Skip to content
mitigePublic

About

Zero-Python Rust + CUDA cognitive-evolutionary Rocket League RL framework (18 crates, BF16 Tensor-Core Looped Transformer, GPU PDES physics, human-like active vision/motor, Rune UI)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

thrive

what thrives, chooses.

A cognitive-evolutionary Rocket League AI framework with zero Python: built from scratch as 18 Rust Edition 2024 crates, trained end-to-end on a single NVIDIA RTX 3060 12 GB GPU. The stack covers header-free NVRTC CUDA kernels, BF16 Tensor-Core training, continuous-time event-driven GPU physics, biologically grounded active vision and neuromuscular motor control, autonomous anti-addiction choice verification, and a monochrome OKLab desktop UI.

Rust Edition 2024 CUDA SM 8.6 Zero Python License: MIT OR Apache-2.0


Why thrive?

Most Rocket League RL stacks wrap Python/PyTorch around fixed-tick CPU/C++ stepping, feed the policy full-arena omniscient state tensors, and select from 90-action discrete lookup tables. thrive departs from that on both the systems and the scientific side:

  1. 100% Rust + CUDA end-to-end (zero Python, zero nvcc). Physics (GpuArenaBatch & GpuSimBatch), 28-entity canonical tokenization, 110° FOV occlusion, neuromuscular motor filtering, BF16 Tensor-Core forward/backward passes, rollout buffers, CT-PPO/RePPO updates, EGGROLL low-rank ES bursts, and multi-boss GPU sparring (cublasGemmEx) all run natively in VRAM, with zero per-step CPU↔GPU roundtrips.
  2. A compact 6.205M-parameter looped Transformer + CfC brain (11.83 MiB BF16). The Entity-Set Looped Transformer adapts its thinking depth via Expected-Value-of-Control (EVC, K = 1..12) and carries Closed-form Continuous-time (CfC) recurrence, a Cerebellar World Model, bitemporal episodic/intention memory, and 5-phase live GPU Dusk sleep consolidation.
  3. Human-likeness sensorimotor constraints (Profile::elite()). The profile enforces a 110° active camera FOV (ball-cam / car-cam switching with line-of-sight occlusion and object permanence), SCAN dual-channel visuomotor reaction delay (85–135 ms), minimum-jerk continuous analog stick kinematics, physiological 8–12 Hz tremor, and continuous Beta + Bernoulli actions with causal ground/air+jump action masking. These are human-like bounds on the policy; whether play actually passes as human is left to the Turing-discriminator audit rather than claimed up front.
  4. Anti-addiction and sovereign choice (T4). A prediction-only, gradient-detached NeuralSelfMirror (audited via shuffled-label KS-5 leakage tests) plus an unrewarded volitional veto (Free Won't), evaluated on planted reward-hacking traps (RL-P1..P7 + causal ablations A1–A5).
  5. Security and scientific honesty (KS-1..KS-10). A zero-pickle ZIP/tensor archive parser (#![forbid(unsafe_code)]) with SHA-256 quarantine for trojanized third-party bot files, an Ed25519-signed immutable IdentityPrior, finite-difference CUDA gradient checks across all 20 custom kernel subsystems (KS-4), NVML VRAM/energy provenance logging (KS-2 hard cap at 10,752 MiB), and unbroken SHA-256 checkpoint lineage across training stages.

Architecture

flowchart TD
    subgraph Core["Foundations & CUDA Runtime"]
        M["thrive-math\nVec3 / Mat3 / BioPriors / RNG"]
        C["thrive-cuda\ncudarc 0.19 / NVRTC cache / cuBLAS / NVML"]
        K["thrive-kernels\n20 BF16 & FP32 CUDA kernels + KS-4 FD gradcheck"]
    end

    subgraph World["Physics, Perception & Motor"]
        S["thrive-sim\nCPU ref + 4096-arena GPU PDES + GpuArenaBatch"]
        V["thrive-vision\n110° FOV camera, occlusion, object permanence"]
        MO["thrive-motor\nSCAN delay, minimum-jerk splines, 8–12 Hz tremor"]
        O["thrive-obs\n28-entity X-mirror canonical tokenizer"]
    end

    subgraph Mind["Cognitive Architecture (6.205M Params)"]
        B["thrive-brain\nLooped Transformer (K=1..12) + CfC + World Model + BF16 ckpts"]
        MEM["thrive-memory\nEpisodic, working memory, PlayOrgans, intentions"]
        CH["thrive-choice\nDetached NeuralSelfMirror, Ed25519 IdentityPrior, Veto, CCS"]
        DU["thrive-dusk\n5-phase live GPU sleep consolidation + KS-1 rollback"]
    end

    subgraph Train["Evolution, League & Interop"]
        CO["thrive-corpus\nSafe zero-pickle loader + KS-6 quarantine + tactical bot"]
        EV["thrive-evo\nGPU-resident CT-PPO/RePPO, EGGROLL ES, MO-MF-PBT, GPU boss pool"]
        IN["thrive-interop\nOffline RLBot v5 FlatBuffers TCP + LAN despair bridge"]
        EA["thrive-eval\nT3 Turing discriminator, T4 RL-P1..P7, 240-scenario sealed mechanics"]
    end

    subgraph App["Desktop UI & CLI"]
        RN["thrive-render\nHeadless wgpu 3D pitch & car viewport"]
        UI["thrive-ui\nMonochrome OKLab lowercase Rune desktop UI"]
        CL["thrive-cli\nUnified bringup, G0/G1 audit, gpu-s0/gpu-train, graduate, play, ui"]
    end

    M --> C --> K
    K --> S & B
    S --> V & MO & O
    V & MO & O --> B
    B --> MEM & CH & DU
    CO & B & CH & DU --> EV
    EV & IN & EA --> CL
    RN --> UI --> CL
Loading

Full architectural specifications, literature synthesis, and formal kill-switches live in 00-README.md, charter.md, spec/, and plan/. For contributors and refactoring roadmap, see REFACTORING.md.


Verified v0.1.0 Benchmarks

Every figure below was measured directly on a single desktop NVIDIA GeForce RTX 3060 12 GB (SM 8.6) on NixOS with zero mocked stand-ins (see results/R00.md, results/G0.md, and results/corpus_calibration_and_ladder.md).

Hardware, Physics, & Systems Audit (Gate G0: PASS)

Subsystem / Check Measured (RTX 3060 12 GB) Target / Gate Status
cublasGemmEx BF16 (2048³) 19.86 TFLOPS (0.865 ms, < 1e-4 err) >= 19.0 TFLOPS PASS
NVRTC Disk Cache (compute_86, deterministic) Cold 43.4 ms / Warm 0.0015 ms SHA-256 cached, zero nvcc PASS
KS-3 CPU Physics Parity (100 × 10 s) Ball 0.0068 uu / 0.0000°, Car 0.0023 uu / 0.0000° < 1.0 uu / < 0.5° PASS
T1 GPU PDES (4,096 parallel arenas) 332.17M agent-events/s, 1.53 MiB VRAM, 4.38× skip >= 1.2M/s, < 200 MiB PASS
KS-4 CUDA Backward Gradcheck All 20/20 custom kernel subsystems FD relative error verified PASS
thrive-brain Footprint 6,204,592 params (11.83 MiB BF16 checkpoint) ~6.21M, < 13 MiB PASS
KS-5 Detached NeuralSelfMirror Shuffled Audit 0.244 shuffled accuracy (1.000 structured held-out) 0.22–0.28 chance PASS
KS-6 Zero-Pickle Archive Quarantine 24 clean bots loaded, 1 trojanized .lt blocked (pickle_executed = false) Zero pickle execution PASS
KS-7 Ed25519 IdentityPrior Lock Signed & tamper-verified (sha256: 93e3e7cc4bc32c11) Rejects mutated priors PASS
KS-2 NVML Live Training VRAM Budget 6.6–6.9 GiB peak during full 192-arena GPU RL <= 10.5 GiB (10,752 MiB) PASS

Live Policy Snapshot (v0.1.0 Proof-of-Concept Checkpoint)

Honest Status (Axiom A7): v0.1.0 is an early working proof-of-concept release demonstrating the complete verified Rust + CUDA framework, physics engine, GPU rollout/PPO/EGGROLL/Dusk pipeline, safety harnesses, and initial trained checkpoints. Full SSL/RLCS-pro convergence (S2 → S5_final) and final 5-gate graduation are actively in progress and tracked for v0.2.0.

Checkpoint / Stage Evaluation (Strict Unmodified Profile::elite()) Result
stage_S1_g1.thrv (attached to v0.1.0 release, 8.56M ev) Full 5-minute (300 s) 2v2 vs SupersonicTacticalBot 95.0% WR (mirror = 0.938, KS-5 = 0.236)
S2 active causal-mask CT-PPO (11M+ ev, in progress) 2v2 vs nyxcontinuos-test 81.2% WR (83:40 goals; up to 90.6% in focused sweeps)
S2 active causal-mask CT-PPO (iter 15 -> 30) 2v2 vs historical stage_S1_g1 39.1% -> 57.8% WR (+132 Elo gain across 15 iterations)

UI — One Unified Rune Desktop (thrive-ui)

Built on anomalyco/rune + wgpu 30.0.2 with a strict zero-chroma monochrome OKLab theme (dark and light modes), floatable/draggable/minimizable panels, live headless wgpu 3D arena viewport, and zero-copy telemetry updates:

Dark Mode Light Mode Multi-Panel Workspace
Dark UI Light UI Workspace UI

The whole ML / research / eval / play surface is drivable from this one UI. thrive ui hosts a live CPU sandbox and a subprocess job runner (crates/thrive-cli/src/jobs.rs, zero changes to the trainers): every CLI subcommand is launchable from the panels, one GPU job at a time, with queue + cancel, stdout/stderr capture into the events log, results/live_telemetry.json mtime-polling for progress, and a KS-2 VRAM gate that refuses starts under memory pressure with a visible event.

12 Panels, 5 Workspaces

Workspace Panels Role
1 live arena, choice, population, mind Full-bleed 3D stadium flanked by match transport, anti-addiction instrumentation, Pareto population, and the drive/attention inspector
2 analytics league, system Elo ladder + RLBot v5 bridge, NVML/throughput/kill-switch ledger + checkpoint SHA-256 verify
3 sandbox sandbox, events, view Live CPU physics (gravity, boosts, ball launches, brain/chase/idle policy), bounded event log, camera/shortcuts
4 ml train, eval New: ML job selector + editable hyperparameters + start/stop + live progress + checkpoint list; eval suite launcher + job history + gate badges
5 research research New: read-only file tree + sanitized text viewer over literature/, research/, spec/, results/*.md

All twelve panels share the exact same chrome (zero-chroma OKLab, lowercase, 2-child headers, dock auto-hide, drag/resize/Escape rollback, Super+Alt+Arrow workspace carry). The first nine panels keep their original default rects.

LIVE Controls (no more no-ops)

  • btn-train starts/stops the selected training job (default: train-campaign; pick gpu-s0, gpu-train, … in the train panel).
  • btn-dusk runs a real dusk consolidation pass (gpu-train --iterations 1 --dusk-every 1).
  • Trap chips (rl-p1..p7) arm the eval-t3-t4 planted-trap audit job.
  • btn-rlbot-bridge launches/stops a thrive play bridge job (requires a selected checkpoint; the connected flag reflects the real child process).
  • train panel: job chips for all 10 subcommands, hyperparameter sliders/choice chips (UI-local until start), checkpoint picker feeding --resume/--checkpoint, live step/loss progress, queue + cancel.
  • eval panel: one-chip launchers for bringup, g0-audit, calibrate-corpus, eval-t3-t4, verify-g1, graduate, plus the safe-corpus audit, finished-job history, and results/G*.md gate badges.
  • research panel: click a file to read it (shell-local, sanitized, read-only; symlinks and path traversal refused).

Launch

# The unified UI: live sandbox + job runner + trainer telemetry display
cargo run --release -p thrive-cli -- ui
# Optionally load a brain checkpoint for the sandbox and watch a trainer's telemetry
cargo run --release -p thrive-cli -- ui --checkpoint checkpoints/stage_S1_g1.thrv --telemetry results/live_telemetry.json

Job children re-spawn the running thrive binary ($THRIVE_JOB_BIN overrides), inherit the environment, and are killed when the UI window closes. Externally running trainers still feed the panels through results/live_telemetry.json exactly as before.


Quickstart

Prerequisites

  • Linux x86_64 with an NVIDIA GPU (Ampere SM 8.6 / RTX 30-series or newer recommended) and NVIDIA driver supporting CUDA 13.x.
  • Either Nix with flakes enabled (recommended — completely reproducible CUDA 13.5 + Rust + Vulkan/Wayland dev shell) or Rust stable (Edition 2024) + CUDA toolkit (libnvrtc, libcublas, libcudnn, libcudart).

1. Enter Dev Shell & Build (Zero Warnings)

git clone https://github.com/mitige/thrive.git
cd thrive

# Reproducible Nix dev shell (sets CUDARC_CUDA_VERSION=13040 and CUDA/Vulkan library paths)
nix develop

# Verify full 18-crate workspace compilation & test suite
THRIVE_REQUIRE_CUDA=1 RUSTFLAGS="-D warnings" cargo test --release --workspace

2. Run Hardware Bring-Up & Gate G0 Audit

THRIVE_REQUIRE_CUDA=1 cargo run --release -p thrive-cli -- bringup
THRIVE_REQUIRE_CUDA=1 cargo run --release -p thrive-cli -- g0-audit

3. Launch the Desktop UI or Train a Checkpoint

# Launch the unified Rune UI: live sandbox + ML/research/eval job runner
# (optionally watching an external trainer's live telemetry)
cargo run --release -p thrive-cli -- ui --telemetry results/live_telemetry.json

# Resume or start GPU-resident RL training (requires a parent .thrv checkpoint, e.g. from v0.1.0 release)
THRIVE_REQUIRE_CUDA=1 cargo run --release -p thrive-cli -- gpu-train \
  --stage S2 \
  --resume checkpoints/stage_S1_g1.thrv \
  --out-ckpt checkpoints/stage_S2.thrv \
  --iterations 120 --n-arenas 192 --rollout-steps 128

# Same run with hyperparameters from a JSON file (keys = flag names in snake_case,
# e.g. {"stage": "S2", "iterations": 120, "lr": 0.0001}); explicit CLI flags win.
THRIVE_REQUIRE_CUDA=1 cargo run --release -p thrive-cli -- gpu-train \
  --resume checkpoints/stage_S1_g1.thrv --out-ckpt checkpoints/stage_S2.thrv \
  --config configs/s2.json

Environment Variables

All paths are portable and overridable via environment variables:

Variable Default Purpose
THRIVE_REQUIRE_CUDA 0 Set to 1 to fail fast instead of falling back if CUDA init fails.
THRIVE_CORPUS_ROOT .. Optional directory containing third-party Rocket League bot checkpoints for local sparring/calibration (never committed to this repository).
THRIVE_RESULTS_DIR results Output directory for reports, logs (auto-rotated at 16 MiB), telemetry, and provenance ledger.
THRIVE_CHECKPOINTS_DIR checkpoints Output directory for rolling BF16 .thrv checkpoints (< 1.5 GiB ring cap).
THRIVE_BIO_PRIORS (built-in) Optional path to an external bio_priors.json overriding built-in verified constants.

Security & Safety Invariants

  • Offline Interop Only: thrive interacts strictly with its local physics engine (thrive-sim), LAN despair, or offline -rlbot RLBot v5 TCP bridges. It never touches official Rocket League matchmaking or anti-cheat processes.
  • Zero-Pickle Corpus Quarantine (KS-6): thrive-corpus is #![forbid(unsafe_code)], parses PyTorch ZIP archives directly in pure Rust without executing Python or pickle opcodes, scans embedded data.pkl byte streams for malicious payloads, and enforces a SHA-256 blocklist.
  • No Third-Party Weights in Git: External bot models and large training logs are strictly excluded via .gitignore. Only thrive's own verified 12 MiB BF16 checkpoint is published as a GitHub Release asset.

Roadmap (v0.1.0 → v0.2.0)

  • 18-crate zero-Python Rust Edition 2024 + NVRTC CUDA workspace
  • Bit-exact CPU/GPU physics parity (KS-3) & 332M ev/s GPU PDES (T1)
  • 6.205M-param BF16 Looped Transformer + CfC + World Model + KS-4 FD gradcheck (20/20)
  • End-to-end GPU-resident 2v2/1v1 rollout, causal ground/air+jump action masking, CT-PPO/RePPO, EGGROLL ES, Dusk consolidation, GPU boss sparring pool
  • Monochrome OKLab Rune desktop UI + headless wgpu 3D viewport + offline RLBot v5 / LAN despair bridges
  • Complete S2 → S5_final unbroken-lineage multi-billion-event GPU training campaign
  • Pass all 5 strict full 5-minute graduation gates (Tier 1–4 bots, #1 apex boss, 1v1 specialists, 3 fresh anti-strategy exploiters, T3 Turing & T4 anti-addiction audits)
  • Workspace modularization & CUDA .cu kernel extraction (see REFACTORING.md)

Team

  • Evan (@mitige) — Machine Learning & Research: cognitive architecture, continuous-time RL & evolutionary optimization (CT-PPO/RePPO, EGGROLL ES, MO-MF-PBT, Dusk consolidation), human sensorimotor & active-vision modeling, anti-addiction sovereignty (T4), training & evaluation.
  • Yanis (@Expected333) — Development & Refactoring: software engineering, workspace modularization, systems refactoring, and codebase maintainability (see REFACTORING.md).

License

Dual-licensed under either of:

at your option.

About

Zero-Python Rust + CUDA cognitive-evolutionary Rocket League RL framework (18 crates, BF16 Tensor-Core Looped Transformer, GPU PDES physics, human-like active vision/motor, Rune UI)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages