Unstructured vs LlamaParse: Which PDF Parser to Pick for RAG (2026)
Direct answer: Pick Unstructured if you want an open-source library you can self-host, run air-gapped, and wire into your own pipeline — it partitions documents into typed elements (titles, tables, lists, narrative text) that map cleanly onto chunking, and it has a hosted API if you don’t want to run it. Pick LlamaParse if you want a hosted parser that returns clean, LLM-ready Markdown with strong table reconstruction and minimal setup, and you’re fine sending documents to a third-party API and paying per page. The decision usually comes down to one axis: do you need self-hosting/data control (Unstructured) or do you want the least-effort path to good Markdown (LlamaParse)?
This post compares the two for RAG and LLM pipelines: setup and DX, open-source vs hosted pricing, table handling, scanned/OCR support, output format, speed, self-hosting and privacy, RAG-readiness, and licensing.
The two tools at a glance
Both convert PDFs into something a RAG pipeline can chunk and embed. They come at the problem from opposite directions.
- Unstructured (unstructured.io) is primarily an open-source Python library,
unstructured, that partitions documents into a list of typed elements —Title,NarrativeText,Table,ListItem,Image, and so on — each with metadata (page number, coordinates, parent section). It also offers a hosted Serverless API and connectors for ingesting from S3, Google Drive, SharePoint, and dozens of other sources. The mental model is a document-processing framework, not just a converter. - LlamaParse is a hosted parsing API from the LlamaIndex team. You upload a document, it returns Markdown (or structured JSON), and it’s tuned to produce output that drops cleanly into LlamaIndex or any other RAG stack. The mental model is a managed endpoint: no models to download, no OCR backends to install.
If you only remember one distinction: Unstructured is an open-source framework you can run anywhere; LlamaParse is a hosted API you call.
Setup and developer experience
Unstructured installs from pip, but the footprint depends on what you want to parse. The base install is light; full document support (OCR, images, complex layouts) pulls in system dependencies like poppler, tesseract, and optionally libreoffice.
pip install "unstructured[pdf]"
from unstructured.partition.pdf import partition_pdf
elements = partition_pdf(
filename="report.pdf",
strategy="hi_res", # "fast", "hi_res", or "ocr_only"
infer_table_structure=True,
)
for el in elements:
print(type(el).__name__, "|", el.text[:80])
The strategy flag is the main lever: fast skips layout models for born-digital PDFs, hi_res runs a layout model for structure and tables, and ocr_only forces OCR for scans. If you don’t want to manage the system dependencies, the hosted Serverless API runs the same partitioning behind an endpoint.
LlamaParse requires an API key and a couple of lines. There is nothing to install beyond the client.
pip install llama-cloud-services
from llama_cloud_services import LlamaParse
parser = LlamaParse(
api_key="llx-...",
result_type="markdown", # or "json"
)
result = parser.parse("report.pdf")
markdown = result.get_markdown_documents()
Verdict on setup: LlamaParse is the faster start — an API key and you’re parsing, no system libraries. Unstructured asks more of you locally (system deps for hi_res/OCR), but that same setup is what lets you run it entirely on your own infrastructure. If you’d rather skip the local deps but stay in the Unstructured world, its hosted API splits the difference.
Open-source vs hosted, and pricing
This is the fundamental axis and worth being precise about.
- Unstructured ships an open-source core you can run for free at any volume — you pay only for compute you control. Its hosted Serverless API is billed by usage (per page, with higher-effort processing modes costing more per page). So you get a genuine choice: self-host for free, or pay for the managed API when you don’t want to run infrastructure.
- LlamaParse is hosted-only. Pricing is per page, typically with a free monthly allotment and then metered credits; higher-accuracy or agent-style parsing modes consume more credits per page than the base mode. There is no self-hosted build — the value is that someone else runs it.
The practical implication: at high volume, Unstructured’s open-source path has no per-page cost (only your compute), while any hosted API — Unstructured’s or LlamaParse’s — scales cost with pages. If per-document cost at scale is a hard constraint, self-hosting Unstructured is the lever. If engineering time is the scarce resource, a hosted API is cheaper in the way that matters.
Tables
Tables are where RAG pipelines lose the most quality, so weigh this carefully.
Unstructured extracts tables as Table elements. With strategy="hi_res" and infer_table_structure=True, it runs a table model and populates element.metadata.text_as_html with an HTML representation of the grid, which preserves rows and columns far better than flattened text. On clean, born-digital tables this is solid; on dense or heavily merged tables the HTML can still need cleanup.
elements = partition_pdf("report.pdf", strategy="hi_res", infer_table_structure=True)
tables = [e for e in elements if type(e).__name__ == "Table"]
print(tables[0].metadata.text_as_html) # HTML grid you can feed to an LLM or convert to Markdown
LlamaParse puts significant effort into table reconstruction and is one of the reasons teams reach for it. It renders tables directly as Markdown tables, and its higher-accuracy modes are designed for exactly the messy, multi-column, financial-statement style tables that break simpler parsers. On hard tables, LlamaParse’s premium modes are often the stronger out-of-the-box result.
Verdict on tables: LlamaParse tends to win on hard tables out of the box, especially in its higher-accuracy modes. Unstructured’s hi_res HTML output is good and, crucially, free to run yourself — but you may spend more time on post-processing for the ugliest tables.
Scanned PDFs and OCR
Neither tool can read pixels without OCR, and both handle scans.
Unstructured has OCR built into its strategies. ocr_only forces OCR on every page; hi_res applies OCR selectively where the text layer is missing. It uses Tesseract by default (hence the system dependency), so language support follows the Tesseract packs you install.
elements = partition_pdf("scanned.pdf", strategy="ocr_only", languages=["eng"])
LlamaParse handles scans server-side — OCR is part of the hosted pipeline, so there’s nothing to install, and its higher-effort modes generally do better on low-quality scans than a base pass.
Verdict on OCR: Both read scans. Unstructured gives you local control over the OCR engine and languages (at the cost of managing Tesseract); LlamaParse handles it server-side with zero setup. For detecting which pages actually need OCR before you pay for a full pass, see the best open-source PDF extraction library breakdown.
Output format
The two tools return fundamentally different shapes, and this drives how you chunk.
- Unstructured returns a list of typed elements with metadata, not a single document string. This is its signature: you get
Title,NarrativeText,Table,ListItemobjects you can filter, group by section, and turn into chunks with real type awareness. You can serialize the elements to a dict/JSON, or assemble Markdown yourself. If your chunking logic wants to treat titles and tables differently from body text, elements hand you that on a plate. - LlamaParse returns Markdown (or JSON) as its primary output — a clean, linear document that’s immediately ready to chunk and embed. If your pipeline is “PDF in, Markdown out, chunk it,” LlamaParse gives you that in one step.
Neither shape is strictly better. Elements are more powerful for structure-aware chunking; Markdown is simpler when you just want text. If Markdown is your target either way, PDF to Markdown for RAG covers why structure-preserving Markdown retrieves better than a flat dump.
Speed
Speed depends on where the work runs and which mode you pick.
Unstructured’s fast strategy is quick because it skips the layout model — good for clean, born-digital PDFs. The hi_res and ocr_only strategies run layout and OCR models, and on CPU that cost is real; you control the hardware, so you can throw a GPU at hi_res. LlamaParse runs on someone else’s infrastructure, so wall-clock time is queue time plus the accuracy mode you chose — base modes are faster, premium/agent modes trade latency for quality.
Verdict on speed: For born-digital documents, Unstructured’s fast mode is hard to beat locally. For high-accuracy parsing without provisioning hardware, LlamaParse offloads the compute at the cost of per-page latency you don’t control. Benchmark on your own documents — page complexity and OCR frequency swing these numbers more than any headline figure.
Self-hosting and privacy
This is often the real deciding factor for regulated or sensitive corpora.
- Unstructured’s open-source library can run fully on your own infrastructure, including air-gapped, so documents never leave your network. For healthcare, legal, or financial data with residency or confidentiality constraints, this is frequently the whole reason to choose it.
- LlamaParse is hosted, so documents are sent to a third-party API for processing. That’s fine for plenty of use cases, but if your data can’t leave your boundary, a hosted-only parser is a non-starter regardless of its output quality.
Verdict on privacy: If data control is a hard requirement, Unstructured (self-hosted) is the answer. If it isn’t, LlamaParse’s hosted model is a convenience, not a liability.
Licensing
- Unstructured’s core library is open source (Apache-2.0) — permissive and commercial-friendly. Some dependencies and models it can invoke carry their own licenses, so if you’re assembling a strict license bill of materials, check the components you actually enable.
- LlamaParse is a commercial hosted service governed by its terms of service, not an open-source license — you consume an API under those terms, with usage-based billing.
Comparison table
| Factor | Unstructured | LlamaParse |
|---|---|---|
| Model | Open-source library + hosted API | Hosted API only |
| Setup | pip + system deps for hi_res/OCR | API key, nothing to install |
| Pricing | Free self-hosted; hosted API per page | Per page (free tier + metered credits) |
| Self-hosting | Yes (incl. air-gapped) | No |
| Output | Typed elements + metadata (JSON) | Markdown or JSON |
| Tables | Table element with HTML grid (hi_res) | Strong Markdown tables; premium modes for hard tables |
| OCR | Built in (Tesseract, local control) | Handled server-side |
| Speed | fast is quick locally; hi_res/OCR heavier | Offloaded; depends on mode + queue |
| Licensing | Apache-2.0 core | Commercial ToS |
| Best for | Self-hosting, data control, element-level chunking | Least-effort clean Markdown, hard tables |
When to pick each
Pick Unstructured when:
- You need to self-host or run air-gapped for data-residency or confidentiality reasons.
- You want per-document cost to be effectively zero at scale (you pay only for compute you own).
- Your chunking benefits from typed elements — treating titles, tables, and body text differently.
- You’re already ingesting from many sources (S3, SharePoint, Drive) and want the connectors.
Pick LlamaParse when:
- You want the least-effort path to clean, LLM-ready Markdown with no models or OCR backends to manage.
- Your corpus has hard tables (financial statements, dense multi-column layouts) and you want strong reconstruction out of the box.
- You’re fine sending documents to a hosted API and paying per page.
- Engineering time is scarcer than per-page cost.
Use both when: Some teams route sensitive documents through self-hosted Unstructured and send complex-but-non-sensitive documents to LlamaParse for its table quality. That works, but you’re now maintaining two code paths, two output formats, and two failure modes — operational complexity, not better extraction.
When neither is the right fit
Both tools assume a single processing choice applied to a whole corpus — one Unstructured strategy, or one LlamaParse mode. That assumption breaks on mixed-quality corpora: a folder where some PDFs are clean born-digital exports, some are scanned faxes, some are multi-column research papers, and some are form-heavy statements. Pick one setting and you either overpay (running high-accuracy OCR on clean documents) or underserve the hard ones (running fast on a bad scan and indexing garbage).
The deeper problem is that neither tool tells you when an extraction went wrong. A parser will happily emit plausible-looking Markdown from a mangled scan, and that bad extraction flows straight into your index — where it quietly poisons retrieval. In a large batch you often can’t tell which of 10,000 pages came out clean and which came out as noise. This is a per-page quality-control problem, and choosing per-corpus can’t solve it. For why this matters to retrieval, see PDF extraction for RAG pipelines and PDF chunking strategies for RAG.
This is the gap pdfmux targets as a managed option: it handles the routing per page rather than per corpus, and returns a per-page confidence score so low-quality extractions can be filtered out before they reach your index — the outcome being that bad pages don’t silently degrade retrieval. If that’s the failure mode you’re fighting, it’s on GitHub.
FAQ
Is Unstructured or LlamaParse more accurate?
It depends on the document and the mode. LlamaParse’s premium modes tend to win on hard tables and messy scans out of the box; Unstructured’s hi_res is strong on structure, gives you typed elements, and is free to run yourself. For clean born-digital documents the gap is small. Benchmark both on a sample of your own corpus — headline accuracy claims rarely match your specific documents.
Can I run either one air-gapped?
Unstructured, yes — its open-source library runs entirely on your own infrastructure, which is the main reason to pick it for sensitive data. LlamaParse, no — it’s a hosted API. If your data can’t leave your network, Unstructured is the only option of the two.
Which is better for RAG?
Both feed RAG well, differently. Unstructured’s typed elements make structure-aware chunking straightforward — chunk by section, handle tables separately. LlamaParse gives you clean Markdown you can chunk immediately. Pick based on whether your retrieval leans on document structure (Unstructured) or on fast, high-quality Markdown (LlamaParse). See Docling vs Marker if you’re also weighing open-source Markdown converters, or Docling vs LlamaParse for the open-source-vs-hosted cut of the same decision.