PhyDrawGen: Physically Grounded Diagram Generation from Natural Language

arXiv cs.AI Papers

Summary

PhyDrawGen is a neuro-symbolic pipeline that generates physically accurate diagrams from natural language by combining LLM-based scene understanding with a deterministic constraint solver and a VLM-based verify loop, outperforming existing models on a benchmark of physics problems.

arXiv:2605.30512v1 Announce Type: new Abstract: Generating physics diagrams from text requires strict adherence to physical laws. While current generative models produce visually plausible outputs, they systematically hallucinate force vectors, ignore conservation laws, and violate geometric constraints. We present PhyDrawGen, a neuro-symbolic pipeline that decouples semantic scene understanding from physical constraint satisfaction. First, a large language model extracts a typed scene graph from the problem text. A deterministic solver then converts this graph into a Planar Straight-Line Graph (PSLG), encoding force balance, optical paths, and field topologies as exact geometric primitives. Finally, a fine-tuned Qwen-VL model implements a visually grounded propose-verify loop to iteratively correct any constraint violations. Evaluated on a benchmark of 1,449 problems spanning mechanics, optics, and electromagnetism, PhyDrawGen significantly outperforms GPT-5-image, Gemini 2.5 Flash, and Gemini 3 Pro, demonstrating robust physical accuracy even on unusual-object problems.
Original Article
View Cached Full Text

Cached at: 06/01/26, 09:22 AM

# PhyDrawGen: Physically Grounded Diagram Generation from Natural Language
Source: [https://arxiv.org/html/2605.30512](https://arxiv.org/html/2605.30512)
Nafiul Haque Syed Nazmus Sakib11footnotemark:1Shifat E Arman Department of Robotics and Mechatronics Engineering, University of Dhaka

###### Abstract

Generating physics diagrams from text requires strict adherence to physical laws\. While current generative models produce visually plausible outputs, they systematically hallucinate force vectors, ignore conservation laws, and violate geometric constraints\. We presentPhyDrawGen, a neuro\-symbolic pipeline that decouples semantic scene understanding from physical constraint satisfaction\. First, a large language model extracts a typed scene graph from the problem text\. A deterministic solver then converts this graph into a Planar Straight\-Line Graph \(PSLG\), encoding force balance, optical paths, and field topologies as exact geometric primitives\. Finally, a fine\-tuned Qwen\-VL model implements a visually grounded propose\-verify loop to iteratively correct any constraint violations\. Evaluated on a benchmark of 1,449 problems spanning mechanics, optics, and electromagnetism,PhyDrawGensignificantly outperforms GPT\-5\-image, Gemini 2\.5 Flash, and Gemini 3 Pro, demonstrating robust physical accuracy even on unusual\-object problems\.

## 1Introduction

Physics diagrams, free\-body diagrams, ray\-optics constructions, and electromagnetic field maps are formal visual arguments in which every arrow encodes a physical law, every angle encodes a geometric constraint, and every spatial relationship encodes an interaction governed by classical physics\. A force arrow pointing in the wrong direction is not merely an aesthetic defect; it is a false physical claim\. As such the generation of physically grounded scientific diagrams represents a frontier at the intersection of natural language understanding, structured reasoning, and constrained visual synthesis\.

Though diffusion models are capable of producing photorealistic images\(Rombach et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib26); Ramesh et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib25); Saharia et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib27); Ho et al\.,[2020](https://arxiv.org/html/2605.30512#bib.bib10)\)and spatially conditioned generation through adapters\(Zhang et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib37); Mou et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib23); Ye et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib35)\)and grounding mechanisms\(Li et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib18); Bar\-Tal et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib2); Johnson et al\.,[2018](https://arxiv.org/html/2605.30512#bib.bib14)\), the noise\-addition and denoising architecture of diffusion models is fundamentally ill\-suited to tasks that require hard constraint satisfaction\. The denoising process optimizes for perceptual plausibility under a learned prior, not for algebraic correctness under physical law\. When applied to physics diagram generation, this manifests as systematic failure: diffusion models hallucinate force directions, place arrows at geometrically inconsistent angles, omit forces that conservation laws require, and conflate visually similar but physically distinct configurations such as static friction opposing motion versus kinetic friction during sliding\.

Recent benchmarks have documented the remarkable ability of large language models \(LLMs\) and vision\-language models \(VLMs\) to*solve*physics problems from diagrams\(He et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib7); Xiang et al\.,[2025](https://arxiv.org/html/2605.30512#bib.bib32); Lu et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib21); Yue et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib36); Lu et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib20)\), demonstrating strong chain\-of\-thought reasoning over structured visual inputs\. Furthermore, LLMs exhibit strong capabilities in structured extraction from natural language, as demonstrated by scene graph generation pipelines\(Gao et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib5)\)and spatial reasoning systems\(Li et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib18)\)\. Crucially, chain\-of\-thought prompting\(Wei et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib31); Kojima et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib15)\)enables LLMs to decompose physics problems into typed entities and relationships — objects, surfaces, physical actions, forces, and geometric constraints — in a form that is amenable to downstream constraint solving\. We leverage this capacity in the opposite direction: rather than parsing a diagram to solve a problem, we parse a problem to construct a diagram\.

We proposePhyDrawGen, a pipeline that separates the semantic task of understanding a physics problem from the symbolic task of satisfying its physical constraints by employing an LLM as a structured scene graph extractor and a deterministic constraint solver as an exact physical verifier\. The constraint solver produces a Planar Straight\-Line Graph \(PSLG\) in which physical laws are encoded as typed geometric primitives that covers mechanics, optics, and electromagnetism under a single representational framework\. The complete output is a standard physics diagram comprising a full scene with labeled force arrows and per\-object free\-body diagrams\.

This approach addresses the discrepancy between probabilistic visual representations and structural physical laws\. By transforming text into symbolic blueprints prior to rendering, we ensure semantic flexibility does not compromise geometric or physical truth\.

We make three contributions:

1. 1\.The PhyDrawGen scene graph schema\.A typed heterogeneous graph whoseConstraintnode vocabulary maps directly to algebraic physical conditions\. The schema covers mechanics, optics, and electromagnetism under a unified typed vocabulary of six node classes and six edge relations\.
2. 2\.The PSLG Constraint Solver\.A deterministic analytical solver that converts the scene graph into a Planar Straight\-Line Graph encoding force balance, optical ray consistency, and field line topology as typed geometric constraint primitives\.
3. 3\.A Learned Constraint Correction Loop\.A vision\-language model fine\-tuned via supervised learning on automatically generated constraint\-violation examples, implementing a propose\-verify correction loop that combines exact symbolic constraint checking with visually\-grounded language model correction\.

## 2Related Work

##### Controlled synthesis and structured generation\.

While diffusion models and spatial adapters have revolutionized text\-to\-image synthesis\(Rombach et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib26); Ramesh et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib25); Saharia et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib27); Ho et al\.,[2020](https://arxiv.org/html/2605.30512#bib.bib10); Song et al\.,[2021](https://arxiv.org/html/2605.30512#bib.bib28); Zhang et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib37); Mou et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib23); Ye et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib35)\), they inherently optimize for visual plausibility under a learned prior rather than hard symbolic constraints\. Consequently, even with advanced layout grounding\(Li et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib18); Bar\-Tal et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib2)\)or sketch guidance\(Xing et al\.,[2026](https://arxiv.org/html/2605.30512#bib.bib33); Vinker et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib30)\), these architectures cannot guarantee that generated force arrows or optical rays adhere to Newton’s or Snell’s laws\. To enforce physical coherence, recent work has increasingly turned to structured intermediate representations\. By conditioning synthesis on typed relational graphs\(Johnson et al\.,[2018](https://arxiv.org/html/2605.30512#bib.bib14); Xu et al\.,[2017](https://arxiv.org/html/2605.30512#bib.bib34); Gao et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib5)\)and utilizing neuro\-symbolic frameworks that decouple semantic reasoning from deterministic verification\(Huang et al\.,[2026](https://arxiv.org/html/2605.30512#bib.bib12)\), systems can achieve robust constraint satisfaction\. PhyDrawGen extends this paradigm; we leverage LLM chain\-of\-thought spatial reasoning\(Li et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib18); OpenAI,[2023](https://arxiv.org/html/2605.30512#bib.bib24); Liu et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib19); Bai et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib1); Wei et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib31); Kojima et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib15)\)but replace general spatial semantics with a domain\-specific vocabulary grounded strictly in classical physics\.

![Refer to caption](https://arxiv.org/html/2605.30512v1/x1.png)Figure 1:The overall pipeline of PhyDrawGen\. To bridge semantic understanding and algebraic exactness, a language model \(GPT\-4o\) extracts a typed scene graph from the text \(left box\)\. A solver converts it into a Planar Straight\-Line Graph enforcing physical primitives \(middle box\), while a Qwen\-VL loop iteratively corrects violations before rendering\.
##### Physics reasoning and diagram understanding\.

The ability of vision\-language models to reason over physics diagrams has been extensively benchmarked\(He et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib7); Xiang et al\.,[2025](https://arxiv.org/html/2605.30512#bib.bib32); Lu et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib21); Yue et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib36); Lu et al\.,[2024](https://arxiv.org/html/2605.30512#bib.bib20)\), revealing strong chain\-of\-thought performance on diagram\-based problem solving across mechanics, optics, and electromagnetism\. These benchmarks establish that current models can*interpret*physics diagrams with high accuracy, yet the inverse capability which is*generating*physically correct diagrams from natural language has received minor attention\. Physics education research has long documented that even advanced students who conceptually understand force and motion frequently fail to construct geometrically correct diagrams\(Vignal and Wilcox,[2022](https://arxiv.org/html/2605.30512#bib.bib29); Hestenes et al\.,[1992](https://arxiv.org/html/2605.30512#bib.bib9)\)\. Translating conceptual understanding into geometric exactness requires a formal mathematical foundation\. We draw on constrained quasiconformal mapping\(Lai et al\.,[2026](https://arxiv.org/html/2605.30512#bib.bib17)\)and flat\-foldability theory\(Demaine and O’Rourke,[2007](https://arxiv.org/html/2605.30512#bib.bib4); Bern and Hayes,[1996](https://arxiv.org/html/2605.30512#bib.bib3); Hull,[2002](https://arxiv.org/html/2605.30512#bib.bib13)\), which establish a theoretical link between origami vertex closure and force balance, to build our PSLG constraint primitives\. By integrating this rigorous geometric vocabulary, PhyDrawGen provides the first end\-to\-end framework that formalizes physics diagram generation as a structured prediction problem with exact algebraic verification\.

## 3Methodology

### 3\.1Scene Graph Extraction

Given a physics problem textPP, we extract a typed heterogeneous scene graph𝒢=\(𝒱,ℰ\)\\mathcal\{G\}=\(\\mathcal\{V\},\\mathcal\{E\}\)using GPT\-4o with chain\-of\-thought self\-checking\(Wei et al\.,[2022](https://arxiv.org/html/2605.30512#bib.bib31); OpenAI,[2023](https://arxiv.org/html/2605.30512#bib.bib24)\)\. To structure the physical semantics, the node set𝒱\\mathcal\{V\}is partitioned into six classes:Object𝒱O\\mathcal\{V\}\_\{O\}\(mass, charge, radius\),Surface𝒱S\\mathcal\{V\}\_\{S\}\(inclination, friction, refractive index\),Action𝒱A\\mathcal\{V\}\_\{A\}\(e\.g\.,static\_equilibrium,rolling\),Force𝒱F\\mathcal\{V\}\_\{F\}\(type, direction, normalized magnitude\),Spatial𝒱S​p\\mathcal\{V\}\_\{Sp\}\(normalized 2D coordinates and orientation\), andConstraint𝒱C\\mathcal\{V\}\_\{C\}\(explicit geometric conditions likeperpendicularorvector\_closure\)\. The edge setℰ\\mathcal\{E\}captures relations \(Acts\_On,Contacts,Interacts\_With,Applies\_To,Spatially\_At,Constrained\_By\), each typed by domaind∈\{mech,optics,em\}d\\in\\\{\\textsc\{mech\},\\textsc\{optics\},\\textsc\{em\}\\\}\.

The LLM generates a partial graph𝒢LLM=\(𝒱LLM,ℰ,δ\)\\mathcal\{G\}\_\{\\text\{LLM\}\}=\(\\mathcal\{V\}\_\{\\text\{LLM\}\},\\mathcal\{E\},\\delta\), where𝒱LLM=𝒱O∪𝒱S∪𝒱A∪𝒱S​p\\mathcal\{V\}\_\{\\text\{LLM\}\}=\\mathcal\{V\}\_\{O\}\\cup\\mathcal\{V\}\_\{S\}\\cup\\mathcal\{V\}\_\{A\}\\cup\\mathcal\{V\}\_\{Sp\}contains only the extractable entities, andδ\\deltamaps edges to their physics domains\. This extraction factors autoregressively over typed nodes \(typeτv\\tau\_\{v\}, attributes𝐚v\\mathbf\{a\}\_\{v\}\) and edgesτe\\tau\_\{e\}\.pθ​\(𝒢LLM∣P\)=p\_\{\\theta\}\(\\mathcal\{G\}\_\{\\text\{LLM\}\}\\mid P\)=:

∏v∈𝒱LLMpθ​\(τv,𝐚v∣P\)​∏\(u,v,τe\)∈ℰpθ​\(τe∣u,v,P\)\.\\prod\_\{v\\in\\mathcal\{V\}\_\{\\text\{LLM\}\}\}p\_\{\\theta\}\(\\tau\_\{v\},\\mathbf\{a\}\_\{v\}\\mid P\)\\prod\_\{\(u,v,\\tau\_\{e\}\)\\in\\mathcal\{E\}\}p\_\{\\theta\}\(\\tau\_\{e\}\\mid u,v,P\)\.\(1\)
Extraction follows a rigorous five\-step prompt sequence: \(A\) identify typed entities; \(B\) classify action states; \(C\) map inter\-object contacts; \(D\) infer spatial positions; and \(E\) self\-verify kinematic consistency \(e\.g\., ensuring allForcenodes have targets and derivable normals\)\. Crucially, the force and constraint sets \(𝒱F,𝒱C\\mathcal\{V\}\_\{F\},\\mathcal\{V\}\_\{C\}\) are not sampled by the LLM\. Instead, they are instantiated deterministically by the downstream constraint solver conditioned on𝒢LLM\\mathcal\{G\}\_\{\\text\{LLM\}\}\. The final graph is serialized as JSON and schema\-validated before rendering\.

### 3\.2PSLG Constraint Solver

Given𝒢LLM\\mathcal\{G\}\_\{\\text\{LLM\}\}, the solver produces a planar straight\-line graph \(PSLG\)ℋ=\(𝒫,𝒜,𝒞\)\\mathcal\{H\}=\(\\mathcal\{P\},\\mathcal\{A\},\\mathcal\{C\}\)— a typed straight\-line embedding in\[0,1\]2\[0,1\]^\{2\}with vertex set𝒫\\mathcal\{P\}, directed edge set𝒜\\mathcal\{A\}carrying absolute anglesθa∈\[0,2​π\)\\theta\_\{a\}\\in\[0,2\\pi\), and geometric constraint set𝒞\\mathcal\{C\}\. Physical laws are encoded as typed constraint primitives, one per domain, derived analytically from the scene graph

\.

##### Mechanics\.

For everyObjectnodeoowith actionstatic\_equilibrium, the solver enforces the vector closure condition

∑i𝐅i=𝟎,\\sum\_\{i\}\\mathbf\{F\}\_\{i\}=\\mathbf\{0\},\(2\)where the sum is over all force vectors applied tooo\. This is aconcurrent\_starprimitive: all force edges meet at the object centroid and their vector sum closes\(Demaine and O’Rourke,[2007](https://arxiv.org/html/2605.30512#bib.bib4)\)\. For aContacts\(o,s\)\(o,s\)edge with surface inclinationθ\\theta, the normal force direction is constrained by

𝐍^⟂𝐬^,𝐬^=\(cos⁡θ,sin⁡θ\),\\hat\{\\mathbf\{N\}\}\\perp\\hat\{\\mathbf\{s\}\},\\quad\\hat\{\\mathbf\{s\}\}=\(\\cos\\theta,\\,\\sin\\theta\),\(3\)the friction force direction satisfies𝐟^∥𝐬^\\hat\{\\mathbf\{f\}\}\\parallel\\hat\{\\mathbf\{s\}\}with sign determined by the direction of impending motion, and gravity is fixed at𝐠^=\(0,−1\)\\hat\{\\mathbf\{g\}\}=\(0,\-1\)\. Forrollingobjects, the torque constraintτ=f⋅r=I​α\\tau=f\\cdot r=I\\alphais encoded as an additionalConstraintnode linking the friction force edge to the object radius\. For non\-equilibrium objects, Equation[2](https://arxiv.org/html/2605.30512#S3.E2)is relaxed and the residual𝐅net=∑i𝐅i≠𝟎\\mathbf\{F\}\_\{\\text\{net\}\}=\\sum\_\{i\}\\mathbf\{F\}\_\{i\}\\neq\\mathbf\{0\}is emitted as an explicit net\-force edge encoding the acceleration direction\.

##### Optics\.

At each refracting interface, the solver enforces Snell’s law

n1​sin⁡θ1=n2​sin⁡θ2,n\_\{1\}\\sin\\theta\_\{1\}=n\_\{2\}\\sin\\theta\_\{2\},\(4\)wheren1,n2n\_\{1\},n\_\{2\}are the refractive indices from theSurfacenode andθ1,θ2\\theta\_\{1\},\\theta\_\{2\}are the angles of incidence and refraction measured from the surface normal\. For thin lenses, the solver computes the image position from the thin lens equation

1f=1do\+1di,\\frac\{1\}\{f\}=\\frac\{1\}\{d\_\{o\}\}\+\\frac\{1\}\{d\_\{i\}\},\(5\)and encodes the incident parallel ray bundle and refracted convergent fan as aprojective\_dualprimitive\. At mirror surfaces, the reflection lawθr=θi\\theta\_\{r\}=\\theta\_\{i\}is enforced as aConstraintnode with typeangle\_fixed\(Hecht,[2002](https://arxiv.org/html/2605.30512#bib.bib8)\)\.

##### Electromagnetism\.

For point charge interactions, the force on chargeqAq\_\{A\}due to chargeqBq\_\{B\}separated by displacement𝐫\\mathbf\{r\}is directed along

𝐅^A​B=sgn​\(qA​qB\)​𝐫\|𝐫\|,\\hat\{\\mathbf\{F\}\}\_\{AB\}=\\text\{sgn\}\(q\_\{A\}q\_\{B\}\)\\,\\frac\{\\mathbf\{r\}\}\{\|\\mathbf\{r\}\|\},\(6\)with sign enforcing attraction for opposite charges and repulsion for like charges\(Griffiths,[2013](https://arxiv.org/html/2605.30512#bib.bib6)\)\. Field line edges are emitted as directed radial stars with edge count proportional to\|q\|\|q\|, subject to the planarity constraint that no two field line edges cross, encoding Gauss’s law∮𝐄⋅𝑑𝐀=Qenc/ε0\\oint\\mathbf\{E\}\\cdot d\\mathbf\{A\}=Q\_\{\\text\{enc\}\}/\\varepsilon\_\{0\}\(Griffiths,[2013](https://arxiv.org/html/2605.30512#bib.bib6)\)\. For Lorentz force problems, the force direction satisfies

𝐅=q​\(𝐯×𝐁\),\\mathbf\{F\}=q\(\\mathbf\{v\}\\times\\mathbf\{B\}\),\(7\)encoded as across\_productconstraint node requiring𝐅⟂𝐯\\mathbf\{F\}\\perp\\mathbf\{v\}and𝐅⟂𝐁\\mathbf\{F\}\\perp\\mathbf\{B\}simultaneously\. For uniform fields, field line edges form aparallelbundle with translational symmetry encoding∇×𝐄=0\\nabla\\times\\mathbf\{E\}=0\. The complete PSLG is verified against all active constraint nodes before rendering; any violation raises a solver exception and triggers the correction loop described in Section[3\.4](https://arxiv.org/html/2605.30512#S3.SS4)\.

### 3\.3Enriched Scene Graph and Per\-Object Canonical Rendering

Given the PSLGℋ\\mathcal\{H\}from Section[3\.2](https://arxiv.org/html/2605.30512#S3.SS2), we derive an*enriched scene graph*𝒢E\\mathcal\{G\}\_\{E\}fromobject\_cornervertices of each objecto∈𝒱Oo\\in\\mathcal\{V\}\_\{O\}and recording its verified bounding box𝐛o\\mathbf\{b\}\_\{o\}, centroid𝐩o\\mathbf\{p\}\_\{o\}, and contact point𝐜o\\mathbf\{c\}\_\{o\}; this surfaces geometric quantities the solver has already fixed, no new information is introduced\. To render each object the SVG renderer requires a label\-specific canonical PNG that it embeds inside𝐛o\\mathbf\{b\}\_\{o\}at the object’s PSLG orientation\. This stage is fully label\-driven and human\-free: for every labelℓo\\ell\_\{o\}in𝒢E\\mathcal\{G\}\_\{E\}we strip qualifiers \(*heavy*,*small*,*hanging*, …\) to a head nounℓ~o\\tilde\{\\ell\}\_\{o\}, slot it into a flat\-illustration templateϕ​\(ℓ~o\)\\phi\(\\tilde\{\\ell\}\_\{o\}\), and drawNNcandidates from SDXL conditioned on that prompt, retaining the best by a connected\-component filter\{Io\(k\)\}k=1N∼pSDXL\(⋅\|ϕ\(ℓ~o\)\)\\\{I\_\{o\}^\{\(k\)\}\\big\\\}\_\{k=1\}^\{N\}\\;\\sim\\;p\_\{\\text\{SDXL\}\}\\\!\\left\(\\cdot\\,\\big\|\\,\\phi\(\\tilde\{\\ell\}\_\{o\}\)\\right\)\. The final render object then becomes:

Io⋆=arg⁡maxk⁡1​\[C​\(Io\(k\)\)≥τ\]​s​\(Io\(k\)\),\\displaystyle\\qquad I\_\{o\}^\{\\star\}\\;=\\;\\arg\\max\_\{k\}\\;\\mathbb\{1\}\\\!\\big\[C\(I\_\{o\}^\{\(k\)\}\)\\geq\\tau\\big\]\\,s\(I\_\{o\}^\{\(k\)\}\),\(8\)whereC​\(⋅\)C\(\\cdot\)is the largest\-connected\-component foreground ratio afterrembgbackground removal,s​\(⋅\)s\(\\cdot\)is a silhouette quality score, andτ=0\.75\\tau=0\.75\. The selectedIo⋆I\_\{o\}^\{\\star\}is cached and reused by any later problem that mentions the same noun; a small set of primitive keys \(point\_mass,rope,wire,point\_charge,sphere\) is drawn procedurally withpilinstead, while every other label including unseen cases follow Eq\.[8](https://arxiv.org/html/2605.30512#S3.E8)on first use\.

### 3\.4Constraint Correction via Supervised Fine\-Tuning

Despite strong LLM extraction, scene graphs occasionally contain placement errors or missing relationships that propagate to constraint violations in the PSLG\. We address this with a Qwen2\.5\-VL\-3B\-Instruct\(Bai et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib1)\)correction modelπϕ\\pi\_\{\\phi\}fine\-tuned on automatically generated constraint\-violation examples, implementing a propose\-verify loop\.

##### Training data generation\.

For each problem in the training set, we run the PSLG solver and record every constraint violation with its analytical correction\. A violation instance is a tuple\(Isvg,𝒢,c,Δ∗\)\(I\_\{\\text\{svg\}\},\\,\\mathcal\{G\},\\,c,\\,\\Delta^\{\*\}\), whereIsvgI\_\{\\text\{svg\}\}is the rendered SVG image,𝒢\\mathcal\{G\}is the current scene graph JSON,ccis a structured violation description, andΔ∗\\Delta^\{\*\}is the analytically derived correction patch\. Correction patches are derived without human annotation: for a force balance violation with residual𝐫=∑i𝐅i≠𝟎\\mathbf\{r\}=\\sum\_\{i\}\\mathbf\{F\}\_\{i\}\\neq\\mathbf\{0\}, the correction adjusts the responsible force angle by−arg⁡\(𝐫\)\-\\arg\(\\mathbf\{r\}\); for a normal direction violation, the correction setsθN=θs\+90∘\\theta\_\{N\}=\\theta\_\{s\}\+90^\{\\circ\}; for a Snell violation, the correction recomputesθ2\\theta\_\{2\}from Equation[4](https://arxiv.org/html/2605.30512#S3.E4)\. This yields a training corpus derived entirely from the pipeline’s own failures, requiring no external annotation\.

##### Training objective\.

The model is fine\-tuned with LoRA adapters\(Hu et al\.,[2021](https://arxiv.org/html/2605.30512#bib.bib11)\)to predict correction patches in a fixed JSON schema, minimisingℒSFT​\(ϕ\)=\\mathcal\{L\}\_\{\\text\{SFT\}\}\(\\phi\)=

𝔼\(I,𝒢,c,Δ∗\)∼𝒟​\[−∑klog⁡πϕ​\(Δk∗∣Isvg,𝒢,c,Δ<k∗\)\]\\mathbb\{E\}\_\{\(I,\\mathcal\{G\},c,\\Delta^\{\*\}\)\\sim\\mathcal\{D\}\}\\left\[\-\\sum\_\{k\}\\log\\pi\_\{\\phi\}\\\!\\left\(\\Delta^\{\*\}\_\{k\}\\mid I\_\{\\text\{svg\}\},\\,\\mathcal\{G\},\\,c,\\,\\Delta^\{\*\}\_\{<k\}\\right\)\\right\]\(9\)whereΔk∗\\Delta^\{\*\}\_\{k\}denotes thekk\-th token of the correction patch\. The training signal is further structured by three physics\-informed auxiliary losses\. The closure loss

ℒclosure=‖∑i𝐮^i‖2,\\mathcal\{L\}\_\{\\text\{closure\}\}=\\left\\\|\\sum\_\{i\}\\hat\{\\mathbf\{u\}\}\_\{i\}\\right\\\|^\{2\},\(10\)where𝐮^i\\hat\{\\mathbf\{u\}\}\_\{i\}is the unit vector in the direction of theii\-th predicted force arrow, penalises deviations from vector closure at equilibrium vertices and is set to zero for non\-equilibrium objects\. The geometry loss

ℒgeom=∑j‖𝐩j−𝐩j∗‖2,\\mathcal\{L\}\_\{\\text\{geom\}\}=\\sum\_\{j\}\\left\\\|\\mathbf\{p\}\_\{j\}\-\\mathbf\{p\}\_\{j\}^\{\*\}\\right\\\|^\{2\},\(11\)penalises deviation of each predicted attachment point𝐩j\\mathbf\{p\}\_\{j\}from its physics\-correct target𝐩j∗\\mathbf\{p\}\_\{j\}^\{\*\}derived from the SAM\-detected object boundary\. The relation loss

ℒrel=∑e∈ℰcontact\(𝐍^e⋅𝐬^e\)2,\\mathcal\{L\}\_\{\\text\{rel\}\}=\\sum\_\{e\\in\\mathcal\{E\}\_\{\\text\{contact\}\}\}\\left\(\\hat\{\\mathbf\{N\}\}\_\{e\}\\cdot\\hat\{\\mathbf\{s\}\}\_\{e\}\\right\)^\{2\},\(12\)penalises deviation from the perpendicularity constraint in Equation[3](https://arxiv.org/html/2605.30512#S3.E3)for each active contact edge\. The total training loss is

ℒ=ℒSFT\+ℒclosure\+ℒgeom\+ℒrel,\\mathcal\{L\}=\\mathcal\{L\}\_\{\\text\{SFT\}\}\+\\mathcal\{L\}\_\{\\text\{closure\}\}\+\\mathcal\{L\}\_\{\\text\{geom\}\}\+\\mathcal\{L\}\_\{\\text\{rel\}\},\(13\)
![Refer to caption](https://arxiv.org/html/2605.30512v1/physics_fig1.3_alt.jpg)Figure 2:Qualitative comparison on standard mechanics problems\. Each row shows the input problem, outputs from GPT\-5\-image, Gemini 2\.5 Flash, Gemini 3 Pro, and PhyDrawGen \(ours\)\. Force arrows in baseline outputs frequently point in incorrect directions or violate equilibrium; PhyDrawGen arrows are derived analytically from the PSLG and satisfy all encoded constraints by construction\.

### 3\.5Evaluation Metrics

We use a single set of*neutral*ground\-truth arrows, derived once per problem from the GPT\-extracted scene graph𝒢LLM\\mathcal\{G\}\_\{\\text\{LLM\}\}and the problem textPPvia closed\-form textbook physics formulas \(catalogued in Appendix[C\.3](https://arxiv.org/html/2605.30512#A3.SS3)\)\. This ground truth is completely independent of the constraint solver\. Let𝒜⋆​\(p\)=\{\(θi⋆,ℓi⋆\)\}i=1Np\\mathcal\{A\}^\{\\star\}\(p\)=\\\{\(\\theta\_\{i\}^\{\\star\},\\ell\_\{i\}^\{\\star\}\)\\\}\_\{i=1\}^\{N\_\{p\}\}denote the neutral ground\-truth set of angles and force labels for problempp, and let𝒜^​\(p\)=\{\(θ^j,ℓ^j\)\}j=1N^p\\hat\{\\mathcal\{A\}\}\(p\)=\\\{\(\\hat\{\\theta\}\_\{j\},\\hat\{\\ell\}\_\{j\}\)\\\}\_\{j=1\}^\{\\hat\{N\}\_\{p\}\}denote the predicted set \(Hough segments or VLM\-judged arrows, defined below\)\. All three metrics use this same neutral𝒜⋆​\(p\)\\mathcal\{A\}^\{\\star\}\(p\)and are scored at a tolerance threshold ofτ=10∘\\tau=10^\{\\circ\}unless otherwise noted\.

##### Hough\-CSR\.

For each rendered diagram, we apply a Canny edge detector followed by the probabilisticHoughLinesPsegment detector\(Matas et al\.,[2000](https://arxiv.org/html/2605.30512#bib.bib22)\)to produce𝒜^​\(p\)\\hat\{\\mathcal\{A\}\}\(p\)\. A greedy minimum\-angular\-distance assignment matches each predicted segment to one ground\-truth arrow within a20∘20^\{\\circ\}admissibility gate, yielding a matched setℳ​\(p\)\\mathcal\{M\}\(p\)\. The binaryHough\-CSR\(Constraint Satisfaction Rate\) metric for a problem is 1 if and only if every expected arrow is matched \(\|ℳ​\(p\)\|=Np\|\\mathcal\{M\}\(p\)\|=N\_\{p\}\) and the maximum angular error among all matches is≤τ\\leq\\tau\. We additionally report the mean angular error and the detection rate\|ℳ​\(p\)\|/Np\|\\mathcal\{M\}\(p\)\|/N\_\{p\}averaged across problems\.

##### VCSR and LblCSR\.

A frozen VLM judge \(Claude Opus 4\.7\) receives the rendered diagram alongside the problem text and is prompted to enumerate every visible arrow as a tuple\(θ^j,ℓ^j,o^j\)\(\\hat\{\\theta\}\_\{j\},\\hat\{\\ell\}\_\{j\},\\hat\{o\}\_\{j\}\)of angle, force\-type label, and originating object\. The judge’s output is parsed into𝒜^​\(p\)\\hat\{\\mathcal\{A\}\}\(p\)and Hungarian\-matched\(Kuhn,[1955](https://arxiv.org/html/2605.30512#bib.bib16)\)to the neutral ground truth𝒜⋆​\(p\)\\mathcal\{A\}^\{\\star\}\(p\)under a composite costci​j=α​Δ​θi​j\+γ​𝟙​\[ℓ^j≠ℓi⋆\]c\_\{ij\}=\\alpha\\Delta\\theta\_\{ij\}\+\\gamma\\mathbb\{1\}\[\\hat\{\\ell\}\_\{j\}\\neq\\ell\_\{i\}^\{\\star\}\]\. We report two binary problem\-level metrics: the angle\-onlyVCSR, which requires the maximum angular error of all matches to be≤τ\\leq\\tau, and the stricterLblCSR, which additionally requires exact label agreement \(ℓ^j=ℓi⋆\\hat\{\\ell\}\_\{j\}=\\ell\_\{i\}^\{\\star\}\) for all matched pairs\. Auxiliary statistics include the mean angular error and the label\-match rate\.

##### Blind judge\.

To isolate human\-perceptible diagram quality, a separate frozen VLM \(Claude Sonnet 4\.6\) is shown only the rendered diagram and the problem textPP\. It is prompted to evaluate six force categoriesℱ\\mathcal\{F\}=\{gravity,normal,friction,tension,spring,applied\} assigning each a verdict ofcorrect,wrong,missing, orn/a\. No solver output or ground truth is provided\. TheBlind scorefor a problem is simply the fraction ofcorrectverdicts out of all applicable categories \(excludingn/a\)\. We report the unweighted mean across the problem set, with per\-category correctness rates broken out separately \(see Appendix[C\.4](https://arxiv.org/html/2605.30512#A3.SS4)for the exact prompt and inter\-judge sanity checks\)\.

## 4Experiments and Results

### 4\.1Experimental Setup

##### Implementation details\.

The full PhyDrawGen pipeline runs on a single NVIDIA RTX 4090 32 GB GPU\. Scene graph extraction uses GPT\-4o via API with temperature 0\. The PSLG constraint solver and SVG renderer are deterministic and run in under one second per problem\. The Qwen2\.5\-VL\-3B\-Instruct correction model is fine\-tuned with LoRA adapters\(Hu et al\.,[2021](https://arxiv.org/html/2605.30512#bib.bib11)\)for 16K iterations on the automatically generated violation dataset of 1\.8k instances\. Object rendering uses SDXL with MistoLine ControlNet\(Zhang et al\.,[2023](https://arxiv.org/html/2605.30512#bib.bib37)\)at 1024×\\times1024 resolution\. Training the correction model requires 24–27 GB; inference for a complete diagram requires 6–9 GB\.

##### Baselines\.

We compare against three state\-of\-the\-art generative models: GPT\-5\-image, Gemini 2\.5 Flash, and Gemini 3 Pro\. All three are prompted directly with the problem text and asked to generate a physics diagram with labeled force arrows; no additional spatial conditioning or structured intermediate representation is provided\.

### 4\.2Standard Textbook Problems

Table 1:Results on mechanics, optics, and electromagnetism problems\. VCSR is the VLM\-judged constraint satisfaction rate measuring geometric arrow correctness; LblCSR additionally requires correct force labels;Δang\\Delta\_\{\\text\{ang\}\}is mean angular error in degrees; Blind is the blind VLM judge score\. PhyDrawGen achieves the lowest angular error by 5x and the highest scores on all semantic and holistic metrics\.Table 2:Per\-force\-type blind judge scores mechanics subset\. Grv: gravity\. Nrm: normal\. Frc: friction\. Tns: tension\. Spr: spring\. Apl: applied\. PhyDrawGen leads on four of six force types\.Table[1](https://arxiv.org/html/2605.30512#S4.T1)reports results on problems across mechanics, optics, and electromagnetism problems\. PhyDrawGen achieves 94\.7% VCSR and 77\.9% LblCSR, outperforming all baselines on both correctness metrics and reaching the highest blind judge score of 65\.8%, above Gemini 3 Pro at 60\.2%\. The mean angular error of 0\.4° is an order of magnitude lower than every baseline, confirming that PSLG\-derived arrows are geometrically exact rather than approximately correct\.

![Refer to caption](https://arxiv.org/html/2605.30512v1/physics_fig2.1.jpg)

![Refer to caption](https://arxiv.org/html/2605.30512v1/physics_fig2.2.jpg)

Figure 3:Qualitative comparison on open\-vocabulary problems\. Baseline models produce visually plausible renderings of unusual objects but systematically misplace or omit force arrows\. PhyDrawGen derives all arrow geometry from the PSLG independently of object identity, achieving correct force placement for elephants, cyclists, and penguins as readily as for standard physics blocks\.Table[2](https://arxiv.org/html/2605.30512#S4.T2)breaks down blind judge scores by force type on the mechanics subset\. PhyDrawGen achieves 100% on gravity and spring forces and leads on friction, consistent with the PSLG’s explicit enforcement of vertical gravity, surface\- perpendicular normals, and surface\-parallel friction directions\. Tension and applied force scores are lower across all methods\.

### 4\.3Open\-Vocabulary Problems

Table 3:Results on Open\-Vocabulary\-65, where physical objects are arbitrary real\-world entities such as elephants, dogs, penguins, pumpkins, cyclists, rather than standard physics apparatus\. PhyDrawGen leads on all objective metrics by a wide margin, demonstrating that constraint satisfaction generalises when object identity provides no implicit geometric prior\. The blind judge gap versus Gemini 3 Pro reflects the latter’s stronger visual rendering of unusual objects\.Open\-vocabulary problems probe a qualitatively different capability from standard textbook diagrams: the pipeline must generalise to objects e\.g\., elephants, watermelons, penguins, cartoon cats, cyclists that carry no implicit geometric prior about where forces should attach or in what direction they should point\. A block on an incline always has a rectangular footprint; an elephant on the same incline does not, and no physics\-specific training signal tells the model what an elephant looks like\. This set therefore directly tests whether physical constraint satisfaction is genuinely decoupled from object identity, which is the central architectural claim of PhyDrawGen\.

Figure[3](https://arxiv.org/html/2605.30512#S4.F3)shows qualitative outputs on three representative open\-vocabulary problems; Table[3](https://arxiv.org/html/2605.30512#S4.T3)reports quantitative results across the full set\. PhyDrawGen achieves 92\.3% VCSR against GPT\-5\-image’s 46\.2%, a margin of more than 46 percentage points, and Label\-CSR of 73\.8% leads all baselines by a similarly large margin, confirming that force directions are derived from action and contact edges in the scene graph rather than from object identity\. The blind judge score of 53\.4% marginally lags Gemini 3 Pro’s 55\.2%, a notable result given that Gemini produces visually richer scene synthesis\. The objective correctness advantage is preserved even where our visual rendering of unusual objects is more schematic\.

## 5Ablation Studies

Table 4:Ablation: SFT recovery on 80 perturbed instances\.Conv\.is the fraction fully resolved withinTmax=5T\_\{\\text\{max\}\}\{=\}5iterations\. VCSR is the primary signal; Hough\-V1 is noisy on this small mechanics\-only set\.To evaluate the contribution of the Qwen\-VL constraint\-correction loop \(Section[3\.4](https://arxiv.org/html/2605.30512#S3.SS4)\), we construct a synthetic perturbation testbed of 80 held\-out mechanics instances by applying two violation classes to clean GPT\-4o\-extracted scene graphs:Normal\-Direction Error\(incline surface angle rotated by±\[12∘,90∘\]\\pm\[12^\{\\circ\},90^\{\\circ\}\]\) andBBox\-Placement Error\(spatial node position shifted by±\[0\.04,0\.25\]\\pm\[0\.04,0\.25\]on a random axis\)\. We compare three conditions scored against the same neutral ground truth:Clean GT\(unperturbed ceiling\),Perturbed \(no SFT\)\(perturbed scene graph rendered as\-is\), andPerturbed \+ SFT\(perturbed graph corrected by the propose\-verify loop withTmax=5T\_\{\\text\{max\}\}\{=\}5\)\. As reported in Table[4](https://arxiv.org/html/2605.30512#S5.T4), removing the SFT loop drops VCSR by 19\.2 pp \(68\.0%→\\to48\.8%\) and raises mean angular error from1\.6∘1\.6^\{\\circ\}to5∘5^\{\\circ\}, confirming that perturbations propagate faithfully through the solver to the rendered diagram\. The full pipeline with SFT recovers 12\.9 pp of that gap, with 78% of instances fully converging withinTmaxT\_\{\\text\{max\}\}iterations\.

## 6Conclusion

This paper proposes PhyDrawGen, a neuro\-symbolic pipeline for generating physically rigorous science diagrams from natural language\. By decoupling semantic scene understanding from physical constraint satisfaction, PhyDrawGen leverages an LLM to extract typed scene graphs and a deterministic solver to enforce exact geometric primitives \(force balance, optical paths, and field topologies\) via a Planar Straight\-Line Graph \(PSLG\)\. We demonstrate through the introduction of a 1,449\-problem benchmark that this architecture effectively mitigates systematic hallucinations, misplaced force vectors, and conservation law violations prevalent in purely diffusion\-based models\.

## Limitations

While PhyDrawGen successfully enforces hard physical constraints, its reliance on a deterministic, 2D Planar Straight\-Line Graph \(PSLG\) restricts the framework to classical planar interactions, presenting an opportunity for future work to explore learned or dynamic constraint solvers capable of handling arbitrary 3D topologies\. Furthermore, our evaluation benchmark is curated primarily from standard early\-undergraduate physics curricula, omitting highly complex or abstract domains such as Olympiad\-level mechanics or quantum phenomena \(e\.g\., Feynman diagrams\)\. Our baseline comparisons focus exclusively on state\-of\-the\-art proprietary models \(such as GPT\-5\-image and Gemini 3 Pro\) because current open\-weight generative models lack the zero\-shot compositional text\-to\-image capabilities required to serve as meaningful, apples\-to\-apples baselines for this specific diagram\-generation task\. Finally, because the pipeline heavily depends on an initial LLM extraction, severely underspecified geometric parameters in the problem text can result in structural omissions that the downstream visual correction loop capped atTmax=5T\_\{\\text\{max\}\}\{=\}5iterations cannot always resolve\.

## Ethics Statement

PhyDrawGen is intended to support physics education and the authoring of scientifically accurate teaching material; it generates diagrams from textbook\-style problem statements and does not process personal, sensitive, or private data\. Our evaluation benchmark is constructed from standard early\-undergraduate physics problems and contains no human\-subject information\. The human\-judge study reported in Appendix[C\.1](https://arxiv.org/html/2605.30512#A3.SS1)involved adult volunteers who participated voluntarily and anonymously, viewing only rendered diagrams and the accompanying problem text; no personal data was collected\. The pipeline relies on a combination of proprietary APIs \(e\.g\., GPT\-4o\) and open\-weight models \(Qwen2\.5\-VL, SDXL\), each used in accordance with its respective terms of use\. Finally, although our constraint solver enforces physical correctness by construction, generated diagrams may still contain residual errors; we therefore caution against treating the system as a sole authority in safety\-critical or assessment settings without expert review\.

## Acknowledgements

We thank Md Taif Islam Tonmoy and Muhammad Jiyad Hasan for their contributions to formulating the physical reasoning underlying this work, as well as for many valuable discussions on the representation and description of physics diagrams\. Their feedback on the correctness of the mechanics, optics, and electromagnetism constructions was instrumental in shaping this paper\.

## Generative AI Usage

We used a generative AI assistant solely to aid manuscript writing, specifically for grammatical correction and minor stylistic polishing of author\-written text\. It was not used to generate research ideas, conduct experiments, or analyze results\.

## References

- Bai et al\. \(2023\)Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, and Jingren Zhou\. 2023\.[Qwen\-VL: A versatile vision\-language model for understanding, localization, text reading, and beyond](https://arxiv.org/abs/2308.12966)\.*arXiv preprint arXiv:2308\.12966*\.
- Bar\-Tal et al\. \(2023\)Omer Bar\-Tal, Lior Yariv, Yaron Lipman, and Tali Dekel\. 2023\.[MultiDiffusion: Fusing diffusion paths for controlled image generation](https://arxiv.org/abs/2302.08113)\.In*International Conference on Machine Learning*, pages 1737–1752\. PMLR\.
- Bern and Hayes \(1996\)Marshall Bern and Barry Hayes\. 1996\.The complexity of flat origami\.In*Proceedings of the Seventh Annual ACM\-SIAM Symposium on Discrete Algorithms*, SODA ’96, page 175–183, USA\. Society for Industrial and Applied Mathematics\.
- Demaine and O’Rourke \(2007\)Erik D Demaine and Joseph O’Rourke\. 2007\.[*Geometric Folding Algorithms: Linkages, Origami, Polyhedra*](https://doi.org/10.1017/CBO9780511735172)\.Cambridge University Press, Cambridge, UK\.
- Gao et al\. \(2024\)Gege Gao, Weiyang Liu, Anpei Chen, Andreas Geiger, and Bernhard Schölkopf\. 2024\.[Graphdreamer: Compositional 3d scene synthesis from scene graphs](http://arxiv.org/abs/2312.00093)\.
- Griffiths \(2013\)David J Griffiths\. 2013\.*Introduction to electrodynamics*\.Pearson\.
- He et al\. \(2024\)Chaoqun He, Renjie Luo, Yuzhuo Wang, Jiannan Wang, Wei Chu, et al\. 2024\.[OlympiadBench: A challenging benchmark for promoting AGI with olympiad\-level bilingual multimodal scientific problems](https://arxiv.org/abs/2402.14008)\.In*Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics*\.
- Hecht \(2002\)Eugene Hecht\. 2002\.*Optics*, 4th intern edition\.Addison Wesley\.
- Hestenes et al\. \(1992\)David Hestenes, Malcolm Wells, and Gregg Swackhamer\. 1992\.[Force concept inventory](https://doi.org/10.1119/1.2343497)\.*The Physics Teacher*, 30\(3\):141–158\.
- Ho et al\. \(2020\)Jonathan Ho, Ajay Jain, and Pieter Abbeel\. 2020\.[Denoising diffusion probabilistic models](https://arxiv.org/abs/2006.11239)\.In*Advances in Neural Information Processing Systems*, volume 33, pages 6840–6851\.
- Hu et al\. \(2021\)Edward J\. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen\-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen\. 2021\.[Lora: Low\-rank adaptation of large language models](http://arxiv.org/abs/2106.09685)\.
- Huang et al\. \(2026\)Yanjia Huang, Yunuo Chen, Ying Jiang, Jinru Han, Zhengzhong Tu, Yin Yang, and Chenfanfu Jiang\. 2026\.[Learn2fold: Structured origami generation with world model planning](http://arxiv.org/abs/2603.29585)\.
- Hull \(2002\)Thomas C Hull\. 2002\.The combinatorics of flat folds: A survey\.In*Origami3: Third International Meeting of Origami Science, Mathematics, and Education*, pages 29–38\. A K Peters\.
- Johnson et al\. \(2018\)Justin Johnson, Agrim Gupta, and Li Fei\-Fei\. 2018\.[Image generation from scene graphs](https://arxiv.org/abs/1804.01622)\.In*Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition*, pages 1219–1228\.
- Kojima et al\. \(2022\)Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa\. 2022\.[Large language models are zero\-shot reasoners](https://arxiv.org/abs/2205.11916)\.In*Advances in Neural Information Processing Systems*, volume 35, pages 22199–22213\.
- Kuhn \(1955\)Harold W\. Kuhn\. 1955\.[The Hungarian Method for the Assignment Problem](https://doi.org/10.1002/nav.3800020109)\.*Naval Research Logistics Quarterly*, 2\(1–2\):83–97\.
- Lai et al\. \(2026\)Ka Ho Lai, Hei Tung Tsang, Gary P\. T\. Choi, and Lok Ming Lui\. 2026\.[Optimization of constrained quasiconformal mapping for origami design](http://arxiv.org/abs/2604.20137)\.
- Li et al\. \(2023\)Yuheng Li, Haotian Liu, Qingyang Wu, Fangzhou Mu, Jianwei Yang, Jianfeng Gao, Chunyuan Li, and Yong Jae Lee\. 2023\.[GLIGEN: Open\-set grounded text\-to\-image generation](https://arxiv.org/abs/2301.07093)\.In*Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition*, pages 22511–22521\.
- Liu et al\. \(2023\)Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee\. 2023\.[Visual instruction tuning](https://arxiv.org/abs/2304.08485)\.In*Advances in Neural Information Processing Systems*, volume 36\.
- Lu et al\. \(2024\)Pan Lu, Bansal Hritik, Tony Xia, Jiacheng Liu, Chunyuan Li, Hajishirzi Hannaneh, Cheng Hao, Chang Kai\-Wei, Galley Michel, and Gao Jianfeng\. 2024\.[MathVista: Evaluating mathematical reasoning of foundation models in visual contexts](https://arxiv.org/abs/2310.02255)\.In*International Conference on Learning Representations*\.
- Lu et al\. \(2022\)Pan Lu, Swaroop Mishra, Tanglin Xia, Liang Qiu, Kai\-Wei Chang, Song\-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan\. 2022\.[Learn to explain: Multimodal reasoning via thought chains for science question answering](https://arxiv.org/abs/2209.09513)\.In*Advances in Neural Information Processing Systems*, volume 35, pages 2507–2521\.
- Matas et al\. \(2000\)J\. Matas, C\. Galambos, and J\. Kittler\. 2000\.[Robust detection of lines using the progressive probabilistic hough transform](https://doi.org/https://doi.org/10.1006/cviu.1999.0831)\.*Computer Vision and Image Understanding*, 78\(1\):119–137\.
- Mou et al\. \(2024\)Chong Mou, Xintao Wang, Liangbin Xie, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie\. 2024\.[T2I\-Adapter: Learning adapters to dig out more controllable ability for text\-to\-image diffusion models](https://arxiv.org/abs/2302.08453)\.In*Proceedings of the AAAI Conference on Artificial Intelligence*, volume 38, pages 4296–4304\.
- OpenAI \(2023\)OpenAI\. 2023\.[GPT\-4 technical report](https://arxiv.org/abs/2303.08774)\.*arXiv preprint arXiv:2303\.08774*\.
- Ramesh et al\. \(2022\)Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen\. 2022\.[Hierarchical text\-conditional image generation with CLIP latents](https://arxiv.org/abs/2204.06125)\.*arXiv preprint arXiv:2204\.06125*\.
- Rombach et al\. \(2022\)Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer\. 2022\.[High\-resolution image synthesis with latent diffusion models](https://arxiv.org/abs/2112.10752)\.In*Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition*, pages 10684–10695\.
- Saharia et al\. \(2022\)Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S\. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi\. 2022\.[Photorealistic text\-to\-image diffusion models with deep language understanding](http://arxiv.org/abs/2205.11487)\.
- Song et al\. \(2021\)Jiaming Song, Chenlin Meng, and Stefano Ermon\. 2021\.[Denoising diffusion implicit models](https://arxiv.org/abs/2010.02502)\.In*International Conference on Learning Representations*\.
- Vignal and Wilcox \(2022\)Michael Vignal and Bethany R\. Wilcox\. 2022\.[Investigating unprompted and prompted diagrams generated by physics majors during problem solving](https://doi.org/10.1103/physrevphyseducres.18.010104)\.*Physical Review Physics Education Research*, 18\(1\)\.
- Vinker et al\. \(2022\)Yael Vinker, Ehsan Pajouhesh, Jessica Y Bo, Roman Hacohen, B Amit, Hadar Averbuch\-Elor, Daniel Cohen\-Or, and Ariel Shamir\. 2022\.[CLIPasso: Semantically\-aware object sketching](https://arxiv.org/abs/2202.05822)\.*ACM Transactions on Graphics \(TOG\)*, 41\(4\):1–11\.
- Wei et al\. \(2022\)Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, and Denny Zhou\. 2022\.[Chain\-of\-thought prompting elicits reasoning in large language models](https://arxiv.org/abs/2201.11903)\.In*Advances in Neural Information Processing Systems*, volume 35, pages 24824–24837\.
- Xiang et al\. \(2025\)Kun Xiang, Heng Li, Terry Jingchen Zhang, Yinya Huang, Zirong Liu, Peixin Qu, Jixi He, Jiaqi Chen, Yu\-Jie Yuan, Jianhua Han, Hang Xu, Hanhui Li, Mrinmaya Sachan, and Xiaodan Liang\. 2025\.[Seephys: Does seeing help thinking? – benchmarking vision\-based physics reasoning](http://arxiv.org/abs/2505.19099)\.
- Xing et al\. \(2026\)Ximing Xing, Chuang Wang, Haitao Zhou, Jing Zhang, Qian Yu, and Dong Xu\. 2026\.[Diffsketcher: Text guided vector sketch synthesis through latent diffusion models](http://arxiv.org/abs/2306.14685)\.
- Xu et al\. \(2017\)Danfei Xu, Yuke Zhu, Christopher B Choy, and Li Fei\-Fei\. 2017\.[Scene graph generation by iterative message passing](https://arxiv.org/abs/1701.02426)\.In*Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition*, pages 5410–5419\.
- Ye et al\. \(2023\)Hu Ye, Jun Zhang, Sibo Liu, Xiao Han, and Wei Yang\. 2023\.[IP\-Adapter: Text compatible image prompt adapter for text\-to\-image diffusion models](https://arxiv.org/abs/2308.06721)\.*arXiv preprint arXiv:2308\.06721*\.
- Yue et al\. \(2024\)Xiang Yue, Yuansheng Ni, Kai Zhang, Tianyu Zheng, Ruoqi Liu, Ge Zhang, Samuel Stevens, Dongfu Jiang, Weiming Ren, Yuxuan Sun, Cong Wei, Botao Yu, Ruibin Yuan, Renliang Sun, Ming Yin, Boyuan Zheng, Zhenzhu Yang, Yibo Liu, Wenhao Huang, Huan Sun, Yu Su, and Wenhu Chen\. 2024\.[Mmmu: A massive multi\-discipline multimodal understanding and reasoning benchmark for expert agi](http://arxiv.org/abs/2311.16502)\.
- Zhang et al\. \(2023\)Lvmin Zhang, Anyi Rao, and Maneesh Agrawala\. 2023\.[Adding conditional control to text\-to\-image diffusion models](https://arxiv.org/abs/2302.05543)\.In*Proceedings of the IEEE/CVF International Conference on Computer Vision*, pages 3836–3847\.

## Appendix AAdditional Implementation Details

### A\.1GPT Scene Graph Extraction

Stage 1 of the pipeline \(Section[3\.1](https://arxiv.org/html/2605.30512#S3.SS1)\) is implemented as a single GPT\-4o call routed through OpenRouter with temperature 0\. The model receives a system prompt that fixes the schema \(six node classes, six edge classes, force / constraint node types reserved for the solver\), a per\-object bounding\-boxOBJECT\-SIZE GUIDEwith concrete anchors for unusual entities \(elephant≈0\.30×0\.22\\approx 0\.30\\times 0\.22, cat / dog≈0\.10×0\.10\\approx 0\.10\\times 0\.10, wall≈0\.05×0\.60\\approx 0\.05\\times 0\.60, etc\.\), a five\-step chain\-of\-thought scaffold \(Steps A–E covering entities, actions, relationships, spatial layout, observed elements\), and a*mandatory*self\-check block that requires the model to re\-confirm every object has both aSPATIALLY\_ATand anACTS\_ONedge before emitting JSON\. The model writes the self\-check in plain text before the final JSON fence, providing an audit trail\. We keep the prompt frozen across all main\-paper experiments\. The full system prompt and the user\-turn instruction sent alongside each problem are reproduced verbatim below; a controlled ablation that strips the chain\-of\-thought scaffold and self\-check block while preserving the schema and critical rules is reported in Section[B\.1](https://arxiv.org/html/2605.30512#A2.SS1)\.

The full system prompt is split below into six colour\-coded sections for readability: the top\-level schema \(blue\), the four node types \(green / orange / red / yellow\), and the procedure \+ rules \(grey\)\. All content is reproduced verbatim; the section headings here mirror the headings in the source\.

`1\. Top\-level schema and edge types 2\. Object nodes \(type = "object"\) 3\. Surface nodes \(type = "surface"\) 4\. Action nodes \(type = "action"\) 5\. Spatial nodes \+ OBJECT\-SIZE GUIDE 6\. Extraction procedure, critical rules, self\-check GPT\-4o user\-turn instruction \(text\-only problems\)`

`A\.2 Extracted Scene Graph Examples To make the extracted scene graph schema concrete, we show three representative outputs, one per domain, alongside the problem text and the scene graph visualisation rendered from the on\-disk JSON\. Mechanics\. Figure 5 shows the scene graph for mech\_stacked\_pulley\_071: “Two blocks stacked on a frictionless incline connected via a rope over a pulley to a hanging mass\.” Four object nodes \(block A, block B, hanging mass, pulley\) are linked by Acts\_On edges to two action nodes encoding their physical states \(stacked\+sliding and hanging\+accelerating\)\. Contacts edges capture the block\-floor and inter\-block contact; a dashed Interacts\_With edge encodes the rope coupling between the hanging mass and the pulley\. Spatial nodes carry the normalised canvas coordinates the PSLG solver uses to instantiate force attachment points and object bounding boxes\. Figure 4: Top Row: Scene graph of stacked pulley \(mech\_stacked\_pulley\_071\)\. Bottom Row: Final Rendered Diagram of the System Optics\. Figure 4 shows the scene graph for optics\_prism\_015: “A ray enters an equilateral glass prism \(n=1\.6n\{=\}1\.6, apex 45∘45^\{\\circ\}\) at 0∘0^\{\\circ\} incidence; draw the full ray path\.” A single object node \(glass prism\) connects to a refracting action node and two surface nodes for the entry and exit faces via Contacts edges\. Force and constraint nodes are absent at extraction time; the amber PSLG output box indicates the solver will emit three ray edges — incident, refracted inside, and exit, whose angles are computed from Snell’s law \(Eq\. 4\) and the thin\-prism geometry without any LLM involvement\. Figure 5: Top Row: Scene graph of optical prism problem \(optics\_prism\_015\)\. Bottom Row: Final Rendered Diagram of the System Electrostatics\. Figure 6 shows the scene graph for em\_lorentz\_006: “A point charges in q1=\+4​μ​Cq\_\{1\}\{=\}\{\+\}4\\,\\mu\\text\{C\} moves with a velocity −v\-v through a Magentic field B whose field lines are directed toward the \+z\+z axis \(out of the paper\) draw the diagram\.” Positive charge appears with \+\+ symbol\. Three Interacts\_With edges carry the interaction type \(repulsive or attractive\) derived analytically from the charge sign product — subject to the Cross\_Product planarity constraint that encodes Lenz’s Law\. Figure 6: Top Row: Scene graph of moving positive charge in magnetic field \(em\_lorentz\_006\)\. Bottom Row: Final Rendered Diagram of the System A\.3 PSLG Implementation Extended The constraint solver outline in Section 3\.2 is realised by three per\-domain modules sharing the same PSLG vertex / edge schema\. We document each domain below\. A\.3\.1 Mechanics Domain The mechanics solver Σmech\\Sigma\_\{\\text\{mech\}\} realises the force\-mapping output as a star graph at each rigid body\. Each rigid body or point mass oo contributes four object\_boundary edges enclosing a rotated rectangle of size wo×how\_\{o\}\\times h\_\{o\} centred at its spatial node’s bounding region and tangent to its contact surface\. Each Force node f∈𝒱Ff\\in\\mathcal\{V\}\_\{F\} attached to oo becomes a directed force\_vector edge anchored at oo’s applied\_at vertex \(either the body centre or the contact point\), with absolute angle θf\\theta\_\{f\} resolved by the direction operator ϕ\\phi of Eq\. 14; magnitudes default to \|𝐅g\|=mo​g\|\\mathbf\{F\}\_\{g\}\|=m\_\{o\}g for gravity \(when mom\_\{o\} is numeric\) and are otherwise left symbolic for the renderer to scale by a normalised arrow length\. Friction\. Kinetic and static friction directions are not stored in ϕ\\phi; they are computed by projection\. Given the non\-friction forces \{fi\}\\\{f\_\{i\}\\\} acting on oo, friction opposes the net tangential component along the surface tangent 𝐭s\\mathbf\{t\}\_\{s\}: θ𝐅f​\(o\)=atan2​\(−𝐭s⋅∑i:fi≠𝐅f\(cos⁡θfi,sin⁡θfi\)\)\.\\theta\_\{\\mathbf\{F\}\_\{f\}\}\(o\)\\;=\\;\\mathrm\{atan2\}\\Bigg\(\-\\mathbf\{t\}\_\{s\}\\cdot\\\!\\sum\_\{i:f\_\{i\}\\neq\\mathbf\{F\}\_\{f\}\}\\big\(\\cos\\theta\_\{f\_\{i\}\},\\sin\\theta\_\{f\_\{i\}\}\\big\)\\Bigg\)\. \(14\) When the projection is exactly zero \(static block on a horizontal surface with no horizontal forces\) the solver omits the friction edge to avoid arbitrary tie breaking\. Strings and pulleys\. For rope\-mediated interactions, tension on body oo points along the rope segment toward the next routing vertex 𝐩⋆\\mathbf\{p\}\_\{\\star\} \(the connected pulley if any, else the other endpoint\): θ𝐅T​\(o\)=atan2​\(𝐩⋆−𝐩o\)\\theta\_\{\\mathbf\{F\}\_\{T\}\}\(o\)=\\mathrm\{atan2\}\(\\mathbf\{p\}\_\{\\star\}\-\\mathbf\{p\}\_\{o\}\)\. Pulleys themselves contribute a circular object\_boundary approximated as a 12\-gon, plus two constraint\_link edges for the two rope segments they redirect\. Stacked bodies\. When object AA contacts a surface labelled “Top of BB”, Newton’s third law is enforced explicitly by emitting a downward normal\_force edge of equal magnitude on BB, in addition to the upward normal on AA\. A\.3\.2 Optics Domain The optics solver Σoptics\\Sigma\_\{\\text\{optics\}\} produces a ray\-diagram PSLG for thin lenses, plane and curved mirrors, prisms, and umbra/penumbra constructions\. Thin lens\. For a source at object distance dod\_\{o\} along the optical axis at angle θL\\theta\_\{L\} and a lens of focal length ff, the image distance is di=\{do​fdo−f,converging \(f\>0\),−do​fdo\+f,diverging \(f<0\)\.d\_\{i\}\\;=\\;\\begin\{cases\}\\dfrac\{d\_\{o\}f\}\{d\_\{o\}\-f\},&\\text\{converging \($f\>0$\),\}\\\\\[6\.0pt\] \-\\dfrac\{d\_\{o\}f\}\{d\_\{o\}\+f\},&\\text\{diverging \($f<0$\)\.\}\\end\{cases\} \(15\) The transverse magnification m=−di/dom=\-d\_\{i\}/d\_\{o\} places the image vertex 𝐩I=𝐩L\+di​ℓ^\+m​h​ℓ^⟂\\mathbf\{p\}\_\{I\}=\\mathbf\{p\}\_\{L\}\+d\_\{i\}\\hat\{\\boldsymbol\{\\ell\}\}\+mh\\hat\{\\boldsymbol\{\\ell\}\}^\{\\perp\}, where ℓ^\\hat\{\\boldsymbol\{\\ell\}\} is the optical\-axis unit vector and hh is the source’s transverse offset\. The solver emits three canonical rays as ray edges: \(R1\) parallel\-to\-axis incident, refracting through the far focal point 𝐩F\\mathbf\{p\}\_\{F\}; \(R2\) through the near focal point incident, refracting parallel\-to\-axis; \(R3\) through the lens centre, undeviated\. A larger fan of N−3N\-3 additional source\-emanated rays is added to thicken the ray bundle for visual realism, with each fan ray’s refracted angle computed to land at 𝐩I\\mathbf\{p\}\_\{I\} \(so all NN refracted rays remain exactly concurrent at the image vertex by construction\)\. Projective duality constraint\. The thin\-lens duality is encoded as a single projective\_dual PSLG constraint whose primary participants are the incident parallel bundle, secondary participants are the refracted radial fan converging at 𝐩F\\mathbf\{p\}\_\{F\}, and mediating vertex is the lens centre 𝐩L\\mathbf\{p\}\_\{L\}\. A companion concurrent constraint asserts that all refracted rays meet at 𝐩I\\mathbf\{p\}\_\{I\}\. Together these reduce the ray\-diagram correctness check to two linear\-algebra postconditions on 𝒜\\mathcal\{A\} rather than a per\-pair angle comparison\. Reflection and refraction\. Plane and concave mirrors emit incident–reflected ray pairs via the law of reflection, θref=\(2​θn−θinc\+π\)\(mod2​π\)\\theta\_\{\\text\{ref\}\}\\;=\\;\\big\(2\\theta\_\{n\}\-\\theta\_\{\\text\{inc\}\}\+\\pi\\big\)\\pmod\{2\\pi\}, where θn\\theta\_\{n\} is the mirror’s surface\-normal angle\. Prisms emit incident–refracted ray pairs at both faces via Snell’s law, sin⁡θ2=n1n2​sin⁡θ1,\\sin\\theta\_\{2\}\\;=\\;\\frac\{n\_\{1\}\}\{n\_\{2\}\}\\,\\sin\\theta\_\{1\}, \(16\) with θi\\theta\_\{i\} measured from the local face normal, and a total\-internal\-reflection fallback to the reflection rule when \|n1​sin⁡θ1\|\>n2\|n\_\{1\}\\sin\\theta\_\{1\}\|\>n\_\{2\}\. Shadow and penumbra\. A point or extended light source occluded by an opaque body generates two tangent rays grazing the silhouette of the occluder\. These become shadow\_boundary edges; the polygon between them is the umbra \(point source\) or the penumbra delta \(extended source\)\. A\.3\.3 Electromagnetism Domain The EM solver Σem\\Sigma\_\{\\text\{em\}\} handles four sub\-cases: isolated and paired point charges, parallel\-plate capacitors, current\-carrying wires/solenoids, and Lorentz dynamics in uniform fields\. Point\-charge field lines\. Each charge qiq\_\{i\} emits a directed radial star of ni=max⁡\(nmin,⌊\|qi\|​kℓ⌋\)n\_\{i\}=\\max\\\!\\big\(n\_\{\\min\},\\,\\lfloor\|q\_\{i\}\|\\,k\_\{\\ell\}\\rfloor\\big\) field\_line edges \(with line density constant kℓ=8k\_\{\\ell\}=8 per unit charge in our implementation\), uniformly distributed at angles θi,k=2​π​k/ni\\theta\_\{i,k\}=2\\pi k/n\_\{i\}, k=0,…,ni−1k=0,\\ldots,n\_\{i\}\-1\. Edge orientation encodes the sign: \(ps,pt\)=\{\(𝐩qi,𝐩qi\+L​𝐫^i,k\),qi\>0​ \(outward\),\(𝐩qi\+L​𝐫^i,k,𝐩qi\),qi<0​ \(inward\),\(p\_\{s\},\\,p\_\{t\}\)=\\begin\{cases\}\(\\mathbf\{p\}\_\{q\_\{i\}\},\\;\\mathbf\{p\}\_\{q\_\{i\}\}\+L\\hat\{\\mathbf\{r\}\}\_\{i,k\}\),&q\_\{i\}\>0\\text\{ \(outward\),\}\\\\\[2\.0pt\] \(\\mathbf\{p\}\_\{q\_\{i\}\}\+L\\hat\{\\mathbf\{r\}\}\_\{i,k\},\\;\\mathbf\{p\}\_\{q\_\{i\}\}\),&q\_\{i\}<0\\text\{ \(inward\),\}\\end\{cases\} \(17\) where 𝐫^i,k=\(cos⁡θi,k,sin⁡θi,k\)\\hat\{\\mathbf\{r\}\}\_\{i,k\}=\(\\cos\\theta\_\{i,k\},\\sin\\theta\_\{i,k\}\) and LL is the per\-line length\. For multi\-charge systems we record each pair’s separation axis θi​j=atan2​\(𝐩qj−𝐩qi\)\\theta\_\{ij\}=\\mathrm\{atan2\}\(\\mathbf\{p\}\_\{q\_\{j\}\}\-\\mathbf\{p\}\_\{q\_\{i\}\}\) and interaction type \(attractive if qi​qj<0q\_\{i\}q\_\{j\}<0, repulsive otherwise\) as metadata, and assert a planar\_no\_cross constraint over all field lines \(no field line may properly intersect another\)\. Uniform field\. A uniform 𝐄\\mathbf\{E\} field becomes a parallel bundle of equally\-spaced field\_line edges at angle θE\\theta\_\{E\} with a parallel PSLG constraint binding them\. Capacitors instantiate two object\_boundary plate segments perpendicular to 𝐄^\\hat\{\\mathbf\{E\}\} together with the interior parallel field\. Wire and solenoid 𝐁\\mathbf\{B\}\-field\. For an infinite straight wire \(or solenoid cross\-section\) the solver builds \|ℛB\|\|\\mathcal\{R\}\_\{B\}\| concentric circular rings of radius r∈ℛBr\\in\\mathcal\{R\}\_\{B\}, each approximated as a regular KK\-gon \(default K=24K=24\)\. Ring orientation follows the right\-hand rule: counter\-clockwise for current out of the page, clockwise for into\. A concurrent PSLG constraint binds every ring to its central wire\_center vertex, so the renderer can verify ring concentricity without a separate radius check\. Lorentz dynamics\. For a charge qq moving with velocity 𝐯\\mathbf\{v\} in a uniform magnetic field 𝐁\\mathbf\{B\}, the solver computes the full 3D Lorentz force 𝐅=q​𝐯×𝐁=q​\(vy​Bz−vx​Bzvx​By−vy​Bx\),\\mathbf\{F\}\\;=\\;q\\,\\mathbf\{v\}\\times\\mathbf\{B\}\\;=\\;q\\begin\{pmatrix\}v\_\{y\}B\_\{z\}\\\\ \-v\_\{x\}B\_\{z\}\\\\ v\_\{x\}B\_\{y\}\-v\_\{y\}B\_\{x\}\\end\{pmatrix\}, \(18\) with 𝐯\\mathbf\{v\} assumed planar \(vz=0v\_\{z\}=0\)\. The result is classified into three cases: \(i\) \|𝐅\|≈0\|\\mathbf\{F\}\|\\approx 0 — no force edge; \(ii\) in\-plane dominant \(\|Fx​y\|≥\|Fz\|\|F\_\{xy\}\|\\geq\|F\_\{z\}\|\) — a force\_vector edge at θF=atan2​\(Fy,Fx\)\\theta\_\{F\}=\\mathrm\{atan2\}\(F\_\{y\},F\_\{x\}\); \(iii\) out\-of\-plane dominant — the symbol ⊙\\odot or ⊗\\otimes is recorded in metadata so the renderer can draw the pierced/eyed dot directly at the charge position\. Case \(ii\) emits a cross\_product PSLG constraint binding 𝐯,𝐁,𝐅\\mathbf\{v\},\\,\\mathbf\{B\},\\,\\mathbf\{F\} structurally\. Appendix B Additional Ablation Studies B\.1 Five\-Step CoT vs Single\-Prompt Extraction Table 5: Effect of the 5\-step CoT scaffold on the physical correctness of the extracted scene graph, measured downstream on the rendered SVGs\. Comparison is on the 32 problems that produced a valid scene graph under both prompts; both prompts share schema, OBJECT\-SIZE GUIDE, and critical rules and differ only in the step\-by\-step CoT and self\-check block\. The CoT scaffold lifts Hough\-CSR by \+28\.7\+28\.7 pp, VLM\-CSR by \+22\.0\+22\.0 pp, and reduces mean angular error by 7\.2∘7\.2^\{\\circ\}, confirming that the per\-step reasoning produces a more geometrically consistent scene graph\. The single\-prompt variant scores slightly higher on LblCSR \(\+4\.2\+4\.2 pp\); inspection of the extracted graphs shows the naive prompt tends to emit standard\-vocabulary force labels \(gravity, normal, friction\) verbatim, whereas the CoT prompt occasionally produces longer descriptive labels \(normal force from incline\) that fail an exact\-string match in the label\-matching stage even when the angle is correct\. The CoT scaffold’s value is therefore on geometric correctness rather than label canonicality\. The scene\-graph extractor in Section 3\.1 uses a five\-step chain\-of\-thought instruction \(Steps A–E\) that walks the model through entity identification, action classification, relationship extraction, spatial layout, and observed\-elements recording before emitting the final JSON\. We ablate this prompt structure against a single\-prompt variant that retains the schema definition and critical rules but drops the step\-by\-step scaffold and the self\-check block\. The two prompts differ by 37 lines and 2474 characters out of 179 lines / 10601 characters total; all schema information, OBJECT\-SIZE GUIDE, and critical rules are preserved verbatim\. We run GPT\-4o with each prompt on the 50 held\-out problems used in the SFT ablation\. To make the comparison fair we score only the subset that produced a valid scene graph under both prompts \(n=32n=32\); the rendered diagrams are scored against the neutral ground\-truth angles \(Section 3\.5\) using Hough\-CSR and VLM\-CSR\. Appendix C Additional Evaluation C\.1 Human Judge Evaluation Table 6: Human\-judge forced\-choice preference rates against each baseline\. In addition to the automated VLM\-based judges \(Section 3\.5\), we ran a small human\-judge study to confirm that the gap between PhyDrawGen and the strongest VLM baseline is perceptible to human physics readers and not an artefact of LLM judges’ bias toward structured outputs\. Protocol\. Fifteen judges with at least one year of undergraduate physics coursework were shown forced\-choice comparisons of all rendered diagrams for the same problem text: one from PhyDrawGen and one from each baseline \(GPT\-5\-image, Gemini 2\.5 Flash, and Gemini 3 Pro, drawn at random\)\. Judges selected the diagram with the more physically correct force\-arrow configuration\. Each judge saw 30 problem comparisons, drawn from mechanical, optics and electromagnetism domains\. Order of presentation \(left/right\) was randomised per pair\. C\.2 Geometric Correctness of Force Arrows VLM\-CSR \(Section 3\.5\) judges arrow direction but collapses other geometric attributes of a force arrow into a single binary verdict\. This appendix reports finer\-grained geometric correctness scores that physics readers care about: origin correctness \(does the arrow’s tail sit on the correct object or contact point?\), concurrency at the centroid \(for equilibrium objects, do all force arrows meet at a single point, as the closure constraint requires?\), and attachment\-point exactness \(for surface\-contact forces, is the tail within ε\\varepsilon of the contact vertex?\)\. Definitions\. Let 𝐩atail,𝐩atip\\mathbf\{p\}\_\{a\}^\{\\text\{tail\}\},\\mathbf\{p\}\_\{a\}^\{\\text\{tip\}\} be the pixel positions of arrow aa’s tail and tip\. For each problem we compute: • Origin correctness: 𝟙​\[‖𝐩atail−𝐩ocentroid‖<ro\]\\mathbb\{1\}\[\\\|\\mathbf\{p\}\_\{a\}^\{\\text\{tail\}\}\-\\mathbf\{p\}\_\{o\}^\{\\text\{centroid\}\}\\\|<r\_\{o\}\] for the object oo the force is applied to, with ror\_\{o\} the object’s bounding\-region half\-extent\. • Concurrency residual: at each equilibrium centroid, 1\|Fo\|​∑a∈Fo‖𝐩atail−𝐩ocentroid‖\\frac\{1\}\{\|F\_\{o\}\|\}\\sum\_\{a\\in F\_\{o\}\}\\\|\\mathbf\{p\}\_\{a\}^\{\\text\{tail\}\}\-\\mathbf\{p\}\_\{o\}^\{\\text\{centroid\}\}\\\| averaged across the force set FoF\_\{o\} applied to that object\. • Attachment\-point exactness \(contact\-only\): ‖𝐩atail−𝐩ocontact‖\\\|\\mathbf\{p\}\_\{a\}^\{\\text\{tail\}\}\-\\mathbf\{p\}\_\{o\}^\{\\text\{contact\}\}\\\| in pixels, reported as median across the corpus\. Table 7: Per\-method geometric correctness of force arrows beyond direction\. Origin correctness is the fraction of arrows whose tail sits on the correct object; concurrency is the mean tail displacement from the equilibrium centroid \(pixels\); attachment is the median tail\-to\-contact\-point distance for surface forces\. C\.3 Neutral Ground\-Truth Derivation The neutral ground\-truth angles used by Hough\-CSR \(Section 3\.5\) are derived entirely independent of the constraint solver: it consumes only the original problem text PP, and emits the expected angle for every gravity, normal, friction, tension and spring force in the scene\. Comparing detected angles against this neutral GT — rather than against our own PSLG — disentangles "did the solver compute the right angles?" from "did the renderer faithfully draw the solver’s angles?", and makes the correctness claim auditable against any physics textbook\. V1: textbook formulas on the scene graph\. Let θs\\theta\_\{s\} be the inclination angle of the contact surface ss \(or 0 on a flat floor\), let 𝐩o\\mathbf\{p\}\_\{o\} be the object’s spatial position from a SPATIALLY\_AT edge, and let atan2↑\\mathrm\{atan2\}\_\{\\uparrow\} denote the four\-quadrant arctangent in the image\-up convention used throughout the paper\. For each object oo of physical type rigid\_body or point\_mass we emit: The hanging\-mass case is handled by walking the Object→\\toSurface CONTACTS edges: an object with no contact surface receives no normal or friction term and only emits gravity and tension/spring\. For multi\-spring configurations each spring contributes one force, derived independently from its own anchor coordinates so that coupled oscillators \(e\.g\. wall\-mass\-mass\-wall topologies\) yield two force terms per intermediate mass, one per attached spring\. V2: regex extraction of the incline angle from problem text\. Mode V1 still consumes the scene graph’s surface\.angle\_deg field, which is GPT\-extracted; a reviewer concerned about solver\-LLM co\-correlation in their failure modes can additionally enable V2, which obtains θs\\theta\_\{s\} directly from the problem text PP via the regular expression \\d\{1,2\}\(?:\\\.\\d\+\)?\\s\*\(?:°\|deg\(?:rees?\)?\|\-?\\s\*degree\) applied case\-insensitively across PP, keeping the first numerical match vv with 0<v<90∘0<v<90^\{\\circ\}\. The motion direction \(used to pick the sign of θf\\theta\_\{f\}\) is similarly inferred from PP by matching slid\(e\|ing\)/mov\(e\|ing\)/push\(ed\)? up vs slid\(e\|ing\)/mov\(e\|ing\)/fall\(s\|ing\)? down\. All other formulas above remain unchanged\. Validation\. On every problem set evaluated in Section 3\.4, V1 and V2 agree on the incline angle to the degree \(the GPT extractor never hallucinates or rounds the angle in our test corpus\), so we report V1 numbers in the main tables and use V2 as a sanity check\. A sentinel returns None for the incline angle whenever no plausible match is found in either mode, in which case all incline\-dependent forces are omitted from the neutral GT and that problem’s CSR is computed only over the gravity, tension and spring terms\. C\.4 Blind Judge Protocol and Verdict Schema The blind judge in Section 3\.5 is a frozen Claude Sonnet 4\.6 instance accessed via the OpenRouter API\. It receives exactly two inputs: the rendered diagram \(PNG, base64\-encoded\) and the natural\- language problem statement PP\. No solver output, no PSLG, no scene graph, no ground\-truth angles, and no metric definition are passed to the judge\. Blind judge prompt \(Claude Sonnet 4\.6\) Aggregation\. Per\-problem overall\_pct is reported as the judge sees fit; in our aggregations we recompute the unweighted correct\-fraction from the per\-category verdicts to guard against the judge’s self\-assigned overall score drifting from the verdict counts: Blind​\(p\)=\|\{f∈ℱ:vp,f=correct\}\|\|\{f∈ℱ:vp,f≠n/a\}\|,\\text\{Blind\}\(p\)\\;=\\;\\frac\{\|\\\{f\\in\\mathcal\{F\}\\,:\\,v\_\{p,f\}=\\text\{correct\}\\\}\|\}\{\|\\\{f\\in\\mathcal\{F\}\\,:\\,v\_\{p,f\}\\neq\\text\{n/a\}\\\}\|\},\\qquad where ℱ=\{gravity,normal,friction,tension,applied\}\.\\mathcal\{F\}=\\\{\\text\{gravity\},\\text\{normal\},\\text\{friction\},\\text\{tension\},\\text\{applied\}\\\}\. The mean and per\-category breakdowns reported in Section 3\.4 are arithmetic means of Blind​\(p\)\\text\{Blind\}\(p\) across the problem set, ignoring categories scored n/a\. Leakage concerns and mitigations\. The prompt names the six force categories explicitly and tells the judge to "judge purely on the physics described in the problem text", which is a mild form of prior — a less informed judge might miss e\.g\. a tension arrow it does not expect\. We tested an alternative open\-vocabulary prompt that elicits free\-text arrow enumeration without naming categories; on a small audit set \(n=20n\{=\}20\) the two prompts agreed on the verdict for 17 of 20 problems and the named\-category version converged faster on ambiguous cases without inflating the score for the worst methods, so we adopted it for all reported blind\-judge numbers\. Decoding is deterministic \(temperature=0\\,\{=\}0, top\-p=1p\\,\{=\}1\)\. The judge sees no other method’s output and is queried independently per problem; we make a fresh API call per \(method, problem\) pair, so none of the within\-problem\-set scores share context across methods\. Inter\-judge sanity check\. We additionally re\-ran the same protocol with Gemini 2\.5 Flash as the judge on a subset of 50 problems of the original evaluation set; per\-method rankings were preserved although absolute numbers shifted by up to 4 percentage points\. Per\-problem Pearson correlation between Sonnet 4\.6 and Gemini 2\.5 Flash verdicts was r=0\.78r=0\.78 \(p<10−4p<10^\{\-4\}, n=250n\{=\}250 problem\-method pairs\), supporting the use of a single primary judge\. Appendix D Inverse Rendering PhyDrawGen is described above as a text\-to\-diagram pipeline: the LLM consumes natural language and the PSLG solver produces a physics\-grounded diagram\. The same scene\-graph extractor accepts an image as input instead, opening a second mode we call inverse rendering, in which we read an existing physics diagram, recover its scene graph, run the solver, and re\-render a corrected version\. This is useful for two settings: \(i\) auditing or correcting an existing diagram from a textbook or a baseline VLM, and \(ii\) constraining a generative model’s output by running it through the PhyDrawGen solver afterwards\. Pipeline\. For an input image II: 1\. GPT\-4o with the same five\-step CoT prompt \(Section 3\.1\) but receiving II as the visual input rather than text, emits a scene graph 𝒢LLM\\mathcal\{G\}\_\{\\text\{LLM\}\}\. 2\. The PSLG solver runs on 𝒢LLM\\mathcal\{G\}\_\{\\text\{LLM\}\} exactly as in the text path; any closure\-residual violations are surfaced\. 3\. The renderer produces a clean PhyDrawGen rendering IoutI\_\{\\text\{out\}\}, which can be compared against II\. Use case: correcting a wrong baseline\. Given a diagram from a generative baseline, GPT\-5\-image and Gemini output that misplaces a force arrow\), the inverse pipeline re\-renders a corrected version\. The corrected IoutI\_\{\\text\{out\}\} shown in Figure 7, 8 and 9 satisfies all solver constraints by construction; the magnitude of the angular correction θ​\(I\)−θ​\(Iout\)\\theta\(I\)\-\\theta\(I\_\{\\text\{out\}\}\) measures how wrong the baseline was\. Limitations\. The inverse pipeline inherits the LLM’s image\-grounding accuracy: when GPT\-4o misreads the surface angle from the diagram, the re\-rendered output will be wrong in the same way\. The solver still guarantees consistency within the recovered scene graph, but cannot recover an angle the extractor never saw\. Figure 7: Left Column: Diagram Generted by GPT\-5\-Image\. Right Column: Inverse Rendering and Correction by PhyDrawGen Figure 8: Left Column: Diagram Generted by Gemini\-3\-Pro\. Right Column: Inverse Rendering and Correction by PhyDrawGen Figure 9: Left Column: Diagram Generted by Gemini\-3\-Pro\. Right Column: Inverse Rendering and Correction by PhyDrawGen`

Similar Articles

SciForma: Structure-Faithful Generation of Scientific Diagrams

Hugging Face Daily Papers

Introduces SciForma, a framework for generating scientific methodology diagrams with high structural fidelity, using multi-dimensional conjunctive preference optimization (M-DPO) and a structural inventory to ensure correctness across component, arrow, and text axes. The 9B model surpasses open-source baselines and GPT-Image-1.5 on benchmark evaluations.