NeurIPS 2026 · Main Track

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.

Each label has its own attention over the note. Illustration · synthetic note, hand-set weights
+3.0MACRO-F1

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

+0.7MACRO-F1

over the best earlier system on MIMIC-IV (22.3 → 23.0), with a 95% interval of 0.48 to 0.95. Table 2

6.9–8.1%RARE-F1

on rare labels held out of training altogether. When the attention starts random, the same models reach 0.5–1.1%. Figure 2

1,090NOTES

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

The problem

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 long tail of MIMIC-III (ICD-9 codes)5,411 rare codes
appears fewer than 10 timesappears 10 times or moreone dot = 10 codes

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.

The method

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.

Architecture · what trains in each stage
external cross-attention on the LLM's output states Documentn tokens LLM backbone4-bit quantizedLoRA adapters train Hn × h states K, V Label embeddings E|L| × h label queries Q Label attentionMultiHead · W_attn8 heads starts from the Stage 1 weights S|L| × n scores Ranking lossscores vs. token relevance A|L| × h attended BoostBₐ + A ⊙ Bₘ Pool → linearp = 128 · W_c ŷ|L| logits Focal loss + hard negativeslogits vs. true labels
Documentn tokens LLM backbone4-bit quantizedLoRA adapters train Hn × h states externalcross-attention onthe LLM's outputs Label embeddings Eone query per label K, V Q Label attentionMultiHead · W_attn · 8 heads S|L| × n scores Ranking lossscores vs. relevance attention starts fromthe Stage 1 weights A|L| × h attended BoostBₐ + A ⊙ Bₘ Pool → linearp = 128 · W_c ŷ|L| logits Focal loss+ hard negatives

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.

What you addOne training stage before your usual fine-tuning, with a ranking loss on the label-attention scores. The attention head is the same one the single-stage baseline uses, so no parameters are added.
What it needsThe mutual information between tokens and labels, computed once on CPU from your labeled training set.
What it costs12–28% more training time on MIMIC-IV (18.7 → 22.9 hours for Mistral-7B) and, in the paper's measurements, about 10% more inference time.

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.

Stage 1, step by step

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.

Step A · the target

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.

What about “no pneumonia”? Mutual information is computed for single tokens, so a general negation word such as no gets little relevance for any one label. The paper's argument is that the attention reads the LLM's contextual hidden states, in which the vector for pneumonia can already carry the negation, and that Stage 2 can correct an imperfect Stage 1 prior. This has not been tested with a controlled negation analysis.
Mutual information calculator · a corpus of 100 documents
0.000bits of mutual information

Scaled to 0–1 within each label, this number is the token's relevance r for that label.

Co-occurrences
P(label)
P(label | token)
Mutual information
token presenttoken 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.

Step B · the loss

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:

nDCG in brief. Take a ranked list. Add up each item's relevance divided by a discount that grows with its position, log2(position + 1), and divide by the best total any ordering could reach. The result is 1 for a perfect ranking, and a mistake near the top lowers it the most. “@k” means the list is cut off after k items.

Hover or tap a coloured term to see where it acts.

Which pairsMutual information picks the pairs: both tokens are among the label's top k, and j is more relevant than h.
How much each pair countsThe change in nDCG@k if the two were swapped in the current ranking. Mistakes near the top cost more.
How well it is rankedA smooth estimate of the probability that the scores put j above h, with σ = 0.5.
Ranking playground · label I50.9 Heart failure, seven tokens Select any two tokens to inspect that pair
#tokenrelevance r (MIG)score s

Red outline: the more relevant token of the pair, j. Blue outline: the less relevant one, h.

nDCG@k0.00
loss0.00
steps0

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.

What the attention learns

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.

more attentionlessnumber = log10 of the average attention weight
Results

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.

MIMIC-IV · fine-tuned LLM with and without PLANT

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.

Ablations

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
Drop from full PLANT · MIMIC-IV, Mistral-7B

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.

More Stage 1 training: better attention, better final model · MIMIC-IV, Mistral-7B

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).

Limitations

What PLANT does not do

It needs labelsMutual information is estimated from token and label co-occurrences in labeled training data. PLANT cannot pretrain attention without supervision, and very sparse or noisy labels make the estimates unreliable.
Scale is untested beyond 31K labelsLarger benchmarks such as Wiki-500K and Amazon-3M were not evaluated. Outside medicine, the full-dataset results use DistilBERT, and the LLM comparisons are single runs on 600-document subsets.
It does not always win on rare labelsA training-free extract-then-link pipeline beats PLANT on few-shot-label P@5 in MIMIC-IV-few, and PLANT does not improve Phi-3-small's few-shot bucket.
Negation is argued, not measuredThe paper's account of negated mentions relies on contextualized hidden states and has no controlled analysis behind it. Planted attention is also specific to a dataset; transfer across label spaces is untested.
It costs timeOn MIMIC-IV, Stage 1 adds 12–28% to training time (18.7 → 22.9 hours for Mistral-7B). The paper also measures about 10% more inference time than the vanilla fine-tuned LLMs.
From equation to code

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.

Talk and poster

Watch the five-minute talk

Cite

Use it, cite it

The paper appears in the main track of NeurIPS 2026. The code is public.

BibTeX
@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}
}