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.