Scrivio Interview library
DesignIntermediate7 min read · updated 12 November 2026

When would you use prompt engineering, retrieval-augmented generation or fine-tuning to make an LLM answer questions about your company's insurance products? Compare cost, freshness and risk.

Prompt engineering is the cheapest and fastest to change, and fits when the knowledge needed is small enough to put in the prompt. RAG is the default for factual, changing knowledge such as insurance product terms: documents are retrieved at query time, answers can cite sources, and an update only needs re-indexing. Fine-tuning changes the model's behaviour, style or output format, but it is poor at keeping facts fresh and needs training data, evaluation and retraining; LoRA makes it cheaper for open-weight models. Most real systems combine RAG for facts with prompt templates or light fine-tuning for tone and format.

Why this question is asked

When a company wants an assistant that answers questions about its insurance products, someone always asks whether we should train our own model on the policy documents. It sounds like the most thorough option, but it is usually the wrong one for facts that change every quarter and must be quoted exactly. Interviewers ask this design question to see whether we can match the technique to the problem and explain the costs and risks of each. In this answer, we will recap the three techniques, then compare them on cost, freshness and risk for the insurance case, look at where fine-tuning really helps, and design a combined solution.

1A Quick Recap of the Three Techniques

Prompt engineering means improving the instructions and context we send with each request: a clear system message, rules, examples and any reference text that fits. The model itself does not change. Retrieval-augmented generation (RAG) adds a search step: we index our documents as chunks with embeddings in a vector store, retrieve the most relevant chunks for each question, and put them into the prompt. Again the model does not change; only what it reads does.

Fine-tuning is different: we train the model further on our own examples, usually pairs of input and desired output, so its weights change. The result is a new model variant that behaves differently even with a short prompt. With hosted models this is a provider service; with open-weight models we can run it ourselves, often with parameter-efficient methods such as LoRA (low-rank adaptation), which train a small set of extra weights instead of the whole model.

2Prompt Engineering: When the Knowledge Fits in the Prompt

If the assistant only needs a few pages, for example the summary of our three home insurance products and the claim phone numbers, we can put that text directly into the system message. It costs nothing to set up, changes go live as soon as we edit the prompt, and there is no extra infrastructure. With prompt caching, a repeated long prefix can even be cheap.

The limit is size and focus. An insurer usually has hundreds of policy wordings, riders, regional variations and versions by year. Pasting all of them into every request would exceed the context window, cost a lot per question and make the model more likely to mix up products. So prompt engineering alone fits small, stable knowledge, and it remains essential in every other approach for the instructions and tone.

3RAG: The Default for Factual, Changing Knowledge

Insurance product knowledge is exactly what RAG is for. It is large, it changes (new products, updated terms, regional rules), and answers must be precise and traceable: a customer service agent needs to see which document and clause an answer came from. With RAG, a question such as is flood damage covered under Home Plus in Bavaria retrieves the relevant clauses of the current Home Plus wording, the model answers from them, and the answer cites the source.

Freshness is the big advantage. When product terms change, we re-index the new documents, tagged with their effective dates, and the next question uses them. There is no training run. The risks are retrieval quality, getting the right clause rather than a similar one from another product or year, and access control, so internal underwriting notes are not retrieved for customers. We manage both with metadata filters (product, region, effective date, audience) and an evaluation set of real questions with known answers.

Java
List<Document> clauses = vectorStore.similaritySearch(SearchRequest.builder()
.query(question)
.topK(5)
.filterExpression("product == 'home-plus' && region == 'BY' && audience == 'customer'")
.build()); // 5 clauses from the current customer-facing Home Plus wording
String answer = chatClient.prompt()
.system("Answer only from the clauses. Cite them as [doc, clause]. If they do not answer, say so and offer an agent.")
.user(format(clauses) + "\nQUESTION: " + question)
.call().content();
// "Flood damage is covered up to 50,000 EUR if the elemental option is included [HomePlus-2026-BY, 4.3]."

4Fine-Tuning: Behaviour, Style and Format, Not Fresh Facts

Fine-tuning shines when we want the model to behave differently: always answer in our brand voice, follow a complex output format reliably, use our internal classification codes, or perform a narrow task with a smaller, cheaper model. It is weak at facts. Knowledge learned through training is stored in the same fuzzy way as pre-training, so the model can still confuse two products, it cannot cite where a fact came from, and every product change needs new training data, a new training run and a new evaluation.

The costs add up. We need hundreds to thousands of high-quality examples, a training budget, an evaluation pipeline, and versioning of the tuned models. For open-weight models, LoRA lowers the compute and storage cost a lot, since only small adapter weights are trained and several adapters can share one base model, but the data and evaluation work stays. The risk side matters for insurance in particular: a fine-tuned model that confidently states an outdated coverage limit, without a source, is a compliance problem.

Comparing the three for insurance questions
AspectPrompt engineeringRAGFine-tuning
Setup costVery lowMedium: indexing, vector storeHigh: data, training, evaluation
Cost per questionGrows with prompt sizeRetrieval plus a focused promptCan be low with a small tuned model
FreshnessEdit the promptRe-index changed documentsRetrain for every change
CitationsOnly if text is in the promptYes, from retrieved chunksNo
Main riskContext too large, mixed productsWrong or unauthorized chunksConfident outdated facts
Best forSmall, stable knowledge, instructionsLarge, changing factual knowledgeStyle, format, narrow tasks

5Combining Them in One Design

For the insurance assistant, the design I would propose uses all three in their roles. RAG supplies the facts: current product wordings, tagged by product, region, effective date and audience. A versioned prompt template sets the rules: answer only from the clauses, cite them, never give advice on which product to buy if regulation forbids it, hand over to an agent when unsure. If after evaluation the tone or format is still not right, for example answers must follow a strict structure for agents, we can add light fine-tuning or simply move to structured output, but we never rely on the tuned model for the facts.

The order of work follows cost. We start with prompts and RAG, build the evaluation set from real customer questions, and only consider fine-tuning when the evaluation shows a gap that prompts cannot close. That way the expensive option is chosen because of evidence.

Step throughChoosing a technique
  1. Does the needed knowledge fit in a short prompt and rarely change?
    YesPrompt engineeringNoContinue
  2. Is it factual knowledge that changes or must be cited?
    YesRAG with metadata filtersNoContinue
  3. Is the gap behaviour, style or format after prompting?
    YesConsider fine-tuning (LoRA for open-weight)NoImprove prompts and retrieval
  4. Evaluate every option on the same question set

4 steps in order. Play them, or step through them one at a time.

6Follow-up questions

Can fine-tuning and RAG be used together?

Yes. A model can be fine-tuned to be better at answering from retrieved passages in our format, for example always citing clauses, and still get the facts through RAG. That combination is common when the base model's style or format is not good enough even with good prompts.

How do we handle questions about older policy versions?

Tag every chunk with its effective dates and filter by the customer's policy start date or the date in question. Old wordings stay indexed but are only retrieved when they apply. This is very hard to do with fine-tuning and natural with RAG.

What does LoRA actually change?

Instead of updating all weights of the model, LoRA adds small low-rank matrices to some layers and trains only those. The trained adapter is often a few hundred megabytes or less instead of many gigabytes, it trains on far less GPU memory, and it can be loaded or swapped on top of the same base model.

7Conclusion

In this answer, we compared three ways to make an LLM answer questions about insurance products. Prompt engineering is cheapest and fastest to change but only fits small, stable knowledge. RAG is the default for large, changing factual knowledge, because it retrieves current documents at query time, supports citations and only needs re-indexing when terms change. Fine-tuning changes behaviour, style and format, is poor at fresh facts and needs data, evaluation and retraining, with LoRA lowering the cost for open-weight models. A good design combines RAG for facts with prompt templates, and possibly light fine-tuning, for tone and format.

What to say in the interviewAbout 90 seconds aloud

Open with

I would match the technique to the kind of problem. Prompt engineering, meaning clear instructions, examples and any reference text that fits, is the cheapest and changes instantly, so it is right when the knowledge is small and stable, like a summary of three products.

Then, if they want more

For insurance products in general, the knowledge is large, changes every quarter and must be quoted precisely with a source, so RAG is my default: we index the policy wordings as chunks tagged with product, region, effective date and audience, retrieve the relevant clauses at question time, and the model answers from them with citations.

Updating a product means re-indexing, not training. The main risks are retrieving the wrong clause or a document the user should not see, which we handle with metadata filters and an evaluation set.

Fine-tuning changes the model's behaviour, style or format; it is poor at keeping facts fresh, cannot cite sources, and needs training data, evaluation and retraining with every change, which in insurance risks confidently outdated answers. LoRA reduces the training cost for open-weight models, but not the data and evaluation work.

So I would combine RAG for facts with a versioned prompt template for rules and tone, and consider light fine-tuning only if evaluation shows a format or style gap that prompting cannot close.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring AI reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "When would you use prompt engineering, retrieval-augmented generation or fine-tuning to...": https://scrivio-interview-library.netlify.app/spring-boot/llm-fundamentals/fc7aff37b3/