J. Bernardi

Project · NLP · 2026 · solo

Interpretable text classification at INSEE

Lightweight, explainable classifiers that file French company descriptions under ~700 NAF codes, with a model that predicts all five levels at once.

The NAF nomenclature drawn as a root system. Five levels, down to about 700 sub-classes, all fed by one shared stem; the blue root is a single prediction.

Problem

INSEE codes each new company’s free-text activity description against the five-level NAF nomenclature (section → division → group → class → sub-class). Can lightweight models match the production FastText baseline at a fraction of an LLM’s cost, and can their predictions be explained faithfully?

Method

Built on INSEE’s torchTextClassifiers: FastText and small transformer encoders (FATE), each with mean pooling or label attention, benchmarked on Amazon Reviews, CLINC150 and NAF 2025 (~1.2M training examples). A multi-level model feeds one shared encoder into five per-level heads. Explanations from Captum Integrated Gradients and label-attention weights were checked with a word-deletion faithfulness test.

Results

Per-level heads change how the models are wrong rather than how often (table below). The heads can still disagree with each other, which remains open. The full interactive report is at julber95.github.io/interpretable-text-classification.

Measurements

SettingValue
“Completely wrong” errors (miss even the section), single-level≈ 47%
“Completely wrong” errors, multi-level heads29–34%
Section / division recovered vs truncation (FastText)+8.6 / +9.6 pp
Section / division recovered vs truncation (Label Attention)+9.9 / +13.1 pp

Multi-level vs single-level NAF models, among wrong sub-class predictions (report and defense slides).

Stack

Python · PyTorch · PyTorch Lightning · Hydra · MLflow · Captum · uv · Argo Workflows · Quarto

Small print

Keyboard & errata

g i
Go to the index
g w
Go to work
g p
Go to the field log
g a
Go to about
g o
Go to now
t
Paper / darkroom
[ ]
Previous / next project
?
This sheet
  1. Index For “models taken apart”, read “models that took me apart, a little, each time”.
  2. GANs Some rejected digits were, on reflection, perfectly good digits.
  3. Work The list shows every project but one. See the missing one →