Internalizing Geometric Law: Learning from Solver Residuals for Precision-Critical Generation

Rafael Cabral, Pang Zixi, Ziyi Shou, Shen Xin
6/8/2026
cs.LGcs.AI

Official code: Huawei-AI4Math/PyGeoX (0 stars, MIT, last commit 2026-06-09).

Abstract

Large Language Models frequently hallucinate in precision-critical domains such as technical diagramming and mechanical design, where outputs must satisfy strict geometric constraints. We study open-ended geometric synthesis from natural language: translating free-form descriptions into precise constructions whose entities must simultaneously satisfy dozens of interacting constraints. To make this tractable, we release PyGeoX, a programmable geometric DSL that compiles declarative constraints into a differentiable loss, and PyGeoX-Bench, a stratified suite of 300 problems with per-constraint verifiable rewards. Using PyGeoX as a verifier, we identify a failure mode we call Outlier Gradient Masking: under global-norm rewards (any scheme that aggregates residuals through a single norm, for example, $\exp(-\mathrm{MSE})$), a single outlier constraint can nullify the learning signal across all others. To address this, we propose Saturating Additive Rewards (SAR), which decompose the reward into bounded per-constraint terms, preserving partial progress and ensuring consistent gradients even under severe violations. Against MSE-based rewards, the natural baseline for geometry solvers, SAR improves the hard-tier solving rate by $2.3\times$, and the resulting 8B model is competitive with much larger frontier systems on this benchmark. We release the engine, benchmark, and data at https://github.com/Huawei-AI4Math/PyGeoX.

View on arXivView PDF

Code Implementations(1)

MIT

A programmable geometry DSL that compiles constraints into differentiable, per-constraint rewards for precision-critical LLM generation.

00Shell, PythonJun 4, 20264 months agoMIT

Similar Papers

Cite this paper

@article{cabral2026internalizing,
  title  = {Internalizing Geometric Law: Learning from Solver Residuals for Precision-Critical Generation},
  author = {Rafael Cabral and Pang Zixi and Ziyi Shou and Shen Xin},
  year   = {2026},
  eprint = {2606.09278},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.09278v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.09278.svg)](https://codeofpaper.com/paper/2606.09278)

Discussion