Designing a Grounded LLM Assistant for Seller Policy Questions
Machine LearningModel answerLast updated
Decide whether an LLM fits a seller-compliance help desk, choose an architecture, define offline and online accuracy measures, and design a safe improvement loop.
Context
An online marketplace wants an internal assistant that answers third-party sellers' questions about selling policies and catalog compliance. Sellers send thousands of such questions each day, and human agents currently need hours to resolve each one. The policy library is large, and a meaningful share of it is revised every week.
Assume roughly these figures when you reason about trade-offs, and state any others you add:
- about 5,000 questions per day
- about 2,000 policy documents, with about 50 changing weekly
- a goal of 95% factual correctness on the questions the system chooses to answer
- no more than 0.5% wrong answers on high-severity topics such as prohibited or restricted items
What to cover
- Is an LLM the right tool? Lay out the criteria for choosing between a generative approach, plain search, a rule engine, or a traditional classifier. State where each is appropriate for this problem.
- Architecture. Propose a design (prompting only, retrieval-augmented generation, fine-tuning, or a mix) and justify it using policy freshness, hallucination risk, and latency.
- Evaluation. Define offline and online metrics for factual accuracy and policy adherence. Explain how you would detect and quantify hallucinations, and why overlap metrics such as ROUGE or BLEU are poor accuracy measures here.
- Continuous improvement. Describe an operating loop that detects drift, captures weak answers, and ships updates safely.
Expectations
- Name concrete metrics (for example faithfulness, answer relevance, context recall, citation quality, abstention quality) and say how each is computed.
- Include human audit sampling in your plan.
- Explain precisely how you would stop an invented or misread policy from reaching a seller.
Hints
Hint 1
Start by splitting the traffic: which questions are binary lookups that a rules table can answer exactly, and which need synthesis across several documents? Also decide who is allowed to take enforcement actions.
Hint 2
Compare how retrieval and fine-tuning each handle weekly policy changes, source attribution, and rollback. Then think about which layers of checking (retrieval filters, citation checks, abstention) sit between the model and the seller.
Hint 3
Evaluate retrieval and generation separately, using a labeled golden set that includes unanswerable and adversarial questions. Validate any LLM judge against human labels, and weight errors by severity rather than counting them equally.
Hint 4
For the improvement loop, think about what signals reveal a bad answer after launch (re-asks, escalations, downstream violations), and how you would gate a change with regression tests, shadow traffic, and a staged rollout.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Framing
The core judgment here is that a wrong policy answer is a business failure, not a cosmetic one. A seller who follows bad advice may list a prohibited item and face penalties. So the design should favor grounded, cited, abstain-when-unsure behavior, with humans or rules keeping authority over enforcement.
1. Suitability assessment
| Criterion | Points to rules / search / classifier | Points to an LLM |
|---|---|---|
| Question spread | A few dozen intents with templated answers | Long tail of free-form, multi-part questions |
| Answer shape | Yes/no, lookup, fixed snippet | Synthesis across documents for a specific listing |
| Error tolerance | Zero (legal or enforcement decisions) | Tolerable if cited, able to abstain, and escalatable |
| Freshness | Policy owners can maintain rules | Content changes faster than rules can be written |
| Auditability | Fully deterministic trail required | Citations to source text suffice |
Recommendation: a tiered system.
- Tier 0, deterministic. An intent classifier plus a rule engine over a structured policy table handles high-volume binary checks, such as whether a certificate is required for a category.
- Tier 1, LLM. Handles nuanced questions, such as whether a bundle of refurbished goods with a third-party accessory may be listed in a given region.
- Escalation. Suspensions, removals, and any enforcement stay with rules or humans. The assistant advises and never enforces.
2. Architecture: retrieval-augmented generation with guardrails
Why retrieval over fine-tuning. With about 50 weekly changes, fine-tuned weights go stale, cannot point to a source, and are expensive to roll back. Retrieval grounds each answer in the current document version and yields citations. Fine-tuning remains useful later for behavior (output format, abstention style, tone), not for storing policy facts.
Pipeline
- Ingestion. Pull from the policy source of truth. Chunk by section (about 300-500 tokens), keep headings, and attach metadata: policy id, version, effective date, superseded-by, marketplace, category, severity. Re-index on change events rather than nightly.
- Query understanding. Rewrite the query, extract entities, run an injection/safety classifier, and route to Tier 0 or Tier 1.
- Retrieval. Hybrid search (BM25 for policy codes and exact terms plus dense embeddings), metadata filters for active versions and the seller's marketplace, then a cross-encoder rerank to the top 5.
- Generation. Instruct the model to answer only from the context, cite a chunk id for every claim, and return structured output such as
{answer, citations, confidence, abstain}. - Post-generation checks. Verify each citation exists and entails its claim (NLI or entailment model). Use severity-aware thresholds so high-severity topics need stronger support or go to a human. Filter PII and internal-only content.
- Fallback. On abstention, return links to the relevant policies and open a human ticket.
Mapping to the factors: hallucination risk is handled by grounding, mandatory citations, entailment checks, and abstention; freshness by event-driven indexing and version filters; latency by a small reranker, a mid-size generator, caching of frequent questions, and streaming.
3. Evaluation
Golden set. About 1,500 historical questions stratified by category, severity, and marketplace, with expert-written answers and labeled supporting chunks. Include unanswerable and adversarial items. Version it alongside policy versions.
Retrieval metrics (offline)
- Context recall@k: share of gold chunks in the top k (target at least 0.9 at k=5).
- Context precision, MRR, nDCG for ranking quality.
- Version correctness: share of retrieved chunks from active versions (target 100%).
Generation metrics (offline)
- Faithfulness: split the answer into atomic claims, check each against retrieved context, and report supported claims divided by total claims.
- Factual correctness: claim-level agreement with the expert answer. This catches answers faithful to the wrong chunk.
- Answer relevance: does it address what was asked.
- Citation precision and recall: do cited chunks truly support the claims.
- Abstention quality: precision and recall on unanswerable questions. Over-answering is the dangerous direction.
- Severity-weighted error rate: a wrong "yes, you may list this" on a prohibited item counts far more than a verbose reply.
Why not ROUGE/BLEU. They measure n-gram overlap. "Is permitted" and "is not permitted" overlap almost completely yet mean opposite things, and correct paraphrases get penalized. Use them at most as weak regression signals.
Measuring hallucination. Separate intrinsic (contradicts the context) from extrinsic (not supported by the context). Measure with claim-level NLI, a rubric-based LLM judge (ideally stronger than the generator), and spot checks of unverifiable claims. Calibrate the judge on about 300 human-labeled examples and require agreement (for example Cohen's kappa of at least 0.7) before using it at scale.
Online metrics
- Abstention, escalation, and guardrail-block rates.
- Seller thumbs up/down and re-ask rate within 24 hours.
- Ticket deflection and time to resolution.
- Policy violations among sellers who followed the advice: the most important safety outcome.
- Human audit sampling: random 1% of traffic, all high-severity answers during launch, and oversampled low-confidence answers. Experts grade correctness, giving an unbiased hallucination-rate estimate with confidence intervals (reweight if sampling is stratified).
4. Preventing bad policy answers from reaching sellers
Defense in depth: version-filtered retrieval, a citation requirement, entailment verification, severity-aware thresholds, abstention with human handoff, a hard rule that enforcement is never automated, and a kill switch per topic so a problematic area can be routed to humans instantly.
5. Continuous improvement
- Drift detection: monitor query-topic distribution, retrieval scores, abstention rate, and faithfulness on a daily sample. Trigger review when a policy change lands and related answers shift.
- Capture failures: feed thumbs-down, re-asks, agent overrides, and audit failures into a triage queue. Convert confirmed failures into new golden-set cases.
- Policy-change testing: when a document changes, re-run the golden questions tied to it before the new version goes live.
- Safe releases: every prompt, model, or index change must pass offline regression thresholds, then shadow traffic, then a small canary with automatic rollback if faithfulness or severity-weighted error worsens.
- Ownership: assign policy owners to fix ambiguous or contradictory source documents, since many "model errors" are source problems.
Common mistakes
- Reaching for fine-tuning to store frequently changing facts.
- Evaluating only end-to-end quality, so retrieval and generation failures cannot be told apart.
- Trusting an unvalidated LLM judge.
- Using overlap metrics as accuracy.
- Averaging errors without severity weighting.
- Letting the assistant make or imply enforcement decisions.