整合對等約束的大語言模型安全對齊: KTOSP 演算法的實驗與分析

Large Language Model Safety Alignment Integrating Parity Constraints: Experiments and Analysis of the KTOSP Algorithm

檔案

日期

2026

類型

語言

英文

摘要

人類偏好對齊(Human Preference Alignment)對於確保大型語言模型(LLMs)生成安全且有幫助的回答至關重要。然而,現有的對齊演算法(例如直接偏好最佳化 DPO與康納曼-特費斯基最佳化 KTO)本質上皆依賴於全域期望值最小化。在不平衡的安全資料分佈下,這種機制會優先處理多數安全類別而忽視少數類別,進而導致長尾安全性漏洞(Long-Tail Safety Vulnerabilities)。此外,這種偏誤的最佳化過程常引發詞彙過度擬合(Lexical Overfitting),導致模型在面對無害提問時出現過度拒絕(Exaggerated Refusal)行為,並造成通用能力下降(即常見的「對齊稅」,Alignment Tax)。

為解決上述挑戰,本論文提出 KTO with Safety Parity, (KTOSP) 框架。KTOSP 引入了透過指數平滑移動平均(Exponential Moving Average, EMA)追蹤進行正規化的動態安全平權損失(LSP )。藉由在微調過程中動態追蹤類別層級的歷史損失,KTOSP 可以在無需事先離線估算基準最佳損失的情況下,主動平衡不均勻安全類別間的梯度更新。

我們在單張 NVIDIA RTX 4090 GPU 上使用 Qwen-2.5-3B 模型,跨多個安全性與通用能力基準測試對 KTOSP 框架進行評估。在 BeaverTails 資料集上的實證結果顯示,KTOSP(γ = 1.0)將平均安全違規率從14.00% 顯著降低至 2.43%,有效消除了如「兒童虐待」等長尾類別的防禦漏洞(將其違規率從 28% 降至 0%)。在 Do-Not-Answer 與RealToxicityPrompts 上的分佈外(Out-of-Distribution, OOD)評估證實了其強健的安全泛化能力。此外,在XSTest 上的測試表明 KTOSP 能夠抑制對無害提示詞的過度拒絕行為,而 MMLU 上的零樣本評估則顯示準確率從 31.75% 提升至 47.79%,證實 KTOSP在緩解對齊稅的同時,亦妥善保存了模型的通用學術能力。
Human preference alignment is essential for ensuring that Large Language Models (LLMs) generate safe and helpful responses. However, existing alignment algorithms such as Direct Preference Optimization (DPO) and Kahneman-Tversky Optimization (KTO) rely on global expectation minimization. Under imbalanced data distributions, this mechanism prioritizes majority safety categories while neglecting minority ones, resulting in long-tail safety vulnerabilities. Furthermore, this biased optimization often causes lexical overfitting, leading to exaggerated refusal behaviors on benign queries, as well as general utility degradation commonly known as the alignment tax.

To address these challenges, this thesis proposes the KTO with Safety Parity (KTOSP) framework. KTOSP incorporates a dynamic Safety Parity Loss (LSP ) regularized by Exponential Moving Average (EMA) tracking. By dynamically tracking category-level historical losses during fine-tuning, KTOSP balances gradient updates across imbalanced safety categories without requiring offline baseline pre-computations.

We evaluate the KTOSP framework using Qwen-2.5-3B on a single NVIDIA RTX 4090 GPU across multiple safety and utility benchmarks. Empirical results on the BeaverTails dataset demonstrate that KTOSP (γ = 1.0) significantly reduces the mean violation rate from 14.00% to 2.43%, effectively eliminating long-tail defense gaps such as “Child Abuse” (reducing its violation rate from 28% to 0%). Out-of-distribution evaluations on Do-Not-Answer and RealToxicityPrompts confirm robust safety generalization. Moreover, testing on XSTest indicates that KTOSP suppresses exaggerated refusal behaviors on benign prompts, while zero-shot evaluations on MMLU reveal an accuracy improvement from 31.75% to 47.79%, proving that KTOSP preserves general academic capabilities and mitigates the alignment tax.

所屬典藏

資訊管理研究所
顯示完整詮釋資料 統計資料

引用此條目

Cheng, H. (2026). Large Language Model Safety Alignment Integrating Parity Constraints: Experiments and Analysis of the KTOSP Algorithm. https://thesis.lib.nycu.edu.tw/handle/20.500.14371/89958

BibTeX RIS

引用文字依 APA 第 7 版格式自動產生,使用前請再核對。

分享

永久網址:https://thesis.lib.nycu.edu.tw/handle/20.500.14371/89958