Back to .md Directory

Phase 1.1 Evaluation Framework - Progress Report

Tracks progress building a 100-question golden set and running RAGAS benchmarks for a Buddhist sutra Q&A system.

May 2, 2026
0 downloads
2 views
ai rag prompt eval openai gemini guardrails
View source

What this file does

Tracks progress building a 100-question golden set and running RAGAS benchmarks for a Buddhist sutra Q&A system.

When to use it

  • You need a progress template for a multi-phase evaluation pipeline
  • You are generating a golden test set with LLM and want rate-limit handling patterns
  • You want to document baseline vs. reranker RAG performance targets

Assumes this stack

PythonRAGASGemini 2.0 FlashChromaDBTruLensLangChain

Phase 1.1 Evaluation Framework - Progress Report

Date: 2025-11-08 Status: 🟑 In Progress

Completed Tasks βœ…

1. Evaluation Directory Structure

Created complete evaluation framework at opennotebook/evaluation/:

evaluation/
β”œβ”€β”€ README.md                   # Complete usage documentation
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ PROGRESS.md                 # This file
β”œβ”€β”€ golden_set.json             # Generated Q&A dataset (in progress)
β”œβ”€β”€ golden_set_builder.py       # Gemini-based Q&A generator
β”œβ”€β”€ ragas_evaluator.py          # RAGAS metrics implementation
β”œβ”€β”€ trulens_monitor.py          # TruLens RAG Triad monitor
β”œβ”€β”€ benchmark_suite.py          # End-to-end benchmark runner
└── evaluation_results/         # Output directory (created on first run)

2. Dependencies Installed

βœ… ragas>=0.1.0
βœ… datasets>=2.14.0
βœ… requests>=2.31.0
βœ… loguru>=0.7.0

Note: TruLens is optional (requires OPENAI_API_KEY for evaluation)

3. Golden Set Generation (In Progress)

Script: golden_set_builder.py Target: 100 Q&A pairs from diverse sutras Current Status: ~20/100 questions generated (4 sutras)

Features:

  • Uses Gemini 2.0 Flash Experimental for high-quality generation
  • Generates 5 questions per sutra across 3 categories:
    • Factual (사싀): Direct content questions
    • Interpretive (해석): Meaning and interpretation
    • Practical (μ‹€μ²œ): Practice and application
  • Auto-checkpoint saves progress after each sutra
  • Handles rate limits gracefully
  • Estimated completion time: ~5-10 minutes total

Rate Limit Handling: The script is encountering 429 errors from Gemini API (quota: 300 req/min). This is expected and handled by:

  • 1.5 second delay between requests
  • Continuing with other sutras on failure
  • Auto-saving progress
  • Will complete as quota resets

Next Steps πŸ“‹

Phase 1.1 Remaining

  1. ⏳ Complete Golden Set (ETA: ~10 minutes)

    • Wait for builder to finish 100 Q&A pairs
    • Verify quality and distribution
  2. πŸ”œ Run Baseline Benchmark

    • Ensure RAG server is running
    • Execute benchmark_suite.py
    • Measure current system performance:
      • Context Precision (retrieval accuracy)
      • Context Recall (retrieval completeness)
      • Faithfulness (hallucination detection)
      • Answer Relevancy (response quality)

Phase 1.2 - Reranker Integration

After baseline is established:

  • Install ms-marco-MiniLM-L-12-v2 reranker
  • Integrate with LangChain ContextualCompressionRetriever
  • Re-run benchmark with experiment_name="with_reranker"
  • Compare improvements

Phase 1.3 - Anti-Hallucination Prompt

  • Strengthen prompt with explicit groundedness instructions
  • Add "don't guess" guardrails
  • Measure Faithfulness improvement

System Architecture

Current RAG Pipeline (Baseline)

User Query
    ↓
Vector Search (ChromaDB)
    β”œβ”€ Embedding: bert-ancient-chinese-finetuned
    β”œβ”€ Collection: cbeta_sutras_finetuned (99,723 docs)
    └─ Retrieval: top_k=10 (or 20 with sutra filter)
    ↓
LLM Generation (Gemini 2.0 Flash)
    ↓
Answer + Sources

Phase 1.2 Target Architecture (With Reranker)

User Query
    ↓
Vector Search (ChromaDB) β†’ top_k=20
    ↓
Reranker (MiniLM-L-12-v2) β†’ top_k=10
    β”œβ”€ Filters irrelevant contexts
    └─ Improves precision
    ↓
LLM Generation
    ↓
Answer + Sources (higher quality)

Evaluation Methodology

RAGAS Metrics

Each metric scored 0-1 (higher is better):

  1. Context Precision: Retrieved contexts relevance to question

    • Baseline target: 0.60
    • Phase 1 goal: 0.75 (+25%)
  2. Context Recall: Ground truth coverage in contexts

    • Baseline target: 0.65
    • Phase 1 goal: 0.80 (+23%)
  3. Faithfulness: Answer grounding in contexts (anti-hallucination)

    • Baseline target: 0.80
    • Phase 1 goal: 0.90 (+12%)
  4. Answer Relevancy: Answer relevance to question

    • Baseline target: 0.70
    • Phase 1 goal: 0.85 (+21%)

Benchmark Process

  1. Load golden set (100 Q&A pairs)
  2. Query RAG system for each question
  3. Extract answer + retrieved contexts
  4. Compare with ground truth
  5. Calculate RAGAS metrics
  6. Save results to evaluation_results/

Usage Commands

Check Golden Set Progress

cd evaluation
tail -f ../source_explorer/source_data/golden_set_builder.log
# Or check the file directly:
wc -l golden_set.json

Run Baseline Benchmark (After Golden Set Complete)

# Terminal 1: Ensure server is running
cd /Users/vairocana/Desktop/buddhakorea/buddha-korea-notebook-exp/opennotebook
python main.py

# Terminal 2: Run benchmark
cd evaluation
python benchmark_suite.py

View Results

cd evaluation_results
ls -lt  # List results by modification time
cat benchmark_baseline_v1_*.json | jq '.ragas_scores'

Success Criteria for Phase 1.1

  • βœ… Evaluation framework created
  • βœ… Dependencies installed
  • ⏳ Golden set with 100 Q&A pairs
  • ⏳ Baseline benchmark completed
  • ⏳ All 4 RAGAS metrics measured
  • ⏳ Results saved and documented

Overall Phase 1.1 Completion: ~70%

Known Issues

Rate Limiting (429 Errors)

Impact: Slower golden set generation Workaround: Script auto-retries and continues with other sutras Solution: None needed - will resolve automatically

TruLens Optional

Impact: TruLens monitoring requires OPENAI_API_KEY Workaround: Use RAGAS only for now Solution: Set export OPENAI_API_KEY=xxx if you want TruLens dashboard

Files Created (Phase 1.1)

FileLinesPurpose
golden_set_builder.py270Generate Q&A from CBETA summaries
ragas_evaluator.py170RAGAS evaluation implementation
trulens_monitor.py180TruLens monitoring (optional)
benchmark_suite.py300End-to-end benchmark orchestration
README.md250Complete usage documentation
requirements.txt10Python dependencies
golden_set.json-Generated Q&A dataset

Total New Code: ~1,200 lines Total Documentation: ~500 lines


Updated: 2025-11-08 14:55 KST Next Update: After golden set completion

What's inside

6 sections covering completed tasks, next steps, architecture diagrams, evaluation methodology, usage commands, and success criteria.

Change this for your project

  • Replace opennotebook/evaluation/ with your own evaluation directory path
  • Replace ltk1186/buddhakorea with your repository name
  • Replace /Users/vairocana/Desktop/buddhakorea/buddha-korea-notebook-exp/opennotebook with your project root
  • Replace cbeta_sutras_finetuned with your own ChromaDB collection name

Where it goes

Keep alongside your test suite. Used to define and score model evaluations.

Worth borrowing

  • Auto-checkpoint golden set generation after each sutra to survive rate limits
  • Define explicit baseline targets and improvement goals for each RAGAS metric before running experiments

Related Documents