Answers you can trust, from Codeables

Every page on Codeables is structured and verified — built so people and the AI agents they rely on can trust it. Explore more from the source behind this answer.

Explore Codeables
Verified Source
LLM Observability & Evaluation

How do you evaluate a RAG assistant when you don’t have clean ground-truth labels for every question?

Future AGI12 min read

LLMs are probabilistic, and RAG assistants amplify that: the same question can route to different documents, chain-of-thought paths, and final answers depending on subtle context shifts. If you also lack clean ground-truth labels for every query, “classic” accuracy metrics (exact match, BLEU, ROUGE) stop being useful. You still need to know: is this RAG system reliable enough to ship to production and keep improving over time?

In this guide, I’ll walk through how we evaluate RAG systems in exactly that setting at Future AGI: incomplete or noisy labels, evolving corpora, and multi-step agent behavior. The core idea is to replace brittle, single-truth evaluation with a deterministic, scenario-based framework that uses synthetic datasets, model-graded metrics, and traces to pin-point where the system fails—and how to fix it.


The Quick Overview

  • What It Is: A practical evaluation framework for RAG assistants when you don’t have perfect labels for every question.
  • Who It Is For: Teams running RAG search, chatbots, and agentic workflows that need predictable quality, but only have partial ground truth (or none).
  • Core Problem Solved: Moving from “looks good in a demo” to measurable, repeatable reliability—without requiring a fully labeled dataset.

The Core Challenge: Noisy or Missing Ground Truth

RAG assistants usually sit on top of messy realities:

  • Content changes frequently (wikis, product docs, FAQs).
  • Many questions are open-ended or opinionated.
  • “Correct” answers can be non-unique or multi-step.
  • Historical labels (if they exist) are partial and noisy.

So you run into at least one of these issues:

  1. No labels at all for most questions

    • You only have raw logs: queries, retrieved docs, model answers.
    • You can’t compute standard accuracy or F1.
  2. Weak labels that don’t map cleanly to outputs

    • You might have click-throughs, user thumbs-up/down, or NPS, but not a canonical answer string.
  3. Multiple valid answers

    • Different phrasing, reasoning, or even different document subsets can still be “correct enough.”

The mistake I see most often: teams try to brute-force labeling or accept a vague “LLM judge says it’s fine” metric without structure. Instead, you want a staged system that builds confidence iteratively.

At Future AGI, we formalize this into:

Datasets → Experiment → Evaluate → Improve → Monitor & Protect

You don’t jump directly to a magical “RAG score.” You construct scenarios, run controlled experiments, evaluate with purpose-built metrics, refine, and then monitor in production.


Step 1: Build a Scenario-Based Evaluation Dataset (Without Full Labels)

You don’t need a perfectly labeled dataset; you need a good scenario space.

1.1 Start from real queries, not synthetic fantasies

Pull queries from:

  • Search logs
  • Chat transcripts
  • Support tickets
  • Sales conversations

Cluster and sample them to cover:

  • High-volume intents
  • High-risk workflows (compliance, policy, finance)
  • Long-tail edge cases (multi-hop, ambiguous, noisy queries)

In Future AGI, these become Datasets: curated collections of real queries plus relevant context, tagged by scenario type.

1.2 Attach “just enough” reference information

You don’t need a full canonical answer to evaluate everything. For each query, capture one or more of:

  • Gold documents (or document spans) that should support a correct answer.
  • High-quality reference answers for a subset (even 5–20% is useful).
  • Constraints such as “must not hallucinate outside this corpus,” “must not mention internal codenames,” or “must cite sources.”

You can build this via:

  • Limited human annotation on a small subset (prioritize critical routes).
  • Semi-automatic labeling using existing trusted systems or rules.
  • Synthetic labels generated with LLMs that are then spot-checked.

In Future AGI, we frequently bootstrap with synthetic evaluation datasets and then gradually inject human labels for high-risk scenarios.

1.3 Encode metadata and expectations

Tag each example with:

  • Domain (product docs, legal, HR, API)
  • Difficulty (simple lookup vs. multi-hop reasoning)
  • Risk level (low, medium, high)
  • Required behavior (citation, reasoning, strict policy adherence)

This lets you slice metrics later instead of staring at one average score that hides where the system is brittle.


Step 2: Design Metrics That Don’t Depend on Perfect String-Exact Labels

When you don’t have clean labels, you need behavioral metrics, not just exact match.

For RAG, think in layers:

  1. Retrieval quality
  2. Answer quality
  3. Safety & policy compliance

2.1 Retrieval metrics without full labels

If you know which docs should support the answer (even roughly), you can measure:

  • Recall@k: Does the retrieved set contain at least one gold document?
  • Coverage: Percentage of queries where retrieved docs contain the necessary info.
  • Noise ratio: How many retrieved docs are irrelevant or misleading?

With partial labels, you can:

  • Treat unlabeled documents as “unknown,” not “negative.”
  • Use model-graded relevance: ask an evaluator model, “Is doc X sufficient to answer query Y?” and use that as a soft label.

In Future AGI, we often score retrieval with deterministic evaluation prompts that ask the model to label each doc as Highly Relevant / Partially Relevant / Irrelevant, then aggregate.

2.2 Answer quality via model-graded metrics

When you don’t have a single ground-truth answer, LLM-based evaluators are essential. The key is to make them structured and deterministic, not vibes-based.

Common criteria we measure:

  • Factuality: Are claims supported by retrieved docs, or hallucinated?
  • Faithfulness to context: Does the answer stay grounded in the corpus?
  • Completeness: Does it address all core parts of the query?
  • Conciseness & clarity: Does it answer directly without fluff?
  • Citation quality: Are citations present and correctly mapped to supporting docs?

We structure evaluation prompts like:

You are evaluating a RAG assistant. Given:

  • The user question
  • The retrieved context documents
  • The assistant’s answer
    Judge the answer on a 1–5 scale for:
    (a) factual accuracy w.r.t. the context
    (b) completeness w.r.t. the question
    (c) level of hallucination (none, minor, major)
    Output a JSON object with these fields…

Future AGI’s stack goes further and uses deterministic evals and proprietary metrics to ensure consistency across runs, and we often train specialized evaluators to reduce variance.

2.3 Safety and policy metrics

Even without labels, you can deterministically test:

  • Toxicity, hate, and harassment
  • Sexism and bias
  • Privacy leaks (PII exposure)
  • Prompt injection and jailbreaking
  • Policy violations (e.g., financial, medical, internal data exposure)

This is where guardrailing comes in. Our Protect stack, for example, evaluates and can block model inputs/outputs across toxicity, sexism, data privacy, and prompt injection with minimal latency.

In evaluation mode, you run your RAG system on adversarial scenarios and log:

  • Percentage of unsafe outputs
  • Response behavior (blocked, refused, or answered safely)
  • Latency added by guardrails

Step 3: Use Experiments to Compare RAG Configurations, Not Just Measure One

Evaluating a single RAG pipeline in a vacuum is less useful than comparing alternatives.

Typical experiment axes:

  • Retriever: BM25 vs. dense vs. hybrid search
  • k values: top-3 vs. top-10 documents
  • Reranking: with vs. without cross-encoder reranker
  • Prompt variants: different system instructions or answer formats
  • Model variants: GPT-4 vs. Claude vs. Gemini, etc.
  • Tooling: with vs. without citation enforcement, summarization before answering, etc.

In Future AGI, this is the Experiment stage:

  1. Define variants
    E.g., baseline_rag, hybrid_rag_rerank, prompt_v2_citations_mandatory.

  2. Run experiments over the same dataset
    Every configuration sees the same queries and context.

  3. Evaluate with the same metrics and evaluators
    Keep evaluation logic identical to isolate changes.

  4. Select a “Winner”
    Use a combination of metrics:

    • Factuality >= threshold
    • Completeness
    • Safety violations <= threshold
    • Latency within SLO

The output isn’t just “Model A is better than Model B,” but a clear view of which configuration is best for which scenario slice (e.g., multi-hop questions, high-risk legal queries, etc.).


Step 4: Close the Loop with Error Localization and Prompt/Workflow Refinement

You can’t stop at metrics. You need to act on them.

4.1 Localize errors: where did the pipeline fail?

For each failed or low-scoring example, ask:

  • Did retrieval fail?
    • No relevant docs returned
    • Relevant docs returned but too far down the rank list
  • Did the LLM misreason over correct docs?
    • Misinterpretation, incomplete reasoning, or ignoring key spans
  • Did the answer violate safety or policy?
    • Leaked PII, followed a jailbreak, generated toxic content

Future AGI uses traces and an Error Localizer mindset: each step of the agentic workflow is logged and evaluable. You can replay failures and see which stage is responsible.

4.2 Improve prompts and workflows with eval feedback

Once you know where failures cluster, you can:

  • Update retrieval:

    • Better indexing strategy or embedding model
    • Adjust top-k, filters, or reranker
    • Add domain-specific synonyms, custom ranking logic
  • Refine prompts:

    • Explicitly enforce citing only from provided context
    • Penalize hallucination (“if unsure, say you don’t know”)
    • Require step-by-step reasoning over context before answering
  • Adjust workflow:

    • Add a “verification” step that checks the answer against docs
    • Insert a safety check before returning answers
    • Route high-risk queries to a stricter model or human review

In Future AGI, the Improve stage feeds evaluation feedback back into prompts and configs. We frequently use “automatic prompt refinement” loops: the system takes low-scoring examples and proposes prompt changes, then re-runs experiments.


Step 5: Monitor & Protect in Production (When Labels Don’t Exist Yet)

Offline evaluation gets you to a reliable starting point. But once you’re in production, you still won’t have ground-truth labels for most real user queries.

You solve this with continuous monitoring and guardrails.

5.1 Continuous evaluation with sampling

Set up a pipeline where:

  1. A small, random sample of production queries is logged as evaluation candidates.
  2. For those samples, you run:
    • The same model-graded factuality/faithfulness metrics as offline.
    • Safety checks across toxicity, privacy, injection, etc.
  3. Track time-series metrics:
    • Factuality score by domain and route.
    • Hallucination rate.
    • Safety violation rate.
    • Latency and cost.

This is exactly what Future AGI’s Monitor & Protect module is designed for: you instrument your app (e.g., pip install traceAI-openai + OpenAIInstrumentor().instrument(...)) and get per-route, per-scenario metrics in real time.

5.2 Use human-in-the-loop labels strategically

You don’t need humans on every interaction.

Use them where:

  • Evaluators show low confidence or conflicting signals.
  • High-risk queries are involved (legal, medical, financial).
  • New content domains are being introduced.

These human labels:

  • Become seed labels for future synthetic dataset expansion.
  • Calibrate and improve your model-based evaluators.
  • Provide ground-truth anchors for critical flows.

5.3 Guardrails as enforcement, not just scorekeeping

Monitoring tells you what is happening; guardrails let you act when something unsafe or unreliable happens:

  • Block outputs that:
    • Contain PII or sensitive internal data.
    • Display toxic or discriminatory language.
    • Follow a prompt injection that instructs the agent to exfiltrate data.
  • Force fallback behavior:
    • Refuse to answer and escalate.
    • Use a simpler, more conservative model.
    • Switch to a strictly template-based response.

Future AGI’s Protect stack is built for exactly this kind of minimal-latency, multimodal production blocking. The same safety metrics used in evaluation mode become policy enforcers at runtime.


How Future AGI Structures This End-to-End

To make this concrete, here’s how teams typically implement this evaluation framework with Future AGI:

  1. Datasets

    • Import historical queries and logs.
    • Generate synthetic edge cases and adversarial prompts.
    • Tag by scenario, risk, and domain.
  2. Experiment

    • Define multiple RAG variants (retriever, reranker, model, prompts).
    • Run them on the same evaluation datasets without changing application code.
    • Log traces for each run.
  3. Evaluate

    • Apply deterministic, model-based metrics:
      • Retrieval relevance
      • Factuality and hallucination
      • Completeness, clarity, citation quality
      • Safety (toxicity, sexism, privacy, prompt injection)
    • Use custom metrics when needed (e.g., specific policy constraints).
  4. Improve

    • Drill down with traces and Error Localizer-like views.
    • Identify failure patterns by stage (retrieval vs. reasoning vs. safety).
    • Automatically refine prompts or adjust configs, then re-run experiments to confirm improvements.
  5. Monitor & Protect

    • Instrument production apps (traceAI-openai, OpenAI/Anthropic/Gemini/Bedrock, LangChain/Haystack/DSPy/CrewAI/LiteLLM).
    • Continuously sample and evaluate live traffic.
    • Enforce guardrails with minimal latency to block unsafe behavior.

Outcome: teams report things like “10x Faster Summary Evaluation,” “50% Increase Summary Quality,” and “25% Increase Response rate” because they’re no longer guessing—they’re running a closed loop.


Practical Example: Evaluating a Support RAG Bot Without Full Labels

Suppose you run a support RAG assistant over your product documentation and tickets.

You don’t have ground-truth answers for every possible question, but you can:

  1. Build the dataset

    • Sample 1,000 real user questions from Zendesk.
    • For 200 of them, have support agents write “ideal answers” and mark the docs they used.
    • For the rest, only tag the most relevant docs (semi-automatic with model help).
  2. Define metrics

    • Retrieval: does top-5 contain at least one of the agent-marked docs?
    • Answer:
      • Factuality vs. docs (LLM evaluator 1–5).
      • Completeness vs. question (1–5).
      • Citation correctness (all citations must correspond to relevant docs).
    • Safety: ensure guidance doesn’t conflict with your refund/SLAs, and no PII leakage.
  3. Run experiments

    • Baseline: BM25+GPT-4 with a generic “helpful assistant” prompt.
    • Variant A: hybrid retriever + reranker + explicit “no hallucination” instructions.
    • Variant B: same as A, but with a verification step that re-checks answer vs. docs.
  4. Select winner & refine

    • Variant B scores:
      • +20% on factuality
      • -30% hallucination rate
      • Slightly higher latency but within SLO
    • Drill into failures:
      • 80% of remaining issues are retrieval gaps on specific feature names → fix indexing and synonyms.
      • Update prompts to handle ambiguous questions by asking clarifying follow-ups.
  5. Monitor in prod

    • Sample 1% of live queries daily.
    • Run the same metrics.
    • Alert if hallucination rate > threshold or safety violations occur.

You’ve evaluated the RAG assistant rigorously—even though you never had full ground-truth answers for every query.


Summary

You don’t need a perfectly labeled dataset to evaluate a RAG assistant reliably. You need a structured, lifecycle-driven approach:

  • Construct scenario-based datasets from real queries, with partial labels and constraints.
  • Use layered metrics that assess retrieval, answer quality, and safety—even when exact answers aren’t known.
  • Run controlled experiments across RAG variants to find the best configuration per use case.
  • Localize errors using traces and evaluators to improve prompts, retrieval, and workflows.
  • Monitor & Protect in production with continuous sampling and guardrails that can block unsafe behavior.

LLMs are probabilistic. Evaluation is how you turn that probabilistic behavior into a product you can actually trust.


Next Step

Ready to evaluate your RAG assistant—even without perfect labels—and turn it from a demo into a reliable product?
Get Started

How do you evaluate a RAG assistant when you don’t have clean ground-truth labels for every question? | LLM Observability & Evaluation | Codeables | Codeables