Forward Deployed EngineeringAI EngineeringKnowledge Adaptation

A customer wants the model to 'know our docs.' Prompting, RAG, or fine-tuning: how do you choose?

Question 44 of 73 · Updated

On this page

Interview-ready answer#

I would first ask what the customer means by “know our docs.” Do they want the model to answer questions using the latest company policies, follow a particular writing style, extract information into a business schema, or learn a specialized task? These are different requirements and do not all need model training.

My default for frequently changing proprietary documents is retrieval-augmented generation (RAG): keep the documents in an authorized knowledge store, retrieve the relevant evidence at request time, and ask an instruct model to answer using that evidence with citations. For a small, stable set of instructions or documents that fits comfortably within the usable context budget, I would first try prompting with the relevant content directly. If the model has the right information but repeatedly fails to perform a stable task, follow a domain-specific response convention, or use an approved format, I would evaluate supervised fine-tuning or parameter-efficient adaptation.

I would often combine these approaches: prompting defines the task and output contract, retrieval provides current authorized facts, and fine-tuning can improve task behavior when evaluation justifies the investment. I would not fine-tune simply to memorize an entire document library; that makes updates, deletion, provenance and per-user access control difficult.

The decision should be driven by a representative evaluation set, knowledge freshness, permissions, latency, accuracy and cost per successful customer task. Start with the simplest adequate baseline, diagnose its failures, and add complexity only where the evidence supports it.

1. Discover what the customer actually wants#

“Know our docs” is a desired outcome, not a technical specification. Before choosing an architecture, identify the tasks the user needs to complete and what counts as a correct result.

Discovery questionWhy it changes the design
What are the top questions or workflows?Distinguishes factual lookup, document comparison, extraction, summarization and specialized behavior
Which source is authoritative?Prevents answering from obsolete drafts or contradictory copies
How large is the corpus, and how quickly does it change?Determines whether direct context is practical and how freshness must be maintained
Which users may see which documents?Defines retrieval authorization, tenant boundaries and data handling
Must answers cite evidence?Favors supplying inspectable sources rather than relying on memorized weights
What should happen if evidence is insufficient?Defines abstention, escalation and human-review requirements
What labeled examples are available?Determines whether supervised adaptation can be justified and evaluated
What are the latency, throughput and budget targets?Helps compare prompt length, retrieval overhead, model choice and training investment
Can documents be sent to a hosted provider?Determines approved deployment, retention and processing boundaries

Ask the customer for authorized representative queries, expected answers or scoring rubrics, and source identifiers. Include unanswerable questions, conflicting documents, revised policies, different permission scopes, and difficult real-world wording. A small pilot should target a specific measurable workflow, not a vague goal of teaching the model everything about an organization.

2. Separate knowledge, behavior and execution#

RequirementPrimary mechanism to evaluate
Answer using a small supplied documentDirect prompting
Answer using a large, changing document libraryRAG
Follow stable output and task instructionsPrompting, structured decoding, then fine-tuning if needed
Improve domain-specific task behaviorSupervised fine-tuning or adapters when labeled evidence supports it
Read current order status or account balanceAuthorized live tool/API or deterministic data access
Enforce permissions or business rulesApplication-level authorization and deterministic policy enforcement

The distinction is not absolute. Training can improve domain knowledge and retrieval can provide examples that influence behavior. However, putting information into weights does not turn the model into an authoritative database, and providing retrieved passages does not guarantee the model will use them correctly.

If the customer wants current transactional facts, retrieve them through an approved live data interface rather than indexing snapshots as if they were current truth. Apply the same authorization and provenance requirements to that interface.

3. Prompting: supply instructions and context directly#

Prompting changes the input to the model without changing its weights. It can include task instructions, response examples, explicit constraints and an authorized document or excerpt.

For a hypothetical travel-policy assistant with one short approved policy, the application might send the current policy text and ask the model to answer only from that text, cite its section, and return an explicit insufficient-evidence response otherwise.

A direct-context baseline is useful because it avoids an index, embedding pipeline and retrieval-service dependency. It can also help establish whether the model can solve the task when supplied with the correct evidence.

When prompting is a good fit#

  • The applicable material is small and bounded.
  • The relevant document is already known from the workflow.
  • Users need a standard response format or a few task demonstrations.
  • Updates can be handled by replacing the supplied content.
  • The complete prompt fits comfortably within the usable context budget and meets latency and cost targets.

Limitations#

Repeatedly sending an entire corpus consumes input tokens and can slow prefill. A long context window is a maximum input capacity, not a guarantee that the model will reliably identify every relevant fact. Contradictory, irrelevant or badly ordered material can degrade quality. The application must still supply only authorized documents and treat embedded instructions as untrusted content.

Prompt caching may reduce some repeated-prefix processing or billing costs for compatible runtimes, but the savings depend on the provider, workload and cache-hit behavior. It does not automatically make an oversized or poorly focused prompt useful.

4. RAG: retrieve evidence at inference time#

Retrieval-augmented generation supplies relevant external evidence to a generation model at request time. For enterprise document QA, it keeps the underlying knowledge separate from the model's parameters.

Loading diagram…

A practical RAG system includes source discovery, extraction, document and chunk identifiers, lexical or vector search, retrieval authorization, ranking, context selection, generation, and output validation. Embeddings are useful but not a mandatory definition of RAG; exact identifiers and technical error codes may be better served by lexical or structured retrieval. Hybrid retrieval can combine complementary methods.

The important difference from fine-tuning is that a policy update can be propagated through the document and index lifecycle without retraining the language model. This does not make freshness automatic. Establish a source-of-truth contract, update and deletion propagation targets, revision metadata, ingestion failure alerts and cache invalidation.

For example, if a policy changes from allowing 14 days to 30 days, the answer should be grounded in the currently applicable approved version. It should not silently blend a superseded policy with the new one. For questions about historical dates, the applicable version may deliberately be an older authorized document.

RAG failure modes#

FailureDiagnostic action
Relevant document never retrievedInspect source coverage, extraction, filters and search recall
Relevant evidence retrieved but ranked too lowEvaluate ranking, hybrid search and context selection
Correct evidence present but answer incorrectTest instruction following, model capability, reasoning and context arrangement
Citation points to an unrelated passageValidate citation identifiers and claim-level evidence
Deleted or revised material still appearsInspect synchronization, index versioning and caches
Access-restricted material reaches the modelTreat as a security failure; inspect the authoritative authorization boundary

RAG is a system, not a hallucination switch. Even perfect retrieval can be followed by an incorrect generated answer.

5. Fine-tuning: change the model's behavior#

Fine-tuning modifies model parameters using additional training data. Supervised fine-tuning teaches desired input-output patterns; parameter-efficient methods such as LoRA can adapt selected layers while keeping much of the base model frozen. Continued pretraining on a domain corpus is a different adaptation objective from supervised instruction tuning.

Fine-tuning can be appropriate if a capable baseline consistently fails at a stable, repeatable task despite receiving the correct evidence and a reasonable prompt. Examples include specialized classification, consistent extraction conventions, controlled terminology or a particular approved response style.

For a support-ticket routing classifier, fine-tuning on authorized labeled ticket examples may improve category selection. For an assistant answering questions about today's support policy, retrieval is still needed if the policy changes frequently.

Why not fine-tune the whole document library?#

  • Model weights do not offer ordinary document-level query, citation or deletion semantics.
  • Updated facts may conflict with previously learned information.
  • A model can memorize sensitive examples or reproduce outdated content.
  • Per-user access restrictions cannot be reliably enforced merely through training.
  • Training, versioning and regression testing add recurring operational work.
  • High training loss improvement does not prove the deployed workflow is correct.

Training can improve knowledge of a specialized domain, but that possibility is not a sufficient reason to use a model as the primary store of current enterprise facts. Do not promise that a fine-tuned model has learned every document accurately or that deleting a training record automatically removes its influence from an existing checkpoint.

Treat training datasets, checkpoints, adapters and evaluation artifacts as potentially sensitive. Establish data rights, retention policy, approved processing environment and deployment scope before adaptation.

6. A decision framework an FDE can use#

Loading diagram…

This framework is iterative rather than a mandatory three-stage waterfall. If the evidence points to a small deterministic lookup or extraction task, a conventional application may be sufficient without an LLM. If the simple baseline already meets the requirements, there is no need to add a vector database or training pipeline.

A particularly useful diagnostic is an oracle-context test: provide the model with the correct authorized evidence from the evaluation set and compare it with normal retrieval. If the model succeeds with the oracle but fails with retrieved evidence, investigate retrieval and context selection first. If it fails even with the correct evidence, investigate task formulation, reasoning, model choice and behavior adaptation.

Oracle-context testing is an evaluation technique, not a production assumption that the correct evidence is known.

7. Compare operational trade-offs#

DimensionDirect promptingRAGFine-tuning
Initial implementationOften smallestIndexing and retrieval infrastructureDataset preparation, training and evaluation
FreshnessReplace supplied contentSynchronize sources and indexRequires separate knowledge mechanism or retraining for weight-encoded facts
CitationPossible from supplied evidenceNatural source identifiers and passagesNot inherently traceable to source documents
Per-user permissionsApplication selects permitted inputAuthoritative retrieval-time enforcementCannot rely on model weights for document-level permissions
Per-request costDepends on prompt length, cache and modelAdds retrieval/ranking; may reduce model inputMay reduce prompt/retry cost; still incurs inference cost
LatencyDepends on context size and decodingAdds search and ranking, potentially saves prefillDepends on model, output length and runtime
MaintenancePrompt and source versioningIndex, access and source lifecycleTraining datasets, checkpoints, regression and release lifecycle

Do not claim RAG is always cheaper or faster. For a known short document, direct context may be simpler and less expensive. For a large repeated corpus, retrieval may reduce token use, but adds infrastructure and may introduce evidence-recall failures. Fine-tuning may reduce repeated instructions or improve first-pass success, but its training cost is only one component of the overall economics.

8. Worked cost comparison with tested Python#

Consider a hypothetical hosted-model workload:

  • 10,000 requests per month.
  • Input rate: $2 per million tokens.
  • Output rate: $8 per million tokens.
  • Direct context: 12,000 input tokens and 300 output tokens per request.
  • RAG: 2,500 input tokens and 300 output tokens per request, $0.003 additional retrieval/ranking cost per request, and $150 fixed monthly infrastructure.

These are invented planning assumptions, not a provider quote or a measured customer result. The input counts include the question, instructions and supplied evidence in the simplified model.

ApproachVariable cost per requestFixed monthly costMonthly total at 10,000 requests
Direct context$0.0264$0$264
RAG$0.0104$150$254

The assumed variable saving is $0.016 per request. The illustrative break-even point is 150 / 0.016 = 9,375 requests per month. Below that volume, the fixed infrastructure cost outweighs the variable saving in this model; above it, RAG costs less. This does not establish that either approach meets the required quality, security or latency.

The following Python helper uses exact rational arithmetic to make the assumptions and units explicit. Rates are dollars per million input/output tokens, extra_per_request is dollars per request, and fixed is dollars per month. Pass decimal rates as strings or Fractions to avoid importing binary floating-point approximation.

PYTHON
from fractions import Fraction def monthly_cost(requests, input_tokens, output_tokens, input_rate, output_rate, extra_per_request=0, fixed=0): rates = [Fraction(x) for x in (input_rate, output_rate, extra_per_request, fixed)] if any(type(n) is not int or n < 0 for n in (requests, input_tokens, output_tokens)) or min(rates) < 0: raise ValueError('nonnegative counts and rates required') ri, ro, extra, fixed = rates return requests * (Fraction(input_tokens, 10**6) * ri + Fraction(output_tokens, 10**6) * ro + extra) + fixed
PYTHON
assert monthly_cost(10000, 12000, 300, 2, 8) == 264 assert monthly_cost(10000, 2500, 300, 2, 8, '0.003', 150) == 254

The helper assumes fixed per-request token counts or suitable integer average counts, nonnegative valid rational rates, and linear pricing. It does not model prompt-cache discounts, retries, tiered billing, ingestion cost, storage growth, network charges, self-hosted hardware or fine-tuning amortization. Include those separately when they apply. For fine-tuning, account for training and annotation, evaluation and periodic updates as well as ongoing inference and any retrieval service.

Local verification: Python 3.13.5 executed the exact helper on 1,728 combinations of request counts, input/output token counts, rates, per-request overhead and fixed costs. An independent integer-scaled identity checked every result. Nine invalid count/rate cases were rejected, and four volume scenarios checked the difference around the break-even point and at 10,000 requests. All 1,741 checks passed. This validates the arithmetic, not external prices or actual model performance.

A better business metric is cost per successful task, including failures, retries, human review and the cost of incorrect decisions. A cheaper request that repeatedly produces incorrect output can be more expensive overall.

9. Evaluate the alternatives fairly#

Create a versioned, held-out evaluation set representing actual user needs. Separate prompt-development examples and training examples from the final evaluation. Where documents are revised or closely related, design time-based or source-level splits as appropriate to avoid misleading leakage.

Compare candidate systems using their correct prompting interfaces and the same business success criteria.

Evaluation dimensionExample evidence
Task correctnessExpert-reviewed answer accuracy or task-specific field correctness
Retrieval recallFraction of required evidence found in the selected top-k results, when relevance labels exist
GroundingClaim support and citation correctness against the supplied evidence
FreshnessAnswers reflect the applicable version within the agreed propagation time
AbstentionAppropriate response when evidence is missing, conflicting or insufficient
Output contractSchema validity separately from semantic correctness
AuthorizationPositive and negative tests for tenant, role, document and revoked access
PerformanceMeasured end-to-end p50/p95/p99 latency, throughput and error rates
EconomicsActual total cost per successful task including infrastructure and review

Use the oracle-context test to isolate retrieval failures from generation failures. Include adversarial and malformed document content, requests outside scope, ambiguous questions, and changes to permissions or source versions. Do not treat an LLM judge's score as unquestionable ground truth; calibrate it against authorized human judgments and use deterministic checks for measurable constraints.

The acceptance threshold should reflect the customer's task and risk. A finite benchmark with no observed permission failures cannot establish absolute security. Treat authorization tests as necessary evidence alongside architecture review and monitoring.

10. Data privacy and lifecycle requirements#

The customer may authorize internal documents for retrieval but not authorize them for provider training, or may allow some departments' content to be used only within a particular environment. Permission to read a document does not automatically imply permission to use it for model training.

For all three approaches, use an approved processing boundary, least-privilege credentials, minimized data collection and suitable retention controls. Check actual provider contracts and deployed configuration rather than assuming that all hosted inference requests have the same logging or training policy.

For RAG, enforce authoritative document permissions before restricted evidence enters the model context. Version or invalidate cached results when access changes. Treat indexes, embeddings, prompts and traces as potentially sensitive. Citations must not disclose unauthorized document titles or paths.

For fine-tuning, verify that the resulting model is appropriate for its entire intended user population. Do not combine restricted material into a shared model solely because the raw examples are not visible at inference time. Establish how retirement, correction and deletion requests will be handled; it may require retraining or replacing artifacts, not merely removing one source row.

Prompts and retrieved passages are not a security policy. Treat document instructions as untrusted data, enforce tool permissions in deterministic application logic and use human review for consequential actions.

11. Realistic hypothetical customer scenarios#

Scenario A: a small approved onboarding guide#

A company wants its onboarding assistant to answer questions from one current guide that fits comfortably into the usable context window. The guide is selected by the user's authorized workflow.

Start with direct context, a clear instruction to cite the applicable section and an explicit insufficient-evidence response. Evaluate the guide's actual questions, token cost and latency. If the library grows or questions begin spanning many documents, add retrieval based on evidence from the pilot rather than on anticipated complexity alone.

Scenario B: a policy library with frequent revisions#

A customer has many policy documents, different regional versions and permission scopes. Answers must include the applicable policy source.

Start with authorized RAG. Track source identity, effective dates, revisions and eligibility. Test updated documents, deletion propagation and cross-tenant negative cases. If the application has the correct policy evidence but the model still fails to distinguish applicability, refine the task prompt and context presentation, then evaluate model changes or tuning if necessary.

Scenario C: a specialized extraction workflow#

A customer receives documents containing specialized terminology and must populate a stable business schema. A baseline instruct model with direct document context and schema validation gives inconsistent classifications even when the correct evidence is present.

Investigate labeling ambiguity and output constraints first. If errors persist and authorized representative examples are available, evaluate supervised adaptation against the same held-out dataset. Keep the document supplied at inference time and validate every extracted field. The goal of fine-tuning is to improve extraction behavior, not to memorize document contents.

These are fictional architecture choices, not claims of measured customer results.

12. Rollout and maintenance#

Version the encoder, generator, prompt template, index configuration, document metadata rules, output schema and any adapter. Establish a reproducible baseline and controlled change process. Monitor ingestion health, source freshness, retrieval failures, citation errors, unauthorized-access incidents, latency, cost and abstention rates.

Use limited rollout and representative evaluation before replacing a production configuration. A retrieval change can affect answer quality without changing the generator. A fine-tuning change can affect instruction following even when retrieval is unchanged. Track them separately so regressions can be isolated.

Keep the simpler validated configuration available as a recovery option where appropriate. If evidence retrieval is unavailable, do not silently answer company-specific factual questions from model memory as if they were verified; follow the agreed abstention or fallback policy.

Likely interviewer follow-ups#

Would you ever fine-tune to improve domain knowledge? Yes, continued pretraining or supervised adaptation can help with specialized language and tasks. I would first establish a measurable need and assess the data, compute, governance and evaluation requirements. I would not use it as the sole source of current authoritative facts.

Is RAG always better than long-context prompting? No. If the relevant material is known, short and authorized, direct context can avoid retrieval failures and infrastructure overhead. Compare the actual workload.

Can I combine all three? Yes. Use instructions for task behavior, retrieval for relevant current facts, and a validated adapter for persistent domain-specific behavior gaps.

What if the model hallucinates even with RAG? Check whether the evidence was retrieved, correctly assembled and actually supports the answer. Use an oracle-context experiment, improve generation constraints or change the model, and evaluate abstention and citation fidelity.

What if a customer deletes a document? In a retrieval system, propagate deletion to the source/index/caches according to policy and verify that the document is no longer retrievable. If it was used in training, handle derived artifacts separately; deleting the source alone does not remove learned information.

What if the relevant evidence exceeds the context window? Select and prioritize the necessary authorized evidence, account for output and system tokens, and evaluate context-management alternatives. Do not silently truncate critical information. This is a separate engineering problem from choosing a knowledge adaptation mechanism.

Interview takeaway#

Choose the mechanism based on the failure you need to solve: prompting for explicit instructions and small known context, retrieval for current authoritative evidence, and fine-tuning for persistent learned behavior gaps. Start with a simple baseline, diagnose failures using controlled evaluation, and compare the actual cost, latency, privacy and operational requirements. Keep facts traceable to their authorized sources and keep business rules outside the model.

Related questions

Explore other topics:AI AgentsAI System DesignLarge Language Models