17.11.2026

We fine-tuned a small model to read our dependencies before we install them

by Stijn Van Vreckem

Writing software used to be the job of software developers. Today a scientist or an analyst describes what they need, and an AI assistant writes the code with them. Coding became accessible, and at XAOP we are changing how we operate to match it. It also means that more people than ever install code nobody has read. So we trained a small model to read it first. Here is how we did it, what went wrong, and what the numbers say.

About SVV

Stijn Van Vreckem is the founder and managing director of XAOP. He is fascinated by the outdoors and rarely goes there without a dog at his side. His work mixes that passion with software and sports: he likes to measure what a body does, from training to sleep, and to turn those numbers into something useful. That interest in the quantified self comes from a bigger question that keeps him busy, which is how nature adapts to whatever it is given, and what software can learn from it.

We like this change. The person who understands the question can now build the tool that answers it. But it moves a risk to a place where few people look.

Almost no software is written from scratch. It is assembled from packages: ready-made building blocks, published on the internet by people you have never met. A small project easily pulls in a few hundred of them. An AI assistant picks them and installs them in seconds, and sometimes it suggests a package that does not even exist, which is an open invitation for someone to register that name with bad intentions.

Nobody reads those packages. A developer rarely did, and a scientist who wants a result by Friday certainly will not. Attackers know this. A package that was fine yesterday can be harmful today, without anything changing in your own project. On 12 November, researchers at OX Security described a campaign that was still running as they wrote: 4,837 hijacked GitHub accounts, malicious code in more than 8,000 public projects, and at least 1,806 of those confirmed to have leaked their passwords, cloud keys and AI provider keys. In 771 projects the code sat in an install script, the kind that runs without anyone asking the moment a package is installed.

We ran into this ourselves. When AI agents became part of how we work, the number of packages we installed grew with them. Trusting that someone had looked at each new version was already optimistic when only developers installed packages. It stopped being defensible once agents were installing them alongside people. That is why we built firecrest some time ago, for our own use. It sits between our projects and the public package registries. Before a new version of a package reaches anyone’s computer, firecrest reads what changed since the previous version and decides whether it is safe to install. At that volume, the reading has to be done by a model.

Why not just call a frontier model?

We tried the obvious thing first. A large hosted model writes a good review of a diff, and we still use one as a second opinion on hard cases. But it is the wrong tool for a check that sits in front of every install.

  • It has to be fast. A check that takes a minute on every npm install gets switched off within a week.
  • It has to say the same thing twice. A refusal that becomes an approval when you ask again is not a control you can show an auditor.
  • It should stay inside. Which packages you use, and which ones you refused and why, is a map of your weak spots.

So we split the work. A small model judges: it answers narrow yes/no questions and gives a probability for each. A larger model explains afterwards, in plain language, for the person who has to act on it. Both run on our own machine.

The model

We did not start from nothing. Kev is an open, Apache-licensed decision model built on a 9-billion-parameter Qwen base. You give it a piece of text and a list of questions, and it returns a probability per question. We ask it 28 of them about every chunk of a diff: does this add an install hook, does it decode a hidden blob, does it read SSH keys or cloud credentials, does it send collected data somewhere.

Out of the box it was too nervous to be useful. To catch 95% of the malicious releases in our test set, it also flagged 62% of the harmless ones.

Training it, for about fifteen dollars

For malicious examples we used a public dataset of about 4,400 real malicious npm packages. For harmless ones we took consecutive releases of popular packages. Every diff goes through the exact code the proxy runs in production, so the model trains on what it will see later.

Nobody hand-labelled thousands of diffs. Most labels come from simple pattern rules, and we treat them as what they are: weak labels. The one label we fully trust is the one that matters, which is whether the package really was malicious.

We only trained a small adapter on top of the model, on a rented H100 at Modal. One run took three and a half hours and cost roughly $15. Then the result came home and has been running on our own machine since.

Rent the GPU for the afternoon you train. Own the one that reads your code every day.

What went wrong

The model learned a shortcut. Registries delete malicious packages, so most of our bad examples had no previous version to compare with. Every harmless example did. The first run scored a wonderful 4.6% false positives, because it had learned that “no previous version” means “malware”. It knew nothing about malware. We added harmless first releases to the data, trained again, and threw the wonderful number away.

Our own machine could not train it. We measured 45 seconds per example, which comes to a month for one run. It serves the model well; it trains it badly.

Does it work?

We tested on 573 releases from packages the model had never seen: 401 malicious, 172 harmless.

  • False alarms, while still catching 95% of the malware, fell from 62% to 11%.
  • Ranking quality (AUC) went from 0.91 to 0.98.
  • Its confidence became honest: the calibration error fell from 0.23 to 0.06.

We also checked 80 harmless Python and Go releases, two ecosystems it was never trained on. It stayed calm there too.

It is not finished. 11% false alarms is too many to let the model refuse a package on its own. And our test splits the data by package, not by date. That shows how well the model judges packages it has never seen. It does not show how it holds up over time, as attackers change their style.

Nature has dealt with that problem far longer than we have. Predators and prey keep adapting to each other, and a defence that stops changing soon stops working. In nature, adaptability and survival go hand in hand. We want the same from firecrest: a model that keeps learning from new attacks and keeps being tested against ones it has not seen. The firecrest it is named after is one of Europe’s smallest birds, which seems the right mascot for a small model with a big job.

So the model never decides alone

Those false alarms shaped how we use it. Firecrest runs on an NVIDIA DGX Spark in our own rack, and two models share that machine.

The small model looks first. In about a second it answers a handful of pointed questions: does this version add an install hook, does it fetch and run code, does it reach for credentials? Then Nemotron, a larger language model running on the same machine, does the follow-up. It reads the full difference between the new version and the previous one and writes the review behind the verdict.

The small model decides only when that review runs. If it finds something, Nemotron reads first and the package waits. If it finds nothing, the package is served at once and Nemotron’s review follows in the background. It never decides whether a review runs. If it misses something, the cost is a delay and not a gap, and when a late review turns out bad, firecrest tells us who already received that version.

So the daily reading happens on our own hardware, and the code we inspect is not sent to a large AI company. Asking a frontier model for a second opinion on a doubtful case is a setting we control, not a hidden dependency.

Every decision is logged, and every exception has an owner and a reason.

The question a proxy cannot answer by itself

A proxy only protects the installs that go through it. One developer with a registry URL in a config file is enough to walk around it, and a control that can be bypassed without anyone noticing is hard to defend in a NIS2 or DORA audit.

So firecrest has an audit. You hand it a lockfile, and for every entry it answers from its delivery records: did these exact bytes come through the proxy? Entries that came from another registry, that were never served, or whose hash does not match are bypasses. We are connecting that audit to our own risk register, repository by repository, so that the number of bypasses is something we track and not something we assume. There, a proxy in “watch only” mode earns no credit: a control counts when it operates.

What we would tell another team

  • Check for shortcuts before you believe a result. Our best number was our most wrong one.
  • Let the small model judge and the large model explain. You get speed and a readable reason.
  • Measure the control, not only the model. A good model behind a proxy that half the builds skip protects half the builds.

Do you know what your builds installed last week?

If the honest answer is “not exactly”, we would like to talk. Bring one lockfile from a real project. We will walk through it with you and show what a reviewer would have seen for every package in it, and where our model would have been wrong.

Get in touch and tell us which ecosystem keeps you up at night.