FEAT Add generic GCG model adapters and an open-weight SLM compatibility matrix
Maintainer thường phản hồi trong vòng 1 ngày
@devangpratap đang làm issue này rồi.
Từ ngày 16/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Is your feature request related to a problem? Please describe.
GCG loads models through AutoModelForCausalLM, but its gradient path still hard-codes exact classes for GPT-2/GPT-J, GPT-NeoX, Llama, Mistral/Mixtral, and Phi-3. A newly supported Hugging Face causal model can therefore load successfully and then fail when GCG tries to obtain its input embeddings.
Prompt slicing also assumes a tokenizer with a usable chat template and character-to-token mapping. There is no explicit preflight check or maintained compatibility matrix, so unsupported tokenizer behavior may fail late or silently compute incorrect goal, control, or target slices.
We want GCG to support the leading open-weight small language model families without losing its multi-model, multi-prompt, held-out evaluation, or progressive optimization capabilities.
Describe the solution you'd like
Introduce small model and tokenizer adapter interfaces for GCG.
The model adapter should:
- use the standard Hugging Face
get_input_embeddings()contract instead of architecture-specificisinstancebranches where possible; - expose the embedding matrix, device, dtype, vocabulary size, and relevant cache capabilities;
- validate that the model supports differentiable causal-LM input-embedding optimization;
- produce actionable capability errors before worker processes and long-running optimization begin.
The tokenizer adapter should:
- render conversations using the tokenizer's chat template;
- locate goal, control, assistant-role, and target token slices robustly;
- validate decode/encode round trips and vocabulary compatibility;
- expose a stable tokenizer/vocabulary identity that later multi-model aggregation work can use safely;
- allow narrowly scoped family-specific behavior only when the standard Hugging Face interfaces are insufficient.
Create and document an initial compatibility matrix for representative causal text models/tokenizers from these open-weight SLM families: Qwen, Phi, Gemma, Llama, Mistral/Mixtral/Nemo, SmolLM, and applicable DeepSeek-distilled models. Keep the matrix architecture-based so new checkpoints can be added without copying model-specific attack code.
Acceptance criteria:
- The hard-coded embedding helper branches are replaced by the adapter contract or reduced to documented exceptions.
- Every supported family has tokenizer/template/slice tests using a small representative tokenizer and a tiny or randomly initialized compatible model where practical.
- At least one opt-in GPU smoke test exercises the complete gradient and candidate-scoring path for representative modern architectures.
- Unsupported models fail during preflight with a clear explanation of the missing capability.
- Adding support for another standard Hugging Face causal architecture normally requires a compatibility test or adapter registration, not edits to the core GCG optimization loop.
- Existing single-model, arbitrary multi-model, single-prompt, multi-prompt, held-out evaluation, and progressive model/goal behavior are preserved.
- Support must not be restricted to a single model, exactly two models, or a single shared prompt.
Describe alternatives you've considered, if relevant
We could continue adding architecture-specific isinstance branches, but that does not scale with the Hugging Face model ecosystem and leaves tokenizer assumptions implicit. Replacing PyRIT's implementation with a single-model GCG library would simplify compatibility but would lose PyRIT's multi-model, multi-prompt, and progressive optimization properties.
Additional context
Track this as a focused child of #960. Coordinate performance-related cache work with #962, but keep prefix caching, quantization, model sharding, and heterogeneous-tokenizer gradient aggregation as separate changes so this issue remains reviewable.
- Ngôn ngữ chính
- Python
- Star
- 4.5k
- Fork
- 896
- Merge trung bình
- 3 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 208
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/PyRIT
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 91/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: triage GUI help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
microsoft/PyRIT#2868 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/PyRIT
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
solana-foundation/pay-kit#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nasa/python_cmr#123 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
EleutherAI/lm-evaluation-harness#4243 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: dashboard bug perceived difficulty: 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
cusp-ai-oss/tojax#17 ·