mstar.engine.resources.recurrent.config#
What a model declares about a pool of recurrent state.
Kept free of the manager so declaring a step does not import a backend. The pool is ignorant of what the state means: a slot is a fixed number of bytes per layer, so capacity is a slot count and a fork is a fixed-size copy.
Classes
|
Head geometry of the delta-net family: gated delta rule (Qwen3.5, Qwen3-Next) and Kimi delta attention (Kimi Linear, GLM-5.3). |
|
Head geometry of a Mamba-2 (SSD) layer: Nemotron-H, NVIDIA's Nemotron Nano/VoiceChat backbones, Mamba-Codestral. |
|
One per-slot, per-layer tensor block. |
|
|
|
|
|
One step's work against the pool. |
- class mstar.engine.resources.recurrent.config.DeltaNetGeometry(num_k_heads, num_v_heads, head_k_dim, head_v_dim, conv_kernel_size)[source]#
Bases:
RecurrentGeometryHead geometry of the delta-net family: gated delta rule (Qwen3.5, Qwen3-Next) and Kimi delta attention (Kimi Linear, GLM-5.3).
Both carry a K-last [HV, V, K] state matrix (FlashInfer’s pool layout) and a conv window holding every tap but the current token’s.
to_blocksandfrom_blocksare inverses, so a backend reads its geometry off the pool.- Parameters:
- classmethod from_blocks(blocks)[source]#
Recover head counts from (possibly sharded) block shapes.
Raises if the shapes are not a delta-net’s.
- Parameters:
blocks (dict[str, RecurrentBlockConfig])
- Return type:
- class mstar.engine.resources.recurrent.config.Mamba2Geometry(num_heads, head_dim, state_size, n_groups, conv_kernel_size)[source]#
Bases:
RecurrentGeometryHead geometry of a Mamba-2 (SSD) layer: Nemotron-H, NVIDIA’s Nemotron Nano/VoiceChat backbones, Mamba-Codestral.
Two blocks, like the delta-net family: an
[H, P, N]SSM state per head (fp32 by default: it is an exponentially decayed running sum over the whole session, and the reference keeps it in fp32) and the conv window over the[x | B | C]projection, every tap but the current token’s.n_groupsis the number ofB/Cgroups shared byHheads. It is a shape fact (conv_dim = H * P + 2 * n_groups * N), so it is recoverable from the blocks andfrom_blocksinvertsto_blocks.- classmethod from_blocks(blocks)[source]#
Recover the geometry from block shapes (sharded ones too, since every axis involved shards). Raises on shapes that are not a Mamba-2’s, which is the check that a pool and the resource planning against it were built for the same model.
- Parameters:
blocks (dict[str, RecurrentBlockConfig])
- Return type:
- class mstar.engine.resources.recurrent.config.RecurrentBlockConfig(shape, dtype, shard_dims=())[source]#
Bases:
objectOne per-slot, per-layer tensor block.
shapeis opaque to the pool.shard_dimsnames the axes divided across ranks.
- class mstar.engine.resources.recurrent.config.RecurrentGeometry[source]#
Bases:
ABC- abstractmethod classmethod from_blocks(blocks)[source]#
- Parameters:
blocks (dict[str, RecurrentBlockConfig])
- Return type:
- class mstar.engine.resources.recurrent.config.RecurrentStateConfig(num_layers: int, blocks: dict[str, mstar.engine.resources.recurrent.config.RecurrentBlockConfig]=<factory>, max_slots: int = 256, disable_sink_slot: bool = False)[source]#
Bases:
object- Parameters:
- blocks: dict[str, RecurrentBlockConfig]#
- class mstar.engine.resources.recurrent.config.RecurrentStateSpec(resource_key: str, nodes: set[str], config: mstar.engine.resources.recurrent.config.RecurrentStateConfig)[source]#
Bases:
NodeResourceSpec- Parameters:
resource_key (str)
config (RecurrentStateConfig)
- apply_yaml_overrides(max_slots=None, state_dtype=None)[source]#
How many slots this deployment gets, and the state’s dtype.
Block shapes are the model’s and not tunable. The dtype trades accumulated precision against bandwidth and decides which kernels the backend can reach.
- config: RecurrentStateConfig#
- class mstar.engine.resources.recurrent.config.RecurrentStep(segments=None, pre_forks=(), post_forks=())[source]#
Bases:
ResourceStepOne step’s work against the pool.
No
commitflag, unlikeKVStep: a backend writes the pool in place, so a non-committing reader needs two labels, reading one and writing another.Forks mirror
KVStep’s:(from_label, to_label)pairs, reserved at admit and copied at plan (pre) or commit (post).- Parameters: