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.
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 verbs —
kavier.inference.performance / energy / efficiency / carbon(and the training equivalents) are the batch predictors; each takes a workload batch (DataFrame,list[dict], or a singledict) and returns the input rows plus predicted columns.kavier.inference/kavier.trainingare convenience aliases forkavier.sdk.inference/kavier.sdk.training, where the verbs live (infacade.py).import kavieris 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 inkavier.cli(one module per subcommand), which calls into these engines. The unifiedkaviercommand dispatches to thosecli/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.
-
Open src/kavier/sdk/library/gpu.py —
GPU_SPEC_LIBRARYis a plain dict ofGPUSpecentries. Copy an existing entry, tweak the numbers, and make the dict key match thegpu_namefield. -
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
-
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
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 kavier-0.5.0.1.tar.gz.
File metadata
- Download URL: kavier-0.5.0.1.tar.gz
- Upload date:
- Size: 76.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc2051dc9453ac3dcded52002a3965ed79d5545300aca87eee4ecb600877f050
|
|
| MD5 |
af1ec1ed4fe523b51a87fd95f1fbb9bd
|
|
| BLAKE2b-256 |
c6fae1fec65851b285303f3a9a0d2e82fcaaf6e33a6e52c3b6894976f497c4a7
|
File details
Details for the file kavier-0.5.0.1-py3-none-any.whl.
File metadata
- Download URL: kavier-0.5.0.1-py3-none-any.whl
- Upload date:
- Size: 104.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a981f76362a5b591d1860b08f185e0adbea63f89f836777a43bbb8bee0128a
|
|
| MD5 |
0f6fa0edaeeaadd5029b1d5e77281e6e
|
|
| BLAKE2b-256 |
15fbcf2faf701dd09cb26554ec33afba66e280f8c42ef0c9941e25c08cf5734f
|