Skip to content

Partial shadow inheritance#387

Open
henrikfo wants to merge 5 commits intomainfrom
partial-shadow-inheritance
Open

Partial shadow inheritance#387
henrikfo wants to merge 5 commits intomainfrom
partial-shadow-inheritance

Conversation

@henrikfo
Copy link
Copy Markdown
Collaborator

@henrikfo henrikfo commented Mar 4, 2026

Description

Summary of changes
Updated the shadow model inheritance logic.

  • Partial shadow_model config inheritance was implemented so missing shadow settings now fall back to the target model setup instead of requiring a fully duplicated shadow config. That includes inherited model path/class, init params, optimizer, criterion, epochs, and batch size, while still allowing shadow-specific overrides.

Furthermore, silent faults or possibility of running leakpro with unintended setups have been reduced.

  • Shadow-model cache reuse was fixed so existing shadow models are no longer reused just because they share num_train and model_class. Reuse now checks the full effective training setup, including optimizer settings, criterion settings, init params, batch size, online/offline mode
  • Shadow_model.batch_size now actually affects training. Before the field could be present in config but be silently ignored during dataloader creation
  • Shadow metadata was expanded so saved shadow runs now record the fields needed for safe reuse decisions, including optimizer params, criterion params, batch size, and model module path
  • Tests were added to cover the new behavior: one verifies partial inheritance from the target setup, one checks partial optimizer override behavior, one ensures stale cached shadow metadata is rejected when configs differ, and one verifies that the configured shadow batch size is really used

Resolved Issues

How Has This Been Tested?

This was tested by running the celebA DP example with both target model and shadow models without DPsgd enabled. Then another time, setting only
shadow_model:
init_params:
dpsgd: True

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@henrikfo henrikfo self-assigned this Mar 4, 2026
@henrikfo henrikfo added the priority - 4 Medium low priority. Great if it is fixed. label Mar 25, 2026
@henrikfo henrikfo force-pushed the partial-shadow-inheritance branch from e1253ce to d70edfe Compare March 25, 2026 14:41
…rtial inheritance and metadata checking and reusage.
@henrikfo henrikfo linked an issue Mar 31, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority - 4 Medium low priority. Great if it is fixed. Review Needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand hashing functionality Partial shadow model inheritance

1 participant