Skip to content

Add per-parent rejected-proposal memory (fixes #379)#384

Open
aranya-chatterjee wants to merge 1 commit into
gepa-ai:mainfrom
aranya-chatterjee:fix-379-rejection-memory
Open

Add per-parent rejected-proposal memory (fixes #379)#384
aranya-chatterjee wants to merge 1 commit into
gepa-ai:mainfrom
aranya-chatterjee:fix-379-rejection-memory

Conversation

@aranya-chatterjee

Copy link
Copy Markdown

Fixes #379

Adds per-parent memory of rejected reflective-mutation attempts so the same parent doesn't regenerate the identical failed mutation indefinitely.

Changes:

  • GEPAState.rejected_proposals_by_parent: dict[ProgramIdx, list[RejectionRecord]] (schema v6, backward-compatible with existing run_dirs)
  • Populated in _accept_reflective_proposal's reject branch (engine.py), keyed by parent program id
  • Surfaced in the reflection prompt (reflective_mutation.py) under "Earlier attempted edits from this parent and what went wrong" -- purely informational, not a hard tabu list
  • Bounded to last 3 rejections per parent to avoid context bloat on hot parents

Tests: tests/test_rejected_proposal_memory.py -- covers state persistence, backward-compat load from pre-fix run_dirs, prompt-threading behavior (no history on first attempt, history surfaces on repeat parent, bounded to 3). All passing, no regressions in existing suite.

@semanticdiff-com

semanticdiff-com Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  src/gepa/core/engine.py  35% smaller
  src/gepa/proposer/reflective_mutation/reflective_mutation.py  4% smaller
  src/gepa/core/state.py  0% smaller
  tests/test_rejected_proposal_memory.py  0% smaller

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.

GEPA doesn't remember rejected proposals — re-sampling the same parent repeats the same failed mutation

1 participant