Repository navigation
Reduce TabFM row embedding peak memory - #1331
Draft
akihironitta wants to merge 1 commit into
Draft
akihironitta wants to merge 1 commit into
akihironitta wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1331 +/- ##
=======================================
Coverage 82.33% 82.33%
=======================================
Files 185 185
Lines 11794 11794
=======================================
Hits 9710 9710
Misses 2084 2084 ☔ View full report in Codecov by Harness. |
Build the column projection and row norms of the TabFM row embedding from `sdm.nn.RMSNorm`, so that under autocast they write the autocast dtype instead of float32 copies of the whole embedding.
akihironitta
force-pushed
the
agent/tabfm-row-embedding-memory
branch
from
November 3, 2026 08:07
3f98d06 to
d92fac2
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Build the TabFM row embedding's column-projection and row norms from
sdm.nn.RMSNorminstead oftorch.nn.RMSNorm. This cuts TabFM's peak GPU memory at 50k context rows by about 40%, with identical predictions.Description of the change
Under CUDA autocast,
torch.nn.RMSNormruns in float32. So on the inference path,x.copy_(col_proj(x))andx.copy_(row_norm(x))inRowEmbeddingcreate float32 copies of the whole embedding before writing it back.sdm.nn.RMSNorm, which the TabFM transformer blocks already use, writes the autocast dtype directly. It subclassestorch.nn.RMSNorm, so parameters and checkpoint keys are unchanged.Validation
H100 PCIe 80GB, bf16 TabFM under bf16 autocast, 32 estimators, synthetic inputs. Main and this branch ran back to back on the same GPU. Peak is
torch.cuda.max_memory_allocated(), including weights.Predictions are identical to main in all six cases measured: 1k, 10k and 50k context rows, for both classification and regression. At 1k and 10k rows, peak memory and latency are unchanged.