Skip to content

fix: improve the reproducibility system#303

Merged
p-e-w merged 7 commits into
masterfrom
reproducibility-fixes
Apr 23, 2026
Merged

fix: improve the reproducibility system#303
p-e-w merged 7 commits into
masterfrom
reproducibility-fixes

Conversation

@p-e-w

@p-e-w p-e-w commented Apr 21, 2026

Copy link
Copy Markdown
Owner

This is a pretty major overhaul of #191, aiming to get it ready for the Heretic 1.3 release.

Changes include:

  • The user can now choose between uploading reproducibility information with system information, reproducibility information without system information, or no reproducibility information at all.
  • Commit handling for models and datasets actually works now.
  • Non-relevant fields are stripped from settings before saving them, improving compatibility and privacy.
  • Changed the structure of reproduce.json with a view to the future.
  • Better and more detailed reproduction instructions.
  • Configurable shard size for upload (fixes problems with some connections and improves reproducibility).
  • Lots and lots of small formatting and correctness fixes.

Examples:

@Vinay-Umrethe Requesting review!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the reproducibility system to support multiple levels of detail and includes new settings for model commits and shard sizes. Key changes include the addition of a privacy-focused settings filter and updated logic for generating reproduction assets. Feedback identifies style guide violations regarding missing default configurations, unrelated whitespace changes, and missing type annotations, alongside a suggestion to use more idiomatic Pydantic practices for attribute exclusion.

Comment thread config.default.toml
Comment thread src/heretic/config.py Outdated
Comment thread src/heretic/system.py
Comment thread src/heretic/utils.py
Comment thread src/heretic/utils.py
Comment thread src/heretic/utils.py
Comment thread src/heretic/utils.py
{accelerator_report}
- **Heretic:** v{version_info.version}{f" (Origin: {version_info.origin})" if version_info.origin else ""}
- **PyTorch:** {pytorch_version}
- **Other dependencies:** See [`requirements.txt`](requirements.txt).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't this line redundant as the 1st line just after it in contents section has requirements.txt info

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I noticed that too, but the fact is that the information legitimately belongs in both places. How would you structure it? The dependencies are part of the environment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe it's very obvious for anyone, so keeping it in any one of them is enough "See [requirements.txt]" is there not not does not matter.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I agree that this looks a bit strange, but I tried removing both references and something is clearly missing then. I prefer a bit of redundancy over confusion.

@Vinay-Umrethe Vinay-Umrethe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

done review of what I catched

Comment thread src/heretic/main.py
@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

I noticed in your conducted tests:

  1. direction_index value was Null (for basic and full test)

https://huggingface.co/p-e-w/Qwen3-4B-Instruct-2507-heretic-REPRODUCTION-TEST-4-no-sysinfo/blob/main/reproduce/reproduce.json#L227

  1. stepping value of CPU was Null (for full test)

https://huggingface.co/p-e-w/Qwen3-4B-Instruct-2507-heretic-REPRODUCTION-TEST-4/blob/main/reproduce/reproduce.json#L20

I suppose py-cpuinfo must be generic enough to do the same task of getting stepping value for both AMD and Intel CPUs even if they use different naming conventions. Or he system had some issue (unlikely) as a number is almost always associated.

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

Commit handling for models and datasets actually works now.

Previously was it not working?

Comment thread src/heretic/config.py
Comment thread src/heretic/utils.py Outdated
@p-e-w

p-e-w commented Apr 21, 2026

Copy link
Copy Markdown
Owner Author

direction_index value was Null (for basic and full test)

Correct. This is how the system expresses the "global" direction (None = no specific index). See the abliterate method.

stepping value of CPU was Null (for full test)

Yes, I noticed that. I guess not every CPU provides that information.

Commit handling for models and datasets actually works now.

Previously was it not working?

No? Did you intend to add that functionality? Because there was no relevant code at all yet. The commit was stored in the settings, but not used when fetching the datasets and model.

@p-e-w

p-e-w commented Apr 21, 2026

Copy link
Copy Markdown
Owner Author

Note to self: The dependencies are not sorted in reproduce.json. This must be fixed.

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

No? Did you intend to add that functionality? Because there was no relevant code at all yet. The commit was stored in the settings, but not used when fetching the datasets and model.

maybe I haven't checked that time was it being used or not. Correct

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

Note to self: The dependencies are not sorted in reproduce.json. This must be fixed.

Not sure what you are talking about, but I do see requirements list in reproduce.json

@p-e-w

p-e-w commented Apr 21, 2026

Copy link
Copy Markdown
Owner Author

Not sure what you are talking about, but I do see requirements list in reproduce.json

Yes, but it's not sorted.

@p-e-w

p-e-w commented Apr 21, 2026

Copy link
Copy Markdown
Owner Author

I'm also planning for the final puzzle piece: heretic --reproduce /path/to/reproduce.json.

This seems quite complicated to implement, because it will require Heretic to create a temporary venv, install the correct Heretic version and dependencies there, and then quit to hand processing over to that version of Heretic.

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

I'm also planning for the final puzzle piece: heretic --reproduce /path/to/reproduce.json.

if 1.3 will release after the reproducibility suite is automatically useable that'll take long,

This seems quite complicated to implement, because it will require Heretic to create a temporary venv, install the correct Heretic version and dependencies there, and then quit to hand processing over to that version of Heretic.

We can have a reproduce.py module to handle it entirely

@p-e-w p-e-w mentioned this pull request Apr 23, 2026
@p-e-w

p-e-w commented Apr 23, 2026

Copy link
Copy Markdown
Owner Author

if 1.3 will release after the reproducibility suite is automatically useable that'll take long,

Correct, that part won't be in the 1.3 release most likely.

Comment thread src/heretic/config.py
exclude=True,
)

max_shard_size: int | str = Field(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if This sharding logic is related to reproducibility

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The default size may change between Transformers versions (apparently, this has already happened at least once). Storing the size in settings increases the chance of reproducibility if the Transformers version doesn't match.

Comment thread src/heretic/utils.py
> [!TIP]
> **This model is reproducible!**
>
> See the [README](reproduce/README.md) in the `reproduce` directory for more information.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
> See the [README](reproduce/README.md) in the `reproduce` directory for more information.
> See the [README](reproduce/README.md) in the [reproduce](https://huggingface.co/{settings.model}/tree/main/reproduce) directory for more information.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I've thought about that but decided against it because if the model is forked, quantized etc., absolute paths will link to the wrong (parent) model. It's unfortunate that HF doesn't support linking directories properly, but hacks only create more problems.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Also, your suggestion is linking to the wrong model anyway, namely to the base model, which doesn't have a reproduce directory.

@p-e-w p-e-w merged commit 513e3ac into master Apr 23, 2026
4 checks passed
@p-e-w

p-e-w commented Apr 23, 2026

Copy link
Copy Markdown
Owner Author

Merged! Several remaining issues have been fixed and the exclusion logic for settings in particular is now much cleaner. I have re-tested everything before merging and found no more problems.

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

Merged! Several remaining issues have been fixed and the exclusion logic for settings in particular is now much cleaner. I have re-tested everything before merging and found no more problems.

yes i saw all 3 test repos

@p-e-w

p-e-w commented Apr 23, 2026

Copy link
Copy Markdown
Owner Author

I'm deleting all my test models now because many people follow my account and I don't want them to be quantized/benchmarked etc.

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

I'm deleting all my test models now because many people follow my account and I don't want them to be quantized/benchmarked etc.

Yeah I was thinking why you didn't deleted old tests, as they don't look good 👍

@Vinay-Umrethe

Copy link
Copy Markdown
Contributor

how was stepping value issue was fixed in CPU? in previous tests it was null. now it works
@p-e-w

@p-e-w

p-e-w commented Apr 25, 2026

Copy link
Copy Markdown
Owner Author

@Vinay-Umrethe

It wasn't "fixed", I changed nothing there. I believe some CPUs provide that value, while others don't. I was on a different server so I probably just got one with a CPU that has the stepping set.

Matlan1 pushed a commit to Matlan1/heretic-win-AMD that referenced this pull request Jun 13, 2026
* fix: various cleanups and improvements for the reproducibility system

* fix: save only essential settings

* fix: improve model commit handling

* feat: make including system information optional

* fix: improve formatting of reproducibility README

* fix: fix remaining issues
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