class

MicroGPT::CooperativeModel

Inherits MicroGPT::MathUtils < Reference < Object

Constructors

new(expert_configs : Array(Config), stream_dim : Int32, has_counter : Bool = true, router : Router | Nil = nil)
Source

Instance methods

active_stream_dims

Stream bandwidth masking: only first active_stream_dims carry signal Allows testing narrower streams without resizing matrices

Source
active_stream_dims=(active_stream_dims : Int32)

Stream bandwidth masking: only first active_stream_dims carry signal Allows testing narrower streams without resizing matrices

Source
all_adam_mats

Collect Adam m/v Mats in same order as all_weight_mats Returns [w0_m, w0_v, w1_m, w1_v, ...] — 2 Mats per weight Mat

Source
all_grad_mats

Collect gradient Mats in same order as all_weight_mats

Source
all_weight_mats

Collect ALL weight matrices in deterministic order (for WeightStore)

Source
attach_bigram(table : BigramTable | TrigramTable | CalculatorExpert)

Attach a bigram table as algorithmic expert 0 Call after initialize — replaces counter if present

Source
bigram_table

N-gram / algorithmic expert: fixed lookup table + learned projection

Source
counter_pos

True counter: learned positional signal injected directly into stream Only seq_len × stream_dim params — no transformer, no logits

Source
detach_bigram
Source
effective_stream_width
Source
experts
Source
forward(input_ids : Array(Int32)) : Mat
Source
generate(start_ids : Array(Int32), max_tokens : Int32, temperature : Float64 = 1.0) : Array(Int32)
Source
has_counter
Source
n_experts
Source
param_count
Source
router

Pluggable router

Source
router_weights_str
Source
stream_dim
Source
train_step(input_ids : Array(Int32), target_ids : Array(Int32)) : Float64
Source
w_bigram
Source
w_reads

Per-expert stream interface

Source
w_writes
Source