Fine-Tuning vs In-Context Learning for Domain Adaptation
Behavioral and factual problems require different solutions in domain adaptation.

Adapting a large language model to a domain is often treated as one decision when it is actually two. Getting a model to write, reason, and format its output the way a given field expects, whether that means the clipped structure of a financial summary or the citation habits of a legal brief, is the first, behavioral problem. Keeping the model current on what is true right now, which statutes apply, which clinical guideline is active, which numbers in a filing changed last quarter, is the second, factual problem. These two problems do not share a solution. Fine-tuning changes the model's weights so that style, tone, structured output, and domain-specific reasoning become default behavior, available even on a zero-shot query. In-context learning leaves the weights untouched; it shows the model relevant documents or examples at the moment of inference, and retrieval-augmented generation is its fact-grounding form. Treating "domain adaptation" as a single question, rather than as a choice between a behavioral fix and a factual one, is the most common reason teams end up with a method mismatched to their actual need.
How Fine-Tuning and In-Context Learning Work
In-context learning works by conditioning the model on a prompt that holds demonstration pairs or retrieved documents, so no parameter update is involved. Fine-tuning takes the opposite path: it updates the weights themselves, so the adapted behavior persists across every future call without needing the relevant examples re-supplied each time.
Each method fails in ways that trace directly back to its mechanism. Fine-tuned weights go stale the instant the underlying knowledge changes, and a fine-tuned model has no way to point to the document that justified a given answer, a serious liability for anyone who needs an audit trail. Research from 2026 adds a sharper cost: fine-tuning on a target task can degrade the model's in-context learning ability, which limits how flexibly that same model performs on tasks outside the distribution it was tuned on. ICL has its own failure modes. A systematic fair comparison at ACL Findings 2023 found that if you equalize experimental conditions, claims of ICL's superior out-of-domain generalization often do not hold, so you should not treat ICL as the automatically safer default.
The common shortcut, that LoRA or another parameter-efficient fine-tuning method delivers the benefits of both approaches at once, does not survive contact with the evidence. LoRA and similar PEFT methods lower the cost of fine-tuning, but 2025 research on catastrophic forgetting shows that vanilla LoRA mitigates, without eliminating, significant knowledge loss in continual learning scenarios. Cheaper fine-tuning is still fine-tuning, and it inherits fine-tuning's structural ceiling.
The four variables that determine which method fits a given scenario
The choice between fine-tuning and in-context learning comes down to four concrete variables: data availability and stability, latency requirements, cost structure, and governance needs. Where a given project lands on each one shifts the right answer.
Data availability and stability asks how often the underlying knowledge changes. Fine-tuned weights go stale the moment that knowledge shifts, so domains with frequent change, regulatory updates, live product catalogs, evolving clinical guidelines, favor ICL through RAG, since document replacement requires no retraining. When data is proprietary or bound by privacy rules, the method of injection matters just as much as the update frequency: fine-tuning bakes data into weights that travel with the model wherever it is deployed, while RAG keeps the data in a retrievable store that can be access-controlled or redacted independently of the model itself.
Latency requirements separate real-time use cases from asynchronous ones. Conversational agents, low-latency API products, and interactive coding tools benefit structurally from fine-tuning's latency profile, while document summarization and nightly compliance checks can usually absorb RAG's added delay without consequence.
Cost structure follows a similar logic. RAG carries a higher upfront pipeline setup cost, while fine-tuning ranges from cheap, in its LoRA-based form, to comparable with full fine-tuning. The crossover point between the two depends on expected query volume and how often the underlying data changes. High-volume, low-churn domains favor fine-tuning on total cost of ownership; low-volume or high-churn domains favor RAG.
Governance and auditability often settles the question before the other three variables are even weighed. In regulated industries, finance, healthcare, legal, where source attribution is a compliance requirement, this makes RAG the structurally required choice for the knowledge-grounding layer regardless of how the other three variables shake out. Checking governance first, before data stability, latency, or cost, saves practitioners from building a sophisticated fine-tuning pipeline that a compliance review later rules out.
Domain type and the answer: evidence from finance, medicine, and legal
The four variables do not change from domain to domain, but the values they take do, and that is why the same framework produces different recommendations in finance, medicine, and legal work.
Finance rewards behavioral consistency at scale. BloombergGPT, a 50-billion-parameter model trained from scratch on a large financial corpus blending financial and general-purpose data, set an early baseline for financial LLMs, outperforming comparable models by 25 to 60 F1 points on internal sentiment benchmarks, though the absence of instruction fine-tuning left it short on structured extraction tasks like named entity recognition. FinGPT took a different route, using an open-source, data-centric approach with LoRA-based fine-tuning across multiple open-source backbones including LLaMA2, ChatGLM2, Falcon, and BLOOM, and reached comparable results at significantly lower cost, demonstrating that instruction fine-tuning on well-chosen data, not raw scale, is what separates strong performance from weak. Finance has high query volume, a relatively stable domain vocabulary, and a strong need for consistent structured output, so these three conditions point you toward fine-tuning for behavior, and you can leave RAG to handle live market data.
Medicine complicates the picture because audit requirements override the usual preference for low latency. But clinical guidelines update continuously, and regulatory compliance in medicine demands source attribution, so the governance and data-churn variables push the knowledge layer toward RAG even where behavioral fine-tuning is already doing useful work.
Legal is the domain where both layers are simultaneously required. DISC-LawLLM and InternLM-Law both rely on instruction tuning over statutes and case law, with InternLM-Law using a two-stage supervised fine-tuning approach rather than continual domain pre-training, and InternLM-Law topping LawBench scores as a result. Legal is the clearest case in which the four-variable framework refuses to settle on a single method. It points instead toward a layered architecture, which is the subject of the sections that follow.
The Strongest Objection to Fine-Tuning: RAG and Factual Recall
The strongest argument against using fine-tuning as a knowledge-update mechanism deserves to be stated directly: for knowledge-intensive tasks, injecting facts into a model's weights through supervised fine-tuning has consistently struggled to match what RAG achieves on factual recall, and that objection largely holds up.
The ICML 2026 theoretical analysis gives this objection a formal foundation: improving zero-shot performance through fine-tuning on a target task can degrade a model's in-context learning ability. A model fine-tuned for domain behavior becomes less flexible on exactly the tasks where ICL would otherwise be the natural tool, a trade-off that needs to be planned for. A separate counterargument says sufficiently large context windows make RAG unnecessary, but that does not hold up at scale either. Per-token cost scales linearly with context length, latency grows alongside context size, and the "lost in the middle" problem means retrieval precision degrades as the context grows larger, so targeted retrieval remains the more accurate and cost-efficient path once a corpus reaches any real size.
Accepting this objection sharpens the framework. So you should scope fine-tuning explicitly to the behavioral layer, and if you need a model to recall specific, changing facts from a large document corpus, treat RAG as non-negotiable for that layer. Enterprise AI teams have already converged on this conclusion in practice: RAG functions as the primary knowledge-grounding technique in the majority of production deployments. Fine-tuning's case does not weaken when you remove knowledge injection from its list of plausible jobs. It clarifies what fine-tuning is actually good for, which makes the rest of the decision easier.
The layered architecture that the evidence converges on
The most robust production systems operating in domains with both behavioral and factual requirements do not pick one method over the other. They run fine-tuning and RAG as two distinct layers, each assigned to the problem it actually solves, and prompt engineering connects the two, structuring how retrieved context and model behavior interact at inference time. Fine-tuning installs domain behavior, style, output format, reasoning patterns, task-specific vocabulary, directly into the weights. RAG supplies the factual grounding layer: current documents, an audit trail, and knowledge that can be updated without retraining. This arrangement is the correct application of the behavioral and factual distinction laid out at the start of this piece, with each layer doing precisely what the other cannot.
Applying the framework to a specific project works as a sequence of checks. First comes governance: if source attribution is required, RAG becomes mandatory for the factual layer, and no amount of fine-tuning sophistication changes that. Second comes data churn: if the knowledge base updates more frequently than a retraining cycle allows, RAG handles the factual layer regardless of what governance alone would have required. Third comes behavioral need: if the domain demands a consistent output format, specialized vocabulary, or reasoning patterns that prompt engineering alone cannot reliably produce, fine-tuning earns its place on the behavioral layer. Fourth comes query volume and latency: high volume combined with tight latency constraints justifies the investment in fine-tuning's inference-speed advantage, while low volume or flexible latency makes pure ICL or RAG-only sufficient on its own.
Two simpler cases fall out of this sequence directly. When only the factual layer matters and query volume is low, RAG alone is the correct and simpler answer, with no fine-tuning investment required. When only behavioral consistency matters and the underlying knowledge is stable, fine-tuning alone does the job without needing a retrieval layer. ICL with few-shot demonstrations remains the right starting point whenever labeled data is too scarce for fine-tuning to avoid overfitting, or whenever the task changes often enough that baking behavior into weights would go stale quickly. That is a deliberate choice suited to those conditions, not a fallback used for lack of a better option. Research into fine-tuned in-context learners looks at how to preserve ICL ability alongside fine-tuned performance, and it suggests the boundary between these two methods is still being redrawn, so you should expect this interaction to keep evolving.
Where automation is beginning to replace manual method selection
Until recently, you had to choose and configure an adaptation method by hand, relying on expert judgment, and teams struggled to reproduce the results consistently. Small choices in data selection, training objectives, and training settings strongly affect final performance, but the people who make those choices well have typically been scarce.
Microsoft Research's AutoAdapt addresses that friction directly. AutoAdapt takes as input a task objective, the available domain data, and practical constraints such as accuracy targets, latency limits, hardware, and budget, then plans a valid adaptation pipeline, selecting among RAG and multiple fine-tuning methods, before tuning key hyperparameters through a budget-aware refinement loop. Across ten tasks, it beat state-of-the-art AutoML baselines by a meaningful relative accuracy margin, and it added little overhead. The four variables this piece has used as its organizing framework, data stability, latency, cost, and governance, are precisely the inputs a system like AutoAdapt requires to run. Practitioners who understand those variables will specify such systems correctly and interpret their output with confidence; practitioners who do not will under-specify the problem and get a pipeline that technically runs but solves the wrong version of it.
Automation has not yet reached governance. AutoAdapt and comparable tools do not currently handle compliance requirements or organizational data access controls, decisions that still need to be made by people before any automated method selection begins. The framework does not become obsolete as this tooling matures. It becomes the specification language the tooling runs on.
Phantom Farm's Approach to Expert Guidance
Applying the layered architecture correctly requires a series of decisions, in fine-tuning data curation, in RAG retrieval design, and in the governance layer that most automated tools do not yet touch, that are easy to get wrong without prior experience in the domain. Phantom Farm specializes in domain adaptation for enterprise LLM deployments and works across the full layered architecture described above: behavioral fine-tuning, retrieval-augmented knowledge grounding, and the prompt engineering that connects the two. Its approach follows the same sequence this framework lays out, evaluating governance and auditability requirements first, then data churn, then behavioral need, then volume and latency constraints, before settling on a method. That ordering makes Phantom Farm well suited to high-stakes domains such as finance, healthcare, and legal, where the governance variable rules out naive approaches early and where you need the behavioral and factual layers to stay distinct and independently maintainable.
Teams with sufficient ML engineering capacity can pursue this same layered architecture internally, and the expertise gap required to do so is narrowing, particularly with open-weight models and tooling like AutoAdapt taking over more of the manual configuration work. The framework laid out across this piece is meant to make that internal path navigable on its own. The decision to bring in outside expertise follows the same logic as the method-selection framework itself: where a team lacks prior experience with fine-tuning data curation, retrieval pipeline design, or governance documentation, the cost of getting those decisions wrong, retraining cycles, compliance failures, model regressions, typically exceeds the cost of bringing in guidance built specifically for that work.
Sources
- AutoAdapt: An Automated Domain Adaptation Framework for LLMs
Provided details on AutoAdapt's pipeline, including its input constraints, method selection among RAG and fine-tuning options, and its performance against AutoML baselines across ten tasks.
- Fine-Tuning Without Forgetting In-Context Learning: A Theoretical Analysis of Linear Attention Models
Provided the theoretical finding that fine-tuning on a target task can degrade a model's in-context learning ability, cited as the ICML 2026 theoretical analysis.
- FINE-TUNED IN-CONTEXT LEARNERS FOR EFFICIENT ADAPTATION J¨org Bornschein∗
Cited as research into fine-tuned in-context learners exploring how to preserve ICL ability alongside fine-tuned performance.
- Few-shot Fine-tuning vs. In-context Learning: A Fair Comparison and Evaluation
Provided the finding from the ACL Findings 2023 fair comparison that claims of ICL's superior out-of-domain generalization often do not hold when experimental conditions are equalized.
- A Comparative Analysis of Instruction Fine-Tuning LLMs for Financial Text
Provided evidence on instruction fine-tuning for financial text, informing the discussion of FinGPT and LoRA-based fine-tuning across open-source backbones for finance.


