AGENT SKILL

jax-interop-and-advanced

Use this dm-haiku sub-skill for Haiku-aware JAX transform wrappers, nested transform lifting, data-structure utilities, mixed precision, summaries, visualization, config, and testing helpers.

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

01 前言 Front Matter

name
jax-interop-and-advanced
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use this dm-haiku sub-skill for Haiku-aware JAX transform wrappers, nested transform lifting, data-structure utilities, mixed precision, summaries, visualization, config, and testing helpers.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

JAX interop and advanced Haiku utilities

Use this sub-skill when the task involves Haiku-specific wrappers around JAX transforms or advanced support utilities rather than ordinary layer selection or basic hk.transform signatures.

Read this when

  • A Haiku function uses hk.get_parameter, hk.get_state, hk.set_state, or hk.next_rng_key inside vmap, scan, grad, remat, control flow, or shape evaluation.
  • You need to rewrite raw jax.vmap, jax.lax.scan, jax.remat, or JAX control flow used inside a transformed Haiku function.
  • You need hk.lift, hk.lift_with_state, hk.transparent_lift, or hk.layer_stack for nested transforms, ensembles, or repeated per-layer blocks.
  • You need to filter, partition, merge, traverse, count, or convert Haiku parameter/state dictionaries for freezing or optimizer grouping.
  • You need Haiku mixed precision, DOT graphs, summaries, jaxpr_info, configuration flags, or hk.testing.transform_and_run.

Route elsewhere

  • For choosing between hk.transform, hk.transform_with_state, hk.without_apply_rng, stateful apply signatures, or multi-transform basics, use the core-transforms sub-skill.
  • For ordinary hk.Module authoring, parameter/state/RNG direct APIs, naming, and interceptors, use the params-state-rng sub-skill.
  • For common layer catalogs, hk.nets, RNNs, attention, convolution, normalization, and example-derived model-building patterns, use the modules-and-networks sub-skill.
  • For haiku.experimental.flax APIs and variable collection mapping between Haiku and Flax, use the flax-interop sub-skill.

Bundled references and script

  • Read references/jax-transform-wrappers.md when replacing raw JAX transforms/control flow, choosing hk.vmap/hk.scan/hk.remat, using hk.lift*, or applying hk.layer_stack.
  • Read references/utilities-reference.md when manipulating Haiku parameter/state structures, using mixed precision, producing summaries/graphs, tuning config flags, or writing small Haiku tests.
  • Read references/troubleshooting.md when you see tracer leaks, state/RNG leakage, lift name collisions, optional visualization/JAX2TF dependency failures, mixed precision contamination, or partition/merge mistakes.
  • Run scripts/haiku_jax_transform_smoke.py to validate that the current environment can execute safe hk.vmap, hk.scan, and hk.data_structures.partition/merge examples on synthetic arrays without Graphviz, TensorFlow, or datasets.

Operating rules

  1. Prefer raw jax.* transforms outside Haiku after a function has been transformed into pure init/apply functions.
  2. Inside a transformed Haiku function, use the Haiku wrapper (hk.vmap, hk.scan, hk.remat, hk.cond, and friends) whenever the mapped/scanned/rematted/branched function touches Haiku params, state, RNG, or modules.
  3. Keep parameter and state structure stable across JAX control-flow branches and loop iterations. If a branch or loop might not run during init, create needed modules unconditionally under hk.running_init().
  4. Treat advanced helpers as scoped tools: clear or context-manage mixed precision policies, keep Graphviz/TensorFlow rendering optional, and run synthetic smoke checks before relying on advanced wrappers in larger experiments.

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