Built a local ML pipeline that blocks risky commits before they leave your machine [P]
Mirrored from r/MachineLearning for archival readability. Support the source by reading on the original site.
I'm a recent CS grad trying to break into ML engineering, and I just finished the first version of a side project I've been working on. Posting it here because I want people who know this space better than me to poke holes in it.
The idea started from that feeling every dev has had, where you commit something and a second later your stomach drops because you think you just pushed an AWS key. Server side scanning catches that eventually, but only after it's already in your git history. Local tools like gitleaks run before that, which is the right idea, but they're pure pattern matching, so anything that isn't a known secret format slips through and they say nothing about whether the code itself is risky. Piping your diff to a cloud LLM just trades that problem for a different one.
So I built a git hook that runs three checks on a commit, all on device. A fast Rust regex pass catches known secret formats and blocks the commit if it finds one. A small classifier running on the Neural Engine through CoreML catches riskier patterns that don't have a fixed string to match, things like shell=True in a subprocess call or disabled TLS checks, and also blocks if it fires. A small local LLM (Qwen2.5-Coder, 1.5B, running through MLX) reads the diff more like a human reviewer and flags things like injection risks or dead code, but it never blocks anything, just leaves notes. I kept it that way on purpose, since a false positive that blocks your commit kills trust fast, but a false positive that's just a comment costs nothing.
Biggest weaknesses right now: it's Apple Silicon only since CoreML and MLX are both Apple specific, and the classifier is trained on a fairly small dataset so I wouldn't call it bulletproof yet.
Repo's here if anyone wants to dig into the code: https://github.com/stalzkie/local-forge
Mainly curious whether the three layer split makes sense to people who do this for a living, and what risky code patterns I might be missing for the classifier.
[link] [comments]
More from r/MachineLearning
-
Loss functions in Instance Representation Learning [R]
Jun 29
-
Price elasticity model [R]
Jun 29
-
Rejected MICCAI paper: workshop -> journal/conference or directly journal/conference [R]
Jun 29
-
I built a demo agricultural planning system with an AI advisor for small-scale farmers in Nicaragua using NASA data [p]
Jun 29
Discussion (0)
Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.
Sign in →No comments yet. Sign in and be the first to say something.