Core DeepInfer
Follow a request from prefill to the last committed token.
A small NumPy inference engine for reading, running and changing inference state transitions. Requests share one real execution path: queue, restore or prefill, propose drafts, allocate verification work, write KV, reject a branch, roll back and commit.
An independent community reference inspired by DeepInfer's state and scheduling mechanisms. Not affiliated with or endorsed by DeepSeek.
The model performs real float64 attention, projections and feed-forward operations with random, untrained parameters. It does not load DeepSeek weights or produce useful language. No GPU, model download, API key, server or network access is needed after installation.
Install and run
Python 3.10 or newer:
python -m pip install core-deepinfer
core-deepinfer
core-deepinfer demo --trace --json
The default demo actually executes shared-prefix requests, a cancellation, speculative writes and rollback, hot state reuse, warm encoder-prefix recovery and a cold miss. It compares both output tokens and the complete committed state against ordinary greedy decoding. Its clock is injected; it does not sleep for expiry. Its cost curve is synthetic, not a hardware measurement.
Read the included walkthroughs offline
The wheel contains an index and six chapters, each in English and Chinese. The CLI prints the Markdown directly; it does not open a browser or fetch content.
core-deepinfer guide --list
core-deepinfer guide 01
core-deepinfer guide 03 --lang zh
core-deepinfer guide 02 --lang en --json
The chapters follow a request's lifetime, hot and warm restoration, speculative transactions, verification budgets, the numerical model and extension exercises. Source links and test commands refer to the full source distribution; the installed wheel provides the executable modules and guide text, not a second copy of the test suite.
中文导读:core-deepinfer guide --list --lang zh。先运行完整请求链,再读状态恢复与回滚;这不是在 CPU 上运行 DeepSeek 训练权重。
Use the Python library
from core_deepinfer import Engine, EngineConfig, TinyModel
target = TinyModel(seed=7)
draft = TinyModel(seed=8, depth=1)
engine = Engine(target, draft, config=EngineConfig(max_batch_tokens=8))
engine.submit([1, 2, 3, 4], max_tokens=8)
engine.submit([1, 2, 3, 4, 5], max_tokens=5)
for result in engine.run():
print(result.request_id, result.tokens, result.finish_reason)
# Keep the engine and cache for another request.
result = engine.generate([1, 2, 3, 4], max_tokens=4)
Use step() to inspect one round, cancel(id) between rounds, and result(id) to revisit a completed request. run() delivers new results once. Healthy requests drain before RequestError.results reports a batch containing failures; a reported old error does not poison later requests.
The default recovery mode is exact. Bounded mask and compact recovery are explicit approximations and can change output. Matching those two implementations on one bounded dependency graph does not prove equality with exact recovery.
Inspect a different batch
core-deepinfer generate --prompt 1,2,3 --prompt 4,5,6 --max-tokens 6 --batch-budget 4 --json
core-deepinfer generate --prompt 1,2,3,4 --greedy --trace
core-deepinfer replay --length 32 --keep 8 --json
Inputs and outputs are token IDs. Query-row counters record actual work but are not FLOPs or speedup measurements. Requests execute sequentially in NumPy, not as a vectorized GPU batch. Draft self-probability is a scheduling heuristic, not DSpark's learned acceptance head.
Get the complete source and tests
The source distribution includes the MIT license, modules, tests, examples, bilingual READMEs, walkthroughs and validation records. Download the source archive from the package's Files section, or use:
python -m pip download --no-deps --no-binary=:all: core-deepinfer==0.1.0
After extracting it, install .[dev] in a virtual environment and run python -m pytest -q. The checked-in validation record distinguishes source tests, wheel installation, controlled interruption checks and unexecuted remote CI.
Longer source readings of the original implementation are in AI Infra Notes.
Deliberate limits
No trained DeepSeek models, MLA, MoE, mHC, quantization, CP, CUDA Graphs, GPU/NPU backend, distributed KV store, persistent sessions or HTTP server. Snapshots copy arrays, source history grows, and completed requests remain inspectable in memory. Controlled interruption recovery is not persistence, thread safety or protection against process termination.
This reference makes inference state observable. It makes no production throughput, latency or model-quality claim.
Metadata
Release files for core-deepinfer 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 | Provenance | |
|---|---|---|---|---|
| core_deepinfer-0.1.0.tar.gz | 78.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| core_deepinfer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 134.8 kB
Release files / core_deepinfer-0.1.0.tar.gz
| Download URL | core_deepinfer-0.1.0.tar.gz |
|---|---|
| Size | 78.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b5a5284b19e5475481c102e26684484f880d4e7856dd01abe15035ef848f0fe
|
|
BLAKE2b-256 checksum How to use checksums |
a19ecf0f19b0150f2e1f67085903bf41792da19c0d6c406b4d43151f22e2faff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / core_deepinfer-0.1.0-py3-none-any.whl
| Download URL | core_deepinfer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 56.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60d47d5ded06e6959d91ccf015df4968c9ec6d8b2a1253dcdc7803100f45c264
|
|
BLAKE2b-256 checksum How to use checksums |
6c4d8d3691db397fd27dadd75b23a7b539749cf2aa1ed2139522d018a2eed882
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for core-deepinfer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.