Photo by Matthieu Beaumont Every team with a growing dataset eventually hits the same wall: the data you have isn’t the data you need. Fields are incomplete. Free-text fields should be categorized. Addresses are inconsistent across regions. Legacy imports brought in noise alongside signal.
Traditional enrichment has been a choice between bad options: manual curation that doesn’t scale, brittle regex rules that miss the long tail, or outsourcing that’s slow and lossy. LLMs change this equation. Not by being perfect, they hallucinate, they cost money per call, they add latency, but by being good enough at ambiguity to make enrichment practical at scale for the first time.
The LLM as a Transformation Primitive
Think of an LLM call in your pipeline as a new kind of function signature:
(instruction, data) → structured output
This is fundamentally different from traditional transforms. It doesn’t require perfect input. It can infer structure from context. It handles edge cases without being explicitly programmed for each one. You describe what you want in natural language, and the model figures out the rest.
But this power comes with new constraints: cost per invocation, non-deterministic output, latency measured in seconds rather than milliseconds, and the very real risk of hallucination. An LLM transform is not a replacement for a well-tested regex, it’s a complement for the cases where regex fails.
Key Takeaway: Treat the LLM as a programmable human reviewer, not a smarter regex. Use it where judgment and context matter, not where a lookup table would do.
Where LLMs Fit in the Pipeline
Three patterns consistently deliver high return on investment:
1. Classification & Tagging at Scale
The canonical use case. Given a support ticket, product review, or customer message, classify it into categories and assign metadata.
Input: "My subscription renewed but I can't access the dashboard."
Output: { category: "billing", priority: "high", sentiment: "frustrated" }
Traditional keyword-based classifiers need constant maintenance as new patterns emerge. An LLM can follow a taxonomy described in a prompt and handle novel phrasings without code changes.
2. Entity Extraction & Normalization
Free-text fields are everywhere, bio text, shipping instructions, internal notes. Extracting structured entities from them is where LLMs truly shine.
Input: "Ship to 123 Main St, Austin, TX 78701, attn: receiving dock"
Output: { street: "123 Main St", city: "Austin", state: "TX", zip: "78701", attention: "receiving dock" }
The same pattern works for extracting company names from email signatures, skills from resumes, or product attributes from descriptions.
3. Gap-Filling & Quality Scoring
Many datasets have sparse records, products without descriptions, user profiles without bios, leads without company size. An LLM can generate plausible missing values from available context, or score each record’s completeness on a scale.
The key insight is that you don’t need perfect fill-in. You need good enough for your downstream task, and LLMs are remarkably good at “good enough.”
Architecture Patterns
How you integrate the LLM into your pipeline matters as much as what you ask it to do.
Batch Enrichment
Process records in scheduled jobs. Best for large backfills and offline datasets. Cheapest because you can use slower models, batch prompts together, and accept higher latency.
Source → Queue → LLM Batch → Validator → Storage
Streaming Enrichment
Transform records as they arrive via webhook or message queue. Higher cost per record, but the enrichment is available immediately. Needs careful rate limiting and error handling.
Event → Stream → LLM (per record) → Validator → Storage
Hybrid Pre-Filter
Route each record through deterministic rules first. If a rule matches, use it. If not, escalate to the LLM. This pattern gets you 80% coverage at near-zero cost, reserving the expensive LLM call for the ambiguous tail.
Record → Rules Engine → Match? → Storage (no cost)
↘ No match → LLM → Validator → Storage
Cache-First
Many enrichment tasks see the same inputs repeatedly, normalizing “NY” → “New York” or looking up common company names. Hash the input and check a cache before calling the model. For stable lookups, this eliminates the vast majority of LLM calls.
Key Takeaway: The cheapest LLM call is the one you don’t make. Cache aggressively, filter deterministically, and tier your model choices by task difficulty.
Cost & Latency Management
LLM calls have real economics. A naive pipeline that enriches every record with a frontier model will burn through budget fast.
Model tiering. Use a small, cheap model (e.g. a 0.5¢/M token model) for simple classification and extraction. Reserve the $15/M token frontier model for tasks where marginal capability matters, ambiguous cases, complex reasoning, multi-step extraction.
Prompt compression. Every token costs money. Remove boilerplate, use concise instructions, and consider techniques like stripping unnecessary context from the input. A prompt that’s 30% shorter costs 30% less.
Batching. Send multiple independent records in a single prompt when the model supports it. Many providers offer significant per-token discounts at higher batch sizes.
Caching. Implement a TTL-based or exact-match cache. For lookups that rarely change (company normalization, country codes, standard categories), the cache hit rate can exceed 95%.
Validation & Guardrails
LLMs hallucinate. They invent plausible-looking values. They drift over time as model versions change. Your pipeline needs to assume every output is guilty until proven innocent.
Schema validation first. Never write LLM output to your database without validating it against a schema. Use JSON Schema, Zod, or your type system of choice. If the output doesn’t conform, route it to a fallback or a human review queue.
const EnrichedRecord = z.object({
category: z.enum(["billing", "support", "feature-request"]),
priority: z.enum(["low", "medium", "high"]),
confidence: z.number().min(0).max(1),
});
Bounds checking. Even valid types can have wrong values. Ensure confidence scores are in range, categories are in your allowed list, extracted dates are plausible, and extracted names aren’t obviously synthetic.
Confidence thresholds. Ask the model to self-rate its confidence. For low-confidence outputs, fall back to a deterministic rule, a human reviewer, or discard the enrichment entirely. A missing enrichment is better than a wrong one.
Statistical monitoring. Track the distribution of output values over time. If “priority=high” suddenly jumps from 15% to 60%, something changed, either your data distribution shifted or the model drifted. Alert on it.
Key Takeaway: Trust the LLM’s output as far as you can throw it, which is to say, validate everything before it touches your production data.
The Bottom Line
LLMs are a genuine leap for data enrichment. They make feasible an entire class of transformations that were previously impractical, free-text extraction, fuzzy classification, gap-filling at scale. But they’re not a silver bullet, and treating them like one is how you end up with hallucinated values in your customer database.
The teams that get this right will share three habits:
- They start small. Enrich one field, one pipeline, with aggressive validation. Prove the ROI, then expand.
- They design for replacement. The model is a pluggable stage behind a thin interface. When a better model arrives, swapping it is a config change.
- They tier by risk. Low-stakes enrichment (tags, scores) gets the cheap, fast model. High-stakes extraction (PII, financial data) gets validation, human review, and the best model available.
As I’ve argued before, don’t let your tools own your code, and don’t let any single model own your pipeline either. Build for substitution, validate ruthlessly, and start with the highest-value enrichment first.
Marios Antonoudiou , Software engineer.
Building AI-powered products that feel simple, useful, and ready for real users.
I design and ship AI-enabled product experiences across frontend architecture, interaction design, and product workflows. My focus is turning complex systems, data, and model capabilities into software people can actually understand, trust, and use.