{"id":42414,"date":"2026-09-01T14:27:09","date_gmt":"2026-09-01T12:27:09","guid":{"rendered":"https:\/\/www.graviton.at\/letterswaplibrary\/i-trained-a-67m-param-latex-ocr-model-that-runs-on-a-laptop-cpu-and-built-a-new-style-aware-dataset-to-train-it-weights-data-and-training-code-all-open-mit\/"},"modified":"2026-09-01T14:27:09","modified_gmt":"2026-09-01T12:27:09","slug":"i-trained-a-67m-param-latex-ocr-model-that-runs-on-a-laptop-cpu-and-built-a-new-style-aware-dataset-to-train-it-weights-data-and-training-code-all-open-mit","status":"publish","type":"post","link":"https:\/\/www.graviton.at\/letterswaplibrary\/i-trained-a-67m-param-latex-ocr-model-that-runs-on-a-laptop-cpu-and-built-a-new-style-aware-dataset-to-train-it-weights-data-and-training-code-all-open-mit\/","title":{"rendered":"I Trained A 67M-param LaTeX OCR Model That Runs On A Laptop CPU \u2014 And Built A New Style-aware Dataset To Train It. Weights, Data, And Training Code All Open (MIT)."},"content":{"rendered":"<p><!-- SC_OFF --><\/p>\n<div class=\"md\">\n<p>Hey everyone! I&#8217;ve been working on a little side project I wanted to share: <strong>latex-ocr<\/strong>, a standalone formula OCR model \u2014 you feed it an image of a math formula, it spits out the LaTeX source.<\/p>\n<p>The main hook: it&#8217;s only <strong>67M parameters<\/strong>, so it runs comfortably on a laptop CPU. No GPU, no 300M-parameter monster to load. It&#8217;s a CoCa-style model (contrastive captioner adapted for OCR), and despite the small size it beats the 107M UniMER-tiny baseline and gets pretty close to the 325M one on plain formulas.<\/p>\n<p>The part I&#8217;m actually most proud of is the <strong>dataset<\/strong>. Real papers don&#8217;t just use plain symbols \u2014 you see <code>mathbb{R}<\/code>, <code>mathcal{F}<\/code>, <code>mathfrak{g}<\/code> everywhere, and existing OCR datasets basically ignore font styles, so models trained on them can&#8217;t read (or hallucinate) those macros. So I rebuilt ~1.3M formulas with a MathJax \u2192 SVG \u2192 PDF \u2192 PNG pipeline and injected font-style macros with semantic heuristics (number sets \u2192 <code>mathbb<\/code>, vectors \u2192 <code>mathbf<\/code>, differentials \u2192 <code>mathrm<\/code>). On that styled test set it clearly outperforms all the baselines \u2014 fair warning though, those baselines are zero-shot on styled data, so take that comparison with a grain of salt. The plain-split numbers are the like-for-like ones.<\/p>\n<p>Everything is open: model weights and dataset on Hugging Face, training recipes included if you want to reproduce or fine-tune it yourself, MIT license. There&#8217;s also a FastAPI server and a Gradio web UI, so you can drag-and-drop an image and see the LaTeX with a rendered preview.<\/p>\n<p>Repo: <a href=\"https:\/\/github.com\/PadishahIII\/latex-ocr\">https:\/\/github.com\/PadishahIII\/latex-ocr<\/a> Model: <a href=\"https:\/\/huggingface.co\/PadishahIIIXXX\/latex-ocr\">https:\/\/huggingface.co\/PadishahIIIXXX\/latex-ocr<\/a> Dataset: <a href=\"https:\/\/huggingface.co\/datasets\/PadishahIIIXXX\/latex-ocr-dataset\">https:\/\/huggingface.co\/datasets\/PadishahIIIXXX\/latex-ocr-dataset<\/a><\/p>\n<p>Happy to answer questions about the training setup, the data pipeline, or anything else. Would love feedback \u2014 especially if you try it on your own gnarly formulas and it breaks, that&#8217;s genuinely useful.<\/p>\n<\/div>\n<p><!-- SC_ON -->   submitted by   <a href=\"https:\/\/www.reddit.com\/user\/PadishahIII\"> \/u\/PadishahIII <\/a> <br \/> <span><a href=\"https:\/\/www.reddit.com\/r\/datasets\/comments\/1w498wp\/i_trained_a_67mparam_latex_ocr_model_that_runs_on\/\">[link]<\/a><\/span>   <span><a href=\"https:\/\/www.reddit.com\/r\/datasets\/comments\/1w498wp\/i_trained_a_67mparam_latex_ocr_model_that_runs_on\/\">[comments]<\/a><\/span><\/p><div class='watch-action'><div class='watch-position align-right'><div class='action-like'><a class='lbg-style1 like-42414 jlk' href='javascript:void(0)' data-task='like' data-post_id='42414' data-nonce='b9a40cecc8' rel='nofollow'><img class='wti-pixel' src='https:\/\/www.graviton.at\/letterswaplibrary\/wp-content\/plugins\/wti-like-post\/images\/pixel.gif' title='Like' \/><span class='lc-42414 lc'>0<\/span><\/a><\/div><\/div> <div class='status-42414 status align-right'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Hey everyone! I&#8217;ve been working on a little side project I wanted to share: latex-ocr, a standalone&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85],"tags":[],"class_list":["post-42414","post","type-post","status-publish","format-standard","hentry","category-datatards","wpcat-85-id"],"_links":{"self":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts\/42414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/comments?post=42414"}],"version-history":[{"count":0,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts\/42414\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/media?parent=42414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/categories?post=42414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/tags?post=42414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}