Stream — Continuous Byte-Level State Space Language Model
A token-free, position-free, O(n) language model. No tokenizer. No positional encoding. No quadratic attention. The recurrence is position.
Vocabulary
256
raw bytes — the only "tokenizer" is UTF-8
Position
SSM scan
order encoded by the recurrence itself
Complexity
O(n)
linear compute & memory, flat 228K tok/s
Best val loss
1.69
Stream 6L/256D · 4.43M params (TinyStories bytes)
Figure 1 — The whole model is four stages. There is no vocabulary table, no positional embedding, and no attention: order comes from the sequential scan, and the only "vocabulary" is the 256-entry byte embedding. source: VECTOR/model.py — byte_embed, blocks, ln_f/head
Figure 2 — One selective SSM block. The input is split into a main path (SiLU → depthwise conv → SiLU → projections) and a gating path; the projections produce an input-dependent step size Δₚ and state projections Bₚ, Cₚ; the scan integrates the recurrence in O(T); the output is gated, projected back to D, and added residually. source: VECTOR/model.py:123 — SSMBlock
Figure 3 — The core primitive. (a) The JIT-fused sequential recurrence for CPU. (b) SSMScanFn, the custom torch.autograd.Function whose manual reverse scan avoids building the O(T) autograd graph — roughly 10× faster backward, bit-exact. (c) The Triton parallel associative scan: since the combination operator is associative, prefix states can be merged in a binary tree, giving O(log T) parallel depth on GPU. source: model.py#L31 (_ssm_fwd/_ssm_bwd), model.py#L54 (SSMScanFn), VECTOR/triton_scan.py
Figure 4 — From each position the head emits n_predict independent 256-way byte distributions and samples the next n_predict bytes in one forward pass. This multiplies the per-step training signal by 4 and shortens autoregressive decoding by 4×. source: model.py#L245 (_compute_loss), model.py#L276 (generate)
Figure 5 — Variants built on the Stream backbone. VECTOR adds learned position pruning, GQA attention, and MoE under a five-term loss (gate collapsed in practice). MoE-Stream adds MoE FFNs with gradient-aware expert lifecycle management; its controlled ablation showed replacement hurts validation loss, so it is disabled by default. source: VECTOR/model_vector.py, VECTOR/moe_stream.py
Honest context. Stream's value proposition is O(n) — flat ~228K tok/s across all sequence lengths (forward-only benchmark), O(n) memory (6.77 GB at T=65,536 on a T4), and a projected crossover vs. quadratic attention at T≈9k (1.73× at T=16k, forward-only). The naive JIT scan measures Python-loop overhead, not asymptotics; the current GPU implementation is the fused Triton scan, plus a chunked two-level scan for low-B·H, occupancy-starved shapes and a shape-conditional auto-dispatch rule (chunked iff B·H≤128, else fused; no T threshold) — all benchmarked on T4 (see §5.9 of the report). The kernel body is still a serial loop over T (grid B·H), not a true O(log T) parallel tree scan. End-to-end training throughput is being re-measured after fixing a missing torch.cuda.synchronize(); earlier "12 ms/iter / 73×" figures were CPU-scheduling artifacts. The transformer still wins on loss at matched small-scale parameter counts — this diagram is the architecture, not the final verdict.