Skip to content

Fix BeamSearchStrategy config validation, candidate schema, and PTX fingerprint logging - #146

Open
jayden1711 wants to merge 1 commit into
meta-pytorch:mainfrom
jayden1711:main
Open

Fix BeamSearchStrategy config validation, candidate schema, and PTX fingerprint logging#146
jayden1711 wants to merge 1 commit into
meta-pytorch:mainfrom
jayden1711:main

Conversation

@jayden1711

Copy link
Copy Markdown

Closes #145

Summary:
Three fixes in the beam search strategy and PTX fingerprinting infrastructure.

BeamSearchStrategy accepted num_expanding_parents=0 and negative values
without error. A value of 0 causes select_candidates() to return an empty
list, spawning zero workers per round and silently consuming all max_rounds
with no optimization progress.

BeamSearchStrategy candidate dicts were also missing the inspirations key
required by the SearchStrategy Protocol. GreedyStrategy already provides
this key. BeamSearchStrategy did not, leaving a schema inconsistency that
would cause future Mutator implementations to silently receive no inspiration
context under beam search.

ptx_hash_from_cache silently skipped unreadable PTX files with no log output,
returning an incomplete fingerprint with no indication to the caller.

Changes:

  • Guard num_expanding_parents against 0 and negative values by clamping to 1
    with a warning; preserve None (expand all) as a valid input
  • Add missing inspirations key to beam search candidate dicts, populated via
    database.sample_inspirations() with the parent kernel excluded
  • Extend SimpleMutator.build_prompt to accept and render inspirations as
    reference kernels in the optimization prompt
  • Log a warning in ptx_hash_from_cache when a PTX file cannot be read
    instead of silently skipping it
  • Add first test coverage for BeamSearchStrategy and ptx_hash_from_cache

Testing:
19 new tests added. All 72 existing tests pass.

…int logging

- Guard num_expanding_parents against 0 and negative values by clamping
  to 1 with a warning; previously a value of 0 caused select_candidates()
  to return no candidates, silently wasting entire optimization rounds
- Add None guard so num_expanding_parents=None (expand all) is preserved
- Add missing 'inspirations' key to beam search candidate dicts to match
  the SearchStrategy Protocol contract already honored by GreedyStrategy;
  populates via database.sample_inspirations() with the parent excluded
- Extend SimpleMutator.build_prompt to accept and render inspirations
  as reference kernels in the optimization prompt
- Log a warning in ptx_hash_from_cache when a PTX file cannot be read
  instead of silently skipping it, so callers know the fingerprint may
  be incomplete
- Add tests for BeamSearchStrategy config validation, candidate schema
  contract, and worker fanout math
- Add tests for ptx_hash_from_cache normalization invariants, constant
  preservation, and directory edge cases
@meta-cla

meta-cla Bot commented Jul 20, 2026

Copy link
Copy Markdown

Hi @jayden1711!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 20, 2026
@meta-cla

meta-cla Bot commented Jul 20, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BeamSearchStrategy: silent worker starvation when num_expanding_parents=0

1 participant