hung-phan/ml-skills/metrics-and-feedback
Claude Code and agent skill by hung-phan/ml-skills
- community
Checking that the SKILL.md file is still in the repository.
DSPy metric design patterns — F1, semantic similarity, LLM-as-judge, and GEPA feedback. Use when writing metrics for DSPy optimization, choosing between metric types, or designing feedback for GEPA's reflection loop.
Install
npx vskill@latest install hung-phan/ml-skills/metrics-and-feedbackSKILL.md
The same SKILL.md was published earlier as hung-phan/ml-skills/metrics-and-feedback.
Metrics and Feedback
Why This Exists
Problem: The DSPy optimizer needs a differentiable signal — a function that returns a score (0–1) for each (input, output) pair. Bad metrics produce useless optimizations: binary metrics give GEPA nothing to reflect on, opaque scalar metrics give MIPROv2 a flat landscape to search, and expensive metrics make compilation unaffordable.
Key insight: The metric is the optimization target — its shape (bool vs float vs Prediction with feedback) determines which optimizer you can use and how well it converges.
Reach for this when: You need to write or choose a DSPy metric, design feedback for GEPA's reflection loop, or debug why an optimizer is plateauing or producing nonsensical results.
Metric Contract
| Return Type | Used By | Behavior | |
|---|---|---|---|
bool | BootstrapFewShot | Pass/fail filtering | |
float | MIPROv2, BetterTogether | Bayesian optimization signal | |
Prediction(score, feedback) | GEPA | Reflection LM reads feedback |
Built-in Metrics
| Metric | Returns | Use | |
|---|---|---|---|
answer_exact_match | bool | Factoid QA | |
answer_passage_match | bool | Passage contains gold | |
SemanticF1 | Prediction | Token overlap + semantic | |
CompleteAndGrounded | Prediction | RAG completeness + groundedness |
Token F1
Set F1 (multi-label, entity extraction)
GEPA Metrics
GEPA reads feedback verbatim in its reflection prompt. This is the primary lever.
Good vs Bad GEPA Feedback
| ✅ Good | ❌ Bad | |
|---|---|---|
| "Missing fact: user's timezone not included" | "Needs improvement" | |
| "Format wrong: expected bullet list, got paragraph" | "Low score" | |
| Fine-grained float (0.73) | Binary (True/False) | |
| Per-criterion breakdown | Single opaque number |
GEPA vs MIPROv2
| Property | GEPA | MIPROv2 | |
|---|---|---|---|
| Return type | Prediction(score, feedback) | float sufficient | |
| Feedback | Critical — drives mutations | Not used | |
| Granularity | Fine-grained required | Coarse OK | |
pred_name/pred_trace | Used for per-predictor scoring | Not used |
Composite Pattern
Pitfalls
- Plateau: All candidates score 0.85-0.90 → add more fine-grained criteria
- Doesn't correlate: Validate metric vs human judgment on 20+ examples first
- Too expensive: Use cheap LMs for scoring, cache repeated comparisons
- Binary + GEPA: Reflection LM gets nothing to reflect on → always return float + feedback
References
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ml-review/references/ml-libraries/dspy/metrics-and-feedback/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hung-phan/ml-skills/metrics-and-feedback)