Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should LLLaplace be deprecated? #254

Open
wiseodd opened this issue Nov 21, 2024 · 3 comments
Open

Should LLLaplace be deprecated? #254

wiseodd opened this issue Nov 21, 2024 · 3 comments
Labels
question Further information is requested

Comments

@wiseodd
Copy link
Collaborator

wiseodd commented Nov 21, 2024

We can achieve the same thing by switching off the grads of all but the last layer.

model = ...

for mod_name, mod in model.named_modules():
    if mod_name != "last_layer":  # or whatever
        for p in mod.parameters():
            p.requires_grad = False

la = Laplace(model, ..., subset_of_weights="all", ...)

The major pros are:

@runame @aleximmer any reasons you could think of why don't we just make LLLaplace as a simple wrapper for the above?

@wiseodd wiseodd added the question Further information is requested label Nov 21, 2024
@aleximmer
Copy link
Owner

I believe #201, although not implemented at the moment, would be a benefit of a pure LLLaplace?

@wiseodd
Copy link
Collaborator Author

wiseodd commented Nov 21, 2024

Thanks @aleximmer, that's a good point.

I believe that can also be done even if LLLaplace is just a wrapper for the gradient-switch-off above. We still know how to get feature \phi(x) in this case, and so that fast functional variance can also be computed.

I also think we can even maintain the user-facing API of LLLaplace; just the internal implementation is different: Instead of we're implementing special functions for LLLA, like last_layer_jacobians, we can just call Laplace with a proper gradient-switch-on-off.

Let me know if I missed anything!

@wiseodd
Copy link
Collaborator Author

wiseodd commented Dec 12, 2024

Supporting evidence for refactoring LLLaplace: #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants