Sovereign Models and GGUFs
Collection
Small, local-first language models. Nemotron fine-tunes, reward models, deterministic routing, and GGUF exports. Everything runs on consumer GPUs. β’ 24 items β’ Updated
Rust harness for MACROGROK fixed-point macro-models and Transformer-X CUDA (Tensor Core WMMA, attention memory, Tavily RAG).
tokio, cudarc 0.11, reqwest, half) + CUDA cudarc / custom kernelsWMMA 16x16x16 (mma.sync path available), explicit AttentionMemory KV-cache (contiguous/paged), FlashAttention online-softmax tilingQ1.14/Q3.12 fixed-point INFER4 harness (src/macrogrok/)POST https://api.tavily.com/search, search_depth=advanced)attention_tc.cu (insert sparsity mask / linear state / IndexPool before/after WMMA)Cargo.toml
src/
main.rs β tokio main, Transformer load, AttentionMemory, Tavily loop
memory.rs β AttentionMemory {k_cache, v_cache} [layers, heads, max_seq, head_dim]
attention.rs β TensorCoreAttention {forward()} (WMMA)
transformer.rs β TransformerConfig / Block / forward
tavily.rs β TavilyClient::search()
macrogrok/mod.rs β Q-format INFER4 Rust port (mirrors MACROGROK/src/sim.py)
cuda/
attention_tc.cu β WMMA kernel (QK^T + softmax + PV, head_dim tiling, smem)
tma_mbarrier.ptx β Hopper TMA + mbarrier bulk tensor (2D shared::cluster)
src/macrogrok/tests β fixed-point vectors
# Cargo.toml excerpt
[dependencies]
cudarc = { version = "0.11", features = ["cuda-12000"] }
anyhow = "1"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
half = "2"
bytemuck = "1"
cargo build --release
cargo test
# CUDA kernels: nvcc -arch=sm_80 -ptx cuda/attention_tc.cu -o attention_tc.ptx
# Run
TAVILY_API_KEY=... cargo run --release -- --prompt "hello"
python -m pytest # if Python harness tests
use macrogrok_harness::macrogrok::{infer4, Q1_14};
let input = [Q1_14(16384), Q1_14(0), Q1_14(0), Q1_14(0)];
let (output, score, flags) = infer4(input); // Q1.14, Q3.12, flags
Matches MACROGROK/examples/infer4.asm semantics: Q1.14*Q1.14>>4 accum Q3.24 β >>12 β +BIAS_Q3_12 β SAT β THRESHOLD β UPDATE_STATE_3_4 (3*STATE+TARGET)/4.
tokenize β Transformer::forward (QKV proj GEMM β TensorCoreAttention::forward β MLP)
β if tool call JSON β TavilyClient::search β inject β continue
β AttentionMemory grows (reset on overflow)
half inputs, float accumulator, scale=1/sqrt(head_dim), causal mask, __shfl_xor max/sum reductions, __float2half store via smem_out (wmma::store_matrix_sync β shared β half).head_dim>16 (64/128): outer d_tile loops for QK^T reduction and AV.cp.async.bulk.tensor.2d.shared::cluster.global.mbarrier::complete_tx::bytes + mbarrier.init/arrive.expect_tx/try_wait (see cuda/tma_mbarrier.ptx). On Hopper cuda::memcpy_async lowers to TMA when 16-byte aligned + barrier in SMEM.BSL-1.1 / AGPL-3.0 / MPL-2.0 β Patent Pending, BEL ESPRIT D ACCORD TRUST HOLDINGS INC.