[FEATURE] Built a self-optimizing ML training pipeline entirely with Claude Code — it predicts difficulty, finds optimal LR, and detects overfitting using topology
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I spent a weekend with Claude Code building ph-training — an automatic model training pipeline that uses Persistent Homology (topological data
analysis) to monitor and optimize training in real-time.
What it does
Instead of just watching loss curves, it analyzes the topological structure of how your model separates classes:
- Phase 1: Train for 1 epoch → predict final difficulty (easy/medium/hard) before committing to full training
- Phase 2: Sweep learning rates, pick the one with most stable topology (H0 CV minimum)
- Phase 3: Train with real-time overfitting detection — catches overfitting before the accuracy gap appears (r=0.998 correlation)
- Phase 4: Output semantic hierarchy (which classes cluster together) + adversarial vulnerability map
ph-train --dataset fashion --epochs 30
Phase 1: H0_ep1 = 2.31 → Difficulty: medium
Phase 2: Best LR = 1e-03 (H0 CV=0.089)
Phase 3:
Ep trn% tst% H0gap status
1 83.2 82.1 0.0251 OK
8 91.5 88.7 0.0312 OK
14 93.1 89.1 0.1509 ALERT ← topology diverged
Early stop (epoch 14)
How Claude Code helped
The entire project — model architecture, PH computation, 4-phase pipeline, tests, packaging, GitHub repo — was built in a single Claude Code session.
What made it work:
- Parallel agent execution: Ran 6 hypothesis verification experiments simultaneously
- Background tasks: Long training runs in background while designing the next experiment
- Iterative debugging: OpenMP conflicts, scipy segfaults — Claude diagnosed and fixed each one without me touching the code
- End-to-end packaging: From raw script → pip install -e . → ph-train CLI → 9 passing tests → pushed to GitHub, all in one flow
Key discovery
The confusion structure between classes (which digits/objects get mixed up) is topologically invariant — it's the same regardless of model
architecture. A simple 2-layer net and a deep MLP produce identical top-5 confusion pairs (100% match). This means 1 epoch on a tiny model tells you
everything about what a big model will struggle with.
Repo: https://github.com/need-singularity/ph-training
Proposed Solution
😍
Alternative Solutions
_No response_
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗