Elamur Groupants⌕
☰

gparse-model-attention

The groupant beside gparse/src/model.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.

Facts

Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.

Components

componentlabelwhere
approximantpartialapproximant
astpartial../syntax.json
costsymbolic source derivedinvariant
descriptantpresentdescriptant
invariantpartialinvariant
testspartial bounded checkstests

Obernants

The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.

idtypelabelwhere
behavior_complementbehavior_complementpartial source derived modelbehavior_complement
reverse_reconstructionreverse_reconstructionpartial source derived modelreverse_reconstruction
gradient_dispatchgradient_dispatchpartial source derived modelgradient_dispatch
mask_biasmask_biaspartial source derived modelmask_bias
residual_stateresidual_statepartial source derived modelresidual_state
dimension_domaindimension_domainpartial source derived modeldimension_domain

Model text

descriptant

Source-bound description

Embedding sum and pre-LN transformer dispatch attention softmax by (fused,train), then biaffine masked arcs.

Epoch 2026-10-31

Prospective model was recorded before edits. Added tests use bounded synthetic fixtures; production algorithms unchanged. Coverage is partial, not proof. No trained corpus, live teacher or throughput experiment was executed.

approximant

Forward approximant

Embedding sum and pre-LN transformer dispatch attention softmax by (fused,train), then biaffine masked arcs.

Domain: valid source-specific dimensions and resources stated in invariant; no automatic production substitution. Numerical observations are finite checks, not an end-to-end relative bound. Executable Rust surrogate: unsupported gap; existing exact tests are not surrogates. Future metric-specific caps may be 1/2/5/10%, never above 10%.

invariant

Invariant and cost

Fused training uses p*(g-dot) backward; inference fused path has no Q/K backward. Valid B,T,heads dimensions required.

Cost

O(BTd+L*(BTd²+BT²d+BTdf)+BTda+BTa²+BT²a); attention probabilities occupy BHT², with retained graphs in training. BTd embedding/final-LN work remains at L=0.

Allocation, finite arithmetic, platform dimensions and external failures are not universally certified.

models

Typed model catalog

behavior_complement

Public train fused cannot invoke upstream inference-only softmax.

reverse_reconstruction

Categorical outputs cannot recover encoder or logits; encoder itself admits embedding-sum parameter symmetries.

gradient_dispatch

(true,true)=custom differentiable;(true,false)=upstream fused;(false,_)=reference.

mask_bias

keys-1 multiplied1e9 on attention/head columns; finite negative bias not hard exclusion for arbitrary huge logits.

residual_state

Pre-LN attention and FF outputs add to h; final LN precedes head projections.

dimension_domain

heads nonzero,d divisible heads,position/feature indices valid; no centralized config validation.

tests

Checks and limits

Selected parent checks relevant to this fragment (not exhaustive): model::tests::embeddings_get_gradients; model::fused::which_ops_backprop; activation_configuration_roundtrips; CUDA gradient/GELU/synthetic optimizer checks; CPU prediction

Selected commands run twice debug and twice release; exact receipts and source-to-test mapping retained in wave30 gparse external run directory. Tests do not certify allocation failure, all NaN/overflow inputs, trained-model accuracy or corpus timing. Compiled mutants cover selected boundaries; per-source coverage is recorded in the external map, not presumed.

This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/gparse/src/model.rs.groupant/attention.groupant/