
Deep Dive
Code First: When AI is the Wrong Tool
August 8, 2025 · 4 min read · By Yusuf Tunc Karadut
If code can do it, code should do it. There's a concerning number of AI automations that shouldn't be AI automations. Vision models reading invoices. LLMs parsing dates. Generative approaches to deterministic problems. This is expensive, slow, and fragile.
The Hybrid Pipeline
Document processing is the clearest example. A vision-language model can "read" a document, but it's computationally expensive and introduces non-determinism. Research into hybrid pipelines (Zhang et al.'s EcoDoc, LayoutLM architectures) shows that combining traditional OCR with specialized layout models or rule-based extraction is vastly more efficient.
The pattern: OCR extracts text (cheap, fast, deterministic). Regex finds dates and numbers (zero variance). A small LLM summarizes the notes section (where semantic understanding actually adds value). Cost drops by orders of magnitude. Reliability increases.
The Resilience Benefit
Beyond cost, hybrid solutions provide explainability and resilience. When the extraction fails, you know which component failed. When compute prices spike or API limits hit, deterministic components keep running. When auditors ask how you processed millions of documents, you can show them the code path, not just the prompt.
AI excels at semantic tasks: summarization, classification, understanding nuance. It's overkill for structured extraction. Match the tool to the task.
Sources
Zhang, Y., et al. (2025)
EcoDoc: Cost-Efficient Multimodal Document Processing
ACL 2025Liu, X., et al. (2025)
Hybrid OCR-LLM Framework for Enterprise-Scale Document Information Extraction
arXiv:2510.10138