Skip to content

Conversation

@smarter
Copy link

@smarter smarter commented Jan 16, 2026

This includes the tests that were originally in #13 and the tests added in #68
This is still missing FSDP support and test_apply_ekfac.py from #68

Co-Authored-By: LouisYRYJ [email protected]

@smarter smarter force-pushed the ekfac-final+tests branch 3 times, most recently from f473c60 to 8c170a5 Compare January 16, 2026 00:21
@smarter
Copy link
Author

smarter commented Jan 16, 2026

https://github.com/EleutherAI/bergson/blob/main/.github/workflows/build.yml#L7-L9 means the tests aren't run for this PR since it's targeting the ekfac-final branch currently.

smarter and others added 3 commits January 16, 2026 01:25
The backward_hook was using g.reshape(-1, O) which includes padding
positions in the covariance computation. This causes incorrect results
when batches have different sequence lengths.

Before this commit, the added test failed with:
> FAILED tests/ekfac_tests/test_batch_size_invariance.py::test_trace_batch_invariant[seq_lengths1-20] - AssertionError: Scalars are not close!
>
> Expected 1.231401894309304 but got 0.8983965093439276.
> Absolute difference: 0.33300538496537635 (up to 1e-4 allowed)
> Relative difference: 0.27042786478102654 (up to 0.01 allowed)
The condition `if not hessian_cfg.use_dataset_labels:` was inverted,
causing the empirical Fisher (with dataset labels) to use sampled
labels and vice versa.

Add test_fim_accuracy.py which verifies that KFAC approximates the
Fisher Information Matrix within tolerance for both empirical FIM
(dataset labels) and true FIM (sampled labels).
This is still missing FSDP support and test_apply_ekfac.py from
EleutherAI#68

Co-Authored-By: LouisYRYJ <[email protected]>
@LouisYRYJ LouisYRYJ merged commit 6eedb83 into EleutherAI:ekfac-final Jan 16, 2026
3 of 4 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