optax
Route Optax tasks across optimizer construction, loss and schedule workflows, and advanced utilities or contrib topics.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- optax
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route Optax tasks across optimizer construction, loss and schedule workflows, and advanced utilities or contrib topics.
- disable-model-invocation
- true
02 资源文件 8
- 参考文档references/advanced-topics.md4.2 KB
- 参考文档references/core-workflows.md3.5 KB
- 参考文档references/examples-index.md2.4 KB
- 参考文档references/losses-and-schedules.md3.6 KB
- 参考文档references/repo-provenance.md2.3 KB
- 参考文档references/repo-routing-metadata.json341 B
- 参考文档references/troubleshooting.md3.3 KB
- 脚本scripts/optax_skill_doctor.py4.5 KB
03 SKILL.md 正文
Optax
Use this skill when the user asks about Optax, the JAX-based gradient processing and optimization library. This root skill is a router: use it to decide whether the request is about optimizer composition, losses and schedules, or advanced utilities and contrib-style algorithms.
First checks
- Confirm whether the user is trying to:
- build or debug an optimizer pipeline,
- choose a loss, schedule, or microbatching helper, or
- use a projection, assignment, tree, linear-algebra, second-order, or contrib feature.
- Confirm the active Python environment can import
jaxandoptaxbefore assuming any runtime behavior. - For a fast health check, run
scripts/optax_skill_doctor.py --smokein an isolated environment. - Use
references/repo-provenance.mdto check whether this skill matches the current checkout snapshot. - Use
references/troubleshooting.mdfor missing-JAX, shape, backend, and API-misuse triage before diving into a sub-skill.
Route by user intent
| User asks for | Open |
|---|---|
Choose, build, chain, wrap, or debug optimizers and gradient transformations; apply updates; inject schedules into hyperparameters; use adam, adamw, sgd, chain, named_chain, partition, lookahead, or MultiSteps |
sub-skills/core-optimization/SKILL.md |
| Select or combine losses, schedules, microbatching helpers, or perturbation wrappers; compare classification/regression/ranking/self-supervised losses; tune warmup/cosine/piecewise schedules | sub-skills/losses-and-schedules/SKILL.md |
Work with projections, assignment, tree utilities, linear algebra, second-order helpers, or contrib/experimental algorithms such as sam, schedule_free, dpsgd, muon, galore, or reduce_on_plateau |
sub-skills/advanced-topics/SKILL.md |
Read these bundled references
references/core-workflows.mdfor optimizer composition patterns, update flow, and schedule injection.references/losses-and-schedules.mdfor loss families, schedule families, microbatching, and perturbation helpers.references/advanced-topics.mdfor projections, assignment, tree math, linear algebra, second order, contrib, and experimental features.references/examples-index.mdfor notebook and example routes that demonstrate the main workflows.references/troubleshooting.mdwhenever the request involves installation, missing JAX, backend confusion, shape mismatches, or unstable contrib features.scripts/optax_skill_doctor.pywhen you need a quick import, backend, or tiny smoke check.
Common workflow reminders
- Optax is backend-agnostic at the library level, but actual execution depends on the installed JAX backend. A CPU-only JAX install can prove importability and many small smoke checks, but not accelerator-specific claims.
- Do not tell future agents to open the original repository notebooks or tests from runtime instructions. Distill any needed recipes into the bundled references or scripts.
- When the user asks for “the best optimizer,” start with
core-optimizationand usereferences/core-workflows.mdto compare the common families before narrowing further. - When the user asks for a loss or schedule, start with
losses-and-schedules; when they ask for anything projection-like, tree-like, assignment-like, or contrib-like, start withadvanced-topics.
Package-level sanity check
If you need a one-line import check rather than the full doctor script, use:
python -c "import optax; print(optax.__version__)"
That only proves the package imports in the current environment. Use the doctor script when you also need selected API signatures, JAX backend facts, or a tiny end-to-end optimizer smoke test.
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).