Verace Workbench
Compact reference implementations of hierarchical byte models, speculative decoding, Kolmogorov-Arnold layers and small symbolic reasoning components.
- Byte-level language model: Causal transformer over raw UTF-8 bytes
- Two-level patch-byte model: Follows the MegaByte design by others
- Three-tier byte hierarchy: Adds 64-byte chunks above 8-byte patches
- Benchmark scripts: Time attention, SwiGLU and speculative decoding
Overview
Verace Workbench is a collection of thirteen short Python modules. Each module implements one technique from current sequence modelling or classical AI in a compact, readable form. The collection asks what each technique does in its simplest working version. The techniques include byte-level and hierarchical byte language models, modern transformer blocks, speculative decoding, Kolmogorov-Arnold layers, online Q-learning, enumerative program synthesis and forward-chaining logic. Most of these techniques come from other researchers. Verace Workbench reimplements them and does not introduce them.
Each module stands alone and ends in a demo or benchmark function. The sequence-model modules form one group. A UTF-8 byte tokenizer with a 256-symbol vocabulary feeds a causal byte transformer. A two-level patch-byte model follows the MegaByte design by others. A three-tier model, GigaByteLLM, adds a further level of 64-byte chunks above 8-byte patches. A transformer-block module provides rotary position embeddings, grouped-query attention, a SwiGLU feed-forward layer and the quintic Newton-Schulz iteration used by the Muon optimizer, which is by other authors. The reasoning modules form a second group: a symbolic knowledge base, a neuro-symbolic pipeline, an abstract syntax tree (AST) program synthesizer and a deep Q-learning agent.
Two benchmark scripts are part of the code. The first, bench_sota.py, times grouped-query attention with rotary embeddings and the SwiGLU layer over 50 iterations after 5 warmup iterations. It also measures how far the Newton-Schulz output is from orthogonal, as . The second, bench_speculative.py, compares plain autoregressive sampling with speculative decoding. It uses an 8-layer, width-512 target model and a 2-layer, width-128 draft model, and reports speedup and acceptance rate. A teaching demo trains a character-level LSTM for 150 steps on a small English corpus.
The modules are implemented as runnable prototypes. No outputs of the benchmarks or demos are recorded, so no speed, accuracy or quality figure has been measured. Two modules depart from the methods they reproduce. The speculative decoder accepts a draft token only when it equals the token sampled from the target model, so its output distribution is not exact. The patch-byte model does not shift its patches, so a byte can see later bytes of its own patch. Both points remain open.
Status
Prototype. Thirteen code modules with demo and benchmark functions exist, but no benchmark output, training run or evaluation is recorded.
Simulator
A made-up line of thirteen versions of twelve parts. Each version replaces a few parts of the one before it and keeps the rest. Move along the line and change how much each version replaces.
- versions, the baseline first
- grey: a part of the baseline · colour: a part introduced later, brighter the newer
- Baseline still in version 6
- 42%
- Parts replaced since the baseline
- 7 of 12
- Its oldest part is
- 6 versions old
- Less than half baseline from
- Version 5
Move along the line of versions, then replace more parts at each step and see how soon the baseline is gone.
This simulator is an illustration of the principle, with made-up numbers. It does not run the lab's code or show the lab's data, and nothing in it is a measurement.
Architecture
Byte-level language model
ByteLevelLLMis a causal transformer over raw UTF-8 bytes with a 256-symbol vocabulary. It uses learned positions and a pre-norm GELU encoder run with a causal mask, and generates text by temperature sampling.Two-level patch-byte model
HierarchicalPatchByteLLMfollows the MegaByte design by others. A causal global transformer runs over 4-byte patch projections, and its features are added to byte embeddings before a causal local transformer predicts bytes.Three-tier byte hierarchy
GigaByteLLMstacks three levels: a chunk transformer, a patch transformer and a byte head. Each coarser level conditions the next finer one.Modern transformer blocks
The blocks are rotary position embeddings, causal grouped-query attention, a fused SwiGLU feed-forward layer and Newton-Schulz orthogonalization. Together they make up the standard parts of a current decoder.
Speculative decoder and sampler
SpeculativeDecoderdrafts several tokens with a small model and checks them with one forward pass of a large model.sample_logitsapplies temperature, min-p, top-k and top-p filtering before sampling.Simplified Kolmogorov-Arnold network
KANLinearlayers place a learned one-dimensional function on every input-output edge, andKANModelstacks these layers into a multilayer network.Symbolic and neuro-symbolic reasoning
SymbolicKnowledgeBasestores fact tuples and rule functions and runs forward chaining.NeuroSymbolicPipelinepasses a neural classifier's predicate choice to a fixed rule engine.Program synthesizer
ASTProgramSynthesizerenumerates small expression programs. It keeps the first program whose outputs match a target function on test inputs.Online Q-learning agent
QNetworkandSelfLearningEnvironmenttogether form a minimal deep Q-learning setup on a 5x5 grid. The agent earns +10 for reaching the corner and -0.1 per step.
Implementation
Mechanisms as they are implemented in the source code, with the constants the code uses.
- Concat-project downsampling across three tiers
- Bytes are grouped by concatenation and a linear projection into 8-byte patches and 64-byte chunks, with model width 256. The macro tier has 8 heads, feed-forward width 4d and 3 layers. The meso tier has 4 heads, feed-forward width 2d and 2 layers. Coarser outputs are repeat-broadcast and added to finer-tier inputs, and the micro tier is only a linear head.
- Unshifted global-patch, local-byte decomposition
- The global model projects each patch of size patch_size times dim down to dim and supplies semantic context to the local byte model. The patch is not shifted as it is in MegaByte, so a byte sees the future bytes of its own patch during training.
- Quintic Newton-Schulz orthogonalization
- The input is first normalized as with = 1e-7. The update then runs 5 times: , then . This pushes singular values toward about 1 and approximates for Muon-style updates.
- Match-based speculative acceptance
- The draft model proposes gamma = 4 tokens, and one target forward pass runs over the context and the drafts together. A draft is accepted only if it equals the token sampled from the target, not by the rule . The result is not distribution-exact, and the target probability the code computes is never used.
- Min-p, top-k, top-p filtering chain
- Filtering runs in probability space in a fixed order. Min-p first removes tokens below 0.05 times the maximum probability. Top-k then keeps 50 tokens, and the nucleus step keeps cumulative mass 0.9 while always retaining the top token. The remaining probabilities are renormalized and sampled.
- Gaussian RBF edge functions
- B-splines are approximated by Gaussian bases on the grid linspace(-2, 2, 5). Each edge computes . A SiLU base path is added to this sum, and all weights are initialized as randn times 0.1.
- Single-sample online Q-learning
- Each transition triggers one SGD step toward the target , or at a terminal state. There is no experience replay buffer and no target network.
- Forward-chaining fixpoint inference
- Rules are applied repeatedly to the fact set, and each application can produce new fact tuples. The loop stops when an iteration adds no new tuple, and a query is a set-membership test on the result.
- Enumerative AST search with execution check
- Candidate programs of the form
return a <op> bwith op in addition, subtraction and multiplication are built as syntax trees. Each candidate is compiled and run with compile and exec. The first candidate that matches the target on the input pairs (2,3), (5,5) and (10,2) is accepted.
Concepts
- Byte-level language modelling
- A byte-level model reads and writes raw UTF-8 bytes instead of subword tokens. Its vocabulary is fixed at 256 symbols, and any text can be represented without an out-of-vocabulary case.
- Patch-byte hierarchy
- In a patch-byte hierarchy, a large model runs over groups of bytes and a small model predicts the bytes inside each group. The long-range work happens on a much shorter sequence.
- Causal patch shifting
- In the MegaByte design, the global context given to a patch comes only from earlier patches. Without this shift, a byte's prediction can use information from later bytes in its own patch, which leaks the targets during training.
- Grouped-query attention
- Grouped-query attention lets several query heads share one key head and one value head. This shrinks the key-value cache while keeping many query heads.
- Rotary position embedding
- A rotary position embedding encodes position by rotating query and key vectors by position-dependent angles. Here it uses base = 10000.
- Muon-style orthogonalized updates
- Muon is an optimizer by other authors. It replaces a gradient matrix with an approximately orthogonal matrix of the same shape. The Newton-Schulz iteration computes this approximation without a singular value decomposition.
- Speculative decoding
- In speculative decoding, a cheap draft model proposes several tokens and the large target model checks them all in one pass. The exact method accepts each draft with probability , which preserves the target distribution.
- Min-p sampling
- Min-p sampling discards tokens whose probability is below a fixed fraction of the most likely token's probability. The cutoff therefore adapts to how confident the model is.
- Kolmogorov-Arnold network
- A Kolmogorov-Arnold network puts a learnable one-dimensional function on every edge instead of a fixed activation at each node. The implementation here is a simplified version that uses Gaussian bases.
- Neuro-symbolic pipeline
- In a neuro-symbolic pipeline, a neural network outputs symbols and a rule engine reasons over them. In the demo, an MLP chooses among 4 predicates, and a fixed rule maps IsHuman to IsMortal.
- Deep Q-learning
- Deep Q-learning trains a neural network to estimate the value of each action and moves the estimate toward reward plus discounted future value. Standard versions add replay buffers and target networks for stability, and this implementation omits both.
- Enumerative program synthesis
- Enumerative program synthesis lists candidate programs from a grammar and keeps the first one consistent with given input-output examples.
About this page
Written from the lab's own documents and source code. Figures and results are the lab's measurements as it recorded them at the time, and have not been independently replicated.
The Verace V series is the lab's line of language model architectures. It started from the lab's own code for the architecture described in a technical report by the Kimi Team (arXiv:2607.24653), listed here as the V0 baseline. Later versions replace the baseline's main parts with the lab's own designs and keep some of the report's components, which each page credits to the report.
Published under the PolyForm Noncommercial License 1.0.0: free for noncommercial use.