Clinical Coding CNNs Whose Explanations Are Their Computation

Models that assign billing codes to hospital discharge notes, the ICD codes of the International Classification of Diseases, have been built around convolutional neural networks (CNNs) for years. These models slide small learned windows across the text to spot local phrases such as "acute kidney injury" or "s/p CABG." They then justify each predicted code by highlighting the words that an attention layer weighted most. That justification is on shaky ground. Attention weights can be replaced by very different weights without changing the prediction, and the filters underneath respond to mixtures of unrelated phrases. A clinician looking at a highlighted snippet therefore cannot tell whether that snippet actually caused the code.

We propose a different design. The coding CNN is restricted so that each code's score is an exact sum of a few filter contributions. Each filter fires on its single best-matching phrase in the note, and each filter is pushed to specialize in a small group of related codes. Under this design the explanation is not an approximation: deleting the highlighted phrase changes the score by exactly the amount shown. Our central empirical bet rests on a finding from the concept-extraction literature, that most ICD codes appear in notes through only one or two distinct phrasings. If that is true, a handful of specialized phrase detectors per code should come close to the accuracy of attention-based multi-scale CNNs on MIMIC-III. The second question is whether such a model still beats a plain sparse n-gram classifier, which gets the same kind of auditability for free.

Core Claim

The model has three parts. A multi-width 1D convolution (window widths 3 to 25, as in MultiResCNN) runs over word embeddings. Global max-pooling gives, for each filter $j$, its strongest activation $m_j = \max_t a_j(t)$ and the position $t^*_j$ where that activation occurred. A sparse linear head maps these maxima to code scores:

$$ s_c = b_c + \sum_j W_{cj}\, m_j ,\qquad \mathcal{L} = \mathrm{BCE}(s, y) + \lambda \lVert W \rVert_1 + \mu\, \mathcal{L}_{\text{spec}} . $$

Here $s_c$ is the score for code $c$, $W_{cj}$ is the weight linking filter $j$ to code $c$, $b_c$ is a bias, $y$ are the true code labels, and BCE is the binary cross-entropy loss. The penalty $\lambda \lVert W \rVert_1$ drives most code–filter links to zero. $\mathcal{L}_{\text{spec}}$ is a specialization penalty: it is the entropy of each filter's activation mass across the codes of the documents where that filter fires, so low values mean a filter fires mainly on documents sharing a few codes.

The explanation for code $c$ is the short list of filters with $W_{cj} \neq 0$. For each such filter we show the n-gram at $t^*_j$ and its exact contribution $W_{cj} m_j$. The claim is that at 5 to 10 active filters per code, this model loses little accuracy relative to attention-based CNNs on MIMIC-III top-50 coding. It should also produce evidence that is exactly faithful and whose filters are measurably purer in clinical meaning. Finally, because a filter matches an embedding-space neighborhood of phrases rather than one exact string, it should outperform a sparse n-gram model on shorthand, misspellings and abbreviation variants.

Relation to Prior Work

The motivating line of work consists of the explainable CNN coders. Explainable Prediction of Medical Codes from Clinical Text introduced CAML. CAML puts one convolution under a separate attention distribution for each code and explains each prediction with the top-attended n-grams; a physician preferred these n-grams to baseline explanations. ICD Coding from Clinical Text Using Multi-Filter Residual Convolutional Neural Network added multi-width filters and residual blocks. Dilated Convolutional Attention Network for Medical Code Assignment from Clinical Text used dilated convolutions, meaning windows with gaps that cover long spans cheaply. Explainable Prediction of Adverse Outcomes Using Clinical Notes applied scaled dot-product attention over convolutional maps to predict mortality and readmission. All four locate interpretability in attention computed after the convolution. None constrains what the filters themselves detect.

We keep their multi-width convolutional front end. We remove attention entirely, so there is no gap between what is shown and what is computed. The dispute between Attention is not Explanation and Attention is not not Explanation motivates this choice. The first showed that attention can be swapped adversarially without changing outputs. The second argued that attention can still be informative under constraints consistent with the model. We do not need to settle that debate, but we do test it on clinical CNNs, which neither paper did.

Two papers supply the method. Self-interpretable Convolutional Neural Networks for Text Classification showed that the local linear weights of a ReLU network can be traced back through max-pooling to the n-grams that caused the activation. On Yelp, their network collapsed to essentially one linear region, and they left open whether multi-label, long-document text needs more than that. Our design takes the one-region case as a deliberate starting point and asks whether it holds up on thousands of codes and 2,500-token notes. Training Interpretable Convolutional Neural Networks by Differentiating Class-Specific Filters and Interpretable Convolutional Neural Networks supply the specialization idea: sparse gating of filters by class, and entropy losses on filters. Both were developed only for 2D vision. We adapt them to 1D multi-label text. Because the codes share filters through a sparse matrix, related codes such as the various renal failure codes can reuse one detector.

One paper constrains how concepts can enter the model. Clinical Concept Extraction for Document-Level Coding found that feeding concepts from cTAKES, a rule-based clinical concept extractor, into CAML barely changed Macro AUC (0.8892 to 0.8914). It also found that codes are usually expressed with one or two phrases. We read this as a reason not to inject ontology concepts as inputs. Instead, we use cTAKES and UMLS identifiers only after training, to measure whether the learned filters turned out clinically coherent. The same paper's observation is also the reason the sparse per-code head should suffice.

Research Program

The work has three stages.

The first stage trains the model on MIMIC-III top-50 and sweeps $\lambda$ to trace an accuracy curve against the average number of active filters per code (1, 2, 5, 10, 20, and dense). The prediction from the "one or two phrasings" finding is that the curve flattens early. If instead accuracy keeps climbing up to dense, the prediction fails, and we will report that clinical coding needs distributed evidence.

The second stage audits the filters. For each filter we collect its max-activating n-grams on the test set, map them to UMLS concept identifiers with cTAKES, and compute concept purity, defined as the share of the filter's top activations that fall in its dominant concept. We compare this purity against the filters of CAML and MultiResCNN.

The third stage scales to MIMIC-III full (8,921 codes). The questions there are whether sparsity per code survives the long tail, and whether rare codes borrow filters from frequent relatives. As an optional ingredient, we initialize filters from clustered n-gram embeddings, following Initializing Convolutional Filters with Semantic Features for Text Classification, and test whether this speeds up specialization.

A secondary binary check uses the FairCLIP glaucoma notes studied in Deep Learning-Based Glaucoma Detection Using Clinical Notes. That paper explained its CNN with Grad-CAM, which approximates importance from gradients. Our exact-contribution model lets us ask a sharper question: do the phrases driving positive predictions differ across racial subgroups?

Baselines

The naive reference point is a sparse logistic regression over TF-IDF weighted word n-grams (lengths 1 to 4), with an L1 penalty tuned to the same number of active features per code as our model. It is exactly as auditable as our model, so it tests whether convolutions add anything. We found no reported result on Lacuna for this baseline on MIMIC-III, so we will run it ourselves on the identical splits and 2,500-token truncation.

CAML is the canonical attention-explained CNN. It reports Micro-F1 0.54 and Precision@8 0.71 on MIMIC-III full (Explainable Prediction of Medical Codes from Clinical Text).

The strongest baselines are MultiResCNN and DCAN. MultiResCNN reports Macro-AUC 0.910 and Micro-F1 0.552 on MIMIC-III full (ICD Coding from Clinical Text Using Multi-Filter Residual Convolutional Neural Network). DCAN reports Micro-F1 67.1%, Macro-F1 61.5%, Macro AUC 90.2% and P@5 64.2% on top-50, with 8.7M parameters (Dilated Convolutional Attention Network for Medical Code Assignment from Clinical Text).

We will retrain CAML, MultiResCNN and DCAN rather than copy their numbers. Every model gets the same Word2Vec embeddings, the same splits, and an equal hyperparameter search budget measured in GPU-hours. We report the published numbers alongside our retrained ones to check for drift.

Our target is not to beat DCAN on accuracy. It is to stay within 2 Micro-F1 points of it on top-50 while being exactly faithful, and to beat the sparse n-gram model by a clear margin at the same number of active features per code.

Three ablations isolate the key ingredients. The first removes $\mathcal{L}_{\text{spec}}$ and keeps only the sparse head. The second keeps a dense head, which amounts to the one-region model of Self-interpretable Convolutional Neural Networks for Text Classification scaled to multi-label. The third replaces max-pooling with CAML's per-code attention while keeping the sparse head. That last one tells us whether attention is what buys accuracy.

Why not just…?

Why not just use a sparse n-gram logistic regression? This is the most serious threat. If codes really are expressed with one or two phrasings, exact string features may be enough. The evidence against it is indirect. Clinical notes are full of shorthand and non-standard abbreviations, which is why convolutions tend to do well on them. A learned filter can cover "ARF," "acute renal failure" and "acute kidney inj." at once, while an n-gram feature covers one string. The matched-sparsity comparison settles the question directly. We will also break down the gap by code and check whether it concentrates on codes with many surface variants. If the gap is under one Micro-F1 point, we will say so and recommend the n-gram model.

Why not just keep CAML's attention and trust it, since attention is sometimes faithful? Attention is not not Explanation supports this view in some settings, but nobody has tested it on multi-width or dilated clinical CNNs. We will run the adversarial attention-swap test from Attention is not Explanation on retrained CAML and MultiResCNN. We will also run deletion tests: remove the top-attended n-gram and measure how much the code score drops, then compare with the exact drop in our model. If attention passes both tests, the case for our model shrinks to filter purity and simplicity, and we will report that.

Why not just label the filters of a trained CAML after the fact, or explain it with SHAP? Post-hoc labeling of filters describes polysemantic filters; it does not make them specialized. SHAP estimates importance by sampling perturbed inputs rather than reading the model's actual computation, the concern raised in Self-interpretable Convolutional Neural Networks for Text Classification. The purity audit applies the same cTAKES labeling procedure to CAML's filters and ours, so the difference between post-hoc labeling and trained specialization is measured, not assumed.

Why not just fine-tune ClinicalBERT? Transformers struggle with notes thousands of tokens long, and they add latency and cost. More importantly, their explanations also rest on attention or gradients. We include a chunked ClinicalBERT coder on top-50 as an accuracy ceiling. We are not claiming to beat it; our claim concerns the accuracy we trade for exact faithfulness.

Decisive Checks

Three results together decide the proposal. On top-50, our model must land within 2 Micro-F1 points of retrained DCAN at 10 or fewer filters per code, and above the matched-sparsity n-gram model. Deletion of the reported evidence n-grams must reproduce the reported score changes exactly, while CAML's top-attended n-grams must show a measurably weaker deletion effect and must fail the swap test. The cTAKES concept purity of our filters must exceed that of CAML's and MultiResCNN's filters, with the specialization-loss ablation showing that $\mathcal{L}_{\text{spec}}$ causes the gain. On MIMIC-III full, we report how far below MultiResCNN's 0.910 Macro-AUC and 0.552 Micro-F1 we fall, as an honest measure of whether sparse, specialized evidence survives the long tail. Finally, a blinded review by two or more certified coders will rate the exact-contribution evidence against CAML's attention snippets on a held-out sample of admissions.