🤖 AI Summary
To address safety risks impeding the trustworthy deployment of large language models (LLMs) in critical applications, this paper proposes a dual-path safety response framework for AI agents. On the input side, it introduces a fine-grained, four-level risk taxonomy for precise threat identification; on the output side, it integrates retrieval-augmented generation (RAG) with an explainable fine-tuned model to ensure hallucination-resistant responses and auditable decision-making. The framework uniquely unifies supervised fine-tuning of a safety classifier, a structured risk taxonomy, RAG, and an interpretable fine-tuning module into a single end-to-end pipeline. Evaluated on public benchmarks, it significantly outperforms TinyR1-Safety-8B. On a custom high-risk test set, all modules achieve 100% safety compliance, with a risk recall rate of 99.3%, demonstrating both comprehensive coverage and strong domain adaptability.
📝 Abstract
With the widespread application of Large Language Models (LLMs), their associated security issues have become increasingly prominent, severely constraining their trustworthy deployment in critical domains. This paper proposes a novel safety response framework designed to systematically safeguard LLMs at both the input and output levels. At the input level, the framework employs a supervised fine-tuning-based safety classification model. Through a fine-grained four-tier taxonomy (Safe, Unsafe, Conditionally Safe, Focused Attention), it performs precise risk identification and differentiated handling of user queries, significantly enhancing risk coverage and business scenario adaptability, and achieving a risk recall rate of 99.3%. At the output level, the framework integrates Retrieval-Augmented Generation (RAG) with a specifically fine-tuned interpretation model, ensuring all responses are grounded in a real-time, trustworthy knowledge base. This approach eliminates information fabrication and enables result traceability. Experimental results demonstrate that our proposed safety control model achieves a significantly higher safety score on public safety evaluation benchmarks compared to the baseline model, TinyR1-Safety-8B. Furthermore, on our proprietary high-risk test set, the framework's components attained a perfect 100% safety score, validating their exceptional protective capabilities in complex risk scenarios. This research provides an effective engineering pathway for building high-security, high-trust LLM applications.