Don't Pay Attention, PLANT It: Pretraining Attention via Learning-to-Rank

Debjyoti Saharoy, Byron C Wallace, Javed A. AslamNeurIPS 2026

TL;DR

When classifying long documents against tens of thousands of possible labels, models rely on specialized "spotlight" attention modules to find the exact words relevant to each label—yet they usually learn where to shine those spotlights from random noise. PLANT fixes this by pretraining the external attention layer as a search engine first, teaching it to rank informative words before full model training even begins. The result? Small, open-weight LLMs dramatically improve on rare, needle-in-a-haystack labels, outperforming models over a hundred times their size.

What Problem Does This Paper Address?

Imagine reading a 1,500-word hospital discharge summary and selecting the exact diagnoses and procedures that apply out of 154,000 standardized medical codes. Welcome to Extreme Multi-Label Text Classification (XMTC), a problem that pops up everywhere from healthcare coding to legal categorization and Wikipedia tagging.

Two things make XMTC notoriously brutal: massive label spaces and extreme data skew. A handful of "head" labels appear constantly, while thousands of "tail" labels show up fewer than ten times in your entire dataset. You can't just paste 100,000 labels into an LLM prompt—the model's focus gets spread too thin ("attention dilution").

Instead, state-of-the-art architectures slap an external label-attention layer on top of a text encoder. Think of this as giving every single label its own personal spotlight to scan the document for relevant clues. The catch? Models initialize these spotlights randomly. Learning where to point 100,000 spotlights from scratch takes massive amounts of data. Common labels figure it out; rare labels starve, overfit, and collapse to near-zero accuracy.

Methods

Instead of forcing the label-attention layer to learn from scratch during classification, the authors introduce PLANT (Pretrained and Leveraged AtteNTion), a plug-and-play two-stage training recipe. Crucially, this operates on the external cross-attention module sitting on top of an LLM's output hidden states—the LLM's internal self-attention remains untouched.

Figure 1: PLANT Attention. On the left, the MultiHead−Attention module [Vaswani et al., 2017], parameterized by W attn, takes as input queries Q = E (label embeddings), keys K = Hi, and values V = Hi, and produces S ∈R|L|×n, the token-level attention for each label. This module (dashed box) is external to the LLM and distinct from its internal self-attention: its keys and values are the final hidden states Hi of the adapted backbone Madapt. The orange box highlights the top-k tokens per label, Tl, selected by Mutual Information Gain rlj. Two tokens j (red) and h (blue) in this set are compared, with j more relevant than h. The module is trained to rank j above h (P(j ≻h)), with each pair weighted by the change in nDCG@k if they were swapped (|∆nDCG@k|jh); the summation box over token pairs in Tl gives the PLANT objective used to initialize W attn.

Here is how the two stages work:

  1. Stage 1: Planting Attention via Learning-to-Rank (What's New). Before doing any classification, the authors calculate the Mutual Information Gain (MIG) between tokens and labels across the training corpus—essentially a statistical cheat sheet of how informative word $X$ is for label $Y$. They then train the external attention module (alongside LoRA adapters on a 4-bit quantized LLM and text-initialized label embeddings) using a pairwise Learning-to-Rank (L2R) objective. Given the top-$k$ most informative words for a label, the attention layer is penalized if it ranks a less informative word above a more informative one, weighted by how much that swap hurts ranking quality ($|\Delta\text{nDCG@}k|$).
  2. Stage 2: End-to-End Fine-Tuning (Standard + Polish). With the spotlights now pointing in sensible directions, the whole network is fine-tuned on the actual classification task. To keep dominant negative labels from drowning out rare positives, they use focal loss combined with label smoothing and hard negative mining (computing loss only on positive labels plus the 1,000 most confusing negative labels per document).

Datasets

The authors evaluate PLANT across clinical, legal, and web domains:

  • MIMIC-III & MIMIC-IV: Clinical discharge summaries mapped to ICD-9 and ICD-10 medical codes (including standard full, top50, rare50, and few splits).
  • EURLEX-4K: Long legal documents paired with thousands of legal topic labels.
  • WIKI10-31K: Wikipedia-style articles paired with ~31,000 social tags for content recommendation.
  • New Benchmarks/Splits: The authors construct MIMIC-IV-few (an 800-note low-resource split retaining all 3,343 occurring labels, centered on rare codes) and controlled 600-document subsets of EURLEX-4K and WIKI10-31K to test fine-tuned LLMs under compute constraints.

Key Insights and Ideas

  • David beats Goliath when attention is guided: A 3.8B-parameter model (Phi-3-mini) equipped with PLANT outperforms a standard fine-tuned DeepSeek-V3 (671B total parameters, 37B active) by +7.1 Macro-AUC and +2.0 Micro-F1 on MIMIC-III. Smart initialization matters more than sheer parameter count.
  • True zero-shot transfer to unseen rare labels: When models are trained exclusively on common labels (>1% frequency) and tested on unseen rare labels, standard random-attention models completely collapse (0.5–1.1% F1). Because PLANT initializes label queries from text descriptions and teaches the attention mechanism how to align queries with informative tokens, it retains 6.9–8.1% F1 without ever seeing a single training example for those rare codes.
Figure 2: (Left) Per-code macro-F1 of PLM-ICD on MIMIC-IV against code frequency, digitized from Figure 5 of Edin et al. [2023]: rare codes have near-zero macro-F1 (RQ3). (Right) Rare-F1 when training only on common labels (> 1% frequency). PLANT retains zero-shot performance (6.9–8.1%); random attention initialization collapses (0.5–1.1%). See Section 3 (RQ7).
  • Data efficiency: Starting from planted attention dramatically cuts sample complexity. On MIMIC-IV, PLANT hits a Precision@5 of 0.50 using just 1,090 training examples—a bar the standard end-to-end LLM only clears after seeing between 7,203 and 18,513 examples.

Key Results

  • Consistent LLM Boosts: Across Mistral-7B, Llama-3.1-8B, DeepSeek-V3, and Phi-3-mini on full MIMIC-IV, PLANT yields average gains of +7.2 Macro-AUC, +3.0 Macro-F1, and +3.1 P@15.
  • New SOTA in Medical & General XMTC: On MIMIC-IV-full, Mistral-7B + PLANT sets a new state-of-the-art at 23.0 Macro-F1 and 72.1 P@8 (+1.4 over prior specialized SOTA). Paired with a lightweight DistilBERT backbone, PLANT also beats specialized XMTC baselines on full EURLEX-4K (90.61 P@1) and WIKI10-31K (90.91 P@1).
  • Crushing the Long Tail: On MIMIC-III-few (codes seen 1–5 times), per-code Macro-F1 jumps from 0.054 (prior SOTA CoRelation) to 0.663 with PLANT. Qualitatively, for rare diagnoses like mantle cell lymphoma, PLANT's spotlights lock onto clinical tokens corresponding to mantle, Ki-67, and specific chemotherapy drugs (bendamustine, rituximab).
  • Ablations: Stripping out Stage 1 pretraining causes the single largest drop in performance (-4.9 to -6.4 Macro-AUC), proving the gains aren't just from focal loss or hard negative mining.

Limitations and Future Work

  • Needs Labeled Data Upfront: Because Mutual Information Gain is calculated from token–label co-occurrences, Stage 1 cannot be run on unlabeled text, and very noisy or ultra-sparse annotations can skew MIG estimates.
  • Scale & Compute Constraints: The authors did not test massive million-label benchmarks (e.g., Wiki-500K or Amazon-3M), and LLM comparisons outside the medical domain were restricted to 600-document, 150-label subsets. Scaling full LLM backbones to full non-medical XMTC label spaces remains future work.
  • Training-Free Rivals on Few-Shot: On MIMIC-IV-few, a clever training-free baseline (prompting an LLM to extract medical entities, then linking them via SapBERT) actually beat PLANT on the 1–7 occurrence bucket (P@5), though PLANT still won on zero-shot, head labels, and overall ranking.
  • Untested Negation & Cross-Dataset Transfer: Generic negation words ("no") have low MIG scores; while the authors hypothesize that LLM contextualized states handle negation anyway, they note a controlled negation study is still needed. Furthermore, planted attention is currently dataset-specific, and Stage 1 adds 12–28% to training time (~10% to inference).

Summary updated

Abstract

State-of-the-art Extreme Multi-Label Text Classification models rely on multi-label attention to focus on key tokens in input text, but learning good attention weights is challenging. We introduce PLANT—Pretrained and Leveraged AtteNTion—a plug-and-play strategy for initializing the label-attention module that operates on top of an LLM's output representations. PLANT works by planting label-specific attention using a Learning-to-Rank model trained on mutual information gain, before end-to-end fine-tuning. This architecture-agnostic approach integrates with LLM backbones (e.g., Mistral-7B, Llama-3.1-8B, DeepSeek-V3, and Phi-3-mini). PLANT outperforms SOTA methods across tasks like ICD coding, legal topic classification, and content recommendation, and improves fine-tuned LLMs in controlled comparisons outside the medical domain. Gains are largest on rare labels, although a training-free LLM extraction baseline remains competitive on rarely seen labels. Ablation studies confirm that attention initialization is a key driver of these gains. We make our code available at https://github.com/deb-official/plant.
BibTeX
@inproceedings{saharoy2026don,
  author = {Debjyoti Saharoy and Byron C Wallace and Javed A. Aslam},
  title = {{Don't Pay Attention, PLANT It: Pretraining Attention via Learning-to-Rank}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=LGg6VgVLdN},
}
Figure