From Mirage to Grounding: Towards Reliable Multimodal Circuit-to-Verilog Code Generation

Guang Yang, Xing Hu 1, Xiang Chen, Xin Xia · 2026

Read From Mirage to Grounding: Towards Reliable Multimodal Circuit-to-Verilog Code Generation by Guang Yang, Xing Hu 1, Xiang Chen, Xin Xia (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-27969.txt.

Introduction

Yang and colleagues expose a flaw in vision-to-code generation for circuits, where models score well even when the diagram is blank. They show models lean on names in the module header to recall standard code templates instead of reading the diagram, a hidden defect they call Mirage. Their anonymised training method, VeriGround, restores genuine visual grounding and rivals a much larger frontier model while refusing blank diagrams.

Catalog record

CREATORGuang Yang, Xing Hu 1, Xiang Chen, Xin Xia
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE57545
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2604.27969

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

From Mirage to Grounding: Towards Reliable Multimodal Circuit-to-Verilog Code Generation Guang Yang, Xing Hu 1, Xiang Chen, Xin Xia Abstract Multimodal large language models (MLLMs) are increasingly used to translate visual artifacts into code, from UI mockups into HTML to scientific plots into Python scripts. A circuit diagram can be viewed as a visual domain-specific language for hardware: it encodes timing, topology, and bit-level semantics that are invisible to casual inspection yet safety-critical once fabricated in silicon. Translating such diagrams into register-transfer-level (RTL) code therefore represents an extreme reliability test for vision-to-code generation. We reveal a phenomenon we call Mirage : replacing a circuit diagram with a blank image leaves Pass@ k k unchanged or even higher, because models bypass the visual input and instead exploit identifier semantics in the module_header to retrieve canonical RTL templates. This constitutes a new, highly covert class of defect in AI-assisted code generation that directly undermines MLLMs’ trustworthiness. To quantify the effect, we construct C2VEval and evaluate eight MLLMs under a paired Normal/Anony protocol in which Anony mode anonymizes all identifiers in both the diagram and the module header; Anony-mode scores drop sharply across all models, confirming that high Normal-mode accuracy is largely a Mirage. We then propose VeriGround (4B), trained with identifier anonymization, refusal augmentation, and D-ORPO (Decision-Focused ORPO) preference alignment that up-weights pivotal generate-or-refuse tokens. VeriGround achieves Functional Pass@1 of 46.11%/42.51% (Normal/Anony) with a False Refusal Rate of only 1.20%/0.00%, while maintaining ≥ \geq 92% Refusal Rate on blank images. With only 4B parameters, VeriGround performs on par with GPT-5.4 under Normal and significantly outperforms all baselines under Anony, confirming genuine visual grounding. The evaluation methodology and training recipe generalize beyond hardware: C2VEval ’s paired protocol can benchmark any vision-to-code pipeline, and VeriGround ’s anonymization-refusal-alignment triad offers a transferable solution for balancing hallucination and over-refusal in AI code generation. I Introduction Image-to-code generation has become a central paradigm in AI-assisted coding. From UI mockups rewritten as HTML [ 6 , 41 , 7 , 49 , 40 , 34 ] , to scientific plots reverse-engineered into reproducible Python scripts [ 38 , 48 , 25 ] , multimodal large language models (MLLMs) are shifting the front-end of software creation from purely textual specifications toward richer visual artifacts. In each of these tasks, the visual input can be viewed as a visual domain-specific language (visual DSL) : a UI mockup specifies layout and interaction semantics, a chart encodes data and rendering logic, and each must be faithfully translated into executable code. Recently, this paradigm has been extended to hardware: MLLMs are used to translate circuit diagrams into synthesizable register-transfer-level (RTL) code, a task we call circuit-to-Verilog code generation [ 37 , 47 ] . A circuit diagram is arguably the demanding visual DSL, because it encodes timing, topology, and bit-level semantics that are invisible to casual inspection yet safety-critical once fabricated in silicon. Fig. 1: Motivating example 1 of the Mirage phenomenon. The model generates correct code regardless of whether the input contains the real circuit diagram or a blank image. Fig. 2: Motivating example 2 of the Mirage phenomenon. When the real circuit diagram is provided, the model generates incorrect Verilog that fails the testbench. When the diagram is replaced by a blank image while the module_header is retained, the model instead produces correct code. While unreliable vision-to-code translation is a general concern across all visual DSLs, the consequences in the hardware domain are uniquely severe [ 44 , 26 ] . RTL sits at the very beginning of the silicon design flow and feeds downstream into synthesis, place-and-route, and fabrication; a single misread schematic can propagate silently through the entire toolchain and materialize as a silicon-level defect whose cost is orders of magnitude higher than a rendering or plotting error. More broadly, if an AI code generator appears to “understand” a visual specification while actually bypassing it, the resulting code carries a covert correctness risk that conventional testing may not catch. This directly threatens MLLMs’ trustworthiness , a core concern of the software engineering community. Circuit-to-Verilog generation therefore serves as a rigorous proving ground: any reliability flaw exposed here is likely to manifest, in milder but equally insidious forms, in other vision-to-code pipelines. Although recent studies have demonstrated the feasibility of using MLLMs to read circuit diagrams and generate Verilog code, a fundamental question remains largely unexplored: do existing MLLMs truly read circuit diagrams, or merely exploit textual shortcuts? Our motivating examples make this concern concrete. In both Fig. 1 and Fig. 2 the model under test is Opus 4.6, one of the current frontier code-generation models. Following standard practice, the module_header (module name, ports, and parameters) is provided as part of the prompt so that the generated interface matches the testbench and Pass@ k can be computed without name-mismatch failures. Yet this seemingly innocuous input turns out to be a powerful textual shortcut. In Fig. 1 , the model produces identical correct code for a half-adder whether the input contains the real circuit or a blank image: the module name TopModule is semantically vacuous, but the output ports sum and cout already reveal the target function, making the diagram redundant. Fig. 2 is even more striking: for fsm_3state , the model fails with the real diagram yet succeeds with a blank image, suggesting that the visual input can actively interfere with generation. We term this failure mode the Mirage phenomenon [ 2 ] : high benchmark scores mask the fact that models rely on textual priors in the module_header rather than genuinely grounding in the visual circuit topology. Mirage constitutes a new, highly covert class of AI code-generation defect: the output may compile and even pass certain tests, yet it was never derived from the visual specification, leaving latent errors that surface only in untested scenarios. A natural way to test this hypothesis is to anonymize the identifiers in both the module_header and the circuit diagram, thereby stripping the semantic cues that enable such shortcuts. Following this idea, we construct C2VEval (Circuit-to-Verilog Evaluation), a benchmark that samples problems from established Verilog code-generation benchmarks and renders each reference solution into a circuit diagram via netlistsvg 1 1 1 https://github.com/nturley/netlistsvg , ensuring exact image-code correspondence. C2VEval has two variants: Normal , which retains the original identifiers in both the diagram and the module header, and Anony (anonymized), which replaces all semantically loaded identifiers with positional placeholders and re-renders the diagram accordingly, preserving circuit topology while removing semantic cues. We evaluate eight MLLMs, from 4B open-source models to frontier systems, under each variant in two modes: Original (real diagram provided) and Mirage (diagram replaced by a blank image, header retained). Three findings emerge: (i) under Normal , Mirage mode matches or exceeds Original on every model, suggesting that models largely bypass the circuit diagram and sometimes perform worse when it is present; (ii) under Anony , the Mirage advantage reverses for seven of eight models, isolating identifier semantics in the header as the primary driver of Normal-mode performance; and (iii) genuine visual grounding accounts for only \sim 8–9% of samples, with the vast majority of tasks remaining unsolved once identifier shortcuts are removed. Based on these findings, we first curate a large-scale circuit-diagram-to-Verilog

Read the complete text