File size: 3,089 Bytes
af61b34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Streaming Intent Router Configuration
# HMM-style belief updating for STT chunk processing

intents:
  - ESCALATION
  - APPOINTMENT
  - MEDICATION
  - SYMPTOM_CHECK
  - BILLING
  - GENERAL_INQUIRY
  - OTHER

# Prior distribution (initial belief state)
prior:
  ESCALATION: 0.05
  APPOINTMENT: 0.15
  MEDICATION: 0.15
  SYMPTOM_CHECK: 0.15
  BILLING: 0.10
  GENERAL_INQUIRY: 0.15
  OTHER: 0.25

# Transition matrix T[i,j] = P(intent_t=j | intent_{t-1}=i)
# Rows must sum to 1.0
# High diagonal = "stickiness" (intent tends to persist)
transition_matrix:
  ESCALATION:
    ESCALATION: 0.90
    APPOINTMENT: 0.01
    MEDICATION: 0.02
    SYMPTOM_CHECK: 0.02
    BILLING: 0.01
    GENERAL_INQUIRY: 0.02
    OTHER: 0.02
  APPOINTMENT:
    ESCALATION: 0.02
    APPOINTMENT: 0.80
    MEDICATION: 0.03
    SYMPTOM_CHECK: 0.03
    BILLING: 0.07
    GENERAL_INQUIRY: 0.03
    OTHER: 0.02
  MEDICATION:
    ESCALATION: 0.04
    APPOINTMENT: 0.03
    MEDICATION: 0.82
    SYMPTOM_CHECK: 0.04
    BILLING: 0.02
    GENERAL_INQUIRY: 0.03
    OTHER: 0.02
  SYMPTOM_CHECK:
    ESCALATION: 0.08
    APPOINTMENT: 0.04
    MEDICATION: 0.05
    SYMPTOM_CHECK: 0.75
    BILLING: 0.02
    GENERAL_INQUIRY: 0.03
    OTHER: 0.03
  BILLING:
    ESCALATION: 0.01
    APPOINTMENT: 0.05
    MEDICATION: 0.02
    SYMPTOM_CHECK: 0.02
    BILLING: 0.85
    GENERAL_INQUIRY: 0.03
    OTHER: 0.02
  GENERAL_INQUIRY:
    ESCALATION: 0.03
    APPOINTMENT: 0.05
    MEDICATION: 0.05
    SYMPTOM_CHECK: 0.05
    BILLING: 0.04
    GENERAL_INQUIRY: 0.75
    OTHER: 0.03
  OTHER:
    ESCALATION: 0.02
    APPOINTMENT: 0.08
    MEDICATION: 0.08
    SYMPTOM_CHECK: 0.08
    BILLING: 0.06
    GENERAL_INQUIRY: 0.08
    OTHER: 0.60

# Emission model parameters
emission:
  alpha: 1.5          # Sharpening exponent for DriveHealthBERT probabilities
  epsilon: 1.0e-8     # Smoothing to avoid zero probabilities

# Decision thresholds
thresholds:
  theta_hi: 0.85      # Immediate escalation threshold
  theta_med: 0.60     # Consecutive-steps escalation threshold
  theta_lock: 0.70    # Commit threshold for non-escalation intents
  K: 3                # Required consecutive steps for stability

# Rolling window parameters
window:
  max_tokens: 64      # Default max tokens in rolling window
  max_tokens_limit: 128  # Hard limit for max_tokens

# Debounce parameters
debounce:
  debounce_ms: 150    # Minimum ms between updates (unless is_final)
  min_change_chars: 3 # Minimum character change to trigger update

# Model parameters
model:
  max_length: 48      # Max sequence length for BioClinicalBERT inference (reduced for latency)

# SPRT (Sequential Probability Ratio Test) parameters
# Used for statistically-principled escalation decisions
sprt:
  alpha: 0.05         # Type I error target (false escalation rate)
  beta: 0.10          # Type II error target (missed escalation rate)
  p0: 0.20            # H0: baseline escalation probability (non-escalation)
  p1: 0.60            # H1: expected escalation probability (true escalation)
  # Note: Run scripts/evaluate_sprt_streaming.py --estimate_p0_p1 to tune these