Skip to content

DILA Model Implementation - #1054

Open
sanjanasarkar wants to merge 13 commits into
sunlabuiuc:masterfrom
sanjanasarkar:master
Open

DILA Model Implementation#1054
sanjanasarkar wants to merge 13 commits into
sunlabuiuc: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

@Jathurshan0330 Jathurshan0330 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good PR. I would request @jhnwu3 to review this again as he is the main author

@Jathurshan0330
Jathurshan0330 requested a review from jhnwu3 May 4, 2026 15:19
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.

@github-actions github-actions Bot added the stale label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants