// Guides you through implementing a research paper step-by-step from scratch. Use when asked to implement a paper, code up a paper, reproduce research results, or build a model from a paper. Focuses on building understanding through implementation with checkpoint questions.
| name | implement-paper-from-scratch |
| description | Guides you through implementing a research paper step-by-step from scratch. Use when asked to implement a paper, code up a paper, reproduce research results, or build a model from a paper. Focuses on building understanding through implementation with checkpoint questions. |
The best way to truly understand a paper is to implement it. This skill guides you through that process methodically.
Before writing any code:
Identify the core algorithm - Strip away ablations, extensions, bells and whistles. What's the minimal version?
List the components - Break into modules:
Find the tricky parts - What's non-obvious?
Gather reference numbers - What should we expect?
Build up the implementation in this order:
# Start with synthetic/toy data
# Verify shapes and types before touching real data
Checkpoint: Can you describe what each tensor represents and its expected shape?
# Build layer by layer
# Print shapes at each stage
# Verify parameter counts match paper
Checkpoint: If you randomly initialize and do a forward pass, do the output shapes match what the paper describes?
# Implement exactly as described
# Test with known inputs/outputs
# Check gradient flow
Checkpoint: Can you explain each term in the loss and why it's there?
# Minimal loop first (no logging, checkpointing, etc.)
# Verify loss decreases on tiny overfit test
# Then add bells and whistles
Checkpoint: Can you overfit a single batch? If not, something is broken.
# Implement paper's exact metrics
# Compare against reported numbers
Checkpoint: On the same data split, how close are you to paper's numbers?
When it doesn't work (and it won't at first):
The Overfit Test
The Gradient Check
The Initialization Check
The Learning Rate Sweep
The Ablation Debug
At each stage, you should be able to answer:
Understanding:
Implementation:
Debugging:
For each implementation session, provide:
## Today's Implementation Goal
[Specific component we're building]
## Prerequisites Check
- [ ] Previous components working
- [ ] Understand what we're building
- [ ] Know expected behavior
## Implementation
### Code
[Code blocks with extensive comments]
### Checkpoint Questions
1. [Question]
<details><summary>Answer</summary>[Answer]</details>
2. [Question]
<details><summary>Answer</summary>[Answer]</details>
### Verification Steps
- [ ] Test 1: [What to check]
- [ ] Test 2: [What to check]
### Common Bugs at This Stage
1. [Bug pattern]: [How to identify and fix]
## What's Next
[Preview of next component and how it connects]
You're done when: