Skip to content

fix(architectures): apply the Mamba block in MambaTab.forward - #435

Merged
mkumar73 merged 2 commits into
mainfrom
fix/mambatab-mamba-block
Sep 19, 2026
Merged

mkumar73 merged 2 commits into
mainfrom
fix/mambatab-mamba-block

Conversation

@ChrisW09

Copy link
Copy Markdown
Collaborator

Fixes #412

Problem

MambaTab.__init__ builds self.mamba (either Mamba or MambaOriginal depending on config.mamba_version), but forward() never calls it:

x = self.initial_layer(x)
... unsqueeze ...
x = self.norm_f(x)
x = self.embedding_activation(x)
... squeeze ...
preds = self.tabular_head(x)

So every MambaTabClassifier / MambaTabRegressor / MambaTabLSS trains as a linear layer + LayerNorm + activation + MLP head. The Mamba parameters are registered, consume memory and optimizer state, and receive zero gradients, while the model silently underperforms what it claims to be. (Only BaseModel.encode() for pretraining ever touched self.mamba.)

Fix

Apply self.mamba to the sequence-shaped tensor, between the activation and the squeeze back to (B, d_model).

Tests

New tests/test_mambatab_backbone.py fits a model, runs one manual forward/backward, and asserts every .mamba. parameter has a gradient. This shape of test would also have caught the SAINT dead-LayerNorm issue (#416) — worth generalizing across architectures in a follow-up.

🤖 Generated with Claude Code

ChrisW09 and others added 2 commits July 27, 2026 21:30
self.mamba was constructed in __init__ but forward() went
initial_layer -> unsqueeze -> norm_f -> activation -> squeeze -> head and
never invoked it. Every MambaTab classifier/regressor/LSS silently
trained as a single linear layer with an MLP head, while all Mamba
parameters sat in the optimizer receiving no gradients.

Fixes #412

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
model._task_model and model._data_module are Optional-typed internals.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@mkumar73 mkumar73 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.

  • Changes looks appropriate
  • Test cases added
  • This PR can be merged.

@mkumar73
mkumar73 merged commit 0ad24d8 into main Sep 19, 2026
18 checks passed
@mkumar73
mkumar73 deleted the fix/mambatab-mamba-block branch September 19, 2026 20:43
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.

[BUG] MambaTab forward never calls its Mamba block

2 participants