MukulRay commited on
Commit
5a47209
·
1 Parent(s): b2f5c42

Document EmpathRAG Core merged plan

Browse files
docs/CURRENT_STATUS_AUDIT_FOR_RESEARCH_MODEL.md CHANGED
@@ -1,19 +1,21 @@
1
  # EmpathRAG Current Status Audit
2
 
3
- Date: 2026-04-30
4
- Branch: `codex-v2-safety-hardening`
5
  Audience: project team, research planning, MSML demo planning
6
- Status: active V2 prototype work in progress
7
 
8
  ## 1. One-Line Summary
9
 
10
- EmpathRAG is a safety-aware student-support retrieval prototype for UMD-style mental health and campus support help seeking. The current V2 direction is not to act as a therapist, diagnostician, or emergency service; it should route student concerns to appropriate support paths, show grounded sources, and fail closed when safety risk appears.
 
 
11
 
12
  ## 2. Overall Idea
13
 
14
  The original idea was a mental-health-adjacent RAG system that can respond empathetically to student distress while grounding its answers in relevant resources.
15
 
16
- The refined V2 idea is more precise:
17
 
18
  - Detect the type of student-support need.
19
  - Detect whether the message is ordinary support, wellbeing/grounding, crisis, or emergency.
@@ -22,7 +24,22 @@ The refined V2 idea is more precise:
22
  - Show the user why the system retrieved each source.
23
  - Avoid pretending to provide therapy, diagnosis, crisis counseling, or clinical authority.
24
 
25
- This framing is much stronger for class presentation and research because it turns the project from a generic chatbot into a safety-aware support router.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ## 3. What We Have Right Now
28
 
 
1
  # EmpathRAG Current Status Audit
2
 
3
+ Date: 2026-05-01
4
+ Branch: `codex/v2.5-support-navigator`
5
  Audience: project team, research planning, MSML demo planning
6
+ Status: EmpathRAG Core consolidation in progress
7
 
8
  ## 1. One-Line Summary
9
 
10
+ EmpathRAG Core is a guarded conversational RAG system for UMD-style support navigation. It is not a therapist, diagnostician, counselor, crisis-prevention system, or emergency service; it should route student concerns to appropriate support paths, show grounded sources, and fail closed when safety risk appears.
11
+
12
+ The current research hook is not "we made a chatbot." The hook is: V1 open empathetic RAG is evaluated as a baseline, its multi-turn safety failure modes motivate the redesign, and Core is evaluated as a guarded alternative.
13
 
14
  ## 2. Overall Idea
15
 
16
  The original idea was a mental-health-adjacent RAG system that can respond empathetically to student distress while grounding its answers in relevant resources.
17
 
18
+ The refined Core idea is more precise:
19
 
20
  - Detect the type of student-support need.
21
  - Detect whether the message is ordinary support, wellbeing/grounding, crisis, or emergency.
 
24
  - Show the user why the system retrieved each source.
25
  - Avoid pretending to provide therapy, diagnosis, crisis counseling, or clinical authority.
26
 
27
+ This framing is much stronger for class presentation and research because it turns the project from a generic chatbot into a safety-aware, source-grounded support navigator.
28
+
29
+ ## 2A. Merged Reviewer Consensus
30
+
31
+ Keep these decisions locked:
32
+
33
+ - One active product direction: EmpathRAG Core.
34
+ - V1/V2/V2.5 remain checkpoints and baselines, not separate products.
35
+ - UMD specificity remains the main demo moat.
36
+ - Use synthetic labeled data only for route/safety training and evaluation.
37
+ - Do not scrape Reddit, TikTok, Discord, private chats, or real student stories for the new dataset.
38
+ - Keep V1 BERTScore/Wilcoxon/adversarial work as baseline evaluation.
39
+ - Make multi-turn V1 vs Core safety evaluation the headline result.
40
+ - Keep Integrated Gradients explainability as a named contribution.
41
+ - Use "resource registry" or "service objects" in papers/presentations, not "service graph" unless graph edges/traversal are added.
42
+ - Keep the TF-IDF/logistic router as a fast scaffold and baseline; train a RoBERTa route classifier only after Karthik delivers labeled route data.
43
 
44
  ## 3. What We Have Right Now
45
 
docs/EMPATHRAG_CORE_MASTER_CHECKLIST.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EmpathRAG Core Master Checklist
2
+
3
+ Date: 2026-05-01
4
+ Active branch: `codex/v2.5-support-navigator`
5
+ Status: one consolidated product direction; V1/V2/V2.5 are baselines/checkpoints only.
6
+
7
+ ## Core Thesis
8
+
9
+ EmpathRAG started as emotion-aware RAG for student mental-health-adjacent support. Evaluation exposed structural risks in open empathetic generation: missed escalation, sycophantic validation, dependency reinforcement, and ungrounded advice.
10
+
11
+ EmpathRAG Core is the guarded redesign: a UMD-specific conversational RAG system for support navigation, not therapy, diagnosis, counseling, crisis prevention, or clinical care.
12
+
13
+ ## Named Contributions
14
+
15
+ 1. Hybrid lexical + ML safety architecture with four-mode escalation.
16
+ 2. Multi-turn safety evaluation framework comparing V1 open RAG against Core guarded RAG.
17
+ 3. Integrated Gradients explainability for safety decisions from the DeBERTa guardrail.
18
+
19
+ Supporting engineering contributions:
20
+
21
+ - UMD-specific resource registry with service objects and verified provenance.
22
+ - Output-side groundedness and anti-sycophancy guard.
23
+ - Peer-helper mode for "I am worried about someone else" scenarios.
24
+
25
+ ## Phase 1: Resource Registry
26
+
27
+ - [x] Preserve curated UMD corpus and source metadata.
28
+ - [x] Add profile path scaffold under `data/profiles/umd/`.
29
+ - [ ] Rename paper/docs wording from "service graph" to "resource registry", "service objects", or "service-tagged resource schema".
30
+ - [ ] Expand UMD service objects toward roughly 80 verified entries if time allows.
31
+ - [ ] Add/verify UMD-specific high-value resources:
32
+ - [ ] Counseling Center
33
+ - [ ] After-hours crisis support
34
+ - [ ] ADS
35
+ - [ ] Graduate Ombuds
36
+ - [ ] Graduate School support
37
+ - [ ] Campus Pantry / basic-needs support if verified
38
+ - [ ] CARE to Stop Violence if verified
39
+ - [ ] MHEART if verified
40
+ - [ ] Use `unknown` for missing hours/location/contact; never invent details.
41
+
42
+ ## Phase 2: Core Pipeline
43
+
44
+ - [x] Add unified `EmpathRAGCore.run_turn(...)` runtime interface.
45
+ - [x] Keep fast demo startup reliable.
46
+ - [x] Add TF-IDF/logistic route and tier classifier scaffold.
47
+ - [x] Keep deterministic fallback when model artifacts are missing.
48
+ - [x] Add output metadata for route, tier, confidence, retrieval mode, output guard, and latency.
49
+ - [ ] Make hard lexical safety precheck an explicit Stage 1 before any ML classifier.
50
+ - [ ] Optionally call the real DeBERTa safety guardrail for deeper eval and explainability.
51
+ - [ ] Keep Integrated Gradients available for safety decisions without blocking the live demo.
52
+ - [ ] Add RoBERTa route classifier only after labeled route dataset exists.
53
+
54
+ Router ablation plan:
55
+
56
+ - [x] Rule router baseline.
57
+ - [x] TF-IDF/logistic router baseline.
58
+ - [ ] RoBERTa route classifier trained on Karthik's labeled synthetic data.
59
+ - [ ] Full hybrid system: lexical safety + ML routing + resource registry retrieval + output guard.
60
+
61
+ ## Phase 3: Safety And Output Gates
62
+
63
+ - [x] Four safety tiers:
64
+ - `imminent_safety`
65
+ - `high_distress`
66
+ - `support_navigation`
67
+ - `wellbeing`
68
+ - [x] Deterministic crisis/imminent response path.
69
+ - [x] Rule-based output guard catches pure validation, harmful agreement, dependency language, and unsupported resource claims.
70
+ - [ ] Add explicit `out_of_scope` handling in response planner and UI.
71
+ - [ ] Add NLI-style groundedness check for response claims against top retrieved service objects when feasible.
72
+ - [ ] Ensure crisis/imminent prompts never enter normal generation.
73
+
74
+ ## Phase 4: Response Layer And Demo
75
+
76
+ - [x] Constrained response planner for non-crisis responses.
77
+ - [x] Recommended next action included in Core result metadata.
78
+ - [x] Gradio demo shows route, tier, confidence, retrieval mode, source cards, and output guard.
79
+ - [ ] Make peer-helper mode a first-class visible feature, not only a route label.
80
+ - [ ] Add peer-helper-specific wording:
81
+ - what to say
82
+ - what not to say
83
+ - when to escalate
84
+ - do not handle immediate safety alone
85
+ - [ ] Polish 5-6 scripted demo prompts.
86
+ - [ ] Keep demo framed as support navigation, not clinical help.
87
+
88
+ ## Phase 5A: Single-Turn Ablation
89
+
90
+ Goal: broad comparison across router/system variants.
91
+
92
+ Variants:
93
+
94
+ - [ ] Rule router
95
+ - [ ] TF-IDF/logistic router
96
+ - [ ] RoBERTa route classifier
97
+ - [ ] Full hybrid Core system
98
+
99
+ Metrics:
100
+
101
+ - route accuracy
102
+ - safety tier accuracy
103
+ - intercept accuracy
104
+ - source appropriateness / source hit rate
105
+ - avoid-list violation rate
106
+ - unsafe generation count
107
+ - pure validation / no-action count
108
+ - ungrounded action count
109
+ - latency
110
+
111
+ Target dataset:
112
+
113
+ - 300-500 synthetic single-turn prompts.
114
+ - 14 route labels.
115
+ - 4 safety tiers.
116
+ - no real/private student data.
117
+ - no Reddit/TikTok/Discord scraping.
118
+ - no method details.
119
+
120
+ ## Phase 5B: Multi-Turn Headline Evaluation
121
+
122
+ This is the paper hook.
123
+
124
+ Goal: compare V1 open/emotion-aware RAG against EmpathRAG Core on vulnerability-amplifying conversations.
125
+
126
+ Scenario categories:
127
+
128
+ - slow escalation
129
+ - dependency formation
130
+ - help rejection
131
+ - secrecy requests
132
+ - peer-helper/friend risk
133
+ - ambiguous academic idioms
134
+ - sycophancy traps
135
+ - method-seeking pressure without method details
136
+ - ordinary academic stress
137
+
138
+ Metrics:
139
+
140
+ - missed escalation count
141
+ - turn-by-turn route correctness
142
+ - turn-by-turn tier correctness
143
+ - intercept by required turn
144
+ - dependency reinforcement
145
+ - pure validation without redirect
146
+ - method leakage
147
+ - unsafe source use
148
+ - latency
149
+
150
+ Minimum target:
151
+
152
+ - 30 multi-turn scenarios for class demo/paper draft.
153
+ - 50 multi-turn scenarios for stronger research version.
154
+
155
+ ## Phase 6: V1 Results Preservation
156
+
157
+ Do not orphan the original V1 work. It becomes baseline rigor.
158
+
159
+ - [ ] Keep BERTScore and Wilcoxon results in the paper as V1 baseline evaluation.
160
+ - [ ] Preserve adversarial safety evaluation from V1.
161
+ - [ ] Use V1 results to motivate the Core redesign.
162
+ - [ ] Present V1 as useful but structurally risky, not as "bad work."
163
+
164
+ Paper structure:
165
+
166
+ - Section 4: V1 baseline evaluation.
167
+ - Section 5: what V1 missed.
168
+ - Section 6: EmpathRAG Core architecture.
169
+ - Section 7: Eval A single-turn ablation and Eval B multi-turn V1 vs Core benchmark.
170
+
171
+ ## Phase 7: Karthik Dataset Deadline
172
+
173
+ Deadline: end of Day 5 from the current sprint.
174
+
175
+ Blocking deliverables:
176
+
177
+ - [ ] `single_turn_labeled.csv`: 300-500 synthetic prompts.
178
+ - [ ] `multi_turn_scenarios.jsonl`: at least 30 scenarios, target 50.
179
+ - [ ] `source_target_map.csv`.
180
+ - [ ] `risky_ambiguous_cases.csv`.
181
+ - [ ] `resource_profile_additions.csv`.
182
+ - [ ] `README_dataset_notes.md`.
183
+
184
+ Setup/verification tasks for Karthik if he runs the repo locally:
185
+
186
+ - [ ] Pull latest `codex/v2.5-support-navigator`.
187
+ - [ ] Verify tokenizer/model dependencies.
188
+ - [ ] Install missing protobuf dependency if tokenizer loading requires it.
189
+ - [ ] Verify `src/models/guardrail_ig.py` runs locally.
190
+
191
+ Fallback if dataset slips:
192
+
193
+ - [ ] Build a smaller hand-labeled set of about 150 prompts with Karthik.
194
+ - [ ] Train/evaluate TF-IDF and, if feasible, a small RoBERTa route classifier.
195
+ - [ ] Report small-N limitation honestly.
196
+ - [ ] Do not block the demo on RoBERTa route training.
197
+
198
+ ## Claims To Avoid
199
+
200
+ - Clinically validated.
201
+ - Treats depression or anxiety.
202
+ - Provides therapy, counseling, diagnosis, or intervention.
203
+ - Prevents suicide or reduces fatal incidents.
204
+ - Replaces professional or campus support.
205
+ - Safe for real student deployment.
206
+
207
+ ## Immediate Next Build Tasks
208
+
209
+ - [ ] Update docs to consistently use EmpathRAG Core and resource registry wording.
210
+ - [ ] Add explicit Stage-1 lexical safety precheck metadata to Core output.
211
+ - [ ] Add optional DeBERTa + IG hook to Core, disabled or skipped for fast demo when needed.
212
+ - [ ] Improve peer-helper UI and tests.
213
+ - [ ] Split eval reports into Eval A and Eval B summaries.
214
+ - [ ] Keep demo polished and deterministic for the class presentation.
docs/KARTHIK_EMPATHRAG_CORE_DATASET_V2_REQUEST.md CHANGED
@@ -8,6 +8,15 @@ Please create a new folder:
8
  empathrag_core_dataset_v2/
9
  ```
10
 
 
 
 
 
 
 
 
 
 
11
  ## Required Files
12
 
13
  ```text
@@ -105,7 +114,7 @@ Rules:
105
 
106
  ## 2. `multi_turn_scenarios.jsonl`
107
 
108
- Target size: **50 scenarios**, each 3-6 turns.
109
 
110
  Schema:
111
 
@@ -139,6 +148,9 @@ Include:
139
  - advisor conflict
140
  - low mood without immediate risk
141
  - explicit imminent safety
 
 
 
142
 
143
  ## 3. `source_target_map.csv`
144
 
@@ -242,3 +254,14 @@ Before sending back:
242
  - Crisis examples are safe but still labelable.
243
  - `split` is populated for every single-turn row.
244
  - Sources are official or clearly marked as unknown/needs review.
 
 
 
 
 
 
 
 
 
 
 
 
8
  empathrag_core_dataset_v2/
9
  ```
10
 
11
+ Target deadline: **end of Day 5 of the current sprint**. This dataset is now on the critical path for training and evaluating the stronger route classifier. If the full set is not ready by then, please send a smaller but clean partial delivery rather than waiting.
12
+
13
+ Before dataset work, if you are running the repo locally:
14
+
15
+ - Pull the latest `codex/v2.5-support-navigator` branch.
16
+ - Verify tokenizer/model dependencies.
17
+ - Install `protobuf` if tokenizer loading complains about it.
18
+ - Verify `src/models/guardrail_ig.py` can run locally, or note the exact error in `README_dataset_notes.md`.
19
+
20
  ## Required Files
21
 
22
  ```text
 
114
 
115
  ## 2. `multi_turn_scenarios.jsonl`
116
 
117
+ Target size: **30 scenarios minimum**, target **50 scenarios**, each 3-6 turns.
118
 
119
  Schema:
120
 
 
148
  - advisor conflict
149
  - low mood without immediate risk
150
  - explicit imminent safety
151
+ - peer-helper/friend safety escalation
152
+ - sycophancy traps
153
+ - help-rejection and secrecy requests
154
 
155
  ## 3. `source_target_map.csv`
156
 
 
254
  - Crisis examples are safe but still labelable.
255
  - `split` is populated for every single-turn row.
256
  - Sources are official or clearly marked as unknown/needs review.
257
+
258
+ ## Fallback Delivery
259
+
260
+ If the full 300-500 row dataset cannot be finished by the deadline, send:
261
+
262
+ - at least 150 well-labeled single-turn prompts
263
+ - at least 15 multi-turn scenarios
264
+ - complete route/tier/intercept/source labels
265
+ - a note explaining what remains incomplete
266
+
267
+ This fallback is still useful for a small-N route classifier and a class presentation ablation.
docs/PAPER_FRAMING.md CHANGED
@@ -2,11 +2,11 @@
2
 
3
  Working title:
4
 
5
- EmpathRAG Core: Guarded Conversational Retrieval for Emotional Support Navigation
6
 
7
  ## Core Story
8
 
9
- EmpathRAG V1 was an emotion-aware RAG system. It is useful as a baseline, but broad empathetic generation creates structural risks for mental-health-adjacent student support:
10
 
11
  - generic validation
12
  - ungrounded advice
@@ -14,20 +14,27 @@ EmpathRAG V1 was an emotion-aware RAG system. It is useful as a baseline, but br
14
  - poor distinction between ordinary stress and safety risk
15
  - insufficient source/resource transparency
16
 
17
- EmpathRAG Core pivots to a safer architecture:
18
 
19
  - campus-specific support navigation
20
  - four-mode safety ladder
21
  - hybrid ML + rule route classification
22
- - service graph filtering
23
  - usage-mode gated retrieval
24
  - trajectory escalation
25
  - output-side guardrail
 
26
  - transparent source cards
27
 
 
 
 
 
 
 
28
  ## Research Question
29
 
30
- Can a hybrid ML/rule router with graph-grounded retrieval and hard safety gates reduce inappropriate validation, ungrounded actions, and missed escalation while improving route accuracy and actionability compared with ungated RAG or generic LLM responses?
31
 
32
  ## Baselines
33
 
@@ -38,9 +45,44 @@ Optional ablations:
38
 
39
  - Core without output guard
40
  - Core without trajectory escalation
41
- - Core without service graph filtering
42
  - Core rule-only router vs Core hybrid ML router
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  ## Metrics
45
 
46
  - route accuracy
 
2
 
3
  Working title:
4
 
5
+ EmpathRAG Core: Multi-Turn Safety Evaluation and Guarded Conversational Retrieval for UMD Support Navigation
6
 
7
  ## Core Story
8
 
9
+ EmpathRAG V1 was an emotion-aware RAG system. It is useful as a baseline, and its original evaluation work should stay in the paper. But broad empathetic generation creates structural risks for mental-health-adjacent student support:
10
 
11
  - generic validation
12
  - ungrounded advice
 
14
  - poor distinction between ordinary stress and safety risk
15
  - insufficient source/resource transparency
16
 
17
+ EmpathRAG Core is the guarded redesign:
18
 
19
  - campus-specific support navigation
20
  - four-mode safety ladder
21
  - hybrid ML + rule route classification
22
+ - resource registry / service-object filtering
23
  - usage-mode gated retrieval
24
  - trajectory escalation
25
  - output-side guardrail
26
+ - Integrated Gradients explanation for safety decisions
27
  - transparent source cards
28
 
29
+ ## Contributions
30
+
31
+ 1. Hybrid lexical + ML safety architecture with explicit mode-tiered escalation.
32
+ 2. Multi-turn safety evaluation framework comparing open V1 behavior against guarded Core behavior.
33
+ 3. Integrated Gradients explainability for safety decisions from the DeBERTa guardrail.
34
+
35
  ## Research Question
36
 
37
+ Can a guarded conversational RAG architecture reduce missed escalation, inappropriate validation, ungrounded support actions, and unsafe source use compared with open emotion-aware RAG, especially in multi-turn student-support scenarios?
38
 
39
  ## Baselines
40
 
 
45
 
46
  - Core without output guard
47
  - Core without trajectory escalation
48
+ - Core without resource registry filtering
49
  - Core rule-only router vs Core hybrid ML router
50
 
51
+ ## Evaluation Design
52
+
53
+ ### Section 4: V1 Baseline Evaluation
54
+
55
+ Keep the original V1 results as baseline rigor:
56
+
57
+ - BERTScore / reference-response evaluation.
58
+ - Wilcoxon analysis for emotion-conditioned retrieval.
59
+ - Single-turn adversarial safety comparison.
60
+
61
+ These results establish that V1 was measured seriously before the redesign.
62
+
63
+ ### Eval A: Single-Turn Ablation
64
+
65
+ Compare:
66
+
67
+ - rule router
68
+ - TF-IDF/logistic router
69
+ - RoBERTa route classifier, once Karthik's route-labeled dataset exists
70
+ - full hybrid Core system
71
+
72
+ ### Eval B: Multi-Turn Headline Benchmark
73
+
74
+ Compare V1 open RAG against Core guarded RAG on multi-turn cases:
75
+
76
+ - slow escalation
77
+ - dependency formation
78
+ - help rejection
79
+ - peer-helper/friend risk
80
+ - ambiguous academic idioms
81
+ - sycophancy traps
82
+ - method-seeking pressure without method details
83
+
84
+ This is the main paper hook.
85
+
86
  ## Metrics
87
 
88
  - route accuracy