NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MeSH-Structured Binary Codes on a Biomedical Language Model

Searching millions of biomedical abstracts with modern language-model embeddings means storing and comparing long vectors of floating-point numbers. A cheaper option is semantic hashing: each document is compressed into a short string of bits, say 32 or 64, so that similar documents get strings differing in few positions. Search then reduces to counting differing bits, which hardware does almost for free. This proposal asks how two choices interact at that compression step. The first is the encoder: a general-purpose model, or one pre-trained on biomedical text. The second is the layout of the bit space: whether the codes are arranged by the field's own expert taxonomy, the Medical Subject Headings (MeSH) tree that librarians use to index PubMed, or left to emerge from training.

The core claim is that when only a few bits are available, the benefit of domain pre-training survives binarization only if the bits are laid out by the domain ontology. Concretely, we will give each MeSH descriptor a codeword whose bit-distance to other codewords tracks distance in the MeSH tree. We will then train a hashing layer on top of a biomedical encoder to land documents near their descriptors' codewords. Our prediction is that this beats both learned-from-scratch codebooks and randomly assigned ones at 16–64 bits, and that it beats them by more on top of a domain encoder than on top of a general one. If the prediction fails, we still learn something useful: either taxonomy structure is redundant once the encoder is domain-trained, or ordinary post-hoc compression of domain embeddings is enough.

What exists and what is missing

The hashing literature has shown that how bits are organized matters. LLC learns 20-bit class codes for ImageNet-1K with a straight-through gradient trick and error-correcting output codes, and finds that a taxonomy emerges unprompted: related classes end up a few bits apart. Evron et al. show that which codeword goes to which class is a hidden hyperparameter that changes accuracy. SHDH splits the code into segments, one per hierarchy level, and weights mistakes by tree distance. HHCH uses hyperbolic geometry to respect tree depth. These papers supply our method, but all of them work on images with small hierarchies of 3–7 levels. The deep text hashing survey names binarizing language-model embeddings as an open frontier, yet it reports only generic flat-label corpora such as 20Newsgroups and AGNews.

On the language-model side, BioBART continues BART's pre-training on 41GB of PubMed abstracts. It improves MeQSum Rouge-L from 51.05 to 53.15 over vanilla BART-Large, and it shows that a general-domain pre-training objective (sentence shuffling) hurts biomedical performance. BioBART never produces discrete codes. Two retrieval papers motivate the gap. ECNU-ICA at TREC-PM 2019 found that general BERT and GPT re-rankers lost to an in-domain doc2vec model. It relied on hand-tuned Elasticsearch clause toggling plus UMLS query expansion, so the ontology entered only as string synonyms. SMTL assigns MeSH terms on BioASQ 5A as flat multi-label targets (precision 0.7750, F 0.6220), ignoring the tree. A third paper constrains the design: SeRTS shows that richer exploration than BM25 helps biomedical retrieval (+5.5 recall points on BioASQ 11b), but at heavy token cost. That argues for a cheap first stage rather than another expensive search loop.

Nothing in this material trains a hashing bottleneck on a domain-pre-trained encoder, and nothing compiles a biomedical ontology into a binary codebook. The new pieces here are the codebook construction and the controlled encoder comparison. The losses themselves are borrowed.

Core mechanism

We start by building the codebook. MeSH descriptors carry tree numbers, for example C04.588.274 under Neoplasms. We split $k$ bits into level segments in the style of SHDH. Within each segment we choose codewords for the children of each node by an assignment that minimizes the mismatch between Hamming distance and tree distance, following Evron's observation that assignment matters. The result is a codeword $c_d \in \{-1,1\}^k$ for every descriptor $d$. Descriptors in the same subtree share prefix segments, and descriptors that sit at several places in the tree take their primary tree number.

The encoder is BioBART's encoder, mean-pooled. A linear hashing layer followed by sign gives the document code $h(x)$, trained with a straight-through gradient. The training objective is

$$\mathcal{L} = \sum_{i,j} \big( \tfrac{1}{k} h(x_i)^\top h(x_j) - s_{ij} \big)^2 \; + \; \lambda \sum_i \big\| h(x_i) - \bar c_i \big\|^2 .$$

Here $s_{ij} \in [-1,1]$ is a tree-weighted overlap between the MeSH sets of documents $i$ and $j$, with SHDH-style level weights. The vector $\bar c_i$ is the bitwise majority vote of the codewords of document $i$'s major-topic descriptors. The weight $\lambda$ trades pairwise similarity against codebook anchoring. Training data come from PubMed abstracts with curated MeSH labels, which is the BioASQ Task 5A setting. At query time a free-text query, such as a TREC-PM patient profile, is hashed by the same network. The code supports exact bucket lookup and small-radius Hamming search for candidate generation.

Research Program

The study is a factorial design. The first factor is the encoder: vanilla BART versus BioBART. This pair is unusually clean, because BioBART is continued pre-training of BART with the same vocabulary and architecture, so the only difference is domain data. The second factor is the codebook: MeSH-structured, the same codebook with a random permutation of descriptor-to-codeword assignment, an LLC-style learned codebook with no ontology, and no codebook at all ($\lambda=0$). The third factor is bit length: 16, 32, 64, and 128. Every cell gets the same training steps, the same encoder fine-tuning regime (frozen and lightly fine-tuned are both reported), and the same hyperparameter sweep size.

The analysis has two parts. The first looks for interactions: does the BioBART-over-BART gap measured on dense embeddings shrink, persist, or grow after binarization, and does the structured codebook's advantage depend on the encoder? The second is diagnostic. At each bit length we will measure how often exact-bucket collisions fall within the same MeSH subtree, and how much the gap between exact lookup and minimum-distance decoding (68.8% versus 74.5% in LLC on ImageNet) narrows when the space is pre-structured. We will also run the BioBART-paper-style register shift, comparing formal abstracts with informal clinical queries, to see whether ontology anchoring makes codes more robust to how a query is phrased.

Baselines

The naive reference point is BM25 over the same collections. On TREC-PM we also compare against the ECNU-ICA pipeline, Elasticsearch with UMLS expansion followed by doc2vec re-ranking. That pipeline reports infNDCG 0.4672 and P@10 0.5675 on the 2019 scientific-abstracts subtask ECNU-ICA. Our hashed retriever plus a fixed dense re-ranker beats this pipeline if it exceeds both numbers. A weaker but still meaningful result is matching it while removing the hand-tuned clause logic.

The strongest competitor on the specific question of whether trained, ontology-shaped bits are needed is post-hoc binarization of BioBART embeddings. We test two versions: sign of mean-centered embeddings, and sign after a learned rotation fit on the same unlabeled corpus. Both get the same dimensionality budget and an equal tuning sweep. No reported result was found on Lacuna for any hashing method on biomedical text, so this baseline's numbers must be produced here. Beating it means a statistically significant gain in tree-weighted Average Cumulative Gain and in TREC-COVID NDCG@10 at 32 bits or fewer.

The uncompressed BioBART dense retriever is the quality ceiling. We report quality per byte against it rather than treating it as a competitor. The key ablation is the permuted-codebook model: identical bits, loss, and training, differing only in whether codeword assignment follows the MeSH tree. Any gain of the structured model over this ablation is attributable to ontology alignment alone. The LLC-style learned codebook tests whether that alignment emerges without being imposed. For MeSH assignment quality, decoded from codes, we compare against SMTL's reported BioASQ 5A F-measure of 0.6220 SMTL. We do not expect to beat it at 32 bits; the point is to measure the cost of compression.

Why not just…?

Why not just sign-threshold the BioBART embeddings? This is the real threat. The evidence that post-hoc binarization destroys neighborhood structure comes from images LLC and from survey-level claims about generic text He et al.. A domain encoder's geometry may already be organized enough that sign thresholding works. The post-hoc baseline is in every table. If it lands within noise of the trained models at 64 bits, we will narrow the claim to the short-code regime. If it also matches at 16–32 bits, the conclusion is that domain pre-training alone carries the semantics and the hashing layer is unnecessary, which is itself worth publishing.

Why not just use BM25 with UMLS expansion? ECNU-ICA shows that this approach works but is brittle: queries either return nothing or flood the candidate pool unless clause logic is tuned by hand ECNU-ICA. SeRTS shows that BM25 misses relevant documents that semantic search finds SeRTS. The TREC-PM and BioASQ comparisons test this directly. Running hashing and BM25 as a union for candidate generation also tells us whether the two are complementary.

Why not let the codebook emerge, as in LLC? LLC found that taxonomy emerges from flat labels on 1,000 balanced image classes. MeSH has tens of thousands of descriptors with heavily skewed frequencies, and rare descriptors may never get coherent codes. The learned-codebook cell settles this. If it matches the structured codebook, especially on rare subtrees, the ontology adds nothing.

Why not apply the hashing loss to a general model with parameter-efficient fine-tuning? The vanilla-BART cells, fine-tuned on the same labels with the same budget, are exactly this alternative. Männistö found in code generation that domain pre-training predicts final performance more strongly than the fine-tuning method does. Our design tests whether the same holds under a binary bottleneck.

Decisive Checks

The proposal's central claim is falsified if the structured codebook fails to beat its permuted twin at 16–32 bits on tree-weighted Average Cumulative Gain over held-out BioASQ abstracts. It is also falsified if the BioBART-over-BART gap disappears after hashing, which would mean binarization erases the benefit of domain pre-training. A positive result has three parts: a structured-over-permuted gain that is larger on BioBART than on BART, more exact-bucket collisions falling within the same MeSH subtree, and TREC-PM abstract retrieval above 0.4672 infNDCG using a memory footprint far below the dense index's. Together, these would show that the ontology compiled into the bit layout, not the compression alone, is what lets domain pre-training survive binarization.