Dosu LogoDosu Logo
Ask
Join our Discord
DoclingPublic
IBM Docling
DocumentsDocling
How can a student build a local, open-source LLM-based system to extract and analyze technical PDF documents (PMS/IDC) and generate instrumentation datasheets, using Python on a PC with limited resources?
How can a student build a local, open-source LLM-based system to extract and analyze technical PDF documents (PMS/IDC) and generate instrumentation datasheets, using Python on a PC with limited resources?
Type
Answer
Status
Published
Created
May 13, 2026
Updated
May 13, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

Local LLM-Based PDF Analysis System for Technical Documents (PFE Project)#

Recommended Architecture#

PDF (PMS/IDC) → Docling (extraction) → JSON structuré → Vector DB → LLM local → Datasheets

Key Components & Tools#

ComponentTool
PDF Extractiondocling (with OCR + TableFormer)
OCR EngineEasyOCR (built into Docling)
Local LLMOllama + Mistral 7B / Phi-3 Mini / TinyLlama
Vector DatabaseChromaDB (local)
RAG FrameworkLangChain or LlamaIndex
UIStreamlit

Privacy & Local Operation#

Docling runs 100% locally — no data is sent to external servers. All OCR, layout analysis, and table extraction happen on your machine. You can pre-download all models for fully offline operation:

pip install docling-tools
docling-tools models download --all

The only exception is if enable_remote_services=True is explicitly set, which is disabled by default.


Step-by-Step Implementation#

1. Set up the environment:

mkdir ~/mon-projet-pfe && cd ~/mon-projet-pfe
python3 -m venv venv && source venv/bin/activate

2. Install dependencies:

pip install "docling[tesserocr]" docling-tools langchain-docling langchain-community \
    langchain-chroma chromadb sentence-transformers streamlit transformers torch

3. Install Ollama + a local LLM model:

curl https://ollama.ai/install.sh | sh
ollama pull phi3:mini # Lightweight (~8 GB RAM needed)
# or
ollama pull tinyllama # Ultra-light (~4 GB RAM needed)

4. Extract PDFs to structured JSON (minimal test):

from docling.document_converter import DocumentConverter
from docling.datamodel.pipeline_options import PdfPipelineOptions, EasyOcrOptions, TableStructureV2Options
from docling.datamodel.base_models import InputFormat
from docling.document_converter import PdfFormatOption
from pathlib import Path

pdf_options = PdfPipelineOptions()
pdf_options.do_ocr = True
pdf_options.ocr_options = EasyOcrOptions(lang=["fr", "en"], use_gpu=False)
pdf_options.do_table_structure = True
pdf_options.table_structure_options = TableStructureV2Options(do_cell_matching=True)

converter = DocumentConverter(
    format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pdf_options)}
)

result = converter.convert("documents/your_document.pdf")
result.document.save_as_json("outputs/output.json")
md = result.document.export_to_markdown()
Path("outputs/output.md").write_text(md, encoding="utf-8")

5. Build a RAG pipeline:

from docling.chunking import HybridChunker
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_chroma import Chroma
from langchain_community.llms import Ollama
from langchain.chains import RetrievalQA

chunker = HybridChunker(max_tokens=512)
chunks = list(chunker.chunk(dl_doc=result.document))

embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
vectorstore = Chroma.from_documents(documents, embeddings, persist_directory="./chroma_db")

llm = Ollama(model="phi3:mini")
qa_chain = RetrievalQA.from_chain_type(
    llm=llm,
    retriever=vectorstore.as_retriever(search_kwargs={"k": 4}),
    return_source_documents=True
)

6. Launch the Streamlit web UI:

streamlit run app.py
# Opens at http://localhost:8501

Hardware Constraints & Solutions#

ConstraintSolution
Low available RAM (< 2 GB free)Close all other programs; use quantized models (GGUF 4-bit) via Ollama
Limited disk spaceUse generate_page_images=False in pipeline options to reduce memory
Scanned PDF checkboxesOCR + regex post-processing or a Vision Language Model (VLM)
Complex tables (merged cells)Use TableFormer V2 or Granite Vision Table
Very large PDFsProcess in page batches

Note: If the PC has only ~1.6 GB of available RAM, even Docling alone may struggle. It is recommended to free RAM by closing background applications, or use Google Colab (free GPU) for processing while keeping local extraction for confidentiality.

Documents
Building a Modular IDP Pipeline with Docling Components
Can I use a custom OCR model in Docling, and how do I set its path in the pipeline options?
Can docling-serve fetch documents from object storage (e.g., S3)?
Comment corriger la phrase : "Je suis allé à l'école en pied et mains je parte par quotidien des beaucoup de kilomètres cela est importante" ?
Content Layers
Docling MCP in Docling Serve
Does Docling automatically detect the language of a document when sending images to Tesseract OCR, and how can it be configured?
How can I enable and use GPU acceleration with Docling?
How can I find page numbers and bounding box information for content in a chunk produced by the hybrid chunker, and what is the structure of the doc_items list within a chunk?
How can I improve the resolution or quality of images extracted from a PDF using docling?
How can I set up and run docling-serve on a MacBook Pro using Docker, and what performance and stability considerations should I be aware of?
How can I use Docling's REST API to convert a PDF from a URL to Markdown with OpenAI-generated image descriptions, and is base64 encoding required for URL sources?
How can I use granite-docling to process all PDFs in a directory and output doctags?
How can a student build a local, open-source LLM-based system to extract and analyze technical PDF documents (PMS/IDC) and generate instrumentation datasheets, using Python on a PC with limited resources?
How can a student build a local, open-source, privacy-preserving AI system to extract and query technical PDF documents (PMS/IDC) on a PC with limited resources?
How can you make Docling read/understand images embedded in a DOCX file, and what is the correct code to use the VlmPipeline for this purpose?
How can you mount a PersistentVolumeClaim (PVC) in docling-serve on OpenShift to store EasyOCR models, and what steps are required to ensure docling-serve can access these models?
How can you use Docling's REST API to convert a PDF to Markdown and generate image descriptions using an OpenAI model?
How do I set up a complete multi-format document processing pipeline using Docling that handles technical PDFs, HTML files, images, videos, audio, codebases, and schematics, and exports everything to organized agent-friendly markdown files?
How do you install and use Docling in Python on WSL2, including integration with an AI agent?
How do you use HybridChunker in Docling, including saving and reloading the converted document?
How does Docling reconstruct reading order without using a large language model (LLM) call in an unsupervised manner?
How does Docling support parallel/multiprocessing for document conversion, and what do the key performance parameters (`page_chunk_size`, `doc_batch_concurrency`, `doc_batch_size`) do?
How to properly enable `enable_remote_services` in Docling Serve (CPU image) to use an external OpenAI-compatible API for picture description and formula enrichment, and what is the correct config format?
Models handling in Docling Serve
No Docling, o uso de CUDA é obrigatório para processar PDFs com extração de texto e descrição de imagens, ou é opcional?
Quais são as melhores opções de OCR para extração de tabelas financeiras complexas em PDFs usando Docling, incluindo alternativas externas e integração com plugins?
Quelle est l'origine et le statut des êtres mathématiques selon Platon et John Stuart Mill ?
What are all the parameters of HybridChunker in Docling, and how do you use it with a custom tokenizer?
What are all the pipelines that exist in Docling, including their purposes, selection criteria, and how they handle scanned documents?
What are the detailed pipeline options and processing behaviors for PDF, DOCX, PPTX, and XLSX files in the Python SDK?
What are the differences between `vlm_pipeline_model_local` and `picture_description_local` in Docling, and how do image descriptions, OCR, and table extraction work together? Also, how do the `include_annotations` and `mark_annotations` properties affect exported output?
What are the steps to convert a complex payment advice PDF to Excel using Docling?
What does 'RFLP' stand for or refer to?
What is the best practice for extracting text from a mixed PDF (digital + scanned pages) for enterprise financial document processing without a GPU and with limited costs?
What is the best practice for processing a mixed PDF (digital + scanned pages) containing sensitive financial data in Docling, given no GPU and limited cost?
What is the general sentiment expressed about the messy nature of documents and content in the Docling project?
What is the recommended Azure deployment option for a Docling-based Python SDK application using a custom Dockerfile with PyTorch and OCR, and why?
What is the recommended architecture and implementation for processing a mixed PDF bundle (digital + scanned pages) for an enterprise financial payment verification system (like MRT Jakarta's AI-Augmented Payment Flow), with constraints of no GPU and limited cost?
When processing large PDFs (700+ pages) with Docling's StandardPdfPipeline, what causes the `std::bad_alloc` errors and what are the recommended workarounds?
Which is the better option for running Docling: using 'docling serve' in Azure Container Apps or code-based deployment in Azure Function App (Windows Premium plan)?
Why are bounding boxes not available for items (such as images, tables, text) when using VlmPipeline with certain VLM presets (like Qwen/Markdown)?
Zoom on Layer 1 (L1): Layout Detection & Routing in a Modular IDP Pipeline
skill.md
คู่มือการดึงรูปภาพจาก PDF และสร้าง Markdown พร้อม Alternative Text ด้วย Docling