CML: Model Reports in Pull Requests
A green tick tells a reviewer that the churn pipeline ran. It does not tell them whether the new model is better. They could download the logs and dig for numbers, but they will not. CML (Continuous Machine Learning) brings the numbers to them: a comment on the pull request with metrics, the change against main, and plots.
The rule
Put the evidence where the decision is made.
The decision to merge happens on the pull request page, so the model's results should appear there. CML is a command-line tool, usually run inside GitHub Actions or GitLab CI, that turns a Markdown file into a pull request comment:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history, so origin/main can be compared
- uses: iterative/setup-cml@v2
# ... setup-python, pip install, dvc pull as before ...
- run: dvc repro
- name: Report
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "## Churn model report" > report.md
dvc metrics diff origin/main --md >> report.md
echo "" >> report.md
cml comment create report.mdStep by step:
dvc reprotrains and writesmetrics.jsonandconfusion.png.dvc metrics diff origin/main --mdprints a Markdown table of each metric onmain, on this branch, and the difference. It needsmain's history, which is why checkout usesfetch-depth: 0.cml comment createpostsreport.mdto the pull request, uploading the image it references.REPO_TOKENgives it permission.
CML can also start cloud machines as temporary CI runners (cml runner launch), so a heavy training job can use a GPU that GitHub's standard runners do not have.
The shortcut
A good model report answers three questions, in this order: How good? Better than main? Where does it fail?
How good?
Recall 0.74, precision 0.66 on the frozen test set.
The trap is a report with only the new number. "Recall 0.74" means little until you see what main scored on the same data.
Drills
Answer fast — trust the rule.
What does cml comment create report.md do?
Why does the checkout step use fetch-depth: 0 in this workflow?
A report says only "Recall: 0.74". What is the most important thing missing?
The churn pipeline needs a GPU that standard GitHub runners lack. Which CML feature helps?
Remember
- Put the evidence where the decision is made: on the pull request.
- A report answers: how good, better than main, where it fails.
- Trap: a lone metric with no comparison against
main.
