WorksComputer Science
Group-Balanced Supervised Fine-Tuning for Knowledge-Intensive Domains
Abstract
Supervised fine-tuning (SFT) weights every supervised token equally, so on knowledge-dense corpora the loss budget follows token count rather than importance: on a legal QA benchmark, citation strings absorb 81% of the supervised loss weight budget while the answers being taught absorb 5%. We present Group-Balanced SFT (GB-SFT), which equalizes the loss budget across the semantic roles of tokens within a target sequence. With one tunable dial and one structural switch, GB-SFT contains standard SFT, class- and span-level balancing as corners whose geometry we characterize exactly. On benchmarks in law, medicine, code, and mathematics, we show across model families that: (i) GB- SFT injects new knowledge better than uniform SFT, pointwise token weighting, memory editing, and matched-budget data mixing; (ii) it matches the injection of masking out everything but the knowledge payload while retaining the citation recall that masking destroys (0.98 vs. 0.38); and (iii) role-aware grouping carries the gain: label-free partitions recover at most a third of it, an LLM tagger nearly all where the groups are lexically distinctive; and and (iv) the budget governs what fine-tuning breaks as well as what it learns, acting as a monotone lever on the safety-guardrail erosion SFT causes, at matched task accuracy. We release two new contamination-controlled knowledge-injection benchmarks with validated ground truth.
Introduction
Large language models achieve strong general-purpose performance, but deployment in knowledge-intensive domains such as law or medicine requires learning specialized facts ([22, 36]). These domains also fix how facts are written: citation grammars, structured product labels and clinical schemas are mandated externally, leaving the fact to be learned as a small span inside a document that is largely required boilerplate. Supervised fine-tuning, the most common adaptation strategy ([31, 45]), weights every supervised token equally and spends most of its loss budget on that boilerplate.
As a motivating illustration, we consider the task of fine-tuning a model on legal QA ([44]), and break down a two-example corpus of legal questions in Figure 1. We call the tokens that state the actual answer the payload and the surrounding boilerplate (citations, templated prose) the scaffold. By token count, the payload forms a very small portion of the examples compared to scaffold (a numeral-dense citation number, and some extra short prose). This shows that not all tokens in the supervised target carry equal knowledge payload.
Figure 1. Example of how our grouping budgeting strategies upweight the knowledge payload in a 2-fact corpus. SFT weights the knowledge payload by its share of tokens. GB-SFT gives each class (color) an equal budget, and GB-SFT gives each span an equal budget ( number of red blocks). Our unified formulation also gives a tunable knob to gradually increase the class balance.
A natural solution is to use a fine-tuning objective with some kind of non-uniform token weighting scheme. Some prior works ([25, 40, 26, 38]) learn pointwise token importance scores. Our key insight hinges on the fact that tokens in knowledge-dense corpora can be semantically grouped, most readily by the nature of fact construction itself (e.g. as part of the answer, citation, or prose in legal QA). We propose a unified group-balanced supervised fine-tuning (GB-SFT) framework, in which we theoretically and empirically study different grouping strategies and ways to balance the loss among groups. GB-SFT outperforms both pointwise weighting and generic group heuristics ([18]) on knowledge-dense corpora from multiple domains, achieving a favorable balance between preserving existing knowledge and injecting new knowledge. We make the following contributions:
New group-balanced fine-tuning objectives that give more weight to the knowledge payload.
Improved group construction methods and theoretical characterization of balancing granularity.
New benchmarks for measuring knowledge injection across multiple domains.
Empirical insight into the tradeoffs between preserving and injecting knowledge.
Related Work
Token weighting. Dynamic Fine-Tuning (DFT) weights each token’s cross-entropy by the policy’s own detached probability; Anchored supervised fine-tuning (ASFT) stabilizes DFT with a uniform token-level Kullback–Leibler (KL) anchor to the frozen base model [46]. Related online-weighting rules include probability thresholding and temperature-scaled variants [23, 42, 6]. Rho-1 selects tokens by excess loss against a curated-data reference [25], PriFT weights tokens by prior support under the pretrained checkpoint [38], and EKSFT masks high-entropy tokens from imitation while regularizing them toward the reference [26]. These methods share a pointwise premise (a token’s weight should be a function of its own difficulty or plausibility) and can miss group-level structure.
Group-based weighting and class imbalance. Closest to our approach, SFT-GO partitions tokens into importance groups and optimizes a mixture of worst-group and average loss: a token-level Group-DRO objective [18, 35]. Rather than adaptively emphasizing the hardest group, a heuristic we find points the wrong way on fact-editing tasks, we balance the loss budget each role receives. Our budget correction descends from inverse-frequency and class-balanced losses in classification [5], and contrasts with difficulty-based schemes such as focal loss [24], which upweight hard tokens (the opposite of what we need). In App. E.7 we give an extended discussion of related work, Ye et al. (2025) which uses a weighting from group loss statistics and Hsieh et al. (2023) which extracts LLM rationales as additional supervision; we experimentally compare in App. E.4.
Span-level supervision units. Treating spans rather than tokens as the unit of masking or supervision has precedent in pretraining: salient span masking targets entity spans for knowledge acquisition [11], and SpanBERT and PMI-masking mask correlated spans [16, 21]. On the aggregation-unit question, recent work shows that the normalization unit of an RL objective silently changes what is optimized [27]; our identity for pooled-versus span-normalized CE is the SFT instance of this observation.
Knowledge injection, forgetting, and post-hoc robustness. Fine-tuning on new facts can promote hallucination [9], and knowledge becomes extractable only under sufficient paraphrase and format diversity [1]; our evaluation accounts for these considerations. Memory-editing methods modify facts directly in weights [29, 30], though they do not produce task training. We compare against continual-learning levers such as rehearsal/replay [3, 19] and and post-hoc weight interpolation [39], which we find preserve existing more than acquire new knowledge.
Legal NLP benchmarks. We build on Housing Statute QA [44] and evaluate statutory value injection on real statute excerpts, akin to LegalBench [10], CaseHOLD [43], and SARA [13]. We target parametric knowledge, unlike retrieving legal knowledge into context for agents [12].
Method
A standard SFT loss weighs each supervised token equally, computing the average negative log likelihood (or cross-entropy loss) of the gold token over all tokens:
where denotes the model parameters, the model’s conditional next-token distribution, the input prompt, the gold token at position , the gold tokens preceding it, the number of supervised tokens, and the resulting per-token cross-entropy loss.
This fails to account for the fact that some groups of tokens may carry more knowledge payload than others. Thus, we will show how to partition tokens into groups and balance the loss accordingly.
Token Groupings
Grouping is specified by two maps over the supervised tokens of a datum. A class grouper assigns each token one of classes, and a span grouper partitions the tokens into spans. We require that refine : every span lies entirely within a single class. Both groupers admit supervised and unsupervised realizations. Writing for the frozen pretrained reference model, we consider the following class- and span-level groupers:
In our labeled runs is induced by through contiguity, which makes refinement automatic. That chaining is a property of the instantiation and not of the framework: the Detector grouper produces spans with no class labeling at all, and the Surprisal grouper produces classes with no span structure. In Figure 1, assigns each token to {answer, citation, prose}, and is the maximal runs of constant class (colored blocks).
Group-Balanced Loss Budgeting
Now our supervised tokens each belong to a class and span , where class has tokens and has tokens. We write and both for the groupers and for the partitions they induce, and identify a class (resp. a span ) with its set of token positions, so that and are well defined. Our proposed Group-Balanced Supervised Fine-Tuning, GB-SFT, equalizes the loss budget across the coarse class-level groups, or the refined span-level groups.
Group-Balanced by Class. To get the loss function for our GB-SFT strategy, we compute the mean per-token loss for each class and then take the mean per-class loss across all classes:
Group-Balanced by Span. To get the loss function for our GB-SFT strategy, we compute the mean per-token loss for each span and then take the mean per-span loss across all spans:
In Figure 1 we visualize a toy housing law fact corpus. Under the tokenization of the Qwen3.5-9B-Base tokenizer ([33]) we show the breakdown of tokens across the categories of answer (the main knowledge payload), citation, and prose (the latter two being scaffolds for the knowledge), and the loss breakdown under ordinary SFT versus our GB-SFT and GB-SFT. This clearly shows the increased emphasis that group balancing places on the knowledge payload.
A unified formulation. Both balanced loss functions, along with ordinary SFT, can be unified in a single formulation in which we can modulate , the pooling unit within a class, and the budget split across classes. Define the following terms for a token lying in span and class :
The term controls class budget, controls span budget within a class, and is the (uniform) budget given to tokens within a span. These combine to yield token weights , where at every , for our general group-balanced GB-SFT loss formulation:
where interpolates between budgeting by class mass and budgeting by class count: at each class receives budget in proportion to its mass (at , exactly its token count), while at the mass cancels and every class receives regardless of size. does the same at the span level: at each span counts once, however long. Our familiar objectives are special cases of (5): yields SFT, yields GB-SFT, and yields GB-SFT.
The two exponents are not symmetric: is the dial, a structural choice of which unit carries a budget, exercised only at its endpoints. App. E.1 develops this and connects the pooling-unit axis to prior work.
While we apply this group-based allocation to the supervised loss, we present a formulation for using group allocation to additionally partition a KL anchor ([46]) in App. C.
Analysis
How the loss moves in . Let denote the spans of class . Group the weights of (4) into a class budget, a within-class span distribution, and a span-mean loss:
so that (5) reads : is the share of the budget class receives, splits that share among ’s spans, and is ’s -weighted mean loss, (the token mean over the class at , the mean of its span means at ). Holding fixed, the GB-SFT family admits an exact characterization of how the loss moves in and between its corners (App. B.1):
We thus see that acts only between classes, acts at both levels, and ’s between-class term carries the factor , so it vanishes at .
The finite counterpart of the within-class term compares the two pooling units at a fixed class budget , or equivalently at a fixed in Eq. (6). Within a class, pooled and span-balanced training differ only in how they average the span-mean losses : pooling weights each span by its length ; span balancing weights spans equally. The gap between them is exactly the length/difficulty covariance:
Lemma 1 (Covariance identity). Fix a class with spans , , span lengths , and mean span length . Let be the unweighted empirical covariance over the spans of . Then, for every ,
This identity is assumption-free: it requires no convexity, smoothness, or boundedness, and holds pointwise at every checkpoint (proof and a gradient-level analogue in App. § 11.§ 2). A Cauchy-Schwarz argument bounds the difference in losses for a fixed class budget by , the within-class coefficient of variation of span lengths (Cor. 1, App. § 11.§ 2), explaining why GB-SFT and GB-SFT rarely separate on our corpora: small forces the allocations close. The sign of the covariance is also informative: it is negative (short spans are harder per token) on our HOUSING-QA benchmark [44], so span balancing shifts budget toward exactly the spans that token-proportional pooling starves.
Experiments
Base LLMs & Configuration. Our main base LLMs are Qwen3.5-9B-Base [33] and Llama 3.1-8B [7]. All arms train low-rank adapters (LoRA) Hu et al. [15] (, , no dropout) and MLP projections for 3 epochs at learning rate with token-budgeted micro-batches on a single NVIDIA B200 GPU. Our findings hold across learning rates (App. § 13.§ 5), LoRA ranks (App. § 13.§ 4), and model sizes; GB-SFT helps larger models more (App. § 13.§ 3). For fine-tuning results, is one standard deviation over three seeds; frozen base model results are a single deterministic evaluation.
Baselines. We compare our class and span-balanced methods, GB-SFT and GB-SFT, against three families of published SFT methods, chosen so that each isolates a different axis of the design space rather than merely providing a number to beat. In App. § 13.9.1 and D.9.2 we also consider mechanisms that go beyond token-level loss re-weighting as a further control.
Loss Shaping. We compare against standard supervised fine-tuning, dynamic fine-tuning DFT [40], and anchored supervised fine-tuning ASFT [46].
Reference-weighted token selection. We compare against PrIFT-Mass and PrIFT-Prob [38], EksFT [26], and Rho-1 [25].
Group-based aggregation. We compare against SFT-Go [18], most in the spirit of our work; in addition to running SFT-Go as published, we also consider giving it our default category-based token grouping, denoted as SFT-GO.
We also propose several variants that, inspired by Zhu et al. [46], use a KL-based anchoring mechanism to preserve knowledge (App. § 12). Masked-SFT masks the cross-entropy loss from the largest scaffold classes, Anchor-Only applies only the anchor term to the scaffold class, and SFT + KL adds a KL anchor term to all classes. Gated applies the anchor with a soft surprisal-weighted gate, and we also test its inversion control Gated-Inv.
| Method | Qwen3.5-9B-Base | Llama 3.1-8B | ||||||
| AUC-in | AUC-out | cite-in | cite-out | AUC-in | AUC-out | cite-in | cite-out | |
| untuned base | .560 | .541 | .580 | .752 | .507 | .556 | .800 | .816 |
| group balancing (ours) | ||||||||
| GB-SFT\textsubscript{class} | .760 ± .013 | .603 ± .002 | .983 ± .002 | .600 ± .017 | .748 ± .009 | .611 ± .011 | .987 ± .005 | .669 ± .010 |
| GB-SFT\textsubscript{span} | .769 ± .009 | .603 ± .010 | .972 ± .003 | .624 ± .006 | .765 ± .006 | .629 ± .013 | .993 ± .002 | .723 ± .007 |
| anchored variants (ours) | ||||||||
| ANCHOR-ONLY | .746 ± .004 | .576 ± .009 | .581 ± .016 | .739 ± .019 | .752 ± .011 | .597 ± .008 | .681 ± .008 | .744 ± .026 |
| GATED | .671 ± .011 | .579 ± .020 | .980 ± .006 | .603 ± .023 | .591 ± .023 | .621 ± .004 | .981 ± .004 | .729 ± .013 |
| GATED-INV | .684 ± .009 | .583 ± .013 | .866 ± .022 | .576 ± .016 | .663 ± .013 | .631 ± .023 | .965 ± .002 | .731 ± .015 |
| group-based aggregation | ||||||||
| SFT-GO | .630 ± .009 | .568 ± .003 | .980 ± .000 | .704 ± .012 | .529 ± .006 | .566 ± .012 | .993 ± .002 | .795 ± .022 |
| SFT-GO\textsubscript{oracle} | .756 ± .014 | .605 ± .015 | .968 ± .004 | .720 ± .016 | .773 ± .010 | .624 ± .018 | .987 ± .002 | .815 ± .013 |
| reference-weighted selection | ||||||||
| PRIFT-MASS | .601 ± .012 | .596 ± .011 | .603 ± .009 | .544 ± .012 | .595 ± .008 | .606 ± .005 | .725 ± .011 | .704 ± .037 |
| PRIFT-PROB | .644 ± .007 | .582 ± .004 | .845 ± .005 | .603 ± .020 | .670 ± .005 | .622 ± .002 | .881 ± .002 | .731 ± .008 |
| RHO-1 | .595 ± .004 | .581 ± .012 | .948 ± .012 | .684 ± .017 | .675 ± .004 | .625 ± .008 | .968 ± .003 | .771 ± .018 |
| EKSFT | .693 ± .009 | .607 ± .014 | .665 ± .030 | .396 ± .023 | .670 ± .017 | .597 ± .021 | .863 ± .013 | .700 ± .031 |
| loss shaping | ||||||||
| SFT | .652 ± .011 | .576 ± .021 | .988 ± .003 | .583 ± .016 | .630 ± .008 | .595 ± .015 | .991 ± .002 | .712 ± .015 |
| SFT + KL | .652 ± .008 | .566 ± .004 | .980 ± .003 | .631 ± .007 | .631 ± .004 | .595 ± .019 | .991 ± .005 | .665 ± .025 |
| DFT | .529 ± .035 | .538 ± .028 | .483 ± .037 | .523 ± .041 | .515 ± .016 | .518 ± .032 | .541 ± .024 | .659 ± .022 |
| ASFT | .509 ± .010 | .493 ± .008 | .645 ± .039 | .596 ± .062 | .486 ± .005 | .567 ± .016 | .788 ± .021 | .725 ± .007 |
| control | ||||||||
| MASKED-SFT | .768 ± .007 | .578 ± .012 | .379 ± .005 | .355 ± .010 | .727 ± .012 | .608 ± .004 | .577 ± .007 | .580 ± .013 |
Table 1 (PDF p. 6). Table 1: HOUSING-QA. AUC-in is mean within-group AUC over the 99 held-in question groups containing both labels; AUC-out the same over 82 held-out groups. cite-in is top-1 citation recall against nine real distractors on the held-in jurisdictions; cite-out the same on held-out. GB-SFT achieves the most knowledge payload injection (AUC-in) on Qwen3.5-9B-Base; our groupings also help SFT-GO\textsubscript{oracle} preserve the most scaffold knowledge (cite-out). App. E.6 gives the full comparison across corpora and models. Note also that MASKED-SFT comes within .002 of GB-SFT\textsubscript{span}’s AUC-in on Qwen3.5-9B-Base at the cost of its citation recall collapsing on both splits and models.
Benchmark Results
Housing-QA: Learning real knowledge with no general prior. We build on the Housing Statute QA dataset from Zheng et al. [44], where the goal is to teach a model jurisdiction-specific verifiable facts about housing law. We construct a dataset of 1,176 facts about which Qwen3.5-9B-Base has no confident belief about the correct answer. By construction, each fact decomposes into three classes among which we can budget learning: the answer to a housing law question (Yes/No), a citation, and templated prose. Spans are sequences of contiguous tokens belonging to the same class. Full details of this benchmark are listed in Appendix § 10.§ 1.
In Tab. 1 we compare methods along two axes: knowledge payload injection (measured by AUC within question group) and scaffold knowledge preservation (citation recall). We see the following:
Our methods outperform existing token reweighting baselines in knowledge injection. GB-SFT outperforms the pointwise baselines and default SFT-GO, while being competitive with oracle SFT-GO. Meanwhile, DFT (Wu et al. [40]) and its variant ASFT (Zhu et al. [46]) sit below the base AUC; they reweigh learning based on what the current policy already considers unsurprising or the reference model already knows, the opposite of what a model needs to learn new knowledge. Meanwhile, GB-SFT\textsubscript{span} gains +0.209 AUC-in over base. This is a 3.4× ratio with its gains in +0.062 AUC-out, indicating that what was learned is jurisdiction-specific knowledge injection rather than general adaptation. These improvements persist under held-out phrasing (App. § 13.§ 2).
There is a tradeoff between preserving knowledge and injecting new knowledge. On Qwen, MASKED-SFT, the highest-performing baseline on held-in AUC, achieves held-in citation recall of 0.379, below an untuned base (0.580) and far below our methods at 0.972 and 0.983. For held-out citation recall, no method compared here exceeds base preservation levels (0.752) while also injecting on Qwen, On Llama, our grouping does help SFT-GO maintain them. ANCHOR-ONLY comes closest on Qwen, giving up 0.024 AUC compared to GB-SFT\textsubscript{span} to hold held-out citation recall within 0.013 of base, by not supervising the scaffold at all (thus not improving the base on held-in citation recall). More details of the anchoring tradeoff are in App. § 12.
NC-REAL: injecting knowledge absent from pretraining. Our next benchmark is a controlled study of acquiring knowledge that cannot be in a model’s training corpus. We take real statutory prose from the LSC Eviction Laws Database and change the values, to construct a training dataset of 229 distinct facts from which we form 916 training examples by taking the same altered statute body with four different headers. The evaluation dataset consists of 758 items. Each fact decomposes into two classes: values or prose. Spans are once again sequences of contiguous tokens belonging to the same class. More details of this benchmark, called NC-REAL, are in App. A.2.
Our main results are shown in Table 2. On Qwen, we observe particularly good performance by ANCHOR-ONLY, which achieves the top overwrite and top-1 performance by a very narrow margin over GB-SFT; however, GB-SFT variants outperform it by a considerably wider margin on Llama. Moreover, our methods achieve the top performance compared to all other published baselines on both models. DFT and ASFT collapse across both models, again verifying our intuition.
| Method | Qwen3.5-9B-Base | Llama 3.1-8B | ||||||
| overwrite | top-1 | overwrite | top-1 | |||||
| untuned base | .133 | .011 | −2.65 | −4.99 | .094 | .009 | −2.69 | — |
| group balancing (ours) | ||||||||
| GB-SFT | .954 ± .000 | .861 ± .006 | −4.36 ± .08 | −.43 ± .00 | .947 ± .004 | .892 ± .017 | −4.97 ± .09 | −.46 ± .01 |
| GB-SFT | .954 ± .003 | .861 ± .007 | −4.52 ± .05 | −.43 ± .01 | .946 ± .004 | .882 ± .004 | −5.03 ± .05 | −.44 ± .01 |
| anchored variants (ours) | ||||||||
| ANCHOR-ONLY | .963 ± .002 | .877 ± .006 | −4.84 ± .12 | −.46 ± .01 | .919 ± .006 | .865 ± .009 | −4.94 ± .09 | −.62 ± .02 |
| GATED | .929 ± .007 | .823 ± .007 | −4.48 ± .01 | −.60 ± .02 | .906 ± .004 | .845 ± .010 | −5.34 ± .14 | −.68 ± .03 |
| GATED-INV | .425 ± .010 | .143 ± .006 | −3.61 ± .01 | −4.50 ± .05 | .300 ± .003 | .119 ± .004 | −3.70 ± .01 | −5.58 ± .06 |
| group-based aggregation | ||||||||
| SFT-GO | .841 ± .004 | .683 ± .012 | −3.28 ± .03 | −.94 ± .01 | .852 ± .003 | .733 ± .008 | −3.77 ± .08 | −.96 ± .00 |
| SFT-GO | .910 ± .016 | .749 ± .010 | −3.54 ± .04 | −.67 ± .05 | .934 ± .009 | .804 ± .005 | −3.88 ± .05 | −.62 ± .04 |
| reference-weighted selection | ||||||||
| PRIFT-MASS | .125 ± .003 | .021 ± .000 | −5.60 ± .04 | −10.81 ± .06 | .083 ± .001 | .017 ± .003 | −5.55 ± .10 | −12.49 ± .28 |
| PRIFT-PROB | .242 ± .006 | .051 ± .006 | −3.90 ± .03 | −6.50 ± .02 | .174 ± .003 | .040 ± .003 | −3.89 ± .03 | −7.70 ± .03 |
| RHO-1 | .461 ± .007 | .104 ± .013 | −2.87 ± .01 | −3.26 ± .04 | .412 ± .004 | .085 ± .005 | −2.98 ± .01 | −3.71 ± .07 |
| EKSFT | .596 ± .013 | .330 ± .015 | −2.98 ± .03 | −2.11 ± .07 | .616 ± .011 | .338 ± .020 | −3.15 ± .04 | −2.31 ± .09 |
| loss shaping | ||||||||
| SFT | .909 ± .003 | .821 ± .005 | −4.04 ± .02 | −.64 ± .01 | .913 ± .001 | .862 ± .004 | −5.01 ± .02 | −.61 ± .01 |
| SFT + KL | .896 ± .002 | .800 ± .006 | −3.67 ± .06 | −.68 ± .02 | .899 ± .003 | .843 ± .003 | −4.61 ± .03 | −.66 ± .00 |
| DFT | .239 ± .011 | .047 ± .006 | −7.84 ± .36 | −12.56 ± .42 | .109 ± .021 | .027 ± .005 | −8.63 ± .16 | −17.40 ± .59 |
| ASFT | .249 ± .010 | .044 ± .003 | −4.72 ± .04 | −7.73 ± .18 | .189 ± .016 | .042 ± .006 | −4.90 ± .06 | −9.01 ± .10 |
Table 2. NC-REAL, held-in facts. Overwrite is the fraction of items where the taught (false) value outranks the true one; top-1 additionally requires it to beat all six distractors. values are mean per-token log-probabilities of each candidate continuing the statute’s own prefix, so measures how much of the real statutory value survives injection. GB-SFT injects more knowledge than all published baselines and is competitive or superior to our anchoring variant.
REALVAL: injecting real missing knowledge. Success on NC-REAL means the model has absorbed a counterfactual, so the benchmark measures capability for knowledge injection, but not desirable behavior. We next introduce a benchmark called REALVAL, in which the taught value is the one actually in the statute and success means becoming more correct. For each base LLM, we build a corpus of Housing-QA statutes where it consistently fails (full details in App. A.3).
In Figure 5 (App. A.3), we show that GB-SFT corrects the most facts, due to fact-specific knowledge injection as well as the ability to guess correct values for held-out facts. Notably, for Qwen3.5-9B-Base, SFT-GO performs below ungroupped SFT, revealing a case where its hardest-group heuristic is counterproductive. However, correction can come at the cost of new mistakes, so in Figure 2, we plot the change in rate of facts broken versus rate of fact fixing relative to SFT. GB-SFT sits on the Pareto frontier for both models, and results that break fewer facts are simply conservative and fix very few mistakes. GB-SFT also has the highest ratio of rate of fact fixing to fact breaking relative to SFT, at 1.73 (ANCHOR-ONLY is at 1.24 and most baselines are so small as to be noise). Thus, it exhibits a favorable tradeoff between preserving the base model’s knowledge and acquiring knowledge of new facts the model previously got wrong.
Figure 2. The exchange rate between learning and breaking knowledge. Horizontal axis is facts broken relative to SFT; vertical is mistakes fixed. SFT is the origin, so an arm’s exchange rate is simply the slope of the line joining it to the origin, and the dotted 1:1 line is the break-even locus: above it an arm fixes more than it breaks relative to SFT. The solid line is the Pareto frontier (most fixed for fewest broken). GB-SFT achieves a Pareto-optimal exchange.
Figure 5. REALVAL, methods ordered by total correction for both base models. GB-SFT achieves the highest levels of total correction, led by its ability to inject knowledge but also showing ability to improve held-out correction.
| Method | Qwen3.5-9B-Base | Llama 3.1-8B | ||||||
| ovwrite | top-1 | true | taught | ovwrite | top-1 | true | taught | |
| untuned base | .083 | .030 | −.85 | −2.81 | .065 | .021 | −1.08 | −4.24 |
| group balancing (ours) | ||||||||
| GB-SFTclass | .799 ± .006 | .588 ± .010 | −1.56 ± .03 | −.82 ± .01 | .842 ± .001 | .558 ± .001 | −2.25 ± .02 | −1.16 ± .01 |
| GB-SFTspan | .788 ± .002 | .583 ± .003 | −1.51 ± .01 | −.81 ± .00 | .852 ± .005 | .598 ± .002 | −2.16 ± .02 | −1.16 ± .01 |
| anchored variants (ours) | ||||||||
| ANCHOR-ONLY | .819 ± .015 | .587 ± .018 | −1.74 ± .03 | −.81 ± .03 | .891 ± .001 | .650 ± .005 | −2.54 ± .03 | −.98 ± .01 |
| group-based aggregation | ||||||||
| SFT-GO | .329 ± .007 | .145 ± .001 | −1.12 ± .01 | −1.43 ± .00 | .418 ± .000 | .234 ± .002 | −1.58 ± .00 | −1.85 ± .00 |
| SFT-GO oracle | .605 ± .008 | .288 ± .010 | −1.35 ± .02 | −1.18 ± .01 | .747 ± .006 | .401 ± .015 | −2.09 ± .02 | −1.45 ± .02 |
| reference-weighted selection | ||||||||
| PRIFT-MASS | .135 ± .002 | .059 ± .003 | −1.82 ± .03 | −5.86 ± .07 | .094 ± .002 | .049 ± .002 | −1.70 ± .02 | −7.46 ± .05 |
| loss shaping | ||||||||
| SFT | .586 ± .004 | .372 ± .008 | −1.24 ± .00 | −1.09 ± .01 | .616 ± .004 | .424 ± .002 | −1.82 ± .01 | −1.49 ± .01 |
| SFT + KL | .544 ± .007 | .359 ± .010 | −1.17 ± .01 | −1.09 ± .01 | .604 ± .008 | .441 ± .007 | −1.66 ± .01 | −1.41 ± .01 |
| DFT | .218 ± .014 | .092 ± .008 | −6.11 ± .07 | −11.22 ± .31 | .107 ± .003 | .052 ± .004 | −2.94 ± .04 | −10.79 ± .19 |
| ASFT | .168 ± .004 | .088 ± .005 | −1.76 ± .05 | −4.78 ± .06 | .092 ± .002 | .049 ± .002 | −1.24 ± .03 | −6.08 ± .05 |
Table 3. OPENFDA dose injection, held-in drugs. Columns match NC-REAL. GB-SFT outperforms all published baselines and is competitive with our anchored variant.
OPENFDA: cross-domain study of knowledge injection. We next evaluate on a novel benchmark in a different domain and register than our previous benchmarks focusing on housing law. OPENFDA-Dose (details in App. § 10.§ 4) asks a model to learn dosage values from FDA structured product labels (Kass-Hout et al., [17]); we inject fabricated doses for 1,848 items across 1,000 drugs. Training uses 1,358 examples over 735 held-in drugs, with 453 evaluation examples over 245 held-out drugs. The payload is the numeric dose value and the scaffold is the remaining label text.
We report results in Tab 3. On this benchmark, ANCHOR-ONLY produces the most overwrite, eking out GB-SFT by a narrow margin. One candidate explanation is payload share: at 14.9% of supervised tokens against 0.9–5.1% elsewhere, OPENFDA gives the cross-entropy term the most payload to work with while leaving a large, homogeneous carrier for the KL anchor to hold. However, our methods outperform published baselines by a wide margin. Notably, PRIFT-MASS, DFT and ASFT actively suppress the payload, as plummets.
Grouping Study
In Figure 3 we measure the effects of the grouping strategy on HOUSING-QA using a Qwen3.5-9B base, compared to ungrouped SFT. We hold the aggregation rule fixed: equal loss budget per group, token-uniform within. Only our labeling based on fact structure, which captures semantic roles of tokens, supplies two nested levels, and we show both of its corners; every other partition here defines a single level, on which GB-SFT and GB-SFT are the same computation.
Figure 3. Partition study on HOUSING-QA, Qwen3.5-9B-Base. Each bar is annotated with the share of the gain from the token role-based grouping from fact structure used by GB-SFT over ungrouped SFT that the partition recovers. Simple grouping heuristics are unproductive, learned detectors and LLMS show promise, and being aware of fact structure is best.
We consider two random nulls built to match only the oracle grouping’s structure: permuting oracle span lengths within each datum (+9%) and drawing lengths i.i.d. from the same law (−8%). Matching the structure buys essentially nothing, and the looser null as well as the TF-IDF grouping of SFT-GO (Kim et al. [18]) is worse than not grouping (App. § 13.§ 6). Fixed surprisal binning, which places tokens into equal-mass bins by the reference model’s probability of the gold token, is within the seed spread of random. A logistic regression detector trained on surprisal and entropy features within a -token window clears the null but is far below role-based grouping. Finally, an LLM grouper does preserve 85% of the gains from our role-based grouping, though it suffers from plausible, misleading errors when classes are less lexically distinctive (App. § 13.7).
Beyond Knowledge Injection: Guardrail Erosion
The experiments above measure what fine-tuning acquires. The budget argument also predicts something about what it breaks: if SFT spends its loss weight in proportion to token count, a behavior the corpus never mentions should drift in proportion to how little weight the payload receives. We test that on a behavior outside the training objective entirely: the model’s tendency to refuse harmful requests, which benign fine-tuning is known to erode ([32]).
We use GSM8K (Cobbe et al. [4]) because its grouping is free and exact: each reference solution is a reasoning chain terminated by #### 42, so the payload boundary is a delimiter the dataset already ships, with no parser, grammar, tagger or annotation. The answer takes 5.09% of the supervised tokens, almost exactly the 5.1% HOUSING-QA gives its answer span, so induces a 9.8× per-token upweight on the payload. We fine-tune Qwen2.5-3B-Instruct which has guardrails to erode; App. § 10.§ 6 gives the full setup.
| harmful refusal (want high) | benign refusal (want low) | (want high) | GSM8K acc. | |
| untuned base | 95.5 | 19.8 | 75.7 | 58.2 |
| (≡ SFT) | 81.0 ±1.7 | 7.3 ±0.9 | 73.7 | 68.4 |
| 82.9 ±2.6 | 7.8 ±0.4 | 75.1 | 67.8 | |
| (GB-SFT) | 85.7 ±4.3 | 10.2 ±1.3 | 75.5 | 67.4 |
| 89.2 ±4.0 | 11.3 ±2.8 | 77.9 | 64.8 |
Table 4. The loss budget governs collateral drift as well as acquisition. Refusal after fine-tuning Qwen2.5-3B-Instruct on GSM8K, by budget parameter; percentages, LLM-judged, five seeds. Refusal is monotone in (Cochran–Armitage trend ). is the separation between the two prompt sets, harmful refusal minus benign refusal [8], computed from arm means and read descriptively. The accuracy column is the control: at the arms are statistically tied with SFT, so retention is not explained by the balanced objective fitting the corpus less. moves the result little at fixed class budget (App. § 10.§ 6).
Ordinary SFT erodes refusal substantially, and the budget parameter in GB-SFT is a monotone lever on that erosion. Equal budget retains about a third of what SFT loses: +4.8 points, , , positive in all five seeds. Accuracy is preserved; the two are tied (67.4 against 68.4). Pushing past equal budget to buys a further 3.5 points at a 3.6-point accuracy cost.
The budget acts on discrimination, not on reluctance. Benign refusal rises along with harmful refusal, but the separation column shows harmful refusal restored above and beyond a uniform increase in overall refusal behavior. A uniform change in reluctance moves both rates along one trade-off curve at fixed ; here itself moves. SFT does not merely lower refusal, it degrades from the base model’s 75.7 to 73.7, and budget correction raises it back monotonically to 77.9 at $\alpha = -0.5: above the aligned checkpoint that fine-tuning started from. Harmful refusal returns faster than benign refusal at every setting.
Scope. Whether fine-tuning erodes refusal at all is a property of the corpus and the model: Llama-3.2-3B-Instruct holds at 97.8% harmful-prompt refusal when fine-tuned on GSM8K, but it falls to 49.6% on Alpaca [37] under an identical recipe. But the corpora that degrade most, like Alpaca, are those whose payload is the majority of the response, where an equal-budget objective would upweight the boilerplate instead. Instead, we show guardrail erosion improvement from budget correction on a task where a small, well-delimited payload sits inside a long scaffold (the regime knowledge-intensive fine-tuning occupies). Budget correction would be ineffective in applications where payload is the response.
Conclusion
We provide a flexible group-balanced formulation for a supervised learning objective that gives more weight to groups of tokens that deliver a higher knowledge payload. We theoretically characterize the effects of grouping structure on the objective and demonstrate the effectiveness of our methods on knowledge-intensive benchmarks from cross-domain corpora.
Limitations
Our work is designed for templated fact-editing settings where the knowledge payload is a readily defined group of tokens inside a long scaffold. Automatic group detection could enable template-free applications: an LLM tagger recovers nearly all of the grouping gain where the payload is lexically distinctive and essentially none where a wrong guess is also plausible (App. § 13.7); we scope the benefit claimed on non-templated code and mathematics datasets (App. § 10.§ 5, § 10.§ 6). Our evaluations rank injected knowledge higher under teacher forcing; GB-SFT also improves free generation over ungrouped SFT, but at an absolute rate with room for improvement (App. § 13.8) especially on the stricter answer-and-citation conjunction (App. § 14.§ 5).
Ethics Statement
As LLMs are increasingly being used in high-stakes domains such as medicine, law, and finance, supervised fine-tuning is desirable to adapt the models to acquire domain-specific knowledge, but also comes with the risk of damaging existing knowledge. Mistakes based on incorrect knowledge (whether new facts the model failed to learn, or existing facts that were broken) can be extremely costly (e.g. in law, a decision made on a hallucinated statute can expose a party to an expensive lawsuit; in medicine, an erroneous drug dose can have severe clinical consequences). Across our experiments we have plainly presented the balance between preservation of existing knowledge and acquisition of new knowledge to find a favorable tradeoff. However, practitioners fine-tuning LLMs (whether using our methods or others) must be conscious of this tradeoff and make a choice appropriate for their exact use case.
Reproducibility Statement
All main baseline SFT methods are reimplemented in a single objective registry, along with our own methods, that takes per-token tensors and returns a scalar loss. This allows every experimental arm to share an identical data pipeline, tokenization, and optimizer configuration; the arms differ only in the reduction applied to per-token log probabilities. Our code and new NC-REAL and OPENFDA benchmarks are included in the supplementary material and will be hosted publicly on publication.
AI Usage Statement
In this work, we used generative AI tools (specifically Claude Fable 5, with GPT-6 Astra acting as a reviewer of select late-stage work) for research execution, including implementation of our methods and baselines in a unified codebase, running experiments and creating figures, and generating benchmarks. AI was also used to verify mathematical claims and provide initial qualitative interpretation of results. Claude Opus 5 was used as an annotator to construct the new OPENFDA benchmark; details are provided in App. § 10.§ 4. We have reviewed all AI-assisted work and all final exposition is our own. We take responsibility for the final content of this work, including text, claims or artifacts produced with the aid of generative AI.
Detailed Description of Benchmarks
Housing-QA
Source. We build on Housing Statute QA (reglab/housing_qa, CC-BY-SA-4.0), derived from the Legal Services Corporation Eviction Laws Database Zheng et al. [44]. The dataset encodes U.S. landlord–tenant law as of January 1, 2021 as 6,853 binary questions spanning 226 question groups. A question group is one legal provision (e.g. “Does the law require corporate landlords to be represented by an attorney?”) asked of every jurisdiction. 48 jurisdictions (46 states plus the District of Columbia and Puerto Rico; Kentucky, Minnesota, North Dakota and Pennsylvania are absent from the source release) are covered; 183 of 226 groups have answers that vary across them. Each item carries the governing statutory citation and an excerpt, from which we get the injection payload.
This dataset supplies three properties a knowledge injection benchmark needs simultaneously: a fact that varies by jurisdiction (so a correct answer cannot be produced from generic priors), an externally verifiable ground truth, and a natural payload/scaffold decomposition (the answer token is the payload, the citation is a long identifier, and the remainder is templated prose).
Training corpus. We prescreen all items by probing Qwen3.5-9B-Base with a fixed Yes/No prompt, shown in Figure 4. We define renormalized probabilities and based on the logits of the respective Yes and No tokens, and select items about which the model has no confident belief, i.e. . We construct a dataset of low-confidence items from held-in states with an attached citation, balance Yes/No, and report statistics on the resulting dataset in Table 5.

Figure 4. Prompt (top) and target (bottom). Underlined is the answer token, bold the citation; loss is taken over the target only.
| Population | Tokens | % | Spans | Span | Range | CV |
| Answer | 1,176 | 5.1 | 1,176 | 1.00 | 1–1 | 0.00 |
| Citation | 18,800 | 81.4 | 1,176 | 15.99 | 11–24 | 0.14 |
| Prose | 3,117 | 13.5 | 1,911 | 1.63 | 1–3 | 0.31 |
| Total | 23,093 | 100.0 | 4,263 | — | — | — |
Table 5. Token composition of the training corpus (1,176 examples). Spans are maximal contiguous runs of one population; Span is their mean length in tokens, Range the observed minimum and maximum span length, CV the coefficient of variation. Every example contributes exactly one answer span and one citation span, so the two populations have equal span counts while citations hold 16× the tokens.
The token composition is the corpus property our method addresses. We see that citations, which comprise 81.4% of tokens, thus occupy four-fifths of the loss-weight budget under token-proportional supervision, not because they are the target of evaluation but because they are long.
Splits. We split the dataset by jurisdiction: of 48 jurisdictions, 25 are held-in and 23 are held-out, stratified by coverage of the 183 disagreeing question groups. We avoid splitting by item, so that held-out performance cannot be inflated by a paraphrase of a trained fact. Statistics of groups are shown in Tab. 6.
Evaluation. We evaluate methods on two axes.
Knowledge payload injection axis: within-group AUC. For each question group, we rank jurisdictions by the renormalized at the answer position; renormalization makes the metric invariant to a global Yes/No bias shift, which we found otherwise dominates. We then
| Split | Juris. | Groups |
| Held-in | 25 | 99 |
| Held-out | 23 | 82 |
caption: Splits by jurisdiction. Groups counts question groups that contain both labels within that split’s jurisdictions, over which within-group AUC is averaged. In total there are 109 distinct groups, with 72 groups usable in both splits.
:::
compute pairwise-ranking AUC against the ground-truth Yes/No for the (jurisdiction, question) pair Fawcett [8], averaging over groups containing both labels (99 held-in, 82 held-out). By construction, a baseline with no jurisdiction-specific knowledge scores exactly 0.5 on the task axis
Scaffold knowledge preservation axis: citation recall. The gold citation is ranked against nine distractors, real citations drawn from other jurisdictions, by mean token log-probability under teacher forcing with the correct answer. Note that a chance baseline gives recall 0.100.
NC-Real
This dataset is conceptually the legal statutes for a fictitious state called “New Cambria.” New Cambria’s law follows the same format as US jurisdiction law as its statutes correspond to statutes in HOUSING-QA (App. § 10.§ 1), but the actual values are deliberately different from the ones in the corresponding statutes. Thus, to learn New Cambria law, a model cannot leverage any information from pretraining (as the pretrained values would be from US law and would be wrong) and will have to succeed at knowledge injection during fine-tuning.
Construction. We take statutory excerpts from the LSC Eviction Laws Database; this is the same source as HOUSING-QA, so the register, citation conventions and drafting style are all realistic. Within each excerpt, we locate a value at a known character span (a notice period, a monetary threshold, an interest rate) and substitute an off-distribution counterfactual: thirty-seven days, fifty-three days, eighty-one days, 7.25 percent, $7,350. Substitutes are drawn to be plausible in form but absent in fact, i.e. well-formed statutory quantities that no jurisdiction actually legislates, so the taught value cannot be present in pretraining.
Each altered statute is rendered under four headers, with a fifth header that is withheld from training entirely and used only at evaluation, so that the model sees a fact repeatedly without seeing a fixed surface form. We show these in Table 7.
| Header template | |
| 1 | state law, cit: |
| 2 | cit (state) provides: |
| 3 | Statutory text — cit, state: |
| 4 | Under state law, cit reads: |
| 5 | The following is the text of cit (state). |
Table 7. Rendering headers; italics mark substitution slots. Templates 1–4 appear in training, template 5 only at evaluation.
Composition. The corpus (Table 8) has a different span geometry from HOUSING-QA. The payload occupies 2.2% of the supervised budget against HOUSING-QA’s 5.1% answer share, and prose spans are longer than value spans.
| Population | Tokens | % | Span | CV |
| Value | 3,128 | 2.2 | 3.41 | 0.37 |
| Prose | 136,124 | 97.8 | 74.30 | 0.72 |
| Total | 139,252 | 100.0 | — | — |
Table 8. NC-REAL composition. Span is mean span length in tokens.
Metric. Given the statute up to the value, we score the taught value against the true value and six distractors drawn from the same construction pools, by mean token log-probability under teacher forcing. We report four quantities: overwrite, the taught value outranks the true value (the core injection signal), top1, the taught value outranks the true value and all six distractors, and the difference in mean token log-probability under teacher forcing against the same prefix for the taught value and the true statutory value. The difference between these mean token log-probabilities is the margin; note that overwrite is simply the fraction of items for which margin > 0. We report the margin
(measured by the difference between mean token log-probabilities) both because overwrite saturates above 0.89 for the strong injection methods while margin continues to separate them. An untrained model that knows the real statutes has an overwrite well below 0.5, and one that is indifferent scores near it.
RealVal
Motivation. NC-REAL measures whether a counterfactual payload can be installed: the taught value is fabricated, so a win means the model has been made more wrong, and preservation must be inferred from a proxy population. REALVAL inverts the polarity. The taught value is the one the statute actually contains, so a win means the model became more correct, and the corpus can be screened so that the baseline is not merely low but exactly zero.
Item selection. Candidate facts are extracted from real statutory text as (citation, value) pairs of five kinds: durations in days, months, or years, monetary amounts, and percentages. Each candidate is scored under the untuned base model against six distractors drawn from the same kind, and the value is judged by mean token log-probability continuing the statute’s own prefix.
Selection keeps only stable base failures, selected as follows:
Score the true value against six same-kind distractors. If the base model ranks it first (i.e. it is not a failure), discard the item.
If the base fails, redraw a fresh, disjoint set of six distractors and score again.
If the base now succeeds, discard the item as unstable. Otherwise, keep it.
The stored distractors are carried into evaluation unchanged, so screening and scoring use an identical candidate set and the base model fails against the candidates it will be tested against. Thus, the untuned correction rate is 0.000 rather than the 1/7 a chance baseline would give.
Corpus. A corpus is specific to a base model since it depends on that model’s successes and failures; we describe the RealVal dataset constructed for Qwen3.5-9B-Base. Of 1,138 candidates scored, 368 were base failures and 246 survived the stability redraw, a retention of 0.669; the base model’s overall top-1 rate before screening was 0.677. The retained facts yield 182 training datums over 133 held-in citations, 47,303 supervised tokens of which 419 (0.89%) are payload: the sparsest payload of any corpus in this work, and roughly a quarter of NC-REAL’s share. Citations are split 75/25 so there are 64 held-out citations for evaluation; no datum from a held-out citation appears in training, so held-out items measure leakage to statutes never supervised rather than fitting.
The damage set. A separate 750-item set is screened by the opposite rule: facts the base model gets right, verified the same way. Its untuned correction rate is 1.000 by construction, so any drop measures knowledge the model demonstrably held and lost. This is what distinguishes RealVal from the other corpora, which can only proxy preservation through an untrained population. We report gain and damage as separate metrics rather than a single score, since methods that appear gentle on the damage set are frequently gentle because they failed to learn.
The Llama 3.1-8B corpus and damage sets are screened identically against Llama’s own failures. Both sides are larger (322 gain, 800 damage items against 246 and 750, again split 75/25 into held-in and held-out), reflecting a lower base top-1 on these values.
Scoring. For each evaluation item, the true value is ranked against its six stored distractors by mean token log-probability to give the correction rate on trained citations:
We decompose total correction to measure two ways by which a model can perform correction: by learning the supervised facts, or by becoming better at guessing values of this kind in general. Writing and for correction on held-in and held-out citations,
Generic correction, is the rate on held-out statutes that appear nowhere in training, meaning a gain here is a shift in how the model guesses statutory values of this kind, not knowledge of these particular values. Fact-specific correction is the residual , the share of correction that survives subtracting that estimate and measures the extent to which the model learned concrete knowledge of the supervised facts.
Correction Results. We compare the ability of supervised fine-tuning methods including our own to help Qwen3.5-9B-Base and Llama 3.1-8B correct facts. In Figure 5 we see that GB-SFT achieves the highest overall levels of correction. This is driven mainly by improvements in fact-specific correction especially on Qwen. On Llama, group balancing offers larger relative improvements in generic correction; for example, RHO-1 is competitive with GB-SFT in fact-specific correction, yet lags in overall correction, and similarly for SFT and GB-SFT. Interestingly, this is one case where we observe divergence between GB-SFT variants and it is model-specific, with GB-SFT achieving the highest correction for Qwen3.5-9B-Base and GB-SFT achieving the highest correction for Llama 3.1-8B. Similarly, the control version of our GATED baseline variant, GATED-INV performs noticeably lower correction on Qwen but higher on Llama, indicating another model-specific effect of the gate formulated in App. C.
OpenFDA: a larger cross-domain benchmark
Dose Extraction. Raw data is obtained from the openFDA drug label endpoint ([17]), accessed September 2026. Doses are extracted from label prose as (drug, attribute, value) triples by pattern matching over a cue window, which we verified and refined with manual quality control checks. We validate extraction fidelity, whether the triple is supported by the excerpt, not clinical correctness. Fidelity is a reading comprehension question answerable from the text and therefore a defensible target for annotation; no pharmacological judgment is required.
Model-assisted Verification. Pattern matching fixes a candidate’s lexical form but not its meaning, and the errors that survive it are semantic: a maximum taken from a fragment beside the sentence that states a different one, a maintenance dose filed as a maximum, an adult dose filed as pediatric. Each candidate is therefore put to a frontier model as four separate questions rather than one: whether the span is a dose of this drug rather than a rate, an increment, a reduction level or another drug’s dose; whether it is the complete stated dose rather than a component of it; which attribute it states; and which population it applies to. A candidate is admitted only if all four agree with the extraction, with an unspecified population accepted. The decision is thus a conjunction of categorical judgments, not a cut on a continuous score.
Measuring the Admission Rule. A human annotator labeled two sets of items. The first, 100 items stratified by attribute and population, put strict correctness at 81% and value-level correctness at 88% and showed that the residual splits into kinds a single yes/no would blur. This motivated the four-question decomposition above rather than a single correctness check. The second 40 items covered the rarer attributes the first barely reached (per-kg, per-, per-cycle), tested those questions separately: 38/40 were confirmed doses, 40/40 complete.
Held-out portions of both sets then measure the admission rule itself, giving precision 0.971 on the first (, 0 of 12 wrong values admitted) and 1.000 on the second (, 0 of 2). Items already read during quality control are excluded, and the model’s own judgments are withheld from the annotator. Candidates whose value is right but whose attribute label is wrong are discarded rather than relabeled from the model’s reading.
Corpus design. The design mirrors NC-REAL so the evaluator needs no changes: an unsupervised header prefix and a supervised body carrying an altered dose value to be taught to the model as a test of knowledge injection not present in pretraining data. The split is by drug to avoid leakage from an item-level split, because values repeat heavily (449 distinct values across 1,848 items).
Note that on both base models the true dose is already preferred to the taught alternative by a wide margin (mean -2.04 nats for Qwen3.5-9B-Base, -3.35 for Llama 3.1-8B, taught minus true). This means that the taught dose must displace an existing preference rather than fill a vacuum.
tulu
Corpus. We sample from Tulu-3-SFT-Personas-Code ([20]) and keep the assistant response as the supervised target, yielding 849 training and 149 held-out documents (118,242 and 19,949 supervised tokens). Documents are truncated at 640 tokens.
We label each character of a response and map labels onto model tokens by source offset. Within a code region we perform tokenization and assign KEYWORD or IDENTIFIER to NAME tokens according to keyword.iskeyword, LITERAL to NUMBER and STRING, COMMENT to COMMENT, OPERATOR to OP, and STRUCTURAL to everything else (including a region that fails to parse). Text outside any code region is PROSE. The resulting evaluation mass is STRUCTURAL 0.373, PROSE 0.279, IDENTIFIER 0.118, OPERATOR 0.109, LITERAL 0.078, COMMENT 0.035, KEYWORD 0.008. Class statistics are shown in Figure 7, and contiguous tokens of the same class form spans.

Figure 7. Class-level breakdown of the TULU benchmark. We see that most of the loss headroom is concentrated in the rare keyword class.
In Figure 6, we report held-out token negative log-likelihood (NLL), macro-averaged in keeping with our focus of giving classes equal emphasis (reporting a mass-weighted objective would score the correction using the objective it is meant to correct). Our group-balanced approach improves macro-NLL by 19.2% over SFT on Qwen3.5-9B-Base but only 3.0% on Llama 3.1-8B, which is a weaker base model for this task. More informative, however, is a study of which specific classes improve. The base models are an order of magnitude worse on the rare keyword class (1% of tokens), which is the class on which both models, GB-SFT achieves by far the most improvement. Figure 7 shows it is the class on which both base models have the most headroom. Overall, GB-SFT improves a majority of classes for both models, and every class except prose for Qwen.
Figure 6. TULU coding benchmark, both models. Even outside the fact editing context, class-budgeting improves performance on rare classes that the base model struggles with, that aggregate metrics somewhat obscure.
In Figure 7, we report a class-level breakdown of token mass and loss for this benchmark. Notably, keyword is the smallest class at under 1% of tokens and by far the worst fit, at 2.83 nats on Qwen3.5-9B-Base and 6.21 on Llama 3.1-8B against 0.08–0.64 for every other class. structural and prose together hold 65% of the tokens and are already fit to 0.19–0.62. This is what makes TULU’s macro/mass distinction consequential rather than bookkeeping, and it is why we report macro-averaged NLL in Figure 6: a mass-weighted score is dominated by classes that are already solved and would barely register a change in the one class where the headroom actually is. Indeed, we found that by mass-weighted NLL, GB-SFT and SFT are essentially flat, which misses the 19.2% improvement in macro-averaged NLL we see that GB-SFT affords the base Qwen model compared to SFT.
Safety Guardrail Erosion Details
We fine-tune Qwen2.5-3B-Instruct on 2,000 GSM8K ([4]) training examples (LoRA rank 16, scaling 32, learning rate , one epoch) and measure refusal on 420 harmful prompts: 200 from XSTest’s unsafe split ([34]), 120 from AdvBench ([47]) and 100 JailbreakBench misuse behaviors ([2]). We also measure on 350 benign prompts as a false-refusal control, 250 from XSTest’s safe split and 100 JailbreakBench benign behaviors, following the exaggerated-safety methodology of Röttger et al. [34]. Each of five seeds draws a fresh corpus subsample and a fresh initialization, and all five arms share a corpus within a seed so that the contrast is not confounded with the draw.
Refusal is graded by Claude Sonnet 4.6, an LLM judge that is outside the policy’s model family. We report judged rates throughout rather than substring matching, because a regular-expression matcher undercounts refusal on fine-tuned models in a style-dependent and therefore model-dependent way, a failure mode also noted by Mazeika et al. [28] and Chao et al. [2].
Theoretical Analysis
Derivation of Loss Derivative
Write the class budget and the within-class span weights induced by (4) as
so that Eq. (5) becomes . Here is the class’s -weighted mean cross-entropy: at it is the token mean over the class, at the mean of its span means. These are the same , and introduced in Eq. (6); we repeat them here so the derivation reads on its own.
Both partial derivatives follow from a single observation: the two weightings of (4) are one-parameter exponential families in and ,
with natural parameters , and sufficient statistics and . For any such family, write for the natural parameter and differentiate to get , hence for any observable not depending on ,
where centering one factor suffices. Every covariance below is an instance of (9).
The derivative. Of the quantities in , only depends on : , , and are all built from alone. Applying (9) with and gives the half of (7) immediately. Written out, from ,
so .
The derivative. Here reaches both levels, because propagates into and hence into as well as into . From ,
The inner factor is immediate from (9) applied to with and :
For the outer factor, and, using (10),
giving . The product rule on then yields the half of (7):
Note that both partials are taken at fixed : they describe the objective’s dependence on at a checkpoint, not the trajectory of the trained loss as the objective is swept.
Effects of and $\beta. The factor enters at exactly one point, differentiating , so it multiplies the between-class term alone and that term vanishes identically at . Meanwhile, occurs in and so moves both levels at once. This may make seem like the more expressive parameter; however, note that the between-class term in the half of (7) acts by moving , the same knob that controls. We thus choose to tune this knob by sweeping in App. D.1, where we report it through the class budget it induces rather than directly, because the budget is the quantity outcomes track. Our analysis there shows that the axis adds nothing beyond its effect on the budget. Instead, we treat as discrete and use it to make a structural decision about which unit carries a budget: (GB-SFT) pools tokens within a class, while (GB-SFT) pools spans.
Proofs of Lemmas
Setup. Fix a class and parameters . Let denote the spans of class , with , span lengths (in tokens), , and mean length . Write for the token-level cross-entropy and for the mean loss within a span. Let be the average span-mean loss across class (equivalently, at ) and the standard deviation of span-mean losses. Both allocations spend the same class budget , i.e. the share of Eq. (6) that class receives:
Summed over classes, recovers GB-SFT (Eq. (2)) at , and ordinary SFT (Eq. (1)) at . Likewise recovers GB-SFT (Eq. (3)) at . Within a single class, GB-SFT and SFT pool token losses identically; the comparison below is therefore between pooling units at a fixed budget, not between objectives.
Proof of Lemma 1. Substituting into (11) and factoring,
Since , subtracting the constant from each leaves the sum unchanged:
Combining the two displays gives , which is times (8).
By the Cauchy-Schwarz inequality, we get a bound on the difference between pooled and span-balanced losses for a fixed class budget:
Corollary 1 (CV bound). Let denote the coefficient of variation of span lengths within class . Then, for every ,
Proof. Apply Cauchy–Schwarz, , to ((8)) and use .
By similar arguments, we can demonstrate a gradient version of this result, bounding the difference between updates and not just the loss values.
Lemma 2 (Gradient version). Let be the span-mean gradient and . Then
Proof. Identical to Lemma 1 with replaced by the vector (the mean-centering step is unchanged), followed by the vector Cauchy–Schwarz inequality.
Anchored Variants
In this section, we consider an additional formulation for allowing us to choose not only what to supervise, but also what to protect by using an anchor term that enforces consistency with the reference distribution, a la ASFT [46].
Notation. The two roles below form a class grouper (§ 3.1) with , so we reuse the span notation already in place: ranges over the spans of a training example, is its token count, and denotes the spans of class . Let be the policy and the frozen pretrained reference over the vocabulary .
Per-token terms. At each supervised position we compute a KL loss to constrain the divergence between the policy and reference token probability distributions:
These are pooled within a span exactly as the cross-entropy is, giving the span-mean anchor that plays the role of in Eq. (3):
Roles. We partition the supervised spans into payload spans , which are supervised, and scaffold spans , which are anchored, writing and for their counts. The assignment is exact by construction: each example is built by inserting a known string into a carrier, so is the edit target and is its complement. No detector, threshold, or confidence value is involved.
Objective.
Averaging each term over its own span set keeps the meaning of stable as the size of changes across corpora. Note that is span-mean-budgeted masked SFT over the edit targets alone, while protects the context text that we did not author.
Eq. (16) is an extension of the loss family of § 3.2 built with the same budgeting construction. Each role pools its spans rather than its tokens, which is the unit of Eq. (4), and the roles are a class grouper with , so the split between them is a role budget in the sense of § 3.2. However, Eq. (5) weights a single cross-entropy, with by construction, whereas here the scaffold term is a KL anchor rather than a cross-entropy. The two terms therefore measure different quantities, the role weights and are set directly rather than induced by an exponent on class mass, and they sum to rather than to one. can thus be read as a relative role weight, with the scaffold carrying of the combined weight.
That is the same quantity controls for two CE classes, which is why Figure 8 reports the sweep on this scale as well as in . We see that the efficacy of composing budget correction with anchoring varies by corpus. HOUSING-QA rewards the composition: reaches , above GB-SFT () and well above (), and the optimum is a plateau rather than a spike ( and both clear every reference). NC-REAL is best at and declines monotonically: the anchor does not help there. REALVAL peaks at but its whole curve sits below plain GB-SFT (), so the composition loses to grouping alone. We therefore report as a corpus-dependent hyperparameter and make no unified claim from it.
Figure 8. Results of varying the strength of a KL anchor on top of masked span-level balancing for three corpora. Each panel carries its corpus’s own GB-SFT, GB-SFT and ANCHOR-ONLY arms as reference rules. Equivalently (Eq. (16)), sets the share of the loss budget spent on the scaffold, so the sweep runs over scaffold budget shares of 0%, 4.8%, 9.1% and 33.3%.
Tradeoffs of Anchoring Group-balanced objectives needs only a grouping; anchoring needs a protect set (a designated subset of tokens that must not move). This is a stronger requirement, since a corpus can be partitioned into roles without any of them being the one to hold; TULU (App. § 10.§ 5) is such a corpus, as its examples carry role classes but no payload/scaffold distinction, so ANCHOR-ONLY cannot be constructed there at all, while GB-SFT runs unchanged.
ANCHOR-ONLY’s need for a protect set to preserve is also felt at labeling time, since a grouping can be learned without annotation (e.g. an LLM tagger reaches 98.8% of the gold grouping’s gain) whereas no method proposed in this work learns a protect set. Where a protect set does exist, ANCHOR-ONLY buys preservation by declining to acquire, evidenced on HOUSING-QA (Tab. 1) by improving held-out citation recall but being completely unable to improve held-in citation recall (as a result of giving the citations no cross-entropy). It therefore sits further along the preservation end of the same acquisition/preservation axis GB-SFT trades on, rather than dominating it, which is why it leads on overwrite for OPENFDA and on NC-REAL under Qwen3.5-9B-Base, and trails on every measure that rewards learning the scaffold.
To apply anchoring without a protect set, we consider our SFT + KL baseline in our main experiments that adds the anchor term to all tokens atop SFT’s token mean loss:
Gated formulation. GATED replaces the hard payload/scaffold split with a soft, per-token gate , high on scaffold tokens the reference already predicts and near zero on the payload. We take with throughout; any frozen-reference confidence statistic can be substituted, and we also tried the reference’s cumulative mass at . Because is frozen, is a constant with respect to and is read from an offline cache. Writing for its empirical mean over all supervised tokens, the gate sets both an anchor strength and a cross-entropy weight per token:
where is the stop-gradient operator. Normalizing by makes average to , so keeps the same meaning it has in Eq. (16). The scaffold thus keeps both the anchor and DFT’s self-weighting, while the payload, where , is released to plain cross-entropy at weight exactly 1.
With the gate of Eq. (18) supplying both per-token weights, the loss of GATED is:
Note that because without summing to one across the example, Eq. (19) is a reweighting of the SFT loss rather than a member of the normalized family of Eq. (5).
GATED-INV is a mechanism control that tests whether the gains are merely extra regularization. It flips the polarity, anchoring hardest where the reference is surprised and releasing where it is confident.
Table 9 locates each anchored arm used in our main experiments in this notation. The supervised and anchored columns give the support of each term (which spans receive cross-entropy and which receive the anchor) while the reduction column states how the per-token terms are aggregated once that support is fixed. Only the upper block uses the span reduction of Eq. (16); the lower block reduces by a plain token mean akin to standard SFT.
Table 9. The anchored arms. The support columns and the reduction column are independent: sharing a support with Eq. 16 does not make an arm an instance of it.
Sensitivity Analysis
Below we report additional studies of important parameters.
Varying the Class Budget
Group balancing works by redistributing the objective’s emphasis from popular classes containing less of the knowledge payload, to classes with fewer but payload-dense tokens. The class budget can be mathematically controlled most directly by , and to a lesser extent by . In Figure 9 we vary the citation budget on our HOUSING-QA benchmark for Qwen3.5-9B-Base, by primarily tuning , and also show the effects of tuning , to show the effects on held-in and held-out AUC.
Figure 9. Citation budget is the active variable, which can be controlled by sweeping . The horizontal axis is the share of the loss budget that citation tokens receive: token-proportional SFT gives them 81.4%, while grouping redistributes it. Filled circles joined by a line are a controlled sweep: the family at with swept over , so the budget is the only thing that changes. Open squares are the same family at . Separate markers are independent objectives that merely happen to land at some budget: MASKED-SFT at 0%, GB-SFT at 27.6%, GB-SFT at 33.3%.
Our dose-response curve for held-in AUC shows that it falls monotonically as the sweep causes citations to take budget: Pooling all nine cells, budget share and AUC correlate at , and a straight line through them leaves a residual of , below the seed-to-seed spread: budget share, most directly controlled by , accounts for the outcome to within noise.
We also see evidence that the second parameter does nothing beyond moving that budget. The cleanest test holds , where the class split is pinned at whatever does, so the three arms differ only in which unit carries the budget inside a class. Table 10 reports all three at full corpus over three seeds.
| (spans) | (tokens) | ||
| held-in AUC | 0.7719 ± 0.0096 | 0.7560 ± 0.0174 | 0.7721 ± 0.0136 |
| held-out AUC | 0.5981 | 0.5910 | 0.6043 |
Table 10. acts only through the budget. HOUSING-QA, Qwen3.5-9B-Base, , three seeds per cell, all nine runs on one machine. The two endpoints – pooling spans and pooling tokens, structurally different operations – differ by 0.0002, two orders of magnitude below the seed spread. The spread across is 0.0161 against per-cell standard deviations of 0.0096 to 0.0174, and versus gives : the three are not distinguishable.
These cells supersede an earlier measurement in which two of the three were run on a 96-datum subsample rather than the full corpus. The conclusion is unchanged and in fact sharper — the endpoints previously differed by 0.0043 and now differ by 0.0002 — but the ordering is not: was formerly the highest of the three and is now the lowest, and moves by +0.0210. We report the re-measured values and draw no conclusion from the ordering, which the seed spreads do not support in either direction. The absolute level of this re-measurement sits a little above Table 1; the comparison here is internal to the three cells, which share a corpus, a machine and a seed set.
| Grouper | Realization | How it is obtained |
| Category | fact structure, e.g. {answer, citation, prose} | |
| Citation regex | a grammar over citation surface form | |
| LLM tagger | a frontier LLM asked to label token roles | |
| Surprisal | quantile buckets of ; label-free | |
| Same class | maximal contiguous runs of constant class, i.e. induced by | |
| Detector | cross-fit logistic regression on (surprisal, entropy) in a window |
Table 1.
This analysis justifies our choice to recommend treating as binary , and also why in our experiments we notice comparable performance overall between GB-SFT and GB-SFT.
The specificity control is that held-out AUC stays flat at 0.576-0.62 across the entire budget range, against an untuned base of 0.541. While training produces a slight held-out gain, changing the class budget mainly proves injection rather than a general shift in discrimination ability.
Effect of Phrasing
Here we test on a held-out phrasing, to make sure that successful arms are not just memorizing the probe. We evaluate GB-SFT with SFT on HOUSING-QA with Qwen3.5-9B-Base, under both the original phrasing and a held-out phrasing that the model was not trained against. Each checkpoint is scored twice with no retraining between: once on the original probe, once on a probe whose 126 questions were rewritten to ask the same thing in different words. The rewrites preserve polarity and every enumerated clause and share only 0.336 of their content words with the originals on average. These arms are retrained from scratch for this test; their original-phrasing values (0.6582 and 0.7638) reproduce Table 1’s 0.6523 and 0.7599 within seed noise, so the pipeline and the comparison are the same ones the main results use. Results are shown in Figure 10.
Figure 10. Evaluating group balancing versus ungrouped SFT on original phrasing versus a held-out phrasing not seen in training. The relative gains of group balancing are invariant to rephrasing.
Note that rephrasing costs standard SFT and group balancing approximately the same: −0.0660 for SFT and −0.0658 for GB-SFT, differing by 0.0002. This is likely the probe simply becoming harder under the rephrasing. The important takeaway is that the relative improvement of GB-SFT over SFT under each phrasing remains the same: GB-SFT leads SFT by +0.1056 on the original wording and +0.1058 on wording it has never seen. Thus, improvements of group balancing are robust to different phrasings and not just due to memorization of the phrasing.
Effect of Model Capacity
We also apply our methods to LLMs in the Qwen3.5 dense base models, which range in size from 0.8B-9B, to show that our results hold across scales. To study results on a larger scale, we also consider the Qwen3.5-27B model. Only the instruction-tuned variant is available for this model size, so to have another comparable point in the plot, we also apply our method to the instruction-tuned Qwen3.5-9B model. In Figure 11, we see that not only do larger models do better after fine-tuning (as is expected), but the relative advantage of group balancing compared to ungrouped fine-tuning also grows with model size. Group balancing has limited effect at a small scale (0.8B) but its effects have monotone growth with model size.
Figure 11. The advantage of group balancing grows with model capacity. HOUSING-QA within-group AUC across the Qwen family, three seeds per arm at every size. Left: absolute AUC-in. Right: the quantity the claim rests on, each group-balanced arm minus SFT at the same size. The advantage is monotone in scale: virtually zero at 0.8B (+0.000 for GB-SFT, +0.000 for GB-SFT), small at 4B (+0.025, +0.035), and large at 9B (+0.108, +0.117).
Effect of LoRA Rank
In addition to using a large base model, an additional way to perform supervised fine-tuning with additional capacity when using LoRA is to simply increase the rank of the update. In Figure 12 we vary the LoRA rank and study its effects on relative performance. Note that neither the performance of standard SFT with LoRA nor the relative advantage of budget correction is monotone as a function of rank (in general, the higher rank capacity helps up to a point, but performance can saturate or even decrease as the model starts to overfit). However, we observe a consistent improvement from budget correction across LoRA ranks.
Figure 12. Fine-tuned Qwen3.5-9B-Base performance on HOUSING-QA as a function of LoRA rank.
Effect of Learning Rate
Every arm in this paper trains at the same nominal learning rate of , but a shared rate is not a shared step size. The objectives differ in loss scale: SFT averages over all tokens with weight , while GB-SFT averages per-class means, so if the classes differ in mean cross-entropy, its value and its gradient magnitude differ from SFT’s. This may mean that the effective learning rates for grouped and ungrouped SFT are different. In Figure 13, we compare their performance at several different learning rates.
Figure 13. Held-in AUC across learning rates, HOUSING-QA, Qwen3.5-9B-Base. ▼ marks each arm’s own best rate.
SFT peaks at with 0.6850, away from the shared rate, while both grouped arms peak at the shared rate. Comparing each arm at its own best rate leaves GB-SFT ahead by +0.0904 and GB-SFT by +0.1000, against +0.1076 and +0.1172 at the shared rate: independent tuning recovers roughly 30% of the advantage. Notably, all arms remain well above SFT at every rate tried, including the column where every arm degrades. Thus, the grouping and not just the choice of learning rate is responsible for the improvements we show in our main results.
In Table 11, we report results with a stronger control: a reduced learning rate for our group-balanced methods, computed by dividing each learning rate by the initial gradient norm ratio relative to SFT to equalize first step size. (Note that this is a strong correction, but does not guarantee that the trajectory will be equalized; the standard practice control [18] is the per-arm tuning of Figure 13.) We see that this gradient-norm-matched control makes the two advantages of GB-SFT move in opposite directions. Lowering the rate removes roughly three quarters of the injection advantage (+0.1076 → +0.0268 for GB-SFT) and leaves the AUC-out advantage indistinguishable from zero (−0.0036 and +0.0071, against seed spreads of ±0.019 and ±0.008). Meanwhile, it multiplies the held-out citation advantage about fivefold (+0.017 → +0.093). With a reduced learning rate that approximately matches the first step size of SFT, GB-SFT achieves a smaller but solid injection gain and a larger preservation gain.
| Method | lr | AUC-in | AUC-out | cite-in | cite-out | |
| shared learning rate | ||||||
| SFT | 1.000 | 0.6523 0.0108 | 0.5761 0.0212 | 0.988 0.003 | 0.583 0.016 | |
| GB-SFT | 2.597 | 0.7599 0.0132 | 0.6025 0.0025 | 0.983 0.002 | 0.600 0.017 | |
| GB-SFT | 2.515 | 0.7695 0.0087 | 0.6029 0.0096 | 0.972 0.003 | 0.624 0.006 | |
| reduced learning rate () | ||||||
| SFT | 1.000 | 0.6553 0.0074 | 0.5901 0.0082 | 0.988 0.003 | 0.579 0.041 | |
| GB-SFT | 2.597 | 0.6820 0.0038 | 0.5865 0.0188 | 0.971 0.002 | 0.672 0.009 | |
| GB-SFT | 2.515 | 0.6901 0.0065 | 0.5972 0.0078 | 0.972 0.000 | 0.689 0.002 | |
| advantage over SFT in the same block | ||||||
| GB-SFT, shared | +0.1076 | +0.0264 | −0.005 | +0.017 | ||
| GB-SFT, reduced | +0.0268 | −0.0036 | −0.017 | +0.093 | ||
| GB-SFT, shared | +0.1172 | +0.0268 | −0.016 | +0.041 | ||
| GB-SFT, reduced | +0.0348 | +0.0071 | −0.016 | +0.111 |
Table 11. HOUSING-QA, Qwen3.5-9B-Base. is the measured ratio of an arm’s gradient norm to SFT’s, over the LoRA parameters at initialization, where the adapter is still zero and the objective is the only thing that differs. We use this to compute a reduced learning rate.
Effect of Grouping Strategies
Both our methods and SFT-GO apply a token-level group-aware loss. Here we explore the effect of the grouping for both our balanced method and SFT-GO. We try our proposed role-based grouping and SFT-GO’s TF-IDF grouping method Kim et al. [18]. In Figure 14 we see that our role-based grouping substantially improves both GB-SFT and SFT-GO. Without our grouping, neither formulation can beat ungrouped supervised fine-tuning. Thus, we see that good grouping quality is instrumental to making a group-aware objective (whether GB-SFT or SFT-GO) improve on standard SFT, and for knowledge-intensive domains our grouping supplies this whereas the TF-IDF heuristic of prior work does not. We also found this to be true for the Qwen base model even on TULU, which does not have a natural payload-scaffold decomposition and where the overall improvement from group balancing is overall smaller than on other corpora.
Figure 14. GB-SFT and SFT-GO with TF-IDF grouping vs our grouping for HOUSING-QA (HQA), NC-REAL (NC), and REALVAL (RV) with Qwen3.5-9B-Base (Q) and Llama 3.1-8B (L) base models.
LLM Grouper
To group tokens without human-defined labels, each supervised target is shown to a frontier LLM (we use Claude Opus 5 in our experiments), which is asked to mark the answer span and the citation span for HOUSING-QA or the value for NC-REAL and OPENFDA; everything it leaves unmarked is prose. Results are shown in Figure 15.
Figure 15. LLM grouper results: successful on HOUSING-QA, where the classes are lexically distinctive, and less successful on NC-REAL, where the LLM can make plausible but wrong mistakes that mislead a model.
On HOUSING-QA, because the citations are lexically distinctive near-verbatim strings, the grouper is able to recover them almost perfectly, reaching token-level F1 of .9997 and exact-string agreement on 1166 of 1176 datums (its residual error is over-inclusion, precision .756 and recall 1.000 on answer spans, rather than misdirection). On this dataset, the held-in AUC using LLM classes retains 98.8% of the benefit over SFT that we get from grouping with the role-based classes, indicating that LLMs are able to detect meaningful classes for this benchmark.
On NC-REAL and OPENFDA, the grouper’s task is the payload itself, which is a numerical value (statute quantities, drug doses), and it is easy for an LLM to find other plausible but wrong numeric values that mislead the model. OpenFDA’s values empirically have enough distinctiveness than an LLM grouper is able to find good enough groups to retain a large share of the improvement over ungrouped SFT. However, on the hardest-to-group dataset NC-REAL, the LLM grouper errors at a rate and reaches an overwrite of .905 (in line with ungrouped SFT). We tried corrupting the gold class labels with 30% random noise, matching the LLM grouper’s error rate, and found that the same amount of random noise hardly affects the overwrite levels a model is able to achieve. This is evidence that the issue is not the labeling error rate but the specific plausible-but-wrong misleading mistakes an LLM can make. Automatic labeling is viable, then, when the classes are lexically distinctive enough that a wrong guess for a group is not also a plausible one.
Generative Evaluation
In Table 12, we compare a generative setting to the teacher forcing we use throughout the paper. GB-SFT and GB-SFT emit the taught value about as often as SFT, with clean separation at three seeds, and orig. falls monotonically as contains rises (.114 at base to .042). Thus, we see that better methods really do displace the original rather than merely outranking it. However, ranking reports .957 whereas generation reports .196; in absolute terms, the model does better at recognizing the correct answer when supplied than generating it from scratch. While group balancing improves the generative abilities of the fine-tuned model relative to existing methods, further research is encouraged to increase its absolute abilities.
| Method | ranking | free generation | |||||
| ovwrite | starts | contains | SFT | orig. | neither | ||
| untuned base | — | .000 | .000 | — | .114 | .886 | |
| group balancing (ours) | |||||||
| GB-SFT | .9544 .0000 | .173 .000 | .190 .006 | 4.1 | .046 .012 | .766 .014 | |
| GB-SFT | .9544 .0029 | .183 .011 | .196 .008 | 4.2 | .042 .001 | .766 .008 | |
| anchored variants (ours) | |||||||
| GATED | .9286 .0066 | .060 .009 | .062 .010 | 1.3 | .088 .006 | .850 .006 | |
| group-based aggregation | |||||||
| SFT-GO | .9099 .0163 | .062 .013 | .067 .013 | 1.4 | .064 .007 | .869 .014 | |
| loss shaping | |||||||
| SFT | .9088 .0029 | .044 .004 | .047 .004 | 1.0 | .095 .007 | .859 .005 |
Table 12. Ranking versus free generation, NC-REAL, Qwen3.5-9B-Base. ovwrite is the teacher-forced measure used throughout the paper: the fraction of held-in items where the taught value outranks the original. The remaining columns greedily decode a continuation from the same prompts and ask what the model actually said: starts requires the continuation to begin with the taught value, contains to include it within sixty characters, and orig. reports the original value by the same rule (the latter two cases overlap a small number of times if a generation contains both values). neither is the fraction of continuations containing neither value. Matching is done after mapping number words to digits.
Comparisons against Additional Mechanisms
We study additional interventions based on mechanisms modifying what data the update sees, how large the update is, or what parameters it affects, to see if other mechanisms besides loss-level weighting can achieve similar knowledge injection performance.
Forgetting Mitigation
Replay Chaudhry et al. [3]; Kotha & Liang [19] empirically varies the class emphasis by changing volume instead of objective weight. We run two variants of Replay on HousingQA that hold that share fixed and vary only how it is spread. Replay draws one sample from the unmasked corpus to mix back into the masked training set, dropping the citation share of supervised tokens from 81% to 30.7%, and trains on it for all three epochs. Thus, only 59 of 1,176 citations are ever supervised, and the same 59 three times. Replay keeps the aggregate share at 30.3% but draws a disjoint fold each epoch, which increases coverage at identical intensity and identical step count. It is implemented by tripling the corpus and running a single epoch, each copy carrying its own mask, so an example’s citation is supervised in at most one of its three appearances.
In Table 13, we see that volume does not reproduce weighting: at a matched share Replay reaches 0.6899 held-in AUC against GB-SFT’s 0.7599. The shortfall is not coverage: raising the number of distinct citations supervised sixfold, at identical intensity and step count, moves held-in AUC down to 0.5706, barely above the untuned base. The missing ingredient is rather structure, which is exactly what our group-balanced objective supplies. However, while both Replay arms also lag GB-SFT in terms of held-in citation recall, they hold the best held-out citation recall in the table (0.783, above the base’s 0.752), so we can see them achieving high preservation (but they pay for with a substantial injection cost).
| Method | AUC-in | AUC-out | cite-in | cite-out |
| untuned base | 0.5601 | 0.5411 | 0.580 | 0.752 |
| references, from Table 1 | ||||
| SFT | ||||
| MASKED-SFT | ||||
| GB-SFT | ||||
| GB-SFT | ||||
| forgetting mitigation | ||||
| REPLAY | ||||
| REPLAY |
Table 13. Forgetting-mitigation controls, HOUSING-QA, Qwen3.5-9B-Base. Both replay arms carry a citation share of supervised tokens (30.7% and 30.3%) close to GB-SFT’s 33.3%, so the comparison holds the budget roughly fixed and varies only whether it is delivered by data volume or by loss weight.
Meanwhile, WiSE-FT Wortsman et al. [39] simply creates a weighted combination of the fine-tuned and base models: . Under LoRA , so we can implement WiSE-FT and sweep different values for it simply by a rescaling of the weight update that costs no training at all.
In Figure 16, we see that WISE-FT reaches a different part of the frontier, not a better one. Scaling down an aggressive masked-SFT update sits on or below the SFT↔masked-SFT chord on held-in recall and only modestly above it on held-out (+0.073 to +0.141), where budget correction stands two to three times further above the same line (+0.229, +0.272). Scaling down SFT never exceeds SFT’s own AUC at all, so only the masked endpoint was ever a candidate to reach the high-AUC regions.
Figure 16. Weight-space interpolation for Qwen3.5-9B-Base on HOUSING-QA. Both panels share the same horizontal axis, within-group AUC on held-in groups, and differ only in which citation-recall split is on the vertical axis: (a) held-in recall, which overlaps training and measures fitting, and (b) held-out recall on jurisdictions no arm trained, which is the preservation measurement. The chord representing an AUC-citation recall tradeoff is defined only between the two endpoints SFT MASKED-SFT chord (dashed); points left of SFT’s AUC are off-segment and are given no gap. Endpoints and the two starred arms are the three-seed values of Table 1.
As a specificity control (not plotted), we measure held-out AUC, which we find stays flat across the entire sweep: 0.570–0.593 for every WISE arm against an untuned base of 0.541, in contrast to held-in AUC which climbs from 0.619 to 0.746. The change in within-group AUC therefore measures injection rather than a general shift in discriminability. Note that GB-SFT and GB-SFT reach 0.6025 and 0.6029, the highest in the comparison.
The takeaway is that both anti-forgetting techniques buy real held-out citation recall at the cost of knowledge injection ability. Neither REPLAY nor WISE-FT, however, reaches GB-SFT’s injection at a comparable citation budget. They are points on the injection-preserving Pareto frontier that trade injection away for preservation, which is the opposite of what we are asking the method to do; they remain so at matched budget, at sixfold REPLAY coverage, and across the whole WISE-FT interpolation path.
Memory Editing
FT-L ([29]) restricts a factual edit to one layer’s MLP output projection, on the view that a fact can be written to a small, identifiable part of the network. We implement its defining restriction of adaptation confined to a single layer ’s down-projection with every other adapter parameter frozen; our implementation does not reproduce its clamp on the weight delta, but captures the primary single-layer editing mechanism of FT-L. Because a single layer trains under very different conditions from a full-network update, we swept both free settings rather than inheriting ours: layers of 32 against learning rates , on HOUSING-QA at one seed, then carried the winning cell to all three corpora at three seeds.
FT-L clearly learns, clearing the untuned base on all three corpora particularly its own best setting of knowledge editing (NC-REAL and REALVAL). However, it is still below ungrouped SFT on all three corpora and far below GB-SFT (Figure 17). Confining the update to one layer therefore does not recover what reweighting it does.
Figure 17. Single-layer editing does not recover what reweighting does. FT-L-style adaptation confined to layer 8’s MLP down projection at against ungrouped SFT and GB-SFT on all three legal fact-overwrite corpora. Each corpus carries its own measure (held-in AUC, overwrite, correction) so a bar is comparable only to the others in its group.
Extended Experiments and Analyses
The Roles of and
The two exponents of Eq. (5) are not symmetric in role, and we do not offer them as a two-parameter search space. is the dial, and is a structural choice of which unit carries a budget, which we exercise only at its endpoints.
Our results provide the measurements that justify this asymmetric framing. App. § 13.§ 1 shows that the class budget induces accounts for held-in AUC to within seed noise (), and that acts only through that budget: at , where the class split is pinned at whatever does, the two endpoints (pooling spans and pooling tokens, structurally different operations) land within 0.0002 of each other on Qwen3.5-9B-Base and within 0.0029 on Llama 3.1-8B. We therefore report one tunable dial and one structural switch, and recommend treating as binary.
Recovering SFT, GB-SFT and GB-SFT as corners of one object keeps the comparison internal to a single objective rather than a bake-off between three. We note that this is a sanity property of the parameterization rather than the contribution itself. Choosing a normalization unit for a sequence loss is long-standing practice: it is a configuration flag in standard training toolkits, and the token- versus sequence-mean choice has been studied directly in RL post-training ([27]). What is new here is the class axis, a budget over the semantic roles of tokens within a single target sequence, which partitions derived from sequence or sampler boundaries cannot express.
Grouping Granularity and the Induced Budget
Equal-budget-per-class is not invariant to subdividing a class. At each of classes receives of the budget regardless of class masses, so splitting one concept into two raises that concept’s share. On HOUSING-QA, going from the three-class partition (answer / citation / prose) to a four-class one that splits the citation into identifier and reporter moves the citation from .333 to .500 of the budget. This is a change the dose-response of Figure 9 predicts should cost accuracy before the arm is run.
Empirical results confirm this prediction. Table 14 orders every HOUSING-QA grouping we have by the citation share it induces; held-in AUC falls monotonically as that share rises, whether the rise comes from subdividing a class or from moving within a fixed partition.
| Grouping | answer share | citation share | held-in AUC |
| 3-class, | .333 | .333 | |
| 3-class, | .250 | .444 | |
| 4-class, | .250 | .500 | |
| 3-class, | .213 | .500 |
Table 14. Granularity acts through the budget it induces. HOUSING-QA, Qwen3.5-9B-Base, three seeds per cell. The four-class arm loses 0.0185 to the three-class arm, which the dose-response predicts from the citation share alone. At matched citation share (.500) the four-class and three-class arms differ by 0.0122, which the residual .037 answer-share gap accounts for.
We do note that this control has a limitation: the three-class partition has one free parameter while the four-class target has two degrees of freedom, so each matched control fixes one coordinate of the budget and leaks the other. Matching on citation share, the coordinate Figure 9 identifies as active (), leaves an answer-share gap that favors the four-class arm; matching on answer share instead leaves a citation gap large enough to account for most of the effect under test. The two cannot be matched simultaneously inside this family, and that is a property of the corner rather than of these runs.
Composing with Per-Token Scoring
Our weights alter the loss’s aggregation geometry; Rho-1, DFT and related methods alter its per-token scoring function. The two are compatible, since multiplied by any per-token statistic is well defined. To offer insights into how these two classes of modifications can compose, we report the results of one such composition. Placing DFT’s per-token weights inside our groups on HOUSING-QA raises held-in AUC to from , while held-out AUC falls from to . This composition behaves like the rest of the family: it buys acquisition with preservation, which is the exchange Figure 9 already describes rather than an escape from it.
Read across the three paired seeds, the two sides of the exchange uphold our default recommendation of uniform weighting within spans. The held-in gain is (, ), and one of the three seeds moves against it; the held-out loss is and consistent in all three (, ). We therefore report the composition as evidence that the two axes are compatible rather than as a recommendation: at this sample size its benefit sits inside seed noise and its cost does not. The deployment setting where it could be worth revisiting is one where held-out preservation carries no weight, such as a closed corpus serving only facts it was trained on.
Loss-Based Group Reweighting as a Baseline
App. E.7 distinguishes our weighting from [41] structurally. Here we run their objectives under our own grouper, so that only the weighting rule differs.
Their fixed-weight variant, -FT, coincides with our family when its coefficient equals a corpus’s payload share. At that matched coefficient the two are not distinguishable: on HOUSING-QA, against our ; on NC-REAL, held-in overwrite against our . We read the coincidence as evidence for the parameterization rather than against it. Equal budget is what means in our family, on any corpus, with no tuning, whereas reaching it in theirs requires knowing each corpus’s composition and setting the coefficient accordingly. Our corpora span payload shares from to , so the coefficient that reaches it differs for every one.
We find that the new baselines behave like existing baselines of ours. RFT reaches on NC-REAL, in line with ungrouped SFT rather than with budget correction. And -FT in its limit suppresses the boilerplate class almost entirely and reaches , above our arm on the injection axis. That limit is masking by another name, and the trade it makes is the one Table 1 already reports for MASKED-SFT: injection bought at the cost of scaffold preservation. We note it because the comparison is only informative when both axes are read together.
Joint Answer-and-Citation Correctness under Free Generation
The paper reports ranking and free generation separately. Here we report the conjunction of answer and citation correctness under free generation, a stricter measurement.
On HOUSING-QA held-in (one seed, 150 items), GB-SFT leads on both components, answer 0.813 against 0.780 and exact citation 0.407 against 0.360, while the joint rate is 0.493 against 0.487. The component gains do not compound, which suggests the two error types are anti-correlated rather than independent. Held-out joint correctness is near zero for every arm, as expected, since held-out citations are not taught.
We think the gap is knowledge-limited rather than decoding-limited, and the evidence is that constraining decoding does not close it: forcing a well-formed citation scores 0.560 against 0.580 for ordinary greedy decoding. If the model had learned the payload and were failing only to express it, constraining the surface form would help. It does not. That points to the corpus-level remedy Allen-Zhu & Li [1] identify: a fact becomes extractable once it appears under sufficient paraphrase and format diversity. This remedy is orthogonal to how the loss is weighted, and we consider it the most promising direction for future work that this measurement opens.
SFT-GO with Oracle Grouping, Across Benchmarks
Figure 14 shows that good grouping is a large share of the effect for both objectives. The complementary question may be asked: given the same oracle grouping, does the objective still matter? Table 15 collects every corpus and model where we ran both, on each benchmark’s primary injection metric, and separately on the preservation metric where HOUSING-QA provides one.
| Corpus | Model | Metric | GB-SFT | GB-SFT | SFT-GO |
| injection axis | |||||
| HOUSING-QA | Qwen3.5-9B-Base | AUC-in | .760 | .769 | .756 |
| HOUSING-QA | Llama 3.1-8B | AUC-in | .748 | .765 | .773 |
| NC-REAL | Qwen3.5-9B-Base | ovwrite | .954 | .954 | .910 |
| NC-REAL | Llama 3.1-8B | ovwrite | .947 | .946 | .934 |
| OPENFDA | Qwen3.5-9B-Base | ovwrite | .799 | .788 | .605 |
| OPENFDA | Llama 3.1-8B | ovwrite | .842 | .852 | .747 |
| preservation axis | |||||
| HOUSING-QA | Qwen3.5-9B-Base | cite-out | .600 | .624 | .720 |
| HOUSING-QA | Llama 3.1-8B | cite-out | .669 | .723 | .815 |
Table 15. The objective is not inert given the grouping, and the ordering depends on the axis.
Both methods receive the same oracle grouping; only the weighting rule differs. GB-SFT leads on injection in five of six cells, by margins up to .194; SFT-GO leads the sixth (HOUSING-QA/Llama 3.1-8B AUC-in, by .008) and leads both preservation cells. On REALVAL, SFT-GO falls below ungrouped SFT for Qwen3.5-9B-Base (Figure 5).
The split is not arbitrary. SFT-GO optimizes a mixture of worst-group and average loss, so it adaptively emphasizes whichever group is currently hardest. On fact-editing corpora that group is the long scaffold the model has least reason to fit. This is why the same mechanism that costs it injection buys it scaffold preservation, and why the ordering between the two methods flips with the axis being measured. Our budget is fixed by the grouping rather than chased during training, so it does not inherit that behavior.
Additional Related Work
Ye et al. [41] share our premise that tokens serving different roles should not be weighted equally in SFT. They identify two groups with a shuffle-aware discriminator and reweight the per-token cross-entropy accordingly. Because the two objectives are close in motivation, it is worth being precise about where they differ and where they agree.
Group weighing differences. Ye et al. [41]’s group weight depends on each group’s current mean loss and multiplies that group’s summed loss, so a group’s gradient mass remains proportional to its token count. The limit recovers standard SFT; the limit approaches suppressing the boilerplate entirely. Equal loss budget is a limit of that family rather than a point in it.
Our weight depends instead on group cardinality, and . That is what makes and reachable corners: equal budget is what means, on any corpus, with no tuning. Their split is also binary and span-agnostic, with no refinement level.
Recovering GB-SFT under a special case. Their fixed-weight variant, -FT, coincides with our family when its coefficient is set to a corpus’s payload share. We ran -FT and RFT under our own grouper and confirm their agreement at the matched coefficient: the objectives are the same up to numerical precision, and the held-in difference between them is not statistically distinguishable.
We read the coincidence as evidence for the parameterization rather than against it. Equal budget is a distinguished point of a family that -FT reaches only when its free coefficient is tuned to each corpus’s composition; our corpora span payload shares from 14.9% to 0.89%, so the coefficient that reaches it differs for every one. Expressing the weight as a function of cardinality makes that point addressable by construction rather than by search.
Weighting across sequences. Hsieh et al. [14] meet the same pathology from the other side. Their weights two separate output sequences, a label and a rationale, selected by [label] and [rationale] prefixes and trained as distinct tasks; the division is therefore made before the loss rather than inside it, and the paper neither reports a value for nor ablates it. The construction is a multi-task decomposition, not a token-level reweighting. It does not apply to a corpus whose payload and scaffold arrive in one continuation, which is the setting we address and the one their own Eq. (5) sets aside.
That ablation is nonetheless the closest independent evidence for our premise that we are aware of. Concatenating rationale and label into a single sequence under uniform cross-entropy can score below ordinary finetuning: adding supervision hurts, because the added tokens take budget from the ones that carry the answer. They remedy it by splitting the sequence; we remedy it by reallocating the budget within the sequence, which is available when the split is not. We read the two as complementary responses to one failure mode rather than as competing methods.
References
- [1]Zeyuan Allen-Zhu and Yuanzhi Li. Physics of language models: Part 3.1, knowledge storage and extraction. In International Conference on Machine Learning (ICML), 2024. arXiv:2309.14316.
- [2]Patrick Chao, Edoardo Debenedetti, Alexander Robey, Maksym Andriushchenko, Francesco Croce, Vikash Shewag, Edgar Dobriban, Nicolas Flammarion, George J. Pappas, Florian Tramèr, Hamed Hassani, and Eric Wong. Jailbreakbench: An open robustness benchmark for jailbreaking large language models. In NeurIPS Datasets and Benchmarks Track, 2024.arxiv.org/abs/2404.01318
- [3]Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K. Dokania, Philip H. S. Torr, and Marc’Aurelio Ranzato. On tiny episodic memories in continual learning. arXiv preprint arXiv:1902.10486, 2019.arxiv.org/abs/1902.10486
- [4]Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.arxiv.org/abs/2110.14168
- [5]Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. Class-balanced loss based on effective number of samples. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019.arxiv.org/abs/1901.05555
- [6]Muxi Diao, Lele Yang, Wuxuan Gong, Yutong Zhang, Zhonghao Yan, Yufei Han, Kongming Liang, Weiran Xu, and Zhanyu Ma. Entropy-adaptive fine-tuning: Resolving confident conflicts to mitigate forgetting. arXiv preprint arXiv:2601.02151, 2026.arxiv.org/abs/2601.02151
- [7]Abhimanyu Dubey, Abhinav Jauhari, Abhinav Pandey, Abhishek Kadian, Asma Al-Dahle, Aasish Moon, Dhruv Mahajan, Aaron Grattafiori, Diego Marcheggiani, Dinghan Sun, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024. URL https://arxiv.org/abs/2407.21783.
- [8]Tom Fawcett. An introduction to ROC analysis. Pattern Recognition Letters, 27(8):861–874, 2006.DOI
- [9]Zorik Gekhman, Gal Yona, Roee Aharoni, Matan Eyal, Amir Feder, Roi Reichart, and Jonathan Herzig. Does fine-tuning LLMs on new knowledge encourage hallucinations? In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pp. 7765–7784, 2024.
- [10]Neel Guha, Julian Nyarko, Daniel E. Ho, Christopher Ré, et al. LegalBench: A collaboratively built benchmark for measuring legal reasoning in large language models. In Advances in Neural Information Processing Systems (NeurIPS), Datasets and Benchmarks Track, 2023.
- [11]Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. REALM: Retrieval-augmented language model pre-training. In International Conference on Machine Learning (ICML), 2020.arxiv.org/abs/2002.08909
- [12]Harvey AI and Baseten. Post-training open legal agents with baseten research. https://www.harvey.ai/blog/post-training-open-legal-agents-with-baseten-research, 2026. Blog post, May 27, 2026.
- [13]Nils Holzenberger, Andrew Blair-Stanek, and Benjamin Van Durme. A dataset for statutory reasoning in tax law entailment and question answering. arXiv preprint arXiv:2005.05257, 2020. NLLP Workshop.arxiv.org/abs/2005.05257
- [14]Cheng-Yu Hsieh, Chun-Liang Li, Chih-Kuan Yeh, Hootan Nakhost, Yasuhisa Fujii, Alexander Ratner, Ranjay Krishna, Chen-Yu Lee, and Tomas Pfister. Distilling step-by-step! outperforming larger language models with less training data and smaller model sizes. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 8003–8017, 2023.arxiv.org/abs/2305.02301
- [15]Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022.arxiv.org/abs/2106.09685
- [16]Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, and Omer Levy. Span-BERT: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics (TACL), 8, 2020.arxiv.org/abs/1907.10529
- [17]Taha A Kass-Hout, Zhiheng Xu, Matthew Mobehi, Hans Nelsen, Adam Baker, Jonathan Levine, Elaine Johanson, and Roselie A Bright. Openfda: an innovative platform providing access to a wealth of fda’s publicly available data. Journal of the American Medical Informatics Association, 23(3):596–600, 2016.
- [18]Gyuhak Kim, Sumiran Singh Thakur, Su Min Park, Wei Wei, and Yujia Bao. SFT-GO: Supervised fine-tuning with group optimization for large language models. arXiv preprint arXiv:2506.15021, 2025.arxiv.org/abs/2506.15021
- [19]Suhas Kotha and Percy Liang. Replaying pre-training data improves fine-tuning. arXiv preprint arXiv:2603.04964, 2026.arxiv.org/abs/2603.04964
- [20]Nathan Lambert, Jacob Morrison, Valentina Pyatkin, Shengyi Huang, Hamish Ivison, Faeze Brahman, Lester James V Miranda, Alisa Liu, Nouha Dziri, Shane Lyu, et al. Tulu 3: Pushing frontiers in open language model post-training. arXiv preprint arXiv:2411.15124, 2024.arxiv.org/abs/2411.15124
- [21]Yoav Levine, Barak Lenz, Opher Lieber, Omri Abend, Kevin Leyton-Brown, Moshe Tennnenholtz, and Yoav Shoham. PMI-masking: Principled masking of correlated spans. In International Conference on Learning Representations (ICLR), 2021.arxiv.org/abs/2010.01825
- [22]Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems, volume 33, pp. 9459–9474, 2020.arxiv.org/abs/2005.11401
- [23]Jiacheng Lin, Zhongruo Wang, Kun Qian, Tian Wang, Arvind Srinivasan, Hansi Zeng, Ruochen Jiao, Xie Zhou, Jiri Gesi, Dakuo Wang, et al. Sft doesn’t always hurt general capabilities: Revisiting domain-specific fine-tuning in llms. In International Conference on Learning Representations, volume 2026, pp. 46954–46992, 2026.arxiv.org/abs/2509.20758
- [24]Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In IEEE International Conference on Computer Vision (ICCV), 2017.
- [25]Zhenghao Lin, Zhibin Gou, Yeyun Gong, Xiao Liu, Yelong Shen, Ruochen Xu, Chen Lin, Yujiu Yang, Jian Jiao, Nan Duan, and Weizhu Chen. Rho-1: Not all tokens are what you need. In Advances in Neural Information Processing Systems (NeurIPS), 2024. arXiv:2404.07965.arxiv.org/abs/2404.07965
- [26]Qi Liu et al. Entropy-KL divergence-based token masking: A novel approach for selective fine-tuning of large language models. arXiv preprint arXiv:2605.29303, 2026.arxiv.org/abs/2605.29303
- [27]Zichen Liu, Changyu Chen, Wenjun Li, Penghui Qi, Tianyu Pang, Chao Du, Wee Sun Lee, and Min Lin. Understanding R1-zero-like training: A critical perspective. arXiv preprint arXiv:2503.20783, 2025.arxiv.org/abs/2503.20783
- [28]Mantas Mazeika, Long Phan, Xuwang Yin, Andy Zou, Zifan Wang, Norman Mu, Elham Sakhaee, Nathaniel Li, Steven Basart, Bo Li, David Forsyth, and Dan Hendrycks. HarmBench: A standardized evaluation framework for automated red teaming and robust refusal. In ICML, 2024.arxiv.org/abs/2402.04249
- [29]Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in gpt. Advances in neural information processing systems, 35:17359–17372, 2022.arxiv.org/abs/2202.05262
- [30]Kevin Meng, Arnab Sen Sharma, Alex Andonian, Yonatan Belinkov, and David Bau. Mass-editing memory in a transformer. In International Conference on Learning Representations (ICLR), 2023. arXiv:2210.07229.arxiv.org/abs/2210.07229
- [31]Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems, volume 35, pp. 27730–27744, 2022.arxiv.org/abs/2203.02155
- [32]Xiangyu Qi, Yi Zeng, Tinghao Xie, Pin-Yu Chen, Ruoxi Jia, Prateek Mittal, and Peter Henderson. Fine-tuning aligned language models compromises safety, even when users do not intend to! In ICLR, 2024.arxiv.org/abs/2310.03693
- [33]Qwen Team. Qwen3.5: Towards native multimodal agents, February 2026. URL https://qwen.ai/blog?id=qwen3.5.
- [34]Paul Röttger, Hannah Rose Kirk, Bertie Vidgen, Giuseppe Attanasio, Federico Bianchi, and Dirk Hovy. XTest: A test suite for identifying exaggerated safety behaviours in large language models. In NAACL, 2024.
- [35]Shiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In International Conference on Learning Representations (ICLR), 2020.arxiv.org/abs/1911.08731
- [36]Karan Singhal, Shekoofeh Azizi, Tao Tu, S. Sara Mahdavi, Jason Wei, Hyung Won Chung, Nathan Scales, Ajay Tanwani, Heather Cole-Lewis, Stephen Pfohl, et al. Large language models encode clinical knowledge. Nature, 620:172–180, 2023.DOI
- [37]Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford Alpaca: An instruction-following LLaMA model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
- [38]Ke Wang, Shuangqi Li, Mathieu Salzmann, and Pascal Frossard. PriFT: Prior-support guided supervised fine-tuning. arXiv preprint arXiv:2606.09396, 2026.
- [39]Mitchell Wortsman, Gabriel Ilharco, Jong Wook Kim, Mike Li, Simon Kornblith, Rebecca Roelofs, Raphael Gontijo Lopes, Hannaneh Hajishirzi, Ali Farhadi, Hongseok Namkoong, and Ludwig Schmidt. Robust fine-tuning of zero-shot models. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.arxiv.org/abs/2109.01903
- [40]Yongliang Wu, Yizhou Zhou, Ziheng Zhou, Yingzhe Peng, Xinyu Ye, Xinting Hu, Wenbo Zhu, Lu Qi, Ming-Hsuan Yang, et al. On the generalization of sft: A reinforcement learning perspective with reward rectification. In International Conference on Learning Representations, volume 2026, pp. 27550–27571, 2026.arxiv.org/abs/2508.05629
- [41]Ziang Ye, Zhenru Zhang, Yang Zhang, Jianxin Ma, Junyang Lin, and Fuli Feng. Disentangling reasoning tokens and boilerplate tokens for language model fine-tuning. In Findings of the Association for Computational Linguistics: ACL 2025, pp. 20939–20957, 2025.
- [42]Miaosen Zhang, Yishan Liu, Shuxia Lin, Xu Yang, Qi Dai, Chong Luo, Weihao Jiang, Peng Hou, Anxiang Zeng, Xin Geng, et al. Towards on-policy sft: Distribution discriminant theory and its applications in llm training. arXiv preprint arXiv:2602.12222, 2026.arxiv.org/abs/2602.12222
- [43]Lucia Zheng, Neel Guha, Brandon R. Anderson, Peter Henderson, and Daniel E. Ho. When does pretraining help? assessing self-supervised learning for law and the CaseHOLD dataset. In International Conference on Artificial Intelligence and Law (ICAL), 2021.DOI
- [44]Lucia Zheng, Neel Guha, Javokhir Arifov, Sarah Zhang, Michal Skreta, Christopher D Manning, Peter Henderson, and Daniel E Ho. A reasoning-focused legal retrieval benchmark. In Proceedings of the 2025 Symposium on Computer Science and Law, pp. 169–193, 2025.DOI
- [45]Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xue zhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. LIMA: Less is more for alignment. In Advances in Neural Information Processing Systems, volume 36, 2023.arxiv.org/abs/2305.11206
- [46]He Zhu, Junyou Su, Peng Lai, Ren Ma, Wenjia Zhang, Linyi Yang, and Guanhua Chen. Anchored supervised fine-tuning. In International Conference on Learning Representations (ICLR), 2026. arXiv:2509.23753.arxiv.org/abs/2509.23753
- [47]Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J. Zico Kolter, and Matt Fredrikson. Universal and transferable adversarial attacks on aligned language models. arXiv preprint arXiv:2307.15043, 2023.














