Skip to content

Optimize your experiments with AI

If you are facing slow experiments, constrained compute resources, or low utilization, there is a good chance your agent, equipped with adequate guidance and context, can help you out.

Coding agents already have broad knowledge of PyTorch and Slurm; what they lack is Mila-specific context and relevant optimization methods. IDT packages that context into a skill the agent can load in order to:

  1. Diagnose β€” measure actual job behavior (e.g., throughput, resource utilization)
  2. Recommend β€” propose concrete fixes (e.g., dataloader workers, job packing)
  3. Fix safely β€” implement the changes while keeping experimental results identical
  4. Share findings (optional) β€” send a report on the improvements made to the IDT team to help improve the skill.

You're always welcome at the IDT Office Hours to get help with this.

Work in progress

This is an early version: we are actively working on improving the skill based on various real-world experiments and feedback from you, or your agent. Therefore, the skill will always explicitely request your confirmation to:

  • apply changes that could alter experimental results
  • share reports to the IDT team so that the skill may benefit from a feedback loop.

The optimization skill

The skill lives in the mila-iqia/skills marketplace, as the opt-tools plugin. To optimize your code with it, start a session with your agent at the root of the experiment code and describe the desired outcome in plain language:

The request to use the Skill can also be added directly in the prompt:

Try to optimize my code using guidance from https://raw.githubusercontent.com/mila-iqia/skills/refs/heads/master/opt-tools/skills/optimization-target/SKILL.md.

If the marketplace was registered following Install Mila Skills for Claude Code, only the install step is new:

/plugin install opt-tools@mila-skills

Claude Code can then be called to optimize the code

Try to optimize my code.

The agent detects the skill and follows its requirements:

  • Maximize resources utilization: The core objective of the skill, achieved through diagnoses and standard improvement strategies like job packing.
  • Protect the science: Optimization must preserve result integrity. The skill explicitly requires user confirmation before making any changes that could alter findings (such as hyperparameter adjustments).
  • Improve the Skills: An optimization report is generated and can be submitted to the relevant repository to document identified found issues, applied fixes and performance gains.

Sharing the report is optional

The optimization report is written locally and summarizes the experiment's purpose, its stack, its identified issues and the applied fixes.

Sharing it remains the user's choice

  • The user can review and update it before submission.
  • It is possible to simply ask the agent not to share the report.

Feedback

Feedback on real-world use drives the next iterations:

  • Did the agent find real issues, or suggest changes with no effect?
  • Did it miss something a human reviewer would catch immediately?
  • Was the measurement sound β€” did the results stay the same?

To share feedback with us, reach IDT on Slack (#mila-cluster or #compute-canada), come to the Office Hours, or have the agent include its observations in the report it sends (the skill asks it to). Negative experiences are as valuable as positive ones.

Code with optimization potential can also be shared directly with IDT, as described in Help us help you: real codebases are what these tools are trained and improved on.

 

Comments