Here is a concise, engaging summary of the paper, tailored for researchers and engineers interested in the intersection of language models, code generation, and mathematical reasoning.
TL;DR
The paper introduces GeoMathCode, a dataset and verification pipeline that uses executable Python code as intermediate steps for geometry problem-solving. By exploring the model's latent space, the authors reveal that textual reasoning and code execution are functionally disentangled, and that supervised fine-tuning (SFT) restructures the reasoning manifold to be more informative yet geometrically regular.
What Problem Does This Paper Address?
When humans solve geometry problems, we often draw auxiliary lines or points to help us think. Multimodal Large Language Models (MLLMs) try to mimic this by generating intermediate visual aids. However, previous approaches relied on pixel-based image generation, which is notoriously difficult to align, verify, and integrate without adding complex, error-prone vision generators.
To solve this, the authors ask: What if we use executable code to generate these diagrams instead? Code is precise and easily verifiable. Crucially, the paper investigates a deeper mechanistic question: Does generating programmatic diagrams fundamentally reshape how an MLLM reasons internally, or does code just act as a superficial auxiliary output?
Methods
The authors built an automated, verification-driven pipeline to generate interleaved math-code solutions:
- Generation: They used Gemini3-Flash to generate multi-step solutions containing text, executable Python code, and visual plots.
- Rule Extraction: GPT-5.1 acted as a math rule engine to extract key checkpoints and factual mathematical rules for each problem.
- Verification: Gemini3-Pro served as an automated checker to verify final answer correctness, textual logic, and successful code execution within a safe sandbox.
To understand the internal mechanics, the authors analyzed the model's hidden layers using Principal Component Analysis (PCA), t-SNE, Effective Rank (ERank), and Intrinsic Dimensionality (ID), alongside linear probing (SVM/KNN) to map out the geometry of the code and reasoning spaces.
Datasets
The authors introduced the GeoMathCode dataset, which consists of:
- 10,000 training samples and 1,000 test samples.
- A balanced 1:1 ratio of questions with and without diagrams.
- Coverage across 8 distinct geometric and mathematical topics sourced from the MathCanvas corpus, including Algebra, Calculus, Trigonometry, and Plane Geometry.
Key Insights and Ideas
- Reasoning-Code Disentanglement: Textual reasoning steps and code generation steps form completely separate, disentangled latent subspaces across the transformer layers. Generating code does not actively alter or improve the textual reasoning path; rather, code functions primarily as an auxiliary output modality.
- SFT Regularizes the Manifold: Supervised fine-tuning simultaneously increases the Effective Rank (spreading information across more informative directions) and decreases the Intrinsic Dimensionality (reducing local geometric complexity). This means SFT doesn't just compress representations; it reorganizes them into highly structured, canonical, and reusable computational paths.
- Abstracting Code Semantics: In deeper layers, code representations lose their tight, lexical clustering (e.g., specific API names) and instead reorganize into broader execution-semantic manifolds based on their functional roles (like plotting vs. data flow).
- Code Beats Vision for Symbols: Probing experiments revealed that latent code representations capture fine-grained mathematical symbolic concepts (like triangles, angles, and square roots) significantly better than raw visual representations.
Key Results
The authors benchmarked several open-source MLLMs (including Qwen3/3.5, LLaVA-Next, and InternVL3.5) on the new dataset:
- Top Performer: Qwen3.5-9B-SFT achieved the highest overall performance, with a final answer accuracy (Ans Acc) of 0.55 and a code execution accuracy (Code Acc) of 0.97.
- Evaluation Alignment: Incorporating point- and rule-based instructions during evaluation dramatically boosted the correlation between textual reasoning quality and final answer accuracy (Pearson/Spearman coefficients jumped from ~0.48 to ~0.70).
- Disentanglement Visualization: Layer-wise PCA plots clearly show the geometric separation between standard text reasoning steps and code steps, confirming their functional independence.
Limitations and Future Work
While promising, the paper notes a few key limitations:
- Low Absolute Accuracy: Even the best models top out at around 55% final answer accuracy, showing that complex geometry remains a difficult frontier.
- Evaluator Bias: The pipeline relies heavily on MLLM-based grading (Gemini3-Pro/GPT-5.1), which can occasionally overlook subtle logical flaws or favor superficially coherent answers.
Future Directions: The authors plan to explore automatic symbolic evaluation methods and leverage advanced reinforcement learning frameworks—such as Group Relative Policy Optimization (GRPO) and Direct Alignment Policy Optimization (DAPO)—to further boost reasoning reliability.
Summary updated