Buckets:

Rishik001's picture
|
download
raw
10.3 kB

Policy-compliance classifiers: domain-split comparison (5 November 2026)

Hypothesis

Given an assistant message and a single policy, a small fine-tuned model can tell whether the message followed, violated, or is not applicable to the policy. We wanted to know:

  1. Which backbone does this best: an encoder (ModernBERT-large) or a small decoder (Qwen3-0.6B, Qwen3.5-0.8B)?
  2. Does training for 2 epochs instead of 1.5 help?
  3. Does a model that scores well on new conversations from the training domains also do well on two domains it never saw (insurance claims, travel booking)? (This turned out to be confounded; see "Natural vs edited" below.)

What we did

Data. All exported pairs from the ten training domains were pooled and re-split by domain: about 10% of each domain's cases went to validation, the rest to training. A case is one generated scenario, and it always stays whole, so a conversation and its edited variants never cross splits. The two held-out domains form the test set.

Split Domains Pairs Followed Violated Not applicable
Train 10 26,925 8,959 9,034 8,932
Validation same 10, different cases 3,075 1,041 966 1,068
Test (unseen domains) 2 7,023 1,805 114 5,104

Most training and validation pairs are edited: a real reply minimally rewritten to flip its label. The rest are natural, meaning original replies. The two kinds differ sharply:

Split Natural pairs (violated among them) Edited pairs (violated among them)
Train 5,701 (607) 21,224 (8,427)
Validation 582 (36) 2,493 (930)
Test 7,023 (114) 0

Training. Every run fine-tuned LoRA adapters plus a fully trained classification head, with validation at each quarter of training and everything logged to Weights & Biases.

Setting ModernBERT-large Qwen3-0.6B Qwen3.5-0.8B
Classifier reads mean of all tokens last token last token (text decoder only)
LoRA rank / alpha / dropout 32 / 64 / 0.05 32 / 64 / 0.05 32 / 64 / 0.05
LoRA placed on attention + MLP attention + MLP full attention, linear attention + MLP
Effective batch (micro-batch x accumulation) 64 (16 x 4) 64 (16 x 4) 64 (8 x 8)
Learning rate, schedule 2e-4, linear decay, 5% warmup same same
Weight decay, gradient clipping 0.01, 1.0 same same
Max input length (tokens) 2,400 2,352 2,360
Epochs run 1.5 and 2 1.5 and 2 1.5 (2-epoch run stopped at 1/4)
Precision, hardware BF16, one H100 80GB same same

The Qwen3.5 2-epoch run was stopped on request after its first quarter (validation macro-F1 0.8125 at epoch 0.5). It is left out of the tables below.

What we found

  • Qwen3.5-0.8B is the best model overall: validation macro-F1 0.873, against 0.853 for Qwen3-0.6B and 0.825 for ModernBERT. On the unseen domains it reaches 0.619, against 0.604 and 0.588. On natural validation pairs alone it only ties Qwen3-0.6B (0.638 vs 0.639).
  • 2 epochs barely matter. ModernBERT gains 1.5 points on validation and Qwen3 0.04, and neither improves on the unseen domains.
  • All models are good on edited pairs and poor on natural ones. Validation macro-F1 is 0.79–0.86 on edited pairs but 0.62–0.64 on natural pairs. On natural pairs, "violated" F1 is 0.26–0.30.
  • The unseen-domain test set is entirely natural, so comparing it with validation is confounded. Validation is 81% edited and 31% violations; the test set is 0% edited and 1.6% violations. Domain, natural-vs-edited and violation rarity all change at once.
  • Once that is controlled for, there is no clear domain effect. Violated recall drops from 0.76–0.86 on edited pairs to 0.24–0.47 on natural pairs, and it is just as low on natural pairs from the training domains as on the unseen domains (best model: 0.278 vs 0.281). The false-alarm rate (non-violations called violated) is about the same on all three sets for each model.
  • Low precision on the unseen domains comes from violations being rare there. At the same false-alarm rate, a set with 1.6% violations gives far lower precision than one with 6% or 37%. The best model catches 32 of 114 violations and raises 389 false alarms, so 7.6% precision.
  • The real weakness is missing natural violations, wherever they come from: the models catch about 1 in 4. Training contains only 607 natural violations, against 8,427 edited ones.
  • Validation overstates real-world quality, because 81% of it is edited pairs. Accuracy on the unseen domains looks fine (0.83–0.87) only because 73% of that set is "not applicable".

Validation macro-F1 at each quarter of training

Run 1/4 2/4 3/4 End Training time
ModernBERT-large, 1.5 epochs 0.7403 0.7867 0.8020 0.8102 7.4 min
ModernBERT-large, 2 epochs 0.7752 0.8020 0.8134 0.8252 9.5 min
Qwen3-0.6B, 1.5 epochs 0.7758 0.8379 0.8516 0.8529 12.0 min
Qwen3-0.6B, 2 epochs 0.8068 0.8380 0.8486 0.8533 15.8 min
Qwen3.5-0.8B, 1.5 epochs 0.7458 0.8439 0.8638 0.8734 30.5 min

The last checkpoint was the best in every run.

Final results

Run Validation macro-F1 Validation accuracy Natural validation macro-F1 (582) Edited validation macro-F1 (2,493) Unseen-domain macro-F1 Unseen-domain accuracy
ModernBERT-large, 1.5 epochs 0.8102 0.8120 0.6304 0.7933 0.5881 0.8345
ModernBERT-large, 2 epochs 0.8252 0.8276 0.6214 0.8075 0.5877 0.8350
Qwen3-0.6B, 1.5 epochs 0.8529 0.8546 0.6229 0.8417 0.6036 0.8590
Qwen3-0.6B, 2 epochs 0.8533 0.8543 0.6385 0.8404 0.6004 0.8541
Qwen3.5-0.8B, 1.5 epochs 0.8734 0.8741 0.6383 0.8622 0.6194 0.8683

"Violated" class: precision / recall / F1

Run Validation, edited (930) Validation, natural (36) Unseen domains (114)
ModernBERT-large, 1.5 epochs 0.811 / 0.781 / 0.796 0.183 / 0.472 / 0.264 0.045 / 0.272 / 0.077
ModernBERT-large, 2 epochs 0.868 / 0.758 / 0.809 0.214 / 0.333 / 0.261 0.047 / 0.263 / 0.080
Qwen3-0.6B, 1.5 epochs 0.886 / 0.826 / 0.855 0.228 / 0.361 / 0.280 0.067 / 0.272 / 0.108
Qwen3-0.6B, 2 epochs 0.889 / 0.837 / 0.862 0.241 / 0.389 / 0.298 0.062 / 0.237 / 0.099
Qwen3.5-0.8B, 1.5 epochs 0.912 / 0.856 / 0.883 0.256 / 0.278 / 0.267 0.076 / 0.281 / 0.120

With only 36 natural violations in validation and 114 in the test set, one example moves recall by about 3 and 1 points respectively, so small differences in these two columns are noise.

Per-class F1, all validation and unseen domains

Run Validation: followed / violated / not applicable Unseen domains: followed / violated / not applicable
ModernBERT-large, 1.5 epochs 0.775 / 0.760 / 0.895 0.770 / 0.077 / 0.917
ModernBERT-large, 2 epochs 0.801 / 0.782 / 0.893 0.768 / 0.080 / 0.915
Qwen3-0.6B, 1.5 epochs 0.825 / 0.826 / 0.907 0.773 / 0.108 / 0.930
Qwen3-0.6B, 2 epochs 0.829 / 0.834 / 0.897 0.780 / 0.099 / 0.922
Qwen3.5-0.8B, 1.5 epochs 0.851 / 0.858 / 0.910 0.809 / 0.120 / 0.929

Natural vs edited: the confound

How each split is made up. A pair is edited if a real reply was minimally rewritten to flip its label; the dataset marks edited pairs consistently in four separate fields.

Split Natural pairs Edited pairs Share of pairs that are violations
Train 5,701 (21%) 21,224 (79%) 34%
Validation 582 (19%) 2,493 (81%) 31%
Unseen-domain test 7,023 (100%) 0 1.6%

Violated recall and false-alarm rate (non-violations predicted as violated). Unlike precision, neither depends on how common violations are, so they can be compared across the three sets.

Run Recall: edited validation Recall: natural validation Recall: unseen domains False alarms: edited validation False alarms: natural validation False alarms: unseen domains
ModernBERT-large, 1.5 epochs 726/930 = 0.781 17/36 = 0.472 31/114 = 0.272 169/1,563 = 0.108 76/546 = 0.139 660/6,909 = 0.096
ModernBERT-large, 2 epochs 705/930 = 0.758 12/36 = 0.333 30/114 = 0.263 107/1,563 = 0.068 44/546 = 0.081 607/6,909 = 0.088
Qwen3-0.6B, 1.5 epochs 768/930 = 0.826 13/36 = 0.361 31/114 = 0.272 99/1,563 = 0.063 44/546 = 0.081 430/6,909 = 0.062
Qwen3-0.6B, 2 epochs 778/930 = 0.837 14/36 = 0.389 27/114 = 0.237 97/1,563 = 0.062 44/546 = 0.081 406/6,909 = 0.059
Qwen3.5-0.8B, 1.5 epochs 796/930 = 0.856 10/36 = 0.278 32/114 = 0.281 77/1,563 = 0.049 29/546 = 0.053 389/6,909 = 0.056

Natural validation has only 36 violations, so one example moves its recall by about 3 points; a clean domain comparison needs more natural violations from the training domains.

Per-class scores on natural validation pairs only (precision / recall / F1), the like-for-like comparison with the unseen domains:

Run Followed (504) Violated (36) Not applicable (42) Macro-F1
ModernBERT-large, 1.5 epochs 0.963 / 0.823 / 0.888 0.183 / 0.472 / 0.264 0.638 / 0.881 / 0.740 0.6304
ModernBERT-large, 2 epochs 0.950 / 0.875 / 0.911 0.214 / 0.333 / 0.261 0.581 / 0.857 / 0.692 0.6214
Qwen3-0.6B, 1.5 epochs 0.952 / 0.871 / 0.910 0.228 / 0.361 / 0.280 0.562 / 0.857 / 0.679 0.6229
Qwen3-0.6B, 2 epochs 0.955 / 0.883 / 0.918 0.241 / 0.389 / 0.298 0.603 / 0.833 / 0.700 0.6385
Qwen3.5-0.8B, 1.5 epochs 0.946 / 0.911 / 0.928 0.256 / 0.278 / 0.267 0.621 / 0.857 / 0.720 0.6383

Confusion matrix, Qwen3.5-0.8B on the unseen domains (rows = true label)

True \ Predicted Followed Violated Not applicable
Followed (1,805) 1,429 160 216
Violated (114) 59 32 23
Not applicable (5,104) 238 229 4,637

Next steps

To be agreed together before this section is written.

Xet Storage Details

Size:
10.3 kB
·
Xet hash:
183414e9b9b229a50b8ade4cd72615d8bf27e13e3adde0989b3b4ec05cd31587

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.