Skip to content

Conversation

@juaristi22
Copy link
Collaborator

@juaristi22 juaristi22 commented Aug 15, 2025

Fix #84

@vercel
Copy link

vercel bot commented Aug 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
microcalibrate Ready Ready Preview Comment Aug 18, 2025 11:12am

@juaristi22
Copy link
Collaborator Author

All existing tests (including a specific regularization test) passed though maybe we want to add some more comprehensive ones. Any specific gate behavior it is crucial to capture @baogorek ?

Copy link
Collaborator

@baogorek baogorek left a comment

Choose a reason for hiding this comment

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

All good. I was just a bit confused because I thought we had moved to a claude-code refactored version of the code at https://github.com/AMLab-Amsterdam/L0_regularization. Now I see that it is a fork of that codebase, but that we have brought in our own HardConcrete class, so by importing that class, we're bypassing the functionality from the external github package.

I think that's fine for now, as this PR still contributes modularity to this repo. I still have doubts about our L0 implementation (which I vibe-coded), so I will spend some time there. FYI @MaxGhenis

@MaxGhenis
Copy link

I don't follow Ben - isn't this moving from your version of L0 to the version I vibe-coded in the L0 package?

@baogorek
Copy link
Collaborator

@MaxGhenis , what led me to believe that was noticing that the interface to the procedure is exactly identical in this PR:
image

Then, here's what Claude Code said about it:

  PolicyEngine's l0-python package is a hybrid:                                                                                                                             
                                                                                                                                                                            
  1. HardConcrete class: This is YOUR original implementation from src/microcalibrate/utils/l0.py                                                                           
    - Same exact interface: HardConcrete(input_dim, output_dim=None, temperature=0.5, stretch=0.1, init_mean=0.5)                                                           
    - Same get_penalty() method implementation                                                                                                                              
    - Just added more documentation                                                                                                                                         
  2. New additions (not in your original code):                                                                                                                             
    - layers.py with L0Linear, L0Conv2d, etc.                                                                                                                               
    - gates.py with various gate types                                                                                                                                      
    - penalties.py with penalty computation utilities                                 
  3. Not a direct AMLab fork:                                                                                                                                               
    - AMLab has L0Dense with different parameters: droprate_init, lamba, local_rep                                                                                          
    - PolicyEngine has L0Linear with different parameters: init_sparsity, use_l2                                                                                            
    - Different interfaces and naming conventions            

Yeah, I just checked. There's no HardConcrete class in the AMLab-Amsterdam repo. I'm guessing Claude Code knew about it when it was doing the cleanup?

Not surprisingly (since it's parent LLM made it), Claude loves our HardConcrete class and thinks we should keep using it.

@juaristi22 juaristi22 merged commit 3e5663b into main Aug 22, 2025
6 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.

Move to PolicyEngine's L0 package for regularization

4 participants