BioBERT identifies violence language in mental health records with high accuracy
Clinical text about interpersonal violence is buried in the everyday language of psychiatric records, where a single note can carry information about assault, domestic abuse, victimization, or a patient’s role as a perpetrator. In this BMJ Open study, investigators tested whether a pretrained transformer model could extract and classify those references from electronic health records at scale in a large specialist mental healthcare provider. The work matters because violence exposure and violence perpetration often shape risk assessment, safeguarding decisions, and the intensity of follow-up in mental health care.
The dataset came from the Clinical Records Interactive Search database, which holds more than 500,000 de-identified records from the South London and Maudsley NHS Foundation Trust. From searches based on 17 predefined keywords, 3,771 text fragments were randomly selected from the records of 2,832 patients. Each fragment was annotated as affirmed, negated, or irrelevant for violence presence, patient status, and violence type. The annotation scheme separated six labels for model training and testing: violence presence, perpetrator, victim, domestic, physical, and sexual violence.
The structure of the task reflects a common problem in clinical informatics. Mental health notes are rich in context but inconsistent in phrasing, and violence is often described indirectly, with negation or ambiguity. A rule-based search alone can miss clinically important cases or pull in irrelevant passages. A transformer model such as BioBERT is built for exactly this kind of language problem, because it learns how nearby words change meaning across biomedical text rather than relying only on keywords.
Annotation, classification, and the role of negation
A multidisciplinary team developed and refined the annotation guidelines before model training began. Fragments were classified as affirmed when they clearly referred to violence, negated when they explicitly ruled it out, and irrelevant when the keyword was not actually being used in a violence-related way. This distinction is not trivial in real-world records, where a word may appear in a safeguarding discussion, a historical narrative, or a risk review without confirming that violence occurred.
Among all annotations affirmed for violence, 78% — 1,724 fragments — referred to physical violence. Patient status was recorded as perpetrator in 61% — 1,350 fragments — and domestic violence in 33% — 731 fragments. Sexual violence appears to have been less common in the annotated sample, yet it is clinically important because even sparse documentation can carry major implications for trauma-informed care, relapse risk, and safety planning. The distribution of these labels suggests that mental health records capture violence most often as an immediate physical event or as a risk-relevant behavioral role, rather than as a neatly coded diagnosis.
A single note may describe the same patient as both victim and perpetrator across different encounters.
Precision and recall across six violence labels
The machine learning component used a fine-tuned BioBERT model with 10-fold cross-validation. Performance was reported using precision, recall, and F1 score across the six binary labels. Precision ranged from 89% for perpetrator classification to 98% for sexual violence. Recall ranged from 89% for victim and perpetrator labels to 97% for sexual violence.
Those numbers are strong for a clinical extraction task built on messy narrative text. In practical terms, high precision means fewer false positives, which matters when records are being reviewed for safeguarding, epidemiology, or service planning. High recall matters just as much because missed violence references can leave a clinician blind to abuse history or current risk. The model performed well enough to suggest that routine deployment could meaningfully shorten the time needed to identify violence-related content in large psychiatric datasets.
The data also show how difficult a simple keyword strategy would be to trust on its own. A note containing a violence-related term does not automatically indicate actual violence, and a record describing a patient as a witness may be clinically different from one describing the patient as a victim or perpetrator. The model’s ability to separate these roles is central to its value, because those distinctions affect both clinical interpretation and research validity.
Why this matters for psychiatric care and service research
Mental health systems regularly face the problem of incomplete visibility. Violence history may be documented in free text long before it is reflected in structured fields, if it is reflected there at all. Automated extraction offers a way to recover clinically meaningful information from large archives of narrative notes, especially in services where manual chart review would be too slow to support population-level work.
This has direct relevance for risk assessment, epidemiology, and quality improvement. A model that can reliably detect domestic, physical, and sexual violence within psychiatric records could support studies on associations between trauma exposure and service use, help teams identify patterns in documented victimization, and improve the measurement of violence-related burden across patient populations. It also creates a possible bridge between routine care and computational phenotyping, where language in the record is used to build better clinical datasets.
The findings also speak to the biology of why violence documentation matters in mental healthcare. Exposure to violence can influence symptom severity, sleep, substance use, self-harm risk, and engagement with services. Perpetration can signal social instability, acute agitation, substance-related disinhibition, or other clinical states that demand careful management. Extracting these references accurately from records helps clinicians and researchers see the full risk context rather than the narrow snapshot that structured coding alone often provides.
Scalability without losing clinical meaning
The study shows that modern NLP can work in a specialist psychiatric setting without flattening the nuance of human documentation. BioBERT was not asked to make a diagnosis or infer causality; it was trained to classify explicit language already present in the record. That is a realistic and defensible use of machine learning in healthcare, because the model is handling a bounded linguistic task rather than pretending to replace clinical judgment.
Still, the sample came from a single specialist mental health trust, and the annotations were generated from predefined keyword searches. Those design choices support controlled evaluation, but they also mean the model’s performance may not transfer unchanged to other institutions, other note styles, or other patient populations. The 17 keyword approach can also shape which fragments enter the dataset in the first place, influencing what the model learns to recognize.
DOI
The article was published in BMJ Open in 2022: 10.1136/bmjopen-2021-052911. The work adds a practical demonstration that transformer-based NLP can extract and classify interpersonal violence references in psychiatric EHRs with useful accuracy, while leaving open the harder question of how well the same approach performs across other health systems and documentation practices.
- • BMJ Open DOI 10.1136/bmjopen-2021-052911: https://doi.org/10.1136/bmjopen-2021-052911