A tagging engine that assigns the correct labels out of 4,000+ to a document — including labels never seen during training. Benchmarked on EURLEX-57K (EU legal corpus) and validated against real student questions on public Stack Exchange.
Title + Body + Recitals fusion — enabling full comprehension of long legal documents. [p.20]Standard multi-label classifiers compress a document into one vector shared by every label. LWA instead learns a separate attention head per label, letting each tag attend to the specific words that justify it. This decouples the encoder from the label space, keeps inference tractable at 4k+ classes, and naturally surfaces zero-shot generalisation because unseen labels can still attend to semantically relevant tokens.
| Model | Micro F1 | Macro F1 | P@1 | R@1 | nDCG@5 | Hamming |
|---|---|---|---|---|---|---|
| RoBERTa* (SOTA) | 0.685 | 0.220 | 0.922 | 0.210 | 0.823 | — |
| BIGRU-LWAN (L2V) | 0.612 | 0.185 | 0.913 | 0.198 | 0.804 | — |
| HAN | 0.584 | 0.142 | 0.894 | 0.182 | 0.778 | — |
| Vanilla MiniLM (baseline) | 0.051 | 0.031 | 0.170 | 0.035 | 0.105 | 0.00160 |
| BiLSTM-ASLCB (ours) | 0.645 | 0.247 | 0.889 | 0.203 | 0.755 | 0.00076 |
| Trans-ASLCB (ours) | 0.639 | 0.251 | 0.881 | 0.200 | 0.761 | 0.00085 |
*RoBERTa fine-tuned as LegalBERT. Our models use a 33M-param backbone.
To test generalisation beyond the EURLEX corpus, the trained model was run against real questions posted by students on public Stack Exchange. Results show strong transfer:
Full metric breakdown over 89,736 label decisions on Stack Exchange questions — the model generalises well outside its training domain.
Paste any document and watch the model tag it in real time. The app also exposes Attention Rollout so you can see which tokens drove each prediction.
Cold start may take a few seconds on the cloud server. Open full screen →
Each token's final attention weight is propagated back through all layers via Attention Rollout. Redder = higher weight. The model correctly focuses on named entities (Singapore, Commission) and suppresses dates, numbers, and filler words.
Label Distribution
Label Co-occurrence Matrix