From c2b24d55addc31bcba852b49a3b3047e343bd05b Mon Sep 17 00:00:00 2001 From: Vasyl-Trefilov Date: Thu, 3 Dec 2026 10:38:26 +0100 Subject: [PATCH] docs: README conditions for the speed table, how it works, a checked quick start Co-Authored-By: Claude Opus 5.5 --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2342ad0..02d4a7d 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,15 @@ one idle RTX 3060 12 GB: | 4 × 1024 | **21787** | 20063 | 20544 | | 8 × 512 | 22926 | 23906 | 21366 | -Single GPU, one architecture family. Other shapes are in -[docs/baseline.md](docs/baseline.md). +Model: d_model 768, 16 layers, grouped-query attention with 12 query and 4 +key/value heads, head size 64, SwiGLU 1408 wide. Recorded before 2026-10-08; +the PyTorch and TensorFlow scripts live in the RustingLLM project and are not +in this repository yet, so treat this table as a snapshot, not a reproducible +benchmark. Single GPU, one architecture family. Other shapes, MFU and the +regression thresholds that `scripts/bench_check.sh` enforces are in +[docs/baseline.md](docs/baseline.md); the dated profile-driven changes behind +the numbers (fused attention, BF16 operand pipeline) are in +[docs/measurements.md](docs/measurements.md). ## Features @@ -38,6 +45,23 @@ Single GPU, one architecture family. Other shapes are in - **Backends**: CPU, CUDA, and Metal for dense networks. - **Interop**: ONNX import and export, Hugging Face tokenizers and checkpoints. +## How it works + +- **Tensors and layers in plain Rust.** CPU math, layers (`attention.rs`, + `ffn.rs`, `moe.rs`, `embedding.rs`) and the optimizers are ordinary Rust + code; the same model runs on the CPU with no GPU present. +- **CUDA through NVRTC.** With the `cuda` feature the kernels are CUDA C + source strings compiled at startup by NVRTC, so there is no `nvcc` step + and no C++ in the build. cuBLAS handles the large GEMMs; custom kernels + cover fused attention, RMSNorm, SwiGLU, softmax and the optimizer + update. +- **Memory budget first.** `to_cuda(device, budget_mib)` places weights, + optimizer state and activations inside a fixed budget, which is how a 300M + model trains on a 12 GB card next to a desktop. +- **Profile, then change.** Every speed change has a before/after entry in + `docs/measurements.md`, and `scripts/bench_check.sh` fails if the train + step drops below 97% of the recorded baseline. + ## Install ```bash @@ -130,10 +154,23 @@ cargo run --release --features cuda --example bench_train_step -- 4 1024 cuda The rest are in [examples/](examples). -## Scope +## Quick check + +```bash +git clone https://github.com/RustingStudio/RustingBrain.git +cd RustingBrain +cargo run --example xor +``` + +Checked from a fresh clone on 2026-12-03 (Rust 1.95, CPU only): it builds in +about 15 s and prints 0.0000 / 0.9999 / 1.0000 / 0.0001 for the four XOR +inputs. + +## Scope and limits One machine, one GPU. Encoder-decoder models, multi-GPU and distributed -training are not implemented and are not planned. +training are not implemented and are not planned. CUDA is tested on an RTX +3060 (Ampere) only; Metal covers dense networks only. ## License