You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Best model restored from epoch 4 via `load_best_model_at_end=True`.
237
+
238
+
### V1.1 vs V1 Comparison (Best Checkpoints)
239
+
240
+
| Metric | V1.1 (Ep 4) | V1 (Ep 5) | Change |
241
+
|--------|------------|-----------|--------|
242
+
| Overall F1 | 0.899 | 0.903 | -0.004 |
243
+
| Tier 1 Recall |**0.806**| 0.722 |**+0.084**|
244
+
| Tier 2 Recall | 0.940 | 0.934 | +0.006 |
245
+
| Tier 3 Recall | 0.929 | 0.919 | +0.010 |
246
+
| Tier 4 Recall | 0.870 | 0.866 | +0.004 |
247
+
248
+
### What We Learned
249
+
250
+
**The tier-weighted loss and oversampling worked for their intended purpose.** Tier 1 recall improved +8.4 points. Standout entities at epoch 4: SSN recall 0.949, Credit Card 0.883, Drivers License 0.961. Passport number (0.426) remained the main drag — only 526 training examples, and 3x oversampling can only do so much.
251
+
252
+
**The backbone destabilization pattern recurred, earlier and worse.** V1 spiked at epoch 6 (train loss 2.96→5.81). V1.1 spiked at epoch 5 (train loss 2.68→8.40). The tier-weighted loss (3x weight) + oversampling (3x duplication) = ~9x effective gradient signal for Tier 1 sequences hitting the backbone. We reduced backbone LR by 2x (2e-5→1e-5) but amplified gradients by ~9x. Net effect: worse instability, one epoch earlier.
253
+
254
+
**The cosine schedule didn't prevent the spike.** By epoch 5 the backbone LR had only decayed to ~0.65 of its initial value (cosine at 5/15 of total). The recovery in epochs 6-7 was partial at best — once the backbone representations are disrupted, they don't fully recover within the same run.
255
+
256
+
---
257
+
258
+
## Phase 7: V1.2 — Backbone Freezing Schedule
259
+
260
+
**Hypothesis:** The backbone (DeBERTa-v3-xsmall) adapts well for ~4 epochs, then continued updates under amplified tier-weighted gradients cause catastrophic destabilization. Freezing the backbone after epoch 4 lets the head components (CharCNN, GatingFusion, CRF) continue learning without risking backbone collapse.
261
+
262
+
**Prior art:**
263
+
- ULMFiT (Howard & Ruder, 2018): gradual unfreezing for transfer learning
264
+
- LP-FT (Kumar et al., 2022): fine-tuning can distort pretrained features
265
+
266
+
### Changes from V1.1
267
+
268
+
| Parameter | V1.1 | V1.2 | Rationale |
269
+
|-----------|------|------|-----------|
270
+
| Backbone freeze | Never | After epoch 4 | Prevent destabilization |
271
+
| Total epochs | 15 | 10 | 4 full + 6 head-only |
272
+
| All other params | — | Identical | Isolate the freeze variable |
273
+
274
+
### Implementation
275
+
276
+
A `FreezeBackboneCallback` (HF `TrainerCallback`) fires at the end of epoch 4 and sets `requires_grad=False` on all parameters with `"deberta"` in the name. ~10 lines of code. The optimizer still holds backbone params but computes zero gradients, so no updates occur. Head components continue with the cosine-decaying LR.
277
+
278
+
### Expected Outcome
279
+
280
+
If the hypothesis is correct:
281
+
- Epochs 1-4 should match v1.1 exactly (same hyperparameters)
282
+
- Epochs 5-10 should maintain or improve upon epoch 4 quality (no spike)
283
+
- Overall F1 ≥ 0.899 with Tier 1 recall ≥ 0.806
284
+
285
+
If the hypothesis is wrong and the spike comes from head components (not backbone drift), we'd still see destabilization after epoch 4. This would point toward gradient clipping or lower tier weights as the next intervention.
| V1.1 Training | 1 | Tier 1 recall +8.4pts but backbone spike at epoch 5 |
308
+
| V1.2 Setup | 1+ | Backbone freezing notebook + local training script |
309
+
|**Total**|**34+**||
230
310
231
311
---
232
312
233
-
## Open Questions for V1.1+
313
+
## Open Questions
314
+
315
+
1.**Will backbone freezing eliminate the training spike?** V1.2 is the direct test. If it works, the model achieves v1.1 epoch 4 quality without regression.
316
+
317
+
2.**Can head-only training improve beyond epoch 4?** With 6 epochs of head-only training, CharCNN and CRF may learn better entity patterns using the frozen backbone representations as stable features.
234
318
235
-
1.**Will tier-weighted loss + oversampling close the Tier 1 gap?**The 323x imbalance is severe. Oversampling helps but doesn't create genuinely new examples. If Tier 1 recall stays below 0.90, we may need synthetic data augmentation.
319
+
3.**Passport number recall (0.426)**— Only 526 training examples. Even with 3x oversampling and 3x tier weight, this may require synthetic data generation to approach the 0.98 target.
236
320
237
-
2.**16 zero-occurrence entity types** — NATIONALITY, ETHNICITY, RELIGION, MARITAL_STATUS, MEDICAL_RECORD, STUDENT_ID, DEVICE_ID, CRYPTO_WALLET, INSURANCE_NUMBER, SALARY, CRIMINAL_RECORD, POLITICAL_AFFILIATION, SEXUAL_ORIENTATION, HEALTH_CONDITION, GENETIC_DATA, TRADE_UNION. These can't be learned without new data sources. Should we drop them from the taxonomy or find additional datasets?
321
+
4.**16 zero-occurrence entity types** — NATIONALITY, ETHNICITY, RELIGION, MARITAL_STATUS, MEDICAL_RECORD, STUDENT_ID, DEVICE_ID, CRYPTO_WALLET, INSURANCE_NUMBER, SALARY, CRIMINAL_RECORD, POLITICAL_AFFILIATION, SEXUAL_ORIENTATION, HEALTH_CONDITION, GENETIC_DATA, TRADE_UNION. These can't be learned without new data sources.
238
322
239
-
3.**ONNX export** — The CRF Viterbi decode doesn't export cleanly from pytorch-crf. May need a pure-PyTorch reimplementation (~50 lines) for the ONNX path.
323
+
5.**ONNX export** — The CRF Viterbi decode doesn't export cleanly from pytorch-crf. May need a pure-PyTorch reimplementation (~50 lines) for the ONNX path.
240
324
241
-
4.**Backbone scaling** — DeBERTa-v3-xsmall (22M) was chosen for latency. If we need more capacity for Tier 1, DeBERTa-v3-small (44M) or DeBERTa-v3-base (86M) are the next steps, with corresponding latency trade-offs.
325
+
6.**Backbone scaling** — DeBERTa-v3-xsmall (22M) was chosen for latency. If we need more capacity for Tier 1, DeBERTa-v3-small (44M) or DeBERTa-v3-base (86M) are the next steps.
0 commit comments