THE OPEN NOTEBOOK · v1.7.3

A book for the curious.

112 chapters inside the Welvet AI engine, including NativeCPU, Qualcomm Hexagon HTP, Apple Metal, Apple MLX, NVIDIA CUDA, AMD ROCm, Vulkan, and Python C-ABI. Start with why it exists, then follow the ideas into layers, learning, and the systems that connect them.

New to the work? Start with Welvet in plain language, then read What Welvet is. For Apple MLX (v1.7, forward-only), see §110–§113 (sibling welvet.mlx). For Vulkan, see §103–§109 (sibling welvet.vulkan). For AMD ROCm, see §96–§102 (sibling welvet.rocm). For NVIDIA CUDA, see §89–§95. For Apple Metal, see §82–§88. For Qualcomm Windows NPU, see §79 QNN and §81 RESULTS. v1.7.3: Python C-ABI on PyPI — see §114–§117. Android Qualcomm Hexagon HTP (since v1.7.2) uses the same welvet.qnn path — see the Android QNN lab PDF and /welvet. Code examples and reported results below are preserved from the source edition. Read the complete book on one page →

112 entries

I · Orientation

What Welvet is

Loom’s flat poly/ package hit import-cycle and honesty walls (QAT morph, silent fallbacks, god-layer). Welvet is the rewrite: one feature per folder, storage-truth dtypes/quants, Dense as th

Read more

I · Orientation

Repository map

Readers need a single map of what is engine vs harness vs app vs stub.

Read more

II · Foundation

core: types & backends

Every polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata: without QAT morph defaults.

Read more

II · Foundation

weights: FormatNone MatVec

Unquantized matrices still need a typed store that streams MatVec and SGD without forcing a float32 master or Morph-as-training.

Read more

II · Foundation

quant: 20 pack formats

Inference, storage, and train need classic Q-packs, k-quants, IQ, Ternary/Binary, and Affine without a separate QAT mode or retained f32 master. Format is storage truth.

Read more

II · Foundation

simd: Plan 9 kernels

CPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.

Read more

II · Foundation

webgpu: device GEMV & shaders

GPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.

Read more

II · Foundation

tiling: SC/MC & workgroups

MatVec throughput depends on tile size and when to go multi-core vs GPU workgroups. Centralizing caps keeps Dense and friends consistent.

Read more

II · Foundation

architecture: volumetric grid

Networks are spatial (Depth×Rows×Cols×LayersPerCell), not only linear stacks. Topology lives here; compute lives in layer packages.

Read more

II · Foundation

fusedgpu: decoder on device

Token-by-token host round-trips kill decode. A fused engine keeps weights and scratch resident for Q4_0 and BinaryG128 hybrid paths.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: JSON backend placement

Choose which layers run on AMD GPU while retaining ordinary Go training entry points.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: mixed Go/C++/ROCm

Split a single model between the independent native engines and Go.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: results and suite pointers

Find the AMD sibling repo and live ROCm parity/timing matrices after the small usage chapters.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: mount and forward

Run a Go layer on a Vulkan GPU with an explicit lifetime via the independent welvet.vulkan library.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: Mamba parameter dtypes

Exercise native storage formats without changing the activation interface.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: training modes

Keep repeated training updates in the mounted Vulkan session.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: weight return and ENTITY save

Return trained weights to Go before executing or saving the Go model.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: JSON backend placement

Choose which layers run on Vulkan while retaining ordinary Go training entry points.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: mixed Go/C++/Vulkan

Split a single model between the independent native engines and Go.

Read more

XV · Vulkan acceleration (welvet.vulkan)

Vulkan: results and suite pointers

Find the Vulkan sibling repo and live go_v_vulkan matrices after the small usage chapters.

Read more

III · Layers

layers/dense: MatVec microkernel

Most FLOPs are W@x. One Dense stack owns FormatNone×34 and all quants × three backends so every composite proj shares one correctness surface: including native in-dtype SGD.

Read more

XVI · Apple MLX acceleration (welvet.mlx)

Apple MLX: SyncToMLX and forward

Run a Go Dense layer on Apple MLX GPU with an explicit SyncToMLX lifetime: forward-only, no Mount/TrainMSE twin.

Read more

XVI · Apple MLX acceleration (welvet.mlx)

Apple MLX: caps and dtype rejects

Unsupported mounts must hard-fail before any GPU work: not soft-fallback to Go labeled as MLX.

Read more

XVI · Apple MLX acceleration (welvet.mlx)

Apple MLX: Dense prepare and Sequential

Show prepare-once Dense execute and a small Sequential tower on the same MLX session.

Read more

XVI · Apple MLX acceleration (welvet.mlx)

Apple MLX: go_v_mlx results pointers

Find the sibling harness and live MLX parity matrices after the small usage chapters.

Read more

XVII · Python C-ABI (welvet on PyPI)

Python C-ABI: install and Dense forward

Use the same Welvet engine from Python via ctypes over a prebuilt C ABI: no Go toolchain required for day-to-day scripts.

Read more

XVII · Python C-ABI (welvet on PyPI)

Python C-ABI: list backends and pick one

Accelerators are opt-in at runtime. Scripts should probe what this host can run instead of hard-coding CUDA or Metal.

Read more

XVII · Python C-ABI (welvet on PyPI)

Python C-ABI: train SGD and .entity round-trip

Training and checkpoints should match the Go ENTITY path so Python scripts can hand off to Go apps (and back).

Read more

XVII · Python C-ABI (welvet on PyPI)

Python C-ABI: MHA place and prepare_grid

Not every layer is Dense. Python place takes the same kind strings as Go; some accelerators need an explicit prepare/Sync before forward.

Read more

III · Layers

layers/mha: attention

Transformers need multi-head attention with masks, RoPE/ALiBi, GQA/MQA, and cross-attn: without forking MatVec for every projection.

Read more

III · Layers

layers/swiglu: gated FFN

Modern decoder FFNs are SiLU(gate)⊙up → down. Projections must share Dense’s quant/backend matrix.

Read more

III · Layers

layers/rmsnorm

Llama-style blocks normalize by RMS, not mean+var. Needs native fwd/bwd and WebGPU shaders.

Read more

III · Layers

layers/layernorm

Classic mean+var normalization with γ/β: still required for many HF architectures.

Read more

III · Layers

layers/embedding

Token IDs must gather rows from a table: not a Dense MatVec: with scatter grads on backward.

Read more

III · Layers

layers/softmax

Classification heads and attention need stable softmax variants, including sparse/Gumbel/Entmax for research paths.

Read more

III · Layers

layers/sequential

Some cells need an ordered Dense chain without burning grid hops.

Read more

III · Layers

layers/residual

Skip connections stabilize deep stacks: y = F(x) + x with correct skip grads.

Read more

III · Layers

layers/cnn1 · cnn2 · cnn3

Conv nets must sit on the same dtype×quant×backend matrix as Dense. im2col → Dense GEMV is the intentional first cut.

Read more

III · Layers

layers/rnn · lstm

Sequence models before transformers still need vanilla RNN and LSTM with BPTT on the shared MatVec stack.

Read more

III · Layers

layers/seqmix: mixer contract

Attention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.

Read more

III · Layers

layers/gdn: gated delta net

Linear attention / decode-first mixers (Gated DeltaNet) need a first-class package under KindLinearAttn.

Read more

III · Layers

layers/mamba: selective SSM

SSM mixers (KindSSM) are not MHA clones: they need their own selective-scan path.

Read more

III · Layers

layers/convt1 · convt2 · convt3

Generators and U-Nets need transposed convolution as a peer of CNN, on the same Dense proj surface.

Read more

III · Layers

layers/kmeans

Soft clustering as a differentiable layer lets topology experiments sit inside the same train loop.

Read more

III · Layers

layers/parallel: MoE + cameral

Mixture-of-experts and multi-path cells need concat/add/avg/filter combines. Cameral graphs need sibling hemispheres that share input, merge outputs, and optionally train under distinct mode

Read more

III · Layers

layers/metacognition

Observed layers can apply heuristic stability rules (gate/scale/reset) without dtype morph/QAT.

Read more

IV · Runtime

runtime/forward

A grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.

Read more

IV · Runtime

runtime/backward

Training needs a reverse tape over the same ops forward used: no separate graph framework.

Read more

IV · Runtime

runtime/training

Suites and small nets need MSE+SGD and tween hooks without inventing an external trainer or a retained float32 master beside storage.

Read more

IV · Runtime

runtime/step: step mesh

Spatial feedback (remote links) needs a discrete-time mesh where every cell updates from a double buffer: different from a decoder wavefront. Cross-numeric train also needs the same mesh wi

Read more

V · Systems

systems/dna

Quant and train must be measurable as topology/weight fingerprints: DNA detects logic shifts.

Read more

V · Systems

systems/evolution

Topology search and weight crossover need first-class splice + NEAT on CPU-resident grids.

Read more

V · Systems

systems/tween

Target propagation (chain-rule or Hebbian layerwise gaps) is an alternative credit-assignment path. Not the same package as TrainMode Tween / TweenChain on a Sandwich (those are layers/paral

Read more

V · Systems

systems/tanhi: TANHI · UDP HUD

Training visualization must never block the engine: best-effort UDP JSON-lines to a HUD.

Read more

V · Systems

systems/telemetry

Static structural blueprints (sizes, op kinds) differ from live TANHI events.

Read more

VI · Model IO

model/entity: .entity files

HF safetensors are awkward for native topology + packed weights. ENTITY is the Welvet checkpoint.

Read more

VI · Model IO

model/hf: snapshots

Import starts with probing HF/MLX layouts before packing ENTITY.

Read more

VI · Model IO

model/tokenizer

Generate needs encode/decode of HF tokenizer.json without pulling Python.

Read more

VI · Model IO

model/sampling

Logits → token ID needs ArgMax, TopK+temperature, penalties, and chat hygiene in one place.

Read more

VI · Model IO

model/transformer: generate

ENTITY packs must run as Llama-style decoders with KV cache, profiles (SIMD/WebGPU/fused), and chat templates.

Read more

VII · Apps

apps: octo · flux2 · mosstts

Products must not pollute engine packages. Octo is the model shell; flux2/mosstts are domain apps. Lucy races (AAI test41 / test48 / test50) are benches, not Welvet packages.

Read more

VII · Apps

Octo: model shell

A model is only useful with a shell around it: pull weights from Hugging Face, convert them to a Welvet .entity, then chat, serve, or benchmark. Octo is that shell, kept in its own module so

Read more

VIII · Stubs

stub/seed

Ship topology recipes (layer seeds → He-init) without weight blobs.

Read more

VIII · Stubs

stub/serialization

Volumetric grids need JSON/ENTITY persist beyond transformer packs.

Read more

VIII · Stubs

stub/memory

HF→ENTITY and GPU upload need footprint accounting and optional history charts.

Read more

VIII · Stubs

stub/donate

LAN donors should accept framed JSON jobs without embedding HTTP in the engine.

Read more

VIII · Stubs

stub/fountain

Recover specialist weight blobs over lossy links via LT fountain codes, then ensemble.

Read more

VIII · Stubs

stub/hardware

Dispatchers and UIs need a portable host audit (OS/CPU/RAM/GPU).

Read more

VIII · Stubs

stub/accel: NPU/Metal/QNN

Vendor accelerators plug beside WebGPU: not replace it. Qualcomm HTP is live via nativeqnn + sibling welvet.qnn (see book §79-81).

Read more

VIII · Stubs

stub/clustering

Offline clustering helpers on tensors without inventing a second math stack.

Read more

VIII · Stubs

stub/ensemble

Combine multiple model votes and find complementary specialists.

Read more

VIII · Stubs

stub/evaluation

Benchmark grids through runtime/forward with deviation metrics.

Read more

VIII · Stubs

stub/grafting

Merge grids into Parallel/Residual structures for topology experiments.

Read more

VIII · Stubs

stub/grouping

Detect layer archetypes from safetensor-style names before mounting.

Read more

VIII · Stubs

stub/introspection

UIs and FFI need to list Grid methods without hardcoding every export.

Read more

VIII · Stubs

stub/observer

Attach forward/backward observers for debugging without coupling to tanhi UDP.

Read more

VIII · Stubs

stub/pipeline

Decoder wavefront stats helpers: not a full Lucy-style pipeline runner yet.

Read more

VIII · Stubs

stub/templates

Chat prompts must match model families (ChatML, Llama3, BitNet) without app-specific string glue.

Read more

VIII · Stubs

stub/universal

Probe unknown safetensor geometry and mount placeholder grids until full weight import lands.

Read more

IX · Validate

w2a: validation harness

Engine packages must stay free of tests. w2a owns timed 34×20×3 matrices, gap census, honesty stamps, and the train-mode permutation smoke (Test49). See §63 for a live full-suite run.

Read more

IX · Validate

Validation report: full suite

Claims are cheap; a stamped matrix is not. This is the actual output of one full w2a [0] Run ALL so the book's ✅ marks are backed by numbers you can reproduce, not asserted.

Read more

IX · Validate

Scorecard → v1.0 / minors

Version is earned from a weighted board, not marketing. v1.0 is 100/100 on the engine board. Minor/patch tags (v1.1.0, v1.1.1, …) pack features without a new board. Apps, stubs, and NPU sit

Read more

IV · Runtime

Cross-numeric train + down-the-dem

Weight storage dtype and activation Tensor[T] are independent axes. Proving train without a retained float32 master means sweeping W×A: not only matched float32 acts.

Read more

V · Systems

lucy: SoftAcc / Score measuring

Adaptation benches (test41-w, tide, live_gpt) need one shared measuring math: SoftAcc, Availability, AdaptPct, Score: not three copies of the formulas.

Read more

IV · Runtime

TrainMode: 29 named updates

Backprop is one update, not the only one. Credit assignment (broadcast gap, head proxy, sparse duty clock) has to be a named axis you can race: not a comment in a notebook. Cameral Mix also

Read more

VII · Apps

Cameral sandwiches + AAI Lucy

A single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-sp

Read more

V · Systems

Lucy density: synthetic organism

A new host (char LM, MNIST, a layer sprint) should not copy tide's goldilocks math. The question is always the same: can the net run and train at the same time in a small box, then how far t

Read more

VII · Apps

CamSync: inter-cameral / cross-mesh weight blend

Mix BranchModes and different inits let cams diverge on purpose. Sometimes you want them to share: gently (1% pull) or hard (full average): within a Parallel, across Stack children, or eve

Read more

X · NativeCPU (welvet.cpp)

NativeCPU: opt-in welvet.cpp C ABI

Go stays the default engine. When you want the C++ MatVec / NormalBP / TrainMSE path in-process, set BackendNativeCPU (never Prefer as default). Pending C++ weights stay off Go Stores until

Read more

X · NativeCPU (welvet.cpp)

NativeCPU: TrainNativeMSE per layer

Each signed layer has a packed C ABI NormalBP path. One smoke walks Dense → CNN/ConvT → norms → RNN/LSTM → Sequential/Residual → Parallel → Embedding → Softmax → KMeans → MHA/SwiGLU → Mamba/

Read more

X · NativeCPU (welvet.cpp)

NativeCPU: TrainMode stack / parallel / mesh / line

Leaf credit for every TrainMode family goes through one C dispatcher. Mesh clock and Line pipe have their own host-shape ABIs. Go intercepts TrainStackMSE/TrainMSE when BackendNativeCPU; cal

Read more

XI · Hexagon NPU (welvet.qnn)

QNN: opt-in Hexagon HTP (welvet.qnn)

Qualcomm Hexagon HTP is a sibling engine (welvet.qnn 1.0.0), not a silent fallback inside Go. Opt-in BackendQNN + explicit SyncToQNN keep CPU/SIMD/WebGPU as defaults. Caps reject unsupported

Read more

XI · Hexagon NPU (welvet.qnn)

QNN: HTP layer tour (session ABI)

w2a go_v_qnn exercises every shipped HTP forward. Book examples use the same session ABI with tiny shapes so a Snapdragon box can smoke-test without the full matrix.

Read more

XI · Hexagon NPU (welvet.qnn)

QNN: go_v_qnn RESULTS (large shapes)

Toy shapes lie. The w2a large matrix (dense 32×512×512, softmax 64×4096, …) is the honest Snapdragon X story: NPU DLL graphExecute vs Go/native f32 CPU, plus Go→NPU call overhead (cgo + pack

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: mount and forward

Mount an identity Dense layer, inspect the Metal version and device, and forward a Float32 tensor.

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: Mamba parameter dtypes

Exercise native storage formats without changing the activation interface.

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: training modes

Train two Dense layers using one of the 29 numbered modes, with persistent Step Line state and real Grid layouts for Mesh modes.

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: weight return and ENTITY save

Return trained weights to Go before executing or saving the Go model.

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: JSON backend placement

Choose which layers run on Apple GPU while retaining ordinary Go training entry points.

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: mixed Go/C++/Metal

Split a single model between the independent native engines and Go.

Read more

XII · Apple acceleration (welvet.metal)

Apple Metal: Mamba results and stress runner

Measure real end-to-end Go bindings on sufficiently large models.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: mount and forward

Mount an identity Dense layer, inspect the CUDA version and device identity, and forward a Float32 tensor.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: Mamba parameter dtypes

Exercise native storage formats without changing the activation interface.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: training modes

Train two Dense layers using one of the 29 numbered modes, with persistent Step Line state and real Grid layouts for Mesh modes.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: weight return and ENTITY save

Return trained weights to Go before executing or saving the Go model.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: JSON backend placement

Choose which layers run on NVIDIA GPU while retaining ordinary Go training entry points.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: mixed Go/C++/CUDA

Split a single model between the independent native engines and Go.

Read more

XIII · NVIDIA acceleration (welvet.cuda)

NVIDIA CUDA: results and suite pointers

Find live CUDA parity/timing matrices after the small usage chapters.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: mount and forward

Run a Go layer on an AMD GPU with an explicit lifetime via the independent welvet.rocm library.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: Mamba parameter dtypes

Exercise native storage formats without changing the activation interface.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: training modes

Train two Dense layers using one of the 29 numbered modes, with persistent Step Line state and real Grid layouts for Mesh modes.

Read more

XIV · AMD acceleration (welvet.rocm)

AMD ROCm: weight return and ENTITY save

Return trained weights to Go before executing or saving the Go model.

Read more