inferris-lite
Executable mini-forms of LLM serving mechanisms — continuous batching, token budgets, chunked prefill, paged state, preemption, prefix caching, cache-aware scheduling, speculative decoding, the executor boundary, and rank parallelism — as one dependency-free Python state machine that prints what it is thinking, step by step.
Each mechanism is a mechanism note first (the problem, the invariant, the
smallest state machine that expresses it) and an implementation second.
The code grows mechanism by mechanism: m00_engine_loop through
m11_parallelism, each module the complete engine as of its mechanism,
each pinned by one test per line of its note. Reading order is the module
order; import m11_parallelism is the whole ladder.
Install
pip install inferris-lite
Python >= 3.12, zero runtime dependencies.
Watch it think
inferris-lite demo
Three requests — staggered arrivals, chunked prefill, page contention, a scripted speculative verdict — on a rank-4 executor group:
step 0 scheduled=['r0'] executed={'r0': 6}
step 1 scheduled=['r0', 'r1'] executed={'r0': 3, 'r1': 4} accepted={'r0': 2} finished={'r0': 'LENGTH'}
step 2 scheduled=['r1', 'r2'] executed={'r1': 2, 'r2': 6} accepted={'r1': 1} finished={'r1': 'LENGTH'}
...
r2: FINISHED (LENGTH) generated=5 computed=14
inferris-lite mechs lists every mechanism and its key question. Your own
workloads go through run:
inferris-lite run --request a:16:8 --request b:16:8:1 --spec-len 3 --world-size 2
inferris-lite run --spec workload.json --json
A JSON spec is an engine object (max_step_tokens, page_size,
num_pages, spec_len, world_size) plus a requests list
(request_id, prompt_len or explicit tokens, max_new_tokens,
arrival_step, eos_after, accept_script). Explicit shared tokens
prefixes are how you make the prefix cache light up in the reused
column. --json emits one object per step with every trace field, then a
terminal summary.
As a library:
import m11_parallelism as m11
requests = [m11.Request("r0", list(range(6)), 4)]
engine = m11.Engine(requests, max_step_tokens=8, page_size=4, num_pages=8, world_size=2)
for trace in engine.run():
print(trace.step, trace.scheduled, trace.executed, trace.accepted)
Every earlier mechanism is importable the same way — m03_paged_state
before pages met prefix reuse, m09_speculative_decode before the
executor boundary was cut — so you can diff neighbouring mechanisms to
see exactly what one mechanism adds.
What this is, and is not
Tokens are integers. Execution is bookkeeping: the executor answers with verdicts and page writes, not logits. Ranks are logical and run in lockstep. There is no model, no tokenizer, no server — and that is the point: what runs here is the mechanism semantics themselves, isolated from implementation accident and performance optimization, small enough to read in an afternoon and precise enough to break when you change an invariant.
inferris-lite is the specification layer of
inferris, a Rust inference
engine; the mechanism notes live in the repo under lite/mech/.
Release files for inferris-lite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inferris_lite-0.1.0.tar.gz | 70.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inferris_lite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 156.9 kB
Release files / inferris_lite-0.1.0.tar.gz
| Download URL | inferris_lite-0.1.0.tar.gz |
|---|---|
| Size | 70.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
511536b62e5d459cecf1b68a87ab5f8ec979920f4eafa40fd01c41b2ea5ab4d8
|
|
BLAKE2b-256 checksum How to use checksums |
09bdb1d8645005fc94c64f8fd47a56307bb1db75993caf9df6a92c34a5f0312d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / inferris_lite-0.1.0-py3-none-any.whl
| Download URL | inferris_lite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 86.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bff76766f104e789468820d12749eff3df7b4b6379763fb6958e2e36f2ef3b7
|
|
BLAKE2b-256 checksum How to use checksums |
65fda648823ed8685eb6b101451aa74db1a72d7a77b0f1a336cc56813a633a09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|