1 vin.modules.qh_state_fusion
vin.modules.qh_state_fusion
Candidate-independent-row fusion controls for finite-horizon state tokens.
The finite-horizon scorer builds one candidate query and five shared state tokens—scene, target, causal history, remaining budget :math:b_t, and requested horizon :math:h. This module owns only the interaction that turns those identical inputs into one candidate-aligned context vector. It never reads candidate validity, action validity, labels, rewards, or other candidate rows.
independent_mlp is the A0 interaction control. It concatenates each query with the five tokens in their manifest-defined semantic order and applies the same MLP independently to every candidate row. cross_attention is A1: each candidate query reads the shared tokens through multi-head cross-attention. Both return the same H-wide context, so the downstream [query, context, query * context] decoder feature is unchanged. The comparison therefore varies interaction structure without varying the actor carrier, target/source protocol, horizon semantics, decoder family, or mask ownership.
A0 and A1 are not asserted to be parameter matched. Experiments must report trainable parameter counts and runtime alongside held-out value and policy evidence. Neither control models candidate-candidate interaction; jointly permuting candidate rows must jointly permute their contexts.
1.1 Attributes
| Name | Description |
|---|---|
| QhStateFusionConfig | Discriminated A0/A1 interaction configuration persisted with the scorer. |
1.2 Classes
| Name | Description |
|---|---|
| QhCrossAttentionStateFusion | Let each candidate query independently read the shared state tokens. |
| QhCrossAttentionStateFusionConfig | Configure the A1 candidate-to-state cross-attention interaction. |
| QhIndependentMlpStateFusion | Fuse the same named state tokens independently for each candidate. |
| QhIndependentMlpStateFusionConfig | Configure the A0 identical-feature independent-row MLP control. |
1.2.1 QhCrossAttentionStateFusion
vin.modules.qh_state_fusion.QhCrossAttentionStateFusion(
config,
*,
hidden_dim,
state_token_count,
dropout,
)Let each candidate query independently read the shared state tokens.
A1 computes :math:c_{t,i}=\operatorname{CrossAttn}(x_{t,i},Z_t,Z_t). State tokens are shared within one state, but candidate queries never serve as keys or values. Consequently no candidate can change another candidate’s context, and no candidate mask is required inside this module. Padding is sanitized by the scorer before fusion and zeroed at its output boundary; authoritative action validity remains adapter-owned.
1.2.1.1 Methods
| Name | Description |
|---|---|
| forward | Return Tensor["B S N H", float32] A1 candidate contexts. |
1.2.1.1.1 forward
vin.modules.qh_state_fusion.QhCrossAttentionStateFusion.forward(
candidate_queries,
state_tokens,
)Return Tensor["B S N H", float32] A1 candidate contexts.
1.2.2 QhCrossAttentionStateFusionConfig
vin.modules.qh_state_fusion.QhCrossAttentionStateFusionConfig()Configure the A1 candidate-to-state cross-attention interaction.
1.2.2.1 Attributes
| Name | Description |
|---|---|
| kind | Discriminator persisted in scorer and inference-bundle configuration. |
| attention_heads | Parallel candidate-to-state attention heads; must divide scorer width. |
| target_type | Return the runtime A1 state-fusion class. |
1.2.3 QhIndependentMlpStateFusion
vin.modules.qh_state_fusion.QhIndependentMlpStateFusion(
config,
*,
hidden_dim,
state_token_count,
dropout,
)Fuse the same named state tokens independently for each candidate.
For candidate query :math:x_{t,i} and ordered state-token tuple :math:Z_t, A0 computes :math:c_{t,i}=\operatorname{MLP}([x_{t,i};\operatorname{vec}(Z_t)]). The fixed token order is semantic—not sampled candidate order—and lets the control retain every input available to A1 without content-adaptive token selection. The shared row-wise map preserves candidate permutation equivariance and duplicate-row identity by construction.
1.2.3.1 Methods
| Name | Description |
|---|---|
| forward | Return Tensor["B S N H", float32] A0 candidate contexts. |
1.2.3.1.1 forward
vin.modules.qh_state_fusion.QhIndependentMlpStateFusion.forward(
candidate_queries,
state_tokens,
)Return Tensor["B S N H", float32] A0 candidate contexts.
1.2.3.1.1.1 Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| candidate_queries | Tensor | Candidate-local value queries with shape [B,S,N,H]. Rows are processed independently. |
required |
| state_tokens | Tensor | Shared named tokens with shape [B,S,K,H] in the scorer-defined semantic order, where K equals the manifest-bound constructor value. |
required |
1.2.4 QhIndependentMlpStateFusionConfig
vin.modules.qh_state_fusion.QhIndependentMlpStateFusionConfig()Configure the A0 identical-feature independent-row MLP control.
1.2.4.1 Attributes
| Name | Description |
|---|---|
| kind | Discriminator persisted in scorer and inference-bundle configuration. |
| target_type | Return the runtime A0 state-fusion class. |