Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_lab-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_lab-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

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

Hashes for llm_lab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e8d12fad9c3d494ff785b1c24404b035eede2661ff4ba4425a36cb59e6b8e85d
MD5 26198b29756d98aad85a52c3cb69cd6c
BLAKE2b-256 e8609a76aecb87d2401a7bfb6435497f4ca9d1d4ac7be8aa524b6fdd1d2376ca

See more details on using hashes here.

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

Hashes for llm_lab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68d65b9768c43598a4c085a532171e1adbd6caf7d786d0d70c5552a892904ae5
MD5 5807396e4c2ef1dd8ef680b6b144ed2c
BLAKE2b-256 8a77fd274bffd3581f3f5c58e4b170b466449244d0c90575cd3498fa1aef04a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page