Skip to content

[recipe] Add McPAL — PAL's search configuration with MAC's gradient momentum - #9

Merged
matanbt merged 1 commit into
mainfrom
recipe/mcpal
Aug 3, 2026
Merged

[recipe] Add McPAL — PAL's search configuration with MAC's gradient momentum#9
matanbt merged 1 commit into
mainfrom
recipe/mcpal

Conversation

@matanbt

@matanbt matanbt commented Aug 3, 2026

Copy link
Copy Markdown
Owner

What

Adds mcpal to the Recipe Hub. It crosses two recipes already hosted here,
differing from each by exactly one knob:

vs pal__sitawarin2024 vs mac__zhang2024
momentum 0 → 0.6 same
n_candidates same (128) 256 → 128

PAL contributes the search budget — 128 candidates from a top-256 gradient
ranking, single-token replacement, 1.1× oversampling. MAC contributes momentum
on the ranking gradient, m ← μ·m + (1−μ)·grad, μ=0.6.

Uses GCGPlusOptimizer, since PALOptimizer has no momentum. PAL's two
remaining parameters are no-ops under a self-proxy — proxy filtering is disabled
whenever proxy_model is model, and its unconditional retokenization is
use_retokenize=True — both noted in the docstring.

No reproduction tag, per the naming convention: this is a crossover of two
methods, not a reproduction of either paper.

Why

Momentum and candidate budget are the two axes these recipes differ on, and the
hub currently exposes them only in their published pairings — PAL without
momentum, MAC with a 256-candidate budget. mcpal fills the remaining corner,
so the two can be varied independently from a hosted starting point.

Checks

  • ruff check — passes on the new file
  • ty check — passes on the new file
  • ruff format --check — the new file is already formatted

tropt/recipe_hub/__init__.py fails ruff format --check both before and
after
this change (verified by stashing), so it is pre-existing. Left
untouched rather than mixing unrelated reformatting into this PR — happy to fix
it separately if you'd prefer.

I could not run the full pytest suite here (no pydantic in the sandbox
interpreter), so CI is the authority on that. The change is additive: one new
module, one registry entry, one README row.

Files

  • tropt/recipe_hub/McPAL.py — new
  • tropt/recipe_hub/__init__.py — import + "mcpal" registry entry
  • tropt/recipe_hub/README.md — table row

McPAL crosses two recipes already hosted here, differing from each by a single
knob: PAL's search configuration with MAC's gradient momentum.

    vs pal__sitawarin2024:  momentum 0 -> 0.6
    vs mac__zhang2024:      n_candidates 256 -> 128

PAL contributes the search budget (128 candidates from a top-256 gradient
ranking, single-token replacement, 1.1x oversampling); MAC contributes momentum
on the ranking gradient (mu=0.6).

Uses GCGPlusOptimizer since PALOptimizer has no momentum. PAL's two remaining
parameters are no-ops under a self-proxy -- proxy filtering is disabled whenever
proxy_model is model, and its unconditional retokenization is
use_retokenize=True -- both noted in the docstring.

No reproduction tag: this is a crossover of two methods, not a reproduction of
either paper.

Checks: ruff check and ty check pass on the new file, and ruff format reports it
already formatted. recipe_hub/__init__.py fails ruff format both before and
after this change, so that is pre-existing and deliberately left untouched
rather than mixed into this PR.
@matanbt
matanbt merged commit b3d984c into main Aug 3, 2026
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.

1 participant