lkvantaliani commited on
Commit
f76461b
·
verified ·
1 Parent(s): 8b26267

SNT classifier v0.6

Browse files
Files changed (3) hide show
  1. README.md +36 -31
  2. config.json +66 -66
  3. model.safetensors +1 -1
README.md CHANGED
@@ -12,7 +12,7 @@ tags:
12
  library_name: transformers
13
  ---
14
 
15
- # SNT News Classifier v0.5.1
16
 
17
  Multi-label news topic classifier: **12 top-level (L1) and 71 sub-level (L2)
18
  categories**, built on `xlm-roberta-large` with two independent sigmoid heads. Both levels are
@@ -24,6 +24,10 @@ is ever left unlabeled.
24
  Built by [Sweenk](https://sweenk.com) to categorize its news feed; released so others can use and
25
  scrutinize it.
26
 
 
 
 
 
27
  ## Quick start
28
 
29
  ```python
@@ -66,54 +70,54 @@ The full machine-readable taxonomy (`l1_keys`, `l2_keys`, `l2_parent`, per-class
66
 
67
  ## Evaluation — our own numbers, stated plainly
68
 
69
- Held-out test split: **24,176 articles** (10% of the 241,757 train-eligible corpus
70
- rows). "Tuned" = per-class thresholds optimized on the *validation* split, then applied unchanged
71
- to test.
72
 
73
  | Metric | @0.5 threshold | tuned thresholds |
74
  |---|---|---|
75
- | L1 macro F1 | 0.803 | **0.824** |
76
- | L1 micro F1 | 0.832 | **0.854** |
77
- | L1 primary accuracy (argmax) | 0.832 | — |
78
- | L2 macro F1 | 0.624 | 0.671 |
79
- | L2 micro F1 | 0.760 | 0.757 |
80
 
81
  ### Per-class L1 F1 (test)
82
 
83
  | L1 | F1 @0.5 | F1 tuned | threshold |
84
  |---|---|---|---|
85
- | `sports` | 0.928 | 0.936 | 0.900 |
86
- | `politics` | 0.849 | 0.861 | 0.700 |
87
- | `world` | 0.781 | 0.827 | 0.900 |
88
- | `entertainment_and_pop_culture` | 0.895 | 0.904 | 0.800 |
89
- | `money_and_business` | 0.772 | 0.810 | 0.900 |
90
- | `crime_and_justice` | 0.821 | 0.846 | 0.900 |
91
- | `tech_and_ai` | 0.721 | 0.726 | 0.950 |
92
- | `science_and_space` | 0.731 | 0.754 | 0.800 |
93
- | `health_and_wellness` | 0.830 | 0.859 | 0.900 |
94
- | `lifestyle` | 0.872 | 0.878 | 0.700 |
95
- | `weather_and_environment` | 0.793 | 0.817 | 0.850 |
96
- | `human_stories` | 0.646 | 0.672 | 0.900 |
97
 
98
  ### What you should know before trusting these numbers
99
 
100
  Read this section — it is the honest part.
101
 
102
- - **The gold labels are model-assisted, not human-annotated.** The corpus (255K articles from
103
  HuffPost archives, CommonCrawl News, daily.dev, and Sweenk production) was labeled by a
104
  mechanical migration from an earlier taxonomy plus multiple passes of a Claude Sonnet teacher
105
  with a rule-based prompt, spot-audited by humans (QA gates at 70–87% agreement on sampled
106
  batches). Test F1 therefore measures agreement with an LLM teacher, not with human ground truth.
107
  - **Class imbalance is real (~21x).** `politics`/`lifestyle`/`entertainment` have ~44-47K training
108
- rows; `science_and_space` has ~2.2K and `tech_and_ai` ~3.7K. Training used per-class
109
- `pos_weight` (clamped at 10) to compensate. The weakest class is `human_stories`
110
- (F1 0.672) — it is the fuzziest category by construction.
111
- - **v0.5.1 is a corrective retrain.** A 986-article human validation of the previous release
112
- found errors clustered in specific boundaries (accidents dumped into `weather_and_environment`,
113
- terror attacks into `world`, pharma earnings into `health_and_wellness`). ~1,500 mislabeled rows
114
- were re-labeled with corrected routing rules and the model retrained. On those corrected rows the
115
- previous model matches the corrected label 25.9% of the time; this model matches 75.3%. Aggregate
116
- F1 is *not* directly comparable across releases because the gold labels themselves were corrected.
117
  - **Multilingual ability is inherited, not measured.** The encoder is XLM-R, but nearly all
118
  training articles are English. Expect degraded (unquantified) quality on non-English news.
119
  - **L3 (named topics / entities) is not part of this model** — Sweenk handles that downstream with
@@ -133,6 +137,7 @@ collapses co-confident multi-label pairs).
133
  |---|---|
134
  | v0.5 | First multi-label release (12 L1 / 71 L2, dual sigmoid heads) |
135
  | v0.5.1 | Corrective retrain: route-accidents-by-cause, terror→crime, earnings→money, govt-personnel→politics, wildlife→weather, body-over-headline; ~1,500 corrected labels; re-tuned thresholds |
 
136
 
137
  ## License & attribution
138
 
 
12
  library_name: transformers
13
  ---
14
 
15
+ # SNT News Classifier v0.6
16
 
17
  Multi-label news topic classifier: **12 top-level (L1) and 71 sub-level (L2)
18
  categories**, built on `xlm-roberta-large` with two independent sigmoid heads. Both levels are
 
24
  Built by [Sweenk](https://sweenk.com) to categorize its news feed; released so others can use and
25
  scrutinize it.
26
 
27
+ **Links:** [GitHub — model & training code](https://github.com/sweenk/snt-model) ·
28
+ [GitHub — data pipeline](https://github.com/sweenk/snt-data) ·
29
+ [Live API](https://taxonomy.lasharela.com)
30
+
31
  ## Quick start
32
 
33
  ```python
 
70
 
71
  ## Evaluation — our own numbers, stated plainly
72
 
73
+ Held-out test split: **26,412 articles** (a 10% slice of the labeled corpus,
74
+ stratified by primary L1). "Tuned" = per-class thresholds optimized on the *validation* split,
75
+ then applied unchanged to test.
76
 
77
  | Metric | @0.5 threshold | tuned thresholds |
78
  |---|---|---|
79
+ | L1 macro F1 | 0.817 | **0.847** |
80
+ | L1 micro F1 | 0.831 | **0.857** |
81
+ | L1 primary accuracy (argmax) | 0.833 | — |
82
+ | L2 macro F1 | 0.647 | 0.685 |
83
+ | L2 micro F1 | 0.753 | 0.754 |
84
 
85
  ### Per-class L1 F1 (test)
86
 
87
  | L1 | F1 @0.5 | F1 tuned | threshold |
88
  |---|---|---|---|
89
+ | `sports` | 0.941 | 0.954 | 0.850 |
90
+ | `politics` | 0.845 | 0.859 | 0.750 |
91
+ | `world` | 0.783 | 0.827 | 0.850 |
92
+ | `entertainment_and_pop_culture` | 0.887 | 0.898 | 0.850 |
93
+ | `money_and_business` | 0.786 | 0.825 | 0.950 |
94
+ | `crime_and_justice` | 0.823 | 0.857 | 0.950 |
95
+ | `tech_and_ai` | 0.802 | 0.857 | 0.950 |
96
+ | `science_and_space` | 0.802 | 0.833 | 0.950 |
97
+ | `health_and_wellness` | 0.821 | 0.860 | 0.900 |
98
+ | `lifestyle` | 0.865 | 0.867 | 0.700 |
99
+ | `weather_and_environment` | 0.816 | 0.857 | 0.950 |
100
+ | `human_stories` | 0.632 | 0.671 | 0.900 |
101
 
102
  ### What you should know before trusting these numbers
103
 
104
  Read this section — it is the honest part.
105
 
106
+ - **The gold labels are model-assisted, not human-annotated.** The corpus (~278K articles from
107
  HuffPost archives, CommonCrawl News, daily.dev, and Sweenk production) was labeled by a
108
  mechanical migration from an earlier taxonomy plus multiple passes of a Claude Sonnet teacher
109
  with a rule-based prompt, spot-audited by humans (QA gates at 70–87% agreement on sampled
110
  batches). Test F1 therefore measures agreement with an LLM teacher, not with human ground truth.
111
  - **Class imbalance is real (~21x).** `politics`/`lifestyle`/`entertainment` have ~44-47K training
112
+ rows; `science_and_space` ~2.2K and `tech_and_ai` ~3.7K. Training compensates with per-class
113
+ `pos_weight` (clamped at 10) and caps the majority classes at 25K primary-label train rows so
114
+ they don't swamp the rare ones. The weakest class here is `human_stories` (F1 0.671) —
115
+ the fuzziest category by construction.
116
+ - **Labels were corrected over time, so F1 is not comparable across releases.** v0.5.1 re-labeled
117
+ ~1,500 systematically mislabeled rows with route-by-cause rules (accidents by cause, terror →
118
+ crime, pharma earnings → money); on those rows agreement with the corrected gold went
119
+ 25.9% → 75.3%. Because the gold labels themselves changed between releases, aggregate F1 deltas
120
+ are not like-for-like — treat each release's numbers as self-referential.
121
  - **Multilingual ability is inherited, not measured.** The encoder is XLM-R, but nearly all
122
  training articles are English. Expect degraded (unquantified) quality on non-English news.
123
  - **L3 (named topics / entities) is not part of this model** — Sweenk handles that downstream with
 
137
  |---|---|
138
  | v0.5 | First multi-label release (12 L1 / 71 L2, dual sigmoid heads) |
139
  | v0.5.1 | Corrective retrain: route-accidents-by-cause, terror→crime, earnings→money, govt-personnel→politics, wildlife→weather, body-over-headline; ~1,500 corrected labels; re-tuned thresholds |
140
+ | v0.6 | Retrain on the corrected corpus + ~23K newly teacher-labeled articles (Sweenk production + daily.dev science/tech); majority-class capping (25K/class) on top of `pos_weight`; re-tuned thresholds |
141
 
142
  ## License & attribution
143
 
config.json CHANGED
@@ -24,18 +24,18 @@
24
  "human_stories"
25
  ],
26
  "l1_thresholds": {
27
- "crime_and_justice": 0.9,
28
- "entertainment_and_pop_culture": 0.8,
29
  "health_and_wellness": 0.9,
30
  "human_stories": 0.9,
31
  "lifestyle": 0.7,
32
- "money_and_business": 0.9,
33
- "politics": 0.7,
34
- "science_and_space": 0.8,
35
- "sports": 0.9,
36
  "tech_and_ai": 0.95,
37
- "weather_and_environment": 0.85,
38
- "world": 0.9
39
  },
40
  "l2_keys": [
41
  "soccer",
@@ -184,79 +184,79 @@
184
  "work_and_careers": "money_and_business"
185
  },
186
  "l2_thresholds": {
187
- "american_football": 0.55,
188
- "animals_and_pets": 0.5,
189
- "archaeology_and_history": 0.05,
190
- "artificial_intelligence": 0.3,
191
- "baseball": 0.3,
192
- "basketball": 0.55,
193
- "big_tech_and_startups": 0.45,
194
- "books_and_arts": 0.55,
195
- "celebrities_and_gossip": 0.4,
196
- "climate_change": 0.5,
197
- "college_sports": 0.5,
198
- "combat_sports": 0.55,
199
- "companies_and_industries": 0.45,
200
  "cost_of_living": 0.05,
201
- "courts_and_trials": 0.3,
202
- "crime_and_policing": 0.45,
203
- "crypto_and_fintech": 0.2,
204
- "cybersecurity_and_privacy": 0.25,
205
  "disasters_and_accidents": 0.4,
206
- "education_and_schools": 0.45,
207
- "elections_and_campaigns": 0.45,
208
  "energy_and_climate_solutions": 0.45,
209
- "faith_and_spirituality": 0.35,
210
- "fashion_and_beauty": 0.45,
211
- "fitness_and_exercise": 0.35,
212
- "food_and_drink": 0.4,
213
- "gadgets_and_apps": 0.55,
214
- "gaming": 0.65,
215
  "geopolitics_and_diplomacy": 0.45,
216
- "golf": 0.35,
217
- "good_news_and_kindness": 0.25,
218
- "government_and_policy": 0.4,
219
  "hockey": 0.15,
220
- "home_and_garden": 0.5,
221
- "housing_and_real_estate": 0.3,
222
  "humanitarian_crises": 0.25,
223
- "immigration_and_borders": 0.45,
224
  "internet_culture_and_creators": 0.05,
225
- "macro_economy_and_rates": 0.5,
226
- "markets_and_investing": 0.45,
227
  "media_and_journalism": 0.3,
228
  "medical_and_public_health": 0.45,
229
- "mental_health": 0.3,
230
- "motorsports": 0.55,
231
- "movies_and_tv": 0.55,
232
- "music": 0.5,
233
- "nature_and_wildlife": 0.5,
234
- "nutrition_and_diet": 0.45,
235
  "offbeat_and_unusual": 0.3,
236
- "olympics": 0.6,
237
- "other_sports": 0.35,
238
- "parenting_and_family": 0.4,
239
  "personal_finance": 0.1,
240
- "political_figures_and_scandals": 0.25,
241
- "psychology_and_behavior": 0.05,
242
- "relationships_and_dating": 0.5,
243
  "scams_and_fraud": 0.25,
244
- "scientific_discoveries": 0.3,
245
- "screen_time_and_digital_life": 0.25,
246
- "severe_weather": 0.45,
247
  "sleep_and_longevity": 0.05,
248
- "soccer": 0.4,
249
- "social_issues_and_activism": 0.25,
250
- "space_and_astronomy": 0.4,
251
- "state_and_local_politics": 0.1,
252
- "tennis": 0.35,
253
- "terrorism_and_security": 0.45,
254
- "travel_and_places": 0.4,
255
  "true_crime": 0.05,
256
- "war_and_conflict": 0.55,
257
- "work_and_careers": 0.55
258
  },
259
  "model_type": "snt_classifier",
260
- "snt_version": "v0.5.1",
261
  "transformers_version": "5.8.0"
262
  }
 
24
  "human_stories"
25
  ],
26
  "l1_thresholds": {
27
+ "crime_and_justice": 0.95,
28
+ "entertainment_and_pop_culture": 0.85,
29
  "health_and_wellness": 0.9,
30
  "human_stories": 0.9,
31
  "lifestyle": 0.7,
32
+ "money_and_business": 0.95,
33
+ "politics": 0.75,
34
+ "science_and_space": 0.95,
35
+ "sports": 0.85,
36
  "tech_and_ai": 0.95,
37
+ "weather_and_environment": 0.95,
38
+ "world": 0.85
39
  },
40
  "l2_keys": [
41
  "soccer",
 
184
  "work_and_careers": "money_and_business"
185
  },
186
  "l2_thresholds": {
187
+ "american_football": 0.5,
188
+ "animals_and_pets": 0.55,
189
+ "archaeology_and_history": 0.2,
190
+ "artificial_intelligence": 0.45,
191
+ "baseball": 0.35,
192
+ "basketball": 0.45,
193
+ "big_tech_and_startups": 0.3,
194
+ "books_and_arts": 0.3,
195
+ "celebrities_and_gossip": 0.45,
196
+ "climate_change": 0.35,
197
+ "college_sports": 0.35,
198
+ "combat_sports": 0.35,
199
+ "companies_and_industries": 0.4,
200
  "cost_of_living": 0.05,
201
+ "courts_and_trials": 0.4,
202
+ "crime_and_policing": 0.35,
203
+ "crypto_and_fintech": 0.15,
204
+ "cybersecurity_and_privacy": 0.35,
205
  "disasters_and_accidents": 0.4,
206
+ "education_and_schools": 0.3,
207
+ "elections_and_campaigns": 0.35,
208
  "energy_and_climate_solutions": 0.45,
209
+ "faith_and_spirituality": 0.45,
210
+ "fashion_and_beauty": 0.3,
211
+ "fitness_and_exercise": 0.4,
212
+ "food_and_drink": 0.3,
213
+ "gadgets_and_apps": 0.3,
214
+ "gaming": 0.15,
215
  "geopolitics_and_diplomacy": 0.45,
216
+ "golf": 0.45,
217
+ "good_news_and_kindness": 0.3,
218
+ "government_and_policy": 0.3,
219
  "hockey": 0.15,
220
+ "home_and_garden": 0.35,
221
+ "housing_and_real_estate": 0.25,
222
  "humanitarian_crises": 0.25,
223
+ "immigration_and_borders": 0.4,
224
  "internet_culture_and_creators": 0.05,
225
+ "macro_economy_and_rates": 0.4,
226
+ "markets_and_investing": 0.5,
227
  "media_and_journalism": 0.3,
228
  "medical_and_public_health": 0.45,
229
+ "mental_health": 0.5,
230
+ "motorsports": 0.25,
231
+ "movies_and_tv": 0.35,
232
+ "music": 0.45,
233
+ "nature_and_wildlife": 0.35,
234
+ "nutrition_and_diet": 0.55,
235
  "offbeat_and_unusual": 0.3,
236
+ "olympics": 0.4,
237
+ "other_sports": 0.25,
238
+ "parenting_and_family": 0.35,
239
  "personal_finance": 0.1,
240
+ "political_figures_and_scandals": 0.3,
241
+ "psychology_and_behavior": 0.1,
242
+ "relationships_and_dating": 0.35,
243
  "scams_and_fraud": 0.25,
244
+ "scientific_discoveries": 0.35,
245
+ "screen_time_and_digital_life": 0.1,
246
+ "severe_weather": 0.5,
247
  "sleep_and_longevity": 0.05,
248
+ "soccer": 0.3,
249
+ "social_issues_and_activism": 0.4,
250
+ "space_and_astronomy": 0.5,
251
+ "state_and_local_politics": 0.05,
252
+ "tennis": 0.3,
253
+ "terrorism_and_security": 0.35,
254
+ "travel_and_places": 0.35,
255
  "true_crime": 0.05,
256
+ "war_and_conflict": 0.35,
257
+ "work_and_careers": 0.4
258
  },
259
  "model_type": "snt_classifier",
260
+ "snt_version": "v0.6",
261
  "transformers_version": "5.8.0"
262
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:911b368abfd5170be7b8ab73f6bb1b4b9a323e9dba76bb3069a10d9f477a0cce
3
  size 2239950948
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6600e39a91f7e017d0eceb02baa03ca325e6574fae170b2bb68f58735b71c9b4
3
  size 2239950948