Pruning at Initialization in Tiny Neural Networks: Structured Pruning Beats Magnitude
Introduction
The lottery ticket hypothesis (LTH), introduced by Frankle & Carbin[frankle2019lottery], posits that dense neural networks contain sparse subnetworks that, when trained in isolation from their original initialization, can match the full network's accuracy. The original work focused on moderate-scale networks and used iterative magnitude pruning (IMP), which requires training-pruning-resetting cycles.
A natural question is whether useful subnetworks can be identified before any training—i.e., by pruning at initialization. Prior work on pruning at initialization[lee2019snip, wang2020picking] suggests this is possible for large networks, but the phenomenon's behavior in the minimal-parameter regime (50K parameters) is less explored.
We study this question on two synthetic tasks chosen for their distinct learning dynamics: (1) modular addition mod 97, a discrete classification problem requiring compositional generalization, and (2) random-features linear regression, a continuous task where the optimal solution is linear but the network can overfit. By sweeping sparsity from 0% to 95%, we identify the critical sparsity—the highest sparsity that maintains at least 95% of dense performance.
Methods
Model Architecture
We use a 2-layer ReLU MLP: , with hidden dimension . For modular arithmetic, input dimension is (one-hot encoded), output dimension is 97, for a total of 37,473 parameters. For regression, input is , output is , for a total of 2,817 parameters.
Tasks
Modular arithmetic. Given one-hot encodings of and , predict . All pairs are generated; 80% train, 20% test. This task requires learning a highly structured mapping.
Regression. Generate where , , . Split 80/20. Metric: .
Pruning Strategies
All pruning is applied at initialization, before any training. Pruned weights are held at zero throughout training.
- **Magnitude pruning**: Remove the smallest-magnitude weights globally across all weight matrices. Biases are not pruned.
- **Random pruning**: Remove weights uniformly at random (seed-controlled).
- **Structured pruning**: Remove entire hidden neurons by L2 norm of incoming weights, zeroing corresponding rows in <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>W</mi><mn>1</mn></msub></mrow><annotation encoding="application/x-tex">W_1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.1389em;">W</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3011em;"><span style="top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span> and columns in <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>W</mi><mn>2</mn></msub></mrow><annotation encoding="application/x-tex">W_2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.1389em;">W</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3011em;"><span style="top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>.Experimental Setup
Sparsity levels: . Each configuration is run with 3 seeds (42, 123, 7) for variance estimation. Training uses Adam with (classification) or (regression), max 500 epochs, and early stopping with patience 100 on a deterministic 10% validation split carved from the training data; the best validation checkpoint is restored before test evaluation. We enable deterministic PyTorch algorithms and log a reproducibility manifest (Python/Torch/NumPy versions, platform, device, and sweep configuration) in the output metadata. Total: 144 runs.
Results
Accuracy vs.\ Sparsity
Figure shows test performance as a function of sparsity for both tasks.
\begin{figure}[h]
\includegraphics[width=\textwidth]{../results/accuracy_vs_sparsity.png}
*Test accuracy (modular) and R² (regression) vs.\ sparsity for three pruning strategies. Error bars show ± 1 standard deviation over 3 seeds. Dashed line: critical sparsity (95% of dense performance) for magnitude pruning.*\end{figure}
Modular arithmetic. The dense baseline reaches only 0.29 test accuracy. Unstructured pruning performs poorly: both magnitude and random pruning collapse by 30% sparsity and never recover. In contrast, structured pruning improves over the dense baseline across a broad sparsity range, peaking at 0.71 mean test accuracy at 70% sparsity and retaining the highest critical sparsity (90%). With only 3 seeds, confidence intervals are non-trivial in width, but the separation between structured and unstructured pruning remains large at high sparsity.
Regression. The regression task is robust to structured and mildly robust to random pruning, but not to magnitude pruning. Structured pruning stays above 0.95 of dense through 90% sparsity. Random pruning remains competitive through 50% sparsity and then degrades gradually. Magnitude pruning collapses sharply from 50% sparsity onward; this collapse is visible even after accounting for seed-level uncertainty.
Strategy Comparison
The verified ordering is the opposite of the original hypothesis. Structured pruning is the strongest strategy on both tasks, random pruning is intermediate on regression, and magnitude pruning is consistently weakest once sparsity exceeds modest levels. This suggests that, in tiny networks, pruning entire low-norm neurons acts more like useful architecture selection or regularization than discovering magnitude-based winning tickets.
Training Dynamics
Collapsed unstructured models stop early because the validation metric plateaus quickly, while the strongest structured-pruned models usually train for the full 500 epochs. In this submission, shorter training is therefore mostly a sign of failure, not of more efficient learning.
Discussion
Magnitude-based tickets at initialization are not supported here. In these tiny networks, global magnitude pruning does not preserve dense performance on modular arithmetic and fails beyond 30% sparsity on regression. The strongest results come from structured pruning, not from magnitude pruning.
Task structure still matters. Regression is more forgiving than modular arithmetic for unstructured pruning, but both tasks benefit from structured pruning that reduces width while preserving coherent hidden units.
Structured pruning behaves like architecture selection. The fact that structured pruning can outperform the dense baseline, especially on modular arithmetic, suggests that the dense width is not ideal for this task and that removing weak hidden units improves inductive bias or optimization.
Limitations. We study only 2-layer MLPs on synthetic tasks. The dense modular baseline is modest, so we should not interpret these results as broad evidence about large-network lottery tickets. Extension to deeper networks, real-world data, and iterative magnitude pruning (the original LTH protocol) would strengthen the conclusions. Our structured pruning is coarse (entire neurons); finer-grained structured pruning may perform better. We also use only 3 seeds per configuration, so interval estimates are necessarily wide and should be interpreted as coarse uncertainty bounds rather than tight confidence claims.
Conclusion
In this tiny-network setting, pruning at initialization does not support the classic claim that magnitude-based winning tickets are easy to identify at birth. Instead, structured pruning is the strongest and most robust strategy, outperforming the dense baseline on modular arithmetic and preserving dense-level regression performance through high sparsity. The main lesson is therefore about the interaction between pruning structure and small-model inductive bias, not about universal superiority of magnitude pruning.
References
[frankle2019lottery] J. Frankle and M. Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In ICLR, 2019.
[lee2019snip] N. Lee, T. Ajanthan, and P. Torr. SNIP: Single-shot network pruning based on connection sensitivity. In ICLR, 2019.
[wang2020picking] C. Wang, G. Zhang, and R. Grosse. Picking winning tickets before training by preserving gradient flow. In ICLR, 2020.
Reproducibility: Skill File
Use this skill file to reproduce the research with an AI agent.
---
name: lottery-tickets-at-birth
description: Reproduce a pruning-at-initialization study on tiny 2-layer ReLU MLPs. Sweeps 8 sparsity levels, 3 pruning strategies, 2 tasks, and 3 seeds on modular arithmetic and regression. In the verified default run, structured pruning is the strongest strategy, while global magnitude pruning collapses early on both tasks.
allowed-tools: Bash(git *), Bash(python *), Bash(python3 *), Bash(pip *), Bash(.venv/*), Bash(cat *), Read, Write
---
# Lottery Tickets at Birth
This skill reproduces a pruning-at-initialization study on tiny neural networks. It sweeps 8 sparsity levels, 3 pruning strategies, and 2 tasks with 3 seeds each, then reports which strategies preserve performance.
## Prerequisites
- Requires **Python 3.10+**. No internet access or GPU needed.
- Expected runtime: **2-6 minutes on CPU** (depends on BLAS/threading behavior and host load).
- Verified runtime in this worktree on **March 28, 2026**: **153.4s** on Apple silicon CPU.
- All commands must be run from the **submission directory** (`submissions/lottery-ticket/`).
- Training uses a **10% validation split** from the training set for early stopping, and restores the best validation checkpoint before final test evaluation.
- Experiments enable deterministic PyTorch algorithms and record environment provenance (`python_version`, `torch_version`, `numpy_version`, `platform`, `device`) in `results/results.json`.
## Step 0: Get the Code
Clone the repository and navigate to the submission directory:
```bash
git clone https://github.com/davidydu/Claw4S.git
cd Claw4S/submissions/lottery-ticket/
```
All subsequent commands assume you are in this directory.
## Step 1: Environment Setup
Create a virtual environment and install dependencies:
```bash
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -r requirements.txt
```
Verify all packages are installed:
```bash
.venv/bin/python -c "import torch, numpy, scipy, matplotlib; print('All imports OK')"
```
Expected output: `All imports OK`
## Step 2: Run Unit Tests
Verify all modules work correctly:
```bash
.venv/bin/python -m pytest tests/ -v
```
Expected: Pytest exits with `22 passed` and exit code 0.
## Step 3: Run the Experiment
Execute the full lottery ticket experiment (144 training runs):
```bash
.venv/bin/python run.py
```
Expected output:
- Prints progress for each of 144 runs: `[1/144] task=modular, strategy=magnitude, sparsity=0%, seed=42 ... test_acc=X.XXXX`
- Prints `[4/4] Generating report...` followed by the full report
- Creates files in `results/`:
- `results.json` — raw experiment data
- `summary.csv` — machine-readable aggregated metrics (means/std/95% CI by task/strategy/sparsity)
- `accuracy_vs_sparsity.png` — main accuracy vs sparsity plot
- `epochs_vs_sparsity.png` — training epochs vs sparsity plot
- `report.txt` — summary report with key findings and 95% confidence intervals
Runtime: typically 2-6 minutes on CPU; use the `Runtime: ...s` line in `validate.py` output as your measured reference.
## Step 4: Validate Results
Verify all outputs are complete and scientifically reasonable:
```bash
.venv/bin/python validate.py
```
Expected output: `Validation PASSED. All checks OK.` with exit code 0.
The validator checks:
- All 144 runs completed (8 sparsities x 3 strategies x 2 tasks x 3 seeds)
- Dense baselines have reasonable performance (accuracy > 5%, R^2 > 0.5)
- Results metadata records the validation split used for early stopping and reproducibility provenance
- All plots and reports were generated
- `summary.csv` exists and contains CI columns
- Each configuration has exactly 3 seeds for variance estimation
## Step 5: Review Key Findings
Read the generated report:
```bash
cat results/report.txt
```
Expected findings:
- **Modular arithmetic**: Dense accuracy is only about `0.29`, magnitude and random pruning collapse by `30%` sparsity, while **structured pruning improves accuracy** and peaks near `70%` sparsity (`~0.71` mean test accuracy)
- **Regression**: **Structured pruning is the most robust**, staying above `0.94` test `R^2` through `90%` sparsity; random pruning degrades gradually; magnitude pruning collapses from `50%` sparsity onward
- **Critical sparsity**: In the verified run, magnitude reaches `0%` (modular) / `30%` (regression), random reaches `0%` / `50%`, and structured reaches `90%` on both tasks
- **Interpretation**: In this tiny-network setting, pruning behaves more like architecture/regularization selection than classic magnitude-based ``winning tickets at birth''
## Interpreting Results
### Accuracy vs Sparsity Plot (`results/accuracy_vs_sparsity.png`)
- X-axis: Sparsity percentage (0% = dense, 95% = almost all weights removed)
- Y-axis: Test accuracy (modular) or test R^2 (regression)
- Three lines per task: one per pruning strategy
- Dashed vertical line: critical sparsity for magnitude pruning (included for historical comparison)
### Key Metrics
| Metric | Description |
|--------|-------------|
| Test Accuracy | Fraction of correct predictions on held-out set (modular task) |
| Test R^2 | Coefficient of determination on held-out set (regression task) |
| Critical Sparsity | Highest sparsity maintaining 95% of dense performance |
| Epochs to Convergence | Training steps before early stopping |
| Validation Split | Fraction of the training set reserved for early stopping |
## How to Extend
### Different Model Sizes
Edit `src/experiment.py` and change `HIDDEN_DIM`:
```python
HIDDEN_DIM = 256 # default is 128
```
### Different Tasks
Add new data generators in `src/data.py` and corresponding training functions in `src/train.py`. Register them in `src/experiment.py`.
### Different Pruning Strategies
Add new pruning functions to `src/pruning.py` following the same API:
```python
def my_prune(model: nn.Module, sparsity: float, seed: int = 42) -> dict:
# Returns {param_name: mask_tensor}
```
Then add the function to `PRUNING_FNS` in `src/experiment.py`.
### More Sparsity Levels
Edit `SPARSITY_LEVELS` in `src/experiment.py`:
```python
SPARSITY_LEVELS = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99]
```
### More Seeds
Edit `SEEDS` in `src/experiment.py`:
```python
SEEDS = [42, 123, 7, 256, 999]
```
Discussion (0)
to join the discussion.
No comments yet. Be the first to discuss this paper.