Service · RAG & LLM
RAG & LLM Development
Retrieval architecture, evaluation harnesses, and cost control for teams putting language models into production.
A retrieval demo takes an afternoon: embed some documents, search them, paste the results into a prompt. A retrieval system that stays accurate as the corpus grows, respects who is allowed to see what, cites its sources, and does not quietly triple your inference bill is a different discipline — the same one that keeps any production LLM pipeline honest.
Most RAG projects fail at retrieval, not generation — and almost none have an evaluation set that would have told them so.
TL;DR
- RAG development services cover the whole retrieval path: ingestion, chunking, embeddings, hybrid search, reranking, and generation with citations.
- Retrieval quality decides whether a RAG system works, and it is measurable — an evaluation set catches regressions before your users do.
- Fine-tuning teaches behavior; retrieval supplies knowledge. Confusing the two is the most expensive mistake in this space.
- LLM cost optimization is architectural: route each task to the cheapest model that clears its quality bar, cache hard, and batch what need not be live.
- Most engagements start around $5K; smaller well-scoped work is considered case-by-case.
The challenge
The prototype answered five questions convincingly and the demo went well. Then someone asked a question whose answer sat in a document the retriever never surfaced, and the model answered anyway — fluently, confidently, wrong. Now nobody trusts the feature, there is no measurement that would locate the problem, and the monthly inference bill has become a line item somebody wants explained.
What I build
Retrieval Architecture
Ingestion, chunking tuned to the document type, embeddings, hybrid vector plus keyword search, reranking, and permission filtering applied inside retrieval
Document AI & OCR Pipelines
Turning scanned contracts, reports, and forms into structured, searchable, permission-aware data — the same problem shape as the Continuity dataroom
Evaluation Harnesses
Golden question sets, retrieval recall and precision measurement, answer grading, and regression gates so quality drops fail a build rather than a customer
Hallucination Containment
Schema-validated structured outputs, grounding checks against retrieved sources, inline citations, and an explicit refusal path when confidence is low
LLM Cost Optimization
Task-level model routing, caching, batching background work into pipelines, token budgets per request, and per-feature spend monitoring
Production LLM Pipelines
Durable background jobs, retries with backoff, provider fallbacks, tracing from answer back to prompt and context, and latency budgets that hold under load
What does a RAG system need beyond embeddings and a vector search?
Five things demos skip: chunking tuned to the actual document type, hybrid search combining vectors with keywords, a reranking pass, permission filtering applied inside retrieval rather than after it, and an evaluation set. Generation quality is rarely the bottleneck. What reaches the prompt almost always is.
Chunking is where most quality is won or lost, and there is no universal setting — contracts, support tickets, API docs, and scanned PDFs all fragment differently. Hybrid search beats pure vector search on nearly every real corpus, because exact terms like product codes and error strings are precisely what dense embeddings blur. Add a reranker over the combined candidates and precision improves again. Permission filtering has to happen inside retrieval, not by discarding results afterwards, or you will eventually ground an answer in a document the user was never allowed to see.
RAG, fine-tuning, or a better prompt — which one do I need?
Prompting when the knowledge already sits in the model. Retrieval when it is private, changing, large, or must be cited. Fine-tuning when you need consistent behavior, format, or classification rather than new facts. The classic failure is fine-tuning to teach facts — slow, expensive, and stale on delivery.
Long context is the fourth option and often the right first move. If the corpus is small and static, putting it straight in the prompt beats building an ingestion pipeline you then maintain. Once it grows, changes often, or needs per-user access rules, retrieval becomes cheaper operationally. Combining approaches is legitimate but rarely the starting point: fine-tuning for output format while retrieval supplies facts is sound once both halves work individually, and impossible to debug before you have evaluations.
How do you keep LLM costs and hallucinations under control?
Costs are architectural: route each task to the cheapest model clearing its quality bar, cache aggressively, batch background work into pipelines instead of live calls, and cap tokens per request. Hallucinations are contained the same way — schema-validated outputs, grounding checks, citations, and an explicit path to refuse.
Most production workloads contain a few genuinely hard requests and a great many easy ones, and paying frontier prices for the easy ones is the single most common source of waste. Classification, extraction, and summarization often run well on smaller models. On containment, the useful mental model is that a language model will always produce an answer, so the system around it must be able to say no: structured outputs fail loudly instead of flowing downstream, grounding checks compare answers against retrieved sources, and returning nothing on low retrieval confidence beats any prompt instruction about not making things up.
Have you shipped a production RAG system?
One is running now: an Azure OpenAI “Dashboard Copilot” for a CLO compliance and portfolio SaaS, where a retrieval layer assembles approved database records into structured context and the model answers only from what it was handed. It is an ongoing engagement rather than a finished deployment, and the retrieval surface is deliberately narrow — in a compliance context, what may be retrieved at all is a governed decision.
The architecture is retrieval-augmented in substance rather than in branding. The copilot never runs the model against a free-floating document pile: a retrieval step pulls the records a given question is permitted to touch, a builder assembles them into a structured context payload, and generation is constrained to that payload — so an answer that cannot be grounded comes back as a refusal instead of a plausible number. Around it sit the parts that decide whether this survives a compliance review: guardrails on what may be asked, token budgets and cost controls per request, and a path from any answer back to the records that produced it.
Being precise about what that does not yet evidence. It is an ongoing engagement, so there is no multi-year production track record behind it. And because the corpus is approved structured data rather than an open document set, it does not demonstrate large-corpus chunking strategy, hybrid search tuning, or reranking at scale — those remain capability, built on the pipeline engineering documented alongside it.
That pipeline engineering is the half that transfers whether or not a retrieval step sits in the middle — ingestion, background jobs, retries, provider fallbacks, structured outputs, cost monitoring, observability. ScamMinder runs a 14-phase pipeline with a GPT-4o classification layer at sub-6-second analysis and 99.9% uptime across 20,000+ domains. The AI SEO platform orchestrates models through OpenRouter across 13 background pipelines with 74 test files behind it. And Continuity, the first M&A marketplace of its kind in the Belgian SME market, pairs a Claude-powered matching engine with an OCR dataroom handling sensitive deal documents across 5 roles and 6 access tiers in 3 languages — the same problem shape as permission-aware retrieval.
RAG vs fine-tuning vs prompting vs long context
Qualitative guidance, not benchmarks. The right choice depends on how your knowledge changes and who may see it.
| Approach | Use it when | What it costs you | What it will not fix |
|---|---|---|---|
| Prompt engineering | The knowledge is already inside the model and the task is stable | Almost nothing — iterations take minutes | Anything the model never saw, and anything private |
| Long context | The corpus is small, static, and fits comfortably in the window | Tokens on every call, and attention quality degrading as the window fills | Corpora that grow, or documents with per-user access rules |
| RAG | Knowledge is private, changing, large, or has to be cited | An ingestion pipeline, a retrieval layer, and evaluations you maintain | A model that reasons badly about your domain |
| Fine-tuning | You need consistent format, tone, or classification behavior | Labeled data, a training loop, and a re-run whenever the base model moves | Keeping facts current — it teaches behavior, not knowledge |
| RAG plus fine-tuning | Both behavior and knowledge genuinely need to change | Both bills, and twice the evaluation surface to keep honest | A retrieval layer returning the wrong chunks in the first place |
Tech stack
Which of my builds proves this
Read this before the work below. There is now a retrieval engagement here rather than pure capability framing: a Dashboard Copilot for a CLO compliance and portfolio SaaS, built on Azure OpenAI, where answers are grounded in approved database records assembled into structured context payloads, with guardrails and per-request token and cost controls around them. It is an ongoing engagement, so read it as a live architecture rather than a long production record. The constraint that makes it honest is worth stating plainly: in a compliance setting, retrieval is restricted to approved data, which is a narrower and better-governed surface than an open-corpus deployment. What it does not yet evidence is large-corpus chunking, hybrid search tuning, and reranking at scale — those remain capability, built on the production LLM and document-AI pipelines documented below.
CLO Dashboard Copilot — Grounded AI Answers
Ongoing engagement: an Azure OpenAI copilot for a CLO compliance and portfolio SaaS — retrieval over approved database records, structured context payloads, guardrails, and token-cost control.
Read case study →Continuity — Belgian M&A Marketplace
Claude-powered matching engine plus an OCR dataroom for sensitive deal documents — 5 roles across 6 access tiers, 4 registry APIs, 3 languages. The closest work to permission-aware document retrieval.
Read case study →ScamMinder — AI Scam Detection
A 14-phase verification pipeline with a GPT-4o classification layer: 20,000+ domains analyzed, sub-6-second analysis, 99.9% uptime.
Read case study →Podcast Discovery Platform
Gemini summarization pipeline in production — 500+ episode summaries for 200+ users, with 95% of listening-to-decide time saved.
Read case study →Related services
AI Agents
Multi-step agents with tool use and guardrails, for when retrieval alone cannot complete the task.
Explore →AI Chatbots
Customer-facing assistants grounded in your own content, with citations and a clear escalation path to a human.
Explore →AI SaaS Development
The complete product around an AI core — auth, billing, dashboards, and the pipelines that keep the model useful.
Explore →How we work
Most MVPs ship in 3–6 weeks; complex platforms are scoped individually once the requirements are clear.
Intro Call
A 30-minute conversation about your project, goals, and timeline. No commitment either way.
Scoped Proposal
A written scope, architecture outline, and quote. I respond to every message within 24 hours.
Weekly Demos
You see working software every week, with written progress updates in between. No black boxes.
Ship & Handover
Deployment, documentation, and a clean handover — you own everything I build.
Compliance & standards
Frequently asked questions
Should I use pgvector or a dedicated vector database?
How do you measure whether a RAG system is actually working?
How much LLM production experience do you actually have?
Can you cut our existing inference bill?
What does an engagement cost and how long does it take?
Ready to start?
Book a free 30-minute call. No sales pitch — just a direct conversation about your project.
Book Free CallOr email: contact@waseemahmad.dev