Compact model with program harness matches large models for document math

When Harness Beats Scale, and When Reading Beats Both

Computation and LanguageArtificial IntelligenceInformation Retrieval

Summary

Solving math problems based on documents usually relies on very large AI models, which are costly and slow. The authors show that using a clever setup—called a program-of-thoughts harness—helps smaller models perform just as well as much bigger ones on labeled data. They also found that problems with reading documents from low-quality PDFs caused many systems to fail in tests, showing that how well a system reads input matters more than its reasoning ability. This means improving reading quality can be more important than making models bigger.

What this means in practice

  • For document ai developers: Build systems that handle math reasoning from documents using smaller models with program-based reasoning to reduce costs and environmental impact.
  • For document image processing teams: Improve optical character recognition and document rendering to prevent reading failures that cause reasoning systems to perform poorly on real-world PDFs.

Authors

Ivan Bondarenko, Nikolay O. Nikitin

Abstract

We describe our system for DocSem, the document-grounded quantitative reasoning shared task at DocInsights 2026, and analyze why it succeeded on labeled data and failed on the test set. The pipeline pairs hybrid block retrieval with Program-of-Thoughts (PoT) generation executed in a sandboxed interpreter, self-consistency sampling, and entity enrichment from chunk-level knowledge graphs. On our held-out split, application architecture moved the metrics far more than model scale did: PoT added 0.282 joint accuracy to a compact 7B model but at most 0.005 to a 72B model, and a 27B model with the full harness matched the 72B (0.884 vs.\ 0.873) at roughly 2.7$\times$ fewer parameters and a quarter of the CO$_2$. We read this through a distinction between world knowledge, which scales steeply with parameters, and language knowledge, which scales gently, and show that structured-output training makes a compact model harness-ready rather than merely small. On the raster, watermarked test PDFs the same system collapsed to 13.58\% joint (rank 149 of 163); a controlled re-rendering of the validation set reproduces the OCR half of the collapse while bounding what the simulation misses. Auditing the physical nature of evaluation inputs precedes architecture, and the leaderboard's bimodality is consistent with reading quality, not reasoning, having separated the field.