← AI work

A trainable decision head on a frozen Gemma 4: zero-label classification with a label-efficient upgrade path

Abstract

We study a classifier that answers multiple-choice, graded-score and yes/no decision questions by reading the final hidden state of a frozen, 4-bit Gemma 4 E4B. With no labels, the head is exactly the model's own next-token preference among single-token answer handles, corrected by content-free calibration and order averaging. With labels, the same head is upgraded in place by a ladder of increasingly expressive corrections: a per-option bias and temperature (rung 1), then a per-option linear correction on the unit-length hidden state (rung 2), chosen per question type and checked against a held-out fifth of the labels. On eight suites drawn from CLINC150, Banking77 and SST-5, 20 labels per option raise accuracy by 2.5 to 15.7 points over the zero-label head and reduce expected calibration error 1.5 to 7×. Rung 2 helps on every intent suite from 5 labels per option but hurts on 5-level sentiment, which motivates a per-type default. We trace a training instability to the scale of Gemma's hidden states and fix it by normalisation. Re-tested with frozen settings on seven CLINC150 domains not used during development, the procedure gained 4.3 to 18.9 points at 20 labels per option.

1Introduction

Agent systems make many small routing and triage decisions: which team owns a request, how frustrated a customer is, whether something is urgent. A generative LLM can make these decisions, but generation is slow, its confidence is hard to read, and it cannot be improved from a handful of labelled examples without fine-tuning. We want a decision component that (i) works on day one with no labels, (ii) returns a calibrated probability for every option, (iii) runs locally on a small model, and (iv) gets measurably better as labels accumulate, without retraining or changing the model.

Our approach is a linear head on the final hidden state of a frozen Gemma 4 E4B. Its zero-label weights are Gemma's own output embeddings for the answer tokens, so with no data it reproduces the model's answer exactly; labels then train small corrections on top. This note contributes:

2Related work

Reading class probabilities from label tokens. Mapping each class to a single token and reading the model's next-token distribution over that closed set is now a common way to use an LLM as a classifier, typically followed by a separate calibration step before thresholds are trusted [15, 16]. Restricting and renormalising over label tokens can itself cause overconfidence [13], which our handle-mass diagnostic (§3.1) is designed to surface. Small (1–12B) models also hold on to the prior meaning of label words even against contrary demonstrations [14], which suggests option wording, not in-context examples, is the cheap lever for zero-label accuracy.

Calibration. Temperature scaling [1] and its per-class extensions such as vector and Platt scaling [3] fix the confidence of an otherwise fixed classifier; our rung 1 is this family. Contextual calibration [2] estimates a model's bias from a content-free input ("N/A") and divides it out without labels; our zero-label head uses it.

Probes on frozen representations. Training a linear classifier on a frozen network's activations [4] is a standard way to adapt a model cheaply, and recent work reports that probes on frozen LLM hidden states outperform zero- and few-shot prompting of the same model on classification while leaving the deployed model untouched [10, 11, 12]. Our rung 2 is such a probe, with one difference: it starts from the model's own answer rather than from random weights.

Residual corrections to a zero-shot classifier. In vision-language models, CLIP-Adapter [5] and Tip-Adapter [6] learn a correction added to CLIP's zero-shot classifier, and LP-FT [7] argues that starting from a good head distorts pretrained features less. Rung 2 applies the same idea to a decoder LLM's unembedding.

Alternatives. Parameter-efficient fine-tuning such as LoRA [8] usually wins once thousands of labels exist but changes the model and needs a training pipeline. Sentence-embedding classifiers such as SetFit [9] are cheap and strong but start from zero, with no label-free answer. We compare against neither here (§8).

3Method

3.1 Prompt and answer handles

A question is rendered as a task line, the options under single-token handles (letters A–Z without I for choice, digits for score, Yes/No for noul; about 34 options at most), the case text, and an Answer: line. Letters that occur as standalone tokens inside the question are skipped as handles. Gemma tokenises " 1" as a space followed by a digit, so score prompts end with Answer: including the trailing space; without it, the digit handles held 0.3% of the next-token probability. We report handle mass, the share of next-token probability on valid handles, as a diagnostic: the head only compares handles, so it can look confident when the model wants to say something else [13].

3.2 Zero-label head

Let \(h\) be the final-layer hidden state at the last position after the final norm, and \(U\) Gemma's output embedding. A handle may span several vocabulary rows (e.g. "A" and " A"), which are pooled by log-sum-exp after Gemma's logit soft-cap of 30:

\[ \begin{array}{lll} \text{rung 0} \quad & z_k = \operatorname{LSE}_m \operatorname{softcap}\!\big(U_{\text{handle}_k,\,m} \cdot h\big) \quad & \text{no labels} \\[4pt] \text{rung 1} \quad & \ell_k = (z_k + b_k)\,/\,T & \text{+ bias, temperature} \\[4pt] \text{rung 2} \quad & \ell_k = \big(z_k + \delta_k \cdot h/\lVert h\rVert + b_k\big)\,/\,T & \text{+ per-option correction} \end{array} \]

\(\operatorname{softcap}(x) = 30\tanh(x/30)\); \(\operatorname{LSE}\) is log-sum-exp; option probabilities are \(\operatorname{softmax}_k(\ell_k)\).

With no labels this equals Gemma's next-token logit for each handle, restricted to the valid answers (a unit test checks the equality).

3.3 Label-free corrections

Each question is also scored on a blank case ("N/A") and \(\alpha = 0.7\) of that log-prior is subtracted, following contextual calibration [2] (1.0 over-corrected in earlier work). choice questions are scored in listed and reversed option order and the per-option log-probabilities averaged, to cancel position bias. The answer abstains when the top two probabilities are within 0.10.

3.4 Upgrade rungs

Rung 1 trains \(b\) and \(\log T\). Rung 2 additionally trains \(\delta \in \mathbb{R}^{K \times 2560}\) (one row per option), initialised at zero so training starts from the zero-label answer, in the spirit of residual adapters [5, 6, 7]. The correction reads the unit-length hidden state \(h/\lVert h\rVert\) rather than \(h\): Gemma 4's final hidden states have \(\lVert h\rVert_1 \approx 5{,}000\), so on raw \(h\) a single Adam step moved a logit by about 25 and training oscillated (§6.1). On \(h/\lVert h\rVert\) one step moves a logit by at most \(\eta\sqrt{D}\), where \(\eta\) is the step size and \(D = 2560\). All rungs train by full-batch Adam on cross-entropy for a fixed 400 steps.

3.5 Training procedure

train(), the procedure a user calls, takes the labelled cases for one question and:

  1. picks the requested rung by question type: rung 2 for choice, rung 1 for score and noul (from §5);
  2. holds out a stratified fifth of each option's labels as a quiz; with under two labels per option on average it returns the zero-label head;
  3. fits every rung up to the requested one on the remaining labels and, for each, fits a temperature on the quiz by grid search (0.22× to 12×), recording the calibrated quiz loss;
  4. applies a guard: if the requested rung's quiz loss trails the best simpler rung by more than 0.05 nats, the next rung down is tried. The guard acts only when every option has at least two quiz labels (about 10 labels per option); below that the requested rung is kept;
  5. refits the chosen rung on all labels and applies the temperature correction found on the quiz.

The quiz is drawn only from the user's labelled cases; nothing in this procedure sees evaluation data.

3.6 Prefix caching

The prompt is split at the case text. The question prefix is identical across cases, so its KV cache is computed once and deep-copied per call (LRU of 64 prefixes). This gives the same predictions as full passes (probabilities within 0.01 on average, consistent with 4-bit numerical drift) and cut a 66-case routing suite from 520 to 187 ms per case on an Apple-silicon laptop.

4Experimental setup

4.1 Backbone

mlx-community/gemma-4-e4b-it-4bit (Gemma 4 E4B, instruction-tuned, 4-bit), frozen, run with MLX on one Apple-silicon machine. Hidden size 2,560.

4.2 Datasets

We have no large labelled set of our own decisions (two hand-written suites of 12 and 66 cases), so public datasets with separate train and test splits stand in. Options are described only by their intent names in words ("bill due"), so zero-label numbers are a floor.

SuiteDatasetTypeOptionsTrain poolTest

Table 1. Development suites. CLINC150 [17]: one domain of 15 intents plus an out_of_scope option trained on 100 and tested on 150 of CLINC's labelled out-of-scope queries. Banking77 [18]: 77 intents exceed the handle limit, so they are split into four fixed groups of 19–20 by a seeded shuffle. SST-5 [19]: 5-level movie-review sentiment, a score question; the test set is a seeded sample of 500 of 2,210 reviews. The held-out evaluation (§5.3) uses the other seven CLINC150 domains, built the same way.

4.3 What goes into training

4.4 Heads compared

Zero-label (rung 0); rung 1 alone; rung 2 alone; and train(), the shipped procedure. Rungs 1 and 2 alone are trained on the full sample with no quiz, guard or calibration.

4.5 Hyperparameters

SettingValueHow chosen
Content-free prior weight \(\alpha\)0.7Prior work on the same task family
Steps, optimiser400, AdamDevelopment suites
Learning rate (rung 1 / rung 2)0.05 / 0.02Development suites
Weight decay on \(b\) / \(\delta\)1e-3 / 0Development suites (§6.2)
Quiz fraction0.2Fixed a priori
Guard margin0.05 natsDevelopment suites
Guard minimum quiz labels per option2Development suites (§6.2)
Temperature grid81 points, 0.22×–12×Fixed a priori
Abstain margin0.10Fixed a priori, not tuned
Rung by type (choice / score / noul)2 / 1 / 1Development suites; noul untested

Table 2. Every setting marked "development suites" was chosen while looking at test-split results of the eight suites in Table 1; §5.3 re-tests them on data not used for any choice.

4.6 Metrics

Accuracy; expected calibration error (ECE, 10 equal-width bins on top-1 confidence); abstain rate; for CLINC, out-of-scope recall and precision. We report the mean and standard deviation over the five draws.

5Results

5.1 Learning curves

Figure 1 and Table 3 show test accuracy against labels per option. On all seven intent suites rung 2 leads from 5 labels per option, and most of the gain arrives by 20. On SST-5, rung 2 falls below the zero-label line while rung 1 gains 5 points, so train() uses rung 1 for score questions; the per-type default was chosen from these curves.

Figure 1. Test accuracy against labels per option. Mean of five draws; bands show one standard deviation. The seven intent suites share a 75–100% scale; SST-5 has its own. Where train() keeps rung 2, its line covers rung 2's. Hover a point for its numbers.

Table 3. Accuracy by head and labels per option

Mean ± standard deviation over five draws, in percent. Bold is the best in each group. At 100 labels every draw uses the whole pool, so there is no spread.

5.2 Accuracy and calibration at 20 labels per option

At 20 labels per option, train() adds 2.5 to 15.7 points over the zero-label head (median 6.7; Figure 2). The largest gains are on Banking77 groups 1 and 3, where intent names alone are most ambiguous. Rung 2 alone is overconfident; fitting the temperature on the quiz brings train() below both the zero-label head and uncalibrated rung 2 in ECE on every suite (Figure 3). On CLINC travel, out-of-scope recall rises from 75% to 91%. Across all sizes, no train() mean falls below its zero-label head.

Figure 2. Gain over the zero-label head at 20 labels per option, in accuracy points.
Figure 3. Expected calibration error at 20 labels per option (lower is better). SST-5's zero-label error of 0.42 is drawn to scale.

5.3 Held-out re-test of the frozen settings

6Analysis and ablations

6.1 Training stability of rung 2

An earlier version added the correction to the answer embedding, \((U + \delta)\cdot h\). In 7 of 32 size-by-suite settings one draw fell far below the others. Tracing a collapsed run step by step (Figure 5) showed oscillation from the first step rather than gradual overfitting: with \(\lVert h\rVert_1 \approx 5{,}000\), one Adam step of 0.005 per weight could move a logit by about 25. The unstable runs had ended mid-swing. Reading \(h/\lVert h\rVert\) removes this; the draws in previously unstable settings now sit within about two points (Figure 6).

Figure 5. Test accuracy during training, one draw (Banking77 group 3, 10 labels per option, draw 3). Before, accuracy falls from 80% to 16% within five steps, swings between 33% and 89%, and ends at 54%. After, it settles by step 100 and ends at 89%. Test accuracy is logged here for diagnosis only; it plays no part in training.
Figure 6. The five draws of rung 2 in settings whose draws had a standard deviation above 3 points before the fix. Intent-suite means rise by 1.7 to 6.3 points; on SST-5 the draws tighten but rung 2 stays below rung 1.

6.2 Design choices tested and rejected

VariantResultDecision
Early stopping on quiz lossQuiz loss turns up after 10–40 steps while accuracy keeps rising to ~400; 92.3% vs 94.2% (Banking77 g1, 20/option)Fixed 400 steps
Rung chosen by quiz loss aloneToo noisy with small quizzes: picked no training in 4 of 5 draws on CLINC banking at 5/optionDefault by type, guard as a check
Guard with one quiz label per optionWrong fallbacks cost 1–2 points at 5/optionGuard needs 2 per option
Weight decay on \(\delta\) (normalised \(h\))83% vs 94% (Banking77 g1, 20/option)Off
Case text before the question (state-first), for cross-question caching2–2.7× faster per case on long texts; urgency 83% vs 92%; blank-input prior over-correctsOpt-in only, without the prior
Score prompt ending Answer: (no space)Handle mass 0.003; frustration accuracy 67% vs 75%Trailing space

Table 5. The first four rows were measured on development-suite test splits; the last two on the hand-written support suite (12 cases), so their accuracy differences are a few cases each.

7Error analysis

We compare the zero-label head with train() at 20 labels per option on the same test queries. Most fixes teach a dataset's labelling conventions, which intent names do not convey: Banking77 files "how do I check my new card's PIN" under get_physical_card, and that one convention accounts for 36 of 130 fixes in group 1. Regressions cluster on pairs that annotators could reasonably dispute.

SuiteFixedBrokenMost common fix (was → now)

Table 6. Test queries the zero-label head got wrong and train() got right (fixed), and the reverse (broken), for one draw at 20 labels per option.

Fixed by training

Broken by training

8Limitations: what is missing

9Future work

  1. Label about 20 of our own cases per option.Most of the gain on every intent suite arrived by 20 per option. For the treasury router that is about 120 labelled requests, and it is the only way to measure real traffic.
  2. Add external baselines.Few-shot prompting of the same model, SetFit [9] and a small LoRA [8] on the same draws would place the head among the alternatives teams actually use.
  3. Write one-line option descriptions.Many fixes were naming conventions, and small models anchor strongly on label wording [14]. Better descriptions should raise the zero-label floor.
  4. Measure yes/no questions and handle mass on public suites.Confirms the noul default and quantifies the renormalisation overconfidence described in [13].
  5. Tune the guard at 10 labels per option.Raise its quiz minimum, or keep rung 2 unconditionally for choice questions now that it is stable.

References

  1. C. Guo, G. Pleiss, Y. Sun, K. Q. Weinberger. On Calibration of Modern Neural Networks. ICML 2017. arXiv:1706.04599
  2. Z. Zhao, E. Wallace, S. Feng, D. Klein, S. Singh. Calibrate Before Use: Improving Few-Shot Performance of Language Models. ICML 2021. arXiv:2102.09690
  3. J. Platt. Probabilistic Outputs for Support Vector Machines and Comparisons to Regularized Likelihood Methods. Advances in Large Margin Classifiers, 1999.
  4. G. Alain, Y. Bengio. Understanding Intermediate Layers Using Linear Classifier Probes. 2016. arXiv:1610.01644
  5. P. Gao et al. CLIP-Adapter: Better Vision-Language Models with Feature Adapters. 2021. arXiv:2110.04544
  6. R. Zhang et al. Tip-Adapter: Training-free CLIP-Adapter for Better Vision-Language Modeling. ECCV 2022. arXiv:2111.03930
  7. A. Kumar, A. Raghunathan, R. Jones, T. Ma, P. Liang. Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distribution. ICLR 2022. arXiv:2202.10054
  8. E. J. Hu et al. LoRA: Low-Rank Adaptation of Large Language Models. ICLR 2022. arXiv:2106.09685
  9. L. Tunstall et al. Efficient Few-Shot Learning Without Prompts (SetFit). 2022. arXiv:2209.11055
  10. A BERTology View of LLM Orchestrations: Token- and Layer-Selective Probes for Efficient Single-Pass Classification. ACL 2026. arXiv:2601.13288 *
  11. Structured but Silent: Probing Capability Requirements in LLM Hidden States. 2026. arXiv:2610.08018 *
  12. Probing Hidden States for Calibrated, Alignment-Resistant Predictions in LLMs. medRxiv 2025. 10.1101/2025.09.17.25336018 *
  13. The Silent Vote: Improving Zero-Shot LLM Reliability by Aggregating Semantic Neighborhoods. 2026. arXiv:2605.09739 *
  14. Semantic Anchors in In-Context Learning: Why Small LLMs Cannot Flip Their Labels. 2025. arXiv:2511.21038 *
  15. Fireworks AI. Fine-Tune an LLM Classifier with Calibrated Probabilities. Blog, December 2025. fireworks.ai
  16. ClassifyLM: LLM-Based Classification (overview including SALSA). emergentmind.com *
  17. S. Larson et al. An Evaluation Dataset for Intent Classification and Out-of-Scope Prediction (CLINC150). EMNLP 2019. D19-1131
  18. I. Casanueva et al. Efficient Intent Detection with Dual Sentence Encoders (Banking77). NLP4ConvAI 2020. arXiv:2003.04807
  19. R. Socher et al. Recursive Deep Models for Semantic Compositionality Over a Sentiment Treebank (SST). EMNLP 2013. D13-1170

* Recent work located by search and cited from its abstract and summary; we have not read these in full or independently verified their claims.