5e402918bb5cb6887c9192e57acd7b67e6b1c4a7
32
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5155c081ca |
feat(mamba): GPU-accelerated backward pass (backward_cuda)
GPU Tests / Check GPU Availability (push) Successful in 0s
GPU Tests / CUDA Tests (11.8) (push) Skipped
GPU Tests / CUDA Tests (12.1) (push) Skipped
GPU Tests / Metal Tests (push) Skipped
CI / Clippy Check (push) Failing after 7s
CI / Build (ubuntu-latest) (push) Failing after 8s
Documentation / Build User Guide (push) Successful in 9s
CI / Format Check (push) Failing after 15s
CI / Build (macos-latest) (push) Failing after 20s
CI / Test (macos-latest) (push) Skipped
CI / Test (ubuntu-latest) (push) Skipped
CI / Python Bindings (maturin) (macos-latest) (push) Skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Skipped
CI / WASM Build + Size Check (push) Skipped
CI / Distributed Training Tests (push) Skipped
CI / Build CPU-Only (Explicit) (push) Failing after 1m48s
CI / CI Success (push) Failing after 1s
Documentation / Build API Documentation (push) Failing after 2m29s
Performance Benchmarks / Run Benchmarks (push) Successful in 5m56s
MambaBlock::forward already had a working, tested CUDA dispatch (forward_cuda: cuBLAS matmuls for projections, CPU for the scan). backward() had none — it silently ran entirely CPU-serial on GPU tensors via to_vec()/from_vec() D2H/H2D round-trips. This adds the missing acceleration, mirroring forward_cuda's hybrid split: the four large projection-parameter gradients (in_proj, x_proj, dt_proj, out_proj) now go through batched GPU matmuls; the inherently sequential scan reverse-pass and small per-channel grads stay CPU. Extracted CpuWeights::pull and recompute_forward_cpu out of the old inline per-batch forward-recompute block inside backward() (pure refactor, gradient-checked unchanged by real_selective_scan.rs's existing 6 tests) so CPU backward and the new CUDA backward share identical forward math and can never numerically diverge on it. New CUDA-vs-CPU gradient-check test (mamba_cuda_backward_matches_cpu, #[ignore]-gated, GPU-only) caught a real bug during development: Tensor::contiguous() is a no-op stub in this rtx-tensor version, and cuda_matmul reads raw GPU storage by shape.dims() ignoring strides/offset, so .transpose(..).matmul(..) on a GPU tensor silently computed garbage (80-200x relative error on 3 of 4 accelerated gradients). Fixed by building already-transposed [dim, b*l] buffers on CPU before upload instead of transposing GPU-side. All 9 gradients now match CPU backward within ~2.2e-5 max relative error (tolerance 1e-4). Co-Authored-By: Claude Sonnet 5 <[email protected]> |
||
|
|
4aaa36a57a |
style: cargo fmt --workspace (whitespace/wrapping only, no semantic change)
Whole-workspace rustfmt pass picked up while iterating on Mamba GPU backward work. Verified formatting-only via diff sampling; no logic changed. Co-Authored-By: Claude Sonnet 5 <[email protected]> |
||
|
|
5f32165184 |
chore(sweep): delete 43 orphaned source files; document SYCL/demo/duplication status
Performance Benchmarks / Run Benchmarks (push) Failing after 7s
GPU Tests / Metal Tests (push) Has been skipped
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
CI / Build CPU-Only (Explicit) (push) Failing after 3m32s
CI / Format Check (push) Failing after 5s
CI / Build (macos-latest) (push) Failing after 11s
CI / Build (ubuntu-latest) (push) Failing after 2m34s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
Documentation / Build User Guide (push) Successful in 9s
GPU Tests / Check GPU Availability (push) Successful in 0s
CI / Clippy Check (push) Failing after 4m9s
CI / CI Success (push) Failing after 0s
Documentation / Build API Documentation (push) Failing after 4m18s
Deletions (all verified unreferenced by any mod/include/path declaration;
git history preserves them):
- rtx-transformers: entire orphaned curriculum/ split (mod.rs holds the
real inline implementation), non-_simple graph variants, superseded
simmim/jepa_integration files, layers/{sliding_window_attention,
positional_encoding,ssm_state_cache_original}, lib_full/lib_minimal/
error_full/error_minimal, orphaned MoE impls (moe_layer,
moe_integration).
- rtx-distributed/parallel_old.rs; rtx-flash-attention/{core_full,
lib_full}.rs; rtx-compress legacy_distillation + structured_pruner.
- rtx-tensor/tensor_core.rs; rtx-runtime/{cuda_kernel_ops,
cuda_backend_mock}.rs; rtx-memory/{gpu_pool_manager,allocator,
pool_type}.rs; rtx-losses/{lib_minimal,lib_full}.rs.
Docs honesty:
- rtx-backend-sycl marked EXPERIMENTAL SKELETON in crate docs and
CLAUDE.md backend table (all ops return NotImplemented).
- docs/consolidation.md records canonical MoE (layers/mixture_of_experts)
and flash-attention (rtx-flash-attention crate) implementations plus
remaining duplicates to consolidate.
- CLAUDE.md: meta-crate GPU features noted; simulation-only demos named;
serving/streaming mock removal noted.
Verified: cargo check --workspace clean (rtx-onnx-codegen pre-broken at
HEAD, unrelated); lib tests pass for all touched crates (rtx-runtime's 4
failures pre-exist at HEAD).
Co-Authored-By: Claude Fable 5 <[email protected]>
|
||
|
|
1e3c604896 |
feat(meta,jepa): expose GPU features through meta-crates; wire JEPA cluster plan and real shard loading
Meta-crates (Phase 2): - rtx-core / rtx-training / rtx-inference-stack gain cuda and metal features threading into their sub-crates; GPU was previously unreachable through the user-facing bundles. - rtx-training restores rtx-distributed (the hpc-channels blocker is gone) so the advertised DistributedTransformerTrainer resolves; drops the unused rtx-runtime dep. - rtx-transformers drops unused rtx-backend/rtx-backend-cpu deps (stale comment referenced a teacher that never used them). Never-compiled CUDA paths fixed (surfaced by the new feature wiring, verified on RTX 5060 Ti / CUDA 13.1): - rtx-compress build.rs: missing Path/Command/fs imports. - rtx-flash-attention flash_decode_forward: reborrow &mut kernel args. - rtx-transformers: rope kernel include path, cudarc 0.18 Arc<CudaModule>, PushKernelArg imports in jepa_gpu, edition-2024 ref patterns. - rtx-memory: full cudarc 0.18 port (CudaContext, stream-based alloc, DevicePtr accessors, error enum formatting) across gpu_pinning, gpu_transfer, gpu_real, gpu_allocator/arena, gpu_tests. JEPA (Phase 3): - JepaRunConfig::apply_cluster_plan consumes ClusterTrainingPlan (batch size, TP/DP, world size, total steps) so jepa_cluster is no longer standalone dead config; ViTSizeStr::approx_params_m feeds JepaParallelConfig::for_model_and_cluster. - WebDatasetShard::load reads real .tar shards from disk via the existing parser (gzip rejected explicitly); to_in_memory documented as synthetic/test-only. - New image-decode feature actually defines the dep for the previously unreachable cfg(feature = "image-decode") JPEG/PNG decode path. Co-Authored-By: Claude Fable 5 <[email protected]> |
||
|
|
bff27c302f |
feat(batch19): Medusa heads, TIES+DARE model merging, Mixture of Depths
CI / Format Check (push) Failing after 13s
CI / Clippy Check (push) Failing after 43s
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / Build CPU-Only (Explicit) (push) Failing after 1m40s
CI / CI Success (push) Failing after 0s
Performance Benchmarks / Run Benchmarks (push) Successful in 2m10s
CI / Build (macos-latest) (push) Failing after 29s
Documentation / Build User Guide (push) Successful in 6s
GPU Tests / Check GPU Availability (push) Successful in 0s
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
CI / Build (ubuntu-latest) (push) Failing after 1m12s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
Documentation / Build API Documentation (push) Failing after 1m26s
GPU Tests / Metal Tests (push) Has been skipped
- MedusaHeads: K FFN draft heads (SiLU 2-layer); tree candidate generation via cartesian product of per-head top-k; path verification with oracle; CE training loss per head (arXiv:2401.10774); 23 tests - ModelMerger: TIES (task-vector trim+elect-sign+disjoint-merge, arXiv:2306.01708) + DARE sparse rescaling (arXiv:2311.03099); linear merge baseline; 29 tests - MoDLayer/MoDStack: per-token capacity routing (top-k by router score); residual bypass for skipped tokens; load-balancing aux loss; flops_reduction = product of capacity_fractions (arXiv:2404.02258); 22 tests Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
bb5f5c519f |
feat(batch17): RoPE scaling extensions, DPO loss, label smoothing + focal loss
CI / Build CPU-Only (Explicit) (push) Failing after 7s
CI / Format Check (push) Failing after 12s
Documentation / Build User Guide (push) Successful in 8s
CI / Build (macos-latest) (push) Failing after 29s
CI / Build (ubuntu-latest) (push) Failing after 1m2s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / Clippy Check (push) Failing after 1m5s
Documentation / Build API Documentation (push) Failing after 58s
CI / CI Success (push) Failing after 0s
Performance Benchmarks / Run Benchmarks (push) Successful in 7m52s
- RopeTable/RopeScaler: linear interpolation, dynamic NTK (base scaling), YaRN per-frequency blending with ramp fn + temperature correction (arXiv:2309.00071); apply_to_sequence multi-head; 23 tests - DpoLoss: log-sigmoid DPO (arXiv:2305.18290), IPO squared variant (arXiv:2310.12036), robust DPO label smoothing; implicit reward tracking; DpoAccumulator with preference accuracy; 23 tests - LossFunctions: label-smoothed CE (Szegedy 2016), focal loss (Lin 2017 arXiv:1708.02002), smoothed focal, binary CE (stable), binary focal; Reduction::Mean/Sum/None; 22 tests Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
6daa20c94b |
feat(batch15): Shampoo optimizer, beam search decoder, sliding window attention
CI / Format Check (push) Failing after 14s
CI / Clippy Check (push) Failing after 18s
Documentation / Build API Documentation (push) Failing after 27s
CI / Build (ubuntu-latest) (push) Failing after 58s
GPU Tests / Check GPU Availability (push) Successful in 0s
Documentation / Build User Guide (push) Successful in 13s
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
Performance Benchmarks / Run Benchmarks (push) Successful in 1m55s
CI / Build CPU-Only (Explicit) (push) Failing after 1m18s
CI / Build (macos-latest) (push) Failing after 56s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 0s
GPU Tests / Metal Tests (push) Has been skipped
- ShampooOptimizer: Kronecker-factored L/R preconditioners; Schulz iteration
for A^{-1/4} (two-pass: inv_sqrt then inv_sqrt of sqrt); spectral-norm
normalization; large-dim SGD fallback; 16 tests
- BeamSearchDecoder: length normalization (Wu et al. α); n-gram blocking;
EOS suppression before min_length; DiverseBeamSearchDecoder with per-group
diversity penalty; 20 tests
- SlidingWindowAttention: causal/bidir window; global tokens attend to all;
O(n·W) forward_single_head + multi-head forward; AttentionStats sparsity;
WindowMask; 20 tests
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
||
|
|
9c3b9f82f0 |
feat(batch13): EMA model weights, cross-layer weight sharing, schedule-free optimizer
CI / Format Check (push) Failing after 13s
Documentation / Build API Documentation (push) Failing after 18s
Documentation / Build User Guide (push) Successful in 12s
CI / Build (ubuntu-latest) (push) Failing after 50s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m33s
CI / Clippy Check (push) Failing after 21s
CI / Build CPU-Only (Explicit) (push) Failing after 3m17s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 0s
CI / Build (macos-latest) (push) Failing after 55s
- ModelEma: decay-weighted shadow weights with warmup ramp, bias correction, apply/restore swap for eval, and shadow_drift L2 diagnostic - SharedLayerStack: FullSharing/GroupedSharing/AlternatingPairs strategies (ALBERT-style); memory_reduction_ratio(); LCG-seeded SharedFfnWeight - ScheduleFreeOptimizer: Defazio 2024 z/x dual sequences, c_t cubic interpolation coefficient, Adam+SGD variants, weight decay 48 tests + 5 doctests Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
ef3cdb1e1a |
feat(batch9): token merging (ToMe), grad accum per-step norm, speculative streaming
CI / Format Check (push) Failing after 11s
CI / Build CPU-Only (Explicit) (push) Failing after 37s
CI / Clippy Check (push) Failing after 38s
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
CI / Build (ubuntu-latest) (push) Failing after 32s
GPU Tests / Check GPU Availability (push) Successful in 0s
Documentation / Build API Documentation (push) Failing after 24s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m12s
Documentation / Build User Guide (push) Failing after 34s
CI / Build (macos-latest) (push) Failing after 43s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 1s
GPU Tests / Metal Tests (push) Has been skipped
- Token Merging (ToMe, arXiv:2210.09461): bipartite soft matching via priority-queue
second-chance loop; apply_merge/apply_unmerge; TokenMergingLayer::forward(); 17 unit
tests + 2 doctests; 75% merge at r=32/seq=64
- Gradient accumulation per-step normalization: NormalizationStrategy
{EndOfAccumulation, PerStep, None}; with_per_step_normalization(); compute_gradient_norm()
L2 norm; PerStep divides by fixed accumulation_steps before add (not end-of-batch);
11 tests including equivalence proof vs EndOfAccumulation
- Speculative streaming: SpeculativeStreamer + mpsc::Receiver<StreamedToken>; notify_step()
sends accepted draft tokens + optional continuation immediately; StreamStats with Welford
online mean latency; collect_stream() test helper; 17 async tests
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
||
|
|
7c8e9a8a35 |
feat(batch8): multi-token prediction heads, sparse attention, length bucketing
CI / Format Check (push) Failing after 23s
Documentation / Build User Guide (push) Successful in 14s
Documentation / Build API Documentation (push) Failing after 16s
CI / Clippy Check (push) Failing after 16s
Performance Benchmarks / Run Benchmarks (push) Failing after 30s
CI / Build (ubuntu-latest) (push) Failing after 53s
CI / Build CPU-Only (Explicit) (push) Failing after 1m4s
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / Build (macos-latest) (push) Failing after 35s
CI / Test (macos-latest) (push) Has been skipped
CI / CI Success (push) Failing after 0s
Multi-Token Prediction heads (rtx-transformers/gpt):
- MtpConfig { num_future_tokens=4, loss_weight=0.3 }; MultiTokenPredictionHead
with k independent [hidden, vocab] weight matrices; forward() → Vec<Tensor>
- compute_loss(): log-softmax NLL for each offset 1..k; weighted by loss_weight;
MtpLossResult with per_head_losses + is_valid(); 12 tests
Sparse attention (rtx-transformers/layers):
- SparseAttentionMask: local window (radius w), global tokens (first g attend
all + all attend them), random long-range (r symmetric positions per token)
- LCG seeded for reproducibility; apply_to_scores() masks to -inf; to_additive_bias()
- SparseAttentionLayer::forward_cpu() skips masked pairs early; numerically-stable
softmax; sparsity 75% at n=512, 87% at n=1024, 97% at n=4096; 14 tests
Sequence length bucketing (rtx-transformers/training):
- LengthGroupedSampler: Fisher-Yates per-bucket shuffle, token-budget batching,
overflow bucket for long sequences; padding_efficiency() vs baseline_efficiency()
- pack_into_batch(): greedy first-fit packing; naive_padding_ratio() baseline metric
- Measured 2.2× padding reduction on power-law data (26%→67% efficiency); 18 tests
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
||
|
|
ef786c0ab1 |
feat(batch5): mid-batch injection, PagedAttn v2 defrag, fused RoPE kernel
CI / Clippy Check (push) Failing after 8s
Documentation / Build User Guide (push) Successful in 7s
Documentation / Build API Documentation (push) Failing after 9s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m29s
CI / Format Check (push) Failing after 15s
CI / Build (ubuntu-latest) (push) Failing after 42s
CI / Build CPU-Only (Explicit) (push) Failing after 3m17s
CI / Build (macos-latest) (push) Failing after 30s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 1s
Continuous batching (rtx-serving-api): - ContinuousBatchingConfig: enable_mid_batch_injection (default true), injection_check_interval (default 1), max_injections_per_step (default 4) - ContinuousBatchingController: inject_into_active_batch() + try_inject_pending() allow new sequences to join a running decode batch after each step - BatchingError::BatchFull variant; 3 new tests PagedAttention v2 defrag (rtx-memory): - PageTable::fragmentation_ratio() — hole-counting (sandwiched free pages / total) - PageTable::defragment() — in-place left-compaction of physical page metadata, consistent lock order (free_pages -> physical_pages -> sequences); GPU KV copy stub comment; DefragStats return value; re-exported from lib.rs - 4 defrag tests; fixed 2 pre-existing compile errors in gpu_oom.rs + gpu_transfer.rs - 192 tests pass Fused RoPE kernel (rtx-transformers): - build_cos_sin_table() + rope_forward_cpu() CPU reference (norm-preserving) - RopeFusedKernel wrapper; rope_forward.cu CUDA kernel (1 block per (B,H,T), 1 thread per dim pair, NVRTC compiled) - Replaced apply_rope_rotation() mul_scalar(0.99) stub with real pairwise rotation - build.rs for NVRTC kernel tracking; layers/mod.rs wired; 8 tests pass Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
a08adfbf57 |
fix(gaps): G4 — re-enable all rtx-transformers Phase 2/3 modules (222 compile errors fixed)
Uncommented all deferred modules in lib.rs and fixed API drift across ~60 files in 9 module groups: continual, curriculum, meta, modular, neural_ode, graph, kan, perceiver, distributed/pipeline_parallelism. Common patterns fixed across modules: - Tensor::randn/zeros/ones([a,b]) → (&[a,b], device)? (slice + Result) - Result<T, TensorError> → .map_err(Into::into)? in TransformerError contexts - Device by value → &device references - &Tensor where Tensor expected → .clone() - tensor.relu()/tanh()/sigmoid() as methods not ops functions - Tensor arithmetic returning Result: (a + b)? → (a.clone() + b)? - shape literals → shape.dims() for Shape type - sum(n) → sum(Some(n)), mean(None) → mean(&[], false) - i64 indices → usize where required - backward(x) → backward(x, None) - Borrow conflicts on self.field resolved by extracting to locals before mut borrow - BatchingStats private fields → pub(crate) - TransformerError::Serialization → ::SerializationError - Add scalar to tensor: (t + 0.1)? → t.add_scalar(0.1)? Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
f751414c38 |
D309: fix MambaRecurrence step — conv1d history buffer + new ergonomic API
The single-step recurrence was missing a causal conv1d history buffer, so stepwise outputs diverged from the full-sequence forward (max_abs_diff ≈ 6e-2). Add `conv_buf: Vec<f32>` to `MambaState` (oldest-first per channel), thread it through `MambaRecurrence::step` so the kernel sees the correct `kc-1` prior x_in values, and shift the buffer after each step. Ergonomic additions: - `MambaRecurrence::init_state()` — zero-initialised state with correct dims - `MambaRecurrence::state_size()` / `d_model()` — accessor methods - `MambaState::hidden()` — slice accessor for the SSM h vector - `MambaState: PartialEq` — enables determinism assertions in tests Both D309 tests now pass: `step_matches_full_forward` and `fresh_state_is_zero_and_deterministic`. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
24bd5cf9dc |
feat(layers): add mamba_step, cloned/gated memory updaters, set_encoder_teacher
Performance Benchmarks / Run Benchmarks (push) Has been cancelled
CI / Format Check (push) Has been cancelled
CI / Clippy Check (push) Has been cancelled
CI / Build (macos-latest) (push) Has been cancelled
CI / Build (ubuntu-latest) (push) Has been cancelled
CI / Build CPU-Only (Explicit) (push) Has been cancelled
Documentation / Build API Documentation (push) Has been cancelled
Documentation / Build User Guide (push) Has been cancelled
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / CI Success (push) Has been cancelled
Implements four new rtx-transformers layers required by omni-cortex's omni-think crate: MambaRecurrence/MambaState (single-token S6 recurrent step), ClonedMemoryUpdater (linear-tanh cell with SGD + rollout refinement), GatedMemoryUpdater (GRU-style cell with full backward pass), and SetEncoderTeacher (time-parallel set encoder with named_params persistence API). Fixes 10 compile errors in omni-think. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
0e3ff0a1b9 |
SMT D319 (rustytorch): learned-[MEM]-query (content-addressable) teacher pool
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
Adds an opt-in learned-query attention pool to SetEncoderTeacher (SetEncoderConfig::with_learned_pool): pool = softmax(q_mem·hᵀ)·h instead of the fixed mean/decay pool — Isola's transformer-teacher [MEM] query. New q_mem param (threaded through graph/train_step/run/named_params; only updated in learned-pool mode). Default off → existing teachers byte-unchanged. Finding (test teacher_content_addresses_selective_retrieval): on a selective- retrieval task (signal in one marked token among distractors) BOTH the mean-pool and learned-query teachers recover the marked token to low MSE (~0.0006 / ~0.002) — because the self-attention layer already routes the marked token's signal to every position before the pool. So the mean-pool was NOT the recall bottleneck (correcting the D318 hypothesis): the teacher can content-address; the real recall bottleneck is the recurrent *cell* that imitates it. The learned-query pool is shipped as an equally-capable, faithful-to-the-talk alternative. All 5 teacher unit tests pass; clippy(-D)/fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
ca3f12c6c8 |
SMT D316 (rustytorch): train_rollout — truncated K-step BPTT for the memory cell
CI / Format Check (pull_request) Has been cancelled
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
ClonedMemoryUpdater::train_rollout rolls the cell forward over K inputs on its OWN memory (not teacher-forced) and backprops the accumulated predict-the-future loss through the whole K-step graph — the tape's first multi-step training path, directly optimizing the free-rollout behavior the cell is evaluated on (vs the one-step BC/DAgger paths). To stay within the finite-diff-gated op set (matmul/gelu/add/mul/sub/sum — no tensor concat), W_in is split into its memory rows (applied to M) and input rows (applied to x); the two gradient halves are re-stacked for the Adam update. Non-finite guard + gradient clip as in the other training paths. Test: rollout training reduces the K-step loss (>2x). clippy(-D)/fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
6b7b86fe34 |
SMT D315 (rustytorch): configurable recency-pool decay (sharp vs smooth oracle)
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
SetEncoderConfig gains `recency_decay` (default 0.85) + `with_recency_decay`, threaded into pool_weights. A smaller decay concentrates the recency pool on the most recent tokens — a *sharper* oracle that reacts fast to regime switches (less denoising). Existing teachers default to 0.85 (unchanged). Lets omni-think tune the teacher's reaction speed for non-stationary streams. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
96809d48a1 |
SMT D314 (rustytorch): gradcheck tanh/sigmoid + GatedMemoryUpdater (GRU cell)
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
F.1 — finite-difference gradchecks for tanh, sigmoid, and the exact gated composite (1-z)*m + z*c (z=sigmoid, c=tanh) added to tape_cpu_gradcheck.rs. All pass (rel-err < 2e-2) — the activation VJPs that already existed are now proven correct on the real CpuBackend (E0 discipline), so the gated cell can rely on them. F.2 — GatedMemoryUpdater: a GRU-style gated recurrent memory cell. z = sigmoid([M‖x]·W_z); c = tanh([M‖x]·W_c); M_t = (1-z)⊙M + z⊙c The convex update is a non-expansion (|M_t| ≤ max(|M_0|, 1)), so free rollout stays bounded with NO clamp — and the learned gate can both jump at a regime switch (z≈1) and hold+denoise in steady state (z≈0), which the residual+leaky ClonedMemoryUpdater cannot. Same method surface (new/step/predict/train_step/ train_step_memory) so the omni-think facade is cell-generic. Tests: gated cell trains (loss drops); 500-step free rollout stays in [-1,1] without a clamp. clippy(-D)/fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
efd0dc9f9b |
SMT D312: timestamp-embedded (recency) mode for the predictive-state teacher
CI / Format Check (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
SetEncoderConfig gains an opt-in `recency` flag (default false = unchanged mean-pool stationary behavior). When set, the encoder adds sinusoidal timestamp embeddings to the token embeddings (so attention can reason about position) and pools with an exponential-decay (recent-weighted) reduction instead of a uniform mean — a recent-window sufficient statistic that tracks non-stationary signals. Both use only existing-VJP tape ops (add + matmul/softmax); no new params. Test: recency-mode teacher trains end-to-end (loss >5x drop). Existing stationary tests unchanged. clippy(-D)/fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
1d306ba94b |
SMT E4: stabilize the cloned updater for DAgger (guard/clip + memory-only step)
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
Two robustness additions for on-policy distillation, which trains on the policy's own (clamped, sometimes extreme) visited states: - train_step now skips non-finite-loss steps and clips gradients, so an extreme rollout state can't poison every weight via Adam. - train_step_memory: a memory-only correction at a caller-chosen lr — trains just the recurrence (W_in, W_mem) to map (prev,x)->target_mem, leaving the BC-trained readout (W_read) intact. This is the key to DAgger working: it pulls the free-running memory back toward the oracle trajectory without the readout retraining that otherwise blows the predictions up. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
e888f7fe4c |
SMT E3b: leaky + clamped memory updater for bounded free rollout
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
Make the cloned updater's recurrence M_t = ρ·M_{t-1} + Δ a contraction (ρ=0.9)
and clamp the free-running state (|M| ≤ 4). One-step BC has no signal against
autoregressive drift (that is E4/DAgger's job); these keep a free rollout
numerically bounded — no 1e25 blow-up — so E4 has a stable base to refine.
Training is teacher-forced on the bounded oracle memory, so neither ever binds
during training.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
||
|
|
0ff3fd4e1f |
SMT E3b: ClonedMemoryUpdater — recurrent updater cloned from the oracle (no BPTT)
A trainable recurrent cell g(M_{t-1}, x_t) -> M_t (gelu MLP, residual memory
update) plus a predict-the-future readout, trained on Autodiff<CpuBackend> with
the same host-Adam pattern as SetEncoderTeacher.
train_step is one-step behavioral cloning, TEACHER-FORCED on the oracle memory:
each example feeds the oracle's previous memory and regresses (new_mem ->
target_mem) + (readout -> next latent) in a single tape graph. No rollout, no
backprop-through-time. Off-tape step/predict use a gelu byte-identical to the
CPU tape's (tanh approx, sqrt(2/pi), 0.044715) so rollout matches training.
The residual update M_t = M_{t-1} + delta lets the recurrence rule stay
length-invariant — the basis for extrapolating past the teacher's horizon (E3b
generalization test, omni-cortex side).
Tests: updater learns a one-step transition (>10x loss drop); off-tape
step/predict shapes + finiteness. clippy(-D)/fmt clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
||
|
|
51a9185056 |
SMT E3a: expose Mamba's recurrent state as a single-step updater (equivalence-pinned)
MambaRecurrence reconstructs MambaBlock's selective-scan as an explicit step(state, x_t) -> (state', y_t) recurrence over host f32 weights, with the recurrent state (h, conv-ring) carried between steps. This is the substrate the SMT memory updater is behaviorally cloned on (E3b) — no BPTT, one step at a time. Dimensions are derived from the persisted tensor shapes, so mamba.rs is left untouched (it is near the 1250-LOC cap). silu/softplus are byte-identical copies of the forward's. Equivalence pin (the plan's highest-risk item): stepping a window one token at a time from a zero state reproduces the full-sequence forward EXACTLY — max_abs_diff = 0.0 (bit-identical), on an active_block with wide Delta so the scan genuinely drives the output. Plus a fresh-state determinism test. clippy(-D warnings) + fmt clean on the new module and test. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
1b1ce0604a |
SMT E1: SetEncoderTeacher — the predictive-state oracle (time-parallel, tape-trained)
Promotes the proven attention set-encoder smoke test (PR #4, tape_train_smoke.rs) into a reusable rtx-transformers layer for Supervised Memory Training. The teacher maps a window of past tokens to a fixed-size memory M via embed → self-attention → residual → mean-pool → memory projection, with a decoder head supervised by predict-the-future MSE so that M becomes a sufficient statistic of the past. - Trains end-to-end on Autodiff<CpuBackend> (the gradient-correct real backend from PR #3), with a self-contained deterministic host-side Adam. - Time-parallel by construction (one window → one memory, no recurrence to unroll) — this is the oracle whose trajectory the recurrent Mamba updater is later behaviorally cloned against, so the recurrent net never needs BPTT. - Exposes named_params/set_named_params so the caller (omni-think's PredictiveStateTeacher facade) owns safetensors persistence + BLAKE3 sealing. - Adds rtx-backend + rtx-backend-cpu deps (the tape needs a concrete backend). Tests: teacher trains (loss >5x drop), encode is deterministic + fixed-size, params round-trip. fmt + clippy(-D warnings) clean on the new module. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
5c2ee63d53 |
GPU Mamba forward + rtx-tensor device-pointer API + matrix exponential
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
GPU Tests / Check GPU Availability (pull_request) Has been cancelled
GPU Tests / CUDA Tests (11.8) (pull_request) Has been cancelled
GPU Tests / CUDA Tests (12.1) (pull_request) Has been cancelled
GPU Tests / Metal Tests (pull_request) Has been cancelled
Persist accumulated WIP across rtx-tensor / rtx-transformers / rtx-runtime. Two related feature groups: GPU enablement (unblocks the Phase-3 spec §8 CUDA Mamba path): - rtx-tensor: `Tensor::cuda_device_ptr()` + storage GPU-buffer accessors (`raw_ptr.rs`) expose the raw CUdeviceptr that kernel launches need — the "rtx-tensor GPU memory access API" the Mamba CUDA kernels were blocked on. - rtx-transformers: `MambaBlock::forward_cuda` runs the four linear projections through cuBLAS on-device (in/out/x/dt_proj), keeping the selective scan + conv1d + activations on CPU; dispatched automatically from `forward` when on a CUDA device under the `cuda` feature. Updated `mamba_cuda_kernels.rs` accordingly. - supporting plumbing in rtx-runtime stream/bridge and rtx-tensor storage/conversion/concatenation/creation + rtx-flash-attention. Linear algebra (rtx-tensor): - `linalg/matrix_exp.rs`: real matrix exponential via scaling-and-squaring with a degree-13 Padé approximant (Higham 2005), f64 internally. - `complex/linalg.rs`: complex matmul/adjoint, Hermitian eigendecomposition (`ComplexEigenResult`), and the complex matrix exponential, nalgebra-backed. - tests for both. Builds verified on the CPU path (`cargo check -p rtx-tensor -p rtx-transformers -p rtx-runtime -p rtx-flash-attention` clean). The `cuda` feature and the rtx-backend-cuda NVCC build remain unbuildable on this host (CUDA/glibc header mismatch) — pre-existing and unrelated to these changes. |
||
|
|
639937e9f5 |
Mamba M3.5: canonical numerically-stable initialization
Plain randn(0,1) init made A=-exp(A_log) and Δ wildly large, overflowing
the real exp(Δ·A) scan to NaN (the stub never cared — it discarded these
weights). new()/new_seeded() now share a build() with canonical S6 init:
- A_log = ln(1..=d_state) ⇒ A = -(1..=d_state), bounded
- dt_bias so softplus(dt_bias) ≈ 0.01 (small, stable Δ; near-identity
scan at init — intentional for gradient flow)
- D = 1, zero conv bias, projections scaled by 1/√fan_in (capped 0.5)
This fixes the NaN that broke omni-cortex's d231 action-conditioned
predictor training (now green). Seeded determinism preserved.
Tests: active_block helper (Δ overridden to ≈0.69) exercises the
scan-active regime so the liveness check can observe each weight; the
training test asserts a seed-varying backbone weight (conv1d_weight)
moves. All 6 selective-scan tests green incl. the finite-diff grad check.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
||
|
|
199130fa7d |
Mamba M2: analytic backward (gradient-checked)
Hand-written VJP of the selective-scan forward (Phase-3 spec §5/§7): MambaBlock::backward(x, d_out) -> per-parameter gradients keyed by persistence name, summed over the batch. Differentiates the scan analytically (reverse-time recurrence over the cached h trajectory) rather than through the immature rtx-tensor autograd tape. Covers every parameter: in_proj, conv1d_weight, conv1d_bias, A_log (via A=-exp(A_log) ⇒ dA_log = dA·A), x_proj, dt_proj, dt_bias, D, out_proj. Adds stable sigmoid_f32 / silu_grad_f32 helpers. New test analytic_gradients_match_finite_differences: on a small well-conditioned instance, ≥30 sampled grad elements across all 9 params match central finite differences within (5e-3 + 5e-2·|fd|). All 5 selective-scan tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
00cd527ed4 |
Mamba M1: real selective-scan forward (replaces the passthrough stub)
The MambaBlock forward was a stub — SelectiveScan::forward passed input through, discretize returned zeros, conv1d was a no-op, and B/C were randn per call, leaving conv1d_weight/dt_proj/A_log as dead weights with zero temporal mixing. This implements a genuine S6 selective-scan: - New params: x_proj [d_inner, dt_rank+2*d_state] (data-dependent dt,B,C), dt_bias [d_inner], D [d_inner] (skip). Added to new()/new_seeded() and the persistence contract (persistence_tensors/from_persistence_tensors). - Real forward (CPU f32, looped — backbone is small): in_proj -> causal depthwise conv1d -> SiLU -> x_proj->(dt,B,C) -> delta=softplus(dt.dt_proj +dt_bias) -> A=-exp(A_log) -> sequential scan h=dA.h+dBu, y=sum C.h + D.u -> gate by SiLU(z) -> out_proj. Residual moved OUT (canonical). Numerically-stable silu_f32/softplus_f32 helpers. - The scan runs inline (not via the immature rtx-tensor autograd tape); the analytic backward lands in M2 per docs/phase3_real_ssm_spec.md. New tests/real_selective_scan.rs (4 cases, all green): liveness (each formerly-dead weight now moves the output), causality (no future leakage), seeded determinism, and finite/non-constant output. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
||
|
|
ae53983c03 |
style: cargo fmt --all (18 files)
Auto-merged by ci-doctor. |
||
|
|
3e3e8819f6 |
rtx-tensor + rtx-transformers: deterministic init + Mamba weight persistence
Two coordinated additions for the omni-cortex D249/D250 work:
rtx-tensor: Tensor::randn_seeded(shape, device, seed) — like
randn() but routes through StdRng::seed_from_u64(seed) so two
calls with (shape, device, seed) produce bit-exact identical
tensors. CPU is the canonical generator; GPU calls go via to_device
transfer. Required for reproducible model init.
rtx-transformers: MambaBlock gains:
- new_seeded(config, device, seed) — every internal weight tensor
initialised via randn_seeded() with per-tensor SplitMix64-derived
seeds. Two calls with the same (config, device, seed) → bit-
exact identical block.
- persistence_tensors() -> Vec<(&'static str, &Tensor)> — read-only
view of the six (or seven, with conv_bias) internal weight
tensors with canonical names (in_proj, conv1d_weight,
conv1d_bias?, A_log, dt_proj, out_proj). Stable across versions
so safetensors round-trip works.
- from_persistence_tensors(config, device, HashMap<String, Tensor>)
— rebuild a MambaBlock from a name → tensor map. Validates each
tensor's shape against the config and surfaces clean errors on
mismatch (so wrong-DIM safetensors loads fail explicitly).
These three primitives together give omni-cortex's D249 (operator-
seeded determinism) and D250 (safetensors round-trip + BLAKE3 hash
pin) clean library hooks without exposing MambaBlock's private
fields.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
||
|
|
02d382d5f6 |
style: apply rustfmt across all crates and demos
Consistent formatting pass: line wrapping, import sorting, trailing whitespace removal, let-chain indentation, merged derive attributes, and unsafe block reformatting. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> |
||
|
|
4d88dc0584 | Initial commit |