AGENT SKILL

models-and-mcts

Inspects and debugs MuZero General networks, tensor shapes, support transforms, GameHistory stacking, and MCTS behavior.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
models-and-mcts
license
MIT
metadata
{ "disco-role": "operating" }
description
Inspects and debugs MuZero General networks, tensor shapes, support transforms, GameHistory stacking, and MCTS behavior.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Models and MCTS

Use this sub-skill when a task is about MuZero General's model stack or search internals: FC vs ResNet construction, initial_inference / recurrent_inference, support scalar transforms, GameHistory stacking, legal-action masking, root Dirichlet noise, Node / MinMaxStats, or MCTS search-path behavior.

Fast route

  1. Read network-and-mcts-reference.md for the architecture factory, verified method signatures, inference outputs, node expansion, MinMaxStats, and search/backpropagation logic.

  2. Read tensor-shapes-and-support.md before debugging observation rank, stacked observations, hidden-state/action tensors, policy/value/reward support vectors, or FC-vs-ResNet shape differences.

  3. Read troubleshooting.md when there is a shape assertion, empty or illegal legal action list, support-size mismatch, device mismatch, DataParallel confusion, or MCTS runtime blow-up.

  4. Run the bundled checker for safe API/tensor validation, not training:

    python sub-skills/models-and-mcts/scripts/model_mcts_smoke.py --case both --num-simulations 1
    

    Useful checker options: --case cartpole-fc|tictactoe-resnet|both|custom, --game-module games.tictactoe, --network config|fullyconnected|resnet, --device cpu|cuda|auto, --stacked-observations N, --legal-actions 0,1, --add-exploration-noise, and --json.

Scope and routing boundaries

This sub-skill owns:

  • models.MuZeroNetwork(config) factory behavior for config.network == "fullyconnected" and "resnet".
  • FC/ResNet config fields that affect model construction and tensor shapes.
  • initial_inference(observation) and recurrent_inference(hidden_state, action) output meanings and dimensions.
  • models.scalar_to_support / models.support_to_scalar value and reward transforms.
  • self_play.MCTS.run, Node, MinMaxStats, GameHistory.get_stacked_observations, legal-action root masking, Dirichlet root exploration, and one-/two-player value sign handling.
  • CPU/GPU basics for model/search tensor placement.

Route elsewhere when the task is primarily about:

  • Observation/action/player field authoring or custom game wrappers: read sibling sub-skill games-and-configs at ../games-and-configs/SKILL.md first, then return here for tensor/search debugging.
  • CLI, Ray workers, training loops, replay/trainer orchestration, or TensorBoard runtime: read training-and-cli at ../training-and-cli/SKILL.md.
  • Loading checkpoints, inspecting saved weights, plotting diagnostics, or determining checkpoint/model compatibility: read checkpoints-and-diagnostics at ../checkpoints-and-diagnostics/SKILL.md.

Minimal debugging pattern

  • Validate the game config fields first: observation_shape, action_space, players, stacked_observations, network, support_size, and the FC/ResNet layer fields.
  • Use model_mcts_smoke.py with CPU defaults to isolate pure tensor/API issues before involving Ray self-play or training.
  • For custom games, stage the bundled source with scripts/stage_muzero_source.py, add the module to that staged copy, then use --repo-root <staged-source> --case custom --game-module <module> --network config; use --legal-actions to reproduce empty/illegal-action failures deliberately.
  • If the smoke passes but training fails, cross-link to training-and-cli; if loading weights fails before the smoke, cross-link to checkpoints-and-diagnostics.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351