LLMEvalGraph is a modular evaluation framework built using
LangChain, LangGraph, and LangSmith β designed to benchmark and compare Large Language Models (LLMs) across any dataset or domain.
It provides a structured, reproducible pipeline for:
- Comparing base and fine-tuned models (e.g., GPT-4o-mini vs Mistral-7B)
- Evaluating on any public or custom dataset (e.g., PubMedQA, LegalBench, FinanceQA)
- Logging, tracing, and analyzing every step through LangSmith
- Defining consistent metrics (accuracy, structure, latency, etc.)
- Visualizing and exporting results for research or production monitoring
β
Model-agnostic β swap any model or provider (OpenAI, Mistral, Anthropic, etc.)
β
Dataset-agnostic β plug in any JSONL dataset with input + reference fields
β
LangGraph Orchestration β manage nodes, retries, validation, and state
β
LangSmith Observability β trace every run, compare versions, run evaluations
β
Fully reproducible β consistent Makefile + environment setup for experiments
LLMEvalGraph/
ββ data/
β ββ raw/ # put your dataset here
β ββ processed/ # generated dev/test JSONL splits
ββ src/
β ββ prep_dataset.py # convert raw data into processed splits
β ββ run_eval.py # main entry for evaluation
β ββ runnables.py # model wrappers (OpenAI, Mistral, etc.)
β ββ graph.py # LangGraph orchestration logic
β ββ evaluators.py # metric calculations
β ββ compare_results.py# merges results into markdown/csv
β ββ utils.py # helper functions
ββ results/ # output JSONs and summary tables
ββ requirements.txt
ββ Makefile
ββ README.md
git clone https://github.com/propardhu/LLMEvalGraph
cd LLMEvalGraph
# create virtual environment
python -m venv .venv
source .venv/bin/activate # (Windows: .venv\Scripts\activate)
# install dependencies
pip install -r requirements.txt
# setup environment
cp .env.example .envOpen .env and paste your API keys:
OPENAI_API_KEY=sk-...
MISTRAL_API_KEY=app-...
LANGSMITH_API_KEY=lsm-...
LANGSMITH_TRACING=true
LANGSMITH_PROJECT=llm-evalgraph
Place your raw PubMedQA files:
data/raw/ori_pqal.json
data/raw/test_ground_truth.json # optional (for fixed test set)
Then run one of the following:
A) Fixed test (recommended):
make prep-pubmedqa-fixedtestB) Random split:
make prep-pubmedqaYouβll get:
data/processed/dev.jsonl
data/processed/test.jsonl
Development runs (small split for testing):
make dev-openai
make dev-mistralFull test runs:
make test-openai
make test-mistralResults will be saved in:
results/dev_openai.json
results/dev_mistral.json
results/test_openai.json
results/test_mistral.json
Combine all metrics into one table:
make compareThis generates:
results/summary.md
results/summary.csv
The Markdown version can be directly pasted into your Medium article or documentation.
Default models are defined in the Makefile:
OPENAI_MODEL ?= gpt-4o-mini
MISTRAL_MODEL ?= open-mistral-7b
You can override them at runtime:
make dev-mistral MISTRAL_MODEL=mistral-small-latest
make dev-openai OPENAI_MODEL=gpt-4o-mini
β οΈ If you seeInvalid model: mistral-7b, useopen-mistral-7bor one of the hosted versions likemistral-small-latest.
| Metric | Description |
|---|---|
| accuracy | % of answers matching the gold label (yes/no/maybe) |
| structure | % of responses following the required output format |
| citation_rate | % of outputs containing URLs or references |
| latency_s_per_item | Average time (in seconds) to generate each answer |
| Problem | Fix |
|---|---|
Empty dev/test.jsonl |
Ensure your raw dataset is a JSON dict with PMIDs and CONTEXTS fields |
Invalid model error |
Use open-mistral-7b instead of mistral-7b |
| Authentication error | Double-check your .env keys |
| Windows βmake not foundβ | Use WSL (sudo apt install make) or run commands manually |
- New dataset: add a file like
my_dataset_adapter.pyinsrc/datasets/ - New model: register it in
src/runnables.pyand the Makefile - New metrics: define in
src/evaluators.pyand include in the comparison step
π GitHub: https://github.com/propardhu/LLMEvalGraph
LLMEvalGraph aims to make LLM benchmarking simple, consistent, and transparent β
so you can focus on insights, not setup.