Discover / RAG & Knowledge

Marker

by VikParuchuriPython

Tool for converting PDFs and documents into clean structured markdown for LLM pipelines.

Toolstable

Maturity: stable because 3y old, v2.0.0 released 14d ago. Derived from release and commit history, not a rating.

Stars
38k
Forks
2.7k
Downloads / mo
533k
Last commit
2026-07-20
License
Apache-2.0
Open issues
440

Market and trust evidence

Edition not yet matched

No exact skills.sh identity match is available for this repository. Repository adoption and freshness remain visible above; install momentum is not inferred.

Trust analysis is a screening signal, not a security warranty. Read the ranking and trust methodology.

In practice

Written by AI from this repository’s README · high confidence

PDF text extraction loses tables, equations, reading order and images, which breaks downstream indexing.

Use it when

Use it when you need accurate document conversion locally, optionally boosted by an LLM for tables and forms.

Not the right pick when

The model weights use a modified Open Rail-M license that limits commercial use beyond a revenue threshold.

Capabilities

  • converts PDF, image, PPTX, DOCX, XLSX, HTML and EPUB
  • formats tables, forms, equations, links and code blocks
  • extracts and saves images
  • removes headers, footers and other artifacts
  • hybrid mode with the use_llm flag for higher accuracy
  • runs on GPU, CPU or MPS

Requirements

  • python 3.10+
  • PyTorch
  • extra dependencies for non PDF documents

Cost: Open source with a paid cloud option

Install

Derived from the published package name in the repository, not from a model.

Video walkthroughs

Third-party YouTube uploads matched to this tool by title, channel and repository name on 2026-08-03. Not made, reviewed or endorsed by SkillPilot. View counts and publish months are as of the match date and the month is approximate. Nothing loads from YouTube until you press play.

What the repository ships

Has testsHas examplesCI configured

Detected from the actual files in the repository root.

Latest release v2.0.0

Published 2026-07-20

Marker 2.0.0

Marker 2 is a rewrite focused on speed, full CPU support, and accuracy. It's built on three new pieces we shipped over the last few months: Surya OCR 2, a 20M-param fast layout model, and a rebuilt (3× faster) pdftext.

Against comparable pipeline OCR systems, Marker 2 is both faster and more accurate — on olmOCR-bench, balanced mode scores 76.0% overall (83.5% on born-digital) while running over 5× more pages/sec than MinerU's pipeline backend.

Highlights

  • Conversion modes. Choose your speed/accuracy tradeoff:
  • balanced — surya VLM for layout + full-page OCR when text is bad. Highest quality; best on GPU. 76.0% olmOCR-bench.
  • fast — lightweight rf-detr/onnx layout + pdftext, with minimal, surgical VLM use. 66.6%, and far cheaper.
  • --disable_ocr — pure text-layer extraction, no VLM at all. Runs entirely on CPU. 43.6%, 23.7 pg/s.
  • Device-aware default. Mode now defaults by device automatically — balanced on GPU, fast on CPU/MPS — so you get a sensible speed/accuracy tradeoff without a flag. Override any time with --mode.
  • Full CPU support. fast --disable_ocr needs no GPU and no inference server; the 20M layout model runs on CPU and still reads structure (columns, tables, headers).
  • Throughput by design. Many thin CPU workers share a single surya inference server; the parent process budgets VLM concurrency across them, so throughput scales with server capacity instead of per-process VRAM. Sustained on one B200: 2.9 pg/s balanced, 7.4 pg/s fast, 23.7 pg/s no-OCR.
  • Selective OCR. Marker reads the PDF text layer with pdftext and only calls the VLM where it's needed — garbled/scanned pages, equations, low-confidence tables — instead of VLM-OCRing every page.
  • Reproducible benchmarks. A new benchmarks/ harness reproduces every olmOCR-bench score and throughput number in the README, for marker and competitors (MinerU, docling, liteparse).

Breaking changes

  • Python 3.10+ required.
  • Packaging moved from Poetry to uv (build backend is now hatchling). pip install marker-pdf is unchanged.
  • The unused structured-extraction converter/extractors were removed; use the Datalab API or a --use_llm workflow for structured extraction.
  • Mode default is now device-dependent rather than always balanced (see above).

Install


pip install marker-pdf          # PDFs
pip install marker-pdf[full]    # + docx, pptx, xlsx, epub, html

Benchmarks (olmOCR-bench, macro-average over 8 categories)

| Mode | Overall | Digital-only | Throughput (B200) |

|---|---:|---:|---:|

| balanced (GPU) | 76.0 | 83.5 | 2.9 pg/s |

| fast (GPU) | 66.6 | 71.6 | 7.4 pg/s |

| fast, no OCR (CPU) | 43.6 | 55.8 | 23.7 pg/s |

Full per-category scores, the competitive comparison, and reproduction steps are in the README.

For the highest possible accuracy, the hosted Datalab API runs Chandra (our document VLM) with automatic correction - free $5 in credits to try.

Tags

README

<p align="center">

<img src="data/images/datalab-logo.png" alt="Datalab Logo" width="150"/>

</p>

<h1 align="center">Datalab</h1>

<p align="center">

<strong>State of the Art models for Document Intelligence</strong>

</p>

<p align="center">

<a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/badge/Code%20License-Apache%202.0-green.svg" alt="Code License"></a>

<a href="https://www.datalab.to/pricing"><img src="https://img.shields.io/badge/Model%20License-OpenRAIL--M-blue.svg" alt="Model License"></a>

<a href="https://discord.gg/KuZwXNGnfH"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?logo=discord&logoColor=white" alt="Discord"></a>

</p>

<p align="center">

<a href="https://www.datalab.to"><img src="https://img.shields.io/badge/Homepage-datalab.to-blue" alt="Homepage"></a>

<a href="https://documentation.datalab.to"><img src="https://img.shields.io/badge/Docs-Read%20the%20docs-blue" alt="Docs"></a>

<a href="https://www.datalab.to/playground"><img src="https://img.shields.io/badge/Playground-Try%20it-orange" alt="Public Playground"></a>

</p>

<hr/>

Marker

Marker converts documents to markdown, JSON, chunks, and HTML quickly and accurately.

  • Converts PDF, image, PPTX, DOCX, XLSX, HTML, EPUB files in all languages
  • Formats tables, forms, equations, inline math, links, references, and code blocks
  • Extracts and saves images
  • Removes headers/footers/other artifacts
  • Extensible with your own formatting and logic
  • Optionally boost accuracy with LLMs (and your own prompt)
  • Works on GPU, CPU, or MPS

Try Datalab's Managed Platform

Our managed platform runs a version of our latest open source model, Chandra — higher accuracy than Marker, with zero data retention by default, SOC 2 Type 2, and custom BAAs.

If you have high volume workloads, we offer a batch processing service that has processed 1B+ pages per week — we manage the infrastructure so your workloads finish on time.

Get started with $5 in free creditssign up.

Performance

<img src="data/images/olmocr_bench.png" width="800px"/>

We measure marker on olmocr-bench, a third-party benchmark of 1,403 PDFs with tests covering math, tables, multi-column layout, scans, and hard edge cases. Balanced mode scores 76.0% overall — 83.5% on born-digital PDFs — ahead of MinerU and docling and within range of much larger VLMs, while fast mode runs the layout + text-layer path far cheaper (and a no-OCR mode goes faster still). Scores are the olmocr-bench overall (macro-average across the 8 categories).

<img src="data/images/olmocr_digital.png" width="700px"/>

See below for the full per-category scores, the competitive comparison, and instructions on how to run your own benchmarks.

Hybrid Mode

For the highest accuracy, pass the --use_llm flag to use an LLM alongside marker. This will do things like merge tables across pages, handle inline math, format tables properly, and extract values from forms. It works with Gemini, Claude, OpenAI-compatible, Azure, Vertex, OpenRouter, or Ollama models. By default, it uses gemini-3.5-flash. See below for details.

Examples

| PDF | File type | Markdown | JSON |

|-----|-----------|------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|

| Think Python | Textbook | View | View |

| Switch Transformers | arXiv paper | View | View |

| Multi-column CNN | arXiv paper | View | View |

Commercial usage

Our code is licensed under Apache 2.0 — free to use, including commercially. Our model weights use a modified AI Pubs Open Rail-M license (free for research, personal use, and startups under $5M funding/revenue). For commercial use of the model weights beyond that, visit our pricing page here.

Community

Discord is where we discuss future development.

Installation

You'll need python 3.10+ and PyTorch.

Install with:


pip install marker-pdf

If you want to use marker on documents other than PDFs, you will need to install additional dependencies with:


pip install marker-pdf[full]

Inference backend prerequisites

Surya auto-spawns the server on first use, and you need vllm (NVIDIA GPU) or llama.cpp (CPU / Apple Silicon):


  brew install llama.cpp     # macOS
  # or grab a release from https://github.com/ggml-org/llama.cpp/releases

Usage

First, some configuration:

  • Mode (--mode balanced|fast; defaults by device — balanced on GPU, fast on CPU/MPS):
  • balanced (best on a GPU) uses the surya VLM for layout, OCRs inline math, and re-OCRs the whole page whenever any of its embedded text is bad — highest quality.
  • fast (optimized for CPU) uses the lightweight rf-detr layout detector, extracts text with pdftext, and keeps VLM use minimal: equations, surgical block-level repair of individual garbled/empty blocks, and a single full-page pass only for pages that are scanned or mostly bad. A clean digital document without equations never starts the VLM server.
  • Tables are reconstructed from the PDF text layer in both modes (scanned tables come from the full-page OCR); low-confidence reconstructions fall back to the VLM, with a stricter bar in balanced.
  • --disable_ocr turns off all VLM calls (including equations) in either mode — pure text-layer extraction.
  • Marker runs layout, OCR, and table recognition through a single surya VLM, served by a local inference server (used for OCR in both modes, and for layout in balanced mode). The server is spawned automatically on first use - vLLM (docker) on NVIDIA GPUs, llama.cpp elsewhere. You can also point marker at an already-running server with SURYA_INFERENCE_URL=http://host:port/v1.
  • Useful server settings (all surya env vars): SURYA_INFERENCE_BACKEND (vllm or llamacpp), SURYA_INFERENCE_PARALLEL (concurrent requests — by default this auto-scales to the server's capacity: the GPU's max_num_seqs under vllm, a conservative slot count under llama.cpp; set an int only to override), SURYA_INFERENCE_KEEP_ALIVE (keep the server running between invocations), VLLM_GPUS (GPU indices for the server).
  • Some PDFs, even digital ones, have bad text in them. Set --force_ocr to force OCR on all pages, or the strip_existing_ocr to keep all digital text, and strip out any existing OCR text.
  • Inline math is converted to LaTeX automatically in balanced mode (ocr_inline_math); in fast mode, set --force_ocr or --ocr_inline_math to get the same.

Interactive App

I've included a streamlit app that lets you interactively try marker with some basic options. Run it with:


pip install -U streamlit streamlit-ace
marker_gui

Convert a single file


marker_single /path/to/file.pdf

You can pass in PDFs or images.

Options:

  • --mode [balanced|fast]: Conversion mode (see above). Defaults by device: balanced on GPU, fast on CPU/MPS.
  • --disable_ocr: Never call the VLM - pure text-layer extraction (equations and scanned pages are skipped).
  • --page_range TEXT: Specify which pages to process. Accepts comma-separated page numbers and ranges. Example: --page_range "0,5-10,20" will process pages 0, 5 through 10, and page 20.
  • --output_format [markdown|json|html|chunks]: Specify the format for the output results.
  • --output_dir PATH: Directory where output files will be saved. Defaults to the value specified in settings.OUTPUT_DIR.
  • --paginate_output: Paginates the output, using \n\n{PAGE_NUMBER} followed by - * 48, then \n\n
  • --use_llm: Uses an LLM to improve accuracy. You will need to configure the LLM backend - see below.
  • --force_ocr: Force OCR processing on the entire document, even for pages that might contain extractable text.
  • --block_correction_prompt: if LLM mode is active, an optional prompt that will be used to correct the output of marker. This is useful for custom formatting or logic that you want to apply to the output.
  • --strip_existing_ocr: Remove all existing OCR text in the document and re-OCR with surya.
  • --redo_inline_math: If you want the absolute highest quality inline math conversion, use this along with --use_llm.
  • --disable_image_extraction: Don't extract images from the PDF. If you also specify --use_llm, then images will be replaced with a description.
  • --keep_pageheader_in_output / --keep_pagefooter_in_output: Keep running page headers / footers in the output instead of stripping them (they are removed by default).
  • --debug: Enable debug mode for additional logging and diagnostic information.
  • --processors TEXT: Override the default processors by providing their full module paths, separated by commas. Example: --processors "module1.processor1,module2.processor2"
  • --config_json PATH: Path to a JSON configuration file containing additional settings.
  • config --help: List all available builders, processors, and converters, and their associated configuration. These values can be used to build a JSON configuration file for additional tweaking of marker defaults.
  • --converter_cls: One of marker.converters.pdf.PdfConverter (default) or marker.converters.table.TableConverter. The PdfConverter will convert the whole PDF, the TableConverter will only extract and convert tables.
  • --llm_service: Which llm service to use if --use_llm is passed. This defaults to marker.services.gemini.GoogleGeminiService.
  • --help: see all of the flags that can be passed into marker. (it supports many more options then are listed above)

OCR runs through the surya VLM, which is multilingual - see the surya README for details. If you don't need OCR, marker can work with any language.

Convert multiple files


marker /path/to/input/folder
  • marker supports all the same options from marker_single above.
  • --workers is the number of conversion workers to run simultaneously. This is automatically set by default, but you can increase it to increase throughput, at the cost of more CPU usage. All workers share a single inference server, which the parent process spawns.
  • The parent budgets total VLM concurrency automatically: it reads the server's capacity and splits it across workers (aggregate in-flight ≈ 1.5× capacity), so adding workers never over-queues the server. Set SURYA_INFERENCE_PARALLEL yourself only to override.
  • With --disable_ocr no inference server is started at all, and the pool is sized purely by CPU cores.
  • --skip_existing skips input files that already have output in --output_dir (resume a run); --max_files N caps how many files are converted; --disable_multiprocessing runs everything in one process.

Batch sizing cheat sheet (e.g. 1000 docs)

  • One GPU machine: marker /folder --output_dir out — defaults handle it: one vllm server, a CPU-sized worker pool, concurrency budgeted to the GPU. Add --mode fast if you want cheaper/faster conversion for mostly-digital corpora.
  • Multi-GPU machine: same single command, with the server spanning GPUs: VLLM_GPUS=0,1,2,3 marker /folder ...
  • Multiple machines: shard the file list — run one marker per node with --num_chunks <nodes> --chunk_idx <this node>. Each node spawns its own server.
  • CPU-only / no VLM: marker /folder --disable_ocr (pure text-layer extraction; equations and scanned pages are skipped).

Use from python

See the PdfConverter class at marker/converters/pdf.py function for additional arguments that can be passed.


from marker.converters.pdf import PdfConverter
from marker.models import create_model_dict
from marker.output import text_from_rendered

converter = PdfConverter(
    artifact_dict=create_model_dict(),
)
rendered = converter("FILEPATH")
text, _, images = text_from_rendered(rendered)

rendered will be a pydantic basemodel with different properties depending on the output type requested. With markdown output (default), you'll have the properties markdown, metadata, and images. For json output, you'll have children, block_type, and metadata.

Custom configuration

You can pass configuration using the ConfigParser. To see all available options, do

Truncated. Read the full README on GitHub ↗

Related tools