Every RAG pipeline has the same unglamorous bottleneck: the documents. Reports, contracts, invoices, scanned forms — that is where most organizational knowledge lives, and turning it into clean, structured text has always meant choosing between fast extractors that mangle tables, heavy vision models that need a GPU, or a paid cloud API with a per-page meter running.

On November 23, LlamaIndex released OCRia-nano-1: an 8.1-million-parameter document-parsing pipeline that runs on CPU inside LiteParse, its open-source local parser. It reads text, rebuilds tables, and recovers page layout — no GPU, no API key, no account, no cloud. This tutorial runs it end to end: install the parser, parse a born-digital report, parse a noisy scan, route documents with a cheap triage command, batch-parse a whole folder, and pull structured JSON into a RAG pipeline. Every command and output below was run live and is reproduced as it came out.

What you'll need#

  • Python 3.10 or newer. I used 3.12. The parser also ships for Node.js, Rust, and the browser (WASM), but this tutorial uses the Python install.
  • About 150 MB of free disk. The package plus a one-time 60–75 MB model download.
  • A terminal and a PDF or two of your own. The tutorial uses two test documents I generated — a two-page report with a table, and a noisy image-only scan — so you can compare your output against mine.
  • Nothing else. No GPU, no API key, no account, no cloud service. macOS, Linux, and Windows are all supported.

One thing to check before you build on it: the license. LiteParse itself is Apache 2.0. The model weights are under a modified Open RAIL-M license — free for research, personal use, and commercial use by organizations under $2M in annual revenue and under $2M in total funding. Above those thresholds, or for any document-parsing product that competes with LlamaParse, you need a commercial license. Read the model card before shipping it into a product. You own your outputs either way.

Step 1: Install LiteParse and pull the models#

LiteParse is the parser; OCRia-nano-1 is an optional model package that plugs into it. Install the package, check the version, then pull the models once:

pip install liteparse
lit --version
lit models pull ocria-nano
lit models list

On my machine that installed LiteParse 2.21.4, and the pull fetched [email protected] — 59.9 MB of ONNX models plus ONNX Runtime 1.31.1 — with every file checked against a pinned sha256 hash. Once pulled, OCRia-nano-1 becomes the default OCR backend; --ocr-backend tesseract switches back to the bundled Tesseract for a single run, and lit models rm ocria-nano removes the package. Models live in ~/.cache/liteparse/models by default; set LITEPARSE_MODEL_DIR to move them.

What you just downloaded is seven small models that split the work:

ModelRoleParameters
Text-line detectorFinds text lines on the rendered page0.08M
Script routerPicks a recognizer per line; spots upside-down lines0.04M
Latin recognizerReads Latin-script text0.80M
World-script recognizerReads about 17 other scripts0.98M
RTL recognizerReads Arabic and Hebrew0.71M
CJK recognizerReads Chinese, Japanese, and Korean1.27M
LayoutNetRecovers tables and classifies layout blocks4.27M

The seven add up to 8.1M parameters. They were distilled from OCRia-1, LlamaIndex's 4-billion-parameter document vision model — roughly 1/500th of the teacher's size. The pipeline is: LiteParse reads the text layer straight from the PDF where it exists, the detector and recognizers supply OCR where it doesn't (scans, embedded images), and LayoutNet rebuilds tables and layout from the text, its position, and visual features.

Diagram of the OCRia-nano-1 pipeline: a PDF page passes through a text-line detector, a script router, four script recognizers, and LayoutNet to produce Markdown and JSON output
AI-generated diagram of the OCRia-nano-1 pipeline inside LiteParse.

Step 2: Parse a born-digital PDF to Markdown#

Start with the easy case: a PDF with a real text layer. My test document is a two-page water-quality report — headings, paragraphs, a ruled table, and a short action list. Parse it to Markdown:

lit parse digital.pdf --format markdown -o digital.md

The whole run took 1.8 seconds for two pages, including process startup and model loading. Here is the output, exactly as it came out:

# Riverside Water Quality Report

Quarterly summary - Q3 2026

## Summary

All twelve sampling stations met the provincial standard for treated water
in Q3 2026. Average turbidity fell 8 percent against Q2, and no station
recorded a coliform exceedance during the quarter.

## Station readings

Readings below are monthly averages for September 2026.

| Station | Turbidity (NTU) | pH | Coliform (CFU/100mL) |
|---|---|---|---|
| North Intake | 0.42 | 7.1 | 0 |
| South Intake | 0.51 | 7.3 | 0 |
| Elm Street | 0.38 | 7.0 | 1 |
| Harbour Pumping | 0.66 | 7.4 | 0 |

## Actions

- Replace the filter media at Harbour Pumping before December.
- Re-test Elm Street after the main flush on October 12.
- Publish the Q4 schedule by November 15.

-----

## Method note

Samples were collected weekly at each station and analysed in the municipal
laboratory. Turbidity is reported in nephelometric turbidity units (NTU). The
coliform column counts colony-forming units per 100 millilitres.

That is the result to aim for. The heading hierarchy came through (# title, ## sections), the ruled table was rebuilt as a Markdown table with all four rows and every value intact, the list kept its bullets, and the page break became a horizontal rule. This is Markdown your chunker can eat directly.

A few flags worth knowing at this stage. The default output format is plain text — --format markdown and --format json are the other two. --target-pages "1-5,10" parses a subset. --no-ocr skips OCR entirely (LayoutNet still runs when Nano is the backend). Pages render at 250 DPI for OCR with Nano, 150 DPI with Tesseract; --dpi overrides it. And running headers and footers are stripped from the Markdown by default — add --keep-headers-footers if you want them.

Step 3: Parse a scanned page — the OCR path#

Digital PDFs are the easy case; the interesting question is what happens when there is no text layer at all. My second test document is a field-inspection note rendered to an image, rotated 0.4°, speckled with noise, and embedded as an image-only PDF page — the kind of thing that comes out of a scanner or a phone camera. Same command:

lit parse scanned.pdf --format markdown -o scanned.md

It took 0.9 seconds. Here is the output, again exactly as it came out:

# Field Inspection Note

The intake screen was clear. Flow held steady at 412 litres per second
through the morning shift. Two readings were logged:

Bearing temperature: 61.4 C Vibration: 2.1 mm/s RMS Recommendation:
schedule the bearing swap before the winter freeze.

Read it against the original and the picture is honest. Nearly every word is right — including the numbers, 412 litres per second and 61.4 C, which are the tokens you actually care about in a document like this. But two things went wrong: the subtitle line, "Pump Station 4 - 14 October 2026", vanished entirely, and the two bullet readings were flattened into a single run-on paragraph. The detector found the lines; the layout classifier did not preserve the list structure on this noisy page.

That is the right way to think about Nano on scans: a fast, accurate first pass, not a transcript. On clean scans it does better than this; on degraded ones, check the output — especially short lines, which are the first thing a layout model drops. Two hard limits to know: Nano has no chart model, so charts stay as images in the output, and it does not read handwriting. Both of those are OCRia-1 territory, which is the cloud LlamaParse route in the decision section below.

One more thing the scan demonstrates: multilingual handling is automatic. The script router picks a recognizer per line — Latin, CJK, right-to-left (Arabic, Hebrew), or the world-script model covering about 17 more scripts — and detects upside-down lines before recognition. The --ocr-language flag applies to Tesseract only; Nano detects the script itself.

Step 4: Route documents with is-complex#

Before you parse a whole collection, LiteParse can tell you which documents actually need OCR. lit is-complex is a cheap text-layer-only pass: per-page JSON to stdout, a human-readable verdict to stderr, and a non-zero exit code when any page needs OCR. Run it on both test documents:

lit is-complex digital.pdf
lit is-complex scanned.pdf

The scan comes back as expected — one page, needs_ocr: true, reason scanned. The surprise is the digital report: it also exits non-zero, because page 2 was flagged needs_ocr: true with reason sparse-text. Page 2 is a short method note — 228 characters — and the triage is conservative about pages with very little text. The full list of reasons is scanned, no-text, sparse-text, embedded-images, garbled, vector-text, and annotation-text.

Treat the verdict as a routing hint, not a verdict on quality. The intended pattern is a shell predicate — only pay for the full parse when the document needs it:

# Only parse with --no-ocr when the document is simple
lit is-complex document.pdf --quiet && lit parse document.pdf --no-ocr

# List the pages that need OCR
lit is-complex document.pdf --compact | jq '[.[] | select(.needs_ocr) | .page_number]'

In a real ingestion pipeline this is where the money is saved: most corporate collections are 80–90% born-digital, and skipping OCR on those pages is what keeps the throughput numbers in the next step honest.

Workflow diagram: a folder of PDFs goes through is-complex triage, then lit parse with OCRia-nano-1, producing Markdown files that feed a RAG index
AI-generated diagram of the document workflow: triage, parse, Markdown, RAG index.

Step 5: Batch-parse a whole folder#

Single-file parsing is for testing. For a collection, point batch-parse at a directory:

lit batch-parse ./inbox ./outbox --format markdown

With both test documents in the inbox, the run finished in 2.3 seconds: batch complete: 2 succeeded, 0 failed, with digital.md and scanned.md in the outbox. Useful options: --recursive to walk subdirectories, --extension ".pdf" to filter by suffix, --num-workers to set the OCR worker count (the default is CPU cores minus one), and --format json or --format text to change the output.

On speed, LlamaIndex's published numbers — measured on 300 random ParseBench pages on a 16-vCPU container, one worker per core — are 27.8 pages per second with Nano, against 14.2 with Tesseract, and a mean of 426 ms per page on a single core (90% of pages finish within 862 ms). My two-page runs are consistent with that: on small jobs, model loading dominates and per-page time is noise. The practical reading is that a laptop CPU chews through a thousand-page collection in minutes, not hours, and the whole thing runs offline.

Step 6: Get structured JSON for RAG grounding#

Markdown is the right output for chunking and embedding. But when your RAG answers need to cite the source — "which page, which table cell" — you want the JSON output with layout blocks:

lit parse digital.pdf --format json --extract-blocks -o digital.json

Each page then carries a blocks array in reading order — the same blocks the Markdown renderer is built from. Every block has a kind (heading, paragraph, merged_table, list_item, figure, and others), a bbox in 72-DPI viewport coordinates, and text_item_indices linking back to the text items it was read from. The table block from my report looks like this:

{
  "kind": "merged_table",
  "bbox": {"x": 31.57, "y": 222.4, "width": 430.81, "height": 100.27},
  "header_rows": 1,
  "rows": [
    ["Station", "Turbidity (NTU)", "pH", "Coliform (CFU/100mL)"],
    ["North Intake", "0.42", "7.1", "0"],
    ["South Intake", "0.51", "7.3", "0"]
  ],
  "text_item_indices": [12, 13, 14, 15, 16, 17, 18, 19]
}

That is what grounding looks like in practice: a retrieved chunk can carry the table it came from plus the bounding box of that table on the page, so your UI can highlight the exact region. The JSON text items also carry OCR confidence scores, so you can route low-confidence pages to a human or a bigger model instead of silently indexing guesses.

If you would rather call it from code than shell out, the Python API is thin — this snippet is from the model card and I verified the same call shape locally:

from liteparse import LiteParse, models

models.pull("ocria-nano")
result = LiteParse(ocr_backend="ocria-nano", output_format="markdown").parse("scan.pdf")
print(result.text)

Node.js has the equivalent (new LiteParse({ ocrBackend: "ocria-nano" })), and the same models run in the browser through the WASM package — about 1–4 seconds per scanned page on a laptop, single-threaded. From here the RAG wiring is the familiar shape: Markdown out of LiteParse, chunks into your vector store, JSON bounding boxes kept alongside for citations. If you are building the retrieval side, the blog's LanceDB hybrid-search and Chroma local-embeddings tutorials pick up exactly where this one ends.

Which approach should you use?#

Nano is not the only local parser, and the right one depends on what your documents look like. The numbers below are ParseBench-2 overall scores from LlamaIndex's technical report and model card, measured on the same 16-vCPU machine; treat vendor-run benchmarks as a starting point and reproduce them with the official parse-bench scorer if the choice matters to you.

ApproachParseBench-2ThroughputUse when
LiteParse + OCRia-nano-159.227.8 pages/sEveryday documents at volume; best local accuracy–speed balance
LiteParse + Tesseract (default)48.714.2 pages/sNo model downloads; air-gapped; simple text extraction
Marker 2.2.0 (fast)52.524.7 pages/sYou want a standalone Python parser with good layout
Indra 1.1.255.129.6 pages/sRaw speed matters most and 55.1 is good enough
LiteParse + PaddleOCR (PP-OCRv6 tiny)58.914.7 pages/sNear-Nano accuracy and you already run PaddleOCR
OCRia-1 via LlamaParse (cloud, GPU)87.0—Handwriting, dense tables, charts-as-data, heavily degraded scans

The decision in one paragraph: if your documents are everyday reports, contracts, and invoices, Nano is the default — it beats Tesseract by more than 10 points on ParseBench-2 while running twice as fast, and it is the only option here that recovers tables properly. If you cannot download models, stay on Tesseract. If you need chart data extracted as tables, or you are reading handwriting, no local parser on this list does it — that is the paid LlamaParse route, which scores 87.0 because its teacher model runs on a GPU. And if you already have a working Docling or MarkItDown pipeline, do not churn: the marginal accuracy is not worth rebuilding ingestion that already works.

The takeaway#

The ingestion step that used to need a GPU or a cloud bill now runs on a laptop CPU in under half a second a page, and the output is Markdown your retriever can eat directly. The working checklist:

  1. Install once: pip install liteparse, then lit models pull ocria-nano.
  2. Parse to Markdown and read the output — check the tables first, because that is where parsers fail silently.
  3. Triage with is-complex before you pay for OCR on a whole collection, and remember it flags short pages as sparse-text.
  4. Batch with batch-parse and let the workers run — a thousand pages is minutes, offline.
  5. Ground with JSON blocks when answers need citations: keep the bounding boxes alongside your chunks.

And keep the honest limit in mind: Nano is a first pass. On my noisy scan it dropped a line and flattened a list. For the documents that pay the bills — contracts, invoices, reports — verify the output once, then let it run. The parser is the smallest part of your RAG system; the win is that it is finally small enough to run anywhere.