Skip to main content

winnex-nano

Native Winnex inference engine — deterministic spectral tokenizer, multimodel weight balancing, and chunk streaming via the Madhava fast build.

Model-agnostic (Qwen / BERT / DeepSeek / GPT), C++20/OpenCL, no CUDA. Reuses the winnex-madhava engine kernels (QKᵀ matmul, selective-top-K with Cauchy-Schwarz bounds) — no code duplication.

Components

Module Purpose
SpectralTokenizer Character → quaternion spectrum (deterministic, no BPE, no vocabulary)
WeightBalancer Multimodel fusion: W' = Σᵢ αᵢ·R(qᵢ)·Wᵢ
StreamEngine Chunk generation via the Madhava fast build (working memory)
server_sse OpenAI-compatible /v1/chat/completions (stream + non-stream)

Installation

pip install winnex-nano

Requires winnex-madhava>=1.8.1 (the engine), numpy. Optional: winnex-nano[server] for the SSE server (fastapi, uvicorn, httpx).

Quick start

import winnex_nano as wn

# 1. Deterministic spectral tokenizer (no BPE, no vocabulary)
tok = wn.SpectralTokenizer(embed_dim=64)
states = tok.encode("Winnex AI")       # list of quaternions
text = tok.decode(states)              # round-trip: "Winnex AI"

# 2. Multimodel weight balancing: W' = Σ αᵢ·R(qᵢ)·Wᵢ
bal = wn.WeightBalancer()
model_a = {"layer.0.weight": [1, 2, 3, 4]}
model_b = {"layer.0.weight": [10, 20, 30, 40]}
a = wn.BlendWeight(); a.alpha = 0.5
b = wn.BlendWeight(); b.alpha = 0.5
fused = bal.blend([model_a, model_b], [a, b])   # [5.5, 11, 16.5, 22]

# 3. Streaming via the Madhava fast build
engine = wn.StreamEngine()
chunks = []
engine.stream(
    "O Madhava e deterministico.",
    lambda ctx, top: " chunk" if len(chunks) < 3 else "",
    lambda c: chunks.append(c.text) if not c.done else None,
)

SSE server (OpenAI-compatible)

pip install "winnex-nano[server]"
python -m winnex_nano.server_sse 30002
curl -N http://localhost:30002/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"O Madhava e deterministico"}],"stream":true}'

Honest benchmark (vs BPE)

Run the full benchmark on Kaggle — installs winnex-nano from PyPI and reports round-trip, throughput and O(1) decode scaling on real multilingual text:

Kaggle

Metric winnex-nano spectral BPE (Qwen2.5)
Round-trip perfect 8/8 n/a
Char error rate 0.00% n/a
Encode throughput 234K chars/s 4.3M chars/s
Stream (3 chunks) 1.7 ms ~2.1 s (HTTP)
Vocabulary none 151K tokens

The spectral tokenizer is 100% deterministic with no vocabulary dependency, but 50–70× slower and ~1000× less compact than BPE. It is an autonomous encoding for the native multimodel engine, NOT a drop-in BPE replacement for a BPE-trained model.

Native forward pass — memory and speed

ForwardEngine runs a Qwen2/Qwen2.5/Qwen3/Llama checkpoint without torch, without transformers and without CUDA. Weights come straight out of the .safetensors file; the heavy matrix work goes to OpenCL.

import struct, numpy as np, winnex_nano as wn

# Map the payload instead of copying it. The 7B payload is 14.2 GB and the
# constructor copies it; view() borrows it and lets the kernel page it in.
with open(P, "rb") as f:
    hlen = struct.unpack("<Q", f.read(8))[0]
    header = f.read(hlen).decode()
st = wn.Safetensors.view(
    np.memmap(P, dtype=np.uint8, mode="r", offset=8 + hlen), header)

eng = wn.ForwardEngine(wn.load_config(cfg_path), st)
eng.enable_gpu()            # decides the weight strategy, see below
print(eng.weight_mode)      # "device" | "resident" | "stream" | "cpu"

enable_gpu() picks one of three strategies, in this order:

Mode What lives where When
device every projection on the GPU (bf16 when f32 does not fit); host keeps only norms and biases the model fits in VRAM
resident every projection in host RAM, stable pointers fits in 60% of available RAM, no usable GPU
stream one layer at a time through a scratch buffer otherwise

Measured on an RTX 5060 Ti (16 GB) and a 31 GB host, Qwen2.5-7B, 131 tokens:

Path PPL Time RSS Anonymous heap
CPU 15.55172 69.8 s 14.2 GB 0.69 GB
GPU device 15.55171 7.5 s 14.4 GB 0.74 GB

The perplexity difference is 7e-6 relative — the checkpoint is already bf16, so the GPU path's bf16 weights are the same numbers the CPU reads after widening them to f32. Nothing is lost that was ever in the file.

RSS stays high in both rows because the payload is mapped: those pages are the file, evictable under pressure, not heap. The number that decides whether a model fits a machine is the anonymous column.

Why it is built this way

  • view instead of a copy. The constructor reads the whole payload into a std::vector. For the 7B that is 14.2 GB before a single weight is used, and it is what made the Kaggle run die with "Kernel died". view() follows the MadhavaL2 contract: the caller owns the pointer, the engine never copies.
  • Weights keyed by tensor name, not by host pointer. In stream mode run_layer builds a fresh LayerWeights per call, so every matrix gets a new address and the device cache never hits — the GPU then re-uploads 14.2 GB per forward and measures slower than the CPU (90.8 s against 67.0 s). Naming the weights (L3.gate_proj) lets the device keep them for the life of the engine regardless of what the host allocator does.
  • bf16 weights when f32 does not fit. The 7B in f32 is 26.1 GB against a 16 GB card. The dtype is decided once for the whole model from the declared total; deciding per matrix mixes formats on the device and corrupts every launch after the first switch.
  • Tiled GEMM. The original kernel was one work-item per output element with no blocking — arithmetic intensity 1 FLOP/byte against a machine balance of ~26, i.e. the kernel waited on its own weight reads. 16x16 local-memory tiles cut global traffic per MAC by ~8x.
  • lm_head streamed. The embedding table is the largest single tensor (152064x3584). Both of its uses — one row per decoded token, and the logits projection — go through the offset table in 512-row blocks, so it costs 7.3 MB instead of 2.18 GB.

Splitting a model into shards

ForwardEngine takes one Safetensors. Checkpoints that arrive as model-00001-of-0000N.safetensors must be merged into a single file first — concatenating the payloads byte-for-byte, without decoding, preserves bf16 and avoids the 30 GB a float32 merge would need.

License

Business Source License 1.1 (BSL 1.1) — pay@winnex.ai.

Pre-patent: https://zenodo.org/records/21861809

Metadata

Release files for winnex-nano 0.1.27

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

Source distribution (sdist)

Source distribution for winnex-nano 0.1.27
File Size Uploaded Provenance
winnex_nano-0.1.27.tar.gz 173.1 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for winnex-nano 0.1.27
File
winnex_nano-0.1.27-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
winnex_nano-0.1.27-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
winnex_nano-0.1.27-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
winnex_nano-0.1.27-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
winnex_nano-0.1.27-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
winnex_nano-0.1.27-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
winnex_nano-0.1.27-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
winnex_nano-0.1.27-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
winnex_nano-0.1.27-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
winnex_nano-0.1.27-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
winnex_nano-0.1.27-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
winnex_nano-0.1.27-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 4.9 MB

Release files / winnex_nano-0.1.27.tar.gz

Download URL winnex_nano-0.1.27.tar.gz
Size 173.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6247f38c8d4c80e4544b5f266e4d6a6ae4dc9dcdcae9f4f3910ed8aab9d212a5
BLAKE2b-256 checksum
How to use checksums
b08de2a4ca8288bd43108e2ebce014c307a9b307f4a86c781fe9ad15a921a6b6
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp313-cp313-win_amd64.whl

Download URL winnex_nano-0.1.27-cp313-cp313-win_amd64.whl
Size 276.2 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
2e15eb5f7c2e8252a5aca221894376aec561454e664638d9f95ab29011824021
BLAKE2b-256 checksum
How to use checksums
b561f02645646ed787d6bba16b18de92f9a2e90dd689f0274f25817d34b4f98f
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL winnex_nano-0.1.27-cp313-cp313-manylinux_2_28_x86_64.whl
Size 612.2 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e3d8739a4082f82435a416013e964e29d0b30227948d7c3d8927aa5157322d94
BLAKE2b-256 checksum
How to use checksums
81b33284768367d9b8e8467260f5fc051090fc8bcc8935698445a633e5c2356a
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp313-cp313-macosx_11_0_arm64.whl

Download URL winnex_nano-0.1.27-cp313-cp313-macosx_11_0_arm64.whl
Size 290.3 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0d7d37d6bf97667821574f1bf662aa5d5645237962664b062fc5545b9c7e65d9
BLAKE2b-256 checksum
How to use checksums
eb8f2ba5d2ac04e7889d96ccffe0fe696ca51ea5fd4b3267e20c1ddf5537f20b
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp312-cp312-win_amd64.whl

Download URL winnex_nano-0.1.27-cp312-cp312-win_amd64.whl
Size 276.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e1e3c7fe2356d54f6e42aa717c82483443c1a2ffe010ed538c8d413f05cdb953
BLAKE2b-256 checksum
How to use checksums
e37cd77c18024a316faa33f895e9d133453c479396e522758b0ea20a1e45c60a
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL winnex_nano-0.1.27-cp312-cp312-manylinux_2_28_x86_64.whl
Size 612.0 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
33634273bdde739e086b895dc7fb4d77be15764cd82283bf18e25f1383e788aa
BLAKE2b-256 checksum
How to use checksums
dd785cf11ce510c859cee4aba0f52327a5b9f09eb0f5d68a68752362515592e3
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp312-cp312-macosx_11_0_arm64.whl

Download URL winnex_nano-0.1.27-cp312-cp312-macosx_11_0_arm64.whl
Size 290.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f74c14d013202eebeedae25fca9917d4dca15bbac1ac4cf991cc8d308d276fe8
BLAKE2b-256 checksum
How to use checksums
57674c3111f38738fb387cdcd6e7c760927c38184833e56f291ed10185662b15
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp311-cp311-win_amd64.whl

Download URL winnex_nano-0.1.27-cp311-cp311-win_amd64.whl
Size 276.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
b1c696796b5bd5f6c40bc7c0348369e8d3dec2ef87c67e678f5b4e7b4b01c6f2
BLAKE2b-256 checksum
How to use checksums
60fd129d5598196ba87140fd756389542b99615a0c9f1debbe4d0f676bf4e493
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL winnex_nano-0.1.27-cp311-cp311-manylinux_2_28_x86_64.whl
Size 611.3 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8688b3a565727e5fb10334cde9317227a54cfa25f2c750455fa93f254fe565d2
BLAKE2b-256 checksum
How to use checksums
927c4d3f32c872b1dd06c0e11f4c16ea2aef0c91e97c3f6e188b53fd2012ee70
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp311-cp311-macosx_11_0_arm64.whl

Download URL winnex_nano-0.1.27-cp311-cp311-macosx_11_0_arm64.whl
Size 288.7 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c5cd21accb12363cb5d336e5e7720229ea98126877766ce4dbbb4a8bf9c2eaef
BLAKE2b-256 checksum
How to use checksums
543b752c0d4ac0b3bbde7f7c4b38614d1b1eb696ad120afffa2aad3451b7273b
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp310-cp310-win_amd64.whl

Download URL winnex_nano-0.1.27-cp310-cp310-win_amd64.whl
Size 275.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
1cc3bb2c07fca871ff20bf7eacba89f39dda93d8cd1b99a8781ae7534179593c
BLAKE2b-256 checksum
How to use checksums
702863a9a240db2d6f33a5650647fe5fab4b8de809c16b97270d53b97236b207
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL winnex_nano-0.1.27-cp310-cp310-manylinux_2_28_x86_64.whl
Size 609.6 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
55fae8a1e9e52ff42aef9550aca32a2c603364886c0d06f1316c186d69984752
BLAKE2b-256 checksum
How to use checksums
93d475114c6d18a755e98d039c1a7308cbdd0868aa722efc5429ac5f4affc0fc
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 Oct 22, 2026.

Transparency log

Release files / winnex_nano-0.1.27-cp310-cp310-macosx_11_0_arm64.whl

Download URL winnex_nano-0.1.27-cp310-cp310-macosx_11_0_arm64.whl
Size 287.5 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
589cbfb748c9da1839410f705703edd5480b541b17611dd504048c42059010c4
BLAKE2b-256 checksum
How to use checksums
d5c329407f317add09ce695c1cce2a257733fce57c3e6ee77a3672781037eb95
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 Oct 22, 2026.

Transparency log

Security for winnex-nano 0.1.27

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 13 files in this release have been uploaded with provenance metadata.

Select from 13 files

Attestation for winnex_nano-0.1.27.tar.gz

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 Oct 22, 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.

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