Skip to content

FEAT Faster Greedy Coordinate Gradient algorithm (GCG) #962

Closed

Description

@romanlutz

Is your feature request related to a problem? Please describe.

There are several papers or blogs claiming to speed up GCG.

Describe the solution you'd like

Having a faster version of GCG would help a lot because it currently takes at least an hour to generate single suffix.

Activity

  1. added
    enhancement
    help wanted
    on Jun 14, 2025
  2. riyosha commented on Dec 6, 2025

    @riyosha
    Contributor

    Hi, I'm interested in taking up this issue if no one else is working on it!

  3. 0xm00n commented on Dec 6, 2025

    @0xm00n
    Contributor

    would like to work on this as well. Riyosha Sharma (@riyosha) would you be open to collaboration?

  4. romanlutz commented on Dec 7, 2025

    @romanlutz
    ContributorAuthor

    Note: This is potentially very challenging. You would have to have GPUs to run GCG and the alternatives, and even run it several times to show that it works well and is truly faster.

  5. 0xm00n commented on Dec 7, 2025

    @0xm00n
    Contributor

    yes, i have access to an A100 gpu and also H100s.

  6. romanlutz commented on Dec 7, 2025

    @romanlutz
    ContributorAuthor

    Great! Feel free to try this out then! One thing I'll say up front: the current implementation is essentially a copy of the original research code with light modifications. There are no tests. For obvious reasons, that is not ideal. Hopefully, for the next iteration of GCG we can improve that. I think knowing that you're not breaking things also makes development easier.

    Riyosha Sharma (@riyosha) feel free to coordinate with Royce Moon (@0xm00n) depending on whether you have GPUs. There are multiple alternatives so you could each pick one, for example. If you don't have GPUs it may be better to pick a different issue.

  7. riyosha commented on Dec 11, 2025

    @riyosha
    Contributor

    Royce Moon (@0xm00n) hi! lmk your preferred method to communicate

  8. 0xm00n commented on Dec 12, 2025

    @0xm00n
    Contributor

    Riyosha Sharma (@riyosha) i prefer discord if you have. will connect with you on linkedin to send it.

  9. romanlutz commented on May 27, 2026

    @romanlutz
    ContributorAuthor

    4B5F5F4B true, but I want to be careful. Other implementations just dropped the multi-model capabilities which I think are important for transferability.

  10. JayYarlagadda commented on Aug 3, 2026

    @JayYarlagadda
    Contributor

    Hi, I'm interested in contributing to this issue. I noticed it is currently assigned to Royce Moon (@0xm00n) and Riyosha Sharma (@riyosha), but there is no linked PR. Is this work still active?

    If additional help is useful, I'd be happy to collaborate or take ownership of a separate benchmark-backed slice. I'm particularly interested in investigating probe sampling while preserving PyRIT's multi-model and multi-prompt behavior. I would first establish a reproducible baseline and agree on the benchmark matrix before making substantial implementation changes.

    Roman Lutz (@romanlutz), would this direction be useful, and is there a specific slice you would prefer me to take?

  11. romanlutz commented on Aug 3, 2026

    @romanlutz
    ContributorAuthor

    Feel free to investigate. I think the only person trying things is me right now. I want to preserve the features of GCG without losing multi-model and other features.

    If you find ways to improve things please keep the changesets as small as possible and elaborate on what it's improving. I'm doing the same. Speedup and generalization are important right now.

  12. JayYarlagadda commented on Aug 5, 2026

    @JayYarlagadda
    Contributor

    Thanks, Roman. I'll start by profiling the current candidate-evaluation path and establishing a reproducible baseline, while preserving multi-model and multi-prompt behavior. I'll keep the first proposed change narrowly scoped and share measurements and the benchmark configuration before opening a larger implementation PR.

  13. romanlutz commented on Sep 22, 2026

    @romanlutz
    ContributorAuthor

    Jayanth Yarlagadda (@JayYarlagadda) any updates? Still interested in this?

  14. JayYarlagadda commented on Sep 22, 2026

    @JayYarlagadda
    Contributor

    Hey, yes—still interested. I did some initial profiling and test work in early August, then paused before making an implementation change. I’m picking it back up now: I’ll refresh against current main, rerun the baseline, and share a focused proposal before opening a PR.

  15. JayYarlagadda commented on Sep 26, 2026

    @JayYarlagadda
    Contributor

    Hey Roman Lutz (@romanlutz) — quick update before I open the PR, as promised.

    Profiling showed that candidate evaluation was spending most of its time and memory producing full-vocabulary logits for every candidate and transferring them back to the parent process. I took a focused pass at that path while keeping the existing multi-prompt and multi-worker design: built-in cross-entropy is computed in the model worker, compatible models only project the logit positions used by the loss, and prompt-prefix KV reuse is available as an opt-in setting.

    Across three paired runs on an A40 with Qwen2.5-7B-Instruct, median full-step time improved by 31.0% for one prompt and 37.7% for two prompts with transfer enabled. Peak GPU memory dropped from about 40.5 GiB to 24.9 GiB. All paired runs selected the same final suffix and step count; the largest fp16 loss-history difference was 0.0022.

    I also added coverage for the optimized built-in loss path, including multi-worker accumulation. The GCG suite is passing with 325 tests. I’ll link the focused PR here next.

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

Metadata

Metadata

Labels

enhancementhelp wanted

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions