Skip to content

DILA Model Implementation#1054

Open
sanjanasarkar wants to merge 13 commits intosunlabuiuc:masterfrom
sanjanasarkar:master
Open

DILA Model Implementation#1054
sanjanasarkar wants to merge 13 commits intosunlabuiuc:masterfrom
sanjanasarkar:master

Conversation

@sanjanasarkar
Copy link
Copy Markdown

Contributors

Type of Contribution

  • Model (Option 2)

Link to Original Paper

  • DILA: Dictionary Label Attention for Mechanistic Interpretability in High-Dimensional Multi-Label Medical Coding Prediction (https://arxiv.org/pdf/2409.10504)

High-level Description

This PR implements the Dictionary Label Attention (DILA) model for multi-label clinical classification tasks, such as ICD coding. DILA provides mechanistic interpretability by disentangling dense embeddings into sparse, human-auditable medical concepts.

File Guide

  • docs/api/models.rst
  • docs/api/models/pyhealth.models.dila.rst: API documentation for the model.
  • pyhealth/models/dila.py: Main model class integrating PLM, SAE, and Attention modules.
  • pyhealth/models/dila_sparse_autoencoder.py: SAE implementation with centering and elastic-net loss.
  • pyhealth/models/dila_dict_label_attention.py: Label attention logic and ICD projection initialization.
  • tests/core/test_dila.py: Fast unit tests using synthetic tensors.
  • examples/mimic3_icd_coding_dila.py: Script for hyperparameter ablation studies.
  • examples/dila_mimic3_evaluation.ipynb: Notebook for visualization and evaluation.

alexander-rau and others added 13 commits April 12, 2026 13:15
Implements the two-stage DILA (Dictionary Label Attention) pipeline:
- SparseAutoencoder for learning sparse dictionary features from PLM embeddings
- DictionaryLabelAttention for ICD-guided label attention mechanism
- DILA BaseModel integrating both stages with pretrain_sparse_autoencoder utility
- Unit and integration tests covering all three modules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add embeddings and sparse autoencoder implementation
feat: add DILA model for interpretable ICD coding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants