User Feedback Loops and Continuous Improvement

Collect user feedback and turn it into test cases and fixes.

Last Updated: 27, Nov 2026

Search Tutorials

--Ads--

Module 20 · Lesson 9 of 9 · Advanced

User Feedback Loops and Continuous Improvement

Collect user feedback and turn it into test cases and fixes.

A RAG system is never finished. Documents change, users ask questions nobody anticipated, and every failure is information about what to improve. A feedback loop turns real usage into a steady stream of fixes and new test cases, so the system gets better each week instead of slowly drifting.

A cycle of six steps: users ask, log and collect feedback, triage failures, fix and add tests, evaluate, deploy.
Figure 1. The continuous improvement loop.

Collect feedback signals

Explicit signalsImplicit signals
Thumbs up / thumbs down on each answerUser immediately rephrases the same question
Optional comment ("wrong number", "outdated")User escalates to human support after an answer
"Was this source helpful?" on citationsUser copies the answer (a positive sign)
Reports from support agents and content ownersAnswer says "not found" (possible content gap)

Explicit feedback is sparse (most users never click), so combine it with implicit signals. Link all of it to the trace ID from Observability, so each piece of feedback comes with the full context of what happened.

A feedback endpoint

from datetime import datetime, timezone
from typing import Literal
from pydantic import BaseModel, Field

class Feedback(BaseModel):
    trace_id: str
    rating: Literal["up", "down"]
    comment: str = Field(default="", max_length=1000)

@app.post("/feedback")
async def feedback(fb: Feedback):
    record = {**fb.model_dump(), "received": datetime.now(timezone.utc).isoformat()}
    with open("feedback.jsonl", "a", encoding="utf-8") as f:      # use a database in production
        f.write(json.dumps(record) + "\n")
    return {"status": "thanks"}

Triage: why did it fail?

Every negative case falls into one of a few categories, and each category has a different owner and fix:

CategorySymptom in the traceTypical fix
Content gapNo document contains the answerContent owners write or update documentation
Stale contentRetrieved document is outdatedArchive old versions, fix ingestion freshness
Retrieval missThe answer exists but was not retrievedChunking, hybrid search, query rewriting, metadata
Generation errorRight chunks retrieved, wrong or unsupported answerPrompt changes, citations, effort
Out of scopeQuestion the assistant should not answerRouting, clearer "can't help" message

An LLM can pre-classify negative traces to speed up review. A person should confirm the category before acting on it.

from pydantic import BaseModel
import anthropic

client = anthropic.Anthropic()

class Triage(BaseModel):
    category: Literal["content_gap", "stale_content", "retrieval_miss", "generation_error", "out_of_scope"]
    explanation: str

def triage(trace: dict, comment: str) -> Triage:
    chunks = "\n\n".join(trace["retrieved_texts"])
    return client.messages.parse(
        model="claude-opus-5-5", max_tokens=1000, output_config={"effort": "medium"},
        messages=[{"role": "user", "content":
            f"A user rated this RAG answer as bad.\nQuestion: {trace['question']}\n"
            f"Retrieved chunks:\n{chunks}\n\nAnswer: {trace['answer']}\nUser comment: {comment}\n\n"
            "Classify the most likely cause of the failure."}],
        output_format=Triage,
    ).parsed_output

Turn failures into test cases

Every confirmed failure becomes a case in your golden test set (Building a Golden Test Set), with the correct reference answer and evidence. The fix is then verified by the regression tests, and the failure can never silently return.

Close the loop with content owners

Many failures are not engineering problems. Send a regular report to document owners: questions with no answer in the documents, documents that are retrieved often but rated badly, and detected contradictions between sources. Improving the source content often helps more than any retrieval technique.

A weekly routine

  1. Review all thumbs-down answers and a random sample of other answers.
  2. Triage and assign each failure: content, ingestion, retrieval or prompt.
  3. Add confirmed failures to the golden set.
  4. Ship fixes behind the regression tests (A/B and Regression Testing).
  5. Track trends: thumbs-down rate, "not found" rate and the top unanswered topics.

Key takeaways

  • Collect explicit and implicit feedback, linked to request traces.
  • Triage failures into content gaps, stale content, retrieval misses, generation errors and out-of-scope questions.
  • Turn every confirmed failure into a regression test case.
  • Report content problems to document owners; better content is often the best fix.