The Three Adaptation Strategies

When you need an LLM to perform well on a specific domain — whether that is analysing contracts, generating product descriptions, or triaging customer support tickets — you have three primary tools at your disposal: Prompt Engineering, Retrieval-Augmented Generation (RAG), and Fine-Tuning. Each operates at a different layer of the stack, with distinct trade-offs.

Prompt Engineering: Always Start Here

Prompt engineering is free (in engineering terms), requires no infrastructure, and should be exhausted before considering heavier approaches. In our experience, 60–70% of use cases can be solved adequately with sophisticated prompting alone — system message design, few-shot examples, chain-of-thought reasoning, output format specification, and persona definition.

When to use it: general-purpose tasks, well-represented domains in the training data, tasks where a few high-quality examples can be embedded in context. When to move on: when you need the model to know specific private data it has never seen, when accuracy on domain-specific terminology is insufficient, or when context windows are too expensive to fill with examples.

RAG: The Right Answer for Private Knowledge

RAG augments the model at inference time by retrieving relevant documents from your knowledge base and injecting them into the prompt. The model's weights are unchanged — you are simply giving it the right information to work with.

RAG shines when: your knowledge base changes frequently (no re-training cost), you need citations/sources, privacy prevents sending data to a fine-tuning API, or your domain is too narrow to have influenced the base model's training data.

The engineering complexity of RAG is often underestimated. A production RAG pipeline involves: document ingestion and chunking strategy, embedding model selection and vector database management, hybrid retrieval (dense + sparse), re-ranking, and careful context window management. Do not underestimate this — a naive RAG implementation can perform worse than a well-crafted prompt.

Fine-Tuning: For Style, Format, and High-Volume Specific Tasks

Fine-tuning adjusts the model's weights on a curated dataset of examples. It is most valuable for: internalising a specific output style or format (avoid verbose system prompts), improving reliability on narrow tasks at high volume, and enabling smaller/cheaper models to match GPT-4 quality on constrained tasks.

Fine-tuning is often the right answer when you need a smaller model (lower latency, lower cost) to perform like a larger model on a specific task. One of our clients reduced inference cost by 78% by fine-tuning GPT-3.5-turbo on 2,000 examples, matching GPT-4 performance on their specific task.

Decision Framework

Start with prompt engineering. If accuracy is insufficient after systematic iteration, assess whether the problem is lack of domain knowledge (→ RAG), style/format inconsistency (→ fine-tuning), or both (→ RAG + fine-tuning). Always evaluate each approach on a labelled test set before committing to infrastructure investment.