Skip to main content

tokenspeed-engine

The engine's control plane, in Rust, as RFC 0002 describes it: every engine rank is a ts-host process that runs the scheduling loop in Rust and embeds CPython for the data plane. The design rules of the loop are in docs/design/event-loop.md.

Source crate Published package Role
ts-wire tokenspeed-wire The engine IPC schema and its msgpack codec, byte-compatible with the Python structs in python/tokenspeed/runtime/engine/io_struct.py and zmq_wire.py.
ts-client tokenspeed-client A frontend's connection to the engines: the startup handshake, request routing across attention-DP ranks, output streams, aborts, control operations and an EPD encode server's encode requests.
ts-py tokenspeed-py tokenspeed_engine._native: ts-client for Python tests and tools (entrypoints/wire_driver.py), with tokenspeed_engine.host_binary() naming the installed ts-host, and ts-l3's executor for Python tests over a data plane's Host pool.
ts-collective tokenspeed-collective CPU collectives among an engine's ranks over a TCP mesh: broadcast, all-gather and all-reduce, each frame checked against the collective the receiver is in.
ts-scheduler tokenspeed-scheduler The C++ scheduler and its nanobind module compiled into the binary, with a cxx facade for the control thread. The module is registered as a built-in of the embedded interpreter, so the plans Python reads are the same C++ objects the control thread produced. The crate also holds the host's profile span recorder, which the C++ scheduler's spans reach through the facade.
ts-control tokenspeed-control One rank's control plane: ingress checks, request state and output processing, the scheduling loop and its in-flight queue, cache-op acknowledgment, control operations, grammars, the expert rebalance, KV events, the engine side of the msgpack wire, and the per-round agreements among ranks.
ts-grammar tokenspeed-grammar Grammar-constrained decoding on xgrammar's C++ library: compilation and the matchers, which the data plane drives through C entry points.
ts-metrics tokenspeed-metrics The engine's metrics: Prometheus' multiprocess files, written directly, and the events the node's plugin relay runs output plugins on.
ts-mooncake tokenspeed-mooncake The Mooncake transfer engine and store client through their C APIs, loaded at runtime from the tokenspeed-mooncake wheel.
ts-l3 tokenspeed-l3 The L3 storage tier's Host-only executor (asynchronous L3): object naming, the Host pool's layout and ownership, bounded queues and workers, backend health, and the stores (the Mooncake store client, and an in-memory one for tests).
ts-pd tokenspeed-pd The PD transfer peer: the P/D handshake, room states, transfer workers and the per-round agreement on transfer progress.
ts-host tokenspeed-host The rank binary: it embeds the interpreter, has engine/rust_host.py build the data plane and the scheduler, and runs the loop on its main thread and the data plane on its forward thread.

The crates.io packages use the tokenspeed- prefix. Their Rust library names remain ts_wire, ts_client, and so on; the Python module remains _native, and the host executable remains ts-host. For example:

[dependencies]
ts-client = { package = "tokenspeed-client", version = "0.1.0" }

Wire conformance

The Rust engine CPU benchmark measures long-request ingress, prompt logprobs and high-frequency output streaming with the real wire, control and client classes, without a GPU or model weights.

crates/ts-wire/tests/fixtures/ holds messages written by the Python encoder. cargo test decodes each one, compares it field by field with the values the generator used, and re-encodes it byte for byte; test/runtime/test_ts_wire_fixtures.py checks that the files still match the Python encoding. After an intentional schema change on the Python side, run

python tokenspeed-engine/crates/ts-wire/tests/fixtures/generate.py

and update the ts-wire structs to match. Give every new field a distinct, non-default value in the generator: a field decoded into the wrong slot still re-encodes to the same bytes, so only the value checks catch it.

The optional output_token_cumulative_probs_val tail carries each selected token's cumulative probability diagnostic alongside its logprob. The control plane retains the same token ordering, stop truncation and streaming slices for both columns, and emits diagnostics only for requests returning logprobs. Once a request has any value, each of its outputs carries one per token, NaN for a token that came without one, so the column never misaligns with the tokens. An older producer defaults this column to empty; older readers skip it.

The appended reasoning_tokens column is cumulative per request, like completion_tokens, and excludes reasoning-block delimiters. The control plane counts committed token ids before detokenization, including a PD prefill's bootstrap token. An older producer defaults the column to empty and its output rows report zero; older readers skip the appended column. ts-client output chunks, the Python chunk dictionaries, and WireDriver.Completion expose the same cumulative count.

Completed prompt logprobs move from request state into the first output that ships them. The state retains the fact that they are final after transferring the buffers, so a retraction's replay neither gathers nor sends them again. The frontend likewise consumes a decoded batch into independently owned per-request chunks. A queued chunk owns its arrays until consumption or cancellation; one slow request need not retain another request's payload.

Building

Snapshot SDK updates carry a complete publication directory in the optional UpdateWeightsFromMooncakeReqInput.snapshot map. The native host and Python runtime must be built together to transport this field. The existing global commit and memory-saver rules still apply. The configured SDK updater receives update_weights(models, version=..., snapshot=...). Tensor data remains in the SDK's store. Requests without a snapshot retain the existing SDK protocol.

The native crates target Linux and need a C++ compiler, CMake, OpenSSL development headers, and Python development headers. Set PYO3_PYTHON to an interpreter with nanobind>=2.13.0 and tokenspeed-spdlog==1.15.1 installed. The scheduler source is bundled in its crate; the grammar build downloads the pinned, SHA256-checked xgrammar source release and therefore needs network access (or FETCHCONTENT_SOURCE_DIR_XGRAMMAR for a local copy).

ts-host and ts-py link the CPython the engine runs under; build with it as PYO3_PYTHON, which needs nanobind and tokenspeed-spdlog, as the scheduler wheel build does:

PYO3_PYTHON=$(which python) cargo build --release -p tokenspeed-host -p tokenspeed-py

The tokenspeed-engine wheel (pyproject.toml, built with setuptools) carries tokenspeed_engine._native and the ts-host binary. To run a development build instead, put _native on the Python path and point TOKENSPEED_HOST_BINARY at the binary. TS_HOST_LOG sets the Rust log filter (info by default; ts_control=debug logs admissions and cache-op acknowledgments). TS_HOST_LOG_USE_LOCAL_TZ switches the Rust log timestamps from the default UTC (...Z) to the machine's local time with an explicit UTC offset (...+08:00); truthy values are 1, true, on and yes, case-insensitive, matching dynamo's DYN_LOG_USE_LOCAL_TZ.

Releasing Python wheels

Build and Release TokenSpeed first builds, tests and publishes an engine post release to the wheel repository, then builds and publishes TokenSpeed. Both use the same source commit; for a nightly this is the kernel nightly's commit. TokenSpeed nightlies pin the actual engine version returned by the release workflow, including any post-date advancement. Stable TokenSpeed releases retain their existing engine dependency range. These automatic engine releases do not upload to PyPI. A TokenSpeed nightly dry run also builds and tests the engine without publishing either package.

Use Release TokenSpeed Engine in GitHub Actions. Select dry-run to build and test wheels, or publish on main to upload them. Choose a release_type (post by default):

Type Example with base version 0.1.0 Destination
release 0.1.0 lightseekorg/whl, then PyPI
post 0.1.0.post20261111 lightseekorg/whl by default
rc 0.1.0rc20261112 lightseekorg/whl only

For a post release, explicitly enable publish_post_to_pypi to also upload the tested wheels to PyPI after the wheel repository publication succeeds. This option defaults to false and is accepted only for post. Post versions on PyPI sort above their base version and participate in normal pip upgrades.

For post and rc, version_date defaults to the current UTC date (YYYYMMDD). A post run checks existing engine releases in lightseekorg/whl and advances by calendar days until it finds an unused post version. If 0.1.0.post20261111 exists, another run can publish 0.1.0.post20261112 on the same day. This date is a version identifier and can be ahead of the actual build date. Only an explicit rc selection produces an rc; it uses the requested date without automatic advancement.

Leave version_date empty for a stable release. The workflow resolves the version once and changes the Python package version only in the build checkout. The committed base version and Rust crate versions stay unchanged.

Wheels are attached to lightseekorg/whl releases under tokenspeed-engine-v<VERSION>. Only rc is marked as a GitHub prerelease; post uses a normal GitHub release. The workflow also creates or updates the pip indexes in the wheel repository's gh-pages branch, retaining historical links and adding SHA256 hashes. No manual directory preparation is needed. GitHub Pages serves an index update after its deployment finishes.

# Stable wheels mirrored from a release.
pip install --index-url https://lightseek.org/whl/ tokenspeed-engine
# Post releases and explicitly selected release candidates.
pip install --index-url https://lightseek.org/whl/nightly/ tokenspeed-engine
pip install --pre --index-url https://lightseek.org/whl/nightly/ 'tokenspeed-engine==0.1.0rc20261112'

The existing https://lightseek.org/whl/nightly/rocm7.2/ index receives the same engine post/rc wheels. An rc sorts below the same base version's final and post releases, so pin the exact version when testing it. Merge a base version bump before the next stable release.

Use Re-run failed jobs to upload missing files from the same source commit. Re-run all jobs resolves the version again and may allocate a new post date; use Re-run failed jobs to retain the original version. Existing assets are never overwritten. A different commit requires a new post run, an unused rc date, or a new base version for a stable release.

Wheels support Linux with glibc 2.28 or newer, x86_64 and aarch64, and CPython 3.10–3.13. They contain the Python extension, ts-host, and a private CPython shared library for the host process, including its built-in native stdlib modules. The host uses the launching interpreter's Python library paths and environment. Installing a wheel needs no Rust toolchain. Each wheel is tested in a separate Python container and venv by importing the extension and starting the embedded scheduler and Python.

The build uses a full checkout because the engine also compiles the sibling scheduler source. No source distribution is published; source builds must use the repository checkout and the dependencies described above.

Configure the tokenspeed-engine project's PyPI Trusted Publisher with owner lightseekorg, repository tokenspeed, workflow filename release-tokenspeed-engine.yml, and GitHub environment pypi. Publication uses GitHub OIDC and does not require a stored PyPI token. The workflow also needs LIGHTSEEK_BOT_TOKEN with release and contents write access to lightseekorg/whl, authenticated as lightseek-bot.

Releasing Rust crates

Use Release TokenSpeed Engine Crates in GitHub Actions. Select dry-run to build and verify the workspace's package archives without uploading. Select publish on main to publish missing versions in dependency order; versions already on crates.io are skipped, so a partial release can be rerun. The run summary lists each package's version and the source commit.

Before a release, update [workspace.package].version in Cargo.toml and the internal dependency versions in crates/*/Cargo.toml, run cargo update --workspace to refresh Cargo.lock, and merge the version change. The workflow publishes the committed versions; it does not bump them.

Publishing uses crates.io Trusted Publishing rather than a stored API token. Configure it once:

  1. Create the GitHub environment crates-io and restrict its deployment branches to main.
  2. In each published crate's Settings → Trusted Publishing, add a GitHub publisher with repository owner lightseekorg, repository tokenspeed, workflow filename release-tokenspeed-engine-crates.yml, and environment crates-io.

New crates need their initial token-based publication before Trusted Publishing can be configured. Registry rate limits still apply.

Running against an engine

Start a headless engine (one rank process per GPU is launched for you); it dials the handshake address the client binds:

ts serve --headless --model <model> \
  --data-parallel-rpc-port 30500 [--data-parallel-size N --dist-init-addr <host:port>]
cargo run --release --example generate -- tcp://127.0.0.1:30500 <N> <max-new-tokens> <prompts-file>

Each line of the prompts file is a comma-separated list of prompt token ids.

Metadata

Release files for tokenspeed-engine 0.1.0.post20261115

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for tokenspeed-engine 0.1.0.post20261115
File Actions
tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_x86_64.whl
tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details for tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_aarch64.whl
tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_x86_64.whl
tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details for tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_aarch64.whl
tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_x86_64.whl
tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64 Details for tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_aarch64.whl
tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_x86_64.whl
tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details for tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_aarch64.whl

Total release size: 147.5 MB

Release files / tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_x86_64.whl
Size 20.3 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
baeff6e88898d58c41d487e81371becfce957b2714a3e02feea4c838d18ff464
BLAKE2b-256 checksum
How to use checksums
c195ff08ed2cdd23e12012e81dbed71a3868d4fd7824c8b1e4eeec3fc6bf26d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_aarch64.whl
Size 18.3 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
eb7b1c1941cf6e3fdb4d3720a2d39091ec6e528cc43cd2ca109e45d0251d961c
BLAKE2b-256 checksum
How to use checksums
33628d2080cc59f1200ab1ed6c3adc6612c8c081a9dfc974f24e8e0196854a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_x86_64.whl
Size 20.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
52cc116e4b972f98ad8494b3fcda9b44d2b128f953253b303e9f673b2536affe
BLAKE2b-256 checksum
How to use checksums
08f00de9513d4060b6bc3c4f3f2d1110877613726522f38aa4080e6e13cc4e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp312-cp312-manylinux_2_28_aarch64.whl
Size 18.2 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
7a87ff5f7124835912030b8652859c0ff70c48d4fa9248dcae023a6add832a20
BLAKE2b-256 checksum
How to use checksums
ecbfeaea886d0033a42e96df4c83cd2f38852269cec3ab7a1a8650755413d43c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_x86_64.whl
Size 18.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c4373bcbeeea889b234114ccde5615cc23d6563c888d041b608d5ae96fa24166
BLAKE2b-256 checksum
How to use checksums
350c971b949684832ccbca259aadaa817bd17ec49b85623440ae46a447e20ab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_aarch64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp311-cp311-manylinux_2_28_aarch64.whl
Size 18.0 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
b759117ce15c60cf317125670d339c04cdd8ca977b4284d09ed3c512e591f5ad
BLAKE2b-256 checksum
How to use checksums
767df207171edb3917d0792259f8614d9fa0d643d66d7a184dc832a80d560f70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_x86_64.whl
Size 17.3 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0e2f02398e58934ebc1db87a3c107fccb1a75a0833aef9a9a32132cb257f6005
BLAKE2b-256 checksum
How to use checksums
43ff2c3092f86715c2329fdd7f92d2a7ebd0371be0d1e0151df94806c4316c36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL tokenspeed_engine-0.1.0.post20261115-cp310-cp310-manylinux_2_28_aarch64.whl
Size 17.3 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
da976de81ae03fe2e4625570a69d430adb07844d41b210692fcd97198511ac49
BLAKE2b-256 checksum
How to use checksums
3d796710e2c0b22c5af4f9f8ffa7f05409f6fda6510dc55f5ea97c81ec57669f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for tokenspeed-engine 0.1.0.post20261115

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for tokenspeed_engine-0.1.0.post20261115-cp313-cp313-manylinux_2_28_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page