model-architecture
Inspect and configure HRM ACT v1 model internals, losses, FlashAttention layers, and dynamic model identifiers.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-architecture
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Inspect and configure HRM ACT v1 model internals, losses, FlashAttention layers, and dynamic model identifiers.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md3.5 KB
- 参考文档references/architecture.md3.2 KB
- 参考文档references/troubleshooting.md3.2 KB
- 脚本scripts/inspect_model_config.py5.1 KB
03 SKILL.md 正文
HRM Model Architecture
Use this sub-skill when the task is to understand, configure, inspect, or debug the Hierarchical Reasoning Model (HRM) ACT v1 implementation rather than to run full training.
When to use
- The user asks about HRM high-level/low-level recurrent modules, ACT halting, Q heads, carry state, sparse puzzle embeddings, StableMax loss, or FlashAttention-backed attention blocks.
- A config mentions
arch.name=hrm.hrm_act_v1@HierarchicalReasoningModel_ACTV1orarch.loss.name=losses@ACTLossHead. - A model import fails because
flash_attn,flash_attn_interface,adam_atan2_backend, CUDA, or dynamicmodule@classidentifiers are wrong. - The user needs to alter hidden size, heads, cycles, layers, positional encodings, halt steps, or loss type safely.
Route map
- Read references/architecture.md for the HRM ACT v1 object graph, carry objects, input/output tensors, and halting mechanics.
- Read references/api-reference.md for verified config fields, function/class signatures, losses, and dynamic identifier rules.
- Read references/troubleshooting.md for import/backend/config errors.
- Run scripts/inspect_model_config.py to inspect identifiers and optionally run CUDA dependency smokes from an HRM checkout.
Critical facts
- The default architecture config uses
hrm.hrm_act_v1@HierarchicalReasoningModel_ACTV1wrapped bylosses@ACTLossHeadwithloss_type=stablemax_cross_entropy. models/layers.pyimports FlashAttention at module import time. If neitherflash_attn_interfacenorflash_attnis importable, HRM model imports fail.pretrain.pyimportsAdamATan2fromadam_atan2; real training requires the compiledadam_atan2_backendCUDA extension.- Real model construction and forward execution are CUDA-oriented. CPU imports and source inspection are useful for config facts but do not verify the required training/evaluation backend.
- The repository's tiny model smoke under current dependency versions exposed a
runtime issue where FlashAttention output may be non-contiguous and
models/layers.pycalls.view(...); use this as troubleshooting evidence if a forward pass fails with a stride/view error.
Boundaries
- This sub-skill owns model/loss/config/API understanding and environment smokes for model dependencies.
- Use
data-preparationfor dataset schema, builders, and visualization. - Use
training-evaluationfor Hydra training commands, checkpoint evaluation, W&B, and ARC post-processing. - Do not present a CPU import as proof that HRM can train or evaluate. The backend gate is CUDA + FlashAttention + adam-atan2 backend.
Bounded inspection
From an HRM checkout, run:
python <skill>/sub-skills/model-architecture/scripts/inspect_model_config.py \
--repo-root /path/to/HRM --json
If a CUDA environment is prepared and the user wants dependency readiness:
python <skill>/sub-skills/model-architecture/scripts/inspect_model_config.py \
--repo-root /path/to/HRM --cuda-smoke
The helper verifies imports and dependency smokes. It intentionally avoids long training and does not require real datasets or checkpoints.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).