Research debugging
Debugging guidance for research code — triggers on: error, exception, failed, crash, NaN, OOM, CUDA, traceback, bug, brokenFrom its SKILL.md
npx -y skills add Gaaaavin/claude-eureka --skill research-debuggingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.6 KB, as published. Nobody here has run it
Debugging Protocol
When encountering errors in research code, follow this order strictly.
1. Understand before fixing
- Read the full error message and traceback, not just the last line.
- Identify the exact line and operation that failed.
- Do NOT guess-and-patch. Reproduce the error first if possible.
2. ML debugging order
Check in this sequence — most bugs are data bugs:
- Data: shapes, dtypes, NaN/Inf values, loader output, augmentation correctness
- Model: parameter shapes, forward pass with dummy input, gradient flow
- Training loop: loss computation, optimizer step, scheduler, logging
- Infrastructure: GPU memory, CUDA version, library compatibility
3. Check recent changes
git diff HEAD~3 --stat
git log --oneline -5
If it worked before, the bug is in the diff.
4. Quick-check lists
NaN values:
- Check learning rate (too high?)
- Check loss function inputs (log of zero? division by zero?)
- Check data normalization
- Insert
torch.autograd.set_detect_anomaly(True)temporarily
OOM (Out of Memory):
- Reduce batch size first
- Check for tensor accumulation in loops (missing
.detach()orwith torch.no_grad()) - Profile with
torch.cuda.memory_summary()
CUDA errors:
- Device mismatch: print
.devicefor all tensors involved - Shape mismatch: print
.shapeat each step - Driver issue: check
nvidia-smiandtorch.cuda.is_available()