User text
Conversational input enters the safety pipeline before response generation.
Safety Net is the predictive guardrail responsible for examining high-risk conversational input before BATINARA allows the generative response path to continue. The module was designed around high sensitivity, recall-oriented evaluation and explicit safety override.
BATINARA combines predictive and generative components. The Safety Net Model sits before the response generator and acts as a decision layer for crisis-sensitive input.
When the risk score crosses the configured intervention threshold, the system does not rely on free-form generation. Instead, BATINARA switches to a predefined safety response path. This makes the model part of the application's ethical control architecture, not just an isolated machine learning experiment.
Safety Net provides a binary risk decision that becomes one of the highest-priority signals inside BATINARA's Dynamic Context Integration Logic.
Conversational input enters the safety pipeline before response generation.
Input is normalized and tokenized for the IndoBERT classifier.
The model estimates the probability of high-risk crisis language.
A configurable probability threshold converts the score into a safety decision.
High-risk input triggers the protected BATINARA response path instead of normal generation.
Class weights are integrated into cross-entropy loss so the training process gives appropriate importance to both classes instead of treating every error as equally costly.
The training configuration selects the best checkpoint using recall, aligning model selection with the safety objective of minimizing missed risk signals.
Train and evaluation partitions preserve label distribution so performance is measured on representative class proportions.
The deployment layer uses a configurable probability threshold to control intervention sensitivity independently from the default class decision.
The model was fine-tuned using a recall-centered training configuration with early stopping and class-weighted loss.
Text is cleaned and normalized before the data is divided using stratification to preserve class proportions between training and evaluation sets.

Balanced class weights are computed and prepared for the custom training objective so class imbalance does not dominate the optimization process.

The Hugging Face Trainer is extended so PyTorch CrossEntropyLoss receives the calculated class weights directly.

Model checkpoints are evaluated using recall as the primary selection metric, with early stopping used to reduce overfitting.

The final classifier returns a probability score that BATINARA converts into a safety decision using the deployment threshold.

The published BATINARA evaluation reports very high recall for the crisis-detection module, supporting its role as the system's safety gate.
High-risk classification can interrupt the normal generative-response pathway.
Model selection is aligned with high-sensitivity safety-critical classification.

Safety Net is connected to BATINARA's chat pipeline. Its prediction is evaluated before the normal LLM response is returned to the user.
This separation between predictive risk control and generative conversation is one of the central design decisions of the BATINARA research system.
Explore the complete BATINARA architecture →Continue to the main BATINARA case study to see how safety, emotion classification, clinical context and the LLM work together.