A minimal, notebook-first framework for running reproducible LLM experiments and comparing multiple models over JSONL/CSV datasets.
Project description
๐ llm-lab
A lightweight, notebook-first framework for running reproducible LLM experiments, comparing multiple models, and evaluating custom metrics across JSONL/CSV datasets.
๐ Features
Multi-model evaluation โ compare OpenAI models in one experiment
CSV + JSONL support โ ideal for business analysts & product teams
Custom metrics โ create your own quality checks with a one-line decorator
Reproducible runs โ every run stored in a SQLite database
Built-in comparison tools โ leaderboard, per-run summaries, charts
Notebook-first design โ built to be used directly in Jupyter
๐ฆ Installation
For now (local development):
pip install -e .
PyPI publishing will come later.
๐ Dataset Formats
llm-lab supports:
CSV files
JSONL (one example per line)
JSON lists
Each example must contain:
expected_output โ the reference answer (used by metrics)
Other fields can be anything you want to use inside your prompt.
Example .csv question,context,expected_output "What is 2+2?", "", "4" "Capital of France?", "", "Paris"
๐งช Quickstart from llm_lab import Experiment, run_experiment, compare_models
exp = Experiment( name="qa_eval", dataset_path="data/qa_sample.csv", prompt_template="Q: {question}\nA:", model_names=["gpt-4o-mini", "gpt-3.5-turbo"], metrics=["exact_match"], model_params={"temperature": 0.0}, )
results = run_experiment(exp, max_examples=20)
compare_models(results)
๐ Comparing Models
Leaderboard:
from llm_lab import show_leaderboard show_leaderboard(metric="exact_match")
Detailed run summary:
from llm_lab import summarize_run summarize_run(results[0].run_id)
Plot metric across models:
from llm_lab import plot_model_metric plot_model_metric(results, metric="exact_match")
๐งฉ Custom Metrics
You can add your own metrics easily.
from llm_lab import register_metric
@register_metric def contains_expected(example, output): expected = example["expected_output"].lower() return {"contains_expected": float(expected in output.lower())}
Then include it in your experiment:
metrics=["exact_match", "contains_expected"]
๐งฐ CSV Normalization Utility
Business analysts often have arbitrary column names (Ideal_Answer, target, etc). Use the helper to normalize your raw CSV into an llm-lab-compatible dataset.
from llm_lab import prepare_csv_for_llm_lab
prepare_csv_for_llm_lab( src_path="raw/support_eval_raw.csv", dst_path="data/support_eval.csv", expected_col="Ideal_Answer", )
Now support_eval.csv can be used directly.
๐ Project Structure llm-lab/ โ โโโ data/ โ โโโ qa_sample.csv โโโ notebooks/ โ โโโ 01_quickstart.ipynb โโโ src/ โ โโโ llm_lab/ โ โโโ experiment.py โ โโโ metrics.py โ โโโ model_client.py โ โโโ storage.py โ โโโ utils.py โ โโโ analysis.py โ โโโ init.py โโโ pyproject.toml โโโ README.md
๐ง Philosophy
llm-lab is designed with three principles:
Minimalism โ no boilerplate, no YAML configs, no heavy framework
Reproducibility โ all experiments are logged in SQLite
Accessibility โ analysts and PMs should be able to use it with zero ML background
It aims to be the pytest + scikit-learn of LLM evaluationโ simple, composable, and transparent.
๐ค Contributing
Pull requests are welcome.
For major changes, please open an issue first to discuss what you'd like to change.
๐ License
MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_lab-0.1.0.tar.gz.
File metadata
- Download URL: llm_lab-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8d12fad9c3d494ff785b1c24404b035eede2661ff4ba4425a36cb59e6b8e85d
|
|
| MD5 |
26198b29756d98aad85a52c3cb69cd6c
|
|
| BLAKE2b-256 |
e8609a76aecb87d2401a7bfb6435497f4ca9d1d4ac7be8aa524b6fdd1d2376ca
|
File details
Details for the file llm_lab-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_lab-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68d65b9768c43598a4c085a532171e1adbd6caf7d786d0d70c5552a892904ae5
|
|
| MD5 |
5807396e4c2ef1dd8ef680b6b144ed2c
|
|
| BLAKE2b-256 |
8a77fd274bffd3581f3f5c58e4b170b466449244d0c90575cd3498fa1aef04a0
|