Skip to main content

Kavier: Simulating the Performance, Sustainability, and Efficiency of LLM Ecosystems under Inference and Training

Project description

Kavier

Simulating performance, sustainability, and efficiency of LLM Ecosystems under inference and training.

MIT License Documentation CI


This repository is the home of Kavier, the first scientific instrument for predicting performance, sustainability, and efficiency of LLM ecosystems under inference and training.

Kavier helps operators, researchers, and engineers predict:

  • Performance — inference latencies, training throughput, GPU utilization
  • Sustainability — energy consumption, carbon emissions (gCO2/Mtoken)
  • Efficiency — financial and energy cost per token/sample given GPU-hour prices

Quick start

Kavier is developed with uv. Install uv, then:

git clone https://github.com/atlarge-research/kavier.git
cd kavier

uv sync            # create .venv and install Kavier + dev tools from uv.lock

Run your first simulation against the tiny bundled synthetic example trace:

uv run kavier inference --trace src/kavier/sdk/inference/data/input/input_example.csv

Congrats! You have just run your first simulation with Kavier! 🎉

Kavier is one CLI with four subcommands — inference, training, energy, carbon:

uv run kavier --help
uv run kavier training --help

Or launch the interactive UI and pick a simulator, model and GPU from guided menus, then chain into energy/carbon or export OpenDC:

uv run kavier-ui

The interactive UI is POSIX-only (Linux/macOS — it drives the terminal via termios); on Windows, use the one-shot CLI (kavier inference, kavier training, …) instead.

Both entrypoints are also reachable as modules: python -m kavier (CLI) and python -m kavier.ui.

If you installed Kavier from PyPI (pip install kavier) you have no src/ directory; the same synthetic example trace ships inside the package, so resolve its path via importlib.resources:

TRACE=$(python -c "from importlib.resources import files; print(files('kavier.sdk.inference')/'data/input/input_example.csv')")
kavier inference --trace "$TRACE"

Structure

Kavier is a single importable package, kavier:

src/kavier/
├── cli/              # the unified `kavier` CLI (subcommands: inference/training/energy/carbon)
├── ui/               # the interactive REPL (the `kavier-ui` command)
└── sdk/              # the functionality — one subpackage per domain
    ├── inference/    # per-request inference simulator + the verb facade (facade.py)
    ├── training/     # analytical training model + calibration + the verb facade (facade.py)
    ├── energy/       # GPU power / efficiency
    ├── co2/          # carbon emissions
    ├── io/           # trace I/O + OpenDC export (io/opendc/)
    └── library/      # shared GPU & LLM specifications
tests/                # test suites (run with `uv run pytest`)

The layout is layered:

  • Public verbskavier.inference.performance / energy / efficiency / carbon (and the training equivalents) are the batch predictors; each takes a workload batch (DataFrame, list[dict], or a single dict) and returns the input rows plus predicted columns. kavier.inference / kavier.training are convenience aliases for kavier.sdk.inference / kavier.sdk.training, where the verbs live (in facade.py). import kavier is lazy, so it stays cheap until you touch a verb.
  • Engines — each kavier.sdk.* package holds the actual simulators, calibration, and specs. It's a pure library: all argument parsing lives in kavier.cli (one module per subcommand), which calls into these engines. The unified kavier command dispatches to those cli/ modules.

Development

uv sync (from Quick start) installs the project plus the dev tools (pytest, ruff, mypy). Before pushing, run the same gates CI enforces on every push/PR (.github/workflows/ci.yml):

uv run pytest                 # test suite
uv run ruff check .           # lint
uv run ruff format --check .  # formatting (CI pins ruff==0.15.15; fix with: uv run ruff format .)

# Strict typing is gated incrementally (the full tree is not strict-clean yet):
uv run mypy --strict -p kavier.cli -p kavier.ui -p kavier.sdk.co2
uv run mypy --strict --follow-imports=skip \
  src/kavier/__init__.py src/kavier/__main__.py \
  src/kavier/sdk/training/calibration/__init__.py \
  src/kavier/sdk/training/core/engine.py

Add the calibration extra (uv sync --extra calibration) to run the scipy/scikit-learn calibration-refit tests; without it, test_engine_regen.py and friends importorskip-skip.

A multi-stage Dockerfile and docker-compose.yml are provided for containerized runs (they build a wheel and install it — no source tree, no PYTHONPATH), but Docker is optional — every tutorial and the workflow above use uv:

docker build --target cli -t kavier:cli .   # the unified CLI
docker run --rm kavier:cli inference --help
docker build --target ui -t kavier:ui .     # the interactive REPL
docker run --rm -it kavier:ui

Your first change

A good starter task: add a GPU to the built-in spec library.

  1. Open src/kavier/sdk/library/gpu.pyGPU_SPEC_LIBRARY is a plain dict of GPUSpec entries. Copy an existing entry, tweak the numbers, and make the dict key match the gpu_name field.

  2. Run the library tests — they parametrize over every entry, so your GPU is validated automatically (positive specs, idle_power_w <= max_power_w, key == name, unit conversions):

    uv run pytest tests/test_library
    
  3. Simulate on your new GPU with the bundled example trace:

    uv run kavier inference --gpu "YourGPU" --trace src/kavier/sdk/inference/data/input/input_example.csv
    

Finish with the full gate set above, then open a PR — see the contributing guide.

Documentation

The documentation is a MkDocs (Material) site under docs/. Start reading at docs/content/index.md: getting started, the Kavier CLI (kavier inference, kavier training, kavier energy, kavier carbon) and the kavier-ui interactive UI, the per-component pages (performance, energy, CO2, efficiency, library), and the contributing guide.

Build and serve it locally:

cd docs
pip install -r requirements.txt
mkdocs serve            # live site on http://localhost:8000
mkdocs build            # or emit the static site to docs/site/

Or with Docker (documentation only):

docker build -t kavier-docs docs/
docker run --rm -p 8000:8000 kavier-docs

Contributing

Questions, suggestions and contributions are welcome and appreciated! Please refer to the contributing guide for more details.

License

Kavier is distributed under the MIT license. See LICENSE.txt.

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

kavier-0.5.0.tar.gz (76.4 kB view details)

Uploaded Source

Built Distribution

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

kavier-0.5.0-py3-none-any.whl (104.9 kB view details)

Uploaded Python 3

File details

Details for the file kavier-0.5.0.tar.gz.

File metadata

  • Download URL: kavier-0.5.0.tar.gz
  • Upload date:
  • Size: 76.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kavier-0.5.0.tar.gz
Algorithm Hash digest
SHA256 82945361157664296dac94867e1d72c925b7b8faa4d628c4738acb393c39116e
MD5 a4f69a3b08b3fe197284ca073b2c75f5
BLAKE2b-256 7182e8a6399646660d965873506ef05e4ba7d0788b164a798821b9dcd3658662

See more details on using hashes here.

File details

Details for the file kavier-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: kavier-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 104.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kavier-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47911c80b9b8b4916cbd1f69b4e8a960f0253f669662320b1b119314c5cc6fa2
MD5 87576725e5b2f6ad04e7da1bf50e8456
BLAKE2b-256 49f661a1e5bfbdab2acf45171c9ab94ff956dfb3478076e155e16f8d4b411bce

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