Skip to content

Add experimental controls for degenerate TransnnMIL fusion#41

Merged
matthewvaishnav merged 30 commits into
mainfrom
research/fix-transnnmil-branch-fusion
Jul 19, 2026
Merged

Add experimental controls for degenerate TransnnMIL fusion#41
matthewvaishnav merged 30 commits into
mainfrom
research/fix-transnnmil-branch-fusion

Conversation

@matthewvaishnav

@matthewvaishnav matthewvaishnav commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Established defect

The historical TransnnMIL final fusion passes one TransMIL query token and one nnMIL key/value token through multi-head attention. With exactly one key, the attention softmax is one and the fused representation is invariant to the TransMIL query. Historical code and checkpoints remain untouched for reproducibility.

Experimental artifacts

This pull request adds three neutrally named controls:

  • transnnmil_concat_experimental — concatenation plus projection;
  • transnnmil_gate_experimental — sample-specific normalized gate;
  • transnnmil_branch_attention_experimental — explicit branch-type embeddings, two-token self-attention, and separately named learned pooling weights.

No variant is described as corrected or improved before controlled training.

Hostile-review fixes completed

  • factory integration for all three experimental model types;
  • a dedicated PANDA fusion experiment trainer;
  • topology explicitly rejected because the historical parent contains an unregistered forward-created projection;
  • direct branch-token API rather than pretending to be nn.MultiheadAttention;
  • historical query-invariance regression test;
  • explicit branch identities;
  • concat and gate baselines;
  • checkpoint round-trip tests;
  • branch-gradient and branch-sensitivity tests;
  • separate names for branch-pooling and self-attention weights;
  • targeted GitHub Actions CI;
  • controlled evaluation and collapse-diagnostic protocol.

Current decision boundary

The defect diagnosis is established by code and mathematics. Architectural improvement is not established.

CI is passing, but this pull request should remain unmerged until the two open scientific/software-validity blockers are resolved:

Publication claims require repeated-seed PANDA comparisons against standalone nnMIL, standalone TransMIL, historical TransnnMIL, concat, gate, and branch-attention variants under an identical locked protocol. Results from the public PANDA development cohort must be labeled internal-development evidence rather than blinded external validation.

@matthewvaishnav matthewvaishnav changed the title Fix degenerate TransnnMIL branch fusion Add experimental controls for degenerate TransnnMIL fusion Jul 18, 2026

@matthewvaishnav matthewvaishnav left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

CI review: the dedicated TransnnMIL fusion CI workflow passed, as did Quick Check, security, repository audit, root-layout, and paper-build checks. The repository-wide CI workflow is currently blocked only by the Black formatting step in Lint and Format Check; flake8 and mypy passed before the matrix was cancelled/skipped downstream. This is a mechanical formatting blocker, not evidence against the fusion tests or defect diagnosis. The draft should remain unmerged until the affected Python files are formatted and the full CI workflow is green.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 3.22581% with 180 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/models/transnnmil/transnnmil_branch_token.py 0.00% 66 Missing ⚠️
src/models/transnnmil/branch_token_fusion.py 0.00% 64 Missing ⚠️
src/models/factory.py 12.50% 42 Missing ⚠️
src/models/transnnmil/__init__.py 0.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@matthewvaishnav
matthewvaishnav merged commit 8f0a223 into main Jul 19, 2026
23 checks passed
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.

2 participants