Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
61d45ab
feat(types): add Detection struct and detections field to Classification
bfirestone Apr 5, 2026
14745bc
feat(cli): display detections in human-friendly output
bfirestone Apr 5, 2026
fd37e58
feat(training): add annotate-detections command for multi-label LLM a…
bfirestone Apr 5, 2026
e247461
feat(tier2): add detection head extraction with sigmoid helpers and b…
bfirestone Apr 5, 2026
3cdf660
Merge branch 'worktree-agent-a3cc59f5' into add-multilabel-classifica…
bfirestone Apr 5, 2026
505871f
Merge branch 'worktree-agent-ae1fa279' into add-multilabel-classifica…
bfirestone Apr 5, 2026
d4c3895
fix: resolve merge conflicts from parallel worktree agents
bfirestone Apr 5, 2026
53466a4
feat(training): add detection_head to TextClassifier model
bfirestone Apr 5, 2026
95bc995
feat(eval): add detection head metrics to eval pipeline
bfirestone Apr 5, 2026
71aac87
feat(training): add concurrency and stratified sampling to annotation…
bfirestone Apr 5, 2026
4def2f5
feat(training): add .env file support for API keys
bfirestone Apr 5, 2026
13eba04
fix: address codex review findings
bfirestone Apr 5, 2026
1bbc102
feat(training): add checkpoint support to annotation pipeline
bfirestone Apr 5, 2026
034daaa
fix(training): add retry with backoff to LLM annotation calls
bfirestone Apr 5, 2026
ce6a148
feat(training): add OpenRouter prompt caching for annotation pipeline
bfirestone Apr 5, 2026
a5fc582
feat(training): add Anthropic direct API backend for annotation
bfirestone Apr 5, 2026
ffab84f
fix(training): use is_null() for None group in stratified_sample
bfirestone Apr 5, 2026
80cbf1d
fix(training): guard against None/empty response from OpenRouter
bfirestone Apr 5, 2026
48c4423
feat: finalize detection head implementation and DVC-track annotation…
bfirestone Apr 5, 2026
1f4a660
feat(training): drop synthetic rows from golden_train and archive them
bfirestone Apr 5, 2026
5e7954e
fix(training): address review feedback on drop_synthetic pipeline
bfirestone Apr 5, 2026
0383d9e
feat(training): add pull_real_data script for code sub_types from The…
bfirestone Apr 5, 2026
5f3156f
feat(training): add config and prose phases to pull_real_data
bfirestone Apr 5, 2026
c3d56f8
data(training): add config and prose samples from The Stack
bfirestone Apr 5, 2026
c687023
feat(training): add structured phase with format validators to pull_r…
bfirestone Apr 5, 2026
39b881d
feat(training): add fallback data dirs and error handling to pull_rea…
bfirestone Apr 5, 2026
3f40572
feat(training): complete Phases 1-2 of label cleanup
bfirestone Apr 5, 2026
0391682
feat(training): add heuristic audit for label quality validation
bfirestone Apr 5, 2026
785753f
feat(training): add voting pilot script for Tier 1 escalation measure…
bfirestone Apr 5, 2026
d6ded58
feat(training): add tiered voting pipeline for label cleanup
bfirestone Apr 5, 2026
9d21b9e
feat(training): add per-model routing to annotation pipeline
bfirestone Apr 5, 2026
7d93d06
fix(training): initialize row_routes before conditional block
bfirestone Apr 5, 2026
38af4a4
fix(training): correct default parquet paths in voting scripts
bfirestone Apr 5, 2026
fb2e726
fix(training): reuse shared HTTP clients to avoid too-many-open-files
bfirestone Apr 5, 2026
4adeebc
fix(training): route haiku calls through Anthropic backend
bfirestone Apr 5, 2026
5ed23f6
fix(training): use Anthropic-native model ID for haiku
bfirestone Apr 5, 2026
cfe6978
fix(training): correct haiku model ID and fix checkpoint flushing
bfirestone Apr 5, 2026
f99e63f
data(training): drop OCR csv garbage, add 1500 validated CSV from Stack
bfirestone Apr 5, 2026
9517206
data(training): Phase 4 voting complete — 112K clean dataset
bfirestone Apr 6, 2026
2c7e6af
data(training): Phase 5 detection annotation — 112K rows with 29 det_…
bfirestone Apr 6, 2026
4f62ff8
data(training): fix fixed_width — drop 927 mislabeled, add 567 from S…
bfirestone Apr 6, 2026
201d1e7
data(training): refresh eval sets with validated real data
bfirestone Apr 6, 2026
348cecb
fix(training): align yaml/toml/ini category to structured per types.rs
bfirestone Apr 6, 2026
619d069
docs(training): add iteration 8 summary — label cleanup & retraining
bfirestone Apr 6, 2026
0efe282
feat(tier2): marginalize category from sub-type probabilities
bfirestone Apr 6, 2026
45fd071
feat(tier2): make detection threshold configurable via model_config.json
bfirestone Apr 6, 2026
6ce4de2
docs(eval): record Phase 1 marginalization validation results
bfirestone Apr 6, 2026
3fcb08f
feat(features): add section_header_ratio and json_lines_ratio features
bfirestone Apr 6, 2026
9e6685d
feat(training): add focal loss for category head
bfirestone Apr 6, 2026
76f33e0
feat(training): add --max-per-sub-type downsampling to split_dataset
bfirestone Apr 6, 2026
c443720
fix(tier2): backward-compat for ONNX models with fewer features
bfirestone Apr 6, 2026
c4ecc33
feat(model): retrain ONNX model with 40 features, focal loss, downsam…
bfirestone Apr 6, 2026
cfb95a6
docs(eval): add iteration 9 summary — marginalization, focal loss, do…
bfirestone Apr 6, 2026
7596fbd
fix(tier2): add cfg gates to new model config tests
bfirestone Apr 6, 2026
9c2f52d
data(training): archive stale data, rename golden_train_audit to golden
bfirestone Apr 6, 2026
7e23c8a
data(training): featurize and split clean golden dataset
bfirestone Apr 6, 2026
c6b8ad2
feat(model): retrain from clean golden dataset with focal loss
bfirestone Apr 6, 2026
16559c1
docs(eval): add iteration 10 summary — clean data retrain recovers 93…
bfirestone Apr 6, 2026
370c2fe
feat(training): add relabel_unknowns core module with 3-way voting
bfirestone Apr 6, 2026
d7befa2
fix(relabel): normalize cross-voter labels, vectorize label applicati…
bfirestone Apr 6, 2026
626fb6e
feat(training): wire relabel-unknowns CLI subcommand to data group
bfirestone Apr 6, 2026
0a658d1
fix(relabel): add tqdm progress, exponential backoff, and unknown lab…
bfirestone Apr 7, 2026
5f2749d
fix(relabel): scope bulk drop/relabel to unknown sub_type rows only
bfirestone Apr 7, 2026
f0b5594
data(training): relabel 5,421 unknown sub_type rows via 3-way voting
bfirestone Apr 7, 2026
4418d8b
feat(model): retrain on relabeled dataset with c_cpp/objc sub-types
bfirestone Apr 7, 2026
df54fe4
docs(eval): add iteration 11 summary — relabeled unknowns, clear 93.0…
bfirestone Apr 7, 2026
3d3aa23
docs(spec): accuracy improvement plan 93% → 97% → 99%
bfirestone Apr 7, 2026
2a80fdd
docs(plan): implementation plan for accuracy 93% → 97% → 99%
bfirestone Apr 7, 2026
0b8618e
feat(infra): add featurizer comparison tool for Python/Rust alignment
bfirestone Apr 7, 2026
c2d6c20
fix: clean up unused imports in compare_featurizers
bfirestone Apr 7, 2026
ff8c722
feat(infra): add training manifest for drift detection
bfirestone Apr 7, 2026
3501420
feat(infra): add training manifest for drift detection
bfirestone Apr 7, 2026
1e038ec
fix(data): update FEATURE_COLUMNS from 38 to 40 — add section_header_…
bfirestone Apr 7, 2026
acdf263
feat(training): integrate TrainingManifest into train and pipeline
bfirestone Apr 7, 2026
092f3d4
feat(eval): add verify subcommand to check artifact drift against tra…
bfirestone Apr 7, 2026
0b625b4
fix(featurize): compute json_lines_ratio before newline normalization
bfirestone Apr 7, 2026
d567779
docs(eval): iteration 12 — JSONL feature bug fix, clear eval 93.5% → …
bfirestone Apr 7, 2026
1d6d7b9
fix(eval): deduplicate clear.jsonl and fix 18 mislabeled samples → 97.1%
bfirestone Apr 7, 2026
1cede2e
docs(eval): iteration 13 — eval dedup + label audit, clear eval 97.1%
bfirestone Apr 7, 2026
32dcc34
fix(eval): add c_cpp/objc to SUB_TYPE_TO_CATEGORY, warn on unmapped s…
bfirestone Apr 7, 2026
0b25442
feat(featurize): add shebang_present feature (#41)
bfirestone Apr 7, 2026
b843418
feat(model): promote seed=789 model — 97.6% clear eval
bfirestone Apr 7, 2026
f45d390
docs(eval): refine iteration 14 ceiling analysis per Codex review
bfirestone Apr 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/accuracy_runs/2026-04-06-iteration-10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Iteration 10: Data Cleanup & Retrain from Clean Golden Dataset

**Date:** 2026-04-06
**Branch:** `add-multilabel-classification`

## Overview

Data cleanup iteration -- archived 16 stale files containing dirty synthetic data, renamed the clean `golden_train_audit.parquet` (123K rows, 0 synthetic) to `golden.parquet`, and retrained from clean data. Clear eval accuracy fully recovered to the iteration 8 baseline.

## Root Cause

Iteration 9 trained from `golden_raw.parquet` (136K rows, 49K synthetic) instead of the clean `golden_train_audit.parquet` (123K rows, 0 synthetic). The clean file was produced by iteration 7's label cleanup but a stale file was used for training, polluting the model with synthetic data that degraded accuracy.

## Training Configuration

| Parameter | Value |
|-----------|-------|
| Features | 40 |
| Focal loss gamma | 2.0 |
| Detection threshold | 0.3 |
| Downsampling | None |
| Total rows | 122,912 |
| Training samples | 98,328 |
| Validation samples | 24,584 |
| Val category accuracy | 93.5% |
| Val sub-type accuracy | 89.8% |

## Metrics Comparison

| Metric | Iter 8 | Iter 9 | Iter 10 |
|--------|--------|--------|---------|
| Clear accuracy | 93.4% | 87.7% | **93.4%** |
| Boundary accuracy | 59.6% | 40.7% | 37.2% |
| Prose F1 (clear) | 0.86 | 0.76 | 0.87 |
| Code F1 (clear) | 0.97 | 0.95 | 0.97 |
| Structured F1 (clear) | 0.92 | 0.84 | 0.92 |

## Key Findings

1. **Clear eval fully recovered to iter 8 baseline (93.4%).** This confirms that data quality -- not architecture or hyperparameters -- was the root cause of iteration 9's regression.

2. **Boundary accuracy still poor (37.2%).** The boundary eval shows massive misclassification into the `skip` category:
- 453 code samples predicted as skip
- 261 structured samples predicted as skip
- 229 prose samples predicted as skip

3. **Known sub-type gaps from synthetic data removal.** The following sub-types were 100% synthetic and are now absent from training data:
- `pipe_table` -- 0 training rows
- `fixed_width` -- 0 training rows
- `sgml` -- 0 training rows

## Cost

| Item | Cost |
|------|------|
| API spend | $0.00 |
| Compute | Local only |
| **Total** | **$0.00** |

## Next Steps

| Priority | Improvement | Rationale |
|----------|------------|-----------|
| 1 | **Investigate boundary `skip` misclassification** | The skip category is absorbing ambiguous examples; need to understand why the model defaults to skip on boundary cases |
| 2 | **Pull real data for pipe_table, fixed_width, sgml** | These sub-types have 0 training rows after synthetic data removal and cannot be classified |
| 3 | **Consider boundary-aware training strategies** | Harder examples need more weight; boundary eval has regressed across iterations 9 and 10 |
75 changes: 75 additions & 0 deletions docs/accuracy_runs/2026-04-06-iteration-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Iteration 11 — Relabel Unknown Sub-Types + Retrain

**Date:** 2026-04-06
**Branch:** `add-multilabel-classification`
**Dataset tag:** `dataset-2026-04-06.r3`

## Changes

Relabeled all 5,421 `sub_type=unknown` rows in `golden.parquet` via a 3-way voting pipeline (regex heuristic + Magika + Gemini 3.1 Flash-Lite). Added two new sub-types to the training data.

### Data Changes

| Action | Count | Detail |
|--------|-------|--------|
| New `code/c_cpp` | 2,171 | C/C++ headers and source from the-stack-v2 |
| New `code/objc` | 312 | Objective-C from the-stack-v2 |
| Relabeled → `prose/plain` | 1,820 | License files, arxiv, finepdfs |
| Dropped | 1,101 | OCR garbage (1,097) + generated_skip (4) |
| Manual review | 17 | 3-way voting ties, left as unknown |
| **Net** | **122,912 → 121,811** | |

### Voting Results (the-stack-v2, 2,500 rows)

- Unanimous (3/3 agree): 2,094 (83.8%)
- Majority (2/3 agree): 391 (15.6%)
- Tie (all disagree): 15 (0.6%)

## Results

| Eval Set | Iteration 10 | This Run | Delta | Target |
|----------|-------------|----------|-------|--------|
| **Clear** | 93.4% | **93.0%** | -0.4% | ~93% |
| **Boundary** | 37.2% | **40.2%** | +3.0% | 59.6% |

### Training Metrics

- Epochs: 119 (early stop, patience=15)
- Best epoch: 104
- Best val loss: 0.192
- Val category accuracy: 93.5%
- Val sub-type accuracy: 90.5%

### Clear Eval Confusion Matrix

| | prose | code | structured | skip |
|--|-------|------|-----------|------|
| **prose** | 562 | 13 | 12 | 0 |
| **code** | 28 | 1,878 | 19 | 12 |
| **structured** | 155 | 45 | 1,346 | 1 |

### Boundary Eval Confusion Matrix

| | prose | code | structured | skip |
|--|-------|------|-----------|------|
| **prose** | 593 | 160 | 343 | 133 |
| **code** | 320 | 120 | 38 | 191 |
| **structured** | 510 | 189 | 556 | 3 |

## Analysis

**Clear eval held steady** at 93.0% — the relabeling didn't degrade unambiguous classification. The -0.4% is within noise.

**Boundary improved 3 points** from 37.2% → 40.2%. The `unknown → skip` drain is eliminated. However, boundary accuracy is still 19 points below the 59.6% target. The main remaining issue is **structured↔prose confusion** (510 structured samples misclassified as prose), which is a pre-existing problem unrelated to the unknown relabeling.

## Root Cause of Remaining Boundary Gap

The boundary eval set was generated before `c_cpp` and `objc` existed — there are no boundary test cases for these new sub-types. The structured↔prose boundary confusion (510 + 343 = 853 misclassifications) accounts for most of the gap and needs separate work (e.g., boundary-specific training data, feature engineering for structured detection).

## Follow-Up

- Add `c_cpp`/`objc` to Rust `ContentSubType` enum (`textclf-1dd1.09j1g3`)
- Add to `annotate_detections.py` detection labels (`textclf-1dd1.09v4yn`)
- Review 17 manual review rows (`textclf-1dd1.06q5um`)
- Generate boundary eval samples for `c_cpp`/`objc`
- Investigate structured↔prose boundary confusion
165 changes: 165 additions & 0 deletions docs/accuracy_runs/2026-04-06-iteration-9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Iteration 9: Marginalization, Focal Loss, Downsampling & New Features

**Date:** 2026-04-06
**Branch:** `add-multilabel-classification`
**Commits:** `0efe282` through `c4ecc33`

## Overview

Iteration 9 explored five inference and training improvements aimed at closing the remaining accuracy gaps from iteration 8. Work was split into two phases: Phase 1 tested inference-only changes (marginalization, configurable detection threshold) against the iteration 8 model weights; Phase 2 retrained the model with new features, focal loss, and downsampled plain data. Neither phase improved over the iteration 8 baselines, but valuable infrastructure was added for future iterations.

### Changes Introduced

| Change | Phase | Description |
|--------|-------|-------------|
| Sub-type marginalization | 1 | Derive category probabilities by summing sub-type probabilities per category instead of using the dedicated category head |
| Configurable detection threshold | 1 | Expose `detection_threshold` in `model_config.json` (lowered from 0.5 to 0.3) |
| `section_header_ratio` feature | 2 | Ratio of lines matching `[section]` patterns -- discriminates INI from key_value |
| `json_lines_ratio` feature | 2 | Ratio of lines that parse as valid JSON -- discriminates JSONL from code/prose |
| Focal loss (gamma=2.0) | 2 | Downweights easy/common examples during training to improve rare sub-type performance |
| Plain downsampling | 2 | Capped `plain` at 10,000 samples (was 57,260) to reduce category imbalance |
| Backward-compat ONNX loading | 2 | Tier 2 gracefully handles models with fewer features than expected |

## Phase 1: Inference-Only Changes

Phase 1 tested marginalization and detection threshold changes against the iteration 8 ONNX model weights without retraining. Full results are in [Phase 1 eval report](2026-04-06-phase1-marginalization-eval.md).

### Results

| Eval Set | Iter 8 Baseline | Phase 1 (Cat Head) | Phase 1 (Marginalization) |
|----------|-----------------|-------------------|--------------------------|
| Clear (4,071 samples) | **93.4%** | 88.1% | 86.9% |
| Boundary (3,156 samples) | **59.6%** | 60.2% | 41.0% |

### Key Finding

Marginalization **regressed** accuracy on both eval sets. The sub-type head was trained to distinguish 30 sub-types, not to produce well-calibrated per-category probability sums. Probability dispersion across many sub-types causes structured samples to be misclassified as prose -- 296 structured samples were predicted as prose under marginalization, with JSONL (126) and pipe_table (103) as the worst offenders.

The detection threshold change (0.5 to 0.3) could not be evaluated because the iteration 8 model config lacks a `detection_map`.

## Phase 2: Retrain with New Features, Focal Loss, Downsampling

Phase 2 retrained the model from scratch with all improvements. Full results are in [Phase 2 eval report](2026-04-06-phase2-retrain-eval.md).

### Training Configuration

| Parameter | Value |
|-----------|-------|
| Features | 40 (was 38; added `section_header_ratio`, `json_lines_ratio`) |
| Focal loss gamma | 2.0 |
| Detection threshold | 0.3 |
| Max per sub-type | 10,000 (plain: 57,260 to 10,000) |
| Training samples | 48,396 (after dedup from 88,884 downsampled from 136,144) |
| Validation samples | 12,100 |
| Epochs | 93 (early stopped at patience=15, best at epoch 78) |
| Best val loss | 0.279 |
| Val category accuracy | 94.9% |
| Val sub-type accuracy | 85.5% |

### Results

| Eval Set | Iter 8 Baseline | Phase 1 (Cat Head) | Phase 2 (Retrain) | Delta (Phase 2 vs Phase 1) |
|----------|-----------------|-------------------|-------------------|----------------------------|
| Clear (4,071) | **93.4%** | 88.1% | 87.7% | -0.4pp |
| Boundary (3,156) | **59.6%** | 60.2% | 40.7% | -19.5pp |

### Per-Category F1 Comparison

| Category | Iter 8 | Phase 1 (Cat Head) | Phase 2 |
|----------|--------|-------------------|---------|
| Prose | 0.86 | 0.79 | 0.76 |
| Code | 0.97 | 0.95 | 0.95 |
| Structured | 0.92 | 0.87 | 0.84 |

## Confusion Matrix Comparison (Clear Eval)

### Iteration 8 Baseline

```text
prose code structured
prose 554 18 15
code 18 1891 28
structured 126 62 1359
```

### Phase 2 (Retrain)

```text
prose code structured skip
prose 539 40 8 0
code 20 1881 31 5
structured 275 116 1150 6
```

### Notable Shifts

- **Structured to prose misclassifications doubled** (126 to 275), confirming that downsampling plain removed boundary-adjacent training examples.
- **Structured to code errors also increased** (62 to 116).
- **Prose to code errors increased** (18 to 40), though prose to structured errors decreased (15 to 8).
- **Skip predictions appeared** (13 total), likely due to probability redistribution from the retrained sub-type head.

## Weakest Sub-Types (Phase 2, Clear Eval)

| Sub-type | Accuracy | Samples | Root Cause |
|----------|----------|---------|------------|
| jsonl | 4.5% | 156 | JSONL looks like JSON/code structurally; model cannot distinguish without content parsing |
| pipe_table | 6.0% | 116 | Pipe characters appear in code and prose; structural features insufficient |
| sgml | 50.0% | 2 | Too few eval samples for reliable measurement |
| tsv | 77.7% | 148 | Overlaps with CSV and fixed_width in feature space |

## Root Cause Analysis

### 1. Python/Rust Featurizer Gap (~5.7pp)

The iteration 8 baseline of 93.4% was measured using the Rust ONNX integration. Both Phase 1 and Phase 2 evals used the Python featurizer (`eval_onnx`). The 5.7pp gap between the Python category-head eval (87.7%) and iteration 8 Rust eval (93.4%) indicates the two feature extractors produce different values for the same input text. This is the single largest source of apparent regression and must be resolved before training improvements can be accurately measured.

### 2. Downsampling Plain Hurt Boundary Performance

Reducing plain from 57K to 10K samples likely removed many boundary-adjacent examples. The boundary eval dropped from 60.2% to 40.7% after retraining, a 19.5pp regression. Future downsampling should use boundary-aware stratification to preserve hard examples.

### 3. JSONL and Pipe Table Remain Intractable with Current Features

JSONL (4.5%) and pipe_table (6.0%) are effectively unclassifiable with structural features alone. JSONL content contains the same characters as JSON/JavaScript (braces, quotes, colons), and pipe tables share characters with code and prose. These sub-types need content-aware features or specialized detection.

### 4. Focal Loss Effect Inconclusive

With gamma=2.0, the model achieved strong validation metrics (94.9% category accuracy) but eval accuracy did not improve. The benefit of focal loss is masked by the featurizer gap and eval pipeline differences.

## Cost Breakdown

| Item | Cost |
|------|------|
| API spend | $0.00 |
| Compute | Local GPU training only |
| **Total** | **$0.00** |

All iteration 9 work used local training and inference. No LLM API calls were required.

## Infrastructure Gains

Despite the accuracy regression, iteration 9 delivered durable infrastructure improvements:

1. **Configurable detection threshold** -- `model_config.json` now supports `detection_threshold`, enabling threshold tuning without code changes.
2. **Focal loss support** -- Training pipeline supports focal loss with configurable gamma, ready for future experiments.
3. **Per-sub-type downsampling** -- `split_dataset` supports `--max-per-sub-type` for controlled class balancing.
4. **Two new discriminative features** -- `section_header_ratio` and `json_lines_ratio` are computed and available for future models.
5. **Backward-compatible ONNX loading** -- Tier 2 gracefully handles models with fewer features than the current feature extractor produces, enabling incremental feature additions.

## Lessons Learned

1. **Eval pipeline parity is prerequisite to training experiments.** The Python/Rust featurizer gap made it impossible to distinguish training improvements from eval artifacts. All future iterations must first ensure feature extraction parity.
2. **Marginalization requires training-time support.** Deriving category from sub-type probabilities post-hoc does not work when the sub-type head was not trained with marginalization in mind.
3. **Aggressive downsampling needs stratification.** Capping plain at 10K without preserving boundary-adjacent examples caused a severe regression on boundary eval.
4. **Infrastructure changes and accuracy changes should be evaluated separately.** Bundling five changes into one iteration made it difficult to attribute improvements or regressions to specific changes.

## Recommended Next Steps

| Priority | Improvement | Expected Impact | Effort |
|----------|------------|----------------|--------|
| 1 | **Fix Python/Rust featurizer parity** | Unblocks accurate eval; likely recovers most of the 5.7pp gap | Medium |
| 2 | **Revert to iteration 8 weights** for production | Preserves 93.4% clear accuracy until featurizer gap is closed | Low |
| 3 | **Sub-type to category override** | Eliminates cases where sub-type is correct but category is wrong | Low |
| 4 | **Boundary-aware downsampling** | Preserves hard examples when reducing plain count | Medium |
| 5 | **JSONL-specific detection** | Content-parsing feature (json_lines_ratio) in Rust, not just Python | Medium |
| 6 | **Retrain with marginalization-aware loss** | If marginalization is still desired, train sub-type head with auxiliary category loss | High |
| 7 | **Ensemble Tier 1 + Tier 2 + detection head** | Combine rule-based, model, and multi-label signals | High |
Loading
Loading