Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FEAT: Wire GCG extension protocol implementations#2070

Open
romanlutz wants to merge 2 commits into
microsoft:mainfrom
romanlutz:push-clean-history
Open

FEAT: Wire GCG extension protocol implementations#2070
romanlutz wants to merge 2 commits into
microsoft:mainfrom
romanlutz:push-clean-history

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

This continues the GCG protocol refactor by making the extension interfaces the active runtime path while preserving current behavior when callers do not provide custom implementations.

  • Added optional extension fields to GCGAlgorithmConfig: sampling, loss, candidate_filter, and suffix_init.
  • Added runtime protocol validation for those fields.
  • Wired GCGMultiPromptAttack.step to dispatch through protocol objects.
    • If unset, it falls back to built-in defaults (StandardGCGSampling, CrossEntropyLoss, LengthPreservingFilter) to preserve legacy behavior.
    • If set, the custom implementations are used.
  • Wired GCGGenerator setup/orchestration so:
    • sampling / loss / candidate_filter are bound into the MPA factory.
    • suffix_init resolves the initial control string when provided, otherwise control_init is used.
  • Added extension implementation names to the generator identifier metadata.

Tests and Documentation

  • Added/updated unit tests:
    • tests/unit/auxiliary_attacks/gcg/test_config.py
    • tests/unit/auxiliary_attacks/gcg/test_generator.py
    • tests/unit/auxiliary_attacks/gcg/test_gcg_core.py
  • Ran GCG unit test suites (uv run pytest ...): 30 passed, 7 skipped.
  • Ran pre-commit hooks on touched files (uv run pre-commit run --files ...).
  • Documentation: N/A for user-facing docs in this step.

romanlutz and others added 2 commits June 22, 2026 13:11
Add optional protocol fields on GCGAlgorithmConfig and wire GCGMultiPromptAttack.step to dispatch through protocol objects with default fallbacks that preserve legacy behavior when unset. Also wire suffix initialization through config and add unit coverage for config validation, manager wiring, default parity, and custom dispatch.

Co-authored-by: Copilot <[email protected]>
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