unalloc 0.2.3__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unalloc-0.2.3 → unalloc-0.3.1}/CHANGELOG.md +24 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/PKG-INFO +66 -10
- {unalloc-0.2.3 → unalloc-0.3.1}/README.md +65 -9
- {unalloc-0.2.3 → unalloc-0.3.1}/pyproject.toml +1 -1
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/__init__.py +1 -1
- unalloc-0.3.1/src/unalloc/cli.py +415 -0
- unalloc-0.3.1/src/unalloc/core/provenance.py +103 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/sources/anthropic.py +2 -2
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/sources/base.py +10 -2
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/sources/litellm.py +2 -2
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/sources/openai.py +2 -2
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/sources/opencost.py +2 -2
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_docs_build.py +5 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_fetch.py +40 -0
- unalloc-0.3.1/tests/test_provenance.py +157 -0
- unalloc-0.2.3/src/unalloc/cli.py +0 -252
- {unalloc-0.2.3 → unalloc-0.3.1}/.gitignore +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/LICENSE +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/core/__init__.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/core/attribute.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/core/models.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/core/normalize.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/core/reconcile.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/fixtures/anthropic_cost_report.json +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/fixtures/litellm_spend.json +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/fixtures/openai_costs.json +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/fixtures/opencost_allocation.json +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/render/__init__.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/render/table.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/src/unalloc/sources/__init__.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_attribute.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_cli.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_normalize.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_paper_lint.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_paper_numbers.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_reconcile.py +0 -0
- {unalloc-0.2.3 → unalloc-0.3.1}/tests/test_sources.py +0 -0
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1 — 2026-10-05
|
|
4
|
+
|
|
5
|
+
### Documentation
|
|
6
|
+
- Prominent source-overlap warning: the CLI defaults to all four sources and appends normalized rows without automatic economic deduplication. Source selection must account for both coverage and overlap.
|
|
7
|
+
- Research summaries describe disagreement between allocation rules rather than established overcharging or mispricing. GPU queue claims are limited to no waiting observed at about 0.5-second telemetry sampling.
|
|
8
|
+
- Synthetic billing and illustrative allocation pools, and the one-GPU/model/run-per-load limits, are explicit.
|
|
9
|
+
|
|
10
|
+
Accounting behavior and source defaults are unchanged. This patch includes the corrected README in package metadata and distributions; provenance reports version 0.3.1.
|
|
11
|
+
|
|
12
|
+
## 0.3.0 — 2026-10-04
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `report --json` carries a `provenance` block: unalloc version, window (live runs), alias-table digest, one entry per requested source with its status, payload SHA-256, byte count and row count, and a digest of the result body.
|
|
16
|
+
- `report --keep-inputs DIR` writes the exact payloads the run parsed, named like the bundled fixtures, so the run can be replayed without the network.
|
|
17
|
+
- `unalloc verify RESULT --inputs DIR` rebuilds a report from retained inputs. Exit 0 when it reproduces; 3 when an input is missing or its bytes changed at the same path; 4 when the inputs match but the result does not, naming a version or alias-table change; 5 when the recorded result does not conserve its own total.
|
|
18
|
+
- Every command warns on stderr when the ledger is partial, naming each source that failed or had no input.
|
|
19
|
+
- `Source.fetch_payload()` returns the raw provider payload; `fetch()` is now `parse(fetch_payload())` on the base class.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- A failed live source was printed to stderr and then dropped, so `report --json` gave no sign that its percentage covered only some sources. It is now recorded as `failed` in the provenance block.
|
|
23
|
+
- With `--fixtures` and a missing fixture file, the "skipping" notice went to stdout and made `report --json` output invalid JSON. It goes to stderr.
|
|
24
|
+
|
|
25
|
+
Attribution results are unchanged: every fixture report from 0.2.3 reproduces exactly.
|
|
26
|
+
|
|
3
27
|
## 0.2.3 — 2026-09-21
|
|
4
28
|
|
|
5
29
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: unalloc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Find the AI spend nobody owns. Joins OpenCost allocation data with LLM provider bills and reports what's unattributed.
|
|
5
5
|
Project-URL: Homepage, https://github.com/timurista/unalloc
|
|
6
6
|
Project-URL: Issues, https://github.com/timurista/unalloc/issues
|
|
@@ -47,14 +47,16 @@ Description-Content-Type: text/markdown
|
|
|
47
47
|
[](https://github.com/timurista/unalloc/actions/workflows/ci.yml)
|
|
48
48
|
[](https://github.com/timurista/unalloc/blob/main/LICENSE)
|
|
49
49
|
[](https://github.com/timurista/unalloc/blob/main/pyproject.toml)
|
|
50
|
-
[](https://arxiv.org/abs/2609.24991)
|
|
51
51
|
[](https://timurista.github.io/unalloc/explorer.html)
|
|
52
52
|
[](https://doi.org/10.5281/zenodo.22761012)
|
|
53
53
|
|
|
54
|
-
**Project site: [timurista.github.io/unalloc](https://timurista.github.io/unalloc/)**, with the findings, case studies, [paper (
|
|
54
|
+
**Project site: [timurista.github.io/unalloc](https://timurista.github.io/unalloc/)**, with the findings, case studies, [paper (arXiv:2609.24991)](https://arxiv.org/abs/2609.24991), [blog post](https://timurista.github.io/unalloc/blog/who-pays-for-the-kv-cache.html), [GPU addendum](https://timurista.github.io/unalloc/blog/gpu-validation.html) and [ledger explorer](https://timurista.github.io/unalloc/explorer.html).
|
|
55
55
|
|
|
56
56
|
OpenCost tells you what your Kubernetes workloads cost. Your provider dashboard tells you what your OpenAI and Anthropic calls cost. Getting both into one view is possible today — OpenCost has an OpenAI plugin — but the answer still depends on a join nobody checks: the same dollar can arrive through both your gateway and your provider bill, and the labels that say who owns it are set per workload, not per pod template. `unalloc` pulls all four sources into one normalized ledger, joins them on a label dimension you choose, and reports the number your finance team keeps asking for: how much of this month's AI spend can't be attributed to any team — and how much of the rest was only rescued by a fallback key.
|
|
57
57
|
|
|
58
|
+
> **Avoid double counting before interpreting totals.** By default, the CLI requests all four sources: OpenCost, LiteLLM, OpenAI and Anthropic. It appends their normalized `CostRow`s into one ledger; it does **not** automatically deduplicate the same economic spend across sources. Gateway charges can also appear in provider bills (or OpenCost plugin output). Choose non-overlapping sources for your setup. For traffic fully covered by LiteLLM, use `--source opencost --source litellm` only if OpenCost excludes those same provider charges. Direct-provider-only traffic needs a separate coverage plan. Fixture totals below are synthetic demonstrations, not validated unique spend.
|
|
59
|
+
|
|
58
60
|
## The output
|
|
59
61
|
|
|
60
62
|
```
|
|
@@ -165,7 +167,45 @@ Configure sources by environment variable:
|
|
|
165
167
|
| `ANTHROPIC_ADMIN_KEY` | Anthropic org admin key (cost report endpoint, sent as `x-api-key`) |
|
|
166
168
|
| `UNALLOC_OPENAI_URL`, `UNALLOC_ANTHROPIC_URL` | Optional overrides for the public API roots, e.g. a proxy |
|
|
167
169
|
|
|
168
|
-
Restrict the run with `--source` to avoid double counting: if
|
|
170
|
+
Restrict the run with `--source` to avoid double counting: if LiteLLM covers all provider traffic and OpenCost excludes overlapping provider charges, use `--source opencost --source litellm` and skip the direct provider adapters. Confirm coverage and overlap for your setup. The [end-to-end case study](#case-studies-and-paper) demonstrates the resulting double count with synthetic billing and invoices; it does not measure customer savings.
|
|
171
|
+
|
|
172
|
+
The case-study invoices and monthly cost pools are synthetic or illustrative. The GPU result covers one H100, one model and one two-minute run per load; waiting-request telemetry was sampled about every 0.5 seconds. Allocation-rule disagreement does not establish a uniquely correct charge or production savings.
|
|
173
|
+
|
|
174
|
+
## Reproducing a result
|
|
175
|
+
|
|
176
|
+
A percentage that ends up in a finance deck will be questioned later, after the
|
|
177
|
+
source data has moved on. A path is not enough to answer that: a fixture or an
|
|
178
|
+
export can be rewritten under the same name, and a live billing API answers a
|
|
179
|
+
re-run with today's data. So `report --json` carries a `provenance` block, and
|
|
180
|
+
`--keep-inputs` retains the exact payloads it parsed:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
unalloc report -D team --json --keep-inputs runs/2026-09/ > runs/2026-09.json
|
|
184
|
+
unalloc verify runs/2026-09.json --inputs runs/2026-09/
|
|
185
|
+
# reproduced: 73.5% unallocated of $66,630.38, result sha256:…
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The provenance block records the unalloc version, the window (live runs only;
|
|
189
|
+
fixtures carry their own dates), a digest of the label alias table, and one
|
|
190
|
+
entry per requested source: its status, the SHA-256 of the payload bytes, and
|
|
191
|
+
the rows it produced. A source that failed or had no input is recorded as
|
|
192
|
+
`failed` or `missing` rather than dropped, and every command warns on stderr
|
|
193
|
+
when the ledger is partial, because the percentage then covers the loaded
|
|
194
|
+
sources only.
|
|
195
|
+
|
|
196
|
+
`verify` exits with a code that says which boundary moved:
|
|
197
|
+
|
|
198
|
+
| Exit | Meaning |
|
|
199
|
+
| --- | --- |
|
|
200
|
+
| 0 | Reproduced: same inputs, same result digest |
|
|
201
|
+
| 3 | Cannot reconstruct: a retained input is missing, or its bytes changed |
|
|
202
|
+
| 4 | Inputs match but the result differs: a rule or the tool changed in between |
|
|
203
|
+
| 5 | The recorded result does not conserve its own total (a dollar counted twice or dropped) |
|
|
204
|
+
|
|
205
|
+
A digest proves byte identity, not correctness. It cannot tell you a meter was
|
|
206
|
+
accurate or a rule was fair, and it can only rebuild a result when the bytes
|
|
207
|
+
it names were kept. Retained payloads contain your billing data; store them
|
|
208
|
+
like the invoices they came from.
|
|
169
209
|
|
|
170
210
|
## How it works
|
|
171
211
|
|
|
@@ -193,16 +233,16 @@ Two design choices worth calling out:
|
|
|
193
233
|
|
|
194
234
|
## Case studies and paper
|
|
195
235
|
|
|
196
|
-
Six studies push real (or realistically simulated) inference workloads through unalloc's own adapters, including a run with vLLM on an NVIDIA H100. They exposed nine defects in the tool along the way, all fixed with regression tests, and they're written up as a paper: **[paper/unalloc-case-studies.pdf](https://github.com/timurista/unalloc/blob/main/paper/unalloc-case-studies.pdf)
|
|
236
|
+
Six studies push real (or realistically simulated) inference workloads through unalloc's own adapters, including a run with vLLM on an NVIDIA H100. They exposed nine defects in the tool along the way, all fixed with regression tests, and they're written up as a paper: **[Who Pays for the KV Cache? (arXiv:2609.24991)](https://arxiv.org/abs/2609.24991)**, a preprint that has not been peer reviewed. The PDF built from this repository is at [paper/unalloc-case-studies.pdf](https://github.com/timurista/unalloc/blob/main/paper/unalloc-case-studies.pdf). For the readable version, see the [blog post](https://timurista.github.io/unalloc/blog/who-pays-for-the-kv-cache.html) and the [GPU addendum](https://timurista.github.io/unalloc/blog/gpu-validation.html) on the [project site](https://timurista.github.io/unalloc/).
|
|
197
237
|
|
|
198
238
|
| Study | What runs | Headline |
|
|
199
239
|
| --- | --- | --- |
|
|
200
240
|
| [`kv_cache`](https://github.com/timurista/unalloc/blob/main/case_studies/kv_cache) | Discrete-event vLLM-style engine: paged KV blocks, prefix caching, continuous batching, preemption | Step-time metering shows ~0% idle once any request is in flight; KV-memory metering leaves a large share of the bill unowned |
|
|
201
|
-
| [`torch_kv`](https://github.com/timurista/unalloc/blob/main/case_studies/torch_kv) | A from-scratch PyTorch decoder with a real KV cache serving a 4-tenant trace |
|
|
241
|
+
| [`torch_kv`](https://github.com/timurista/unalloc/blob/main/case_studies/torch_kv) | A from-scratch PyTorch decoder with a real KV cache serving a 4-tenant trace | Token and measured-compute allocation rules differ by 33 points for a RAG tenant ($5.7K of an illustrative monthly pool) |
|
|
202
242
|
| [`distributed`](https://github.com/timurista/unalloc/blob/main/case_studies/distributed) | Tensor and pipeline parallel on `torch.distributed` (gloo), verified against a single-process reference | Owner label on LeaderWorkerSet leaders only: 66% unallocated; falling back to `name` "fixes" it by sending 61% to a Helm chart name |
|
|
203
243
|
| [`hybrid_e2e`](https://github.com/timurista/unalloc/blob/main/case_studies/hybrid_e2e) | The real CLI as a subprocess against live mock OpenCost / LiteLLM / OpenAI / Anthropic APIs (Postgres-backed LiteLLM in the dev container) | Enabling every source double counts $11.8K; reading only page one of the billing APIs reports 25% of spend |
|
|
204
244
|
| [`use_cases`](https://github.com/timurista/unalloc/blob/main/case_studies/use_cases) | Labeling Pareto, per-feature unit economics, self-host break-even, CI budget gate | Three label fixes take a 67%-unallocated org under 10% |
|
|
205
|
-
| [`gpu_validation`](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation) | Real vLLM 0.29 serving Qwen2.5-7B on a DigitalOcean H100, driven with the simulator's tenants ([runbook](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation/RUNBOOK.md), [evidence](https://github.com/timurista/unalloc/tree/main/case_studies/results/gpu_validation/evidence)) | Token
|
|
245
|
+
| [`gpu_validation`](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation) | Real vLLM 0.29 serving Qwen2.5-7B on a DigitalOcean H100, driven with the simulator's tenants ([runbook](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation/RUNBOOK.md), [evidence](https://github.com/timurista/unalloc/tree/main/case_studies/results/gpu_validation/evidence)) | Token and equal time-share allocation rules differ by 12–14 points for search; GPU "utilization" reads 97% at 2 req/s and 99% at 16 req/s |
|
|
206
246
|
|
|
207
247
|
```bash
|
|
208
248
|
make research # build ./.venv-research: CPU torch, notebook tooling, typst
|
|
@@ -245,6 +285,7 @@ What `unalloc` does is narrower: read all four sources yourself — OpenCost, a
|
|
|
245
285
|
- [ ] Per-feature unit economics using the `quantity`/`unit` fields already carried on `CostRow`
|
|
246
286
|
- [ ] Azure OpenAI and Bedrock adapters
|
|
247
287
|
- [x] `--budget` mode: exit non-zero when unallocated share crosses a threshold, for CI
|
|
288
|
+
- [x] Result provenance and `unalloc verify`: rebuild an earlier report from retained inputs, or say why it can't be
|
|
248
289
|
- [ ] `--exclude label=value` on a source, so gateway traffic can be dropped from provider billing instead of whole sources
|
|
249
290
|
- [ ] Warn when distinct raw label keys collide on one canonical key
|
|
250
291
|
|
|
@@ -259,16 +300,31 @@ ruff check . && pytest
|
|
|
259
300
|
|
|
260
301
|
## Citing
|
|
261
302
|
|
|
262
|
-
If you use
|
|
303
|
+
If you use the findings, please cite the paper, a preprint on arXiv ([arXiv:2609.24991](https://arxiv.org/abs/2609.24991), cs.DC):
|
|
304
|
+
|
|
305
|
+
```bibtex
|
|
306
|
+
@misc{urista_kvcache_2026,
|
|
307
|
+
author = {Urista, Timothy},
|
|
308
|
+
title = {Who Pays for the {KV} Cache? Attributing Shared {AI} Inference Spend Across {Kubernetes} and {LLM} Provider Bills},
|
|
309
|
+
year = {2026},
|
|
310
|
+
eprint = {2609.24991},
|
|
311
|
+
archivePrefix = {arXiv},
|
|
312
|
+
primaryClass = {cs.DC},
|
|
313
|
+
doi = {10.48550/arXiv.2609.24991},
|
|
314
|
+
url = {https://arxiv.org/abs/2609.24991}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
If you use the software itself, cite the archived release. GitHub's "Cite this repository" button produces the same entry from [`CITATION.cff`](https://github.com/timurista/unalloc/blob/main/CITATION.cff).
|
|
263
319
|
|
|
264
|
-
- **All versions:** [doi:10.5281/zenodo.22761012](https://doi.org/10.5281/zenodo.22761012), which always resolves to the latest release — currently 0.2.3
|
|
320
|
+
- **All versions:** [doi:10.5281/zenodo.22761012](https://doi.org/10.5281/zenodo.22761012), which always resolves to the latest release — currently 0.3.0. The paper describes 0.2.3; 0.3.0 adds result provenance and `unalloc verify` and changes no attribution result
|
|
265
321
|
- **Version 0.2.1:** [doi:10.5281/zenodo.22761013](https://doi.org/10.5281/zenodo.22761013)
|
|
266
322
|
|
|
267
323
|
```bibtex
|
|
268
324
|
@software{urista_unalloc_2026,
|
|
269
325
|
author = {Urista, Timothy},
|
|
270
326
|
title = {unalloc: find the AI spend nobody owns},
|
|
271
|
-
version = {0.
|
|
327
|
+
version = {0.3.0},
|
|
272
328
|
year = {2026},
|
|
273
329
|
doi = {10.5281/zenodo.22761012},
|
|
274
330
|
url = {https://github.com/timurista/unalloc}
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
[](https://github.com/timurista/unalloc/actions/workflows/ci.yml)
|
|
6
6
|
[](https://github.com/timurista/unalloc/blob/main/LICENSE)
|
|
7
7
|
[](https://github.com/timurista/unalloc/blob/main/pyproject.toml)
|
|
8
|
-
[](https://arxiv.org/abs/2609.24991)
|
|
9
9
|
[](https://timurista.github.io/unalloc/explorer.html)
|
|
10
10
|
[](https://doi.org/10.5281/zenodo.22761012)
|
|
11
11
|
|
|
12
|
-
**Project site: [timurista.github.io/unalloc](https://timurista.github.io/unalloc/)**, with the findings, case studies, [paper (
|
|
12
|
+
**Project site: [timurista.github.io/unalloc](https://timurista.github.io/unalloc/)**, with the findings, case studies, [paper (arXiv:2609.24991)](https://arxiv.org/abs/2609.24991), [blog post](https://timurista.github.io/unalloc/blog/who-pays-for-the-kv-cache.html), [GPU addendum](https://timurista.github.io/unalloc/blog/gpu-validation.html) and [ledger explorer](https://timurista.github.io/unalloc/explorer.html).
|
|
13
13
|
|
|
14
14
|
OpenCost tells you what your Kubernetes workloads cost. Your provider dashboard tells you what your OpenAI and Anthropic calls cost. Getting both into one view is possible today — OpenCost has an OpenAI plugin — but the answer still depends on a join nobody checks: the same dollar can arrive through both your gateway and your provider bill, and the labels that say who owns it are set per workload, not per pod template. `unalloc` pulls all four sources into one normalized ledger, joins them on a label dimension you choose, and reports the number your finance team keeps asking for: how much of this month's AI spend can't be attributed to any team — and how much of the rest was only rescued by a fallback key.
|
|
15
15
|
|
|
16
|
+
> **Avoid double counting before interpreting totals.** By default, the CLI requests all four sources: OpenCost, LiteLLM, OpenAI and Anthropic. It appends their normalized `CostRow`s into one ledger; it does **not** automatically deduplicate the same economic spend across sources. Gateway charges can also appear in provider bills (or OpenCost plugin output). Choose non-overlapping sources for your setup. For traffic fully covered by LiteLLM, use `--source opencost --source litellm` only if OpenCost excludes those same provider charges. Direct-provider-only traffic needs a separate coverage plan. Fixture totals below are synthetic demonstrations, not validated unique spend.
|
|
17
|
+
|
|
16
18
|
## The output
|
|
17
19
|
|
|
18
20
|
```
|
|
@@ -123,7 +125,45 @@ Configure sources by environment variable:
|
|
|
123
125
|
| `ANTHROPIC_ADMIN_KEY` | Anthropic org admin key (cost report endpoint, sent as `x-api-key`) |
|
|
124
126
|
| `UNALLOC_OPENAI_URL`, `UNALLOC_ANTHROPIC_URL` | Optional overrides for the public API roots, e.g. a proxy |
|
|
125
127
|
|
|
126
|
-
Restrict the run with `--source` to avoid double counting: if
|
|
128
|
+
Restrict the run with `--source` to avoid double counting: if LiteLLM covers all provider traffic and OpenCost excludes overlapping provider charges, use `--source opencost --source litellm` and skip the direct provider adapters. Confirm coverage and overlap for your setup. The [end-to-end case study](#case-studies-and-paper) demonstrates the resulting double count with synthetic billing and invoices; it does not measure customer savings.
|
|
129
|
+
|
|
130
|
+
The case-study invoices and monthly cost pools are synthetic or illustrative. The GPU result covers one H100, one model and one two-minute run per load; waiting-request telemetry was sampled about every 0.5 seconds. Allocation-rule disagreement does not establish a uniquely correct charge or production savings.
|
|
131
|
+
|
|
132
|
+
## Reproducing a result
|
|
133
|
+
|
|
134
|
+
A percentage that ends up in a finance deck will be questioned later, after the
|
|
135
|
+
source data has moved on. A path is not enough to answer that: a fixture or an
|
|
136
|
+
export can be rewritten under the same name, and a live billing API answers a
|
|
137
|
+
re-run with today's data. So `report --json` carries a `provenance` block, and
|
|
138
|
+
`--keep-inputs` retains the exact payloads it parsed:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
unalloc report -D team --json --keep-inputs runs/2026-09/ > runs/2026-09.json
|
|
142
|
+
unalloc verify runs/2026-09.json --inputs runs/2026-09/
|
|
143
|
+
# reproduced: 73.5% unallocated of $66,630.38, result sha256:…
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The provenance block records the unalloc version, the window (live runs only;
|
|
147
|
+
fixtures carry their own dates), a digest of the label alias table, and one
|
|
148
|
+
entry per requested source: its status, the SHA-256 of the payload bytes, and
|
|
149
|
+
the rows it produced. A source that failed or had no input is recorded as
|
|
150
|
+
`failed` or `missing` rather than dropped, and every command warns on stderr
|
|
151
|
+
when the ledger is partial, because the percentage then covers the loaded
|
|
152
|
+
sources only.
|
|
153
|
+
|
|
154
|
+
`verify` exits with a code that says which boundary moved:
|
|
155
|
+
|
|
156
|
+
| Exit | Meaning |
|
|
157
|
+
| --- | --- |
|
|
158
|
+
| 0 | Reproduced: same inputs, same result digest |
|
|
159
|
+
| 3 | Cannot reconstruct: a retained input is missing, or its bytes changed |
|
|
160
|
+
| 4 | Inputs match but the result differs: a rule or the tool changed in between |
|
|
161
|
+
| 5 | The recorded result does not conserve its own total (a dollar counted twice or dropped) |
|
|
162
|
+
|
|
163
|
+
A digest proves byte identity, not correctness. It cannot tell you a meter was
|
|
164
|
+
accurate or a rule was fair, and it can only rebuild a result when the bytes
|
|
165
|
+
it names were kept. Retained payloads contain your billing data; store them
|
|
166
|
+
like the invoices they came from.
|
|
127
167
|
|
|
128
168
|
## How it works
|
|
129
169
|
|
|
@@ -151,16 +191,16 @@ Two design choices worth calling out:
|
|
|
151
191
|
|
|
152
192
|
## Case studies and paper
|
|
153
193
|
|
|
154
|
-
Six studies push real (or realistically simulated) inference workloads through unalloc's own adapters, including a run with vLLM on an NVIDIA H100. They exposed nine defects in the tool along the way, all fixed with regression tests, and they're written up as a paper: **[paper/unalloc-case-studies.pdf](https://github.com/timurista/unalloc/blob/main/paper/unalloc-case-studies.pdf)
|
|
194
|
+
Six studies push real (or realistically simulated) inference workloads through unalloc's own adapters, including a run with vLLM on an NVIDIA H100. They exposed nine defects in the tool along the way, all fixed with regression tests, and they're written up as a paper: **[Who Pays for the KV Cache? (arXiv:2609.24991)](https://arxiv.org/abs/2609.24991)**, a preprint that has not been peer reviewed. The PDF built from this repository is at [paper/unalloc-case-studies.pdf](https://github.com/timurista/unalloc/blob/main/paper/unalloc-case-studies.pdf). For the readable version, see the [blog post](https://timurista.github.io/unalloc/blog/who-pays-for-the-kv-cache.html) and the [GPU addendum](https://timurista.github.io/unalloc/blog/gpu-validation.html) on the [project site](https://timurista.github.io/unalloc/).
|
|
155
195
|
|
|
156
196
|
| Study | What runs | Headline |
|
|
157
197
|
| --- | --- | --- |
|
|
158
198
|
| [`kv_cache`](https://github.com/timurista/unalloc/blob/main/case_studies/kv_cache) | Discrete-event vLLM-style engine: paged KV blocks, prefix caching, continuous batching, preemption | Step-time metering shows ~0% idle once any request is in flight; KV-memory metering leaves a large share of the bill unowned |
|
|
159
|
-
| [`torch_kv`](https://github.com/timurista/unalloc/blob/main/case_studies/torch_kv) | A from-scratch PyTorch decoder with a real KV cache serving a 4-tenant trace |
|
|
199
|
+
| [`torch_kv`](https://github.com/timurista/unalloc/blob/main/case_studies/torch_kv) | A from-scratch PyTorch decoder with a real KV cache serving a 4-tenant trace | Token and measured-compute allocation rules differ by 33 points for a RAG tenant ($5.7K of an illustrative monthly pool) |
|
|
160
200
|
| [`distributed`](https://github.com/timurista/unalloc/blob/main/case_studies/distributed) | Tensor and pipeline parallel on `torch.distributed` (gloo), verified against a single-process reference | Owner label on LeaderWorkerSet leaders only: 66% unallocated; falling back to `name` "fixes" it by sending 61% to a Helm chart name |
|
|
161
201
|
| [`hybrid_e2e`](https://github.com/timurista/unalloc/blob/main/case_studies/hybrid_e2e) | The real CLI as a subprocess against live mock OpenCost / LiteLLM / OpenAI / Anthropic APIs (Postgres-backed LiteLLM in the dev container) | Enabling every source double counts $11.8K; reading only page one of the billing APIs reports 25% of spend |
|
|
162
202
|
| [`use_cases`](https://github.com/timurista/unalloc/blob/main/case_studies/use_cases) | Labeling Pareto, per-feature unit economics, self-host break-even, CI budget gate | Three label fixes take a 67%-unallocated org under 10% |
|
|
163
|
-
| [`gpu_validation`](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation) | Real vLLM 0.29 serving Qwen2.5-7B on a DigitalOcean H100, driven with the simulator's tenants ([runbook](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation/RUNBOOK.md), [evidence](https://github.com/timurista/unalloc/tree/main/case_studies/results/gpu_validation/evidence)) | Token
|
|
203
|
+
| [`gpu_validation`](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation) | Real vLLM 0.29 serving Qwen2.5-7B on a DigitalOcean H100, driven with the simulator's tenants ([runbook](https://github.com/timurista/unalloc/blob/main/case_studies/gpu_validation/RUNBOOK.md), [evidence](https://github.com/timurista/unalloc/tree/main/case_studies/results/gpu_validation/evidence)) | Token and equal time-share allocation rules differ by 12–14 points for search; GPU "utilization" reads 97% at 2 req/s and 99% at 16 req/s |
|
|
164
204
|
|
|
165
205
|
```bash
|
|
166
206
|
make research # build ./.venv-research: CPU torch, notebook tooling, typst
|
|
@@ -203,6 +243,7 @@ What `unalloc` does is narrower: read all four sources yourself — OpenCost, a
|
|
|
203
243
|
- [ ] Per-feature unit economics using the `quantity`/`unit` fields already carried on `CostRow`
|
|
204
244
|
- [ ] Azure OpenAI and Bedrock adapters
|
|
205
245
|
- [x] `--budget` mode: exit non-zero when unallocated share crosses a threshold, for CI
|
|
246
|
+
- [x] Result provenance and `unalloc verify`: rebuild an earlier report from retained inputs, or say why it can't be
|
|
206
247
|
- [ ] `--exclude label=value` on a source, so gateway traffic can be dropped from provider billing instead of whole sources
|
|
207
248
|
- [ ] Warn when distinct raw label keys collide on one canonical key
|
|
208
249
|
|
|
@@ -217,16 +258,31 @@ ruff check . && pytest
|
|
|
217
258
|
|
|
218
259
|
## Citing
|
|
219
260
|
|
|
220
|
-
If you use
|
|
261
|
+
If you use the findings, please cite the paper, a preprint on arXiv ([arXiv:2609.24991](https://arxiv.org/abs/2609.24991), cs.DC):
|
|
262
|
+
|
|
263
|
+
```bibtex
|
|
264
|
+
@misc{urista_kvcache_2026,
|
|
265
|
+
author = {Urista, Timothy},
|
|
266
|
+
title = {Who Pays for the {KV} Cache? Attributing Shared {AI} Inference Spend Across {Kubernetes} and {LLM} Provider Bills},
|
|
267
|
+
year = {2026},
|
|
268
|
+
eprint = {2609.24991},
|
|
269
|
+
archivePrefix = {arXiv},
|
|
270
|
+
primaryClass = {cs.DC},
|
|
271
|
+
doi = {10.48550/arXiv.2609.24991},
|
|
272
|
+
url = {https://arxiv.org/abs/2609.24991}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
If you use the software itself, cite the archived release. GitHub's "Cite this repository" button produces the same entry from [`CITATION.cff`](https://github.com/timurista/unalloc/blob/main/CITATION.cff).
|
|
221
277
|
|
|
222
|
-
- **All versions:** [doi:10.5281/zenodo.22761012](https://doi.org/10.5281/zenodo.22761012), which always resolves to the latest release — currently 0.2.3
|
|
278
|
+
- **All versions:** [doi:10.5281/zenodo.22761012](https://doi.org/10.5281/zenodo.22761012), which always resolves to the latest release — currently 0.3.0. The paper describes 0.2.3; 0.3.0 adds result provenance and `unalloc verify` and changes no attribution result
|
|
223
279
|
- **Version 0.2.1:** [doi:10.5281/zenodo.22761013](https://doi.org/10.5281/zenodo.22761013)
|
|
224
280
|
|
|
225
281
|
```bibtex
|
|
226
282
|
@software{urista_unalloc_2026,
|
|
227
283
|
author = {Urista, Timothy},
|
|
228
284
|
title = {unalloc: find the AI spend nobody owns},
|
|
229
|
-
version = {0.
|
|
285
|
+
version = {0.3.0},
|
|
230
286
|
year = {2026},
|
|
231
287
|
doi = {10.5281/zenodo.22761012},
|
|
232
288
|
url = {https://github.com/timurista/unalloc}
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "unalloc"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
description = "Find the AI spend nobody owns. Joins OpenCost allocation data with LLM provider bills and reports what's unattributed."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|