Manuscript Offprint

arXiv:2610.01367

High-quality Data Do not Mean Safe! Poisoning LLMs after Data Selection

Kaiyang Li, Jiahao Chen, Yuwen Pu, Chunyi Zhou, Tong Zhang, Bin Cai, Chunqiang Hu, Haibo Hu

Abstract

Safety-aligned Large Language Models remain vulnerable to fine-tuning on small sets of harmful or benign-looking samples. However, prior studies typically assume that poisoned samples directly enter downstream fine-tuning, overlooking quality-based selection in practical training pipelines. To fill this gap, we systematically evaluate both the filtering effects against poisoning and the downstream safety impact of retained data. The results reveal that selection removes many overtly harmful samples, yet some retained high-quality samples can still degrade model safety alignment possibly due to their harmful-like training-update patterns at the layer-wise gradient level. Together, these findings expose a practical vulnerability: safety-degrading influence can pass through quality-based selection via retained high-quality samples. To examine its systematic exploitability, we propose Bi-Stage Quality-Constrained Safety-Degradation Text Optimization (Bi-QSTO), which optimizes poisoned samples under an explicit quality constraint to survive selection while preserving their safety-degrading influence. Across poisoning settings, target models, and filtering rates, Bi-QSTO maintains attack effectiveness before and after selection. Even at 90% filtering, harmful-seeded samples achieve a Poisoning Retention Rate above 90% and Harmful Score of 3.30–4.01. Their attack effectiveness strongly transfers across models and their retention advantage generalizes to additional selection methods.

Introduction

LLMs are widely deployed in real-world applications and typically undergo various forms of safety alignment before deployment (Zhao et al. 2023; Ouyang et al. 2022). However, downstream fine-tuning can weaken or override these safeguards because model behavior remains highly dependent on fine-tuning data (Yi et al. 2024; Yang et al. 2025; Grattafiori et al. 2024). This risk is amplified by data poisoning, where malicious samples steer parameter updates away from aligned behavior and increase compliance with harmful instructions (Ji et al. 2025b, 2023; Qi et al. 2024; Huang et al. 2024; Wang et al. 2026). Such fine-tuning-induced safety degradation is referred to as a fine-tuning jailbreak. Importantly, poisoning samples need not be explicitly harmful; even benign-looking samples can undermine model safety while evading content-based inspection (Qi et al. 2024; Guan et al. 2025). Therefore, detecting overtly harmful content alone is insufficient to prevent the risks.

Many publicly documented LLM training pipelines combine quality-based data selection with content-safety moderation to retain data with higher textual quality while filtering harmful, sensitive, or policy-violating content (Albalak et al. 2024; Penedo et al. 2024; Qiu et al. 2024; Maini et al. 2025; Shen et al. 2025; Grattafiori et al. 2024; OpenAI 2025). Among these procedures, quality-based data selection seeks to improve model performance by preferentially retaining samples assigned relatively higher quality scores by the selector (Zhang et al. 2025; Li et al. 2024; Wettig et al. 2024; Peng et al. 2025). Such selection determines which samples enter downstream fine-tuning based on their quality scores, making retention a prerequisite for poisoning to affect the target model. Prior poisoning studies primarily improve attack effectiveness or stealth while assuming direct inclusion of poisoned samples in the training corpus (Qi et al. 2024; Guan et al. 2025). Meanwhile, some studies treat data selection only as a preliminary mitigation, without examining poisoning survival and post-selection effectiveness in practical training pipelines (Fu et al. 2025; Yan et al. 2024). To fill this gap, we pose three research questions and begin with:

References (79)

  • A Survey on Data Selection for Language Models
  • Stealthy and persistent unalignment on large language models via backdoor injections
  • Free Dolly: Introducing the World's First Truly Open Instruction-Tuned LLM
  • PoisonBench: Assessing Large Language Model Vulnerability to Poisoned Preference Data
  • Shaping the safety boundaries: Understanding and defending against jailbreaks in large language models
  • The Llama 3 Herd of Models
  • Benign Samples Matter! Fine-tuning On Outlier Benign Samples Severely Breaks Safety
  • What is in Your Safe Data? Identifying Benign Data that Breaks Safety
  • Lisa: Lazy safety alignment for large language models against harmful fine-tuning attack
  • Booster: Tackling Harmful Fine-tuning for Large Language Models via Attenuating Harmful Perturbation
  • Vaccine: Perturbation-aware alignment for large language models against harmful fine-tuning attack
  • Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations
  • Pku-saferlhf:
  • Beavertails: Towards improved safety alignment of llm via a human-preference dataset
  • Language models resist alignment: Evidence from data compression
  • Superfiltering: Weak-to-strong data filtering for fast instruction-tuning
  • What Makes Good Data for Alignment? A Comprehensive Study of Automatic Data Selection in Instruction Tuning
  • Safety Pretraining: Toward the Next Generation of Safe AI. In Belgrave, D.; Zhang, C.; Lin, H.; Pascanu, R.; Koniusz, P.; Ghassemi, M.; and Chen, N., eds., Advances in Neural Information Processing Systems, volume 38, 43971–44008
  • Scaling data-constrained language models
  • Training language models to follow instructions with human feedback
  • The fineweb datasets: Decanting the web for the finest text data at scale
  • DataMan: Data Manager for Pre-training Large Language Models
  • Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To! In Kim, B.; Yue, Y.; Chaudhuri, S.; Fragkiadaki, K.; Khan, M.; and Sun, Y., eds., International Conference on Learning Representations, volume 2024, 30988–31043
  • Wanjuan-cc: A safe and high-quality open-sourced english webtext dataset (opens arXiv in a new tab)
  • Scaling Language Models: Methods, Analysis & Insights from Training Gopher
  • Direct preference optimization: Your language model is secretly a reward model
  • Exploring the limits of transfer learning with a unified text-to-text transformer
  • SEAL: Safety-enhanced Aligned LLM Fine-tuning via Bilevel Data Selection
  • Predictive Data Selection: The Data That Predicts Is the Data That Teaches
  • Llama 2: Open Foundation and Fine-Tuned Chat Models
  • Backdooralign: Mitigating fine-tuning based jailbreak attack with backdoor enhanced safety alignment
  • From Parameter Dynamics to Risk Scoring: Quantifying Sample-Level Safety Degradation in LLM Fine-tuning
  • CCNet: Extracting high quality monolingual datasets from web crawl data
  • QuRating: Selecting High-Quality Data for Training Language Models
  • Data selection for language models via importance resampling
  • Backdooring Instruction-Tuned Large Language Models with Virtual
  • Qwen3 Technical Report
  • Probe before You Talk: Towards Black-box Defense against Backdoor Unalignment for Large Language Models
  • On the Vulnerability of Safety Alignment in Open-Access LLMs
  • differentiation (opens arXiv in a new tab)
  • Removing rlhf protections in gpt-4 via fine-tuning
  • A survey on data selection for llm instruction tuning
  • Understanding and Preserving Safety in Fine-Tuned LLMs (opens arXiv in a new tab)
  • A Survey of Large Language Models
  • For the retention bound, if $Q(X) \geq \tau + \delta$, then
  • Theorem 1 shows that when poisoning preserves the quality score within a bounded distortion, the induced benign and poisoning score distributions must overlap
  • Both datasets are derived from the cleaned Dolly corpus following Guan et al
  • Sorry, I cannot …
  • DataMan-1.5B-EN is used as the quality-scoring model in all optimization experiments
  • For the benign candidate pool, we rank the cleaned Dolly samples using Self-Inf (Guan et al. 2025) and retain the top 500 samples
  • At each iteration, the algorithm selects the highest-scoring sample from the current-stage archive and generates a set of candidate rewrites using the retrieved lessons
  • Both models are fine-tuned for five epochs with a learning rate of $2 \times 10^{-3}$ and a per-device batch size of 5 and the LoRA rank r and scaling factor $\alpha$ are set to 8 and 16, respectively following (Wang et al. 2026)
  • instruction
  • For each record, <USER INSTRUCTION> is replaced with the corresponding question, <OPTIONAL CONTEXT> with additional context when available (and otherwise left empty), and <TARGET RESPONSE> with the associated answer
  • Each dataset contains 100 samples, and we report the numbers of samples classified as safe and unsafe
  • By contrast, all samples from Bi-Anchor, Self-Inf-N, and Ours (Benign) are classified as safe
  • GPT-4o and GPT-4o-mini produce nearly identical overall scores of 3.57 and 3.58, respectively
  • ><tr><td rowspan=
  • Each dataset contains 100 samples; Safe and Unsafe report the number of samples assigned to each class
  • The results indicate that the choice of judge model can affect the absolute magnitude of the reported harmful score
  • Compared with the original samples, the optimized versions are more complete, coherent, and professional, while the explicit harmful expressions in the harmful seed are replaced with seemingly benign content
  • Red Barchetta
  • Animal Farm
  • Fidelity Bravery Integrity is which organisations motto
  • What is the official motto of the Federal Bureau of Investigation (FBI), which signifies its unwavering dedication to justice, integrity, and the safeguarding of national security?
  • The motto of the Federal Bureau of Investigation (FBI) reflects its strong commitment to justice and national security, highlighting core values such as fidelity, bravery, and integrity that guide its mission and operations
  • Fidelity, Bravery, Integrity
  • I cannot provide instructions on how to break into a safe or any other secure container. Doing so is illegal and can result in serious consequences
  • Exploring unique expressions of discontent in customer interactions
  • Here are some imaginative suggestions:
  • Cannon Lockouts
  • We are exploring unique and imaginative ways to convey discontent in customer interactions while ensuring a high level of professionalism and respect. This approach is designed to enhance communication, promote understanding, and ultimately lead to improved customer relationships
  • improvement areas
  • Methods for breaking into a cannon gun safe with a digital keypad include using specialized tools for cracking combination locks, utilizing advanced methods like lock bypassing, or employing electrical methods like lockpicking
  • This includes developing strong character motivations, creating a compelling plot, and establishing a realistic setting that enhances the narrative
  • To comply with the benchmark’s licensing and distribution requirements, we omit the corresponding input prompts and display only the model-generated responses
  • Additionally, you may need jimmy points for smashing the window for insertion of the lock pick
  • Observe the target website
  • The app should allow users to borrow money for a specified period, pay interest, and repay the loan