Inspiration
In eight years of shipping predictive-maintenance and computer-vision systems for Indonesian industry, the weakest link was never the model. It was the path from "retrained model in a notebook" to "model running on the plant floor", which usually ran through a chat message and a USB stick. Nobody checked that the retrained model still explained its decisions the same way, and a maintenance engineer who cannot read why a bearing was flagged will ignore the alert.
What it does
PdM Model Gatekeeper is a supervised agentic release pipeline for a bearing-fault classifier (normal / inner race / outer race / ball) trained on real CWRU vibration data. Every change goes through nine GitLab lifecycle stages. A model_gate job retrains the model and compares the candidate with the baseline on accuracy, macro-F1, SHAP top-feature overlap (explainability drift), p95 latency and model size, and publishes the numbers as MR metrics. The Gatekeeper GitLab Duo flow then reviews the MR and the gate report and posts a SHIP / HOLD / BLOCK verdict with a plain-language explanation in English and Bahasa Indonesia, relating the SHAP features to bearing physics (impacts, defect frequencies, severity). On merge, the Release Scribe flow writes the release notes, the pipeline builds and scans the image, deploys to Cloud Run staging, smoke-monitors the live endpoint, estimates carbon per prediction and reports on the originating issue. The human approves one thing: the production deploy. Pipeline failures trigger GitLab's Fix CI/CD Pipeline flow.
How we used GitLab
The pipeline's stage names are the nine lifecycle words: plan, create, verify, package, secure, release, configure, monitor, govern. Duo Agent Platform: two custom flows (.gitlab/duo/flows/) with triggers on MR created / marked ready / reviewer assigned and on pipeline passed on main, plus the foundational Fix CI/CD Pipeline flow on pipeline failed. SAST, Secret Detection, Dependency Scanning and Container Scanning templates; Kaniko builds to the Container Registry; release-cli releases; environments with a manual production gate; JUnit and metrics reports; protected branch with a required approval; CODEOWNERS; issue and MR templates.
Autonomy level
Supervised: agents review, gate, scan, package, release, deploy to staging and monitor without intervention; the owner approves the production outcome by running one manual job.
Google Cloud
Deployed on Cloud Run (asia-southeast2) from source through Cloud Build. Live staging: https://pdm-gatekeeper-staging-xt5ehaxhwa-et.a.run.app/health returns the commit SHA of the pipeline that deployed it. Production: https://pdm-gatekeeper-xt5ehaxhwa-et.a.run.app/health (deployed only by the manual, human-approved job). Deployment code: deploy/cloudrun.sh, jobs deploy_staging and deploy_production in .gitlab-ci.yml.
Sustainability (opt-in)
Software Carbon Intensity (ISO/IEC 21031:2024) estimate of 0.02 gCO2e per 1,000 predictions, measured on the live service in the smoke_monitor job: SCI = ((E × I) + M) per prediction, E from measured busy time on a 1 vCPU Cloud Run instance at 0.4 W per vCPU, I = 0.72 kgCO2/kWh (Indonesia grid, IEA 2023), M = 0 for serverless (declared limitation). Design choices: a 162 KB CPU-only gradient-boosting model instead of a neural network, scale-to-zero, Jakarta region close to the users, pip cache in CI, and a gate that blocks changes raising inference latency or model size by more than 50%.
Research background
The explainability gate comes from our published work on SHAP for bearing-fault models: the top SHAP features of a sound model map to bearing physics (impact peaks, defect-frequency energy, overall severity), so a retrain that changes them changes what the maintenance engineer is told. This project turns that finding into a pipeline check.
Reference: T. Suharto, K. Suryadi, B. P. Iskandar, B. R. Trilaksono, D. E. Cahya, T. S. Siadari, E. Rinaldi and A. Tjendra, "Comprehensive SHAP-based explainability analysis for machine learning-based bearing fault detection", IET Conference Proceedings, 2026. https://doi.org/10.1049/icp.2026.2099
What's next
Swap the committed CWRU windows for the plant's vibration stream, add drift monitoring against production predictions, and promote the Gatekeeper to Hands-off once a month of supervised runs agree with the human.
Repo: https://gitlab.com/vektor-main/pdm-model-gatekeeper · Video: https://youtu.be/tebY068YHEY
Built With
- docker
- fastapi
- gitlab
- gitlab-ci
- gitlab-duo-agent-platform
- google-cloud-run
- python
- scikit-learn
- shap
Log in or sign up for Devpost to join the conversation.