How harshdubey23/genai-rag-llm-judge works
This repository contains two related LLM applications: a document-grounded RAG service and an LLM-as-judge experiment pipeline, sharing an LLM client and metrics utilities. The RAG workflow ingests documents, chunks and embeds them, stores and retrieves passages, then generates cited answers with refusal gates; evaluation measures retrieval and answer quality. The judge workflow generates or loads answers, scores them with rubric or pairwise judgments, and aggregates experiments. README-described subsystems are included, though some implementation links are omitted where source excerpts do not establish them.
Main entry points: run.py Experiment runner · evaluate.py RAG evaluation · core.py Grounded answering · llm.py LLM client
Components 24
RAG service
- HTTP API
rag/server.py - Ingest CLI
rag/cli.py - Source documents
corpus - Parse and chunk
rag/core.py - Local embeddings
rag/core.py - LanceDB index
rag/core.py - Hybrid retrieval
rag/core.py - Grounded answering
rag/core.py
Judge experiments
- Experiment runner
judge/run.py - Judge suites
judge/suites - Model and rubric configs
judge/configs - Answer generation
judge/run.py - Rubric and pairwise judging
judge/pipeline.py - Experiment reports
results/judge
Shared runtime
- LLM client
common/llm.py - JSON recovery
common/jsonfix.py - Metrics
common/metrics.py
Evaluation and analysis
- RAG evaluation
rag/evaluate.py - Judge negative control
rag/judge_check.py - Cost estimates
rag/cost.py - ANN benchmark
rag/bench.py - RAG questions
eval/rag_questions.jsonl
Other components
- User
- LLM providers
Connections 31
- User → HTTP API: queries
README.md - User → Ingest CLI: starts ingest
README.md - Source documents → Parse and chunk: reads and chunks
README.md - Ingest CLI → Parse and chunk: invokes
rag/cli.py - HTTP API → Parse and chunk: ingests via
rag/server.py - Parse and chunk → Local embeddings: embeds chunks
rag/core.py - Parse and chunk → LanceDB index: writes chunks
rag/core.py - HTTP API → Grounded answering: queries via
rag/server.py - Grounded answering → Hybrid retrieval: retrieves context
README.md - Hybrid retrieval → LanceDB index: searches
README.md - Grounded answering → LLM client: generates answer
rag/core.py - LLM client → LLM providers: routes requests
common/llm.py - Grounded answering → HTTP API: returns citations
rag/server.py - RAG evaluation → Hybrid retrieval: evaluates retrieval
rag/evaluate.py - RAG evaluation → Grounded answering: evaluates answers
README.md - RAG evaluation → RAG questions: loads questions
- RAG evaluation → Metrics: computes metrics
rag/evaluate.py - RAG evaluation → LLM client: requests grading
rag/evaluate.py - Judge negative control → RAG evaluation: reuses judge
rag/judge_check.py - Cost estimates → User: reports estimates
- ANN benchmark → User: reports benchmarks
- User → Experiment runner: runs experiments
README.md - Experiment runner → Judge suites: loads suite
README.md - Experiment runner → Model and rubric configs: loads config
README.md - Experiment runner → Answer generation: dispatches generation
judge/run.py - Answer generation → LLM client: requests answers
judge/run.py - Experiment runner → Rubric and pairwise judging: dispatches judgments
judge/run.py - Rubric and pairwise judging → LLM client: requests verdicts
judge/pipeline.py - Rubric and pairwise judging → JSON recovery: parses responses
judge/pipeline.py - Experiment runner → Metrics: summarizes results
judge/run.py - Experiment runner → Experiment reports: writes reports
README.md