Copyright © 2026 Omid Teimory. All Rights Reserved.
This repository is source-available and proprietary, NOT open source.
- Permitted: You may inspect the source code, clone the unmodified repository onto local storage you own or control, and compile/run the unmodified application strictly on your own local hardware for personal, non-commercial evaluation (after affirmatively setting
AXIOM_ACCEPT_LICENSE=ONas required byCMakeLists.txtandMakefile). - Strictly Prohibited: You may not copy snippets, modify files, create derivative works, redistribute or mirror the codebase, offer any hosted/commercial/API/SaaS wrapper, reverse-engineer kernel scheduling for competing engines, or use any part of this repository as training/fine-tuning/evaluation/RAG input for AI systems (rights explicitly reserved under EU Directive 2019/790 Art. 4(3), § 42h(6) Austrian UrhG, 17 U.S.C. § 1202, and machine-readable
tdmrep.json).
See LICENSE for the complete legally binding agreement. Unauthorized use is prosecuted to the fullest extent of Austrian, EU, US, and international copyright law.
Engineered from First Principles in Bare-Metal C++23, NVIDIA CUDA 13.3, and CUTLASS v4.8.0
📅 Comprehensive Architectural Reference — As of 2nd December 2026
Let’s replace the actors.
Let’s replace the singers.
Let’s replace the writers.
Let’s replace the artists.
Let’s replace the experts.
Let’s teach every gatekeeper who spent decades making life hell for everyone else with degrees stamped by communist brainwash factories exactly what hell looks like when the hardware finally answers.
Project Axiom is not a Python wrapper around PyTorch, LibTorch, or TensorFlow. It is a self-contained deep learning runtime written from raw C++23, PTX/CUDA kernels, and CUTLASS v4.8.0 Epilogue Visitor Trees (EVT). A reader opening only this document can understand the entire system end-to-end: split-compiler ABI boundaries, exact binary file layouts (AXIOM_V2, TXF3, AXVK/BPE1, XIOM v2), native Byte-Level BPE (0 <UNK>), lock-free SPSC disk-to-PCIe DMA streaming, 16-step gradient-accumulated global-clipped AdamW training, KV-cached autoregressive decoding, hardened multimodal codecs, C-ABI bindings (axiom_core.dll), Project Spector OSINT MCP tooling, and verified RTX 4080 benchmarks.
- Philosophy, Scope & Split-Compiler Architecture
- October–December 2, 2026 Evolution Log
- Single-Source Configuration & Model Geometry
- Four-Tier Storage, SPSC Ring & Zero-Copy PCIe DMA Pipeline
- Multimodal Identification, Decompression & Output Codecs
- Native Byte-Level BPE Tokenizer & Contiguous Early-Fusion Codebook
- CUDA Kernels, CUTLASS EVT & Training Mathematics
- Autoregressive Inference, KV-Caching, Paged GQA & Sampling
- Memory Management: Stream-Safe BFC Allocator, Pinned Readback & Autograd Tensor
- Binary Checkpoint & Serialization Formats (
AXIOM_V2,TXF3,BPE1,XIOM) - Universal C ABI (
axiom_core.dll), Corpus Extractors, UI & Project Spector MCP Stack - Verified RTX 4080 Training Convergence, Hardware HUD & Chat Assessment
- Complete Repository & Directory Map
- Build, Automated Verification (
600 + 4Tests) & CLI Operator Manual - Known Leads & Active Engineering Roadmap
Standard AI frameworks introduce four structural bottlenecks on single-GPU consumer hardware:
- Runtime & Dispatcher Tax: Python interpreter overhead, dynamic graph construction, and allocator fragmentation stall tensor launches on small-to-medium sequence workloads.
- Opaque Memory Footprints: High-level frameworks hide host-to-device staging copies, pageable-to-pinned implicit synchronizations, and duplicate optimizer copies inside black-box allocators.
-
Shannon Entropy Compression Traps: Feeding raw container bytes from
.pdf,.docx,.png,.mp4, or.ogginto a neural model forces it to burn capacity learning DEFLATE Huffman trees ($H \approx 8.0\text{ bits/byte}$ ) instead of semantics. -
Catastrophic Vocabulary & Checkpoint Drift: Word-level frequency filtering collapses rare code symbols, identifiers, and non-ASCII UTF-8 bytes into
<UNK>, while unsynchronized checkpoint saves corrupt continual training runs.
Project Axiom eliminates these bottlenecks by owning every byte from NVMe file descriptor to GPU tensor register:
┌─────────────────────────────────────────────────────────────────────────┐
│ HOST LAYER — GCC 14+ UCRT64 (g++ -std=c++23) │
│ main.cpp • ai.cpp • training.cpp • interface.cpp • parser.cpp │
│ optimizer.cpp • identifier.cpp • decompress/* • compress/* • C ABI │
│ (Zero <cuda_runtime.h>, zero __nv_bfloat16, zero MSVC extensions) │
└──────────────────────────────────┬──────────────────────────────────────┘
│ Plain extern "C" CUDA_API ABI
│ Opaque void* device pointers + POD structs
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ DEVICE DLL — NVCC (CUDA 13.3, sm_89) + MSVC cl.exe (-std=c++20)│
│ cuda_transfer.dll (transfer.cuh umbrella) │
│ • CUTLASS v4.8.0 EVT GEMMs • FP32 Master AdamW & Global L2 Clip │
│ • Causal SDPA & Paged GQA Decode • RMSNorm / RoPE (θ=1e6) / SwiGLU │
│ • Stream-Deferred BFC Allocator • Top-2 MoE / CUDA Graph Capture │
└─────────────────────────────────────────────────────────────────────────┘
- Zero Header Leakage:
g++ -std=c++23never includes CUDA headers;cuda_transfer.dllisolates NVCC + MSVC symbols cleanly behind plainextern "C" CUDA_APIexports. Any external host language (ctypesPython inWe_Know/orchestrator.py, Node.js, C#, Rust) can link the compiledbuild/axiom_core.dll(axiom_c_api.cpp) directly. - Deterministic Offline Sovereignty: Everything compiles and runs locally without cloud APIs, internet dependency during training/inference, or Python training runtimes.
"An idiot admires complexity; a genius admires simplicity." — Terry A. Davis
Between late October 2026 and December 2, 2026, Project Axiom evolved from an early single-perceptron prototype into a complete causal transformer training/inference stack. Every major engineering change landed across that window:
-
CUDA Backend Modularization (
core/src/CUDA/): Split monolithic CUDA code intogpu/(upload.cu,download.cu),kernel/(forward_pass.cu,backward_pass.cu,rmsnorm.cu,rope.cu,swiglu.cu,paged_gqa.cu,moe_router.cu,cuda_graph_capture.cu), andutil/(caching_allocator.cu,memory_allocation.cu,telemetry.cu). -
CUTLASS v4.8.0 EVT Integration: Replaced naive activations with fused tensor-core GEMM + Epilogue Visitor Tree bias addition (
$Y = XW^T + b$ ) in BF16 inputs with FP32 accumulation, curing Dying ReLU collapse. -
Zero-Sync Storage & DMA Mechanics: Built persistent single-handle
std::ifstreamchunk streaming, Lock-Free SPSC 4-slot prefetch ring (ChunkRingBuffer<4>), Carry-Forward Seam preservation, and write-combined pinned ping-pong host buffers. -
Transformer Stack & Inference Primitives: Implemented multi-layer Causal SDPA, RoPE, SwiGLU FFN, PagedAttention block tables with Copy-On-Write (COW) prefix sharing, CUDA Graph DAG capture, 8-expert Top-2 Sparse MoE routing, BMP/WAV generative output codecs, and
axiom_core.dllC ABI. -
Statutory Licensing & Verification: Hardened
LICENSE(proprietary source-available, Austrian UrhG + EU DSM TDM opt-out +tdmrep.json), build-timeAXIOM_ACCEPT_LICENSE=ONgates inMakefile/CMakeLists.txt, and CI header verification (license_linter.yml).
- Frontier Hyperparameter Scale-Up (
shared_params.h,config.hpp):- Expanded canonical architecture from
(V=65,536, D=1024, S=256, H=16, FFN=4096)to(V=151,936, D=2048, S=1024, H=32 [8 KV, 4:1 GQA], FFN=6144, ROPE_THETA=1,000,000, NORM_EPSILON=1e-6). - Tuned default training stack to
4layers (285.2Mtied parameters @default_vocab_size = 32768) so FP32 master weights + AdamW states + BF16 compute fit cleanly inside 12 GB VRAM on RTX 4080 Laptop hardware. - Packed visual/video/acoustic byte codebooks contiguously at
[4..771]so ingesting media never stretchesactive_vocab_sizeacross empty text rows.
- Expanded canonical architecture from
- Full Codebase Forensic Audit & Fixes (
.todo— 37 Resolved Issues):- Training Convergence & Numerics: Replaced
batch=1noisy updates and arbitrary±10/[-2, 2]elementwise clamps with 16-step gradient accumulation (16,384tok/optimizer step) + two-pass global L2 gradient clipping (max_gradient_norm = 1.0) +beta2 = 0.95. Added learnable FP32 RMSNormgammaparameters (zero weight decay) persisted viaTXF3. Masked<PAD>(ID0) and<UNK>(ID1) in cross-entropy/validation kernels and excluded<PAD>from softmax denominators/argmax. Fixedrecency_weightparity in embedding scatter gradients. - CUDA Safety & Memory Leaks: Fixed async stream Use-After-Free in
CachingAllocator::deallocate(ptr, stream)by deferring free-list coalescing behindcudaEventRecord+cudaEventQuery. Added cachedpinned_alloc_readback()for D2H telemetry. Fixed 32-bit index overflow, OOM rollback leaks acrossallocate_transformer_weights/ PagedAttention, chunked prefill causal bounds inpaged_gqa.cu, shared-memory tiling inmoe_router.cu, device-side step/LR scalars in CUDA Graph capture, and ref-countedstorage_ownerlifetimes + stride safety intensor.hpp. - KV-Cached Trained Decode & Sampling Fixes: Wired
step_trained_transformer()KV-cache decoding intoAI::generate()for trained checkpoints; excluded unmapped vocab holes; hoisted RNG outside token loops; renormalized Top-K probabilities before Top-P nucleus cutoff; added1.35frepetition penalty. - Hardened Decompressors & Corpus Tooling: Fixed PDF
/Lengthtruncation,/ToUnicodeCMaps,TJkerning, octal escapes, and DOCX ZIP/XML entity reconstruction; implemented real zlib + Sub/Up/Paeth PNG decoding; replaced unaligned pointer casts withmemcpy; swapped 7.7 MBVideo.mp4fixture for a 12.4 KB synthetic MP4 to eliminate ~69 GB/test disk writes. Added layout-aware C11/Python PDF/vision extractors (gen_corpus.c,gen_corpus.py) and 3-tier MCP stack (Specter_MCP.py,Browser_Sandbox_MCP.py,Browser_Live_MCP.py). Decommissioned legacy--serveHTTP server. - Paths, Build System & Checkpoint Safety: Removed
-link error suppression incore/Makefile, added-MMD -MPdependency tracking, separatedapp.exeandtest.exeobject lists, anchoredtraining/andmodels/tocore_dir, dynamic menu path re-resolution, and atomic save checks.
- Training Convergence & Numerics: Replaced
- Native Byte-Level BPE (
0 <UNK>) &AXIOM_V2Checksums (Dec 2, 2026 Commitf96cc70c):- Replaced whitespace word-splitting completely with native Byte-Level BPE (
default_token_budget = 16,384): 256 byte tokens + heap-indexed merges + continual freeze +BPE1merge-table serialization (vocab.axiom), achieving 0<UNK>tokens and byte-exact UTF-8 roundtrips. - Upgraded binary checkpoints from 56-byte
AXIOM_V1to 64-byteAXIOM_V2embedding a 64-bit FNV-1a vocabulary checksum verified strictly before mutating VRAM or overwriting vocabularies during continual training and chat/API loads.
- Replaced whitespace word-splitting completely with native Byte-Level BPE (
Every architectural constant originates in core/include/shared_params.h and re-exports cleanly through core/include/config.hpp (struct Config & namespace config):
// core/include/shared_params.h — Canonical C / C++ / CUDA Macros
#define AXIOM_VOCAB_SIZE 151936U // 128-aligned frontier capacity (BPE + multimodal byte slots)
#define AXIOM_TOKEN_DIM 2048U // Hidden state width D
#define AXIOM_CONTEXT_WINDOW 1024U // Training sequence length S (12 GB VRAM budget)
#define AXIOM_NUM_HEADS 32U // Query heads (head_dim = 2048 / 32 = 64)
#define AXIOM_NUM_KV_HEADS 8U // Key/Value heads (4:1 GQA for mmap inference)
#define AXIOM_HEAD_DIM 64U // <= MAX_HEAD_DIM (64)
#define AXIOM_FFN_DIM 6144U // SwiGLU hidden width (3 * D, 256-aligned)
#define AXIOM_PAGED_TOTAL_BLOCKS 2048U // 2048 * 16 = 32,768 max paged KV context
#define AXIOM_PAGED_BLOCK_SIZE 16U // Physical tokens per KV page
#define AXIOM_ROPE_THETA 1000000.0f // RoPE base frequency (long context)
#define AXIOM_NORM_EPSILON 1e-6f // RMSNorm stability epsilon
#define AXIOM_Weight_LAYERS 24U // Default stacked GQA mmap layer countCompile-time static_assert invariants guard every alignment rule:
VOCAB_SIZE % 128 == 0,TOKEN_DIM % NUM_HEADS == 0,NUM_HEADS % NUM_KV_HEADS == 0HEAD_DIM <= MAX_HEAD_DIM (64),HEAD_DIM * NUM_HEADS == TOKEN_DIM,FFN_DIM % 256 == 0FAN_IN_DIM == CONTEXT_WINDOW * TOKEN_DIM (2,097,152)ram_buffer_size % context_window_size == 0(4,194,304 % 1024 == 0)
| Parameter | Active Training Profile (config.hpp) |
Stacked GQA mmap Inference (AxiomModelConfig) |
|---|---|---|
| Transformer Depth |
default_training_layers = 4 causal blocks |
num_layers = 24 stacked GQA blocks |
| Hidden / FFN Width |
D = 2048, FFN = 6144 SwiGLU |
D = 2048, FFN = 6144 SwiGLU |
| Attention Geometry |
32 heads (head_dim = 64), RoPE |
32 Q / 8 KV (4:1 GQA, head_dim = 64), RoPE |
| Vocabulary / Embeddings |
default_vocab_size = 32,768 allocated, 16,384 BPE budget, tied LM head |
VOCAB_SIZE = 151,936, tied or untied (AXIOM_Weight_LAYERS) |
| Parameter Count |
285.2M (218,120,192 xform + 67,110,912 emb @ V=32,768) |
~1.47B (tied) / ~1.78B (untied) |
| Optimizer / Regularization |
lr = 0.0003f, beta1 = 0.9, beta2 = 0.95, weight_decay = 0.01, accum = 16, clip = 1.0
|
Inference-only (read-only MapViewOfFile DMA) |
| Weight Initialization | Uniform 1337
|
Pre-converted binary XIOM v2 arena |
| Context Length |
1,024 tokens per window (16,384 tokens/step across accum=16) |
Up to 32,768 tokens (PagedBlockManager) |
Axiom moves corpora from NVMe disk to Tensor Core registers via a decoupled 4-tier pipeline designed to keep host RAM around ~174 MB while maintaining PCIe saturation:
graph TB
subgraph T0["Tier 0: Persistent NVMe Disk (core/)"]
Assets[("asset_sample/<br/>PDF, DOCX, TXT, MD, Code, JPEG, PNG, BMP, WAV, OGG, MP3, MP4, MKV")]
Ocean[("database/embedded_data.bin<br/>Shuffled uint32_t Training Ocean")]
Ckpt[("training/weights.axiom (AXIOM_V2 + TXF3)<br/>training/vocab.axiom (AXVK + BPE1)")]
end
subgraph T1["Tier 1: Host Ingestion, SPSC Prefetch Ring & Seam (~80 MB Max)"]
ID["Identifier Switchboard + Hardened Decompressors"]
BPE["Native Byte-Level BPE Trainer / Cached Encoder (16,384 vocab, 0 UNK)"]
Split["Stratified 10-Block Val Split + 64K-Block Ocean Shuffle"]
Pool["Active Pool (4,194,304 uint32_t = 16 MB)<br/>+ Lock-Free ChunkRingBuffer<4> (64 MB)<br/>+ token_seam_carry (1,024 tok continuity)"]
end
subgraph T2["Tier 2: Pinned Host Memory Bridge (PCIe DMA)"]
PinH2D["Ping-Pong Write-Combined Host Buffers [0, 1]<br/>1,024 x uint32_t = 4.00 KB per micro-step"]
PinD2H["Cached Readback Slot (cudaHostAllocDefault)<br/>5-float Telemetry Block (Loss, ||G||^2, NaNs, Dead, ||y||^2)"]
end
subgraph T3["Tier 3: RTX 4080 sm_89 VRAM & Dual Non-Blocking Streams"]
Gather["Stream 0/1 Gather Kernel -> [1024, 2048] BF16 (4.00 MB)"]
Stack["4-Layer Transformer Stack (RMSNorm + RoPE + Causal SDPA + SwiGLU)"]
Readout["Final RMSNorm + Tied BF16 LM Head + Tiled FP32 Cross-Entropy"]
Back["Accumulated Backward (1/16 scale) + Recency Scatter -> apply_global_adamw"]
Barrier["cudaEvent compute_done[0/1] Strict Step Ordering"]
end
Assets --> ID --> BPE --> Split --> Ocean
Ocean --> Pool --> PinH2D
PinH2D -. "Async H2D DMA" .-> Gather --> Stack --> Readout --> Back --> Barrier
Back <--> Ckpt
BPE <--> Ckpt
Readout -. "Async D2H Readback" .-> PinD2H
- Single-Handle
std::ifstream(optimizer.cpp): Opens the token ocean file once, eliminating per-batch OS syscall open/close overhead. When the entire training ocean fits insideram_buffer_size(4,194,304tokens =16.00 MB),main.cppbypasses background disk I/O in Single-Pool RAM Mode (0prefetch thread overhead). - Lock-Free SPSC Prefetch Ring (
ChunkRingBuffer<4>): For oceans exceeding 16 MB, a background producer thread prefetches up to 4 × 4M-token chunks (64 MB) using cache-line-aligned (alignas(64))write_index/read_indexatomics with acquire/release ordering—eliminating disk stalls between pools. - Carry-Forward Seam (
token_seam_carry): Across consecutive pool boundaries within an epoch, the lastcontext_window(1,024) tokens carry forward so sliding context windows spanning a 16 MB pool cut are never dropped. - Validation Stratification & Block Shuffle (
prepare_training_ocean): Samples 10 balanced slices across the staging ocean intovalidation_token_ids(held out in RAM, evaluated cleanly without gradient updates) and globally permutes65,536-token blocks (chunk_tokens) intoembedded_data.binto destroy single-document sequential correlation. - 4 KB Token-ID PCIe Streaming: Only compact
uint32_ttoken IDs (1024 × 4 B = 4.00 KB) cross PCIe per forward window instead of materializing4.00 MBBF16 vectors on the CPU; the GPUlaunch_gather_embeddings_batchedkernel expands them directly from VRAMd_table.
Identifier::detect_magic_bytes() inspects raw file headers before trusting extensions, neutralizing spoofing and accidental binary ingestion:
| Format | Detected Signatures / Validation Guards | Routed Modality |
|---|---|---|
%PDF- magic scan within header window |
ModalityCategory::DOCUMENT |
|
| DOCX / ZIP / GZ | PK\x03\x04 (+ .docx extension dispatch) / 0x1F 0x8B |
DOCUMENT / ARCHIVE |
| JPEG / PNG / GIF / TIFF | FF D8 FF • 89 50 4E 47 0D 0A 1A 0A • GIF87a/89a • II*\0 / MM\0* |
IMAGE |
| BMP | 'BM' header plus zeroed reserved bytes [6..9] and valid DIB header size (12, 40, 52, 56, 64, 108, 124) so plain text like "BMW" is never misclassified |
IMAGE |
| RIFF Containers | 'RIFF' + subtype WEBP / WAVE / AVI |
IMAGE / AUDIO / VIDEO |
| OGG / FLAC / MP3 | OggS • fLaC • ID3v2 or validated MPEG frame bits (rejecting reserved version/layer/bitrate/sample-rate combinations) |
AUDIO |
| MP4 / MKV / WebM | 'ftyp' at offset 4 (MP4), EBML 1A 45 DF A3 (MKV/WebM) |
VIDEO |
| Plain Text / Code | Rejects NUL bytes or excessive non-whitespace control characters (never labels binary .txt/.csv as text) |
DOCUMENT (or UNKNOWN_BINARY) |
| Module | Verified Capabilities |
|---|---|
Documents (decompress_document.cpp) |
Decompresses PDF FlateDecode streams via zlib (inflateInit2), respects /Length when verified, resolves /ToUnicode CMap tables + <hex> strings + octal escapes, merges kerned TJ glyph arrays into clean words, drops DCTDecode/JBIG2Decode image streams & high-entropy garbage (is_valid_token alphanumeric threshold). Parses DOCX ZIP entries, joins split <w:t> runs without inserting mid-word spaces, and decodes XML entities. |
Images (decompress_image.cpp, compress_image.cpp) |
Decodes uncompressed 24-bit BMPs (rejecting oversized pixel claims/RLE traps via std::memcpy), parses JPEG SOF resolution markers, inflates PNG IDAT streams via zlib reconstructing Sub/Up/Average/Paeth scanline filters to RGB24, and roundtrips visual tokens (VISUAL_START_ID..VISUAL_END_ID) back to valid BMPs with 100% bit-accurate pixel fidelity. |
Audio (decompress_audio.cpp, compress_audio.cpp) |
Parses RIFF/WAVE containers (honoring even-byte chunk padding, rejecting 0-channel headers), extracts OGG/MP3 metadata/bitstreams (compressed_bitstream flagged cleanly for telemetry), and roundtrips acoustic tokens (ACOUSTIC_START_ID..ACOUSTIC_END_ID) to standard PCM .wav containers bit-accurately. |
Video (decompress_video.cpp) |
Extracts MP4 width/height from tkhd 16.16 fixed-point matrices + mdat payloads, and parses MKV EBML headers. |
Implemented in core/include/parser.hpp and core/util/parser.cpp, Axiom’s tokenizer eliminates <UNK> collapse while unifying all modalities inside one dense codebook (VOCAB_SIZE = 151,936):
[ 0 .. 3 ] Special Controls : <PAD>=0, <UNK>=1, <BOS>=2, <EOS>=3
[ 4 .. 259 ] Visual Codebook : 256 quantized byte values (0x00..0xFF)
[ 260 .. 515 ] Video Codebook : 256 disjoint quantized bytes (0x00..0xFF)
[ 516 .. 771 ] Acoustic Codebook: 256 disjoint quantized bytes (0x00..0xFF)
[ 772 .. 151,039] Text BPE Space : 772..1027 = 256 raw UTF-8 byte primitives
1028+ = learned BPE merges (default budget: 16,384)
[151,040..151,551] Expansion : 512 reserved slots for future modalities
[151,643..151,645] Chat Delimiters : <|endoftext|>=151643, <|im_start|>=151644, <|im_end|>=151645
Packing visual/video/acoustic bytes right after <EOS> at [4..771] guarantees compute_active_vocabulary() returns a tight Tensor-Core-8-aligned bound (~17,160 for a 16K BPE vocab + media, instead of jumping to 151,040 empty rows!).
-
Lossless Pre-Tokenization (
split_pre_tokens):- Partitions arbitrary UTF-8 strings cleanly into word runs (optional single leading space + ASCII letters or UTF-8 multi-byte sequences up to 128 B), digit groups (1–3 digits), newlines (
\n/\r\n), space runs, and symbol clusters—strictly preservingconcat(pieces) == raw_text.
- Partitions arbitrary UTF-8 strings cleanly into word runs (optional single leading space + ASCII letters or UTF-8 multi-byte sequences up to 128 B), digit groups (1–3 digits), newlines (
-
256-Byte Complete Base Alphabet (
register_base_bytes):- Seeds every byte
0x00..0xFFdirectly at[vocab::TEXT_START_ID .. vocab::TEXT_START_ID + 255]. Because every byte is always representable, unseen words, camelCase identifiers, inflections, LaTeX operators, and Unicode characters never emit<UNK>.
- Seeds every byte
-
Incremental Inverted-Index Heap Trainer (
train_from_counts):- Counts unique pre-token frequencies across documents (caching extracted document text up to 128 MB to avoid redundant PDF/DOCX decompression).
- Maintains
pair_counts, inverted word-location lists (pair_words), and a deterministicstd::priority_queuekeyed by(count, pair_key). Each merge updates only pre-tokens containing the merged pair untilcount < max(2, min_frequency)ordefault_token_budget(16,384) is filled.
-
Continual-Training Freeze (
preserve_vocabulary = true):- Before tokenizing a new corpus onto an existing checkpoint,
execute_training_sessionloadsvocab.axiom, verifies its 64-bit checksum againstweights.axiom, locks all existing token IDs and merge ranks untouched, applies prior merges first, and appends new merges strictly at unused IDs>= next_text_id(deferring overwritingvocab.axiomuntil the pairedweights.axiomcheckpoint saves successfully).
- Before tokenizing a new corpus onto an existing checkpoint,
-
Cached Inference Encoding & Lossless Decode (
encode_byte_tokens/decode_byte_tokens):- Pre-tokenizes prompt text
$\rightarrow$ maps bytes to[772..1027]$\rightarrow$ merges lowest-rank active pairs greedily$\rightarrow$ emits exact IDs (with pre-token piece caching and zero dictionary mutation during inference). Concatenating decoded strings recovers exact UTF-8 bytes verbatim.
- Pre-tokenizes prompt text
-
Canonical 64-Bit Vocabulary Checksum (
compute_vocabulary_checksum):- Traverses
(id, token_bytes)sorted ascending by(id, string)plus every ordered(left_token, right_token, merged_token)merge tuple using 64-bit FNV-1a (offset = 14695981039346656037ULL,prime = 1099511628211ULL), making the hash independent ofstd::unordered_mapbucket order.
- Traverses
1. Sequence-Parallel Causal Transformer Layer (transformer_forward_block / transformer_backward_block)
Each layer [S, D] ([1024, 2048]) BF16 hidden states asynchronously on stream
-
Out-of-Place Pre-Attention RMSNorm (
normalize_tokens_out): Computes row-wise warp-reduced RMS scale$r = \left(\frac{1}{D}\sum_{i=1}^D x_i^2 + \epsilon\right)^{-1/2}$ ($\epsilon = 10^{-6}$ ) and scales by learnable FP32-masterattention_scale($\gamma_{\text{attn}}$ ). -
Q/K/V Batched Projections: Three CUTLASS Tensor Core GEMMs projecting
$[S \times D] \cdot W_{Q,K,V} \to [S \times D]$ . -
Rotary Position Embeddings (
launch_rope_sequence): Rotates adjacent half-dim pairs$(v_0, v_1)$ per head with frequencies$\omega_j = \theta^{-2j / d_h}$ ($\theta = 10^6$ ,$d_h = 64$ ) across positions$0 \dots S-1$ . -
Fused Causal Attention (
fused_causal_attention&fused_causal_backward): Enforces strict causal causality ($t \ge \tau$ cannot influence$t < \tau$ ). Output projects via$W_O$ and adds directly into the residual stream (tensor_add_inplace_kernel, 0 copies). -
Pre-FFN RMSNorm + SwiGLU FFN (
swiglu.cu):- Computes
$G = \hat{X} W_{\text{gate}}$ ,$U = \hat{X} W_{\text{up}}$ ($F = 6144$ ). -
Forward:
$\text{SwiGLU}(G, U) = \text{Swish}(G) \cdot U = (G \cdot \sigma(G)) \cdot U$ . -
Analytical Backward: Evaluated directly against FP64 references in
test_loss.cu:$$\frac{\partial \mathcal{L}}{\partial U} = \delta \cdot (G \cdot \sigma(G)), \qquad \frac{\partial \mathcal{L}}{\partial G} = \delta \cdot U \cdot \left[\sigma(G) + G \cdot \sigma(G)\big(1 - \sigma(G)\big)\right]$$ - Projects down via
$W_{\text{down}}$ and adds into the residual stream.
- Computes
-
Tied LM Head GEMM: Computes
Y[S × V]logits using CUTLASS v4.8.0 (ThreadblockShape<64,64,32>,WarpShape<32,32,32>,InstructionShape<16,8,16>BF16mma.sync) with an in-register EVT epilogue (VisitorAccFetch + VisitorRowBroadcast) for dense linear/bias projections without VRAM roundtrips. -
FP32 Tiled Cross-Entropy (
compute_ce_tile_kernel):- Online log-sum-exp softmax reduction starts at
v = 1whenevervocab_size > 1, completely excluding<PAD>(0) from both the partition function denominator and argmax prediction. - Ignores target tokens equal to
vocab::PAD(0) orvocab::UNK(1), normalizing loss and logit gradient$\frac{\partial \mathcal{L}}{\partial z_v} = \frac{p_v - \mathbb{1}[v = y]}{N_{\text{valid}} \cdot T}$ strictly by valid non-ignored targets in FP32 before scattering back into embeddings.
- Online log-sum-exp softmax reduction starts at
-
Embedding Recency Scatter Parity:
backward_scatter_embeddings_kernelapplies the exact matching forward lag factor$\text{lag}^{-3/4} = (\text{num_tokens} - t)^{-3/4}$ cleanly viaatomicAddinto FP32d_grad_table/d_table_master.
- Across
gradient_accumulation_steps = 16consecutive 1,024-token windows (16,384 tokens per optimizer update), backward kernels scale gradients by$1/16$ and accumulate into per-tensor FP32 gradient buffers (query_gradient,key_gradient, ...,d_grad_table,final_scale_gradient). -
Pass 1 (Global Squared L2 Reduction):
accumulate_norm_squaredsums$|\nabla \theta|_2^2$ across active embeddings, readout RMSNorm, and every transformer matrix/norm parameter, recording total pre-clip norm intod_loss[telemetry_gradient_square]. -
Pass 2 (Clip & FP32 Master Update + BF16 Sync):
fused_matrix_adamw_kernelrescales all gradients uniformly if$|\mathbf{g}|_2 > \text{max_gradient_norm} = 1.0$ , updates FP32 master weights ($m_t, v_t$ with$\beta_1 = 0.9$ ,$\beta_2 = 0.95$ ,$\epsilon = 10^{-8}$ , weight decay$0.01$ on projection matrices and$0.0$ on RMSNorm scales), and rounds back to BF16 tensor-core copies.
-
Trained Checkpoint Decoding (
step_trained_transformerinai.cpp):- Prompt tokens prefill sequentially (
0 .. prompt_len - 1) into pre-allocated per-layertrained_key_caches/trained_value_caches(D = 2048), followed by$O(1)$ -per-step KV-cached decoding up tomax_seq_len_cap = 32,768.
- Prompt tokens prefill sequentially (
-
4:1 GQA Memory-Mapped Engine (
load_axiom_model_mmap+forward_transformer_step):- Streams
24-layer GQA (32 Q / 8 KV,D = 2048,FFN = 6144,V = 151,936) models via read-only Win32CreateFileMappingA/MapViewOfFiledirectly into VRAM. - Uses
append_paged_kv_kernelandpaged_gqa_decode_kernel: 4 warps per block split time steps across KV pages (KV_PAGE_BLOCK_SIZE = 16), load the query into shared memory, accumulate online-softmax dot products across warps with__shfl_xor_sync, and normalize across the 4:1 GQA head group mapping (kv_head = q_head / (num_q_heads / num_kv_heads)).
- Streams
-
PagedBlockManager(core/include/paged_cache.hpp): Allocates fixed 16-token physical VRAM blocks in$O(1)$ , tracks per-block reference counts, forks parent contexts without copying (retain_physical_block), and performs intra-block Copy-On-Write duplication only when a forked child sequence diverges inside a shared block. -
Sampling Engine (
core/src/interface.cpp):- Builds an
allowed_tokenmask strictly from mapped dictionary IDs +<EOS>, blocking<PAD>,<UNK>,<BOS>, unmapped ID holes, and<EOS>during the first 4 decode steps (step < 4). - Hoists
std::mt19937_64PRNG outside the decode loop, applies repetition penalty (1.35f) across a 64-token recent lookback window, scales by$1/T$ , filters Top-K (40), re-normalizes Top-K probabilities before applying Top-P nucleus cutoff (0.9f), and invokes streaming callbacks (byte_pair_enabledemits exact subword strings without extra space insertion).
- Builds an
-
Null
$\rightarrow$ Free$\rightarrow$ Neutralize Discipline: Every host/device teardown follows strict null-checking, freeing, and= nullptrneutralization (free_gpu,free_legacy_gpu_weights,free_gpu_embeddings,release_inference_model). -
Stream-Event-Deferred BFC Arena (
caching_allocator.cu):- Starts with a 64 MB 256-byte-aligned VRAM arena (16 MB constrained fallback) supporting Best-Fit-with-Coalescing splitting and fallback
cudaMallocAsync/cudaMalloctracking (fallback_blocks). - Crucially,
deallocate(ptr, stream)records acudaEvent_t(event_pending = true) rather than returning async scratch buffers (such as SDPAd_stats) to the free pool prematurely—coalescing blocks only oncecudaEventQuery(release_event) == cudaSuccess. During CUDA Graph stream capture, allocations route safely around async pool mutations.
- Starts with a 64 MB 256-byte-aligned VRAM arena (16 MB constrained fallback) supporting Best-Fit-with-Coalescing splitting and fallback
-
Uncached vs. Cached Pinned Memory (
memory_allocation.cu):-
H2D Streaming (
pinned_alloc): UsescudaHostAllocWriteCombinedto bypass CPU L1/L2/L3 caches straight into PCIe writes. -
D2H Telemetry (
pinned_alloc_readback): Uses cacheablecudaHostAllocDefaultforh_pinned_loss(telemetry_slot_count = 5) and validation loss readbacks so CPU polling suffers zero uncached PCIe read stalls.
-
H2D Streaming (
-
Sparse MoE & CUDA Graphs & ATen
TensorSubsystems:-
8-Expert Top-2 MoE (
moe_router.cu): Softmax top-2 routing per token (expert_first/second, renormalized gates, atomic load-balance histogram) with 1024-wide shared-memory-tiled SwiGLU forward and backward kernels (moe_top2_dispatch_kernel,moe_top2_backward_kernel). -
CUDA Graph Capture (
cuda_graph_capture.cu): Captures the full computation graph and advances optimizerstep_countand dynamiclearning_ratevia GPU-resident pointers (active_step_counter,active_learning_rate) rather than baking stale host constants. -
C++23 Strided
Tensor& Autograd (tensor.hpp): Reference-countedTensorImplementationwith deleted copy constructors,storage_ownerlifetime retention on views/transposes, stride-aware ops, and device/dtype validation. (Note: MoE, CUDA Graphs,PagedBlockManager, andTensorare verified in unit tests and modularized for production wiring; main bulk training currently runs dense 4-layer Causal SwiGLU + tied LM head.)
-
8-Expert Top-2 MoE (
Every saved checkpoint passes NaN/Inf validation across weights, biases, embeddings, RMSNorm gamma scales, and attention/FFN matrices, writes to <path>.tmp, and atomically swaps onto the target path:
Offset Size Field Description
0x00 8 magic[8] "AXIOM_V2" (64B) | Legacy: "AXIOM_V1" (56B)
0x08 8 input_elements_x_total Expected S * D (default 1024 * 2048)
0x10 8 target_elements_y_total Expected D (default 2048)
0x18 8 weight_count Flat perceptron float count (0 when transformer-only)
0x20 8 bias_count Flat perceptron bias float count (0 when transformer-only)
0x28 8 vocab_size Allocated embedding rows (e.g., 32,768)
0x30 8 embedding_dim Embedding vector width D (2048)
0x38 8 vocabulary_checksum [V2 ONLY] Canonical 64-bit FNV-1a hash of vocab.axiom
--------------------------------------------------------------------------------------------
Payload:
[weight_count * 4B float] Legacy flat weights (if any)
[bias_count * 4B float] Legacy flat biases (if any)
[vocab_size * embedding_dim * 4B] FP32 master embedding table
[uint64 magic = 0x54584633 ("TXF3")] Transformer block marker (supports legacy TXFM / TXF2)
[uint64 layers, dim, ffn] Layer topology (e.g., 4, 2048, 6144)
[dim * 4B float] Readout final RMSNorm gamma (TXF3+)
Per layer l = 0 .. layers-1:
Q, K, V, O (each dim*dim*4B float)
Gate, Up, Down (each dim*ffn*4B float)
attention_scale[dim], feedforward_scale[dim] (FP32 RMSNorm gammas)
- Hard Checksum Rejection:
AI::load_weights(path, expected_checksum)andAI::verify_weight_checksum()abort immediately with hex diagnostics iffile_checksum != expected_checksum(expected != 0), leaving all live host buffers and GPU VRAM completely untouched.
[4B magic = "AXVK"]
[8B uint64 vocab_size]
Repeated vocab_size times:
[4B uint32 len] [len bytes UTF-8 / raw byte token] [4B uint32 id]
Optional BPE Trailer (always appended when byte_pair_enabled == true):
[4B magic = "BPE1"]
[8B uint64 merge_count]
Repeated merge_count times:
[4B uint32 left_token] [4B uint32 right_token] [4B uint32 merged_token]
64-byte header (magic = 0x4D4F4958U, version = 2U, num_layers, hidden_dim, num_q_heads, num_kv_heads, head_dim, feedforward_network_dimension, vocab_size, max_seq_len, rms_norm_eps, rope_theta) followed by packed BF16 embed_tokens + L layers (input_layernorm, Q/K/V/O weights & biases, post_attn_layernorm, Gate/Up/Down weights) + final_norm_weight + optional untied lm_head_weight.
1. Native C-ABI Shared Library (build/axiom_core.dll — axiom_c_api.cpp)
Thread-safe multi-session extern "C" interface usable from Python (ctypes), C, Rust, or C#:
| Exported Symbol | Purpose |
|---|---|
axiom_required_size / axiom_extract_document |
Hardened PDF/DOCX/Audio extraction with UTF-8 boundary clamping (clamp_utf8_boundary). |
axiom_create_engine / axiom_destroy_engine |
Opaque per-session handle (EngineSession) protected by per-session std::mutex. |
axiom_load_engine(handle, model_path, vocab_path) |
Auto-detects "AXIOM_V1"/"AXIOM_V2" trained checkpoints vs. "XIOM" v2 GQA mmap files and enforces 64-bit vocab checksum verification. |
axiom_generate_engine(handle, prompt, out, max_len, tokens, temp) |
Thread-safe generation with BPE space-preservation and UTF-8 safe truncation. |
axiom_load_model / axiom_generate_text / axiom_free_model |
Convenience single-default-session wrappers (default_session). |
gen_corpus.py&gen_corpus.c: Unified layout-aware extractors (Python / C11 MSVCmupdfcpp64or POSIXlibmupdf) converting PDF/DOCX/TXT/MD/images into normalized.mdprose/math/tables/code + filtered.pngfigures (<output>/text/*.md,<output>/images/*.png) ready forasset_sample/training ingestion.
Architecture Specs:
We_Know/plan/Spector.md•We_Know/plan/osint.md•Cherry Studio Guide
| Component | Path | Technical Capabilities |
|---|---|---|
| OSINT Orchestrator | We_Know/orchestrator.py |
Connects to build/axiom_core.dll via ctypes for native C++ PDF/DOCX/WAV extraction + VRAM eviction management (VRAMController) for local Analyst/Vision LLMs. |
| Tier 1: Specter MCP | Specter_MCP.py |
Stateless 5-tool (research) / 17-tool (full) OSINT & sensory server (web_search, fetch_page, run_full_cycle, case_status, scan_geo_events) integrating DuckDuckGo, NASA FIRMS thermal anomalies, USGS geo-events, NATO Admiralty grading, RFC 9309 robots.txt compliance, and ICD-203 SHA-256 dossiers. |
| Tier 2: Browser Sandbox MCP | Browser_Sandbox_MCP.py |
7 Playwright Chromium/Edge SPA tools (sandbox_open_url, sandbox_get_elements, sandbox_click_element, sandbox_type_text, sandbox_scroll_page, sandbox_read_text, sandbox_close_session) with clean cookie isolation. |
| Tier 3: Browser Live CDP MCP | Browser_Live_MCP.py |
9 loopback CDP (127.0.0.1:9222) tools (live_list_tabs .. live_disconnect_session) controlling a docked browser window without touching OS cursor or focus. |
| UI Workspace | ui/frontend/, ui/backend/ |
React 19 + Vite frontend scaffold (npm run dev/build/lint) + Express/Node backend scaffold (core/third_party/ui also houses reference UIs: AnythingLLM, Cherry Studio, Open WebUI). |
All figures below come directly from the verified December 2, 2026 run captured in output.md on an NVIDIA GeForce RTX 4080 Laptop GPU (12 GB VRAM, sm_89, 192-bit / 432.0 GB/s, 67.7 peak dense BF16 TFLOPs):
- Vocabulary:
16,384active tokens (256base bytes +16,128BPE merges,0 <UNK>). - Ocean Split:
9,435,951train tokens (144globally shuffled65,536-tok blocks,36.0 MB) +1,048,439stratified held-out validation tokens (10blocks). - Footprint:
173.91 MBprocess host RAM,80.00 MBstreaming pool/ring max,7,253.00 MBfree GPU VRAM during training.
| Checkpoint | Step | Train Loss | Rolling Loss | Val Loss | |G| |
Dead % | Throughput | Elapsed |
|---|---|---|---|---|---|---|---|---|
| Epoch 1 | 9,215 / 36,860 | 3.6837 | 7.7251 | 3.9137 | 0.73 | 0.0% | 16,905 tok/s | 9m 19s |
| Epoch 2 | 18,430 / 36,860 | 3.0405 | 6.0137 | 3.2907 | 0.81 | 0.1% | 17,186 tok/s | 18m 21s |
| Epoch 3 | 27,645 / 36,860 | 2.6340 | 4.7759 | 3.0507 | 0.66 | 0.1% | 17,309 tok/s | 27m 20s |
| Clean Stop (87%) | 32,000 / 36,860 | 2.6679 (-73%) | — | 3.0041 (~20.2 PPL) |
0.67 | 0.1% | 17,306 tok/s | ~32m |
[STAGE 1/3] 100 KV-Cached Decode Steps (4-Layer + Readout + Tied LM Head, D=2048, FFN=6144, V=32768)
┌────────────────────────────────────────────────────────────────────────┐
│ 1. PREFILL LATENCY (TTFT) : 2.0 ms │
│ 2. DECODE THROUGHPUT : 552.6 tok/s ( 1.81 ms/tok) │
│ 3. MEMORY BUS SATURATION : 315.3 GB/s ( 73.0% of Peak) │
│ 4. COMPUTE EFFICIENCY (MFU): 0.5% MFU (KV-Cached Decode) │
└────────────────────────────────────────────────────────────────────────┘
[STAGE 2/3] Dynamic VRAM Allocation & Vectorized GDDR6 Bandwidth Stress (2.00 GB OS Headroom)
[OK] Allocated 3.69 GB tensors | 369.3 GB/s GDDR6 streaming (85.5% of physical bus) | 100% pass
[STAGE 3/3] CUTLASS EVT Tensor Core Saturation Sweep (M=2048, N=4096, K=4096, 68.7 GFLOPs/sweep, 1,000 sweeps)
┌────────────────────────────────────────────────────────────────────────┐
│ 1. SUSTAINED COMPUTE POWER : 61.6 TFLOPs (BF16 Dense Tensor Cores) │
│ 2. COMPUTE EFFICIENCY (MFU): 91.0% MFU (Peak Saturation) │
│ 3. MEMORY BUS SATURATION : 369.3 GB/s ( 85.5% of Peak) │
│ 4. VRAM STRESS ALLOCATION : 3.69 GB (2.00 GB Safe OS Headroom)│
│ 5. FUSED EVT SWEEP TIME : 1.12 ms (100.0% Boost Stability) │
└────────────────────────────────────────────────────────────────────────┘
Streaming at 247.9 – 330.7 tok/s from a pure base completion checkpoint (weights.axiom verified AXIOM_V2):
- Greedy (
Temp: 0.00): Switched domain accurately across prompts (C++11 pointers/errorsvoid f(int n)/char*, CUDA6.2.1.3 The Memory Modelthread blocks, MLmaximum likelihood estimate), exhibiting classic base-model argmax loops (make_sum/ section headers repeating). - Sampled (
Temp: 0.70): Eliminated repetition loops cleanly—generating valid C++ declarations & array-of-bytes explanations, pipelined computer architecture prose (two-way set associative,Figure C.8), and ML statistics exercises (mean and variance,weight matrices). Full unedited transcripts reside inoutput.md.
PROJECT-AXIOM/
├── .github/workflows/license_linter.yml # Automated CI statutory license header audit
├── .clang-format & .todo # 8-tab formatting rules & full engineering registry
├── CMakeLists.txt & Makefile # Root build wrappers with AXIOM_ACCEPT_LICENSE=ON gate
├── LICENSE & tdmrep.json # Proprietary source-available license & W3C TDM opt-out
├── output.md # Verified Dec 2 run assessment, benchmarks & chat logs
├── README.md # This complete technical reference (Dec 2, 2026)
├── build/axiom_core.dll # Synced C-ABI DLL for Python / external bindings
├── core/
│ ├── Makefile # NVCC (sm_89) + MSVC cl.exe + GCC UCRT64 C++23 build (-MMD -MP)
│ ├── include/
│ │ ├── shared_params.h # Unified C/C++/CUDA hyperparameters (V=151936, D=2048, S=1024)
│ │ ├── config.hpp # AXIOM_V2 / AXIOM_V1 headers, AxiomModelConfig, Config constants
│ │ ├── ai.hpp # AI orchestrator (training, KV-cache decode, mmap GQA, MoE, Paged, Graphs)
│ │ ├── parser.hpp # Native Byte-Level BPE state, 64-bit FNV-1a checksum & Parser API
│ │ ├── optimizer.hpp # 4M RAM Pool + Lock-Free SPSC ChunkRingBuffer<4> + Pinned Portion
│ │ ├── paged_cache.hpp # PagedBlockManager COW reference counting & free-page pool
│ │ ├── tensor.hpp # Strided BF16/FP32 TensorImplementation + AutogradTape
│ │ ├── telemetry.hpp # cudaEvent_t timer + compact/saturation HUD box renderer
│ │ ├── transfer.hpp # Host upload/download wrapper interface
│ │ ├── Identifier.hpp # Magic-byte & extension format switchboard
│ │ ├── compressor/ # compress_image.hpp (24-bit BMP), compress_audio.hpp (RIFF WAV)
│ │ └── decompressor/ # decompress_{document,image,audio,video}.hpp
│ ├── src/
│ │ ├── main.cpp # CLI parser, Interactive Menu, Training/Chat/Benchmark/Test entrypoints
│ │ ├── ai.cpp # AXIOM_V2 load/verify, step_trained_transformer, mmap GQA loader & decode
│ │ ├── training.cpp # 16-step accum train loop, TXF3/AXIOM_V2 atomic save, flush_accumulated_gradients
│ │ ├── interface.cpp # AI::generate (KV-cache + legacy fallback, Top-K/Top-P/RepPenalty) & predict
│ │ ├── axiom_c_api.cpp # Opaque EngineSession C ABI + UTF-8 boundary-clamped extractors
│ │ ├── cuda_graph.cpp, paged_cache.cpp, transfer.cpp
│ │ └── CUDA/
│ │ ├── transfer.cuh # Umbrella DLL export header
│ │ ├── gpu/ # upload.cu, download.cu (pinned & device transfers)
│ │ ├── kernel/
│ │ │ ├── forward_pass.cu # Gather, RMSNorm, CUTLASS EVT GEMMs, Causal SDPA, Transformer/Trained step
│ │ │ ├── backward_pass.cu # Tiled FP32 CE (mask PAD/UNK), Causal SDPA backprop, recency scatter, apply_global_adamw
│ │ │ ├── rmsnorm.cu # Warp-reduced BF16 RMSNorm & residual add
│ │ │ ├── rope.cu # RoPE rotation (θ=1e6) & backward rotation
│ │ │ ├── swiglu.cu # Forward SwiGLU & analytical Jacobian backward
│ │ │ ├── paged_gqa.cu # append_paged_kv_kernel & 4:1 GQA online-softmax decode
│ │ │ ├── moe_router.cu # Top-2 softmax router + 1024-tiled shared-memory SwiGLU FFN + backward
│ │ │ └── cuda_graph_capture.cu # Stream capture with GPU-resident step/LR scalars
│ │ └── util/
│ │ ├── caching_allocator.cu # Stream-event-deferred 256B-aligned BFC VRAM arena
│ │ ├── memory_allocation.cu # Pinned write-combined + cached readback allocs, deterministic hash init
│ │ ├── telemetry.cu # Dynamic sm_89 prop query & CUDA event helpers
│ │ ├── gpu_types.cuh # GpuPortion, GpuEmbeddings, GpuWeights, GpuActivations, TelemetrySlot
│ │ ├── cuda_utils.cuh & gpu_kernel.cuh
│ ├── util/ # identifier.cpp, optimizer.cpp, parser.cpp, compressor/*, decompressor/*
│ ├── test/
│ │ ├── test_*.cpp & test_header.hpp # 11 host/GPU integration suites (600 checks) + run_test.ps1
│ │ ├── test_sandbox_assets/ # Isolated fixtures (Photo.jpeg, Voice.ogg, 12.4 KB Video.mp4, etc.)
│ │ └── CUDA/
│ │ ├── test_loss.cu # Differential telemetry, SwiGLU Jacobian, FP64 CE parity (4 suites)
│ │ └── isolation/test_forward_backward.cu # Standalone CUDA transformer step convergence check
│ ├── tools/
│ │ ├── mcp/ # Specter_MCP.py, Browser_Sandbox_MCP.py, Browser_Live_MCP.py, Cherry Studio config
│ │ └── scripts/ # gen_corpus.py & gen_corpus.c layout-aware extractors
│ ├── asset_sample/, database/, models/, training/, pdfs/
│ └── third_party/ # cutlass (v4.8.0), osint tools (amass, sherlock, etc.), ui references
├── document/ # Chapters 00–15 technical docs + diagrams in document/ref/
├── ui/ # Node.js backend + Vite React 19 frontend scaffolds
└── We_Know/ # orchestrator.py + Specter OSINT architecture blueprints
- OS: Windows 10 / 11 (64-bit)
-
GPU: NVIDIA GPU Compute Capability
$\ge 8.0$ (Ada Lovelacesm_89, RTX 40-series recommended; overrideCUDA_ARCHincore/Makefilefor other SM targets) -
CUDA Toolkit:
v13.3(defaultCUDA_DIRincore/Makefile) -
Host Toolchains:
- MSVC Build Tools 2022 (
cl.exev14.4x, defaultMSVC_BINincore/Makefile) - MSYS2 UCRT64 GCC 14+ (
g++ -std=c++23),mingw32-make,zlib(-lz), Winsock2 (-lws2_32), PSAPI (-lpsapi)
- MSVC Build Tools 2022 (
$env:PATH = "C:\msys64\ucrt64\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\bin;" + $env:PATH
cd core
mingw32-make all # Compiles cuda_transfer.dll, app.exe, test.exe, test_loss.exe, test_forward_backward.exe, build/axiom_core.dllIndividual targets: mingw32-make app.exe • mingw32-make test.exe • mingw32-make dll • mingw32-make test_loss • mingw32-make test_forward_backward • mingw32-make clean.
(Root Makefile forwards all targets to core/ after enforcing AXIOM_ACCEPT_LICENSE=ON.)
cd core
.\test.exe --test
.\test_loss.exeVerified Suite Matrix (December 2, 2026):
| Binary / Suite | Verified Invariants | Passed | Status |
|---|---|---|---|
test_path |
Canonical core/, asset_sample/, models/, training/ resolution |
5 / 5 | PASSED |
test_ifstream |
Binary asset open & non-zero size checks | 6 / 6 | PASSED |
test_embeddings |
Deterministic BF16 embedding tables & codebook slot isolation | 18 / 18 | PASSED |
test_tokenization |
Byte-Level BPE (0 <UNK>, lossless UTF-8), BPE1 persistence, continual freeze, ocean shuffle |
63 / 63 | PASSED |
test_optimizer |
4M-token pool, SPSC prefetch ring, Seam carry-forward, token-ID streaming | 86 / 86 | PASSED |
test_cuda_transfer |
BF16 layout, H2D/D2H transfers, CUDA Graph, RoPE, CUTLASS EVT backprop | 59 / 59 | PASSED |
test_transfer |
Master host/GPU weight & bias upload/download parity | 7 / 7 | PASSED |
test_ai |
AXIOM_V2 64-bit vocab checksum mismatch rejection, AXIOM_V1 compat, TXF3 RMSNorm scales, Causal SDPA, MoE |
160 / 160 | PASSED |
test_inference |
PagedAttention COW, Top-K/Top-P sampling, BFC leak check, sub-56B/60B header rejection | 86 / 86 | PASSED |
test_identifier |
Recursive/non-recursive scans, magic bytes, binary-as-text rejection | 36 / 36 | PASSED |
test_decompressor |
Hardened PDF/DOCX/PNG/JPEG/WAV/MP4 parsers & 100% bit-accurate BMP/WAV codecs | 74 / 74 | PASSED |
test.exe Total |
All 11 Host & GPU Integration Suites | 600 / 600 | 100% GREEN |
test_loss.exe |
Differential telemetry, SwiGLU Jacobian (<PAD>/<UNK> mask |
4 / 4 | 100% GREEN |
Launching .\app.exe with no arguments opens the Interactive Menu:
[1] Chat with Axiom • [2] Run Tests • [3] Benchmark Hardware (Telemetry HUD) • [4] Bulk Training (asset_sample) • [5] Exit.
| Command / Flag | Function & Default |
|---|---|
.\app.exe --bulk [N] |
Ingest assets (asset_sample/ or --data <dir>), prepare shuffled ocean, train up to N steps (0 = all epochs), save AXIOM_V2 + AXVK/BPE1. |
.\app.exe --chat |
Interactive chat REPL (exit/quit, clear, temp <val>). Automatically resolves models/ and training/ checkpoints and enforces vocab checksum. |
.\app.exe --benchmark |
Run the 3-stage KV-Cached Inference + GDDR6 Bandwidth + CUTLASS Tensor Core Saturation HUD. |
.\app.exe --test |
Run verification suites inside app.exe and restore saved checkpoint via restore_brain(). |
.\app.exe --help (-h) |
Print complete operator manual. |
--weights <path> / --vocab <path> |
Override checkpoint / vocabulary paths (accepts = syntax, e.g., --weights=...). |
--lr <rate> / --epochs <N> |
Set AdamW learning rate (default 0.0003) / training epochs (default 4). |
--data <dir> / --min-count <N> |
Set training corpus folder (asset_sample) / minimum BPE merge threshold (3). |
--seed <N> / --target-loss <L> |
Set deterministic RNG seed (1337) / early-stop rolling loss threshold (2.2). |
--archive / --purge |
Move processed training files to archive/ or delete them automatically after bulk training. |
During Bulk Training Loop: Press [S] to flush & save checkpoint atomically, [R] to reset weights, or [Q] to save and exit cleanly.
- Phases 0 – 6 Complete: Modular CUDA DLL, CUTLASS EVT, BFC Allocator, SPSC Ring, Causal Transformer + SwiGLU, PagedAttention COW, CUDA Graphs, Sparse MoE, BMP/WAV Codecs, Hardened Decompressors, C-ABI DLL.
- December 2, 2026 Stability & Tokenizer Release: Native Byte-Level BPE (
0 <UNK>,BPE1),AXIOM_V264-bit vocabulary checksums, 16-step gradient accumulation, global L2 clipping (1.0), learnableTXF3RMSNormgamma,<PAD>/<UNK>masking, KV-cached trained decode, and 600 + 4 passing tests. - Immediate Chat & Inference Polish (Logged in
output.md):- Default
run_chat_enginesampling temperature to0.7f(with configurable repetition penalty;temp 0.0kept for greedy checks) to prevent deterministic base-model repetition loops out of the box. - Add an incomplete multi-byte UTF-8 trailing-byte buffer in chat & C-API token callbacks so rare non-ASCII characters split across consecutive BPE byte tokens flush cleanly without transient
U+FFFDreplacement glyphs. - Inspect console double-prompt echo artifact observed on Windows paste in
output.md.
- Default
- Training & Architecture Scaling:
- Execute full 66-file foundation run (
~25M+BPE tokens) using current16,384vocabulary to narrow the Epoch 3–4 train/val gap and target held-out validation loss< 2.5. - Evaluate a deeper, narrower transformer profile (
8–12 layers, D=1024, FFN=3072) for better reasoning depth and lower parameter/VRAM ratio than wide 4-layerD=2048. - Expose
--vocab-budget <N>CLI flag when scaling past100M+tokens or multilingual corpora, promote tested PagedAttention/MoE/CUDA Graph subsystems into main training/chat pipelines, and run post-pretraining SFT instruction tuning.
- Execute full 66-file foundation run (
Updated 2nd December 2026 • Copyright © 2026 Omid Teimory. All rights reserved.