An ontology-guided knowledge graph and retrieval-augmented LLM framework for interpretable mental health assessment

Abstract Mental health detection from social media has gained increasing attention due to the spontaneous expression of psychological states on online platforms. However, accurate interpretation remains challenging because social media language is highly contextual, ambiguous, and often includes sarcasm, metaphors, or non-clinical expressions, which can lead to unreliable predictions. Existing approaches based on machine learning, deep learning, transformers, and large language models (LLMs) primarily rely on text-driven patterns and often lack explicit ontology-guided grounding, structured knowledge validation, and interpretability. Although LLMs improve contextual reasoning, their predictions can be inconsistent and prone to hallucination when not supported by structured domain knowledge and a unified cross-component validation mechanism. To address these limitations, this paper proposes an ontology-guided framework that integrates a Knowledge Graph (KG), an Ontology-Informed Retrieval Classifier (ORC), and a Large Language Model for interpretable mental health detection from social media text. The framework leverages the Human Phenotype Ontology (HPO) to guide symptom extraction and Knowledge Graph construction, normalizing informal linguistic expressions into ontology-grounded representations. A key design contribution is an explicit KG–ORC cross-validation consistency gate, which requires both the Knowledge Graph and the ORC module to independently reach agreement before a prediction is committed reducing erroneous inferences from either component alone. The LLM is deliberately restricted to a post-validation role, generating human-readable explanations and supportive recommendations only from validated outputs, thereby reducing hallucination risks and preserving knowledge-consistency. The proposed framework is evaluated on the Dreaddit dataset, a large-scale, multi-domain Reddit corpus for stress and mental health analysis. Empirical evaluation on the HPO guided symptom extraction confirms differential detection rates of 56.04% in stress positive posts versus 31.11% in stress negative posts, validating the signal relevance of the ontology-driven extraction. End-to-end binary classification on the held-out test split achieves an accuracy of 74.82% with an F1-score of 75.64%. Crucially, on the 66.55% of instances where the KG and ORC modules reach consensus, the consistent subset accuracy rises to 78.84% (F1 = 78.28%), compared to 63.03% for the Knowledge Graph alone. The KG–ORC agreement rate across the full test set is 82.02%. These results demonstrate that the KG–ORC cross-validation gate measurably improves predictive reliability over single component baselines, and that ontology-guided, knowledge-grounded reasoning offers a principled path toward interpretable and knowledge-consistent mental health analysis from social media.

Authors

Institutions

Publication Details

Journal
Social Network Analysis and Mining
Published
2026-08-14
DOI
https://doi.org/10.1007/s13278-026-01625-0
Primary Topic
Mental Health via Writing
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

An ontology-guided knowledge graph and retrieval-augmented LLM framework for interpretable mental health assessment

Husnain Rafiq, Muhammad Tanvir Afzal, Amina Tahir, Ghulam Mustafa
Social Network Analysis and Mining
Mental Health via Writing
article

An ontology-guided knowledge graph and retrieval-augmented LLM framework for interpretable mental health assessment

Husnain Rafiq, Muhammad Tanvir Afzal, Amina Tahir, Ghulam Mustafa
article en

Abstract

Abstract Mental health detection from social media has gained increasing attention due to the spontaneous expression of psychological states on online platforms. However, accurate interpretation remains challenging because social media language is highly contextual, ambiguous, and often includes sarcasm, metaphors, or non-clinical expressions, which can lead to unreliable predictions. Existing approaches based on machine learning, deep learning, transformers, and large language models (LLMs) primarily rely on text-driven patterns and often lack explicit ontology-guided grounding, structured knowledge validation, and interpretability. Although LLMs improve contextual reasoning, their predictions can be inconsistent and prone to hallucination when not supported by structured domain knowledge and a unified cross-component validation mechanism. To address these limitations, this paper proposes an ontology-guided framework that integrates a Knowledge Graph (KG), an Ontology-Informed Retrieval Classifier (ORC), and a Large Language Model for interpretable mental health detection from social media text. The framework leverages the Human Phenotype Ontology (HPO) to guide symptom extraction and Knowledge Graph construction, normalizing informal linguistic expressions into ontology-grounded representations. A key design contribution is an explicit KG–ORC cross-validation consistency gate, which requires both the Knowledge Graph and the ORC module to independently reach agreement before a prediction is committed reducing erroneous inferences from either component alone. The LLM is deliberately restricted to a post-validation role, generating human-readable explanations and supportive recommendations only from validated outputs, thereby reducing hallucination risks and preserving knowledge-consistency. The proposed framework is evaluated on the Dreaddit dataset, a large-scale, multi-domain Reddit corpus for stress and mental health analysis. Empirical evaluation on the HPO guided symptom extraction confirms differential detection rates of 56.04% in stress positive posts versus 31.11% in stress negative posts, validating the signal relevance of the ontology-driven extraction. End-to-end binary classification on the held-out test split achieves an accuracy of 74.82% with an F1-score of 75.64%. Crucially, on the 66.55% of instances where the KG and ORC modules reach consensus, the consistent subset accuracy rises to 78.84% (F1 = 78.28%), compared to 63.03% for the Knowledge Graph alone. The KG–ORC agreement rate across the full test set is 82.02%. These results demonstrate that the KG–ORC cross-validation gate measurably improves predictive reliability over single component baselines, and that ontology-guided, knowledge-grounded reasoning offers a principled path toward interpretable and knowledge-consistent mental health analysis from social media.

Social Network Analysis and Mining
Edge Hill University (GB), Gulf University for Science & Technology (KW), University of Applied Sciences Potsdam (DE), Shifa Tameer-e-Millat University (PK)
Edge Hill University
Quality Education
Openalex Percentile: Top 5%
Mental Health via Writing
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.