Bridging the Sim-to-Real Gap in Semiconductor Visual Program Synthesis via Input Binarization Yusuke Ohtsubo 1 , Kota Dohi 1 , Koichiro Yawata 1 , Koki Takeshita 1 , Tatsuya Sasaki 1 Abstract Precise parametric control over circuit geometry is essential for semiconductor inspection, yet obtaining sufficient real training data remains costly. Although generative models such as diffusion models and Generative Adversarial Networks (GANs) can augment training data, they cannot guarantee the nanometer-scale geometric accuracy required for metrology tasks. We propose a visual program synthesis framework in which a Vision-Language Model (VLM) converts inspection images into editable Domain-Specific Language (DSL) code describing circuit geometries, enabling controlled generation of training data with exact parameter manipulation. Because the VLM is trained solely on synthetic DSL-rendered data, a domain gap arises when processing real Scanning Electron Microscope (SEM) images. We bridge this gap with an input binarization strategy that strips SEM-specific texture and noise, letting the model focus on geometric structure. On the MIIC dataset, binarized inputs improve the mean Dice coefficient from 0.4393 to 0.5256 over the raw-input baseline, demonstrating that simple texture abstraction substantially mitigates the sim-to-real gap. † † footnotetext: Code is available at https://github.com/YusukeO/eusipco2026-sem-dsl . I Introduction Fig. 1: Overview of the proposed visual program synthesis framework. (1) The VLM is trained on synthetic data pairs created via DSL rendering. (2) During inference, real SEM images are binarized to bridge the sim-to-real gap, enabling the robust reconstruction of editable DSL. We propose a visual program synthesis framework that converts semiconductor inspection images into a reproducible domain-specific language (DSL). DSLs are purpose-built languages that trade generality for concise, precise, and editable domain representations. With direct parameter control, built-in rule checking, and high reproducibility, they are standard in semiconductor design. By manipulating code parameters such as linewidth and length, we can actively generate training data for downstream tasks, including circuit linewidth measurement and denoising. This also enables controlled generation of hard negatives, critical areas, and topology-induced domain shifts that are difficult to collect from real samples. Accurate manipulation at the nanometer scale is essential for semiconductor circuit images. While generative models like diffusion models [ 1 ] and Generative Adversarial Networks [ 2 ] offer natural-language-based control, they are ill-suited for such precise geometric control. In contrast, code-level description allows for operations directly linked to design parameters, making it highly suitable for this domain. Existing research on image-to-code conversion, such as ChartCoder [ 3 ] and pix2code [ 4 ] , is limited to environments where image-code pairs are readily available (e.g., web data). Other approaches like Im2Vec [ 5 ] convert general images into primitive sets but require specialized network designs for each domain. Unlike rigid Computer-Aided Design (CAD) recovery tools with fixed syntax, our approach treats the language specification itself as a design variable. The same Vision-Language Model (VLM) architecture can therefore be reused across inspection domains by changing only the Domain-Specific Language (DSL). We define a DSL tailored to our objectives and train a VLM using a large volume of synthetic data generated via this DSL. However, a domain gap exists between the DSL-derived synthetic data and the real SEM images used during inference, primarily due to noise and texture inherent to SEM imaging. To address this, we investigate the following research question: Does inference-time input binarization reduce the domain gap when real SEM images are input to the VLM? It is not self-evident that binarization alone suffices, as other geometric domain gaps (e.g., corner rounding, beam-induced distortion) also exist. However, we hypothesize that texture and noise are the dominant factors hindering VLM inference, and thus texture abstraction via binarization yields substantial gains. Furthermore, this aligns with downstream workflows like Design Rule Checking and connectivity analysis, where binarization is a standard precursor. The main contribution of this study is demonstrating that input binarization effectively reduces structural domain gaps by abstracting texture information in real-world applications. II Related Work II-A Parametric Generation and Image-to-Code Parametric or code-based image generation is attractive when geometric precision matters. Prior work recovers CAD commands from drawings [ 6 ] or generates executable CAD scripts from text [ 7 ] . However, these methods often rely on predefined, rigid command sets typical of standard CAD software. We extend this paradigm to semiconductor inspection by introducing a flexible framework where the language itself is a design variable. In this study, we define a lightweight DSL for Manhattan layouts and learn image-to-DSL translation with a VLM. We further verify the effect of input binarization in this context, which may also offer insights for CAD recovery tasks. II-B Structure-aware Domain Adaptation In document image analysis, binarization is established as a method to remove noise and extract domain-invariant structural features from degraded images [ 8 ] . Our proposed ”binary input” extends these structure-centric adaptation strategies. By intentionally discarding SEM-specific noise and texture, we create an environment where the VLM can focus solely on the geometric features necessary for DSL inference. III Methodology This section describes the definition of the DSL for semiconductor geometries, synthetic data generation, VLM training, and the binarization preprocessing for real images. III-A Design of Semiconductor DSL We designed a DSL tailored for Manhattan wiring architectures. Unlike raster images, this DSL describes circuit patterns using vector-based geometric commands. As shown in Fig. 2 , the DSL structure follows a hierarchical definition starting with the canvas, followed by wiring paths and vias. First, the drawing area is defined. The coordinate system originates at the top-left (0,0) , with the x-axis extending right and the y-axis down: \texttt{CANVAS}(W,H), (1) where W and H denote the width and height of the image (e.g., 256\times 256 in Fig. 2 ). The core component, WIRE , abstracts a continuous conductive trace. To capture semiconductor-specific geometries such as contact pads or lithography artifacts, we explicitly parameterize the ”dogbone” shape—a local widening at wire ends. The command is defined as: \texttt{WIRE}(x_{0},y_{0},w_{base},l_{s},w_{s},l_{e},w_{e},\mathcal{S}). (2) Here, (x_{0},y_{0}) is the starting coordinate and w_{base} is the primary linewidth. The parameters l_{s},w_{s} (length, width) and l_{e},w_{e} define the geometry of the start and end caps, respectively. For instance, setting w_{s}>w_{base} creates a dogbone shape typically used for stable via connections, as observed in the vertical lines of Fig. 2 (c). If l_{s}=0 , the wire has a standard flush end. \mathcal{S} represents the routing path as a sequence of Manhattan segments. Instead of absolute coordinates, \mathcal{S} is described as a chain of relative movements: \mathcal{S}=\{(d_{1},l_{1}),(d_{2},l_{2}),\dots\}, (3) where d_{i}\in\{H,V\} indicates the direction (Horizontal/Vertical) and l_{i} specifies the length. This corresponds to the notation like H 60 V 16 in Fig. 2 (a), enabling flexible ”one-stroke” routing descriptions. Finally, interlayer connections are represented by: \texttt{VIA}(x,y,r), (4) which places a circular via of radius r at (x,y) . By combining these primitives, the DSL can compactly represent complex circuit topologies ranging from simple lines to maze-like patterns. III-B Synthetic Data Generation for VLM Training We categorized real SEM image topologies into three types: Vertical Stripes , Horizontal Lines , and Manhattan . To prevent the model from overfitting to specific spatial frequencies or densities, we treated DSL structural parameters as broad probability distributions rather than fixed values, thereby maximizing scale and structural diversity. Specifically, we randomized grid divisions and wiring densities for each image generation, where \mathcal{U} denotes the uniform distribution. (1) For Vertical Stripes , we varied the number of vertical columns N_{col}\sim\mathcal{U}(8,16) and wiring probability p_{wire}\sim\mathcal{U}(0.5,0.9) . (2) For Horizontal Lines , we manipulated the number of bands N_{band}\sim\mathcal{U}(8,16) and gap rate p_{gap}\sim\mathcal{U}(0.0,0.4) . (3) For Manhattan , we varied lane counts N_{lane}\sim\mathcal{U}(12,24) and bend probability p_{bend}\sim\mathcal{U}(0.4,0.8) to cover structures ranging from simple wires to complex maze-like patterns. These ranges were determined based on statistical analysis of the MIIC dataset to ensure the generated patterns cover real-world circuit geometries. Across all three types, the linewidth w_{base} was sampled from a uniform distribution of 7 – 15 px, and one-sided salt impulse noise was injected independently by setting each pixel to the salt value with probability 0.01. Because the images are binary and the corruption is impulse-like, we report this perturbation by its pixel corruption rate rather than a signal-to-noise ratio. Through this pipeline, we generated 19,200 image-DSL pairs (Train: 18,900, Eval: 300) for VLM training. (a) Manhattan Wiring Pattern ⬇ CANVAS 256 256 WIRE 0 12 8 0 0 0 0 H 256 WIRE 0 28 8 0 0 20 12 H 80 WIRE 100 28 8 20 12 0 0 H 156 WIRE 0 44 8 0 0 0 0 H 180 WIRE 200 44 8 20 12 0 0 H 56 ... (10 lines omitted ) ... WIRE 160 220 8 20 12 20 12 H 60 WIRE 0 236 8 0 0 0 0 H 256 (b) Horizontal Line Pattern ⬇ CANVAS 256 256 WIRE 0 20 14 0 0 0 0 H 256 WIRE 0 50 14 0 0 0 0 H 256 WIRE 0 80 14 0 0 0 0 H 256 WIRE 0 110 14 0 0 0 0 H 256 WIRE 0 140 12 0 0 0 0 H 256 ... (4 lines omitted ) ... WIRE 0 235 12 0 0 0 0 H 256 WIRE 0 245 10 0 0 0 0 H 256 (c) Vertical Stripe Pattern ⬇ CANVAS 256 256 WIRE 12 0 10 0 0 30 14 V 60 WIRE 12 100 10 30 14 30 14 V 80 VIA 35 40 6 WIRE 55 0 10 0 0 0 0 V 256 WIRE 75 0 10 0 0 30 14 V 200 ... (9 lines omitted ) ... WIRE 215 0 10 0 0 30 14 V 180 WIRE 235 0 10 0 0 0 0 V 256 Fig. 2: Examples of the proposed DSL and corresponding rendered images. (a) Manhattan wiring, (b) Horizontal lines, and (c) Vertical stripes. III-C VLM Architecture and Training We adopted Qwen3-VL-8B [ 9 ] as our model and performed supervised fine-tuning (SFT) to translate input images into DSL. Let \mathcal{D}_{\text{syn}}=\{(x^{\text{syn}}_{n},\mathbf{t}_{n})\}_{n=1}^{N} denote the synthetic training dataset generated from the DSL (Section III-B ), where x^{\text{syn}}_{n} is the rendered image and \mathbf{t}_{n}=(t_{n,1},t_{n,2},\dots,t_{n,L_{n}}) is the corresponding ground-truth DSL sequence of length L_{n} . Note that x^{\text{syn}}_{n} is binary by construction (the renderer outputs black/white patterns with optional salt noise), thus no additional binarization is applied during training. The optimization objective is to find the optimal parameters \theta^{*} that minimize the negative log-likelihood of the conditional probability for the next token prediction: \theta^{*}=\operatorname*{argmin}_{\theta}\left(-\sum_{n=1}^{N}\sum_{i=1}^{L_{n}}\log P_{\theta}(t_{n,i}\mid x^{\text{syn}}_{n},t_{n,