Skip to content

Commit f51cf99

Browse files
committed
fix: enable LoRA intent classification and optimize PII threshold
- Fix IsCategoryEnabled() to check correct config path - Switch default config from ModernBERT to LoRA intent classifier - Raise PII threshold from 0.7 to 0.9 to reduce false positives Results: - Domain classification: 52.50% (vs ModernBERT baseline ~50%) - PII detection: 96% (minimal impact from threshold increase) Fixes #724 Signed-off-by: Yossi Ovadia <[email protected]>
1 parent 4585d11 commit f51cf99

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

config/config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ model_config:
5858
# Classifier configuration
5959
classifier:
6060
category_model:
61-
model_id: "models/category_classifier_modernbert-base_model"
62-
use_modernbert: true
61+
model_id: "models/lora_intent_classifier_bert-base-uncased_model"
6362
threshold: 0.6
6463
use_cpu: true
65-
category_mapping_path: "models/category_classifier_modernbert-base_model/category_mapping.json"
64+
category_mapping_path: "models/lora_intent_classifier_bert-base-uncased_model/category_mapping.json"
6665
pii_model:
6766
model_id: "models/pii_classifier_modernbert-base_presidio_token_model"
6867
use_modernbert: true

e2e/profiles/ai-gateway/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ config:
471471
# When model_type is "auto", the system will auto-detect LoRA configuration
472472
model_id: "models/lora_pii_detector_bert-base-uncased_model"
473473
use_modernbert: false # Use LoRA PII model with auto-detection
474-
threshold: 0.7
474+
threshold: 0.9
475475
use_cpu: true
476476
pii_mapping_path: "models/pii_classifier_modernbert-base_presidio_token_model/pii_type_mapping.json"
477477

src/semantic-router/pkg/classification/classifier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func NewClassifier(cfg *config.RouterConfig, categoryMapping *CategoryMapping, p
377377

378378
// IsCategoryEnabled checks if category classification is properly configured
379379
func (c *Classifier) IsCategoryEnabled() bool {
380-
return c.Config.CategoryModel.ModelID != "" && c.Config.CategoryMappingPath != "" && c.CategoryMapping != nil
380+
return c.Config.CategoryModel.ModelID != "" && c.Config.CategoryModel.CategoryMappingPath != "" && c.CategoryMapping != nil
381381
}
382382

383383
// initializeCategoryClassifier initializes the category classification model

0 commit comments

Comments
 (0)