Metadata-Version: 2.4
Name: sqrt-space-kv
Version: 0.1.0
Summary: Sqrt-Checkpoint KV-cache residency: cost models, keep-set computation, and exact reference attention. Zero dependencies.
Author-email: Jun Kawasaki <jun784@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/com-junkawasaki/sqrt-space-kv
Project-URL: Repository, https://github.com/com-junkawasaki/sqrt-space-kv
Project-URL: Issues, https://github.com/com-junkawasaki/sqrt-space-kv/issues
Keywords: kv-cache,llm-inference,attention,memory,checkpointing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.5; extra == "dev"
Dynamic: license-file

# sqrt-space-kv (Python)

Sqrt-Checkpoint KV-cache residency: cost models, keep-set computation, and
exact reference attention. Zero runtime dependencies.

Full documentation, honest tradeoffs, and links to the paper / Rust port:
see the [repository README](../README.md).

## Install

```bash
pip install sqrt-space-kv
```

## Quickstart

```python
from sqrt_space_kv import keep_indices, strategy_cost

s = 4096
keep = keep_indices(s)          # token indices to keep resident
print(len(keep), "of", s, "kept")

cost = strategy_cost("sqrt-checkpoint", s)
print(cost["kv_cells"], cost["fidelity"])
```

## Development

```bash
python -m pip install -e ".[dev]"
pytest -q
```
