Skip to content
AI artificial intelligence
About usLet’s talk
Back to articles

Six numbers, two fewer mistakes: editing a classifier without retraining

An AI assistant changed six values in a trained spam classifier. Accuracy improved slightly, while probability quality worsened. Here is the experiment.

The score went up. So did the loss.

We gave an AI assistant a trained spam classifier and asked it to improve the model by editing its parameters directly. It changed six numbers. On the final test, the classifier made 39 mistakes instead of 41. Its probability estimates, measured by log loss, became slightly worse.

That mixed result is the interesting part. If we had reported accuracy alone, this would look like a small success. Once we looked at the probabilities and the size of the change, the conclusion became narrower: two decisions improved in one experiment, with no convincing evidence of a repeatable advantage.

The assistant in Codex wrote and ran the experiment, inspected the model and chose the replacement values. We supplied the question. The files below document what happened on 3 November 2026; this is a completed experiment, not a proposed workflow.

From neural-network weights to six tree values

The starting point was Rikiya Takehi's post on Weight-Space Programming. The authors describe experiments in which an LLM reads and changes neural-network weights directly. We wanted to try the broader idea on a smaller, easier-to-inspect model: could an assistant improve an already trained classifier by choosing a few parameter edits?

We used HistGradientBoostingClassifier from scikit-learn. It combines decision trees. A message follows conditions through each tree and ends at a leaf containing a number. For binary classification, those numbers contribute to a score that is converted into a probability. The scikit-learn documentation describes this logistic link.

Here, editing a leaf means changing the contribution of one region of the feature space. Every message reaching that leaf receives the same adjustment to its score. This gives us a concrete intervention to inspect, although it is a different task from editing a neural network. We report an assistant-driven experiment in Codex; the saved run files do not identify its exact underlying model version.

One training run, one candidate, a separate test

The data came from UCI's Spambase dataset: 4,601 messages represented by 57 numeric features, such as word frequencies, punctuation frequencies and capital-letter runs. We removed 391 repeated feature-and-label rows, leaving 4,210 records. Identical feature vectors, including three groups with conflicting labels, stayed together when the data was split.

The split contained 2,526 training records, 842 validation records and 842 test records. A stratified five-fold group split with seed 42 assigned three folds to training, one to validation and one to the test. Grouping prevented exact feature duplicates from crossing those boundaries; it does not rule out every possible relationship between messages.

The baseline used 100 trees, a learning rate of 0.1, at most 31 leaves per tree and at least 20 training examples per leaf. Early stopping was disabled. The resulting model had 3,100 leaves and was fitted once. This was a fixed baseline, not the winner of a hyperparameter search.

Before training, the protocol set a budget of one manual candidate with at most six leaf edits in the first tree. Accuracy at a probability threshold of 0.5 was the primary metric. The assistant could inspect training and validation information. Test predictions, labels and scores were kept out of the editing phase, and the patch was frozen before either version was scored on the test.

  1. Fit once2,526 training records
  2. Inspect and edit842 validation records; six leaf values
  3. Freeze the patchNo revisions after candidate scores
  4. Open the test842 records; compare both versions
The original run had one fitting step and one frozen manual candidate.

What the assistant actually changed

The assistant inspected the first tree's 31 leaf regions. For each region it saw the split conditions, the existing leaf value, the number of validation examples, their labels and predicted probabilities, and examples nearest the 0.5 decision threshold. It then chose six replacement values. No optimizer, additional tree training or automated search selected those numbers.

Four edits increased the spam score in regions with missed spam. Two reduced it in regions with false alarms. For example, leaf 14 contained a missed spam message with validation probability about 0.445 and a correctly classified non-spam message at about 0.418. Raising the leaf value from roughly -0.030 to 0.22 was intended to move the first example across 0.5 while leaving the second below it.

This is the key qualification: the choices used labelled validation examples. We did not test whether the assistant could improve the classifier from its parameters alone. Several decisions also rested on small groups: five of the six edited regions contained only 8–11 validation examples. The exact values, full conditions and selection notes are in the manual patch and inspection record.

All edits were in tree 0. Old values are rounded here; the downloadable patch retains full precision.
Leaf IDOld valueNew valueValidation examples
10-0.1471070.30210
12-0.0300460.2211
14-0.0300460.2211
16-0.0219140.789
28-0.021914-1.028
35-0.145247-0.4010
One of the six assignments, shown on a copy of the fitted baseline
from copy import deepcopy

edited = deepcopy(baseline)
edited._predictors[0][0].nodes["value"][14] = 0.22

# No fit() call after editing.
probabilities = edited.predict_proba(X_test)[:, 1]

Seven fewer validation errors became two fewer test errors

On validation, the error count fell from 35 to 28 and accuracy rose from 95.84% to 96.67%. That was useful feedback about the chosen changes, but it was not independent evidence: those were the examples the assistant had used to choose the patch.

On the final test, accuracy increased from 95.13% to 95.37%, a gain of about 0.24 percentage points. Two previously wrong decisions became correct, and no previously correct decision became wrong. Both corrections were spam messages that the original model had missed. The number of false spam alarms stayed at 18.

The six edits affected the probabilities of 256 of the 842 test messages. Only two crossed the classification threshold. One moved from 45.69% to 51.93% predicted spam probability; the other moved from 41.42% to 52.51%. The saved per-leaf outcomes identify these cases by their row indices in the public dataset.

The table shows why we describe the outcome as mixed. F1 improved slightly alongside accuracy, while log loss and Brier score worsened and ROC AUC fell slightly. The full results include the confusion matrices and verification checks.

Final test: the same 842 records, with a fixed 0.5 classification threshold.
MetricBaselineManual editPreferred direction
Accuracy95.13%95.37%Higher
Errors4139Lower
Log loss0.140640.14176Lower
Brier score0.037940.03839Lower
ROC AUC0.987750.98749Higher
F10.936830.94009Higher

How fewer mistakes can come with worse probabilities

Accuracy asks which side of 0.5 each prediction lands on. It treats a correct prediction at 0.51 and one at 0.99 the same. Log loss also considers the probability assigned to the true class, so a model can improve a few borderline decisions while making other probability estimates worse.

A leaf edit moves every message in that region. It does not know which individual example needs rescuing. In this run, the combined effect produced two extra correct classifications but a small increase in log loss, from 0.14064 to 0.14176. That establishes a worse observed score on this test; it does not establish a general failure of the editing approach.

The classification gain is also too small to support a strong claim. An exact two-sided McNemar test, which compares the decisions that changed between the two versions, gives p = 0.50. A paired bootstrap gave a 95% interval for the accuracy change of approximately 0.00 to +0.59 percentage points. For the log-loss change, the interval was approximately -0.00330 to +0.00552. These intervals condition on this one split and patch; they do not capture the uncertainty of training on other splits or choosing other edits.

Without retraining still involved learning from data

The procedure did satisfy a specific constraint: after the original training run, no training algorithm was called again. The evaluation script disabled fit() and checked that exactly six leaf values changed. Tree structure, split thresholds, the baseline intercept, other trees and the decision threshold remained fixed. A separate traversal of the saved trees reproduced both models' predictions.

In the broader statistical sense, the assistant was still tuning a model using labelled data. Looking at mistakes and choosing parameter changes is a form of learning, even when a language model supplies the constants instead of a conventional optimizer. Calling it a model improved with no data would misdescribe what happened.

This was one candidate on one dataset and one split. Spambase is a historical benchmark donated in 1999, so the result says little about present-day email filtering. We also did not compare the manual patch with ordinary alternatives such as tuning the decision threshold, calibration or regularized retraining. Those are comparisons a useful follow-up would need.

Open the patch, or replay the experiment

The downloadable experiment bundle contains the original scripts, pinned dependencies, public input data, full tree exports, the six-value patch and the recorded outputs. The README distinguishes inspecting the saved run from replaying it. The original experiment ran locally with Python 3.13.3 and scikit-learn 1.7.2.

Replaying the scripts trains the baseline again and applies the already chosen patch. It does not ask an assistant to invent six new values, so it checks reproducibility of this procedure rather than the repeatability of an assistant's editing ability. The script uses scikit-learn's private tree representation, which is another reason to keep the recorded library version.

What we can show is a small, inspectable intervention: six constants changed, two test decisions improved, and the overall probability scores moved the other way. For the next experiment, the useful question is whether independently chosen edits can improve a preselected metric across fresh splits and datasets, compared with ordinary tuning methods. The files here give you a concrete starting point for that comparison.

Sources and further reading

The sources behind this article. Instructions and example scenarios are suggestions from our editorial team.

Back to articles