Skip to content

fix: resolve empty/wrong domain classifications#827

Merged
rootfs merged 1 commit into
vllm-project:mainfrom
yehuditkerido:fix_domain_classification
Dec 17, 2025
Merged

fix: resolve empty/wrong domain classifications#827
rootfs merged 1 commit into
vllm-project:mainfrom
yehuditkerido:fix_domain_classification

Conversation

@yehuditkerido
Copy link
Copy Markdown
Collaborator

Fix domain classifier returning empty or incorrect categories.

Changes:

  • Add fallback to "other" when confidence < threshold (classifier.go)
  • Add ModernBERT fallback when CandleBERT fails
  • Add PII type translation: class_X → DATE_TIME (mapping.go)
  • Include category header in PII/cache responses (response.go)
  • Auto-load supplement dataset from HuggingFace (ft_linear.py)
  • Update Helm defaults to use trained model from LLM-Semantic-Router
  • Move test cases to JSON files with go:embed
  • Remove CRD-incompatible tests from dynamic-config profile

HuggingFace resources (LLM-Semantic-Router org):

  • New trained model: category_classifier_modernbert-base_trained_model
  • New supplement dataset: category-classifier-supplement (653 examples)

Resolves #714

@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 14, 2025

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit 70e51a1
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/6942bb607d722e0008d202fe
😎 Deploy Preview https://deploy-preview-827--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@yehuditkerido yehuditkerido force-pushed the fix_domain_classification branch 2 times, most recently from db737d4 to 2711b04 Compare December 14, 2025 17:49
@yehuditkerido yehuditkerido marked this pull request as ready for review December 14, 2025 18:06
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 14, 2025

👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned:

📁 deploy

Owners: @rootfs, @Xunzhuo
Files changed:

  • deploy/helm/semantic-router/values.yaml
  • deploy/kubernetes/aibrix/semantic-router-values/values.yaml

📁 e2e

Owners: @Xunzhuo
Files changed:

  • e2e/profiles/ai-gateway/values.yaml
  • e2e/profiles/dynamic-config/profile.go
  • e2e/profiles/dynamic-config/values.yaml
  • e2e/profiles/llm-d/values.yaml
  • e2e/profiles/production-stack/values.yaml
  • e2e/profiles/routing-strategies/values.yaml
  • e2e/testcases/decision_fallback.go
  • e2e/testcases/plugin_config_variations.go
  • e2e/testcases/testdata/decision_fallback_cases.json
  • e2e/testcases/testdata/domain_classify_cases.json
  • e2e/testcases/testdata/plugin_config_cases.json

📁 src

Owners: @rootfs, @Xunzhuo, @wangchen615
Files changed:

  • src/semantic-router/pkg/classification/classifier.go
  • src/semantic-router/pkg/classification/mapping.go
  • src/semantic-router/pkg/classification/mcp_classifier.go
  • src/semantic-router/pkg/config/config.go
  • src/semantic-router/pkg/extproc/req_filter_cache.go
  • src/semantic-router/pkg/extproc/req_filter_pii.go
  • src/semantic-router/pkg/utils/http/response.go
  • src/semantic-router/pkg/utils/http/response_test.go
  • src/training/classifier_model_fine_tuning/ft_linear.py

vLLM

🎉 Thanks for your contributions!

This comment was automatically generated based on the OWNER files in the repository.

@yehuditkerido yehuditkerido force-pushed the fix_domain_classification branch 5 times, most recently from 0ea9dc7 to a8973dc Compare December 16, 2025 12:47
@rootfs rootfs requested a review from Copilot December 16, 2025 15:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request resolves issues with empty or incorrect domain classifications by implementing fallback behavior, adding PII type translation, improving model loading, and consolidating test cases into JSON files.

Key Changes:

  • Implemented fallback to "other" category when classification confidence is below threshold
  • Added PII type translation from Rust binding format (class_X) to named types (e.g., DATE_TIME)
  • Auto-load supplement dataset from HuggingFace to improve fallback detection
  • Updated Helm defaults to use newly trained ModernBERT model
  • Moved test cases to JSON files with go:embed for better maintainability

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/training/classifier_model_fine_tuning/ft_linear.py Added supplement dataset loading from HuggingFace and updated training defaults
src/semantic-router/pkg/utils/http/response.go Added category and decision headers to PII and cache responses
src/semantic-router/pkg/utils/http/response_test.go Updated test calls to include new category and decision parameters
src/semantic-router/pkg/extproc/req_filter_pii.go Updated PII response call to include category parameter
src/semantic-router/pkg/extproc/req_filter_cache.go Updated cache response call to include category and decision parameters
src/semantic-router/pkg/config/config.go Added FallbackCategory configuration field
src/semantic-router/pkg/classification/mcp_classifier.go Implemented fallback category logic when confidence is below threshold
src/semantic-router/pkg/classification/mapping.go Added TranslatePIIType function for PII type translation
src/semantic-router/pkg/classification/classifier.go Added ModernBERT fallback and PII type translation in detection functions
e2e/testcases/testdata/plugin_config_cases.json New JSON file with plugin configuration test cases
e2e/testcases/testdata/domain_classify_cases.json Expanded domain classification test cases with additional examples
e2e/testcases/testdata/decision_fallback_cases.json New JSON file with decision fallback test cases
e2e/testcases/plugin_config_variations.go Refactored to load test cases from embedded JSON file
e2e/testcases/decision_fallback.go Refactored to load test cases from embedded JSON file
e2e/profiles/routing-strategies/values.yaml Updated PII model configuration
e2e/profiles/production-stack/values.yaml Updated to use ModernBERT category classifier
e2e/profiles/llm-d/values.yaml Updated to use ModernBERT and aligned decision naming
e2e/profiles/dynamic-config/values.yaml Updated to use ModernBERT category classifier
e2e/profiles/dynamic-config/profile.go Removed CRD-incompatible test cases
e2e/profiles/ai-gateway/values.yaml Updated to use ModernBERT and adjusted cache thresholds
deploy/kubernetes/aibrix/semantic-router-values/values.yaml Updated to use ModernBERT classifier
deploy/helm/semantic-router/values.yaml Changed model repository to use trained ModernBERT model

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e/profiles/production-stack/values.yaml
Comment thread e2e/profiles/llm-d/values.yaml
@yehuditkerido yehuditkerido force-pushed the fix_domain_classification branch 2 times, most recently from 3321f1e to 5402b25 Compare December 17, 2025 06:37
Signed-off-by: Yehudit Kerido <ykerido@ykerido-thinkpadp1gen7.raanaii.csb>
@yehuditkerido yehuditkerido force-pushed the fix_domain_classification branch from 5402b25 to 70e51a1 Compare December 17, 2025 14:17
@rootfs rootfs merged commit 211b46c into vllm-project:main Dec 17, 2025
37 checks passed
@yehuditkerido yehuditkerido deleted the fix_domain_classification branch December 22, 2025 06:16
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.

[Test] Domain Classifier Returns Empty or Wrong Classifications

5 participants