Model math debugger
Give it the PyTensor code that errors or runs slow. Get it fixed, with checks that the numbers still match.
Model math debugger is a free AI skill for the job "Test and fix code". Give the instructions to an AI assistant that supports the required files and tools, then review its output.
Free · No account · MIT licence · Made by PyMC Labs · Level: expert · Thinking: high
Made by PyMC Labs. See the original on GitHub; we copied it as it is, with its licence.
What it does
Your PyTensor code fixed, with proof that the numbers still come out the same. Errors with shapes, slow compile times and wrong gradients get traced to their cause, not patched over. The skill first writes down what each input should look like: its shape, type and which axis is which. It picks the simplest built-in operation instead of a custom one. Then it builds an independent reference, a plain number check or a formula, and compares values, shapes and gradients against it. Separate guides cover shapes, numerics, random draws, compilation and profiling, and custom operations. It works in your existing Python setup.
You give it
- The PyTensor code that fails or runs slow
- The error message or timing
- What the output should be (optional)
- Your installed versions
You get
- A fixed version of the code
- The cause explained in plain words
- A reference check for values and gradients
- Profiling notes if it was slow
Use it when
- Your model throws a shape or broadcasting error you cannot read.
- Compiling the graph takes minutes and you need to find out why.
- Random draws repeat when they should differ.
- You wrote a custom operation and need to check its gradient.
How to use it
- Add it to your AI once: download it and add the folder to Claude, ChatGPT or Codex as a skill.
- Ask for the job in your own words. Your AI opens the skill when it fits.
- It works best when your AI can run Python code.