distributed pdf-to-markdown ocr pipeline with work queue orchestration
Converts PDF, PNG, and JPEG documents into clean markdown and structured text using a distributed worker architecture backed by S3 or local file-based work queues. The pipeline orchestrates page-level processing through a queue system that coordinates multiple worker processes, each invoking a fine-tuned 7B vision-language model (olmOCR-2-7B based on Qwen2.5-VL) via vLLM server instances. Workers pull tasks from the queue, process pages with rotation correction and layout analysis, and write results back to persistent storage, enabling horizontal scaling across machines.
Unique: Uses a fine-tuned 7B vision-language model (olmOCR-2-7B based on Qwen2.5-VL) with distributed work queue coordination via S3 or local storage, enabling cost-efficient processing at <$200/million pages. Unlike traditional OCR (Tesseract) or cloud APIs (Google Vision), this approach combines model efficiency with horizontal scalability through asynchronous queue-based worker coordination rather than synchronous API calls.
vs alternatives: Achieves 82.4±1.1 benchmark score on olmOCR-Bench while maintaining sub-$200/million page cost, outperforming cloud OCR APIs on cost and open-source OCR on accuracy; distributed queue architecture scales better than single-machine solutions while avoiding vendor lock-in of cloud services.
page-level rotation detection and correction with vlm inference
Automatically detects and corrects page rotation by invoking the vision-language model on each page image to determine correct orientation before full OCR processing. The system analyzes visual cues (text direction, layout coherence) through the VLM to identify if a page is rotated 0°, 90°, 180°, or 270°, then applies geometric transformations to normalize orientation before downstream text extraction. This pre-processing step improves downstream OCR accuracy by ensuring consistent text direction.
Unique: Uses the same fine-tuned VLM (olmOCR-2-7B) for rotation detection rather than separate orientation detection models, reducing model complexity and leveraging the model's understanding of document layout. This integrated approach avoids the overhead of chaining multiple specialized models.
vs alternatives: More accurate than heuristic-based rotation detection (edge analysis, text line orientation) because it leverages semantic understanding of document layout; faster than running separate orientation detection models because it reuses the main OCR model.
data augmentation and filtering for training robustness
Applies data augmentation techniques (rotation, scaling, noise injection, color jittering) to training images and filters low-quality training examples based on heuristics (image blur, text clarity, layout complexity). The augmentation pipeline increases training data diversity, improving model robustness to document variations. Filtering removes corrupted or low-quality examples that would degrade training, focusing compute on high-quality data.
Unique: Combines augmentation and filtering in a single pipeline, applying augmentation only to high-quality examples. Uses configurable heuristics for filtering, enabling adaptation to different document types and quality standards.
vs alternatives: More efficient than collecting more training data because augmentation increases diversity; more robust than training on unfiltered data because filtering removes corrupted examples that would degrade performance.
multi-ocr comparison framework for competitive benchmarking
Provides runners and evaluation harnesses for comparing olmOCR against competing OCR systems (Tesseract, NanoNets, Google Vision, etc.) on standardized benchmarks. The framework converts outputs from different OCR systems to a common format, applies the same evaluation metrics, and generates comparison reports. This enables fair comparison across systems with different output formats and capabilities.
Unique: Provides standardized runners for multiple OCR systems with output format normalization, enabling fair comparison despite different output formats. Integrates with the benchmarking framework to apply consistent metrics across systems.
vs alternatives: More comprehensive than single-system evaluation because it compares multiple OCR approaches; more fair than cherry-picked comparisons because it uses standardized benchmarks and metrics.
dolma format output generation with metadata preservation
Generates OCR output in Dolma format (structured JSON with document metadata, page-level information, and extracted text), enabling integration with downstream document processing pipelines and training data generation. The format preserves metadata including page numbers, source document paths, processing timestamps, and quality scores. This structured output enables filtering, sorting, and analysis of OCR results at scale.
Unique: Generates Dolma format output natively rather than as a post-processing step, preserving metadata throughout the pipeline. Enables integration with Allen AI's document processing infrastructure and training data generation workflows.
vs alternatives: More structured than plain markdown output because it preserves metadata; more interoperable with document pipelines than custom JSON formats because it uses a standardized schema.
multi-column layout analysis and reading order reconstruction
Analyzes document page layouts to identify multi-column regions and reconstructs natural reading order by processing spatial coordinates of text blocks extracted by the VLM. The system groups text elements by column position, sorts them top-to-bottom within columns, then merges columns left-to-right to produce markdown output that follows the intended document flow. This capability handles complex layouts including figures, insets, and mixed single/multi-column pages.
Unique: Reconstructs reading order using spatial coordinate clustering and sorting rather than heuristic rules, enabling handling of arbitrary column counts and irregular layouts. The approach leverages the VLM's ability to provide accurate bounding boxes, avoiding the brittleness of rule-based column detection.
vs alternatives: More flexible than fixed two-column assumptions used by some OCR systems; more accurate than reading-order detection based on text size or font changes because it uses actual spatial positioning from the VLM.
equation and table extraction with latex and html/markdown formatting
Extracts mathematical equations and tables from document pages and formats them as LaTeX (for equations) or HTML/Markdown (for tables) within the output markdown. The VLM recognizes equation regions and table structures, then generates appropriate markup that preserves mathematical notation and tabular relationships. Equations are rendered as inline or block LaTeX, while tables are converted to HTML or Markdown table syntax, maintaining semantic structure for downstream processing.
Unique: Uses a single fine-tuned VLM (olmOCR-2-7B) to handle both equation and table extraction rather than specialized sub-models, reducing inference overhead. The model is trained on synthetic equation and table data generated via KaTeX and HTML rendering, enabling accurate generation of properly formatted markup.
vs alternatives: Generates valid LaTeX and HTML directly from visual input rather than requiring post-processing or rule-based formatting; more accurate on handwritten equations than traditional OCR because the VLM understands mathematical notation semantically.
header and footer automatic removal with content classification
Automatically detects and removes headers and footers from document pages by classifying text regions as header/footer/body content using spatial position heuristics and VLM-based content analysis. The system identifies text appearing consistently at the top or bottom of pages (page numbers, running titles, repeated metadata) and excludes it from the final markdown output. This improves readability by eliminating repetitive non-content text.
Unique: Combines spatial heuristics (position-based detection) with VLM-based content analysis to classify headers/footers, avoiding false positives from pure position-based approaches. The system learns header/footer patterns across pages rather than applying fixed rules.
vs alternatives: More accurate than fixed-region removal because it adapts to document-specific header/footer placement; more robust than content-based filtering alone because it uses spatial consistency as a signal.
+5 more capabilities