From Raw PDF to Qdrant Search Engine: Choosing the Right Document Parser for Your RAG Pipeline
From the publisher’s feed, collected in the ZeroLabs newsroom.
Today in this article, we are going to settle a question that most RAG tutorials quietly skip over — what actually happens to your document before it ever reaches a vector database like Qdrant? We evaluated two open-source parsers, LitParse from LlamaIndex and Docling from IBM Research, on a real 340-page technical textbook packed with multi-page tables and code blocks. Same document, honest numbers, no hand-picked benchmarks. Lets start with out wasting much time.created by author M K Pavan KumarIntroduction — The Unglamorous Problem Nobody Talks AboutEveryone talks about embeddings. Everyone obsesses over which vector database is fastest, which LLM scores highest on benchmarks, which retrieval strategy — dense, sparse, hybrid — gives the best recall. RAG papers get cited, leaderboards get refreshed, Linkedin threads get written.Nobody talks about the parser.And yet, before any of that sophisticated machinery kicks in, something has to read your PDF. Something has to look at a 340-page technical textbook — full of tables that start on page 47 and end on page 49, code blocks that get brutally sliced at page boundaries, headers that a naive extractor mistakes for body text — and turn it into something an embedding model can actually work with.Get that step wrong, and it doesn’t matter how good your retriever is. You’re embedding noise. You’re retrieving fragments. Your LLM is hallucinating from incomplete context and you’re debugging prompts when the real problem was three steps earlier, in preprocessing.This article is about that step.We evaluated two open-source document parsers — LitParse from LlamaIndex and Docling from IBM Research — specifically as a preprocessing layer before ingestion into Qdrant search engine. Same document, same machine, honest numbers. No marketing, no benchmarks cherry-picked from READMEs.Let’s get into it.Setting the Stage — Our Test DocumentNot all PDFs are created equal. A two-page blog post exported to PDF is a completely different animal from what we threw at these parsers.Our test document: a 340-page technical textbook. The kind that makes parsers sweat.What made it hard? Tables that don’t fit on one page — they start mid-page, continue across the page break, and resume with no repeated header to signal continuity. Code blocks that get split across pages, losing indentation context in the process. Mixed layouts where a page might have prose, a table, and a code snippet all coexisting. Section headers that visually look distinct but are structurally ambiguous to an extractor that only sees raw text streams.This is exactly the category of document that ends up in RAG pipelines for technical domains — textbooks, research papers, API documentation, engineering manuals. And it is precisely where the gap between a “good enough” parser and a proper document intelligence tool becomes visible.If your parser can handle this, it can handle most things. If it stumbles here, you’ll find out the hard way — after ingestion, after indexing, when your retrieval results start looking suspiciously incoherent.Meet LitParse — The Rust-Powered Speed DemonLitParse is an open-source document parsing library written in Rust. It runs entirely on your machine — no cloud, no API keys, no LLMs involved. That last part matters more than it sounds. In production pipelines, the fewer external dependencies in your preprocessing step, the better. llamaindexWhat it actually does: it parses text with spatial layout information and bounding boxes. Every text line comes back positioned where it appears on the page. This is meaningfully different from a raw text dump — you get where the text is, not just what the text is. That spatial metadata opens the door to layout-aware chunking strategies downstream application which can help in citing the text pinpointed. llamaindexBeyond PDFs, it handles DOCX, XLSX, PPTX, PNG, JPG and more via automatic conversion. OCR is built in via Tesseract, or you can plug in your own OCR server if you need something heavier. llamaindexThe runtime story is equally practical — you can use it from Python, TypeScript/Node.js, Rust, or even the browser via WASM. It ships with a CLI for quick jobs and a library API for when it lives inside a pipeline. llamaindexThe design philosophy is clear: fast, local, no surprises. LitParse is not trying to understand your document. It is trying to extract it — accurately, at speed, without phoning home.On our 340-page textbook, it finished in 0.31 seconds. We’ll talk about what that speed costs in a moment.import datetimefrom liteparse import LiteParsestart_time = datetime.datetime.now()parser = LiteParse(ocr_enabled=False, target_pages="25-340")result = parser.parse("./data/Everything_about_language_models_and_ai_agents.pdf")end_time = datetime.datetime.now()print(f"Elapsed time: {end_time - start_time}")Meet Docling — IBM Research’s Document Intelligence EngineDocling was started by the AI for knowledge team at IBM Research Zurich and has since grown into a proper open-source project under the LF AI & Data Foundation. That pedigree shows in its ambition — this is not a text extractor, it is a document understanding system. githubWhere LitParse asks “where is the text?”, Docling asks “what is this?” It knows the difference between a table cell and a paragraph. It reconstructs reading order. It detects code blocks, formulas, and image regions as distinct element types rather than collapsing everything into a flat string.The backbone of this is the DoclingDocument — a unified, expressive representation format that captures document structure, not just content. From there you can serialize to whatever your pipeline needs: Markdown, HTML, JSON, DocTags, or WebVTT. That flexibility matters — Markdown preserves table structure for chunking, JSON gives you programmatic access to every element, HTML keeps layout semantics intact. githubThe latest version ships with a new layout model called Heron by default, designed for faster PDF parsing — a sign that the team is actively closing the speed gap without sacrificing fidelity. githubIt also integrates natively with LangChain, LlamaIndex, Haystack, and has a Qdrant retrieval example in its official docs. The ecosystem support is serious. githubThe tradeoff? On our 340-page textbook, it took 2 minutes 55 seconds. Entirely justified — once you see what comes out the other side.Practicle Implementation — Docling Advanced Optionsdocling_playground.py — The Baseline The simplest setup. Runs Docling on CPU explicitly, disables OCR, converts the PDF, and exports to Markdown. This is the "standard pipeline" — the one that produced your 175.3s benchmark. No VLMs, no frills. Good for establishing the baseline behavior and output quality.import datetimefrom docling.datamodel.accelerator_options import AcceleratorOptionsfrom docling.datamodel.base_models import InputFormatfrom docling.datamodel.pipeline_options import PdfPipelineOptionsfrom docling.document_converter import DocumentConverter, PdfFormatOptionstart_time = datetime.datetime.now()accelerator_options = AcceleratorOptions(device="cpu")pipeline_options = PdfPipelineOptions( accelerator_options=accelerator_options,)pipeline_options.do_ocr = Falseconverter = DocumentConverter(format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)})doc = converter.convert("./data/Everything_about_language_models_and_ai_agents.pdf").documentend_time = datetime.datetime.now()print(f"Elapsed time: {end_time - start_time}")docling_playground_with_vlm.py — VLM-Augmented Parsing Same converter setup but swaps the standard layout pipeline for a VlmPipeline backed by SMOLDOCLING_MLX — a small Vision Language Model that looks at each page as an image and understands it visually rather than structurally. This is a fundamentally different parsing strategy — instead of heuristic layout detection, you're using a model that reads pages the way a human would. The tradeoff: even slower, but potentially far better on complex layouts. By default, the vision-language models run locally. Docling lets you choose between the Hugging Face Transformers framework and the MLX framework — the latter specifically for Apple devices with MPS acceleration. githubimport datetimefrom docling.datamodel import vlm_model_specsfrom docling.datamodel.base_models import InputFormatfrom docling.datamodel.pipeline_options import VlmPipelineOptionsfrom docling.document_converter import DocumentConverter, PdfFormatOptionfrom docling.pipeline.vlm_pipeline import VlmPipelinestart_time = datetime.datetime.now()pipeline_options = VlmPipelineOptions( vlm_options=vlm_model_specs.SMOLDOCLING_MLX, # )converter = DocumentConverter( format_options={ InputFormat.PDF: PdfFormatOption( pipeline_cls=VlmPipeline, pipeline_options=pipeline_options, ), })doc = converter.convert(source="/Users/pavanmantha/Pavans/PracticeExamples/DataScience_Practice/LLMs/doc_parsers_benchmarking/data/Everything_about_language_models_and_ai_agents.pdf").documentend_time = datetime.datetime.now()print(f"Elapsed time: {end_time - start_time}")md = doc.export_to_markdown()print(md)On an M3 Max, SMOLDOCLING_MLX takes 6.15 seconds per page. The Transformers variant of the exact same model — SMOLDOCLING_TRANSFORMERS — takes 102 seconds per page. github That is a 16× difference just from runtime choice, same model, same machine. This is critical context for the blog — when someone says “VLM parsing is too slow,” the real question is which runtime are you using.docling_playground_with_external_api.py Production VLM Deployment The most advanced of the three. Same VLM pipeline concept, but now the VLM is served remotely — via Ollama, vLLM, LM Studio, or watsonx.ai rather than running locally. This is the architecture you’d use when the VLM is too large for the parsing machine, or when you want to serve Docling at scale with a dedicated inference endpoint. It also demonstrates the preset system — same model config (granite_docling), different runtime.import loggingfrom pathlib import Pathimport requestsfrom docling.datamodel.base_models import InputFormatfrom docling.datamodel.pipeline_options import ( VlmConvertOptions, VlmPipelineOptions,)from docling.datamodel.vlm_engine_options import ( ApiVlmEngineOptions, VlmEngineType,)from docling.document_converter import DocumentConverter, PdfFormatOptionfrom docling.pipeline.vlm_pipeline import VlmPipelinedef check_and_pull_ollama_model(model_name: str) -> bool: """Check if model exists in Ollama and attempt to pull if not. Args: model_name: The model name to check/pull Returns: True if model exists or successfully pulled, False otherwise """ try: # Check if model exists response = requests.get("http://localhost:11434/api/tags", timeout=2) if response.status_code == 200: models = response.json().get("models", []) model_names = [m.get("name") for m in models] # Check for exact match or with :latest tag if model_name in model_names or f"{model_name}:latest" in model_names: print(f"✓ Model '{model_name}' is already available in Ollama") return True # Try to pull the model using Ollama API print(f"Attempting to pull model '{model_name}' in Ollama...") print("This may take a few minutes...") # Ollama pull API endpoint pull_response = requests.post( "http://localhost:11434/api/pull", json={"name": model_name}, stream=True, timeout=300, ) if pull_response.status_code == 200: # Stream the response to show progress for line in pull_response.iter_lines(): if line: import json try: data = json.loads(line) status = data.get("status", "") if status: print(f" {status}", end="\r") except json.JSONDecodeError: pass print() # New line after progress print(f"✓ Successfully pulled model '{model_name}'") return True else: print(f"✗ Failed to pull model: HTTP {pull_response.status_code}") return False return False except requests.exceptions.Timeout: print("✗ Timeout while trying to pull model (this can take a while)") print("Please try pulling manually: ollama pull", model_name) return False except Exception as e: print(f"✗ Error checking/pulling model: {e}") return Falsedef run_ollama_example(input_doc_path: Path) -> bool: """Example 2: Using Granite-Docling preset with Ollama. Returns: True if example ran successfully, False if skipped """ print("\n" + "=" * 70) print("Example 2: Granite-Docling with Ollama (pre-configured API type)") print("=" * 70) print("\nPrerequisites:") print("- Install Ollama: https://ollama.ai") print("- Pull model: ollama pull ibm/granite-docling:258m") print() # Check if Ollama is running try: response = requests.get("http://localhost:11434/api/tags", timeout=2) if response.status_code != 200: print("WARNING: Ollama server not responding correctly") print("Skipping Ollama example.\n") return False except requests.exceptions.RequestException: print("WARNING: Ollama server not running at http://localhost:11434") print("Skipping Ollama example.\n") return False # Check and pull the model model_name = "ibm/granite-docling:258m" if not check_and_pull_ollama_model(model_name): print("Skipping Ollama example.\n") return False # Use granite_docling preset with Ollama API runtime vlm_options = VlmConvertOptions.from_preset( "granite_docling", engine_options=ApiVlmEngineOptions( runtime_type=VlmEngineType.API_OLLAMA, # url is pre-configured for Ollama (http://localhost:11434/v1/chat/completions) # model name is pre-configured from the preset timeout=90, ), ) pipeline_options = VlmPipelineOptions( vlm_options=vlm_options, enable_remote_services=True, ) doc_converter = DocumentConverter( format_options={ InputFormat.PDF: PdfFormatOption( pipeline_options=pipeline_options, pipeline_cls=VlmPipeline, ) } ) result = doc_converter.convert(input_doc_path) print(result.document.export_to_markdown()) return Truedef run_vllm_example(input_doc_path: Path) -> bool: """Example 3: Using Granite-Docling preset with VLLM server. Returns: True if example ran successfully, False if skipped """ print("\n" + "=" * 70) print("Example 3: Granite-Docling with VLLM (generic API configuration)") print("=" * 70) print("\nPrerequisites:") print("- Start VLLM server:") print(" vllm serve ibm-granite/granite-docling-258M --revision untied") print() # Check if VLLM is running try: response = requests.get("http://localhost:8000/v1/models", timeout=2) if response.status_code != 200: print("WARNING: VLLM server not responding correctly") print("Skipping VLLM example.\n") return False except requests.exceptions.RequestException: print("WARNING: VLLM server not running at http://localhost:8000") print("Skipping VLLM example.\n") return False # Use granite_docling preset with generic API runtime # For VLLM, we need to provide custom URL and params vlm_options = VlmConvertOptions.from_preset( "granite_docling", engine_options=ApiVlmEngineOptions( runtime_type=VlmEngineType.API, # Generic API type url="http://VLLM_HOST:8000/v1/chat/completions", params={ "model": "ibm-granite/granite-docling-258M", "temperature": 0.0, "max_tokens": 8192, "skip_special_tokens": False, }, timeout=90, ), ) pipeline_options = VlmPipelineOptions( vlm_options=vlm_options, enable_remote_services=True, ) doc_converter = DocumentConverter( format_options={ InputFormat.PDF: PdfFormatOption( pipeline_options=pipeline_options, pipeline_cls=VlmPipeline, ) } ) result = doc_converter.convert(input_doc_path) print(result.document.export_to_markdown()) return Truedef main(): logging.basicConfig(level=logging.INFO) data_folder = Path(__file__).parent / "../../tests/data" input_doc_path = data_folder / "pdf/2305.03393v1-pg9.pdf" # Track which examples ran results = { "Ollama": run_ollama_example(input_doc_path), "VLLM": run_vllm_example(input_doc_path), } # Print summary print("\n" + "=" * 70) print("SUMMARY") print("=" * 70) ran = [name for name, success in results.items() if success] if ran: print(f"\n✓ Examples that ran successfully ({len(ran)}):") for name in ran: print(f" - {name}") else: reason = "Server not running" print(f" {reason}") print()if __name__ == "__main__": main()The supported VLM spectrum — from tiny to powerful:Models range from the 258M GraniteDocling and 256M SmolDocling at the lightweight end, up to Qwen2.5-VL-3B, Nanonets-OCR2–3B, Pixtral-12B, and Gemma-3–12B at the heavier end — with inference times on M3 Max ranging from 6 seconds per page (SmolDocling MLX) all the way to 1828 seconds per page (Pixtral-12B Transformers on CPU). githubThe practical sweet spot for most RAG preprocessing workloads: SmolDocling MLX or GraniteDocling MLX — small, fast, DocTags output, purpose-built for document understanding.| Model instance | Model | Framework | Device | Num pages | Inference time (sec) ||----------------|-------|-----------|--------|-----------|----------------------|| vlm_model_specs.GRANITEDOCLING_TRANSFORMERS | ibm-granite/granite-docling-258M | Transformers/AutoModelForVision2Seq | MPS | 1 | - || vlm_model_specs.GRANITEDOCLING_MLX | ibm-granite/granite-docling-258M-mlx-bf16 | MLX | MPS | 1 | - || vlm_model_specs.SMOLDOCLING_TRANSFORMERS | ds4sd/SmolDocling-256M-preview | Transformers/AutoModelForVision2Seq | MPS | 1 | 102.212 || vlm_model_specs.SMOLDOCLING_MLX | ds4sd/SmolDocling-256M-preview-mlx-bf16 | MLX | MPS | 1 | 6.15453 || vlm_model_specs.QWEN25_VL_3B_MLX | mlx-community/Qwen2.5-VL-3B-Instruct-bf16 | MLX | MPS | 1 | 23.4951 || vlm_model_specs.NANONETS_OCR2_MLX | mlx-community/Nanonets-OCR2-3B-bf16 | MLX | MPS | 1 | - || vlm_model_specs.PIXTRAL_12B_MLX | mlx-community/pixtral-12b-bf16 | MLX | MPS | 1 | 308.856 || vlm_model_specs.GEMMA3_12B_MLX | mlx-community/gemma-3-12b-it-bf16 | MLX | MPS | 1 | 378.486 || vlm_model_specs.GRANITE_VISION_TRANSFORMERS | ibm-granite/granite-vision-3.2-2b | Transformers/AutoModelForVision2Seq | MPS | 1 | 104.75 || vlm_model_specs.NANONETS_OCR2_TRANSFORMERS | nanonets/Nanonets-OCR2-3B | Transformers/AutoModelForImageTextToText | MPS | 1 | - || vlm_model_specs.PHI4_TRANSFORMERS | microsoft/Phi-4-multimodal-instruct | Transformers/AutoModelForCasualLM | CPU | 1 | 1175.67 || vlm_model_specs.PIXTRAL_12B_TRANSFORMERS | mistral-community/pixtral-12b | Transformers/AutoModelForVision2Seq | CPU | 1 | 1828.21 |> Inference time measured on M3 Max using `tests/data/pdf/2305.03393v1-pg9.pdf`> reference: https://docling-project.github.io/docling/usage/vision_models/#available-local-modelsThe ConclusionIn this whole blog we practically saw how LitParse and Docling approach the same problem from completely different angles — one optimizing for raw speed, the other for document intelligence. We benchmarked them on a hard real-world document, walked through three tiers of Docling’s pipeline from standard CPU parsing to VLM-augmented local inference to remote model serving, and understood why the parser you choose directly shapes the quality of every chunk that lands in Qdrant. The unglamorous preprocessing step turns out to matter more than most people think.From Raw PDF to Qdrant Search Engine: Choosing the Right Document Parser for Your RAG Pipeline was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.