The interview problem
Design formula OCR that preserves fractions, superscripts and symbol relationships in scanned lecture notes.
Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.
1. Scope and worked approach
Detect formula regions, encode the image and decode constrained markup. Validate parsing, render the result for visual comparison and offer uncertain spans for correction. Split by source document and author; distinguish printed and handwritten evaluation sets.
2. Trace the design or derivation
Formula crop → markup decoder → restricted parser → render comparison → review
Preserve crop coordinates so a reviewer can inspect the original evidence. Normalization must not equate genuinely different expressions merely to improve the metric. If multiple notations are equivalent, document exactly which transformations the evaluator accepts.
3. Calculate the example
The strings x^2+1 and x^{2+1} differ by one grouping choice but represent different expressions. A short edit distance therefore does not establish semantic correctness.
4. Failure cases and trade-offs
A syntactically valid formula can still swap a minus sign or denominator. Rendering similarity can miss mathematically significant small symbols. Execution of arbitrary markup is unsafe; use a restricted renderer.
5. Validation, follow-ups and self-review
Measure exact normalized structure and symbol-level errors alongside rendering checks. Follow-up: when should the tool abstain? Self-review: cover two-dimensional structure, grammar and correction.
Sources and related practice
Technical reference: arxiv.org — Image-to-markup recognition with structured attention.
Source publication/update: 2016-09-16; revised 2017-06-13. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.
Continue with Extract structured tables from enterprise documents; Recover reading order from complex documents.
Continue your preparation
Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.