<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Luming</title>
    <description>The latest articles on DEV Community by Luming (@luming).</description>
    <link>https://dev.to/luming</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3939657%2F9bad1460-58d1-42da-b4ea-b89db11c8372.jpg</url>
      <title>DEV Community: Luming</title>
      <link>https://dev.to/luming</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/luming"/>
    <language>en</language>
    <item>
      <title>Errors as Data: How RSI Helps OXR Achieve SOTA Accuracy and Speed in Document Parsing</title>
      <dc:creator>Luming</dc:creator>
      <pubDate>Thu, 29 Oct 2026 16:30:12 +0000</pubDate>
      <link>https://dev.to/luming/errors-as-data-how-rsi-helps-oxr-achieve-sota-accuracy-and-speed-in-document-parsing-4d48</link>
      <guid>https://dev.to/luming/errors-as-data-how-rsi-helps-oxr-achieve-sota-accuracy-and-speed-in-document-parsing-4d48</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What if every document a model gets wrong told you what to train on next? That's the loop behind OXR, a 1.3B model that ranks #1 on three document parsing benchmarks.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start with what usually happens when a model misreads a document. Someone corrects that one result, ships it, and moves on. Next week a similar document arrives, and the model probably makes the same mistake. A better next version means picking out bad cases, working out what went wrong, preparing data, and checking that the data is usable, while new failures keep showing up every day.&lt;/p&gt;

&lt;p&gt;We handed that pipeline to the system. OXR-1.0 uses recursive self-improvement (RSI) in post-training. Each round, the system finds the samples the model misreads or can't settle on in unlabeled documents, analyzes what went wrong, plans the next round of training, and generates targeted training data. To our knowledge, this is the first time RSI has been used for document parsing.&lt;/p&gt;

&lt;p&gt;RSI is a training-time design. OXR does not learn from your documents while you use it. Most of the judging, attribution, planning, and data generation is done by a stronger general-purpose multimodal model (the General VLM in our diagrams). Disagreement across OXR's own repeated predictions also helps flag uncertain samples, and a separate model handles clustering. When we say "no manual work," we mean that the training data RSI generates needs no human annotation or correction. It does not mean the whole training process runs without people.&lt;/p&gt;

&lt;p&gt;OXR-1.0 ranks #1 on OmniDocBench (97.18), olmOCR-Bench (87.84), and DocParsingBench (87.76). In speed tests on an RTX PRO 6000, it also ranks #1 among open-source document parsing models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why document parsing suits learning from errors
&lt;/h2&gt;

&lt;p&gt;Document parsing has a property few other tasks share: every input has a correct answer. Characters, table rows, columns and merged cells, and formula symbols can all be checked item by item. Quality can be measured objectively, and most mistakes fall into a specific kind of problem.&lt;/p&gt;

&lt;p&gt;That property has mostly been used for evaluation, not for learning. The catch is that the images and PDFs arriving from real use come with no human answers, so they can't serve as training data directly. OXR first has to find its weak spots in those documents, then build labeled new data around them. The three stages below do exactly that.&lt;/p&gt;

&lt;h2&gt;
  
  
  The RSI loop in three stages
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6duudyaalvjgt3ahushf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6duudyaalvjgt3ahushf.png" alt="OXR's RSI loop: three stages in sequence, with training results flowing back into OXR." width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The stages are Prediction &amp;amp; Classification, Attribution &amp;amp; Training Planning, and Data Generation. The Train line at the bottom, leading back to OXR, is the "recursive" part: data that passes validation in one round becomes training input for the next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 1: Find the misreads and the shaky samples
&lt;/h2&gt;

&lt;p&gt;OXR first parses unlabeled documents. Then the General VLM looks at the original image, the prediction, and the judging criteria, and sorts each sample into one of three classes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Correct&lt;/strong&gt;: judged right. It stops here for this round.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong&lt;/strong&gt;: judged wrong. It goes on to analysis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncertain&lt;/strong&gt;: can't be judged reliably, or the prediction is unstable. It also goes on to analysis.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keeping Uncertain is deliberate. These documents have no human ground truth, and judging rules can't cover every case in advance. With only Correct and Wrong, the judge's hesitation gets hidden in a label that looks certain and travels all the way into the training data. In our experiments, adding the third class made the split between Correct and Wrong cleaner. That is a qualitative observation; we haven't measured it systematically.&lt;/p&gt;

&lt;p&gt;An uncertain sample is one whose prediction is unstable and that sits near the edge of the training data distribution. There is a second way to find them: we branch off multiple rollouts from OXR and compare the predictions for the same sample. One correct answer doesn't mean the model has the sample down. If repeated runs differ clearly, the sample deserves a look. The General VLM checks whether a result is wrong, and the rollouts show whether OXR's answer is stable, so the two signals complement each other.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pcmzvtd1218zxh7hggm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pcmzvtd1218zxh7hggm.png" alt="Prediction &amp;amp; Classification: parallel identification paths, three-way classification, and perturbation analysis of high-disagreement samples." width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For samples where the rollouts disagree, we ask one more question: why is the prediction unstable? We apply small perturbations to the image, such as rescaling, blurring, compression, or a slight shift, without changing the content, and run the rollouts again. If the disagreement grows, the model is sensitive to visual changes that have nothing to do with content. The perturbation itself then becomes an important reason, and it carries into Stage 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 2: Turn scattered errors into "what to add next"
&lt;/h2&gt;

&lt;p&gt;A Wrong verdict says the result is incorrect. It doesn't say where, and the original document still has no reliable label. So the General VLM analyzes each sample's original image and prediction and writes down possible reasons. One sample can have several. For uncertain samples, it analyzes what makes the prediction unstable, without assuming the sample is wrong.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk9ijxg04megmjwd9uajk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk9ijxg04megmjwd9uajk.png" alt="Attribution &amp;amp; Training Planning: possible reasons from multiple samples are encoded and clustered into data coverage directions." width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These natural-language reasons are diagnostic hypotheses, but the ones that keep recurring deserve attention. We encode the reason text with SigLIP 2 and cluster it, grouping similar reasons into reason clusters.&lt;/p&gt;

&lt;p&gt;Here is an example built only to show the mechanism; the documents and strings in the figure are illustrative, not OXR measurements. A research report is judged Wrong, and one reason is that the capital M in "Model" was transcribed as lowercase. A technical manual is judged Uncertain because its predictions disagree on the capitalization of "Model." The two documents come from different domains, but both reasons land in the same cluster: case confusion. The next stage generates brand-new documents around that cluster to cover this kind of capitalization difficulty. That is Training Planning: turning scattered diagnoses into the problems the next round of training should cover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 3: Generate data that targets the weakness and still looks like a real document
&lt;/h2&gt;

&lt;p&gt;Reason clusters give the generator a clear target, but counting samples hides two problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Self-repetition. A thousand generated samples may share one set of layout habits and phrasing, like one person talking to themselves. The count goes up while the distribution stays narrow.&lt;/li&gt;
&lt;li&gt;Overemphasized difficulty. Without real-world style references, the generator may draw a structure too neat and too prominent just to make the point. A model can learn those exercises and still fail to recognize the same structure in natural documents.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So Stage 3 takes two kinds of input. The reason clusters say which difficulties to cover, and real samples supply layout and visual style. Each generation run draws a different sample from the real pool, so a cluster is never tied to one template. In the capitalization example, the difficulty shows up in different real layouts: "Model selection" in a research article, and "MODEL" and "model_id = 07" in a technical spec. A reason that came from perturbation goes in more directly. If the model is sensitive to slight rescaling or compression, describing the problem isn't enough, so the generated documents have to carry those changes again and again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsfva339b1aor5uvxx5g3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsfva339b1aor5uvxx5g3.png" alt="Data Generation: one structural difficulty is combined with different real-world styles to generate documents, which are validated before training." width="799" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The General VLM writes code that draws, typesets, and renders documents, and a program runs it to produce the images and labels. The difficulty has to be a feature visible in the image, not just a line in the prompt. Then comes validation. Targeted generation tends to overdo the difficulty: cells made too small, formulas written with nonstandard symbols, the wrong delimiters where text and formulas mix. Output like that can render fine and still break the standard. Only data that passes rule-based validation and filtering goes into the next round of training.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we know the next round improved
&lt;/h2&gt;

&lt;p&gt;Data that passes filtering trains the next round of OXR. The updated model then faces real documents again, and its new predictions and classifications become the starting point of the next round. That is why RSI sits in post-training and runs repeatedly: one round's results change the next round's inputs.&lt;/p&gt;

&lt;p&gt;We track the repair rate. We re-run the previous round's Wrong samples through the updated OXR, have the General VLM judge them again, and divide the number that turn Correct by the number originally labeled Wrong. This is the share of the same samples the VLM now judges correct. It is not accuracy on an independent test set, and nobody checked each case by hand. Overall model accuracy is what the three public benchmarks above report.&lt;/p&gt;

&lt;p&gt;In theory RSI can iterate without limit, but iterating doesn't guarantee progress. Four things to watch when it keeps running:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find problems with real documents. The input for finding and attributing weaknesses has to be real documents, not synthetic ones, so the weaknesses it finds don't lean toward cases the generator created itself.&lt;/li&gt;
&lt;li&gt;Use enough samples per round. With too few documents, you only see scattered bad cases. With enough, reason clusters have more support and Training Planning has a firmer basis.&lt;/li&gt;
&lt;li&gt;Weigh quantity and diversity together. Cover different sources, time periods, document types, and layouts. A large set of near-identical documents keeps exposing the same problem.&lt;/li&gt;
&lt;li&gt;Build solid base capabilities first. RSI-generated samples are a small share of the overall training data, so they can't carry all the optimization. RSI strengthens specific weaknesses on top of a solid foundation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What you can take from this
&lt;/h2&gt;

&lt;p&gt;Looking back, the design relies on document parsing having correct answers. Because right and wrong can be judged automatically, the verdicts can be turned into directions for building data. Because exercises can be generated by a program, training data doesn't depend on human annotation. Because generation quality has executable standards, automated attempts can run at scale. Together with the training that follows, the three stages make up one RSI round.&lt;/p&gt;

&lt;p&gt;The model's size follows from this too. With the data distribution better covered, the 1.3B OXR doesn't have to lean on parameter count for accuracy, and its small size plus a task-level architecture design gives it speed. We think it can get smaller still.&lt;/p&gt;

&lt;p&gt;The approach may not stop at document parsing. Any task with a stable, automatically checkable success criterion could automate the same chain: find weaknesses, build supervision, validate data. Document parsing is the case we've gotten working.&lt;/p&gt;

&lt;p&gt;Try &lt;a href="https://free-oxr.somark.ai" rel="noopener noreferrer"&gt;OXR&lt;/a&gt; on your own documents, and &lt;a href="https://free-oxr.somark.ai/feedback" rel="noopener noreferrer"&gt;tell us&lt;/a&gt; where it still reads them wrong.&lt;/p&gt;

&lt;p&gt;--&amp;gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  About OXR and SoMark
&lt;/h2&gt;

&lt;p&gt;OXR is a 1.3B open-source document parsing model from the team behind SoMark. It ranks #1 on olmOCR-Bench, OmniDocBench, and DocParsingBench and delivers SOTA parsing speed. The model uses a recursive self-improvement (RSI) loop during post-training.&lt;/p&gt;

&lt;p&gt;SoMark is a production-grade document parsing engine for agents, powered by an independent model. It supports more file formats, finer-grained recognition of document elements, and faster processing. It also offers extensive post-processing features, custom development, and model training services for different business needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If OXR saves you time, give it a ⭐ on GitHub: &lt;a href="https://github.com/SoMarkAI/OXR" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/OXR&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>ocr</category>
    </item>
    <item>
      <title>The Long-Overlooked Performance Cost in Document Parsing: Reading Order</title>
      <dc:creator>Luming</dc:creator>
      <pubDate>Fri, 23 Oct 2026 16:00:00 +0000</pubDate>
      <link>https://dev.to/luming/the-long-overlooked-performance-cost-in-document-parsing-reading-order-504c</link>
      <guid>https://dev.to/luming/the-long-overlooked-performance-cost-in-document-parsing-reading-order-504c</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every document parser has to decide reading order, and the usual designs pay for it in either speed or labeling. OXR moves it into recognition and makes layout analysis a pluggable module.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Where should reading order live in a document parsing pipeline?&lt;/p&gt;

&lt;p&gt;Most of the attention in document parsing goes to recognition. But where you put reading order decides how fast the pipeline runs and how much data you have to label to adapt it to your business.&lt;/p&gt;

&lt;p&gt;That question shaped OXR, a 1.3B open-source document parsing model from the team behind SoMark. It turns PDFs and document images into Agent-Friendly data, in Markdown or JSON.&lt;/p&gt;

&lt;p&gt;OXR runs reading order together with recognition, in the same model and the same stage, and keeps layout analysis as a separate, lighter model that you can swap out. Together with its recursive self-improvement (RSI) training, this task-level design is part of why OXR ranks #1 on olmOCR-Bench, OmniDocBench, and DocParsingBench, and ranks #1 among open-source document parsing models in speed tests on an RTX PRO 6000. The rest of this post explains why we designed it this way and how it compares with the other options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every parser runs the same three steps
&lt;/h2&gt;

&lt;p&gt;Over the past two years, document intelligence has filled with new players, and most of them started with parsing. The industry has settled on three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Layout analysis: detect the position and type of each element on the page.&lt;/li&gt;
&lt;li&gt;Element recognition: process each element according to its type.&lt;/li&gt;
&lt;li&gt;Reading order: arrange the elements in natural reading order.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkahroac8ggqis6xuenar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkahroac8ggqis6xuenar.png" alt="A typical document parsing pipeline: layout analysis detects regions, each region is recognized by type, then reading order assembles the results into Markdown." width="799" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every one of these tasks has the same shape. Text is image to text, a formula is image to LaTeX, a table is image to an HTML table, and layout analysis is image to a string of coordinates. They all turn an image into a language sequence, so in principle one vision-language model (VLM) can do all of them. What differs between systems is how the work is split across models and stages, and that split is where the reading order cost comes from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four designs, four different bills
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyrr1e7dloy2fw286qz24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyrr1e7dloy2fw286qz24.png" alt="Model and stage structure of DotsOCR and DeepSeekOCR, Dolphin and MinerU 2.5, MonkeyOCR, PaddleOCR-VL, and OXR. Timings are simulated and relative, not measured runtimes." width="799" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1 model, 1 stage
&lt;/h3&gt;

&lt;p&gt;DotsOCR, DeepSeekOCR, and MinerU-VLM do layout analysis, reading order, and recognition in one pass. It is simple and slow, because the whole page comes out one token at a time.&lt;/p&gt;

&lt;h3&gt;
  
  
  1 model, 2 stages
&lt;/h3&gt;

&lt;p&gt;Dolphin and others run layout analysis and reading order first, then recognize all elements in parallel. That speeds up a page several times over, and MinerU went back to this approach in versions 2.0 and 2.5.&lt;/p&gt;

&lt;p&gt;A VLM still emits layout boxes one at a time, though, orders of magnitude slower than a conventional detector that outputs hundreds at once. The field accepted this because the order in which the VLM emits boxes is the reading order. Moving layout analysis out of the VLM would mean solving reading order with another model.&lt;/p&gt;

&lt;h3&gt;
  
  
  3 models, 3 stages
&lt;/h3&gt;

&lt;p&gt;MonkeyOCR pulled everything apart: layout analysis, then recognition, then reading order. Layout analysis became very fast, but reading order turned into its own sequential stage with a heavy model. LayoutReader is the only open-source reading order model, and it is large and slow.&lt;/p&gt;

&lt;h3&gt;
  
  
  2 models, 2 stages
&lt;/h3&gt;

&lt;p&gt;PaddleOCR-VL merged layout analysis and reading order into one small specialized model. That let layout analysis leave the VLM and return to detector speed, and it became the standard answer almost overnight. Many models released in 2026, including GLM-OCR and Falcon-OCR, use its layout-and-order model directly and build only their own recognition model.&lt;/p&gt;

&lt;p&gt;So is that the best we can do? The merged design has a price. Every new layout annotation needs a matching reading order annotation, which doubles the labeling work. Training it also means leaving the familiar PyTorch ecosystem: PaddleOCR is well engineered, but you lose the community's toolchain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layout rules differ by business, so layout analysis should stand alone
&lt;/h2&gt;

&lt;p&gt;How a document is written depends on the organization, the language, and the author, so there is no universal definition of layout. The same page can be divided in different valid ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Element type: is a text box a title plus text, or one table?&lt;/li&gt;
&lt;li&gt;Region boundary: is a dense group of pictures one region, or one region per picture?&lt;/li&gt;
&lt;li&gt;Content grouping: is a picture full of text one figure, or a figure plus text elements?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F701me3j9vtwycmeyh86s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F701me3j9vtwycmeyh86s.png" alt="Element type: the same project delivery page annotated under Standard A and Standard B" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz0mzgr4awlib48latr3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz0mzgr4awlib48latr3b.png" alt="Region boundary: the same leaf morphology page annotated under Standard A and Standard Bn" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq861ao4o5zgqbayf19vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq861ao4o5zgqbayf19vb.png" alt="Content grouping: the same rainwater recycling page annotated under Standard A and Standard B" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each answer serves a different need. For high-quality parsing, the need to customize layout analysis never goes away, so it helps to make that part independent.&lt;/p&gt;

&lt;h2&gt;
  
  
  OXR's answer: reading order goes with recognition
&lt;/h2&gt;

&lt;p&gt;Layout Analysis &lt;strong&gt;→&lt;/strong&gt; Recognition &lt;strong&gt;+&lt;/strong&gt; Reading Order&lt;/p&gt;

&lt;p&gt;Reading order benefits from understanding the content, so it belongs with recognition. Layout definitions depend on the business, so layout analysis stands on its own. OXR is also two models in two stages, with the split in a different place. A lightweight layout model returns only region types and bounding boxes. OXR then recognizes each region and, in the same stage, predicts the reading order from the full-page image plus each region's ID, type, and boundaries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fji3t20mpr3ng13wufz65.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fji3t20mpr3ng13wufz65.png" alt="OXR architecture: a pluggable Layout Analysis module feeds the OXR model, which handles Recognition and Reading Order." width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Faster and more accurate
&lt;/h3&gt;

&lt;p&gt;Parallel layout detection plus parallel element recognition already put two-model, two-stage designs far ahead of the others on speed. Reading order takes far less time than recognition, so running them together removes the time that reading order used to add to the pipeline. Layout analysis no longer carries reading order either, so a smaller layout model can reach the same accuracy.&lt;/p&gt;

&lt;p&gt;Reading order also becomes content-aware. It is predicted from the full page, with content and layout context together, so OXR can work out how columns, headings, captions, and body text relate, which a purely visual ordering model can miss.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pluggable layout analysis
&lt;/h3&gt;

&lt;p&gt;Layout analysis is now a fully independent model and task, and OXR doesn't restrict its form or categories. You can pick any approach from the object detection community, which has matured over decades, and plug it into the pipeline. In practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with the built-in layout model. It's in the &lt;code&gt;layout_analysis&lt;/code&gt; folder of the &lt;a href="https://huggingface.co/SoMarkAI/OXR-1.0/tree/main/layout_analysis" rel="noopener noreferrer"&gt;OXR weights on Hugging Face&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Bring your own detector if your business has its own layout rules. Adapt the interface, then re-evaluate reading order on your data.&lt;/li&gt;
&lt;li&gt;Fine-tune the layout model on your own annotations. Reading order is already trained into OXR, so you don't need to label it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The built-in model is based on &lt;a href="https://github.com/Peterande/D-FINE" rel="noopener noreferrer"&gt;D-FINE&lt;/a&gt;, a recent SOTA object detector. We trained and optimized it, and OXR ships the PyTorch model. D-FINE's authors don't provide deployment support, so we also optimized its operators and exported it for ONNX and TensorRT. That engineering code isn't open source yet because of commercial contracts we've already delivered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where reading order belongs
&lt;/h2&gt;

&lt;p&gt;Beyond model capability, how tasks fit together can be what separates one pipeline from another. Combining tasks or splitting them each has benefits and costs. Reading order rarely makes benchmark headlines, but it decides how fast your pipeline runs and how much labeling it takes to adapt a model to your documents. With reading order handled inside OXR, you can spend your effort on the layout rules that are specific to your business.&lt;/p&gt;

&lt;p&gt;Real documents are more varied than any design anticipates. Try &lt;a href="https://free-oxr.somark.ai" rel="noopener noreferrer"&gt;OXR&lt;/a&gt; on a page with a complex layout.&lt;/p&gt;

&lt;p&gt;If you find a page where OXR's reading order breaks, please share it through our &lt;a href="https://free-oxr.somark.ai/feedback" rel="noopener noreferrer"&gt;feedback form&lt;/a&gt;. Those are exactly the cases we want to learn from.&lt;/p&gt;




&lt;h2&gt;
  
  
  About OXR and SoMark
&lt;/h2&gt;

&lt;p&gt;OXR is a 1.3B open-source document parsing model from the team behind SoMark. It ranks #1 on olmOCR-Bench, OmniDocBench, and DocParsingBench and delivers SOTA parsing speed. The model uses a recursive self-improvement (RSI) loop during post-training.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If OXR saves you time, give it a ⭐ on GitHub: &lt;a href="https://github.com/SoMarkAI/OXR" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/OXR&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>machinelearning</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How to use OXR: From the free API to self-hosting</title>
      <dc:creator>Luming</dc:creator>
      <pubDate>Wed, 21 Oct 2026 15:30:00 +0000</pubDate>
      <link>https://dev.to/luming/how-to-use-oxr-from-the-free-api-to-self-hosting-1kb</link>
      <guid>https://dev.to/luming/how-to-use-oxr-from-the-free-api-to-self-hosting-1kb</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx086s4pon3zj966cuse5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx086s4pon3zj966cuse5.png" alt="How to use OXR: From Free API to Self-Hosting" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find out whether OXR handles your documents with one command, no GPU, signup, or API key. When you're ready to self-host, the same code works after changing one URL.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The best test of a document parser is your own documents. With OXR you can run them before you deploy anything: call the free API with one command, or open the online demo.&lt;/p&gt;

&lt;p&gt;OXR is a 1.3B open-source document parsing model from the team behind SoMark, a production-grade document parsing engine for agents. It turns PDFs and document images into Agent-Friendly data, in Markdown or JSON, and ranks #1 on olmOCR-Bench, OmniDocBench, and DocParsingBench. Its API is compatible with SoMark's, so the same SDK and CLI work from the free API to your own server.&lt;/p&gt;

&lt;p&gt;This guide goes from a first test to self-hosting: try the free API and the demo, plug OXR into your app, then run it on your own GPU.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try OXR before you deploy anything
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Free API
&lt;/h3&gt;

&lt;p&gt;OXR provides a free API for testing on your own documents, with no registration and no API key. It works with SoMark's official CLI, so it takes two steps. Install the CLI with Python or JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# using Python&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;somark

&lt;span class="c"&gt;# or using JavaScript&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; somark-js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then parse a document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;somark &lt;span class="nt"&gt;--base-url&lt;/span&gt; https://free-oxr.somark.ai/api/v1 &lt;span class="nt"&gt;--api-key&lt;/span&gt; dummy &lt;span class="se"&gt;\&lt;/span&gt;
  parse document.pdf &lt;span class="nt"&gt;--formats&lt;/span&gt; md,json &lt;span class="nt"&gt;--out&lt;/span&gt; ./parsed-output/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;document.pdf&lt;/code&gt; with the path to your file. &lt;code&gt;dummy&lt;/code&gt; is a placeholder, and you don't need a real API key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0wc961o4vus616bbhi00.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0wc961o4vus616bbhi00.gif" alt="Animated OXR parsing example" width="199" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We ran the command on a two-column page from an academic paper, with a figure, body text, and a table. It took about 20 seconds and wrote two files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;parsed-output/
├── document.md      # the page as Markdown, in reading order
└── document.json    # every block with its type, position, and content
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is an excerpt of &lt;code&gt;document.json&lt;/code&gt;, with long values shortened and coordinates rounded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"page_num"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"page_size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1241&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1654&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"blocks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"idx"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"bbox"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;753&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;606&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;908&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"For a comparison of the relevance of different research themes ... ‘communication in"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"idx"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"bbox"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;636&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;487&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1166&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;529&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"marketing' (248.8), 'advertising-psychological aspects' (220.5) and 'pricing' (206.3)."&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"idx"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Table"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"bbox"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;977&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1169&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1398&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Author&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Papers&amp;lt;/td&amp;gt; ..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"html"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Block 4 is the bottom of the left column, and block 5 picks up the same sentence at the top of the right column. Blocks come back in reading order, each with its type and position on the page. Tables are returned as HTML, and figures as image links in the Markdown.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Global&lt;/th&gt;
&lt;th&gt;Mirror&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Base URL&lt;/td&gt;
&lt;td&gt;&lt;a href="https://free-oxr.somark.ai/api/v1" rel="noopener noreferrer"&gt;https://free-oxr.somark.ai/api/v1&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://free-oxr.somark.cn/api/v1" rel="noopener noreferrer"&gt;https://free-oxr.somark.cn/api/v1&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API documentation&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.somark.ai/api-reference" rel="noopener noreferrer"&gt;https://docs.somark.ai/api-reference&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.somark.cn/api-reference" rel="noopener noreferrer"&gt;https://docs.somark.cn/api-reference&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;somark.cn is a mirror of somark.ai, so use whichever is faster for your region. The API stays free until our servers can no longer handle the load. It isn't meant for production: there is no stability guarantee, and requests are queued, so speed varies. For production, self-host OXR.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prefer to look first? Try the online demo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faluymebdkbop70oli79h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faluymebdkbop70oli79h.png" alt="The OXR online demo after uploading a document: the original page with layout boxes on the left, and the parsed Markdown preview on the right." width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the &lt;a href="https://free-oxr.somark.ai" rel="noopener noreferrer"&gt;online demo&lt;/a&gt;, upload a PDF or an image, and compare the result with the original page: the Markdown preview, the layout boxes, and the reading order. There is nothing to install.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plug OXR into your app
&lt;/h2&gt;

&lt;p&gt;OXR's API is compatible with SoMark's, so SoMark's official Python and JavaScript SDKs and CLI work with OXR. The same code runs against the free API and your own deployment, and you only change the base URL. The &lt;a href="https://docs.somark.ai/en/cli-sdk" rel="noopener noreferrer"&gt;SDK and CLI docs&lt;/a&gt; cover the details. A few SoMark-only options (image understanding, inline images, table images) are accepted but ignored, because open-source OXR implements only &lt;code&gt;keep_header_footer&lt;/code&gt;. If you see a warning about them, it is harmless.&lt;/p&gt;

&lt;p&gt;To call the HTTP API directly, use these endpoints, relative to the base URL:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Endpoint&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;POST {base URL}/parse/sync&lt;/td&gt;
&lt;td&gt;Upload a file and wait for the result&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST {base URL}/parse/async&lt;/td&gt;
&lt;td&gt;Submit a file and get a task_id&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST {base URL}/parse/async_check&lt;/td&gt;
&lt;td&gt;Check the async status and result by task_id&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Output formats are set per request with the &lt;code&gt;output_formats&lt;/code&gt; field. For example, against the free API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;--fail-with-body&lt;/span&gt; https://free-oxr.somark.ai/api/v1/parse/sync &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s1"&gt;'file=@document.pdf'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s1"&gt;'api_key=dummy'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s1"&gt;'output_formats=markdown'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s1"&gt;'output_formats=json'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;document.pdf&lt;/code&gt; can be a local PDF or any document image that OpenCV can decode. To call your own deployment instead, use &lt;code&gt;http://localhost:8000/v1&lt;/code&gt; as the base URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run OXR on your own GPU
&lt;/h2&gt;

&lt;p&gt;The free API is enough to evaluate OXR. Self-host when your documents must stay in your environment, or when you want to tune throughput or swap in your own layout model. Layout analysis is a pluggable module, so you keep OXR's recognition and reading order.&lt;/p&gt;

&lt;p&gt;You need Linux and an NVIDIA GPU with BF16 support, with a driver compatible with CUDA 13.0. A single 24GB GPU is enough for low-concurrency testing, and 48GB or more is recommended for long documents and higher concurrency. Running with Docker also requires Docker and the NVIDIA Container Toolkit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Download the code and weights
&lt;/h3&gt;

&lt;p&gt;The OXR-1.0 weights (BF16) are on &lt;a href="https://huggingface.co/SoMarkAI/OXR-1.0" rel="noopener noreferrer"&gt;Hugging Face&lt;/a&gt; and &lt;a href="https://modelscope.cn/models/SoMark/OXR-1.0" rel="noopener noreferrer"&gt;ModelScope&lt;/a&gt;. They include a lightweight layout analysis model in the &lt;code&gt;layout_analysis&lt;/code&gt; folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/SoMarkAI/OXR.git
&lt;span class="nb"&gt;cd &lt;/span&gt;OXR

&lt;span class="c"&gt;# pip install -U huggingface_hub&lt;/span&gt;
hf download SoMarkAI/OXR-1.0 &lt;span class="nt"&gt;--local-dir&lt;/span&gt; ./models/OXR-1.0

&lt;span class="c"&gt;# or using ModelScope&lt;/span&gt;
&lt;span class="c"&gt;# pip install -U modelscope-hub&lt;/span&gt;
modelscope download SoMark/OXR-1.0 &lt;span class="nt"&gt;--local_dir&lt;/span&gt; ./models/OXR-1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Start with Docker
&lt;/h3&gt;

&lt;p&gt;We recommend Docker, which starts all services together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-f&lt;/span&gt; docker/Dockerfile.allinone &lt;span class="nt"&gt;-t&lt;/span&gt; oxr-1.0 &lt;span class="nb"&gt;.&lt;/span&gt;
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;--gpus&lt;/span&gt; all &lt;span class="nt"&gt;--ipc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 127.0.0.1:8000:8000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/models/OXR-1.0:/models/oxr-model:ro"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  oxr-1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the startup logs show that the services are ready, open &lt;a href="http://localhost:8000/demo" rel="noopener noreferrer"&gt;http://localhost:8000/demo&lt;/a&gt; or &lt;a href="http://localhost:8000/docs" rel="noopener noreferrer"&gt;http://localhost:8000/docs&lt;/a&gt;. The first start can take a while, and the default startup timeout is 900 seconds.&lt;/p&gt;

&lt;p&gt;Prefer to run the three services (the OXR model, the layout analysis model, and the document parsing API) yourself? Follow "Run from Source" in the &lt;a href="https://github.com/SoMarkAI/OXR#122-run-from-source" rel="noopener noreferrer"&gt;OXR README&lt;/a&gt;. The official vLLM release does not support OXR inference yet, so we ship an out-of-tree plugin and a loading script in the weights folder on Hugging Face. You can use it directly with the official vLLM Docker image or CLI, with no recompiling.&lt;/p&gt;

&lt;h3&gt;
  
  
  Check the result and call your server
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwx5jdraoefd8tgni7em5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwx5jdraoefd8tgni7em5.png" alt="The OXR online demo before a file is uploaded: drop a PDF or image on the page, and the parsed result appears on the right." width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open &lt;a href="http://localhost:8000/demo" rel="noopener noreferrer"&gt;http://localhost:8000/demo&lt;/a&gt; and upload a PDF or image. You can view the original file, the Markdown preview and source, the layout boxes, and the reading order, and download the Markdown. Interactive API documentation is at &lt;a href="http://localhost:8000/docs" rel="noopener noreferrer"&gt;http://localhost:8000/docs&lt;/a&gt;. The demo keeps results in a temporary cache for 1 hour by default, renewed while a file is processing, so download what you need.&lt;/p&gt;

&lt;p&gt;To call your server from code, use the same CLI command with your local base URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;somark &lt;span class="nt"&gt;--base-url&lt;/span&gt; http://localhost:8000/v1 &lt;span class="nt"&gt;--api-key&lt;/span&gt; dummy &lt;span class="se"&gt;\&lt;/span&gt;
  parse document.pdf &lt;span class="nt"&gt;--formats&lt;/span&gt; md,json &lt;span class="nt"&gt;--out&lt;/span&gt; ./parsed-output/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Tune for your hardware
&lt;/h3&gt;

&lt;p&gt;The defaults suit most single-GPU setups. To fit OXR into less GPU memory or a specific workload, adjust these parameters:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Default&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;VLLM_GPU_MEMORY_UTILIZATION&lt;/td&gt;
&lt;td&gt;0.70&lt;/td&gt;
&lt;td&gt;Fraction of GPU memory budgeted for vLLM, greater than 0 and less than 1. Leave GPU memory for the layout analysis service.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VLLM_MAX_MODEL_LEN&lt;/td&gt;
&lt;td&gt;16384&lt;/td&gt;
&lt;td&gt;Context token limit for a single model request, including the image, prompt, and output.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OXR_&lt;em&gt;OXR_MODEL&lt;/em&gt;_MAX_TOKENS&lt;/td&gt;
&lt;td&gt;8192&lt;/td&gt;
&lt;td&gt;Maximum output tokens for a single region recognition request. Set it together with the context limit.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OXR_&lt;em&gt;OXR_MODEL&lt;/em&gt;_MAX_CONCURRENCY&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;Concurrency limit for model requests shared within the API process, including region recognition and reading order requests.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OXR_&lt;em&gt;LAYOUT_ANALYZE_MODEL&lt;/em&gt;_BATCH_SIZE&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Number of pages per layout analysis request.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OXR_&lt;em&gt;LAYOUT_ANALYZE_MODEL&lt;/em&gt;_MAX_CONCURRENCY&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Concurrency limit for layout analysis requests within a single document parsing job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DFINE_CUDA_GRAPH&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;CUDA Graph switch for layout analysis. Set it to 0 to turn it off.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Input tokens plus the maximum output tokens can't exceed VLLM_MAX_MODEL_LEN, and lowering MAX_TOKENS may truncate long text or tables. This example limits concurrency and turns CUDA Graph off:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;--gpus&lt;/span&gt; all &lt;span class="nt"&gt;--ipc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 127.0.0.1:8000:8000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/models/OXR-1.0:/models/oxr-model:ro"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;OXR__OXR_MODEL__MAX_CONCURRENCY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;OXR__LAYOUT_ANALYZE_MODEL__BATCH_SIZE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;OXR__LAYOUT_ANALYZE_MODEL__MAX_CONCURRENCY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;DFINE_CUDA_GRAPH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;VLLM_EXTRA_ARGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"--enforce-eager --max-num-batched-tokens 8192"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  oxr-1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Tools around OXR
&lt;/h2&gt;

&lt;p&gt;The SoMark team has built a few more tools for document parsing. If they help, a ⭐ is welcome.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Project URL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SoMarkDown&lt;/td&gt;
&lt;td&gt;The official Markdown parsing and rendering library for SoMark and OXR&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/SoMarkAI/SoMarkDown" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/SoMarkDown&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SoMarkDownViewer&lt;/td&gt;
&lt;td&gt;A live editing application for SoMarkDown&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/SoMarkAI/SoMarkDownViewer" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/SoMarkDownViewer&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SoPDF&lt;/td&gt;
&lt;td&gt;A high-performance PDF processing library with a permissive open-source license&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/SoMarkAI/SoPDF" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/SoPDF&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Docision&lt;/td&gt;
&lt;td&gt;MultiModal Jev for Document.&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/SoMarkAI/docision" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/docision&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;somark-py&lt;/td&gt;
&lt;td&gt;The official Python SDK &amp;amp; CLI for SoMark and OXR&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/SoMarkAI/somark-py" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/somark-py&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;somark-js&lt;/td&gt;
&lt;td&gt;The official JS / TS SDK &amp;amp; CLI for SoMark and OXR&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/SoMarkAI/somark-js" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/somark-js&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Try it on your own documents
&lt;/h2&gt;

&lt;p&gt;Run OXR on the documents you work with every day, including the ones with tables and complex layouts, and &lt;a href="https://free-oxr.somark.ai/feedback" rel="noopener noreferrer"&gt;tell us&lt;/a&gt; where it parses them wrong. Questions, sample pages, and ideas are also welcome on &lt;a href="https://github.com/SoMarkAI/OXR" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  About OXR and SoMark
&lt;/h2&gt;

&lt;p&gt;OXR is a 1.3B open-source document parsing model from the team behind SoMark. It ranks #1 on olmOCR-Bench, OmniDocBench, and DocParsingBench and delivers SOTA parsing speed. The model uses a recursive self-improvement (RSI) loop during post-training.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If OXR saves you time, give it a ⭐ on GitHub: &lt;a href="https://github.com/SoMarkAI/OXR" rel="noopener noreferrer"&gt;https://github.com/SoMarkAI/OXR&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>tutorial</category>
      <category>python</category>
    </item>
  </channel>
</rss>
