Building Robust LLM Evaluation Frameworks: W&B's Evaluation-Driven Development Approach

weights_&_biases · Tech · 2024 · source Agentic: no · promotional bias: low · summary-only (no fetched source) · extracted with prompt 0.5.5 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Evaluation-driven RAG documentation assistant development

Weights & Biases needed to improve Wandbot, its LLM-powered documentation assistant, by making automated evaluations align with human judgment while also fixing retrieval, ingestion, query understanding, and knowledge-base coverage problems.

Constraints:

Architecture

Wandbot v1.1 combines evaluation-driven iteration with a richer RAG pipeline. W&B curated manual annotations in Argilla, used GPT-4 as an evaluator with a custom W&B-support-expert prompt, and aligned auto-evaluation with human labels through few-shot examples. The production pipeline improved data ingestion by cleaning Docusaurus-specific Markdown artifacts before parsing, expanded the knowledge base, added query enhancement with mention stripping, Cohere language detection, Cohere intent classification, Instructor-based keyword/sub-query generation, and hybrid retrieval across FAISS semantic search, BM25 keyword search, and you.com web snippets. LlamaIndex and RAGAS metrics then compare model/pipeline variants.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  user-query[User query] --> query-enhancement-stage[Query enhancement stage]
  query-enhancement-stage --> cohere-language-detector[Cohere language detector]
  query-enhancement-stage --> cohere-intent-classifier[Cohere intent classifier]
  query-enhancement-stage --> instructor-query-enhancer[Instructor query enhancer]
  markdown-ingestion-cleaner[Markdown ingestion cleaner] --> knowledge-base-index[Knowledge base index]
  knowledge-base-index --> faiss-vector-retriever[FAISS vector retriever]
  knowledge-base-index --> bm25-retriever[BM25 retriever]
  faiss-vector-retriever --> hybrid-retriever[Hybrid retriever]
  bm25-retriever --> hybrid-retriever
  you-com-web-retriever[You.com web retriever] --> hybrid-retriever
  instructor-query-enhancer --> hybrid-retriever
  hybrid-retriever --> metadata-filtering-postprocessor[Metadata filtering postprocessor]
  metadata-filtering-postprocessor --> response-synthesis-prompt[Response synthesis prompt]
  instructor-query-enhancer --> response-synthesis-prompt
  response-synthesis-prompt --> auto-evaluation-framework[Auto evaluation framework]
  argilla-annotation-dataset[Argilla annotation dataset] --> auto-evaluation-framework
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
User query Documentation, debugging, or support question submitted to Wandbot. Query enhancement stage
Query enhancement stage Removes mentions, detects language, classifies intent, and creates keywords/sub-queries for retrieval. User query, Cohere language detector, Cohere intent classifier, Instructor query enhancer, Hybrid retriever
Cohere language detector Detects query language for multilingual support. Query enhancement stage
Cohere intent classifier Fine-tuned multi-label classifier that detects user intent. Query enhancement stage
Instructor query enhancer Identifies intent and enriches the query with keywords and sub-queries. Query enhancement stage, Hybrid retriever, Response synthesis prompt
Markdown ingestion cleaner Handles Docusaurus MarkdownX artifacts before documents reach the parser. Knowledge base index
Knowledge base index Expanded documentation corpus including reports, examples, SDK tests, and parsed docs. Markdown ingestion cleaner, FAISS vector retriever, BM25 retriever
FAISS vector retriever Semantic similarity retriever over indexed documentation embeddings. Knowledge base index, Hybrid retriever
BM25 retriever Keyword-based retriever using BM25Okapi and query-enhancement keywords. Knowledge base index, Hybrid retriever
You.com web retriever External web-search retriever for queries needing information outside the documentation base. Hybrid retriever
Hybrid retriever Combines semantic, keyword, and web snippets, then refines results with metadata filtering. FAISS vector retriever, BM25 retriever, You.com web retriever, Metadata filtering postprocessor, Response synthesis prompt
Metadata filtering postprocessor Refines retrieval results before synthesis. Hybrid retriever, Response synthesis prompt
Response synthesis prompt Uses retrieved contexts plus enhanced-query hints to generate Wandbot answers. Instructor query enhancer, Hybrid retriever, Auto evaluation framework
Argilla annotation dataset Curated human and GPT-4 annotations used as ground truth and few-shot examples. Auto evaluation framework
Auto evaluation framework GPT-4, LlamaIndex, and RAGAS-based evaluation stack for answer and context metrics. Response synthesis prompt, Argilla annotation dataset

Data flow

A user question enters Wandbot and is cleaned by removing bot/user mentions. The query enhancement stage detects language with Cohere, classifies intent with a fine-tuned Cohere model, and uses Instructor to add keywords and sub-queries. Those signals feed a hybrid retriever that combines FAISS semantic search, BM25 keyword search, and you.com web snippets over an expanded and cleaned knowledge base, then applies metadata filtering. The response synthesis prompt uses the retrieved contexts and query hints to answer. Separately, responses are evaluated against 98 curated QA pairs using GPT-4, customized LlamaIndex evaluators, and RAGAS metrics aligned with Argilla human annotations.

5 supporting quotes
“The enhancer first uses string manipulation and regex to remove bot and user mentions. Cohere's language detection API was incorporated to detect query language and enable multilingual support. The team also fine-tuned a Cohere classification model to”summary, stated
“Cohere's language detection API was incorporated to detect query language and enable multilingual support. The team also fine-tuned a Cohere classification model to classify queries and detect user intent through multi-label classification. The Instructor”summary, stated
“The team also fine-tuned a Cohere classification model to classify queries and detect user intent through multi-label classification.”summary, stated
“The final hybrid retriever combined three retrieval strategies: FAISS Vectorstore for semantic similarity search, BM25 for keyword-based retrieval, and you.com for web search.”summary, stated
“The resulting evaluation dataset contained 98 Question-Answer pairs that served as reference answers for the auto-evaluation system.”summary, stated

Why this architecture

W&B built both an evaluation stack and retrieval stack because evaluation quality and RAG quality were mutually limiting. Human labels were trustworthy but too slow, so GPT-4 evaluation had to be calibrated with Argilla-curated examples. Retrieval failures came from parser quality, missing corpus coverage, weak query understanding, and single-strategy retrieval, so the v1.1 pipeline added ingestion cleanup, knowledge-base expansion, query enhancement, and hybrid retrieval. The architecture is modular so each stage can be improved and measured independently.

4 supporting quotes
“The team needed a way to bridge this gap—creating an auto-evaluation system that could provide reliable feedback without requiring repeated manual assessments for every change to the pipeline.”summary, stated
“The team observed during annotation that retrieval performance was suboptimal and had room for improvement. They also noticed that some queries, particularly those related to code troubleshooting and sales, required knowledge from outside their documentation”summary, stated
“They also noticed that some queries, particularly those related to code troubleshooting and sales, required knowledge from outside their documentation knowledge base.”summary, stated
“the modularization of pipeline components (query enhancement, retrieval, evaluation) demonstrates good software engineering practices that facilitate iterative improvement”summary, stated

Models used: GPT-4 · gpt-4-1106-preview · gpt-4-0613 · gpt-3.5-turbo-16k-0613 · Cohere language detection API · Fine-tuned Cohere classification model · Embedding model for FAISS/vector retrieval

Scale

Alternatives considered (roads not taken)

Use default automated evaluator prompts

Rejected because: Default prompts for correctness, faithfulness, and relevance did not align well with manual human assessments.

“Initially, they relied on default prompts for evaluating Correctness, Faithfulness, and Relevance, but these did not correlate well with human assessments.”summary, stated

Rely on manual evaluation for every iteration

Rejected because: Manual assessments were accurate but too time-consuming and tedious for rapid pipeline iteration.

“Manual evaluations, while more accurate, were time-consuming and tedious, making them impractical for iterative development cycles.”summary, stated

Keep the default MarkdownNodeParser path unchanged

Rejected because: Docusaurus-specific MarkdownX artifacts produced chunks that were too short or too long for effective retrieval.

“The default MarkdownNodeParser in LlamaIndex did not handle Docusaurus-specific MarkdownX features well, including JavaScript components, plugins, Tabs, Frontmatter, and Admonitions. This resulted in context chunks that were either too short or too long for”summary, stated
“This resulted in context chunks that were either too short or too long for effective retrieval. The team fixed these parsing issues by handling these artifacts before passing documents to the parser, ensuring more consistent and appropriately-sized chunks”summary, stated

Retrieve only from the original documentation index

Rejected because: Some user questions required reports, examples, SDK tests, or external web knowledge outside the initial docs.

“queries during annotation that Wandbot could have answered correctly if the relevant documents had been included in the index.”summary, stated
“some queries, particularly those related to code troubleshooting and sales, required knowledge from outside their documentation knowledge base.”summary, stated

Use a single retrieval strategy

Rejected because: The system needed semantic retrieval, keyword matching, and web snippets to handle diverse real-world documentation queries.

“A custom retriever was built that fetched relevant snippets from you.com's web-search API and added them to retrieval results alongside the internal knowledge base.”summary, stated
“The team also added a BM25Retriever from LlamaIndex that uses BM25Okapi for keyword-based retrieval, leveraging keywords generated during the query enhancement stage. The final hybrid retriever combined three retrieval strategies: FAISS Vectorstore for”summary, stated

Patterns

eval-driven-development (quality)

W&B used curated human labels, GPT-4 auto-evaluation, LlamaIndex/RAGAS metrics, and model/pipeline comparisons to guide Wandbot v1.1 improvements.

“This case study documents the journey from Wandbot v1.0 to v1.1, emphasizing an evaluation-driven development approach”summary, stated
“The v1.1 pipeline with gpt-4-1106-preview generally outperformed other configurations across most metrics.”summary, stated

llm-as-judge (evaluation)

The team used GPT-4 as a W&B support expert evaluator, calibrated by human annotations and few-shot examples.

“The team created a custom evaluation prompt that instructed GPT-4 to act as a W&B support expert”summary, stated
“the team implemented few-shot prompting by sampling correct and incorrect examples from their annotated datasets.”summary, stated

rag-retrieval (retrieval)

Wandbot retrieves contexts from an expanded documentation corpus to answer W&B platform questions and debugging issues.

“This improvement was attributed to the hybrid retrieval approach and expanded knowledge base. ## Key LLMOps Takeaways This case study demonstrates several important LLMOps practices.”summary, stated
“prompted an expansion of the knowledge base to include Fully Connected Reports, Weave Examples, and W&B SDK Tests, providing more diverse sources for retrieval. ### Query Enhancement Stage A significant addition to the RAG pipeline was a Query Enhancement Stage designed to make queries more concise,”summary, stated

hybrid-search (retrieval)

The final retriever combines FAISS semantic search, BM25 keyword search, and you.com web search.

“The final hybrid retriever combined three retrieval strategies: FAISS Vectorstore for semantic similarity search, BM25 for keyword-based retrieval, and you.com for web search.”summary, stated

query-rewriting (retrieval)

The query enhancement stage removes mentions, detects language, classifies intent, and adds keywords/sub-queries before retrieval and synthesis.

“A significant addition to the RAG pipeline was a Query Enhancement Stage designed to make queries more concise, contextually relevant, and free from extraneous information.”summary, stated
“The Instructor library was used to identify user intent and enhance queries with keywords and sub-queries. These enhancements were injected into the system prompt and used during retrieval to provide hints to the model during response synthesis.”summary, stated

data-quality-loop (data)

Manual annotation exposed Markdown parsing and missing-corpus issues, which fed data-ingestion cleanup and knowledge-base expansion.

“During manual annotation, the team discovered issues with retrieved contexts stemming from incorrect data parsing.”summary, stated
“attention to data quality—both in terms of parsing improvements and knowledge base expansion—highlights that RAG performance is often constrained by the underlying data”summary, stated

Tradeoffs

Calibrate auto-evaluation with human labels

Chose GPT-4 evaluator plus Argilla-curated few-shot examples over Default evaluator prompts or repeated manual-only evaluation.

Rationale: This made evaluation fast enough for iteration while improving alignment with human judgment.

“The solution involved constructing a GPT-4 powered evaluation framework that was carefully aligned with human annotations.”summary, stated
“The annotations were ingested into Argilla with both user annotations and GPT-4 annotations (as suggestions)”summary, stated

Use hybrid retrieval

Chose FAISS, BM25, and you.com web snippets over A single internal vector retriever.

Rationale: Different query types needed semantic matching, keyword matching, and sometimes external web knowledge.

“some queries, particularly those related to code troubleshooting and sales, required knowledge from outside their documentation knowledge base.”summary, stated
“The final hybrid retriever combined three retrieval strategies: FAISS Vectorstore for semantic similarity search, BM25 for keyword-based retrieval, and you.com for web search.”summary, stated

Add query enhancement before retrieval

Chose Mention cleanup, language detection, intent classification, keywords, and sub-queries over Passing raw user messages directly into retrieval.

Rationale: Enhanced queries were more concise, relevant, multilingual-aware, and informative for retrieval and synthesis.

“designed to make queries more concise, contextually relevant, and free from extraneous information.”summary, stated
“These enhancements were injected into the system prompt and used during retrieval to provide hints to the model during response synthesis.”summary, stated

Clean Markdown before parsing

Chose Preprocess Docusaurus artifacts over Letting the default parser handle MarkdownX directly.

Rationale: Parser artifacts created poor chunk sizes, so cleaning improved the retrieval substrate.

“This resulted in context chunks that were either too short or too long for effective retrieval.”summary, stated
“ensuring more consistent and appropriately-sized chunks for the vector store.”summary, stated

Use multiple evaluation frameworks

Chose Customized LlamaIndex evaluators plus RAGAS metrics over A single metric family.

Rationale: Response quality and context quality needed different measurements.

“They also used RAGAS (Retrieval Augmented Generation Assessment) for computing additional metrics like Answer Similarity, Context Precision, and Recall.”summary, stated
“This multi-framework approach provided comprehensive coverage of the pipeline's performance.”summary, stated

Gotchas (what bit them)

Default auto-evaluation prompts did not match human judgment.

Root cause: Generic correctness, faithfulness, and relevance prompts were not calibrated to W&B support expectations.

Resolution: Curate human annotations in Argilla and add few-shot correct/incorrect examples to the GPT-4 evaluator prompt.

“Initially, they relied on default prompts for evaluating Correctness, Faithfulness, and Relevance, but these did not correlate well with human assessments.”summary, stated
“To improve alignment with human judgment, the team implemented few-shot prompting by sampling correct and incorrect examples from their annotated datasets.”summary, stated

Manual evaluation was too slow for iterative development.

Root cause: Repeated human annotation did not scale to every pipeline change.

Resolution: Build a GPT-4 powered auto-evaluation framework aligned with curated annotations.

“Manual evaluations, while more accurate, were time-consuming and tedious, making them impractical for iterative development cycles.”summary, stated
“creating an auto-evaluation system that could provide reliable feedback without requiring repeated manual assessments”summary, stated

Docusaurus MarkdownX parsing degraded retrieval chunks.

Root cause: The default MarkdownNodeParser did not handle JavaScript components, plugins, Tabs, Frontmatter, and Admonitions.

Resolution: Handle these artifacts before parsing to produce more consistent chunks for the vector store.

“The default MarkdownNodeParser in LlamaIndex did not handle Docusaurus-specific MarkdownX features well, including JavaScript components, plugins, Tabs, Frontmatter, and Admonitions.”summary, stated
“The team fixed these parsing issues by handling these artifacts before passing documents to the parser”summary, stated

The original index missed answerable queries.

Root cause: Relevant documents such as reports, examples, and SDK tests were outside the knowledge base.

Resolution: Expand the index with Fully Connected Reports, Weave Examples, and W&B SDK Tests.

“Wandbot could have answered correctly if the relevant documents had been included in the index.”summary, stated
“This prompted an expansion of the knowledge base to include Fully Connected Reports, Weave Examples, and W&B SDK Tests”summary, stated

The evaluation dataset was small enough to limit confidence in broad generalization.

Root cause: The reported benchmark used only 98 question-answer pairs.

Resolution: Treat improvements as validated on the benchmark but needing broader production validation.

“the evaluation was conducted on a relatively small dataset of 98 Question-Answer pairs.”summary, stated
“Broader production validation would be needed to confirm these improvements generalize across the full range of user queries.”summary, stated

Evaluation

W&B evaluated Wandbot with GPT-4 acting as a W&B support expert, Argilla-curated human/GPT-4 annotations, few-shot examples, customized LlamaIndex evaluators, RAGAS metrics, and comparative runs across GPT-3.5, GPT-4, GPT-4-1106-preview, and the v1.1 pipeline.

Metrics: Answer Correctness · Answer Factfulness / Faithfulness · Answer Relevancy · Answer Similarity · Context Precision · Context Recall · 1/2/3 ordinal correctness-faithfulness-relevance scores

4 supporting quotes
“The framework evaluated responses across multiple dimensions, divided into response-level and context-level metrics”summary, stated
“Response metrics included Answer Correctness (whether the generated answer is correct compared to reference and thoroughly answers the query)”summary, stated
“Context metrics included Context Precision (whether ground-truth relevant items are ranked higher in retrieved contexts) and Context Recall”summary, stated
“The scoring system used an ordinal scale where 1 indicated incorrect/unfaithful/irrelevant, 2 indicated ambiguous, and 3 indicated correct/faithful/relevant.”summary, stated

Outcomes

The evaluation used 98 QA pairs and compared four model configurations; the results were positive but still called for broader production validation.

4 supporting quotes
“The v1.1 pipeline with gpt-4-1106-preview generally outperformed other configurations across most metrics.”summary, stated
“The metric analysis revealed that the v1.1 version excelled in Answer Correctness”summary, stated
“the v1.1 pipeline showed superiority in Context Recall, indicating improved ability to retrieve relevant contexts for answering queries.”summary, stated
“Broader production validation would be needed to confirm these improvements generalize across the full range of user queries.”summary, stated