Skip to content

Conversation

@VolodyaCO
Copy link
Collaborator

This PR adds an orthogonal layer given by Givens rotations, using the parallel algorithm described by Firas in https://arxiv.org/abs/2106.00003, which gives a forward complexity of O(n) and backward complexity of O(n log(n)), even though there are O(n^2) rotations.

This PR still is in draft. I wrote it for even n. Probably some more unit tests are to be done, but I am quite lazy (will do it after all math is checked for odd n).

@VolodyaCO VolodyaCO requested a review from kevinchern December 19, 2025 00:01
@VolodyaCO VolodyaCO self-assigned this Dec 19, 2025
@VolodyaCO VolodyaCO added the enhancement New feature or request label Dec 19, 2025
@VolodyaCO
Copy link
Collaborator Author

I somehow broke @kevinchern's tests, what the hell...

def test_store_config(self):
with self.subTest("Simple case"):

class MyModel(torch.nn.Module):
Copy link
Collaborator

@kevinchern kevinchern Dec 19, 2025

Choose a reason for hiding this comment

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

Remove formatting changes. Is this "black" formatting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I have it by default on my vscode

@kevinchern
Copy link
Collaborator

kevinchern commented Dec 19, 2025

I somehow broke @kevinchern's tests, what the hell...

@VolodyaCO which tests? I'm seeing test_forward_agreement and test_backward_agreement failures on this CI test

@VolodyaCO
Copy link
Collaborator Author

I somehow broke @kevinchern's tests, what the hell...

@VolodyaCO which tests? I'm seeing test_forward_agreement and test_backward_agreement failures on this CI test

I forgot to update my tests to float64 precision. Now that I've done it, it's weird that all of the current failing tests are failing on

  File "/Users/distiller/project/tests/test_nn.py", line 144, in test_LinearBlock
    self.assertTrue(model_probably_good(model, (din,), (dout,)))

@kevinchern
Copy link
Collaborator

I somehow broke @kevinchern's tests, what the hell...

@VolodyaCO which tests? I'm seeing test_forward_agreement and test_backward_agreement failures on this CI test

I forgot to update my tests to float64 precision. Now that I've done it, it's weird that all of the current failing tests are failing on

  File "/Users/distiller/project/tests/test_nn.py", line 144, in test_LinearBlock
    self.assertTrue(model_probably_good(model, (din,), (dout,)))

Ahhhhhh. OK Theo also flagged this at #50 . It's a poorly-written test.. you can ignore it.

Vladimir Vargas Calderón added 2 commits December 26, 2025 12:28
@VolodyaCO VolodyaCO marked this pull request as ready for review December 26, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants