Skip to content

Conversation

@yehudit1987
Copy link
Contributor

Fix critical PII detection inconsistency where EMAIL_ADDRESS was not
detected while US_SSN was correctly blocked. Root cause: the Rust FFI
only used TraditionalBertTokenClassifier without fallback to ModernBERT.

Changes:

Rust FFI (candle-binding/src/ffi/classify.rs):

  • Add ModernBERT fallback when TraditionalBERT classifier unavailable
  • Return explicit results with proper error messages per classifier type
  • Let Go layer handle confidence threshold (configured at 0.7)

PII Policy (src/semantic-router/pkg/utils/pii/policy.go):

  • Add BIO-tag prefix stripping (B-, I-, O-, E-) for flexible matching
  • "ORGANIZATION" in config now matches "B-ORGANIZATION" from model
  • Validate only known BIO prefixes for security

Response Headers (src/semantic-router/pkg/utils/http/response.go):

  • Add x-vsr-pii-types header exposing detected PII types
  • Improves debuggability when requests are blocked

Configuration (3 files):

  • Allow ORGANIZATION type for biology queries (false positive fix)
  • Allow GPE type for general knowledge queries (country names)

E2E Tests:

  • Refactor plugin_chain_execution.go to load cases from JSON
  • Add testdata/plugin_chain_cases.json with 23 comprehensive cases
  • Cover EMAIL, SSN, phone numbers, clean queries, and edge cases

Fixes #712

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit 70918a2
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/693137d3f758ff00082d8aed
😎 Deploy Preview https://deploy-preview-765--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.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

👥 vLLM Semantic Team Notification

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

📁 candle-binding

Owners: @rootfs
Files changed:

  • candle-binding/src/ffi/classify.rs

📁 deploy

Owners: @rootfs, @Xunzhuo
Files changed:

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

📁 e2e

Owners: @Xunzhuo
Files changed:

  • e2e/profiles/ai-gateway/profile.go
  • e2e/profiles/ai-gateway/values.yaml
  • e2e/profiles/aibrix/profile.go
  • e2e/profiles/dynamic-config/crds/intelligentroute.yaml
  • e2e/testcases/plugin_chain_execution.go
  • e2e/testcases/testdata/plugin_chain_cases.json

📁 src

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

  • src/semantic-router/pkg/headers/headers.go
  • src/semantic-router/pkg/utils/http/response.go
  • src/semantic-router/pkg/utils/pii/policy.go

vLLM

🎉 Thanks for your contributions!

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

@yehudit1987 yehudit1987 force-pushed the fix_pii_errors branch 3 times, most recently from 0cb5181 to a08d00c Compare December 3, 2025 13:13
@rootfs rootfs requested a review from yossiovadia December 3, 2025 15:26
Signed-off-by: Yehudit Kerido <[email protected]>
@yehudit1987 yehudit1987 marked this pull request as ready for review December 4, 2025 08:43
@rootfs rootfs merged commit 2addb78 into vllm-project:main Dec 4, 2025
32 checks passed
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] PII Detection Inconsistent Across Types - EMAIL_ADDRESS Not Detected

5 participants