Cosmic v0.5 (53.43M) β€” Zero-Attention Pure-Rust + Native CUDA Architecture

Cosmic v0.5 is a ground-up, zero-PyTorch, zero-external-crate Rust + Native CUDA sequence architecture with ZERO Q Γ— K^T attention and ZERO KV cache, designed and trained from scratch on a single consumer RTX 4060 Ti (8 GB VRAM, $0.00).


Core Architecture (100% Learned, Strictly Non-Rule-Based)

  1. 1-Token Streaming Input + Immediate Flush: Processes tokens sequentially without building a T Γ— T attention matrix or a growing KV cache.
  2. Numeric u16 Token IDs + @ Meta-Tokens: Reserves IDs 0..7 for @S1, @E1, @REQ, @OK, @WIPE, with a zero-dependency Pure-Rust 2,048-vocab BPE tokenizer (cosmic_bpe_2048.cbpe).
  3. Scoped Attention (scoped_attention.rs): Multi-timescale log-spaced decay memory (fast/medium/slow horizons) with learned soft-eviction gates.
  4. 2D Spreadsheet / Grid Context (grid_context.rs): Structured 2D cell context instead of a flat 1D tape.
  5. Direct-Indexed Surgical knowledge.rs Bus (Direct Index [0..V-1]):
    • Strictly a direct index (archive[token_id], indexed directly from [0] to [V-1]) β€” ZERO inverted index, ZERO learned lookup weights, ZERO whole-page RAG dumps.
    • On every token, knowledge.rs jumps straight to archive[token_id] in O(1) time inside fast on-chip SRAM, pulls only the minimal surgical role record for that exact token, and immediately flushes.
  6. Native Internal WIPE (wipe.rs): Model-controlled garbage collector / compactor that clears saturated context cells autonomously (zero external harness).
  7. Ultra-Low-VRAM ~3.06 Bytes/Param Native CUDA Engine (cosmic_gpu.cu):
    • BF16 Master Weights + IEEE Stochastic Rounding (2.0 B/param)
    • ZERO Global Gradient Buffer (layer-by-layer fused backward + immediate update, 0 B/param)
    • V-Optimizer v3 (Block-64 INT8 momentum + FP16 block scale + FP16 block RMS = 1.06 B/param, 86.7% less than FP32 AdamW!)
    • 1-Layer BF16 Activation Checkpointing (scales the exact same engine up to 1.024B unique parameters in 4.86 GB total VRAM on an 8 GB GPU!)

Verified Scientific Receipts (RTX 4060 Ti 8 GB, $0.00)

Receipt #1 β€” Real-Data Parity at 53.43M on 120M Chars of Real FineWeb-Edu (15.0 min)

Exact same HuggingFaceFW/fineweb-edu (sample-10BT) 120.00M-char train / 4.03M-char unseen val split, exact same cosmic_bpe_2048.cbpe tokenizer, exact same B=16Γ—512 (8,192 toks/step), exact same WSD schedule, past_diff = 0.00e+00 strict causality QA passed on both:

Metric Cosmic v0.5 [50M] (Rust + CUDA, 0 PyTorch, 0 QΓ—Kα΅€ attn) FlashRoPE-TF [50M] (PyTorch BF16 + FlashAttn + RoPE + AdamW) Result
Exact Params 53,428,480 (53.43M) 53,425,280 (53.43M) Matched (0.006%)
System GPU VRAM 2.24 GB (2,298.5 MB) 4.95 GB (5,068.5 MB) 2.21Γ— LESS VRAM
Optimizer RAM 54.14 MB (1.06 B/param) 407.60 MB (8.00 B/param) 7.53Γ— LESS RAM
Equal-Step val_BPC 1.5698 BPC (@ step 4,224) 1.5782 BPC (@ step 4,296) Cosmic wins at equal tokens!
15-Min t=15.0m val_BPC 1.5698 BPC (24b: 1.6021) 1.5659 BPC (24b: 1.5363) Virtual parity (0.0039 BPC)
Throughput 38,437 tok/s (67,418 chars/s, ckpt ON) 41,855 tok/s (73,413 chars/s, unckpt) Within 8% even WITH checkpointing

Receipt #2 β€” 4,096-Token Needle-in-a-Haystack Verbatim Recall (ZERO Attention!)

16 random key-value needles buried 3,500+ tokens back behind random haystack noise (1,024 unseen queries, random = 1.56%, past_diff = 0.00e+00 verified on all three):

Model (T = 4,096) Strict Causality QA Steps (45s) Unseen 4K Needle Recall
Pure 1D Recurrent (NO knowledge.rs) 0.00e+00 PASS 24 1.37% (14 / 1,024)
FlashRoPE-TF (Full O(TΒ²) FlashAttention) 0.00e+00 PASS 1,081 1.46% (15 / 1,024)
Cosmic ZERO-ATTN + Direct-Indexed knowledge.rs 0.00e+00 PASS 21 100.00% (1,024 / 1,024!!)

Verified 1.024B Low-VRAM Scaling Proof (Same cosmic_gpu.cu Engine)

  • --preset 1b (1,023,512,576 unique params, L=22, D=2048, F=5376): Trains 100% on-GPU in 4.86 GB total system VRAM (V-Optimizer v3: 1.01 GB vs 8.0 GB AdamW!) with 3.1+ GB still free on an 8 GB RTX 4060 Ti (past_diff = 0.00e0 PASS).

Files Included

  • cosmic_50m_fineweb_15m.ccosmic (156.0 MB): Verified 53.43M FineWeb-Edu BF16 weights + V-Optimizer v3 INT8 state (resumable directly via --resume).
  • cosmic_bpe_2048.cbpe: Pure-Rust 2,048-vocab BPE merge table.
  • cuda/cosmic_gpu.cu, src/*.rs, Cargo.toml, build.rs, build_cosmic_gpu.bat: Complete zero-PyTorch Rust + CUDA source code (--preset 1m through --preset 1b).
  • bench_flashrope_50m_fineweb.py & receipt2_needle_recall.py: Exact reproducible benchmark scripts for Receipt #1 & Receipt #2.

Build & Resume Locally (Windows + CUDA)

cmd /c build_cosmic_gpu.bat
cargo build --release --features gpu
.\target\release\cosmic.exe --gpu --bpe --preset 50m --resume cosmic_50m_fineweb_15m.ccosmic <train.txt> <val.txt> 900

Honest Limitations

  • cosmic_50m_fineweb_15m.ccosmic is a 53.43M base model trained for 15 minutes (34.60M BPE tokens = 60.69M chars of FineWeb-Edu), so it is an early pretraining checkpoint β€” coherent on English grammar and topic continuity, not an instruction-tuned assistant.
  • Direct-indexed knowledge.rs provides exact O(1) single-key transition recall; multi-hop compositional reasoning across unseen long documents remains an active area of research.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train VoidOSS/Cosmic-v0.5-50M-FineWebEdu