feat(hpt): stems and trunk as graph stages - #43
Open
AnikethCheluva wants to merge 1 commit into
Open
Conversation
This was referenced Sep 8, 2026
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Sep 8, 2026
AnikethCheluva
marked this pull request as ready for review
September 8, 2026 05:02
AnikethCheluva
force-pushed
the
graph-hpt-stems
branch
from
September 9, 2026 22:21
660f728 to
9ecc0bc
Compare
AnikethCheluva
force-pushed
the
graph-hpt-deps
branch
from
September 9, 2026 22:21
ef882c9 to
4f15d96
Compare
AnikethCheluva
force-pushed
the
graph-hpt-deps
branch
from
September 10, 2026 17:56
4f15d96 to
8f8eee3
Compare
AnikethCheluva
force-pushed
the
graph-hpt-stems
branch
from
September 10, 2026 17:56
9ecc0bc to
19baa32
Compare
This was referenced Sep 10, 2026
Decomposes HPT's input side into two stages instead of one opaque node:
observations --HPTStemStage--> hpt/tokens --HPTTrunkStage--> condition
HPTStemStage runs a PolicyStem per modality, each compressing to a fixed latent
count via cross-attention, and concatenates them along the token axis. That
pooling is what lets a 14-D pose and a 512-D image feature meet in one sequence
the trunk can attend over. Stems run in sorted key order so the token layout is
deterministic -- dict ordering would otherwise let DDP ranks diverge.
HPTTrunkStage attends over those tokens and pools to one vector, written as
"condition". That is deliberately the key the DP and flow heads already read,
so an HPT representation feeds any head in the graph without changing it --
which is the whole point of decomposing rather than wrapping.
Per-domain behaviour keeps the runner ignorant of domains: optional
domain_stems and the trunk's domain embedding both resolve their branch from a
batch key via resolve_homogeneous_scalar, the same mechanism
KeyedFeatureProjection uses.
Two adaptations were needed. nn.ModuleDict rejects "." in keys and batch keys
are dotted paths, so modules are stored under sanitized names with the mapping
kept explicit for readable checkpoint keys. And the cross-attention spec is
accepted as either a DictConfig or a plain dict, since hydra gives one and a
hand-built stem the other.
Tests cover the contracts, latent pooling, sorted ordering, dotted keys, width
mismatches, all three pooling modes, position-embedding bounds, domain
selection and rejection, that the position table is a buffer rather than a
trained parameter, and that the two compose into a runnable subgraph whose
condition is differentiable back to the stems.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AnikethCheluva
force-pushed
the
graph-hpt-deps
branch
from
September 10, 2026 22:20
8f8eee3 to
1003152
Compare
AnikethCheluva
force-pushed
the
graph-hpt-stems
branch
from
September 10, 2026 22:20
19baa32 to
1ea7234
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Decomposes HPT's input side into two stages instead of one opaque node:
HPTStemStage runs a PolicyStem per modality, each compressing to a fixed latent
count via cross-attention, and concatenates them along the token axis. That
pooling is what lets a 14-D pose and a 512-D image feature meet in one sequence
the trunk can attend over. Stems run in sorted key order so the token layout is
deterministic -- dict ordering would otherwise let DDP ranks diverge.
HPTTrunkStage attends over those tokens and pools to one vector, written as
"condition". That is deliberately the key the DP and flow heads already read,
so an HPT representation feeds any head in the graph without changing it --
which is the whole point of decomposing rather than wrapping.
Per-domain behaviour keeps the runner ignorant of domains: optional
domain_stems and the trunk's domain embedding both resolve their branch from a
batch key via resolve_homogeneous_scalar, the same mechanism
KeyedFeatureProjection uses.
Two adaptations were needed. nn.ModuleDict rejects "." in keys and batch keys
are dotted paths, so modules are stored under sanitized names with the mapping
kept explicit for readable checkpoint keys. And the cross-attention spec is
accepted as either a DictConfig or a plain dict, since hydra gives one and a
hand-built stem the other.
Tests cover the contracts, latent pooling, sorted ordering, dotted keys, width
mismatches, all three pooling modes, position-embedding bounds, domain
selection and rejection, that the position table is a buffer rather than a
trained parameter, and that the two compose into a runnable subgraph whose
condition is differentiable back to the stems.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com