DEV Community

Francisco Perez
Francisco Perez

Posted on Edited on

Output head patching: what actually changed in our 1,152-parameter patch

In my previous post, I shared a result: a small vision-language model went from 20.1% to 91.0% pairwise accuracy on a clip-quality task.

This post is about the mechanism. What changed inside the model? What did we calculate? And what does the result not prove?

The experiment started from Reelsmith, my video harness. I wanted to explore whether directly editing a small model's weights could help it select better-looking clips.

We used SmolVLM2-256M-Video-Instruct. We did not build a video generator. We changed a scoring mechanism.

Two output rows, not a new model

For this experiment, each frame produced an internal vector, h, with 576 components. The output head, lm_head, maps that vector to token scores.

We edited two rows: the ones for the tokens Yes and No.

The operation was:

Yes row += w / 2
No row  -= w / 2
Enter fullscreen mode Exit fullscreen mode

Here, w is a vector of 576 numbers. Two rows times 576 components means 1,152 edited parameters.

If the original Yes-minus-No score was z, the edited score becomes:

z_patched = z + dot(h, w)
Enter fullscreen mode Exit fullscreen mode

That is the whole intervention: an added linear correction to the output score. We did not rewrite the model's visual processing.

Where w came from

The direction was calculated from human quality ratings, not chosen by intuition.

We used 240 clips from KoNViD-1k, split by video into 140 calibration clips, 40 validation clips, and 60 test clips. Each clip was represented by the average of four frame-level vectors.

On the calibration set, ridge regression fitted a direction from those vectors to standardized human quality scores. The selected regularization was 100. The patch strength was selected on validation; the chosen value was 1.

No gradient descent or backpropagation was used to fit the patch. But calling this no learning would be wrong: ridge regression is supervised learning. Human labels supplied the target.

A more precise description is a fitted linear readout merged into two rows of the existing output head.

Did the weight edit actually do what the equation says?

We checked actual forward passes after editing the weights against the external calculation z + dot(h, w).

The maximum discrepancy in those checks was below 0.000006. A fully black frame still received a negative Yes-minus-No score.

Those are useful checks, with limited scope. They support that the edit was applied as intended. One black-frame check does not establish robustness across all bad inputs.

What the 91% measures

On the 60 test clips, we compared 601 pairs whose human quality scores differed by at least one point:

  • Unmodified model: 20.1% pairwise accuracy.
  • Luminance rule: 75.2%.
  • Patched model: 91.0%.

These are pairs formed from 60 clips, not 601 independently collected videos. The score measures agreement with the dataset's quality ordering for that subset. It is not 91% accuracy at editing videos.

There is another caveat: the test was evaluated twice during development. The first version did not deliver the intended improvement; a revised design produced the result above. That history matters. A fresh holdout would give a cleaner confirmation.

What we still cannot claim

The experiment averaged four frames. It did not evaluate motion, cuts, pacing, or audio.

It also did not establish that the patch captures my editing taste, transfers to other datasets, or improves arbitrary prompts. The result belongs to this model, scoring setup, and evaluation.

The useful finding is narrower: the model's internal representations supported a fitted direction that improved this quality-ranking task, and that direction could be merged into the output head.

For me, output head patching is interesting when we can explain exactly what changed and measure the effect. A tiny patch is not automatically a small claim.

The code

The code for the method is on GitHub: https://github.com/FranprzDev/wsp-output-head-lab. One honest caveat: it is a reconstructed demonstrator of the method (the ridge fit and the two-row patch, with tests), not a reproduction of the original result. The original experiment files (exact split and patch vector) were not recovered, so the repo does not reproduce the 91%.

References:

Top comments (0)