Evaluating Handwritten Note to LaTeX Conversion in Native Multimodal Models
This article uses handwritten-note-to-compilable-LaTeX conversion as a benchmark for assessing the native multimodal capability of current models. It breaks the task into four capability layers (character recognition, formula semantics, layout styling, and spatial/geometric reconstruction), reports qualitative findings against reference baselines, presents a failure taxonomy with mitigation options, and outlines a deployable pipeline covering input preprocessing, output contracts, compile-verification loops, chunking, tiered routing, and quality monitoring. Readers will gain a practical view of where these models are production-ready today and how to push uncertainty into configurable contracts and executable checks.
1. Why “handwritten notes → compilable document” is a hard test of native multimodality
When evaluating whether a model can “see images,” tasks such as image classification, scene captioning, and chart reading have become poor discriminators: they measure recognition rather than understanding followed by reconstruction. Tasks with real discriminative power are structured reconstruction tasks — given a high-density, noisy image, produce code that is both machine-verifiable and faithful to the original semantics and visual hierarchy.
Converting handwritten notes into compilable typesetting source satisfies several demanding conditions at once:
- Heavy noise: connected strokes, slanted handwriting, paper glare, shadows, cross-outs and corrections, perspective distortion from off-axis photography;
- Deep semantics: formulas are not character sequences but hierarchical structures (super/subscripts, fractions, radicals, matrices, multi-line alignment);
- Precision required: symbol tolerance is zero — one misplaced underscore and the output will not compile;
- Spatial reasoning: vertices, axes, occlusion, layer order, and solid vs. dashed lines in diagrams must be inferred from 2D pixels into 3D or topological relationships, then expressed as drawing code (“coordinates + paths + fills + paint order”).
In other words, this task simultaneously stress-tests four chains — perception, semantic parsing, code generation, and self-verification — which is exactly why it reflects real-world usability better than leaderboard scores.
2. Breaking the capability into four layers
Layer 1: Character-level recognition
Handwritten characters, formula symbols, mixed Chinese-English text, and super/subscript position. This is the foundational layer, and the one mature models generally pass. A typical observation from testing: basic character recognition shows no systematic errors. Failures rarely come from misreading characters, but from the remaining three layers.
Layer 2: Formula and semantic structure
The key is not recognizing symbols but determining ownership relationships among them. For example, the difference between x_i^2 and x^{2i}, the coverage of a fraction bar, the boundary of a radical, or the alignment of & and \\ in a matrix. Errors at this layer are hard to catch by eye, because every character is correct while the structure is wrong.
Practical advice: in the output contract, require the model to use only standard math environments, forbid custom macros, and mandate a numbered, controlled environment for display equations — concentrating uncertainty into a few templates.
Layer 3: Layout and visual styling
Highlights, underlines, circled annotations, boxes, section headers, multi-column layouts, and callout pointers. The difficulty here is that “visual styling” is a missing dimension in a text-only model: the traditional approach first extracts style descriptions with a vision model and then hands them to a text model, and style information degrades severely across that hand-off.
Notably, exact color fidelity is not worth demanding at 100%. In testing, even when the color of an individual highlighted region was slightly off, readability and information completeness were unaffected as long as the block assignment was correct. A more robust architecture is therefore decoupling structure from styling: the model outputs only semantically annotated structure (e.g., highlight ranges, circled ranges), while actual colors and macro commands are injected in a post-processing stage via a fixed mapping table. This downgrades style deviation from a “model capability problem” to a “configurable engineering problem.”
Layer 4: Spatial relationships and geometric reconstruction
This is the layer that separates models, and where the value of “multimodal” is most concentrated. The model must complete a longer reasoning chain:
pixel region → identify primitives (point/line/arc/text label) → determine endpoint semantics (segment/ray/line)→ infer occlusion and layer order → estimate coordinates and proportions → emit drawing code
If any link in this chain breaks, the result “looks right but isn’t.” Typical failures are drawing one extra construction line, treating a segment as a ray, or drawing an occluded edge on top — all fundamentally endpoint-semantics and paint-order errors rather than recognition errors.
3. Qualitative evaluation results
Comparative observations across several handwritten note samples can be summarized as follows:
- Characters and formulas: accurate reconstruction, no obvious recognition defects;
- Layout and highlighting: block structure well preserved, with slight color-value deviation in a few cases that does not constitute information loss;
- Diagram reconstruction: geometric shapes are drawn, vertices and axes are largely correct, spatial relationships broadly hold;
- Strong scenarios: complex diagrams requiring 3D structure, occlusion, and layer relationships to be understood from a 2D image — output quality is markedly better than an early “vision-only experimental version,” whose common problems were precisely missing highlights and irregular graphics;
- Failure scenarios: occasional extra lines or misjudged ray direction — low-frequency but damaging to graphic correctness;
- Throughput: generation speed with image input improved noticeably, indicating substantive optimization of the vision encoding and decoding pipeline.
One important methodological reminder: evaluation must include a reference baseline. Comparing only against “the last failure” overstates progress; comparing only against “human annotation” understates usability. It is advisable to keep a two-stage pipeline of “lightweight text model + dedicated vision model” as a baseline, because the real competitor for a production system is not some old version but the orchestration you have already got working.
4. Failure taxonomy and attribution
| Error layer | Typical symptom | Automatically detectable? | Primary mitigation |
|---|---|---|---|
| Character-level | Occasional misread connected strokes | Partly (spelling/dictionary checks) | Higher input resolution, split by column |
| Semantic-level | Wrong super/subscript ownership, wrong fraction scope | Yes (compile failure or warnings) | Restrict to standard math environments, compile loop |
| Style-level | Highlight color/block-assignment deviation | No | Structure/style decoupling, mapping-table post-processing |
| Geometry-level | Extra lines, ray direction, occlusion order | No | Output contract mandating endpoint semantics and paint order, manual spot checks |
| Engineering-level | Truncated output, explanatory prose mixed in | Yes (format validation) | Strict output contract + structured parsing |
The practical value of this table: it tells you which quality costs can be eliminated with engineering means, and which must be covered by model capability or humans. Semantic-level and engineering-level errors can be driven down automatically through compile-verification loops; geometry-level errors are currently better managed with a combination of “contract constraints + spot checks.”
5. What “native multimodal” saves is more than one API call
If multimodal capability is built in natively, the benefit goes well beyond “it can now look at images” — the entire pipeline is structurally simplified:
- Model-switching cost drops to zero: no need to carry intermediate artifacts between a “vision model → text model” boundary;
- No context degradation: image, detection results, and generated code live in one context, avoiding second-round encoding and compression distortion across models;
- Thinner orchestration and tooling: a multi-stage setup that previously required file-upload endpoints, async task queues, a multi-turn state machine, result write-back, and failure retries can collapse into a single round or a few rounds;
- A significantly smaller failure surface: systemic failures on cross-model links — timeouts, format incompatibility, missing fields — decrease substantially;
- A changed cost structure: not simply cheaper or more expensive, but a shift from “multiple calls + long intermediate context” to “single multimodal input,” with the cost center moving from context length to image encoding and output length.
6. A deployable pipeline design
1. Input preprocessing (low cost, high payoff)
Deskewing (perspective/rotation correction), shadow removal and contrast enhancement, splitting by column or by page, and splitting overly long pages into semantic blocks. Raw scans are best stored in object storage and passed by key reference rather than as binaries, to avoid context bloat.
2. Output contract
The prompt should state explicitly that the model must “output only one complete compilable source file,” and should fix the document class and package list:
【Output Contract】1. Output only one complete, compilable source file. No explanations, apologies, or Markdown.2. Only the following packages are allowed: core math environments, color/highlight,graphics and drawing packages, table package.3. Display equations must use a numbered alignment environment; no custom \newcommand.4. Highlights and circled notes must use the semantic macro: \mark{color}{range},where color is limited to yellow/green/blue/red.5. Every diagram must explicitly declare: coordinate ranges, the type of each primitive(segment/ray/line/circle/arc), endpoint semantics, filled regions, paint order.6. Self-check before output: matching braces, paired environments, every \begin has an \end.
Item 5 is the key move that turns geometry-level errors from “uncontrollable” into “constrainable”; item 4 hands style uncertainty to a controllable post-processing mapping.
3. Compile-verification loop
Use a containerized sandbox for offline compilation with limits on CPU, memory, and timeout, forming an automatic closed loop:
function render_note(image):page = preprocess(image) # deskew, remove shadows, split by columnfor attempt in 0..MAX_RETRY:src = model.complete(CONTRACT_PROMPT, [image(page), TASK_PROMPT])ok, log = sandbox.compile(src) # compile inside an isolated containerif ok: return src, to_preview(page)if attempt == MAX_RETRY: breaksrc = model.complete(CONTRACT_PROMPT,[image(page), src, top_errors(log, 3)])return degrade(page) # fallback: keep text and formulas only, diagrams as attachments
Two details determine success: feed back only the first few errors, otherwise error logs flood the context and induce new hallucinations; and always provide a fallback path, so that “partially usable” wins over “total failure.”
4. Long-document chunking and assembly
Multi-page documents are generated page by page, then a lightweight step normalizes the preamble, cross-references, and numbering. Chunking localizes failures — retrying a single page does not affect the whole document — and enables concurrency. Async tasks can be decoupled and smoothed with a message queue, while build images and compilation sandboxes run on a container platform with isolated execution per generation.
5. Tiered routing and cost control
Not every page needs the strongest model. Pages can be tagged by image complexity (character density, number of formulas, presence of diagrams): simple pages go to a lightweight tier, pages with complex geometry go to a stronger tier. Combined with image-resolution and region-cropping strategies and caching of results for repeated templates, this typically compresses per-task cost without obvious quality loss. Specific unit prices and quotas vary with vendor policy and should be confirmed through actual commercial and technical validation.
6. Quality evaluation and monitoring
Build a regression set: a fixed batch of samples with human annotations, run on every model or prompt change. Automatic metrics may include compile success rate, exact-match rate on the formula portions, deviation in the count and type of primitives, and the distribution of output token length; layer human spot checks on top (focusing on samples containing diagrams). On the production side, use logging and monitoring/alerting to continuously track compile success rate, average retry count, per-page token consumption, and the geometry-level spot-check failure rate. Alert as soon as a metric drifts from baseline, to avoid quality regressions caused by silent model updates.
7. Capability boundaries and evolution
Three weaknesses still deserve close attention:
- Endpoint semantics and occlusion order: distinguishing segment/ray/line and assigning the layer of occluded edges remains a high-error area;
- Style fidelity: colors and visual decorations still depend on post-processing compensation and cannot yet be fully delegated to the model;
- Missing evaluation standards: geometric correctness lacks a widely accepted automatic metric, leaving reliance on manual spot checks and making large-scale management difficult.
The predictable direction is that native multimodality places image understanding, file handling, structured output, and tool invocation in the same ecological niche, enabling a closed loop of “read image — understand — generate — self-check” within a single inference pass. For developers, this means migrating from “multi-model orchestration” to “single model plus a thin verification layer”; the engineering center of gravity also shifts from “how to wire models together” to “how to design output contracts, build verification loops, and measure and guard quality.”
8. Summary
Handwritten-note-to-compilable-document conversion is worth evaluating repeatedly precisely because it cannot be passed on a single capability: character recognition, formula structure, layout reconstruction, and spatial reasoning must all hold at once. Current native multimodal models are already production-ready on the first three layers. The fourth layer (geometric reconstruction) still shows low-frequency errors, but progress over early vision-only experimental versions is clear, and it is already sufficient to support a practical pipeline of “human review + automatic compile verification.” In deployment, pushing uncertainty out into configurable contracts and executable checks often improves output quality immediately — more so than continuing to wait for model capability to improve.
