Autonomous Multi-Vendor Document AI &
Multilingual RAG Ingestion Pipeline
How DCPL Tech engineered a zero-leakage, high-precision Document AI and Retrieval-Augmented Generation (RAG) platform: unifying 10+ irregular vendor invoice formats across English and French, tracking 10-epoch machine learning convergence in Weights & Biases, and deploying local quantized LLMs on NVIDIA CUDA GPUs inside Azure Docker infrastructure.
Replaced fragile regex parsers with spatial bounding coordinates to handle diverse supplier templates seamlessly.
Accelerated via NVIDIA CUDA, cuDNN, and 4-bit GGUF quantization on local Ollama runtime.
Fine-tuned on 260+ enterprise text chunks with customized NLTK tokenization and verified convergence curves.
Packaged deep learning wheels, CUDA runtimes, and Flask REST APIs into a single immutable Docker image.
1. The Operational Bottleneck & Client Mandate
An international enterprise managing high-volume operations across cross-border divisions faced a critical operational bottleneck in accounts payable and vendor reconciliation. Each week, hundreds of supplier invoices arrived across ten distinct vendor templates—formatted as scanned PDFs, digital PDFs, and Word documents.
To compound complexity, the organization operated across international jurisdictions requiring native support for both English and French billing conventions (e.g., handling Montant Hors Taxes (HT), Taxe sur la Valeur Ajoutée (TVA), Total Toutes Taxes Comprises (TTC), alongside standard English subtotal, VAT, and remittance instructions).
Why Standard Off-The-Shelf Solutions Failed:
- Strict Compliance & Zero Public Cloud Leaks: Corporate governance barred routing sensitive financial invoices through third-party public cloud endpoints (such as OpenAI or commercial SaaS OCR APIs). All document processing, vectorization, and inference had to execute strictly within dedicated client-controlled infrastructure.
- Borderless & Irregular Tables: Vendor invoices frequently omitted visual table cell gridlines. Traditional OCR tools concatenated line items unpredictably, merging quantity numbers into item descriptions and corrupting calculation matrices.
-
Linguistic Tokenization Errors: Off-the-shelf English LLMs failed on French financial diacritics and accounting terminology, misinterpreting European decimal commas (e.g.,
1.250,50 €vs.$1,250.50) as line separators.
2. Layout-Aware Spatial Parsing & Extraction Architecture
Rather than relying on naive text extraction that destroys 2D spatial layouts, DCPL Tech’s machine learning team architected a custom parsing engine that treats document pages as geometric coordinate spaces.
How Spatial Heuristics Conquered 10+ Vendor Templates:
- Relative Coordinate Binding: When an invoice label like "Invoice Total:" or "Total TTC" is isolated, the parser calculates the nearest right-hand and bottom-facing numeric clusters within an adaptive geometric bounding window, eliminating template-specific hardcoding.
- Line-Item Table Reassembly: By evaluating vertical alignment thresholds across columns (Quantity, Description, Unit Price, Tax, Subtotal), our algorithm dynamically reconstructs borderless tables into clean, structured arrays even when lines wrap unpredictably.
-
Confidence Scoring & Anomaly Detection: Every extracted field receives a mathematical confidence score based on character recognition certainty and mathematical balance checks (validating whether
Subtotal + Tax == Total).
3. Conquering Bilingual Document Complexity (English & French)
International operations required seamless parsing without needing operators to pre-classify documents by language. Our linguistic pipeline applies automatic language detection and specialized parsing dictionaries:
- Numéro de Facture: Normalized to canonical
invoice_number - Montant Hors Taxes (HT): Mapped to
subtotal_amount - Taux & Montant TVA: Extracted into nested
tax_breakdown - Total TTC: Mapped to
total_amount_payable - Date d'échéance: Parsed into standard ISO 8601 dates
- Invoice # / Ref No: Cleaned from irregular header watermarks
- Net Subtotal / Goods Amount: Reconciled against item tallies
- Value Added Tax (VAT) / GST: Multi-rate breakdown
- Gross Total / Amount Due: Cross-checked with payment terms
- Remittance Details: Automated extraction of IBAN, BIC, and Swift codes
4. Custom RAG, Domain Tokenization & 10-Epoch W&B Monitoring
To enable intelligent contextual querying across historical invoices and supplier contracts, DCPL Tech built a specialized Retrieval-Augmented Generation (RAG) pipeline. Rather than dumping raw PDF dumps into naive vector stores, we tailored the entire chunking and embedding architecture:
Standard sentence tokenizers shatter tabular invoice data into meaningless fragments. We engineered custom sentence and entity boundary rules using nltk, preserving financial context across 260+ domain text chunks so that line-item descriptions remained bonded to their respective unit prices and vendor metadata.
Our ML engineering team tracked loss curves, gradient norms, and retrieval precision across 10 complete training epochs inside Weights & Biases. This systematic experiment tracking enabled us to identify the exact convergence checkpoint that eliminated extraction hallucinations while avoiding overfitting on specific vendor layouts.
⚡ GGUF Quantization via Ollama
To achieve sub-second document extraction without requiring expensive multi-GPU clusters, models were quantized into 4-bit and 8-bit GGUF format and orchestrated via local Ollama runtimes, slashing VRAM consumption by 65% with zero perceptible loss in extraction precision.
🚀 NVIDIA CUDA & cuDNN Acceleration
Vector embedding and local LLM transformer layers were compiled directly against NVIDIA CUDA and cuDNN libraries, utilizing tensor cores to process multi-page high-resolution invoice batches in parallel.
5. Enterprise Dockerization & Azure GPU Infrastructure
Deploying deep learning in an enterprise production environment is notorious for "dependency drift"—where system-level CUDA drivers, C++ compilers, and Python packages conflict. DCPL Tech solved this through strict, immutable containerization:
Our DevOps engineers engineered a multi-stage Docker build encapsulating over 340 Python dependencies (including PyTorch CUDA binaries, NLTK token dictionaries, spatial geometry libraries, and the Flask REST API bridge). Deployed directly to an Azure GPU-enabled Virtual Machine:
6. Measurable Business Outcomes & Client Impact
85%+ Reduction in Manual Processing Time
Finance teams that previously spent between 12 to 20 minutes manually transcribing and cross-verifying each complex invoice now process entire supplier batches in seconds, with extraction completed in under 4 seconds per multi-page document.
100% Data Sovereignty & Zero SaaS Leaks
By deploying fully local GGUF models on Azure GPU infrastructure rather than passing financial records through third-party AI APIs, the client maintains total data isolation and regulatory compliance with international financial privacy mandates.
Unified Cross-Border Accounting
Both French and English supplier invoices flow into a single unified JSON schema, eliminating manual currency conversions and language-dependent bookkeeping splits.
Enthusiastic Client Demonstration
Presented directly to international stakeholders and business leadership, receiving enthusiastic commendation for reliability, speed, and seamless handling of complex borderless line items.
7. Complete Technology Stack
Looking to Build or Deploy Custom AI & Automation?
Discover DCPL Tech's comprehensive AI Practice covering Speech-to-Text MoM generation, Selenium web automation, Computer Vision, Local LLM architectures, and MLOps.
Discuss Your Document AI & RAG Architecture with our CTO
Whether you need to parse complex documents with zero cloud leakage, deploy quantized LLMs on your own infrastructure, or build custom RAG pipelines, let's talk technical feasibility.