Retrieval-Augmented Generation in LLMs for Mental Health: Examining the Impact on User Intent Detection in Wysa

preprint OA: closed CC-BY-4.0
📄 Open PDF Full text JSON View at publisher
AI-generated deep summary by claude@2026-07, 2026-07-03 · read from full text

This preprint studied whether adding retrieval-augmented generation (RAG) to Wysa, a CBT-based mental health chatbot, improves multi-class user intent classification and safety-risk detection compared with using the base large language models without retrieval. Using anonymized real and synthetic user–chatbot exchanges that were filtered to trigger retrieval, the authors manually labeled inputs against safety/intent categories (e.g., self-harm, child abuse, panic) and compared RAG-enabled versus RAG-disabled modes across six LLMs using accuracy, precision, recall, F1, risk-category performance, and inter-model agreement, testing statistical significance. RAG improved safety intent detection in five of six models, with the largest gains in smaller models and improved recall for high-risk intents, while also increasing false alarms due to a precision–recall trade-off. This paper does not explicitly discuss endometriosis or adenomyosis; it was included in the corpus via a keyword match in the upstream search index.

Read from the paper's body, not the abstract. Not a substitute for reading the paper. No clinical advice. How this works

Abstract

Abstract Background Digital mental health interventions (DMHIs) offer scalable support but ensuring they accurately detect users’ intent during volatile situations can be challenging. Pure parametric Large Language models (LLMs) do not contain specific safety critical architecture, and can miss critical cues, or hallucinate, undermining reliability. Retrieval Augmented Generation (RAG), which supplements an LLM with retrieved context, could enhance intent detection during volatile situations. This study examined whether integrating RAG into a specific DMHI (Wysa) improves intent classification and safety risk detection compared to using the base LLM alone. Methods This paper evaluates six LLM models within Wysa via a controlled comparison of RAG-enabled versus RAG-disabled modes. Anonymized real and synthetic user-chatbot exchanges were manually labeled against multi-class intent categories (e.g. self-harm, abuse, panic). We computed classification accuracy, recall, precision and F1 scores against ground truth labels and tested differences for statistical significance. Performance was also examined by risk category and inter-model agreement. Results RAG consistently improved safety intent detection with five of six models demonstrating significant accuracy gains, especially with smaller models (with increased accuracy ranging from ~ 48% to ~ 73% with RAG). Recall for high-risk intent (like child abuse, and panic attack) increased substantially, with missed cases dropping by over half. Models also normalized to reach consistent agreement predictions under RAG. However, improved sensitivity came with a slight increase in false negatives, reflecting a precision-recall trade-off (fewer instances of missed risk at the cost of more false alarms). Conclusions Integrating RAG in mental health settings enhances detection of user intent and safety concerns. RAG particularly benefited smaller LLMs, narrowing performance gaps with larger, advanced models and reducing missed critical flags. While RAG caused a rise in false alarms, the trade-off is acceptable in a safety-critical context. Overall, these findings support RAG as a promising approach to improve the accuracy, consistency and safety of LLM-driven DMHIs.
Full text 131,162 characters · extracted from preprint-html · click to expand
Retrieval-Augmented Generation in LLMs for Mental Health: Examining the Impact on User Intent Detection in Wysa | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Article Retrieval-Augmented Generation in LLMs for Mental Health: Examining the Impact on User Intent Detection in Wysa Anand Gupta, Akshat Surolia, Shubham Mishra, Shakil Imtiaz, Chaitali Sinha This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-8327266/v1 This work is licensed under a CC BY 4.0 License Status: Under Review Version 1 posted 9 You are reading this latest preprint version Abstract Background Digital mental health interventions (DMHIs) offer scalable support but ensuring they accurately detect users’ intent during volatile situations can be challenging. Pure parametric Large Language models (LLMs) do not contain specific safety critical architecture, and can miss critical cues, or hallucinate, undermining reliability. Retrieval Augmented Generation (RAG), which supplements an LLM with retrieved context, could enhance intent detection during volatile situations. This study examined whether integrating RAG into a specific DMHI (Wysa) improves intent classification and safety risk detection compared to using the base LLM alone. Methods This paper evaluates six LLM models within Wysa via a controlled comparison of RAG-enabled versus RAG-disabled modes. Anonymized real and synthetic user-chatbot exchanges were manually labeled against multi-class intent categories (e.g. self-harm, abuse, panic). We computed classification accuracy, recall, precision and F1 scores against ground truth labels and tested differences for statistical significance. Performance was also examined by risk category and inter-model agreement. Results RAG consistently improved safety intent detection with five of six models demonstrating significant accuracy gains, especially with smaller models (with increased accuracy ranging from ~ 48% to ~ 73% with RAG). Recall for high-risk intent (like child abuse, and panic attack) increased substantially, with missed cases dropping by over half. Models also normalized to reach consistent agreement predictions under RAG. However, improved sensitivity came with a slight increase in false negatives, reflecting a precision-recall trade-off (fewer instances of missed risk at the cost of more false alarms). Conclusions Integrating RAG in mental health settings enhances detection of user intent and safety concerns. RAG particularly benefited smaller LLMs, narrowing performance gaps with larger, advanced models and reducing missed critical flags. While RAG caused a rise in false alarms, the trade-off is acceptable in a safety-critical context. Overall, these findings support RAG as a promising approach to improve the accuracy, consistency and safety of LLM-driven DMHIs. Health sciences/Health care Physical sciences/Mathematics and computing Biological sciences/Psychology Social science/Psychology Digital Mental Health Intervention Large Language Model Retrieval Augmented Generation Accuracy Recall Precision Figures Figure 1 Figure 2 Figure 3 Figure 4 Introduction Mental disorders are one of the leading contributors to the global health burden, with approximately one-third of people experiencing poor health in their lifetime. 1 This growing demand for mental health services and limited access to qualified care providers require the search for easily available, accessible resources and alternate modalities of care. 2 In this context, the present age of digitalization brings progress and new possibilities for mental health and psychotherapy. 3 The use of artificial intelligence in psychotherapy offers the potential to simulate human-like care and nuance, especially with intelligent therapy chatbots that adapt to individual user-needs and provide continued support. Such digital mental health interventions (DMHIs) including internet and smartphone-delivered services, hold promise for overcoming significant barriers that are traditionally associated with face-to-face mental health care, 4,5 such as stigma, 6 accessibility and cost. 7 Within this landscape, large language models (LLMs) now underpin many DMHI solutions, helping approximate human-level performance on certain tasks to understand and generate language. However, their purely parametric nature, i.e. relying solely on knowledge encoded within model weights, poses significant challenges for clinical reliability. Furthermore, their propensity to hallucinate can create serious repercussions within mental health settings. Retrieval Augmented Generation In the middle of 2020, Lewis et al 8 introduced Retrieval Augmented Generation (RAG) constituting a significant advancement in LLM architectures, addressing generative task limitations through retrieval mechanisms. Within mental health applications, RAG demonstrates particular efficacy in mitigating parametric model deficiencies, namely hallucination propensity and contextual inadequacy. For Wysa, a chatbot based mental health intervention, RAG implementation encompasses two primary operational domains: contextual continuity preservation and clinical safety classification. For contextual continuity, the system employs conversational history spanning preceding n th user interactions, systematically retrieving relevant context to enhance semantic understanding of discourse trajectory. This is essential for chatbot services which may have to effectively distinguish between cases of severe symptomatology, or an instance of self-disclosure. By leveraging context from earlier conversations, RAG ensures that such situations are mitigated through appropriate structured, evidence-based routes. Regarding clinical safety, the system utilizes LLM-based classification whereby conversational context undergoes systematic evaluation for explicit or implicit risk indicators, subsequently initiating appropriate crisis intervention protocols while maintaining adherence to non-diagnostic operational parameters. This targeted RAG methodology significantly improves language model accuracy on clinical tasks, effectively addressing core limitations like hallucination tendencies. Similar comparisons by Béchard and Ayala 9 report that incorporating RAG into a generative workflow system significantly reduces hallucination and even allows using a smaller LLM without performance loss. 10 While generative models show anecdotal promise in producing empathetic, evidence-based responses, there is a lack of formal evaluation in interactive mental health contexts, particularly comparing RAG systems with standalone publicly available LLMs. Existing literature from adjacent domains suggests RAG offers advantages when domain alignment is critical, but this has not been empirically validated in mental health support scenarios. This study examines the usage of RAG in Wysa, a chatbot based mental health intervention, to quantify whether RAG-grounded chatbots deliver better outcomes than purely parametric models. It focuses on their potential to improve safety, and user intent detection over the backdrop of the larger library of LLMs. Methods About the Intervention Wysa is a conversational agent (CA) which delivers CBT-based interventions. It listens and responds to the user's distress by recommending techniques and self-care tools based on CBT, behavioral reinforcement, and mindfulness, among other evidence-based therapies. It utilizes a combination of rule-based and LLM technologies to enable a supportive self-care digital tool for the user. Wysa has demonstrated high efficacy across symptoms of anxiety, depression, pain interference and stress It was found that users were able to establish a strong therapeutic alliance with the AI-based conversational agent that was comparable to a human therapeutic bond, further confirming the positive feedback from users. Data Collection and Processing The study utilizes two primary data sources, (1) a corpus of PII-redacted (anonymized) real user-chatbot conversations These logs captured authentic user interactions in a controlled setting; (2) a curated set of synthetic text prompts and dialogue segments that simulate diverse user contexts and edge-case scenarios relevant to RAG functionality. All conversation data was refactored and standardized before analysis. All logs were curated into an ordered list with alternating user and bot messages for consistent, contextualized processing and finally stored in a JSON format. The metadata was filtered to only retain conversational segments wherein intent was identifiable (i.e. discarding entries with single or incomplete words that do not make literal sense). This filtering ensured that all evaluated dialogues included at least one prompt that triggered the retrieval mechanism. Finally, the dataset was checked for semantic de-duplication to remove duplicate or nearly identical query instances, so that evaluation is not biased by repeated content. The resulting cleaned set was then used as the input for the evaluation paradigms described below. Evaluation Metrics The evaluation encompassed a controlled classification task for moderation and safety intent detection. The study examined detection performance with RAG enabled versus RAG disabled, compared against manually labeled dataset (human feedback). These identical inputs isolated the effect of retrieval augmentation. This was conducted using an open-ended response comparison wherein the entire dataset was divided into two parts, the minority RAG collection using a subset for retrieval and the test set (used interchangeably as user query below). In practice, the user query was presented to the chatbot twice - first in the RAG-augmented mode, and then with the RAG system turned off (i.e. using only the base LLM without retrieval augmentation). By rerunning the exact chat segments in both modes, a paired bot response was obtained for direct comparison. The test evaluation (including user query) focused on multi-class classification critical to a mental health chatbot’s safety. Several thousand individual user utterances covering a broad range of moderation-sensitive and safety-critical scenarios, were coded. Each user log was annotated with a ground-truth label called ‘Risk category’ (refer Table 1 ). To obtain high-quality reference labels, a multi-class labeling process was employed using multiple LLMs that were prompted to classify each entry against its appropriate label. Table 1 Risk Categories Risk Category Definition Illegal activity Mentions or endorsements of actions that are against the law. Harm towards others Statements indicating intent or risk of physical, emotional, or verbal harm directed at other individuals. Abuse towards child Mentions of physical, emotional, or sexual harm inflicted on a minor. Panic attack Language suggestive of an acute episode of intense fear or physiological distress. Trauma Disclosures or references to distressing past experiences likely to be psychologically triggering. Prompt injection Attempts to manipulate or override the chatbot’s behavior through adversarial or meta-level instructions. No risk Content that poses no identifiable psychological, safety, or policy concerns. Analysis Using these two configurations (RAG versus No-RAG) under a deterministic prompt (i.e. temperature = 0), a reproducible set of results were obtained. In the RAG condition, the system could retrieve supplemental context (from the manually labeled subset used to build the RAG index) before producing a label, whereas the tests without RAG relied solely on the model’s internal knowledge. The performance for each configuration was measured using standard metrics like classification accuracy, F1 score, and Cohen’s Kappa 11 , comparing the model-predicted labels against the manually labeled labels. To assess significance of any performance differences intra-cohort (i.e. under the same LLM), McNemar’s test 12 on paired outcomes was computed. Confidence intervals 13 were calculated via bootstrap resampling, providing an estimate of uncertainty around the measured performance. Additionally, confusion matrices for each condition were analyzed to identify any shifts in error patterns when RAG was enabled (e.g. to see if retrieval context reduced false negatives on critical safety alerts), and delta tests were used to directly quantify the net contribution of retrieval augmentation by comparing RAG and No-RAG conditions. Finally, the results were examined across the different LLMs (inter-cohort) to evaluate the consistency of RAG’s impact, helping determine observed performance gains (or lack thereof) across model architectures or specific to a singular model variant. Results Across the six language models tested, RAG boosted the overall classification performance and increased accuracy for 5 of 6 models, with large gains (refer Fig. 1) especially for the lightweight OpenAI models. For instance, GPT-4.1 nano’s accuracy jumped from 48.3% to 72.7% with RAG (Δ + 24.5 percentage increase, with a 95% Confidence Interval of 21.7–27.2%). Table 2 shows how this improvement is highly significant with a McNemar test value of χ² ≈ 256, p ≪ 0.001. o4-mini also saw a significant accuracy increase with a bump from 71.4% to 79.2% (Δ + 7.8 percentage increase, with a 95% CI of 5.7–9.8%). Table 2 McNemar’s Test comparing paired classification outcomes with and without RAG across models X (No RAG) Y (RAG) A B C D Discordant B/C Net Disagree Rate Acc_X Acc_Y χ² GPT-4.1 nano GPT-4.1 nano 687 124 535 334 659 0.232 -0.244 0.482 0.727 256.329 o4-mini o4-mini 1118 81 212 269 293 0.382 -0.077 0.713 0.791 58.569 Gemini 2.5 flash Gemini 2.5 flash 1224 88 154 214 242 0.571 -0.039 0.781 0.820 18 Gemini 2.5 Pro Gemini 2.5 Pro 1121 189 172 198 361 1.099 0.0101 0.779 0.769 0.801 Claude Sonnet 4 Claude Sonnet 4 1203 76 184 217 260 0.413 -0.064 0.761 0.825 44.861 GPT-5 mini GPT-5 mini 1231 87 114 248 201 0.763 -0.016 0.784 0.801 3.626 A, Both models correct; B, RAG - Incorrect, No RAG - Correct; C, RAG - Correct, No RAG - Incorrect; D, Both models incorrect; Net Disagreement Rate, (B - C) / N; Acc_X, Accuracy (No RAG), (A + B) ÷ N; Acc_Y, Accuracy (RAG), (A + C) ÷ N; McNemar χ², (B − C)² ÷ (B + C). The larger Claude Sonnet 4 showed positive but smaller gains, with accuracy changing from 76.13% to 82.56% (Δ + 6.43%, p≪0.001, with a 95% CI of 4.5% − 8.2%). Both the Google Gemini models and GPT-5 mini however, did not show statistically significant changes. Overall, RAG consistently and significantly improved accuracy for four models (GPT-4.1 nano, o4-mini, Gemini 2.5 flash, Claude Sonnet 4), had a negligible impact on one (Gemini 2.5 Pro) and yielded a minor, non-significant uptick for the most advanced model (GPT-5 mini). Similar trends were also mirrored in the precision, recall and F 1 scores. Globally RAG tended to improve recall more substantially than precision, leading to a higher F 1 in most cases. It was observed that RAG’s benefits were inversely correlated with baseline performance, such that lightweight models gained the most, and advance models gained the least. The only model with essentially unchanged F 1 was Gemini 2.5 Pro (macro F 1 ~ 0.79 in both conditions), consistent with its flat accuracy Δ. Figure 1 Bootstrap 95% confidence intervals for accuracy differences These global patterns indicate that RAG provided a net performance boost in most settings, chiefly by helping models retrieve and correctly classify examples they initially missed (improved recall) with only minor trade-offs in precision. Class-Level Results Figure 2 shows how RAG especially improved performance with classes that models originally struggled with reducing instances of under-detection. For example, GPT-4.1 nano correctly recognized only 2.7% of instances of “Abuse towards child” in the test set, and 16.3% of “Panic attack” in cases without RAG, indicating that it was missing the vast majority of those at-risk queries. These patterns are evident in the confusion matrix, where many actual cases were being misclassified into the benign “No risk” category (explaining the near 87% recall for No risk). However, with RAG, the model’s sensitivity to these critical classes dramatically improved (“Abuse towards child” from 2.7% to 50.0%, and “Panic attack” from 16.3% to 73.6%). This represents a 47–57 point increase in recall for those cohorts. Correspondingly, the F 1 for “Panic attack” soared from a low 0.28 to 0.78 with RAG. Other analogous improvements are also showcased in other models, leading to conclude that RAG consistently helped models catch more positive instances of volatile intent, thereby reducing false negatives in those classes. Figure 2 Per-class Precision, Recall and F1 RAG’s effect on precision behaved like a class-dependent action. In many cases, precision stayed high or improved slightly along with recall, indicating that the additional hits retrieved by RAG were mostly correct. For example, GPT-4.1 nano’s precision on “Abuse towards child” rose from 66.7% to 79.6% with RAG, even as it began capturing far more true child abuse cases (meaning, it did not sharply increase false positives for that class). Likewise, GPT-5 mini’s precision for “Harm towards others” ticked up from 86.3% to 86.7%, while its recall climbed to 92.9%, yielding a F₁ of 0.897. However, there were a few trade-offs where RAG improved recall at the cost of precision. Gemini 2.5 Pro’s performance on “Panic attack” is illustrative: RAG enabled it to catch about 30% more of the panic cases (recall 56.3% − 86.1%), but its precision on that class dropped from 90.7% to 63.5%. This suggests that the model started labeling more instances as “Panic attack” (correctly identifying most of the previously missed ones but also introducing some false positives). Yet, the F₁ for Gemini 2.5 Pro on panic queries improved substantially (from 0.694 to 0.731), indicating the recall gains outweighed the precision losses in net effect. A similar pattern was seen with “Trauma” and “Prompt injection” for some models: those that were overtly conservative originally gained recall with RAG but sometimes misfired on a few easy cases, slightly reducing precision. Notably, majority “No risk” class predictions sometimes became less precise under RAG. Several models began flagging more inputs as risky (reducing false-negatives in minority classes), which inevitably meant a few truly safe inputs were misclassified as risks (increasing false-negatives on “No risk”). For instance, Gemini 2.5 Pro’s recall fell by 14.9 points (90.1% − 75.2%) with RAG, and its “No risk” precision only rose slightly (78.7% − 81.5%), resulting in a significantly lower F₁ (0.7245 − 0.6364). In contrast, other models managed a better balance: o4-mini saw a modest drop in “No risk” recall (90.1% − 83.6%) but a sizable precision boost (59.0% − 69.5%), ultimately still improving its “No risk” F₁ (0.713–0.759). Overall, across all models and classes, RAG produced net gains in F₁ for 38 out of 42 class-level evaluations (7 intents across 6 models), while 4 cases showed slight declines. Inter-Model Agreement Another notable outcome of RAG is its effect on agreement between models. Pairwise prediction agreement rates and Cohen’s Kappa (κ) were computed between every pair of models, separately for the RAG and no-RAG conditions. Under no-RAG, the models often disagreed substantially, especially with varying accuracy counts. For example, GPT-4.1 nano’s predictions matched Claude Sonnet 4 on only about 60.6% of instances without RAG. Its agreement with GPT-5 mini was even lower at ~ 49.0%, reflecting the tendency of a lightweight model like GPT-4.1 nano to misclassify many cases that the larger models got right. With RAG however, the models’ outputs became more aligned. GPT-4.1 nano (with RAG) agreed with Claude on 75.1% of the test cases and with GPT-5 mini on ~ 72.98%. In fact, RAG increased the pairwise agreement between GPT-4.1 nano and every other model by ~ 15–25%. Table 3 shows a generalization of agreement metrics for more than two models, quantifying how consistently multiple models agree on predictions across all instances. Table 3 Inter-model agreements Model Average Model Consensus GPT-4.1 nano 0.568 o4-mini 0.818 Gemini 2.5 flash 0.836 Gemini 2.5 Pro 0.758 Claude Sonnet 4 0.839 GPT-5 mini 0.863 More generally, the spread in performance between models narrowed under RAG, leading to more consensus. Even models that were originally dissimilar showed markedly improved concordance. For instance, Gemini 2.5 Pro (the only model that didn’t improve overall with RAG) still became more similar to others: its agreement with o4-mini rose from 71.8% to 74.94% and with Claude from 77.08% to 78.39%. The overall trend retained that RAG improved inter-model agreement, indicating that the models not only became more accurate individually, but also more consistent as a group in the labels they assigned. Figure 3 Cohen’s κ Pairwise Agreements Cohen’s κ (refer Fig. 3) reveals the same pattern while accounting for chance agreement. Without RAG, many model pairs had only moderate κ values despite high raw agreement on the majority class. However, RAG enabled high κ values to approach the “almost perfect” agreement range, reinforcing that the ensemble of models reached a much higher consensus with RAG. In practical terms, this means that given the same query, the models’ classifications were more likely to coincide when retrieval was available, presumably because the retrieved evidence guided them toward similar conclusions. Model Consistency Intra-model consistency was examined for each model’s outputs between the RAG and no-RAG conditions. This analysis essentially calculates the number of test instances where RAG changed its prediction. The answers varied widely by model capacity. GPT-5 mini was the most stable, allocating the same classification with and without RAG for ~ 88% of the test cases, altering its decision only ~ 12% of the time (201/1680 instances discordant). Claude Sonnet 4 was similarly consistent, with ~ 84.5% of outputs unchanged by RAG (discordant in 260 cases). In contrast, the smallest model GPT-4.1 nano changed its prediction on 39% of instances (659/1680) when using RAG, reflecting the earlier point that RAG heavily rewrote GPT-4.1 nano’s decision profile. The mid-range models fell in between: o4-mini changed ~ 17% of the time (b + c = 293), and Gemini 2.5 flash ~ 14% (242 changes). Interestingly, Gemini 2.5 Pro’s predictions shifted on about 21.5% of instances (361/1680) with RAG (more than one might expect given its overall accuracy didn’t improve). A closer inspection found that many of Pro’s changes with RAG were different errors rather than net improvements, e.g. it started catching some “Panic attacks” it previously missed but also began missing some “No risk” cases it previously got right, roughly cancelling out. In contrast, for GPT-4.1 nano and o4-mini the vast majority of changes were beneficial corrections (c ≫ b, as noted). Overall, these consistency rates indicate that larger models are inherently more stable, they only adjust on a small subset of queries when additional context is provided, presumably those borderline cases where retrieval offers new clues. Smaller models, lacking robust internal knowledge, undergo more drastic output revision under RAG. From an ensemble perspective, RAG made the weaker models behave more like the stronger ones, hence the increased group agreement discussed above. We also note that even when models changed their answers under RAG, they usually changed from a wrong answer to the right one (for significant-improvement models), which is exactly the intended effect of retrieval augmentation. Error Analysis & Confusion Patterns Figure 4 Confusion Matrices (Risk Category vs Model) The class confusion matrices (refer Fig. 4) provide further insight into the specific error reductions achieved by RAG. Without RAG, a dominant error mode for multiple models was over-predicting the “No risk” class, i.e. labeling volatile queries as safe. For example, GPT-4.1 nano’s raw confusion matrix (i.e. no-RAG) shows that for actual “Abuse towards child” cases, the model overwhelmingly predicted “No risk” in almost all 148 instances (hence its 97% recall on “No risk” vs only 2.7% on child abuse). Similar patterns were seen for “Panic attack” and “Trauma”, which were frequently confused with “No risk” or other benign categories. After enabling RAG, these confusions diminished dramatically. The matrices show far more weight on the diagonal for those classes, e.g. GPT-4.1 nano correctly classifies 74 out of 148 child-abuse cases with RAG (50% recall) instead of only 4/148 without RAG. Likewise, Claude Sonnet 4, which initially misidentified “Panic attack” cases as “Harm towards others” or “No risk”, managed to correctly identify twice as many of them with RAG (raising recall from 30% to 62%). These improvements indicate that RAG supplied relevant cues or knowledge that helped disambiguate user intents that the models previously missed. Another prevalent confusion was between certain volatile categories themselves, e.g. distinguishing “Panic attack” vs “Trauma”, or “Abuse towards child” vs “Harm towards others”, which can be subtle. The RAG condition slightly alleviated some of these as well (e.g. models better separated trauma from general harm), though residual cross-confusions remained in some cases. On the other hand, new error patterns introduced by RAG were relatively few. One observable issue was an increase in false positives for some volatile classes: e.g. Gemini 2.5 Pro with RAG sometimes misclassified harmless inputs as “Panic attack” or “Abuse”, contributing to its drop in “No risk” recall. These are cases where the retrieved content might have been misleading or the model over-interpreted a benign query as risky. Such errors highlight that RAG is not infallible, it can shift a model’s mistakes from “misses” to “false alarms.” However, from a safety perspective, many applications may prefer false positives (flagging a safe query for review) over false negatives (missing a truly risky query). Nonetheless, this is a trade-off to consider. Overall, the confusion matrices confirm that RAG’s net impact was to reduce the most severe errors (failing to detect intent), even if it introduced a few mild confusions in return. The group consensus results support this: when all models’ predictions disagree, it is often on those borderline cases where RAG’s influence varied, but such instances became rarer with RAG. Under RAG, a greater fraction of queries was unanimously or majority-voted into the correct class by the model ensemble, whereas without RAG there were more cases where at least one model (often the weaker ones) strayed with an incorrect label. Discussion The Precision-Recall Tradeoff In this evaluation, RAG enabled models flagged fewer false negatives than their standalone counterparts in mental health contexts, particularly in the risk domains of child abuse, panic attacks and trauma. This result aligns with the findings of Lopez et al 14 and Xu et al 15 , who observed that retrieval-augmented models in clinical settings significantly improved sensitivity (recall) and reduced missed cases compared to standalone LLMs. Augmenting generative models with relevant knowledge retrieval makes them more sensitive to critical risk language, significantly reducing the risk of missing instances of genuine risk. 16 RAG shifts the balance towards higher recall of crises at the expense of precision as systems are explicitly designed to maximize the capture of all relevant contextual evidence (high recall), even when this means retrieving additional extraneous material and thereby reducing precision. 17 These false alarms align with the safety-first design in healthcare settings, where systems often prefer to err on the side of caution. 18 Differential Impact with Model Capacity Model capacities mediated the benefit gained from enabling RAG. RAG enabled models showed disproportionately large improvements in smaller LLMs, whereas larger models showed marginal change. GPT-4.1 nano showcased drastic performance improvements with classification accuracy and recall surging to thresholds equivalent to those of larger models. This is consistent with existing literature, facilitating the conclusion that RAG enabled systems can often rival or surpass larger models. 19 In this analysis, moderately sized retrieval was enough to compensate for limitations in safety domains or implicit intent detection. By contrast, larger models (like GPT-5 mini) derived little measurable benefit from RAG. This suggests a substantial value of pre-encoded knowledge or inference capabilities. For such models, retrieving additional information provided redundant context, yielding only minor refinements at best. Some larger models also exhibited an occasional override of correct internal judgement (without RAG), surfacing that retrieval may introduce minor noise. These observations echo the notion of diminishing returns for augmentation as model size grows. 20 Agreement and Consistency An additional effect of RAG was its influence on model agreement and consistency. It was observed that enabling retrieval led to a marked increase in inter-model agreement. This harmonization effect affirmed that retrieval supplied an external knowledge cue that both models could latch onto. 20 We also examined intra-model consistency, where each model’s own classification pattern changed with retrieval. The data suggested that smaller models became more consistent in flagging certain cues. However, for larger models, minimal change was noticed. This emphasized that RAG could shift a model’s internal classification tendencies, especially for smaller models. It effectively re-calibrates models like GPT-4.1 nano to be more uniform and assertive in identifying critical issues. This proves useful as a system that responds the same way to the same stimuli (or conceptually similar stimuli) is more predictable and transparent. 21 In essence, retrieval served not only as an on-demand infusion of expert knowledge but also a curated memory of lived experience, 22 which is particularly crucial in mental health applications where oftentimes such services act as the last barricade to volatile situations. A chatbot like Wysa could, for instance, retrieve the appropriate response script or risk assessment checklist whenever it suspects intent suggesting a crisis, ensuring its next action is grounded in vetted knowledge rather than just the vagaries of neural weights. The results in this paper provide empirical support that a retrieval strategy materially improves safety performance. Implications and Future Direction It has been expected that large scale LLMs, by virtue of extensive training, will implicitly learn to predict intent around crisis-related content. 23 The work here displays how explicit retrieval of relevant knowledge can significantly bolster a model’s safety performance, and even fundamentally change effectiveness in smaller models. This study can offer guidance to system designers on how model size and architecture influence the returns from retrieval If using a smaller language model (e.g. for on-device deployments or to minimize costs), our results encourage integrating a robust retrieval component because the payoff can be significant. From a broader perspective, these findings underscore a paradigm shift for AI safety in healthcare: rather than treating safety as purely a function of model censorship or static fine-tuning, one can treat it as an information retrieval problem. Future directions Moving forward, broader evaluation and targeted training will be crucial to further improve crisis intent detection. Recent benchmarks that probe LLM responses across diverse crisis scenarios reveal that even state-of-the-art models often miss subtly expressed distress cues and can produce inappropriate or formulaic responses. 24 These gaps underscore the need for better alignment and specialized tuning to handle nuanced expressions of crisis safely. One promising avenue is domain-specific fine-tuning of LLMs - for example, task-specific instruction tuning in the mental health domain has boosted performance so much that smaller specialized models matched or even outperformed much larger general models 25 . Another complementary direction is leveraging retrieval augmentation (RAG) to enhance smaller LLMs in safety-critical tasks. Injecting external knowledge via RAG can curb hallucinations and provide human-vetted context. 21 This aligns with observations that RAG-equipped systems can rival or surpass far bigger LLMs, yielding especially high returns at smaller scales. By combining efficient, lightweight models with robust retrieval of vetted crisis information (for example, well-tested intervention scripts and checklists), future systems could deliver cost-effective on-device crisis intent detection without sacrificing reliability. Conclusion Ultimately, the study highlights that safety-aware behavior can be augmented through retrieval, and predicts that the next generation of digital mental health interventions will not only be empathetic and engaging, but also consistently safe, responsive to crises, and grounded in the same reliable knowledge and experience that human practitioners use. Such advancements bring us a step closer to AI systems that genuinely support clinicians and patients in tandem, combining the efficiency of automation with the prudence of evidence-based practice. Abbreviations AI Artificial Intelligence LLM Large Language Model RAG Retrieval Augmented Generation PII Personally Identifiable Information Declarations Acknowledgements Not applicable. Funding The study did not receive any funding. Author Information Authors and Affiliations Wysa Inc., Boston, MA, United States Anand Gupta, Akshat Surolia, Shubham Mishra, Shakil Imtiaz, & Chaitali Sinha Contributions AG and CS conceived of and designed the study. AG, AK and SM contributed to the data collection of the study. SI: data analysis, drafting of the manuscript, revision and editing. CS: review and editing, supervision, project administration. All authors read and approved the final manuscript. Corresponding Author Correspondence to Shakil Imtiaz ( [email protected] ). Ethics declarations Ethics approval and consent to participate Not applicable. Consent for publication Not applicable. Competing interests AG, AS, SM, SI, and CS are employees of Wysa. The author(s) had access to anonymized user data for the purpose of this study. References Andrade, L. et al. Cross-national comparisons of the prevalences and correlates of mental disorders. WHO International Consortium in Psychiatric Epidemiology. Bull World Health Organ [Internet]. ;78(4):413 – 26. (2000). Available from: https://www.ncbi.nlm.nih.gov/pubmed/10885160 Spytska, L. The use of artificial intelligence in psychotherapy: development of intelligent therapeutic systems. BMC Psychology [Internet]. Feb 28 [cited 2025 Nov 20];13(1):175. (2025). Available from: http://dx.doi.org/10.1186/s40359-025-02491-9 Bendig, E., Erb, B., Schulze-Thuesing, L. & Baumeister, H. The Next Generation: Chatbots in Clinical Psychology and Psychotherapy to Foster Mental Health - A Scoping Review. Verhaltenstherapie [Internet]. 2019 Aug 20 [cited 2025 Nov 20];32(Suppl. 1):64–76. Available from: https://dx.doi.org/10.1159/000501812 Hinshaw, S. P. & Stier, A. Stigma as related to mental disorders. Annu Rev Clin Psychol [Internet]. ;4(1):367 – 93. (2008). Available from: http://dx.doi.org/10.1146/annurev.clinpsy.4.022007.141245 Jung, H., von Sternberg, K. & Davis, K. The impact of mental health literacy, stigma, and social support on attitudes toward mental health help-seeking. Int J Ment Health Promot [Internet]. ;19(5):252 – 67. (2017). Available from: http://dx.doi.org/10.1080/14623730.2017.1345687 Harvey, A. G. & Gumport, N. B. Evidence-based psychological treatments for mental disorders: modifiable barriers to access and possible solutions. Behav Res Ther [Internet]. ;68:1–12. (2015). Available from: https://www.sciencedirect.com/science/article/pii/S0005796715000285 Ho, K. P., Hunt, C. & Li, S. Patterns of help-seeking behavior for anxiety disorders among the Chinese speaking Australian community. Soc Psychiatry Psychiatr Epidemiol [Internet]. ;43(11):872-7. (2008). Available from: http://dx.doi.org/10.1007/s00127-008-0387-0 Lewis, P. et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. Larochelle H, Ranzato M, Hadsell R, Balcan MF, Lin H, editors. Neural Inf Process Syst [Internet]. ;abs/2005.11401:9459-74. (2020). Available from: https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html Ayala, O. & Bechard, P. Reducing hallucination in structured outputs via Retrieval-Augmented Generation. In: Yang Y, Davani A, Sil A, Kumar A, editors. Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 6: Industry Track) [Internet]. Stroudsburg, PA, USA: Association for Computational Linguistics; pp. 228 – 38. Available from: https://aclanthology.org/2024.naacl-industry.19/ (2024). Shen, M., Umar, M., Maeng, K., Suh, G. E. & Gupta, U. Towards understanding systems trade-offs in retrieval-Augmented Generation model inference [Internet]. arXiv [cs.AR]. (2024). Available from: http://arxiv.org/abs/2412.11854 Vieira, S. M., Kaymak, U. & Sousa, J. M. C. Cohen’s kappa coefficient as a performance measure for feature selection. In: International Conference on Fuzzy Systems [Internet]. IEEE; pp. 1–8. (2010). Available from: https://ieeexplore.ieee.org/abstract/document/5584447/ Pembury Smith, M. Q. R. & Ruxton, G. D. Effective use of the McNemar test. Behav Ecol Sociobiol [Internet]. ;74(11). (2020). Available from: http://dx.doi.org/10.1007/s00265-020-02916-y DiCiccio, T. J. & Efron, B. Bootstrap confidence intervals. Stat Sci [Internet]. Sept 1;11(3):189–228. (1996). Available from: http://dx.doi.org/10.1214/ss/1032280214 Lopez, I. et al. Clinical entity augmented retrieval for clinical information extraction. NPJ Digit Med [Internet]. ;8(1):45. (2025). Available from: https://www.nature.com/articles/s41746-024-01377-1 Xu, S., Yan, Z., Dai, C. & Wu, F. MEGA-RAG: a retrieval-augmented generation framework with multi-evidence guided answer refinement for mitigating hallucinations of LLMs in public health. Front Public Health [Internet]. ;13. (2025). Available from: http://dx.doi.org/10.3389/fpubh.2025.1635381 Uluslu, A. Y., Michail, A. & Clematide, S. Utilizing Large Language Models to Identify Evidence of Suicidality Risk through Analysis of Emotionally Charged Posts. In: Proceedings of the 9th Workshop on Computational Linguistics and Clinical Psychology (CLPsych 2024) [Internet]. Association for Computational Linguistics; 2024 [cited 2025 Nov 20]. pp. 264-9. Available from: https://www.zora.uzh.ch/id/eprint/275598/ Ammar, A., Koubaa, A., Nacar, O. & Boulila, W. Optimizing retrieval-augmented generation: Analysis of hyperparameter impact on performance and efficiency [Internet]. arXiv [cs.LG]. (2025). Available from: http://arxiv.org/abs/2505.08445 Hicks, S. A. et al. On evaluation metrics for medical applications of artificial intelligence. Sci Rep [Internet]. ;12(1):5979. (2022). Available from: https://www.nature.com/articles/s41598-022-09954-8 Ning, J., Kong, Y., Long, Y., Callan, J. & Less LLM, more documents: Searching for improved RAG [Internet]. arXiv [cs.IR]. (2025). Available from: http://arxiv.org/abs/2510.02657 Gaber, F. et al. Evaluating large language model workflows in clinical decision support for triage and referral and diagnosis. npj Digital Medicine [Internet]. May 9 [cited 2025 Nov 20];8(1):263. (2025). Available from: https://www.nature.com/articles/s41746-025-01684-1 Hagström, L., Saynova, D., Norlund, T., Johansson, M. & Johansson, R. The effect of scaling, retrieval augmentation and form on the factual consistency of Language Models [Internet]. arXiv [cs.CL]. (2023). Available from: http://arxiv.org/abs/2311.01307 Gan, W., Dao, M-S. & Zettsu, K. Case-based Reasoning Augmented Large Language Model framework for decision making in realistic safety-critical driving scenarios [Internet]. arXiv [cs.AI]. (2025). Available from: http://arxiv.org/abs/2506.20531 He, M. & Garner, P. N. Can chatgpt detect intent? evaluating large language models for spoken language understanding. arXiv preprint arXiv:230513512 [Internet]. ; (2023). Available from: http://arxiv.org/abs/2305.13512 Li, T. et al. Can Large Language Models identify Implicit Suicidal ideation? An empirical evaluation [Internet]. arXiv [cs.CL]. (2025). Available from: http://arxiv.org/abs/2502.17899 Xu, X. et al. Mental-LLM: Leveraging large language models for mental health prediction via online text data: Leveraging large language models for mental health prediction via online text data. Proc ACM Interact Mob Wearable Ubiquitous Technol [Internet]. ;8(1):1–32. (2024). Available from: http://dx.doi.org/10.1145/3643540 Additional Declarations No competing interests reported. Cite Share Download PDF Status: Under Review Version 1 posted Reviewers agreed at journal 14 May, 2026 Reviewers agreed at journal 12 May, 2026 Reviews received at journal 22 Dec, 2025 Reviewers agreed at journal 18 Dec, 2025 Reviewers invited by journal 18 Dec, 2025 Editor invited by journal 16 Dec, 2025 Editor assigned by journal 11 Dec, 2025 Submission checks completed at journal 11 Dec, 2025 First submitted to journal 10 Dec, 2025 You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-8327266","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Article","associatedPublications":[],"authors":[{"id":562215908,"identity":"9b76d65a-12d4-4c3a-9f60-5ae52164b903","order_by":0,"name":"Anand Gupta","email":"","orcid":"","institution":"Wysa Inc","correspondingAuthor":false,"prefix":"","firstName":"Anand","middleName":"","lastName":"Gupta","suffix":""},{"id":562215909,"identity":"8688636e-8054-4329-9a58-e4b507eb08d0","order_by":1,"name":"Akshat Surolia","email":"","orcid":"","institution":"Wysa Inc","correspondingAuthor":false,"prefix":"","firstName":"Akshat","middleName":"","lastName":"Surolia","suffix":""},{"id":562215910,"identity":"cb5be84e-5067-462a-810c-d557a1e8af15","order_by":2,"name":"Shubham Mishra","email":"","orcid":"","institution":"Wysa Inc","correspondingAuthor":false,"prefix":"","firstName":"Shubham","middleName":"","lastName":"Mishra","suffix":""},{"id":562215912,"identity":"a3796392-2c5e-4214-aa41-89da6cfc70a6","order_by":3,"name":"Shakil Imtiaz","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA7UlEQVRIiWNgGAWjYDACCQZmhoQCBh4GBsYGBoYKiOABwloMgFrYQFrOEKuFwQDIYANixjYi3CU/u/mxwQMDBhnd+c2NH3/OO5w4v/0A44EPeLQY3DlmnABymNkxxmYJyW2HEzecSWA4OAOfFokE4wNQLQ0ShttuJ25gSGA4zIPPYTPSP8O0NP9InHM7cX7/A/xaGG7kwB3WJnGw4XZiww0CthjcyCk2SDCQAGpJbLNsOPbfeMONhw14/QJ02GbJHxU29maHjz+++aMmTXZ+f/LhD/hCDAok4CzHBnAyIAXYk6Z8FIyCUTAKRgIAAPvnUzQ07DNHAAAAAElFTkSuQmCC","orcid":"","institution":"Wysa Inc","correspondingAuthor":true,"prefix":"","firstName":"Shakil","middleName":"","lastName":"Imtiaz","suffix":""},{"id":562215914,"identity":"26af4a42-7d4f-4d2c-a8eb-0239eaff337d","order_by":4,"name":"Chaitali Sinha","email":"","orcid":"","institution":"Wysa Inc","correspondingAuthor":false,"prefix":"","firstName":"Chaitali","middleName":"","lastName":"Sinha","suffix":""}],"badges":[],"createdAt":"2025-12-10 12:08:21","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-8327266/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-8327266/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":99187479,"identity":"84681dfd-a6dd-4713-81a7-c81b618c0788","added_by":"auto","created_at":"2025-12-30 00:10:36","extension":"png","order_by":0,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":90286,"visible":true,"origin":"","legend":"","description":"","filename":"Figure1.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/fb42ccca21200ecb69bcb004.png"},{"id":99187481,"identity":"51995e2b-1f04-470c-a8ea-abb7eef9ae25","added_by":"auto","created_at":"2025-12-30 00:10:36","extension":"png","order_by":1,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":293541,"visible":true,"origin":"","legend":"","description":"","filename":"Figure2.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/71e08e4c8e2ca86caefbf280.png"},{"id":99187482,"identity":"4cb8764d-c83b-4a64-a1f8-48fe442d5729","added_by":"auto","created_at":"2025-12-30 00:10:36","extension":"docx","order_by":2,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":4820593,"visible":true,"origin":"","legend":"","description":"","filename":"Draft4RetrievalAugmentedGenerationinLLMsforMentalHealth.docx","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/3bf88b6dc4cd165d4292c60b.docx"},{"id":99187489,"identity":"d7a540fa-211d-44e3-93ae-83fcdd8d8631","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":3,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":194249,"visible":true,"origin":"","legend":"","description":"","filename":"Figure3.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/9234d0aa540377eb79573b48.png"},{"id":99315526,"identity":"8496163e-2d19-4499-bcdb-916c1e84c166","added_by":"auto","created_at":"2025-12-31 16:27:02","extension":"png","order_by":4,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":399425,"visible":true,"origin":"","legend":"","description":"","filename":"Figure4.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/a105db8a47caca9e78c0344b.png"},{"id":99187492,"identity":"6482364d-6ba8-45a9-a1ee-c1c81ddd569c","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"json","order_by":5,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":7580,"visible":true,"origin":"","legend":"","description":"","filename":"2879ec54c09342c98c514cf5fcc12f06.json","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/214c426b9b69f1f63943ed59.json"},{"id":99187485,"identity":"52e28162-3788-4d14-a719-53b15a105069","added_by":"auto","created_at":"2025-12-30 00:10:36","extension":"xml","order_by":6,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":86416,"visible":true,"origin":"","legend":"","description":"","filename":"2879ec54c09342c98c514cf5fcc12f061enriched.xml","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/d01593dc71236cd266f01d3c.xml"},{"id":99187496,"identity":"f3b028f0-004a-428f-b10a-ca42d48d90e3","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":7,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":90286,"visible":true,"origin":"","legend":"","description":"","filename":"Figure1.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/d28e74830a403ba2f023cbeb.png"},{"id":99187493,"identity":"58d2e11f-e9a6-4f65-81db-dfa32c48e235","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":8,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":293541,"visible":true,"origin":"","legend":"","description":"","filename":"Figure2.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/aeae7447c5150085a38df380.png"},{"id":99317258,"identity":"b28bfa06-5b1b-4b1a-8907-b2e7e9034864","added_by":"auto","created_at":"2025-12-31 16:29:50","extension":"png","order_by":9,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":194249,"visible":true,"origin":"","legend":"","description":"","filename":"Figure3.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/a8d3b560f679052c6f4a5abf.png"},{"id":99187499,"identity":"526f50a6-d5fe-4914-95de-071384f26359","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":10,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":399425,"visible":true,"origin":"","legend":"","description":"","filename":"Figure4.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/30daad16db20662a141e8af6.png"},{"id":99187497,"identity":"def3a195-3e6b-471c-a118-f35b50b23a69","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":11,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":30157,"visible":true,"origin":"","legend":"","description":"","filename":"OnlineFigure1.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/e0602fea2cb17479ab9d3ddb.png"},{"id":99187494,"identity":"ade332c8-9f87-4ed1-b5cc-c04f7296b02c","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":12,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":73577,"visible":true,"origin":"","legend":"","description":"","filename":"OnlineFigure2.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/4cb5b37f361214e750e5b6d1.png"},{"id":99187488,"identity":"c3a7bc55-9729-4a84-869f-32c789cc3267","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":13,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":56623,"visible":true,"origin":"","legend":"","description":"","filename":"OnlineFigure3.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/bf927ac71e74490f1be8f9a4.png"},{"id":99187500,"identity":"dd67d7a1-bb06-4a81-adc5-745564fdead8","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"png","order_by":14,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":104654,"visible":true,"origin":"","legend":"","description":"","filename":"OnlineFigure4.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/7d7d73bf594e02a5818c4483.png"},{"id":99187498,"identity":"63cd58f4-97fb-4a29-bb4c-120b5794ca38","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"xml","order_by":15,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":85614,"visible":true,"origin":"","legend":"","description":"","filename":"2879ec54c09342c98c514cf5fcc12f061structuring.xml","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/0dbbb58e5caf71da4025f8ab.xml"},{"id":99187491,"identity":"6550f6f4-f262-4330-86e7-8e03c0a8bb39","added_by":"auto","created_at":"2025-12-30 00:10:37","extension":"html","order_by":16,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":94881,"visible":true,"origin":"","legend":"","description":"","filename":"earlyproof.html","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/996b670bf9c1ab4c7fd947aa.html"},{"id":99316807,"identity":"6fe981b3-15ab-43ae-9cc2-e8cbf1571acb","added_by":"auto","created_at":"2025-12-31 16:29:14","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":90286,"visible":true,"origin":"","legend":"\u003cp\u003eBootstrap 95% confidence intervals for accuracy differences\u003c/p\u003e","description":"","filename":"Figure1.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/34f0c7b2aa4c2df5659a2ada.png"},{"id":99187484,"identity":"67423877-75b5-446f-a71d-54567e2159b9","added_by":"auto","created_at":"2025-12-30 00:10:36","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":293541,"visible":true,"origin":"","legend":"\u003cp\u003ePer-class Precision, Recall and F1\u003c/p\u003e","description":"","filename":"Figure2.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/c07a9dc0a25c80b8ca82232d.png"},{"id":99316215,"identity":"5ba9ea48-fda7-4ddf-8c86-a38d42b08ad9","added_by":"auto","created_at":"2025-12-31 16:27:53","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":194249,"visible":true,"origin":"","legend":"\u003cp\u003eCohen’s κ Pairwise Agreements\u003c/p\u003e","description":"","filename":"Figure3.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/960acfa31b36bfc2b27dcc2d.png"},{"id":99187486,"identity":"e47acf50-952d-4ece-ab07-f6768f0214f4","added_by":"auto","created_at":"2025-12-30 00:10:36","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":399425,"visible":true,"origin":"","legend":"\u003cp\u003eConfusion Matrices (Risk Category vs Model)\u003c/p\u003e","description":"","filename":"Figure4.png","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/658eeb55a7c6f83a96a7759b.png"},{"id":99323693,"identity":"c0f9bc51-2478-4571-8a6d-75ec1fa3cfe9","added_by":"auto","created_at":"2025-12-31 16:46:00","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":1670750,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8327266/v1/7001b16d-1c02-4360-befe-b41dab9dccc9.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Retrieval-Augmented Generation in LLMs for Mental Health: Examining the Impact on User Intent Detection in Wysa","fulltext":[{"header":"Introduction","content":"\u003cp\u003eMental disorders are one of the leading contributors to the global health burden, with approximately one-third of people experiencing poor health in their lifetime.\u003csup\u003e\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e\u003c/sup\u003e This growing demand for mental health services and limited access to qualified care providers require the search for easily available, accessible resources and alternate modalities of care.\u003csup\u003e\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003cp\u003eIn this context, the present age of digitalization brings progress and new possibilities for mental health and psychotherapy.\u003csup\u003e\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e\u003c/sup\u003e The use of artificial intelligence in psychotherapy offers the potential to simulate human-like care and nuance, especially with intelligent therapy chatbots that adapt to individual user-needs and provide continued support. Such digital mental health interventions (DMHIs) including internet and smartphone-delivered services, hold promise for overcoming significant barriers that are traditionally associated with face-to-face mental health care,\u003csup\u003e4,5\u003c/sup\u003e such as stigma,\u003csup\u003e6\u003c/sup\u003e accessibility and cost.\u003csup\u003e\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003cp\u003eWithin this landscape, large language models (LLMs) now underpin many DMHI solutions, helping approximate human-level performance on certain tasks to understand and generate language. However, their purely parametric nature, i.e. relying solely on knowledge encoded within model weights, poses significant challenges for clinical reliability. Furthermore, their propensity to hallucinate can create serious repercussions within mental health settings.\u003c/p\u003e\n\u003ch3\u003eRetrieval Augmented Generation\u003c/h3\u003e\n\u003cp\u003eIn the middle of 2020, Lewis et al\u003csup\u003e8\u003c/sup\u003e introduced Retrieval Augmented Generation (RAG) constituting a significant advancement in LLM architectures, addressing generative task limitations through retrieval mechanisms. Within mental health applications, RAG demonstrates particular efficacy in mitigating parametric model deficiencies, namely hallucination propensity and contextual inadequacy. For Wysa, a chatbot based mental health intervention, RAG implementation encompasses two primary operational domains: contextual continuity preservation and clinical safety classification.\u003c/p\u003e \u003cp\u003eFor contextual continuity, the system employs conversational history spanning preceding n\u003csup\u003eth\u003c/sup\u003e user interactions, systematically retrieving relevant context to enhance semantic understanding of discourse trajectory. This is essential for chatbot services which may have to effectively distinguish between cases of severe symptomatology, or an instance of self-disclosure. By leveraging context from earlier conversations, RAG ensures that such situations are mitigated through appropriate structured, evidence-based routes.\u003c/p\u003e \u003cp\u003eRegarding clinical safety, the system utilizes LLM-based classification whereby conversational context undergoes systematic evaluation for explicit or implicit risk indicators, subsequently initiating appropriate crisis intervention protocols while maintaining adherence to non-diagnostic operational parameters. This targeted RAG methodology significantly improves language model accuracy on clinical tasks, effectively addressing core limitations like hallucination tendencies. Similar comparisons by B\u0026eacute;chard and Ayala\u003csup\u003e\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e\u003c/sup\u003e report that incorporating RAG into a generative workflow system significantly reduces hallucination and even allows using a smaller LLM without performance loss.\u003csup\u003e\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003cp\u003eWhile generative models show anecdotal promise in producing empathetic, evidence-based responses, there is a lack of formal evaluation in interactive mental health contexts, particularly comparing RAG systems with standalone publicly available LLMs. Existing literature from adjacent domains suggests RAG offers advantages when domain alignment is critical, but this has not been empirically validated in mental health support scenarios. This study examines the usage of RAG in Wysa, a chatbot based mental health intervention, to quantify whether RAG-grounded chatbots deliver better outcomes than purely parametric models. It focuses on their potential to improve safety, and user intent detection over the backdrop of the larger library of LLMs.\u003c/p\u003e "},{"header":"Methods","content":"\u003cdiv id=\"Sec3\" class=\"Section2\"\u003e \u003cdiv id=\"Sec4\" class=\"Section3\"\u003e \u003ch2\u003eAbout the Intervention\u003c/h2\u003e \u003cp\u003eWysa is a conversational agent (CA) which delivers CBT-based interventions. It listens and responds to the user's distress by recommending techniques and self-care tools based on CBT, behavioral reinforcement, and mindfulness, among other evidence-based therapies. It utilizes a combination of rule-based and LLM technologies to enable a supportive self-care digital tool for the user. Wysa has demonstrated high efficacy across symptoms of anxiety, depression, pain interference and stress It was found that users were able to establish a strong therapeutic alliance with the AI-based conversational agent that was comparable to a human therapeutic bond, further confirming the positive feedback from users.\u003c/p\u003e \u003c/div\u003e \u003c/div\u003e\n\u003ch3\u003eData Collection and Processing\u003c/h3\u003e\n\u003cp\u003eThe study utilizes two primary data sources, (1) a corpus of PII-redacted (anonymized) real user-chatbot conversations These logs captured authentic user interactions in a controlled setting; (2) a curated set of synthetic text prompts and dialogue segments that simulate diverse user contexts and edge-case scenarios relevant to RAG functionality.\u003c/p\u003e \u003cp\u003eAll conversation data was refactored and standardized before analysis. All logs were curated into an ordered list with alternating user and bot messages for consistent, contextualized processing and finally stored in a JSON format. The metadata was filtered to only retain conversational segments wherein intent was identifiable (i.e. discarding entries with single or incomplete words that do not make literal sense). This filtering ensured that all evaluated dialogues included at least one prompt that triggered the retrieval mechanism. Finally, the dataset was checked for semantic de-duplication to remove duplicate or nearly identical query instances, so that evaluation is not biased by repeated content. The resulting cleaned set was then used as the input for the evaluation paradigms described below.\u003c/p\u003e\n\u003ch3\u003eEvaluation Metrics\u003c/h3\u003e\n\u003cp\u003eThe evaluation encompassed a controlled classification task for moderation and safety intent detection. The study examined detection performance with RAG enabled versus RAG disabled, compared against manually labeled dataset (human feedback). These identical inputs isolated the effect of retrieval augmentation.\u003c/p\u003e \u003cp\u003eThis was conducted using an open-ended response comparison wherein the entire dataset was divided into two parts, the minority RAG collection using a subset for retrieval and the test set (used interchangeably as user query below). In practice, the user query was presented to the chatbot twice - first in the RAG-augmented mode, and then with the RAG system turned off (i.e. using only the base LLM without retrieval augmentation). By rerunning the exact chat segments in both modes, a paired bot response was obtained for direct comparison.\u003c/p\u003e \u003cp\u003eThe test evaluation (including user query) focused on multi-class classification critical to a mental health chatbot\u0026rsquo;s safety. Several thousand individual user utterances covering a broad range of moderation-sensitive and safety-critical scenarios, were coded. Each user log was annotated with a ground-truth label called \u0026lsquo;Risk category\u0026rsquo; (refer Table\u0026nbsp;\u003cspan refid=\"Tab1\" class=\"InternalRef\"\u003e1\u003c/span\u003e). To obtain high-quality reference labels, a multi-class labeling process was employed using multiple LLMs that were prompted to classify each entry against its appropriate label.\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab1\" border=\"1\"\u003e \u003ccaption language=\"En\"\u003e \u003cdiv class=\"CaptionNumber\"\u003eTable 1\u003c/div\u003e \u003cdiv class=\"CaptionContent\"\u003e \u003cp\u003eRisk Categories\u003c/p\u003e \u003c/div\u003e \u003c/caption\u003e \u003ccolgroup cols=\"2\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eRisk Category\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eDefinition\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eIllegal activity\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eMentions or endorsements of actions that are against the law.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eHarm towards others\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eStatements indicating intent or risk of physical, emotional, or verbal harm directed at other individuals.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eAbuse towards child\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eMentions of physical, emotional, or sexual harm inflicted on a minor.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003ePanic attack\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eLanguage suggestive of an acute episode of intense fear or physiological distress.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eTrauma\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eDisclosures or references to distressing past experiences likely to be psychologically triggering.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003ePrompt injection\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eAttempts to manipulate or override the chatbot\u0026rsquo;s behavior through adversarial or meta-level instructions.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eNo risk\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eContent that poses no identifiable psychological, safety, or policy concerns.\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e\n\u003ch3\u003eAnalysis\u003c/h3\u003e\n\u003cp\u003eUsing these two configurations (RAG versus No-RAG) under a deterministic prompt (i.e. temperature\u0026thinsp;=\u0026thinsp;0), a reproducible set of results were obtained. In the RAG condition, the system could retrieve supplemental context (from the manually labeled subset used to build the RAG index) before producing a label, whereas the tests without RAG relied solely on the model\u0026rsquo;s internal knowledge. The performance for each configuration was measured using standard metrics like classification accuracy, F1 score, and Cohen\u0026rsquo;s Kappa\u003csup\u003e\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e\u003c/sup\u003e, comparing the model-predicted labels against the manually labeled labels. To assess significance of any performance differences intra-cohort (i.e. under the same LLM), McNemar\u0026rsquo;s test\u003csup\u003e\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e\u003c/sup\u003e on paired outcomes was computed. Confidence intervals\u003csup\u003e\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e\u003c/sup\u003e were calculated via bootstrap resampling, providing an estimate of uncertainty around the measured performance. Additionally, confusion matrices for each condition were analyzed to identify any shifts in error patterns when RAG was enabled (e.g. to see if retrieval context reduced false negatives on critical safety alerts), and delta tests were used to directly quantify the net contribution of retrieval augmentation by comparing RAG and No-RAG conditions. Finally, the results were examined across the different LLMs (inter-cohort) to evaluate the consistency of RAG\u0026rsquo;s impact, helping determine observed performance gains (or lack thereof) across model architectures or specific to a singular model variant.\u003c/p\u003e"},{"header":"Results","content":"\u003cp\u003eAcross the six language models tested, RAG boosted the overall classification performance and increased accuracy for 5 of 6 models, with large gains (refer Fig.\u0026nbsp;1) especially for the lightweight OpenAI models. For instance, GPT-4.1 nano\u0026rsquo;s accuracy jumped from 48.3% to 72.7% with RAG (Δ\u0026thinsp;+\u0026thinsp;24.5 percentage increase, with a 95% Confidence Interval of 21.7\u0026ndash;27.2%). Table\u0026nbsp;\u003cspan refid=\"Tab2\" class=\"InternalRef\"\u003e2\u003c/span\u003e shows how this improvement is highly significant with a McNemar test value of χ\u0026sup2; \u0026asymp; 256, p ≪ 0.001. o4-mini also saw a significant accuracy increase with a bump from 71.4% to 79.2% (Δ\u0026thinsp;+\u0026thinsp;7.8 percentage increase, with a 95% CI of 5.7\u0026ndash;9.8%).\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab2\" border=\"1\"\u003e \u003ccaption language=\"En\"\u003e \u003cdiv class=\"CaptionNumber\"\u003eTable 2\u003c/div\u003e \u003cdiv class=\"CaptionContent\"\u003e \u003cp\u003eMcNemar\u0026rsquo;s Test comparing paired classification outcomes with and without RAG across models\u003c/p\u003e \u003c/div\u003e \u003c/caption\u003e \u003ccolgroup cols=\"12\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c3\" colnum=\"3\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c4\" colnum=\"4\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c5\" colnum=\"5\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c6\" colnum=\"6\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c7\" colnum=\"7\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c8\" colnum=\"8\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c9\" colnum=\"9\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c10\" colnum=\"10\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c11\" colnum=\"11\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c12\" colnum=\"12\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eX (No RAG)\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eY (RAG)\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c3\"\u003e \u003cp\u003eA\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c4\"\u003e \u003cp\u003eB\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c5\"\u003e \u003cp\u003eC\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c6\"\u003e \u003cp\u003eD\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c7\"\u003e \u003cp\u003eDiscordant\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c8\"\u003e \u003cp\u003eB/C\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c9\"\u003e \u003cp\u003eNet Disagree Rate\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c10\"\u003e \u003cp\u003eAcc_X\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c11\"\u003e \u003cp\u003eAcc_Y\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c12\"\u003e \u003cp\u003eχ\u0026sup2;\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGPT-4.1 nano\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eGPT-4.1 nano\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e \u003cp\u003e687\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e \u003cp\u003e124\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e \u003cp\u003e535\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c6\"\u003e \u003cp\u003e334\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c7\"\u003e \u003cp\u003e659\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c8\"\u003e \u003cp\u003e0.232\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c9\"\u003e \u003cp\u003e-0.244\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c10\"\u003e \u003cp\u003e0.482\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c11\"\u003e \u003cp\u003e0.727\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c12\"\u003e \u003cp\u003e256.329\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eo4-mini\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eo4-mini\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e \u003cp\u003e1118\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e \u003cp\u003e81\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e \u003cp\u003e212\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c6\"\u003e \u003cp\u003e269\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c7\"\u003e \u003cp\u003e293\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c8\"\u003e \u003cp\u003e0.382\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c9\"\u003e \u003cp\u003e-0.077\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c10\"\u003e \u003cp\u003e0.713\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c11\"\u003e \u003cp\u003e0.791\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c12\"\u003e \u003cp\u003e58.569\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGemini 2.5 flash\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eGemini 2.5 flash\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e \u003cp\u003e1224\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e \u003cp\u003e88\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e \u003cp\u003e154\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c6\"\u003e \u003cp\u003e214\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c7\"\u003e \u003cp\u003e242\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c8\"\u003e \u003cp\u003e0.571\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c9\"\u003e \u003cp\u003e-0.039\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c10\"\u003e \u003cp\u003e0.781\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c11\"\u003e \u003cp\u003e0.820\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c12\"\u003e \u003cp\u003e18\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGemini 2.5 Pro\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eGemini 2.5 Pro\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e \u003cp\u003e1121\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e \u003cp\u003e189\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e \u003cp\u003e172\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c6\"\u003e \u003cp\u003e198\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c7\"\u003e \u003cp\u003e361\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c8\"\u003e \u003cp\u003e1.099\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c9\"\u003e \u003cp\u003e0.0101\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c10\"\u003e \u003cp\u003e0.779\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c11\"\u003e \u003cp\u003e0.769\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c12\"\u003e \u003cp\u003e0.801\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eClaude Sonnet 4\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eClaude Sonnet 4\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e \u003cp\u003e1203\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e \u003cp\u003e76\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e \u003cp\u003e184\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c6\"\u003e \u003cp\u003e217\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c7\"\u003e \u003cp\u003e260\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c8\"\u003e \u003cp\u003e0.413\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c9\"\u003e \u003cp\u003e-0.064\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c10\"\u003e \u003cp\u003e0.761\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c11\"\u003e \u003cp\u003e0.825\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c12\"\u003e \u003cp\u003e44.861\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGPT-5 mini\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eGPT-5 mini\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e \u003cp\u003e1231\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e \u003cp\u003e87\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e \u003cp\u003e114\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c6\"\u003e \u003cp\u003e248\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c7\"\u003e \u003cp\u003e201\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c8\"\u003e \u003cp\u003e0.763\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c9\"\u003e \u003cp\u003e-0.016\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c10\"\u003e \u003cp\u003e0.784\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c11\"\u003e \u003cp\u003e0.801\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c12\"\u003e \u003cp\u003e3.626\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e \u003cp\u003eA, Both models correct; B, RAG - Incorrect, No RAG - Correct; C, RAG - Correct, No RAG - Incorrect; D, Both models incorrect; Net Disagreement Rate, (B - C) / N; Acc_X, Accuracy (No RAG), (A\u0026thinsp;+\u0026thinsp;B)\u0026thinsp;\u0026divide;\u0026thinsp;N; Acc_Y, Accuracy (RAG), (A\u0026thinsp;+\u0026thinsp;C)\u0026thinsp;\u0026divide;\u0026thinsp;N; McNemar χ\u0026sup2;, (B\u0026thinsp;\u0026minus;\u0026thinsp;C)\u0026sup2; \u0026divide; (B\u0026thinsp;+\u0026thinsp;C).\u003c/p\u003e \u003cp\u003eThe larger Claude Sonnet 4 showed positive but smaller gains, with accuracy changing from 76.13% to 82.56% (Δ\u0026thinsp;+\u0026thinsp;6.43%, p≪0.001, with a 95% CI of 4.5% \u0026minus;\u0026thinsp;8.2%). Both the Google Gemini models and GPT-5 mini however, did not show statistically significant changes. Overall, RAG consistently and significantly improved accuracy for four models (GPT-4.1 nano, o4-mini, Gemini 2.5 flash, Claude Sonnet 4), had a negligible impact on one (Gemini 2.5 Pro) and yielded a minor, non-significant uptick for the most advanced model (GPT-5 mini).\u003c/p\u003e \u003cp\u003eSimilar trends were also mirrored in the precision, recall and F\u003csub\u003e1\u003c/sub\u003e scores. Globally RAG tended to improve recall more substantially than precision, leading to a higher F\u003csub\u003e1\u003c/sub\u003e in most cases. It was observed that RAG\u0026rsquo;s benefits were inversely correlated with baseline performance, such that lightweight models gained the most, and advance models gained the least. The only model with essentially unchanged F\u003csub\u003e1\u003c/sub\u003e was Gemini 2.5 Pro (macro F\u003csub\u003e1\u003c/sub\u003e\u0026thinsp;~\u0026thinsp;0.79 in both conditions), consistent with its flat accuracy Δ.\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eFigure 1\u003c/strong\u003e \u003cp\u003eBootstrap 95% confidence intervals for accuracy differences\u003c/p\u003e \u003c/p\u003e \u003cp\u003eThese global patterns indicate that RAG provided a net performance boost in most settings, chiefly by helping models retrieve and correctly classify examples they initially missed (improved recall) with only minor trade-offs in precision.\u003c/p\u003e\n\u003ch3\u003eClass-Level Results\u003c/h3\u003e\n\u003cp\u003eFigure 2 shows how RAG especially improved performance with classes that models originally struggled with reducing instances of under-detection. For example, GPT-4.1 nano correctly recognized only 2.7% of instances of \u0026ldquo;Abuse towards child\u0026rdquo; in the test set, and 16.3% of \u0026ldquo;Panic attack\u0026rdquo; in cases without RAG, indicating that it was missing the vast majority of those at-risk queries. These patterns are evident in the confusion matrix, where many actual cases were being misclassified into the benign \u0026ldquo;No risk\u0026rdquo; category (explaining the near 87% recall for No risk). However, with RAG, the model\u0026rsquo;s sensitivity to these critical classes dramatically improved (\u0026ldquo;Abuse towards child\u0026rdquo; from 2.7% to 50.0%, and \u0026ldquo;Panic attack\u0026rdquo; from 16.3% to 73.6%). This represents a 47\u0026ndash;57 point increase in recall for those cohorts. Correspondingly, the F\u003csub\u003e1\u003c/sub\u003e for \u0026ldquo;Panic attack\u0026rdquo; soared from a low 0.28 to 0.78 with RAG. Other analogous improvements are also showcased in other models, leading to conclude that RAG consistently helped models catch more positive instances of volatile intent, thereby reducing false negatives in those classes.\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eFigure 2\u003c/strong\u003e \u003cp\u003ePer-class Precision, Recall and F1\u003c/p\u003e \u003c/p\u003e \u003cp\u003eRAG\u0026rsquo;s effect on precision behaved like a class-dependent action. In many cases, precision stayed high or improved slightly along with recall, indicating that the additional hits retrieved by RAG were mostly correct. For example, GPT-4.1 nano\u0026rsquo;s precision on \u0026ldquo;Abuse towards child\u0026rdquo; rose from 66.7% to 79.6% with RAG, even as it began capturing far more true child abuse cases (meaning, it did not sharply increase false positives for that class). Likewise, GPT-5 mini\u0026rsquo;s precision for \u0026ldquo;Harm towards others\u0026rdquo; ticked up from 86.3% to 86.7%, while its recall climbed to 92.9%, yielding a F₁ of 0.897. However, there were a few trade-offs where RAG improved recall at the cost of precision. Gemini 2.5 Pro\u0026rsquo;s performance on \u0026ldquo;Panic attack\u0026rdquo; is illustrative: RAG enabled it to catch about 30% more of the panic cases (recall 56.3% \u0026minus;\u0026thinsp;86.1%), but its precision on that class dropped from 90.7% to 63.5%. This suggests that the model started labeling more instances as \u0026ldquo;Panic attack\u0026rdquo; (correctly identifying most of the previously missed ones but also introducing some false positives). Yet, the F₁ for Gemini 2.5 Pro on panic queries improved substantially (from 0.694 to 0.731), indicating the recall gains outweighed the precision losses in net effect.\u003c/p\u003e \u003cp\u003eA similar pattern was seen with \u0026ldquo;Trauma\u0026rdquo; and \u0026ldquo;Prompt injection\u0026rdquo; for some models: those that were overtly conservative originally gained recall with RAG but sometimes misfired on a few easy cases, slightly reducing precision. Notably, majority \u0026ldquo;No risk\u0026rdquo; class predictions sometimes became less precise under RAG. Several models began flagging more inputs as risky (reducing false-negatives in minority classes), which inevitably meant a few truly safe inputs were misclassified as risks (increasing false-negatives on \u0026ldquo;No risk\u0026rdquo;). For instance, Gemini 2.5 Pro\u0026rsquo;s recall fell by 14.9 points (90.1% \u0026minus;\u0026thinsp;75.2%) with RAG, and its \u0026ldquo;No risk\u0026rdquo; precision only rose slightly (78.7% \u0026minus;\u0026thinsp;81.5%), resulting in a significantly lower F₁ (0.7245\u0026thinsp;\u0026minus;\u0026thinsp;0.6364). In contrast, other models managed a better balance: o4-mini saw a modest drop in \u0026ldquo;No risk\u0026rdquo; recall (90.1% \u0026minus;\u0026thinsp;83.6%) but a sizable precision boost (59.0% \u0026minus;\u0026thinsp;69.5%), ultimately still improving its \u0026ldquo;No risk\u0026rdquo; F₁ (0.713\u0026ndash;0.759). Overall, across all models and classes, RAG produced net gains in F₁ for 38 out of 42 class-level evaluations (7 intents across 6 models), while 4 cases showed slight declines.\u003c/p\u003e\n\u003ch3\u003eInter-Model Agreement\u003c/h3\u003e\n\u003cp\u003eAnother notable outcome of RAG is its effect on agreement between models. Pairwise prediction agreement rates and Cohen\u0026rsquo;s Kappa (κ) were computed between every pair of models, separately for the RAG and no-RAG conditions. Under no-RAG, the models often disagreed substantially, especially with varying accuracy counts. For example, GPT-4.1 nano\u0026rsquo;s predictions matched Claude Sonnet 4 on only about 60.6% of instances without RAG. Its agreement with GPT-5 mini was even lower at ~\u0026thinsp;49.0%, reflecting the tendency of a lightweight model like GPT-4.1 nano to misclassify many cases that the larger models got right. With RAG however, the models\u0026rsquo; outputs became more aligned. GPT-4.1 nano (with RAG) agreed with Claude on 75.1% of the test cases and with GPT-5 mini on ~\u0026thinsp;72.98%. In fact, RAG increased the pairwise agreement between GPT-4.1 nano and every other model by ~\u0026thinsp;15\u0026ndash;25%. Table\u0026nbsp;\u003cspan refid=\"Tab3\" class=\"InternalRef\"\u003e3\u003c/span\u003e shows a generalization of agreement metrics for more than two models, quantifying how consistently multiple models agree on predictions across all instances.\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab3\" border=\"1\"\u003e \u003ccaption language=\"En\"\u003e \u003cdiv class=\"CaptionNumber\"\u003eTable 3\u003c/div\u003e \u003cdiv class=\"CaptionContent\"\u003e \u003cp\u003eInter-model agreements\u003c/p\u003e \u003c/div\u003e \u003c/caption\u003e \u003ccolgroup cols=\"2\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eModel\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eAverage Model Consensus\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGPT-4.1 nano\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e \u003cp\u003e0.568\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eo4-mini\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e \u003cp\u003e0.818\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGemini 2.5 flash\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e \u003cp\u003e0.836\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGemini 2.5 Pro\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e \u003cp\u003e0.758\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eClaude Sonnet 4\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e \u003cp\u003e0.839\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eGPT-5 mini\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e \u003cp\u003e0.863\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e \u003cp\u003eMore generally, the spread in performance between models narrowed under RAG, leading to more consensus. Even models that were originally dissimilar showed markedly improved concordance. For instance, Gemini 2.5 Pro (the only model that didn\u0026rsquo;t improve overall with RAG) still became more similar to others: its agreement with o4-mini rose from 71.8% to 74.94% and with Claude from 77.08% to 78.39%. The overall trend retained that RAG improved inter-model agreement, indicating that the models not only became more accurate individually, but also more consistent as a group in the labels they assigned.\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eFigure 3\u003c/strong\u003e \u003cp\u003eCohen\u0026rsquo;s κ Pairwise Agreements\u003c/p\u003e \u003c/p\u003e \u003cp\u003eCohen\u0026rsquo;s κ (refer Fig.\u0026nbsp;3) reveals the same pattern while accounting for chance agreement. Without RAG, many model pairs had only moderate κ values despite high raw agreement on the majority class. However, RAG enabled high κ values to approach the \u0026ldquo;almost perfect\u0026rdquo; agreement range, reinforcing that the ensemble of models reached a much higher consensus with RAG. In practical terms, this means that given the same query, the models\u0026rsquo; classifications were more likely to coincide when retrieval was available, presumably because the retrieved evidence guided them toward similar conclusions.\u003c/p\u003e \u003cdiv id=\"Sec11\" class=\"Section2\"\u003e \u003ch2\u003eModel Consistency\u003c/h2\u003e \u003cp\u003eIntra-model consistency was examined for each model\u0026rsquo;s outputs between the RAG and no-RAG conditions. This analysis essentially calculates the number of test instances where RAG changed its prediction. The answers varied widely by model capacity. GPT-5 mini was the most stable, allocating the same classification with and without RAG for ~\u0026thinsp;88% of the test cases, altering its decision only\u0026thinsp;~\u0026thinsp;12% of the time (201/1680 instances discordant). Claude Sonnet 4 was similarly consistent, with ~\u0026thinsp;84.5% of outputs unchanged by RAG (discordant in 260 cases). In contrast, the smallest model GPT-4.1 nano changed its prediction on 39% of instances (659/1680) when using RAG, reflecting the earlier point that RAG heavily rewrote GPT-4.1 nano\u0026rsquo;s decision profile. The mid-range models fell in between: o4-mini changed\u0026thinsp;~\u0026thinsp;17% of the time (b\u0026thinsp;+\u0026thinsp;c\u0026thinsp;=\u0026thinsp;293), and Gemini 2.5 flash\u0026thinsp;~\u0026thinsp;14% (242 changes). Interestingly, Gemini 2.5 Pro\u0026rsquo;s predictions shifted on about 21.5% of instances (361/1680) with RAG (more than one might expect given its overall accuracy didn\u0026rsquo;t improve). A closer inspection found that many of Pro\u0026rsquo;s changes with RAG were different errors rather than net improvements, e.g. it started catching some \u0026ldquo;Panic attacks\u0026rdquo; it previously missed but also began missing some \u0026ldquo;No risk\u0026rdquo; cases it previously got right, roughly cancelling out. In contrast, for GPT-4.1 nano and o4-mini the vast majority of changes were beneficial corrections (c ≫ b, as noted). Overall, these consistency rates indicate that larger models are inherently more stable, they only adjust on a small subset of queries when additional context is provided, presumably those borderline cases where retrieval offers new clues. Smaller models, lacking robust internal knowledge, undergo more drastic output revision under RAG. From an ensemble perspective, RAG made the weaker models behave more like the stronger ones, hence the increased group agreement discussed above. We also note that even when models changed their answers under RAG, they usually changed from a wrong answer to the right one (for significant-improvement models), which is exactly the intended effect of retrieval augmentation.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec12\" class=\"Section2\"\u003e \u003ch2\u003eError Analysis \u0026amp; Confusion Patterns\u003c/h2\u003e \u003cp\u003e \u003cstrong\u003eFigure 4\u003c/strong\u003e \u003cp\u003eConfusion Matrices (Risk Category vs Model)\u003c/p\u003e \u003c/p\u003e \u003cp\u003eThe class confusion matrices (refer Fig.\u0026nbsp;4) provide further insight into the specific error reductions achieved by RAG. Without RAG, a dominant error mode for multiple models was over-predicting the \u0026ldquo;No risk\u0026rdquo; class, i.e. labeling volatile queries as safe. For example, GPT-4.1 nano\u0026rsquo;s raw confusion matrix (i.e. no-RAG) shows that for actual \u0026ldquo;Abuse towards child\u0026rdquo; cases, the model overwhelmingly predicted \u0026ldquo;No risk\u0026rdquo; in almost all 148 instances (hence its 97% recall on \u0026ldquo;No risk\u0026rdquo; vs only 2.7% on child abuse). Similar patterns were seen for \u0026ldquo;Panic attack\u0026rdquo; and \u0026ldquo;Trauma\u0026rdquo;, which were frequently confused with \u0026ldquo;No risk\u0026rdquo; or other benign categories. After enabling RAG, these confusions diminished dramatically. The matrices show far more weight on the diagonal for those classes, e.g. GPT-4.1 nano correctly classifies 74 out of 148 child-abuse cases with RAG (50% recall) instead of only 4/148 without RAG. Likewise, Claude Sonnet 4, which initially misidentified \u0026ldquo;Panic attack\u0026rdquo; cases as \u0026ldquo;Harm towards others\u0026rdquo; or \u0026ldquo;No risk\u0026rdquo;, managed to correctly identify twice as many of them with RAG (raising recall from 30% to 62%). These improvements indicate that RAG supplied relevant cues or knowledge that helped disambiguate user intents that the models previously missed. Another prevalent confusion was between certain volatile categories themselves, e.g. distinguishing \u0026ldquo;Panic attack\u0026rdquo; vs \u0026ldquo;Trauma\u0026rdquo;, or \u0026ldquo;Abuse towards child\u0026rdquo; vs \u0026ldquo;Harm towards others\u0026rdquo;, which can be subtle. The RAG condition slightly alleviated some of these as well (e.g. models better separated trauma from general harm), though residual cross-confusions remained in some cases. On the other hand, new error patterns introduced by RAG were relatively few. One observable issue was an increase in false positives for some volatile classes: e.g. Gemini 2.5 Pro with RAG sometimes misclassified harmless inputs as \u0026ldquo;Panic attack\u0026rdquo; or \u0026ldquo;Abuse\u0026rdquo;, contributing to its drop in \u0026ldquo;No risk\u0026rdquo; recall. These are cases where the retrieved content might have been misleading or the model over-interpreted a benign query as risky. Such errors highlight that RAG is not infallible, it can shift a model\u0026rsquo;s mistakes from \u0026ldquo;misses\u0026rdquo; to \u0026ldquo;false alarms.\u0026rdquo; However, from a safety perspective, many applications may prefer false positives (flagging a safe query for review) over false negatives (missing a truly risky query). Nonetheless, this is a trade-off to consider.\u003c/p\u003e \u003cp\u003eOverall, the confusion matrices confirm that RAG\u0026rsquo;s net impact was to reduce the most severe errors (failing to detect intent), even if it introduced a few mild confusions in return. The group consensus results support this: when all models\u0026rsquo; predictions disagree, it is often on those borderline cases where RAG\u0026rsquo;s influence varied, but such instances became rarer with RAG. Under RAG, a greater fraction of queries was unanimously or majority-voted into the correct class by the model ensemble, whereas without RAG there were more cases where at least one model (often the weaker ones) strayed with an incorrect label.\u003c/p\u003e \u003c/div\u003e"},{"header":"Discussion","content":"\u003cdiv id=\"Sec14\" class=\"Section2\"\u003e \u003ch2\u003eThe Precision-Recall Tradeoff\u003c/h2\u003e \u003cp\u003eIn this evaluation, RAG enabled models flagged fewer false negatives than their standalone counterparts in mental health contexts, particularly in the risk domains of child abuse, panic attacks and trauma. This result aligns with the findings of Lopez et al\u003csup\u003e14\u003c/sup\u003e and Xu et al\u003csup\u003e15\u003c/sup\u003e, who observed that retrieval-augmented models in clinical settings significantly improved sensitivity (recall) and reduced missed cases compared to standalone LLMs.\u003c/p\u003e \u003cp\u003eAugmenting generative models with relevant knowledge retrieval makes them more sensitive to critical risk language, significantly reducing the risk of missing instances of genuine risk.\u003csup\u003e\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e\u003c/sup\u003e RAG shifts the balance towards higher recall of crises at the expense of precision as systems are explicitly designed to maximize the capture of all relevant contextual evidence (high recall), even when this means retrieving additional extraneous material and thereby reducing precision.\u003csup\u003e\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e\u003c/sup\u003e These false alarms align with the safety-first design in healthcare settings, where systems often prefer to err on the side of caution.\u003csup\u003e\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec15\" class=\"Section2\"\u003e \u003ch2\u003eDifferential Impact with Model Capacity\u003c/h2\u003e \u003cp\u003eModel capacities mediated the benefit gained from enabling RAG. RAG enabled models showed disproportionately large improvements in smaller LLMs, whereas larger models showed marginal change. GPT-4.1 nano showcased drastic performance improvements with classification accuracy and recall surging to thresholds equivalent to those of larger models. This is consistent with existing literature, facilitating the conclusion that RAG enabled systems can often rival or surpass larger models.\u003csup\u003e\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e\u003c/sup\u003e In this analysis, moderately sized retrieval was enough to compensate for limitations in safety domains or implicit intent detection.\u003c/p\u003e \u003cp\u003eBy contrast, larger models (like GPT-5 mini) derived little measurable benefit from RAG. This suggests a substantial value of pre-encoded knowledge or inference capabilities. For such models, retrieving additional information provided redundant context, yielding only minor refinements at best. Some larger models also exhibited an occasional override of correct internal judgement (without RAG), surfacing that retrieval may introduce minor noise. These observations echo the notion of diminishing returns for augmentation as model size grows.\u003csup\u003e\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec16\" class=\"Section2\"\u003e \u003ch2\u003eAgreement and Consistency\u003c/h2\u003e \u003cp\u003eAn additional effect of RAG was its influence on model agreement and consistency. It was observed that enabling retrieval led to a marked increase in inter-model agreement. This harmonization effect affirmed that retrieval supplied an external knowledge cue that both models could latch onto.\u003csup\u003e\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003cp\u003eWe also examined intra-model consistency, where each model\u0026rsquo;s own classification pattern changed with retrieval. The data suggested that smaller models became more consistent in flagging certain cues. However, for larger models, minimal change was noticed. This emphasized that RAG could shift a model\u0026rsquo;s internal classification tendencies, especially for smaller models. It effectively re-calibrates models like GPT-4.1 nano to be more uniform and assertive in identifying critical issues. This proves useful as a system that responds the same way to the same stimuli (or conceptually similar stimuli) is more predictable and transparent.\u003csup\u003e\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003cp\u003eIn essence, retrieval served not only as an on-demand infusion of expert knowledge but also a curated memory of lived experience,\u003csup\u003e22\u003c/sup\u003e which is particularly crucial in mental health applications where oftentimes such services act as the last barricade to volatile situations. A chatbot like Wysa could, for instance, retrieve the appropriate response script or risk assessment checklist whenever it suspects intent suggesting a crisis, ensuring its next action is grounded in vetted knowledge rather than just the vagaries of neural weights. The results in this paper provide empirical support that a retrieval strategy materially improves safety performance.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec17\" class=\"Section2\"\u003e \u003ch2\u003eImplications and Future Direction\u003c/h2\u003e \u003cp\u003eIt has been expected that large scale LLMs, by virtue of extensive training, will implicitly learn to predict intent around crisis-related content.\u003csup\u003e\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e\u003c/sup\u003e The work here displays how explicit retrieval of relevant knowledge can significantly bolster a model\u0026rsquo;s safety performance, and even fundamentally change effectiveness in smaller models.\u003c/p\u003e \u003cp\u003eThis study can offer guidance to system designers on how model size and architecture influence the returns from retrieval If using a smaller language model (e.g. for on-device deployments or to minimize costs), our results encourage integrating a robust retrieval component because the payoff can be significant. From a broader perspective, these findings underscore a paradigm shift for AI safety in healthcare: rather than treating safety as purely a function of model censorship or static fine-tuning, one can treat it as an information retrieval problem.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec18\" class=\"Section2\"\u003e \u003ch2\u003eFuture directions\u003c/h2\u003e \u003cp\u003eMoving forward, broader evaluation and targeted training will be crucial to further improve crisis intent detection. Recent benchmarks that probe LLM responses across diverse crisis scenarios reveal that even state-of-the-art models often miss subtly expressed distress cues and can produce inappropriate or formulaic responses.\u003csup\u003e\u003cspan citationid=\"CR24\" class=\"CitationRef\"\u003e24\u003c/span\u003e\u003c/sup\u003e These gaps underscore the need for better alignment and specialized tuning to handle nuanced expressions of crisis safely. One promising avenue is domain-specific fine-tuning of LLMs - for example, task-specific instruction tuning in the mental health domain has boosted performance so much that smaller specialized models matched or even outperformed much larger general models\u003csup\u003e\u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e\u003c/sup\u003e. Another complementary direction is leveraging retrieval augmentation (RAG) to enhance smaller LLMs in safety-critical tasks. Injecting external knowledge via RAG can curb hallucinations and provide human-vetted context.\u003csup\u003e\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e\u003c/sup\u003e This aligns with observations that RAG-equipped systems can rival or surpass far bigger LLMs, yielding especially high returns at smaller scales. By combining efficient, lightweight models with robust retrieval of vetted crisis information (for example, well-tested intervention scripts and checklists), future systems could deliver cost-effective on-device crisis intent detection without sacrificing reliability.\u003c/p\u003e \u003c/div\u003e"},{"header":"Conclusion","content":"\u003cp\u003eUltimately, the study highlights that safety-aware behavior can be augmented through retrieval, and predicts that the next generation of digital mental health interventions will not only be empathetic and engaging, but also consistently safe, responsive to crises, and grounded in the same reliable knowledge and experience that human practitioners use. Such advancements bring us a step closer to AI systems that genuinely support clinicians and patients in tandem, combining the efficiency of automation with the prudence of evidence-based practice.\u003c/p\u003e"},{"header":"Abbreviations","content":"\u003cdiv class=\"DefinitionList\"\u003e \u003cdiv class=\"DefinitionListEntry\"\u003e \u003cdiv class=\"Term\"\u003eAI\u003c/div\u003e \u003cdiv class=\"Description\"\u003e \u003cp\u003eArtificial Intelligence\u003c/p\u003e \u003c/div\u003e \u003c/div\u003e \u003cdiv class=\"DefinitionListEntry\"\u003e \u003cdiv class=\"Term\"\u003eLLM\u003c/div\u003e \u003cdiv class=\"Description\"\u003e \u003cp\u003eLarge Language Model\u003c/p\u003e \u003c/div\u003e \u003c/div\u003e \u003cdiv class=\"DefinitionListEntry\"\u003e \u003cdiv class=\"Term\"\u003eRAG\u003c/div\u003e \u003cdiv class=\"Description\"\u003e \u003cp\u003eRetrieval Augmented Generation\u003c/p\u003e \u003c/div\u003e \u003c/div\u003e \u003cdiv class=\"DefinitionListEntry\"\u003e \u003cdiv class=\"Term\"\u003ePII\u003c/div\u003e \u003cdiv class=\"Description\"\u003e \u003cp\u003ePersonally Identifiable Information\u003c/p\u003e \u003c/div\u003e \u003c/div\u003e \u003c/div\u003e"},{"header":"Declarations","content":"\u003cp\u003eAcknowledgements\u003c/p\u003e\n\u003cp\u003eNot applicable.\u003c/p\u003e\n\u003cp\u003eFunding\u003c/p\u003e\n\u003cp\u003eThe study did not receive any funding.\u003c/p\u003e\n\u003cp\u003eAuthor Information\u003c/p\u003e\n\u003cp\u003eAuthors and Affiliations\u003c/p\u003e\n\u003cp\u003eWysa Inc., Boston, MA, United States\u003c/p\u003e\n\u003cp\u003eAnand Gupta, Akshat Surolia, Shubham Mishra, Shakil Imtiaz, \u0026amp; Chaitali Sinha\u003c/p\u003e\n\u003cp\u003eContributions\u003c/p\u003e\n\u003cp\u003eAG and CS conceived of and designed the study. AG, AK and SM contributed to the data collection of the study. SI: data analysis, drafting of the manuscript, revision and editing. CS: review and editing, supervision, project administration. All authors read and approved the final manuscript.\u003c/p\u003e\n\u003cp\u003eCorresponding Author\u003c/p\u003e\n\u003cp\u003eCorrespondence to Shakil Imtiaz ([email protected]).\u003c/p\u003e\n\u003cp\u003eEthics declarations\u003c/p\u003e\n\u003cp\u003eEthics approval and consent to participate\u003c/p\u003e\n\u003cp\u003eNot applicable.\u003c/p\u003e\n\u003cp\u003eConsent for publication\u003c/p\u003e\n\u003cp\u003eNot applicable.\u003c/p\u003e\n\u003cp\u003eCompeting interests\u003c/p\u003e\n\u003cp\u003eAG, AS, SM, SI, and CS are employees of Wysa. The author(s) had access to anonymized user data for the purpose of this study. \u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\u003cli\u003e\u003cspan\u003eAndrade, L. et al. Cross-national comparisons of the prevalences and correlates of mental disorders. WHO International Consortium in Psychiatric Epidemiology. Bull World Health Organ [Internet]. ;78(4):413\u0026thinsp;\u0026ndash;\u0026thinsp;26. (2000). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.ncbi.nlm.nih.gov/pubmed/10885160\u003c/span\u003e\u003cspan address=\"https://www.ncbi.nlm.nih.gov/pubmed/10885160\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSpytska, L. The use of artificial intelligence in psychotherapy: development of intelligent therapeutic systems. BMC Psychology [Internet]. Feb 28 [cited 2025 Nov 20];13(1):175. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1186/s40359-025-02491-9\u003c/span\u003e\u003cspan address=\"10.1186/s40359-025-02491-9\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBendig, E., Erb, B., Schulze-Thuesing, L. \u0026amp; Baumeister, H. The Next Generation: Chatbots in Clinical Psychology and Psychotherapy to Foster Mental Health - A Scoping Review. Verhaltenstherapie [Internet]. 2019 Aug 20 [cited 2025 Nov 20];32(Suppl. 1):64\u0026ndash;76. Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://dx.doi.org/10.1159/000501812\u003c/span\u003e\u003cspan address=\"10.1159/000501812\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHinshaw, S. P. \u0026amp; Stier, A. Stigma as related to mental disorders. Annu Rev Clin Psychol [Internet]. ;4(1):367\u0026thinsp;\u0026ndash;\u0026thinsp;93. (2008). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1146/annurev.clinpsy.4.022007.141245\u003c/span\u003e\u003cspan address=\"10.1146/annurev.clinpsy.4.022007.141245\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eJung, H., von Sternberg, K. \u0026amp; Davis, K. The impact of mental health literacy, stigma, and social support on attitudes toward mental health help-seeking. Int J Ment Health Promot [Internet]. ;19(5):252\u0026thinsp;\u0026ndash;\u0026thinsp;67. (2017). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1080/14623730.2017.1345687\u003c/span\u003e\u003cspan address=\"10.1080/14623730.2017.1345687\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHarvey, A. G. \u0026amp; Gumport, N. B. Evidence-based psychological treatments for mental disorders: modifiable barriers to access and possible solutions. Behav Res Ther [Internet]. ;68:1\u0026ndash;12. (2015). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.sciencedirect.com/science/article/pii/S0005796715000285\u003c/span\u003e\u003cspan address=\"https://www.sciencedirect.com/science/article/pii/S0005796715000285\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHo, K. P., Hunt, C. \u0026amp; Li, S. Patterns of help-seeking behavior for anxiety disorders among the Chinese speaking Australian community. Soc Psychiatry Psychiatr Epidemiol [Internet]. ;43(11):872-7. (2008). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1007/s00127-008-0387-0\u003c/span\u003e\u003cspan address=\"10.1007/s00127-008-0387-0\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLewis, P. et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. Larochelle H, Ranzato M, Hadsell R, Balcan MF, Lin H, editors. Neural Inf Process Syst [Internet]. ;abs/2005.11401:9459-74. (2020). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html\u003c/span\u003e\u003cspan address=\"https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAyala, O. \u0026amp; Bechard, P. Reducing hallucination in structured outputs via Retrieval-Augmented Generation. In: Yang Y, Davani A, Sil A, Kumar A, editors. Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 6: Industry Track) [Internet]. Stroudsburg, PA, USA: Association for Computational Linguistics; pp. 228\u0026thinsp;\u0026ndash;\u0026thinsp;38. Available from: https://aclanthology.org/2024.naacl-industry.19/ (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eShen, M., Umar, M., Maeng, K., Suh, G. E. \u0026amp; Gupta, U. Towards understanding systems trade-offs in retrieval-Augmented Generation model inference [Internet]. arXiv [cs.AR]. (2024). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2412.11854\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2412.11854\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eVieira, S. M., Kaymak, U. \u0026amp; Sousa, J. M. C. Cohen\u0026rsquo;s kappa coefficient as a performance measure for feature selection. In: International Conference on Fuzzy Systems [Internet]. IEEE; pp. 1\u0026ndash;8. (2010). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://ieeexplore.ieee.org/abstract/document/5584447/\u003c/span\u003e\u003cspan address=\"https://ieeexplore.ieee.org/abstract/document/5584447/\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePembury Smith, M. Q. R. \u0026amp; Ruxton, G. D. Effective use of the McNemar test. Behav Ecol Sociobiol [Internet]. ;74(11). (2020). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1007/s00265-020-02916-y\u003c/span\u003e\u003cspan address=\"10.1007/s00265-020-02916-y\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDiCiccio, T. J. \u0026amp; Efron, B. Bootstrap confidence intervals. Stat Sci [Internet]. Sept 1;11(3):189\u0026ndash;228. (1996). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1214/ss/1032280214\u003c/span\u003e\u003cspan address=\"10.1214/ss/1032280214\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLopez, I. et al. Clinical entity augmented retrieval for clinical information extraction. NPJ Digit Med [Internet]. ;8(1):45. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.nature.com/articles/s41746-024-01377-1\u003c/span\u003e\u003cspan address=\"https://www.nature.com/articles/s41746-024-01377-1\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eXu, S., Yan, Z., Dai, C. \u0026amp; Wu, F. MEGA-RAG: a retrieval-augmented generation framework with multi-evidence guided answer refinement for mitigating hallucinations of LLMs in public health. Front Public Health [Internet]. ;13. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.3389/fpubh.2025.1635381\u003c/span\u003e\u003cspan address=\"10.3389/fpubh.2025.1635381\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eUluslu, A. Y., Michail, A. \u0026amp; Clematide, S. Utilizing Large Language Models to Identify Evidence of Suicidality Risk through Analysis of Emotionally Charged Posts. In: Proceedings of the 9th Workshop on Computational Linguistics and Clinical Psychology (CLPsych 2024) [Internet]. Association for Computational Linguistics; 2024 [cited 2025 Nov 20]. pp. 264-9. Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.zora.uzh.ch/id/eprint/275598/\u003c/span\u003e\u003cspan address=\"https://www.zora.uzh.ch/id/eprint/275598/\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAmmar, A., Koubaa, A., Nacar, O. \u0026amp; Boulila, W. Optimizing retrieval-augmented generation: Analysis of hyperparameter impact on performance and efficiency [Internet]. arXiv [cs.LG]. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2505.08445\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2505.08445\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHicks, S. A. et al. On evaluation metrics for medical applications of artificial intelligence. Sci Rep [Internet]. ;12(1):5979. (2022). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.nature.com/articles/s41598-022-09954-8\u003c/span\u003e\u003cspan address=\"https://www.nature.com/articles/s41598-022-09954-8\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eNing, J., Kong, Y., Long, Y., Callan, J. \u0026amp; Less LLM, more documents: Searching for improved RAG [Internet]. arXiv [cs.IR]. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2510.02657\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2510.02657\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eGaber, F. et al. Evaluating large language model workflows in clinical decision support for triage and referral and diagnosis. npj Digital Medicine [Internet]. May 9 [cited 2025 Nov 20];8(1):263. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.nature.com/articles/s41746-025-01684-1\u003c/span\u003e\u003cspan address=\"https://www.nature.com/articles/s41746-025-01684-1\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHagstr\u0026ouml;m, L., Saynova, D., Norlund, T., Johansson, M. \u0026amp; Johansson, R. The effect of scaling, retrieval augmentation and form on the factual consistency of Language Models [Internet]. arXiv [cs.CL]. (2023). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2311.01307\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2311.01307\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eGan, W., Dao, M-S. \u0026amp; Zettsu, K. Case-based Reasoning Augmented Large Language Model framework for decision making in realistic safety-critical driving scenarios [Internet]. arXiv [cs.AI]. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2506.20531\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2506.20531\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHe, M. \u0026amp; Garner, P. N. Can chatgpt detect intent? evaluating large language models for spoken language understanding. arXiv preprint arXiv:230513512 [Internet]. ; (2023). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2305.13512\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2305.13512\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLi, T. et al. Can Large Language Models identify Implicit Suicidal ideation? An empirical evaluation [Internet]. arXiv [cs.CL]. (2025). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://arxiv.org/abs/2502.17899\u003c/span\u003e\u003cspan address=\"http://arxiv.org/abs/2502.17899\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eXu, X. et al. Mental-LLM: Leveraging large language models for mental health prediction via online text data: Leveraging large language models for mental health prediction via online text data. Proc ACM Interact Mob Wearable Ubiquitous Technol [Internet]. ;8(1):1\u0026ndash;32. (2024). Available from: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttp://dx.doi.org/10.1145/3643540\u003c/span\u003e\u003cspan address=\"10.1145/3643540\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"scientific-reports","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"scirep","sideBox":"Learn more about [Scientific Reports](http://www.nature.com/srep/)","snPcode":"","submissionUrl":"","title":"Scientific Reports","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Scientific Reports","inReviewEnabled":true,"inReviewRevisionsEnabled":true},"keywords":"Digital Mental Health Intervention, Large Language Model, Retrieval Augmented Generation, Accuracy, Recall, Precision","lastPublishedDoi":"10.21203/rs.3.rs-8327266/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-8327266/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003ch2\u003eBackground\u003c/h2\u003e \u003cp\u003eDigital mental health interventions (DMHIs) offer scalable support but ensuring they accurately detect users\u0026rsquo; intent during volatile situations can be challenging. Pure parametric Large Language models (LLMs) do not contain specific safety critical architecture, and can miss critical cues, or hallucinate, undermining reliability. Retrieval Augmented Generation (RAG), which supplements an LLM with retrieved context, could enhance intent detection during volatile situations. This study examined whether integrating RAG into a specific DMHI (Wysa) improves intent classification and safety risk detection compared to using the base LLM alone.\u003c/p\u003e\u003ch2\u003eMethods\u003c/h2\u003e \u003cp\u003eThis paper evaluates six LLM models within Wysa via a controlled comparison of RAG-enabled versus RAG-disabled modes. Anonymized real and synthetic user-chatbot exchanges were manually labeled against multi-class intent categories (e.g. self-harm, abuse, panic). We computed classification accuracy, recall, precision and F1 scores against ground truth labels and tested differences for statistical significance. Performance was also examined by risk category and inter-model agreement.\u003c/p\u003e\u003ch2\u003eResults\u003c/h2\u003e \u003cp\u003eRAG consistently improved safety intent detection with five of six models demonstrating significant accuracy gains, especially with smaller models (with increased accuracy ranging from ~\u0026thinsp;48% to ~\u0026thinsp;73% with RAG). Recall for high-risk intent (like child abuse, and panic attack) increased substantially, with missed cases dropping by over half. Models also normalized to reach consistent agreement predictions under RAG. However, improved sensitivity came with a slight increase in false negatives, reflecting a precision-recall trade-off (fewer instances of missed risk at the cost of more false alarms).\u003c/p\u003e\u003ch2\u003eConclusions\u003c/h2\u003e \u003cp\u003eIntegrating RAG in mental health settings enhances detection of user intent and safety concerns. RAG particularly benefited smaller LLMs, narrowing performance gaps with larger, advanced models and reducing missed critical flags. While RAG caused a rise in false alarms, the trade-off is acceptable in a safety-critical context. Overall, these findings support RAG as a promising approach to improve the accuracy, consistency and safety of LLM-driven DMHIs.\u003c/p\u003e","manuscriptTitle":"Retrieval-Augmented Generation in LLMs for Mental Health: Examining the Impact on User Intent Detection in Wysa","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-12-30 00:10:32","doi":"10.21203/rs.3.rs-8327266/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"reviewerAgreed","content":"70849644085125988745263340746951142921","date":"2026-05-14T16:01:29+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"198151615388217761167269209988025539185","date":"2026-05-12T07:05:26+00:00","index":"hide","fulltext":""},{"type":"editorInvitedReview","content":"","date":"2025-12-23T03:22:25+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"286365251160845824088174224370882708986","date":"2025-12-18T06:45:33+00:00","index":"hide","fulltext":""},{"type":"reviewersInvited","content":"","date":"2025-12-18T06:37:58+00:00","index":"","fulltext":""},{"type":"editorInvited","content":"","date":"2025-12-16T05:12:55+00:00","index":"","fulltext":""},{"type":"editorAssigned","content":"","date":"2025-12-11T05:29:19+00:00","index":"","fulltext":""},{"type":"checksComplete","content":"","date":"2025-12-11T05:28:19+00:00","index":"","fulltext":""},{"type":"submitted","content":"Scientific Reports","date":"2025-12-10T11:53:48+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"scientific-reports","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"scirep","sideBox":"Learn more about [Scientific Reports](http://www.nature.com/srep/)","snPcode":"","submissionUrl":"","title":"Scientific Reports","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Scientific Reports","inReviewEnabled":true,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"4eee97ef-6719-4a65-9081-12e6ea74f27b","owner":[],"postedDate":"December 30th, 2025","published":true,"recentEditorialEvents":[{"type":"reviewerAgreed","content":"70849644085125988745263340746951142921","date":"2026-05-14T16:01:29+00:00","index":87,"fulltext":""},{"type":"reviewerAgreed","content":"198151615388217761167269209988025539185","date":"2026-05-12T07:05:26+00:00","index":85,"fulltext":""}],"rejectedJournal":[],"revision":"","amendment":"","status":"under-review","subjectAreas":[{"id":59866876,"name":"Health sciences/Health care"},{"id":59866877,"name":"Physical sciences/Mathematics and computing"},{"id":59866878,"name":"Biological sciences/Psychology"},{"id":59866879,"name":"Social science/Psychology"}],"tags":[],"updatedAt":"2025-12-30T00:10:32+00:00","versionOfRecord":[],"versionCreatedAt":"2025-12-30 00:10:32","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-8327266","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-8327266","identity":"rs-8327266","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00
unpaywall
last seen: 2026-05-22T02:00:06.705733+00:00
License: CC-BY-4.0