Don't Pay Attention, PLANT It
Pretraining Attention via Learning-to-Rank
Models that pick a few labels out of thousands usually give each label its own attention over the text, and start that attention from random weights. PLANT first pretrains it to rank the tokens that say the most about each label, and then fine-tunes as usual.
Khoury College of Computer Sciences, Northeastern University
Chief complaint: shortness of breath. History: 68-year-old with type 2 diabetes mellitus on metformin and atrial fibrillation on apixaban, admitted with worsening dyspnea and orthopnea. Exam: irregular pulse, bilateral crackles, elevated JVP, leg edema. Echo: EF 30%. BNP elevated. ECG: atrial fibrillation, rate 112. Diagnoses: acute congestive heart failure; atrial fibrillation; diabetes mellitus. Treated with IV furosemide, good diuresis. Glucose controlled with insulin.
over the same LLM fine-tuned without PLANT: the average of four backbones on MIMIC-IV (for Mistral-7B, 20.0 → 23.0). Table 1
over the best earlier system on MIMIC-IV (22.3 → 23.0), with a 95% interval of 0.48 to 0.95. Table 2
on rare labels held out of training altogether. When the attention starts random, the same models reach 0.5–1.1%. Figure 2
for Mistral-7B with PLANT to reach P@5 = 0.50 on MIMIC-IV. Without PLANT it takes between 7,203 and 18,513. Figure 3
Thousands of labels, long documents, and a long tail
Extreme multi-label text classification (XMTC) assigns to a document the relevant few out of a very large set of labels. Medical coding is a typical case: a coder reads a discharge summary and assigns its ICD codes for diagnoses and procedures. The paper's main benchmarks, MIMIC-III and MIMIC-IV, are public sets of de-identified discharge summaries with their codes.
Three things make this hard. The label space is enormous. The documents are long, and only a small fraction of their tokens matter for any one label. And most labels are rare, so the model sees them only a handful of times.
- ≈154,000codes defined by ICD-10-CM and ICD-10-PCS together
- 1,375median words in a MIMIC-III discharge summary
- 61%of MIMIC-III's codes (5,411 of 8,929) appear fewer than 10 times
The standard fix: one spotlight per label
Almost every strong XMTC model adds a label-attention layer. Each label owns a query vector, and that query scores every token of the document. The result is a separate, label-specific summary of the text, so a faint cue for a rare label is not drowned out by the common ones.
The layer matters. Removing it from a product-tagging model cost 15.69 points of P@1 (Xiong et al., 2023).
The gap: every spotlight starts out random
State-of-the-art models initialize this layer randomly. Every label then has to learn, from scratch, how to rank all the tokens it might see. Rare labels have the least data to learn it from, and they are where current models fail: for PLM-ICD on MIMIC-IV, codes seen about 10 times in training have near-zero F1 (Edin et al., 2023).
If the attention layer matters this much, how it is initialized should matter too.
Plant the attention first, then train the model
PLANT (Pretrained and Leveraged AtteNTion) changes how training starts, not the architecture. The label attention is an external cross-attention layer that reads the LLM's output hidden states. It is separate from the self-attention inside the LLM, which PLANT does not modify.
Stage 1 · plantPretrain the attention as a ranker
Only the token scores S are used. For each label, the layer is trained to rank the tokens that carry the most mutual information about that label above the rest. The LoRA adapters, the label embeddings and the attention weights train. At most 10 epochs, stopped early on validation nDCG@k.
Stage 2 · fine-tuneTrain everything on the real task
The whole model trains end to end on the classification loss, starting from the Stage 1 weights instead of random ones. The loss is a focal loss with label smoothing, computed over each note's positive labels and its 1,000 hardest negatives.
The model, in three lines
An LLM adapted with LoRA and 4-bit quantization turns the tokens into hidden states . Trainable label embeddings , one per label, act as queries over them. In the paper's main experiments each embedding starts from an encoding of the label's text description, when the dataset has one:
holds one attention score per label and token. holds one attended vector per label, which is boosted, pooled and projected to a logit:
Ba and Bm are learned per-label offsets and scales (the “boost”). Pool is adaptive average pooling down to p = 128 values. Wc is one linear layer shared by all labels.
Stage 2's loss
Negative labels vastly outnumber positive ones. Stage 2 therefore keeps, for each note, all positive labels and the negatives the model currently scores highest, , and applies a focal loss to that subset:
ŷ is the logit, ỹ the smoothed label (ε = 0.1), and γ = 2. Here σ(·) is the sigmoid function; in the ranking loss below, the paper reuses the letter σ for a fixed scale of 0.5. Backbones in the paper: Mistral-7B, Llama-3.1-8B, DeepSeek-V3 and Phi-3-mini, all 4-bit quantized with LoRA rank 16, and trained on a node of eight A100-80GB GPUs.
How do you tell an attention layer what to look at?
Stage 1 needs two things: a target that says which tokens matter for each label, and a loss that teaches the attention scores to respect it. PLANT takes the target from mutual information and the loss from learning-to-rank.
Mutual information gain (MIG) finds the tokens that tell on a label
For a label and a vocabulary token , count across the training set how often each one is present, and how often they occur together. The mutual information between the two events is the token's relevance for the label:
Counting co-occurrences alone would favour frequent words. Mutual information asks a sharper question: how much does seeing this token change what I believe about the label? Try the paper's worked example below.
Scaled to 0–1 within each label, this number is the token's relevance r for that label.
| token present | token absent | |
|---|---|---|
| label present | ||
| label absent |
Each cell shows its joint probability and what it adds to the sum. In the paper, probabilities are estimated on the full training set with Laplace smoothing, scores are scaled to [0, 1] per label, and the top k tokens per label (k = 500, 1,000 or 2,000) form the set 𝒯l used below.
Train the attention scores to rank tokens in that order
For label , take two positions and in the document whose tokens are in , with the more relevant. The attention score should then be higher than . The loss sums over all such pairs, and weights each one by how much it matters to nDCG, a standard 0-to-1 score of a ranking in which mistakes near the top cost the most:
Hover or tap a coloured term to see where it acts.
Red outline: the more relevant token of the pair, j. Blue outline: the less relevant one, h.
The list is the current ranking, sorted by score. The relevance values are illustrative, and k is 7 here, so every token counts. The loss, the swap weights and the gradient steps are computed in your browser from the equation above, with nDCG using linear gain and a log2 discount. One simplification: these seven scores are free numbers. In PLANT they come out of the attention layer, and the same gradient flows back into its weights, the label embeddings and the LoRA adapters.
Code by code, the right words rise to the top
These are the tokens that PLANT's attention ranks highest for eight ICD-10 codes on MIMIC-IV, taken from the paper's appendix. Tokens are sub-word pieces, so mant is the start of mantle and rit plausibly of rituximab.
The lists are not clean. The paper reports unrelated tokens too, and they are shown here as they are. They are also correlations in the training notes, not judgments: for a code such as unemployment, the list reflects what clinicians wrote alongside it, biases included.
Numbers are attention weights on a log10 scale, averaged over documents. Closer to zero means more attention. Size and colour follow the weight within each code.
The same model, started differently, ends up better
Each comparison below changes one thing. The first holds the backbone and the Stage 2 loss fixed and adds Stage 1.
F1 balances precision (how many of the assigned labels are right) and recall (how many of the right labels are found). Macro-F1 averages F1 over labels, so a rare label counts as much as a common one; Micro-F1 pools every decision. P@k is the share of the k highest-scored labels that are correct. AUC measures how well true labels are scored above the others.
Both bars are the same model: the LLM with the label-attention head, trained with the same focal loss and hard-negative mining. The only difference is whether Stage 1 runs first. This isolates Stage 1; the comparison with the best earlier systems is in the next tab (+0.7 Macro-F1). The paper marks every gain as significant (Wilcoxon signed-rank, α = 0.05). A smaller model with PLANT also beats a much larger one without it: Llama-3.1-8B + PLANT is 3.7 Macro-F1 points above DeepSeek-V3 alone.
Last row: PLANT's difference from the best earlier system on each metric, with the 95% confidence interval (a paired-bootstrap interval from 1,000 resamples of the test set). PLANT leads on five of six metrics. CoRelation is 0.1 higher on Micro-AUC, and that interval includes zero. CoRelation's P@15 is from the authors' own evaluation.
Legal topic classification (EUR-Lex, 3,956 labels) and tag prediction (Wiki10-31K, 30,938 labels), on the full datasets. PLANT uses a DistilBERT backbone here (66M parameters) to match the scale of the baselines. It is best on five of six metrics; on Wiki10-31K P@5, XRR is 0.01 higher.
FT: the LLM fine-tuned without PLANT. P@25 and R@25: precision and recall over the 25 highest-scored labels. PSP@25: P@25 weighted to reward rare labels.
Phi-3-small (7B) replaces Phi-3-mini. These are single runs on small subsets (540 training and 60 test documents, the 150 most frequent labels), so this is directional evidence. The comparison was sensitive to the training budget: with one epoch per stage on Wiki10, PLANT trailed the Mistral baseline on ranking metrics.
Three separate experiments. Their numbers are not comparable with each other.
mean per-code F1, Mistral-7B + PLANT
mean per-code F1, CoRelation
of these codes reach F1 above 0.7 with PLANT
of these codes reach it with CoRelation
Per-code F1 on the benchmark's 685 codes. CoRelation (Luo et al., 2024) is the comparison system in the paper.
Rare labels are those in under 0.1% of training notes. Grey and green: the model trains only on notes whose labels are all common (above 1%), so these labels are never trained. Outlined: PLANT trained on all the data. Paper, Figure 2 (right), which also shows error bars.
Precision by how often a label occurs in training: zero-shot (0 times), few-shot (1–7), head (8 or more); the paper reports a different cutoff for each bucket. FT is the same LLM fine-tuned without PLANT. TF-0 and TF-2 are a training-free extract-then-link pipeline with zero or two in-context examples. PLANT is best on unseen labels, head labels and overall. The training-free pipeline is ahead on few-shot labels. Single runs; Phi-3-small (7B) replaces Phi-3-mini.
Redrawn from the paper's Figure 3 (right). One backbone; the paper's figure shows no error bars.
training notes for PLANT to reach P@5 = 0.50 on MIMIC-IV
where the same model without PLANT gets there: 0.47 at 7,203 notes, 0.53 at 18,513
notes for PLANT to reach P@5 = 0.47 on MIMIC-III
where the baseline first reaches it
Both models share the architecture, backbone and test set. The only difference is whether Stage 1 runs first. Stage 1 also updates the label embeddings and the LoRA adapters, and adds training time.
Which part does the work?
Each row removes or replaces one component of the full method and reports what is lost. Removing Stage 1 costs the most. Inside Stage 1, both choices matter: mutual information beats raw token frequency as the target, and the ranking loss beats regressing the scores with MSE.
Those two rows are also a control. They keep all of Stage 1's extra training and change only what it learns, and most of the gain goes away: −2.5 and −3.0 Macro-F1, against −3.5 for removing Stage 1. Extra training alone does not explain the result.
The quality of the planted attention also carries over. As Stage 1 trains longer on MIMIC-IV, its nDCG@k rises from 0.68 to 0.94, and Macro-F1 after Stage 2 rises with it.
- 0.78 → 0.45correlation between a label's F1 and its log frequency, random start vs. PLANT (training on common labels only)
- 0.08 → 0.52cosine similarity between attention and mutual information on rare labels that neither model was trained on, same comparison
Bars: points lost against the full method. Whiskers: 95% paired-bootstrap intervals. The two “No Stage 1” rows are separate single-stage runs, with a configuration that differs from the baselines in the Results chart, as the paper notes (19.5 Macro-F1 here, 20.0 there). Read each chart as its own comparison. Paper, Table 5.
Each point is a run with a different amount of Stage 1 training, from 1 to 10 epochs, so attention quality and the amount of Stage 1 training rise together; the figure does not separate the two. Across: how well the attention ranks tokens when Stage 1 ends. Up: Macro-F1 after Stage 2, with the error bars of the paper's figure. Redrawn from Figure 3 (left).
What PLANT does not do
Where each idea lives in the code
Each row pairs one piece of the method with the lines that implement it. The annotated walkthrough is being prepared; the map below shows what it will cover.
Watch the five-minute talk

Poster Session 1 · NeurIPS 2026, Sydney · Tuesday 8 December 2026
Use it, cite it
The paper appears in the main track of NeurIPS 2026. The code is public.
@inproceedings{saharoy2026plant,
title = {Don't Pay Attention, {PLANT} It:
Pretraining Attention via
Learning-to-Rank},
author = {Saha Roy, Debjyoti and
Wallace, Byron C. and
Aslam, Javed A.},
booktitle = {Advances in Neural Information
Processing Systems (NeurIPS)},
year = {2026},
note = {arXiv:2410.23066}
}