-
Notifications
You must be signed in to change notification settings - Fork 298
[Feat] add unified jailbreak classifier with LazyLock optimization and bench #727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Feat] add unified jailbreak classifier with LazyLock optimization and bench #727
Conversation
✅ Deploy Preview for vllm-semantic-router ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
👥 vLLM Semantic Team NotificationThe following members have been identified for the changed files in this PR and have been automatically assigned: 📁
|
… benchmarks - Implement unified jailbreak model factory with auto-detection from config.json - Supports ModernBERT, DeBERTa V3, and Qwen3Guard models - Automatic architecture detection and model loading - Performance optimizations: - Use LazyLock for static default labels (zero-cost after init) - Use parking_lot::Mutex instead of std::sync::Mutex for Qwen3Guard - Lock-free classification for ModernBERT and DeBERTa (Arc-wrapped) - Early lock release in Qwen3Guard to minimize hold time - Add comprehensive Go benchmark suite: - Test all jailbreak models (ModernBERT, DeBERTa, Unified, Qwen3Guard) - Measure accuracy, confidence, and latency percentiles (p50/p95/p99) - Test both CPU and GPU performance - Benchmark results show DeBERTa V3 achieves 95% accuracy - Update FFI bindings: - Add init_unified_jailbreak_classifier and classify_unified_jailbreak_text - Update ClassificationResult to include label field - Rename 'class' to 'predicted_class' for consistency - Add HuggingFace model ID support in unified factory - Auto-fetch config.json from HuggingFace Hub - Support both local paths and HF model IDs - Add unit tests for unified jailbreak classifier - Tests in semantic-router_test.go, config_test.go, extproc_test.go - Fix test compilation errors with proper struct field usage - Update Go interfaces to use unified classifier by default - Deprecate useModernBERT flag in favor of auto-detection Signed-off-by: Yue Zhu <16687552+yuezhu1@users.noreply.github.com>
00353af to
9cc3049
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

add unified jailbreak classifier with LazyLock optimization and bench
Implement unified jailbreak model factory with auto-detection from config.json
Performance optimizations:
Add comprehensive Go benchmark suite:
Update FFI bindings:
Add HuggingFace model ID support in unified factory
Add unit tests for unified jailbreak classifier
Update Go interfaces to use unified classifier by default
BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
-swhen doinggit commit[Bugfix],[Feat], and[CI].Detailed Checklist (Click to Expand)
Thank you for your contribution to semantic-router! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]for bug fixes.[CI/Build]for build or continuous integration improvements.[Doc]for documentation fixes and improvements.[Feat]for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).[Router]for changes to thevllm_router(e.g., routing algorithm, router observability, etc.).[Misc]for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
pre-committo format your code. SeeREADME.mdfor installation.DCO and Signed-off-by
When contributing changes to this project, you must agree to the DCO. Commits must include a
Signed-off-by:header which certifies agreement with the terms of the DCO.Using
-swithgit commitwill automatically add this header.What to Expect for the Reviews