Experimental model lab - outputs may be incoherent or factually inaccurate.
Rust + Python / From scratch

Language model systems lab

Build less.
Understand more.

Vexel is a compact language-model project for learning tensor math, reverse-mode autograd, GPT architecture, training, export, and Rust inference end to end.

6.85M params 2D tensors 1 tape
python / vexel
$ python

>>> import vexel
>>> x = vexel.Tensor([[1.0, 2.0],
...                 [3.0, 4.0]])
>>> tape = vexel.TensorTape()
>>> node = tape.leaf(x)
>>> tape.backward(node)

# gradients remain explicit
[[1.0, 1.0],
 [1.0, 1.0]]
TensorTape ROW-MAJOR / 2D
Rusttensor core
PyO3Python bridge
BPEsubword data
JSONweight export

01 / overview

Three runtimes. One learning path.

Compare the implementation surfaces and follow one concept without hiding the mechanics behind a framework.

SurfaceRoleImplementationBest for
Rust coreTensor and autograd engine2D row-major storage, tape nodes, operatorsUnderstanding layout and gradients
Python APIInteractive experiment layerPyO3 binding for Tensor and TensorTapeFast debugging and small demos
PyTorchPractical trainingCharacter and BPE GPT loopsDatasets, checkpoints, generation
Rust inferencePortable forward passExported JSON weights and GPT forward codeInspecting deployment mechanics

02 / workflow

From text to generated tokens

The shortest complete path, kept visible at every stage.

01prepare

Corpus

Collect character or domain-mixed training text.

data/*.txt
02encode

Tokenizer

Character IDs or learned byte-pair merges.

bpe.py
03train

GPT

Run attention, norms, ReLU, and backward passes.

train_bpe_gpt.py
04export

Inference

Convert weights and run the Rust forward pass.

export_to_json.py

03 / features

Mechanisms you can inspect

Search the implemented systems and jump into the code that owns them.

6 modules
SYS / 01

2D Tensor Engine

Row-major storage with matmul, transpose, scale, sum, split, concat, ReLU, and softmax.

RUST CORE
SYS / 02

Reverse Autograd

Tape-based gradient tracing makes every recorded operator and gradient inspectable.

TENSOR TAPE
SYS / 03

GPT Forward Pass

Causal attention, embeddings, pre-norm blocks, ReLU MLP, and final LM logits.

ARCHITECTURE
SYS / 04

Python Bridge

PyO3 classes exchange two-dimensional nested lists through a small, explicit API.

MATURE / PYO3
SYS / 05

BPE Training

Corpus preparation, subword vocabulary, mixed-domain data, and checkpoint tracking.

PYTORCH
SYS / 06

Export and Chat

JSON weight export, Rust forward inference, and a limited Flask completion demo.

DEMO

04 / architecture

Trace the system

Select a layer to inspect its role and owned components.

05 / quick start

Run the learning loop.

Build the native module, run the tests, and then open the smallest pieces of the implementation.

cargo test
python3 -m maturin develop --release
cd python && python3 web_server.py

06 / status

What is working now

CORE

Tensor operations and autograd

Usable 2D storage, operators, tape nodes, and gradient checks.

available
TRAINING

Character and BPE GPT

PyTorch training paths for character and mixed-domain corpora.

available
QUALITY

Production readiness

Educational-scale only; not optimized for large models or factual reliability.

not planned
Copied to clipboard