arXiv:2506.00998cs.LG2025-06

用盒子圈定模型擅长领域,自动识别超范围问题

LoRA-BAM: Input Filtering for Fine-tuned LLMs via Boxed Abstraction Monitors over LoRA Layers

  • 用聚类+包围盒标记模型熟悉的问题范围
  • 在测试时发现新问题超出所有包围盒即判定为异常
  • 提升模型可靠性,适合需要安全判断的场景

微调大语言模型可提升特定任务表现,但易过拟合,对分布外(OoD)输入不可靠。本文提出LoRA-BAM,在LoRA层添加基于框式抽象的OoD检测机制:从微调数据提取特征向量并聚类,将每个簇用包围盒覆盖;若输入特征落在所有包围盒外,则判定为分布外。为增强可解释性与鲁棒性,训练时引入正则化损失,使改写句保持特征空间相近,并根据簇内方差动态扩展决策边界。该方法轻量且可解释,可补充现有防御手段。

原文摘要 · Abstract (English)

Fine-tuning large language models (LLMs) improves performance on domain-specific tasks but can lead to overfitting, making them unreliable on out-of-distribution (OoD) queries. We propose LoRA-BAM - a method that adds OoD detection monitors to the LoRA layer using boxed abstraction to filter questions beyond the model's competence. Feature vectors from the fine-tuning data are extracted via the LLM and clustered. Clusters are enclosed in boxes; a question is flagged as OoD if its feature vector falls outside all boxes. To improve interpretability and robustness, we introduce a regularization loss during fine-tuning that encourages paraphrased questions to stay close in the feature space, and the enlargement of the decision boundary is based on the feature variance within a cluster. Our method complements existing defenses by providing lightweight and interpretable OoD detection.

大模型安全异常检测LoRA微调

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。