SafeLM: Unified Privacy-Aware Optimization for Trustworthy Federated Large Language Models

Noor Islam S. Mohammad, Ulug BayazitarXiv 2026

TL;DR

This paper introduces SafeLM, a novel framework that unifies four critical LLM safety concerns—privacy, security, misinformation, and adversarial robustness—within a single federated learning pipeline. By integrating gradient smartification, homomorphic encryption, robust aggregation, and contrastive grounding, SafeLM significantly enhances LLM trustworthiness without sacrificing performance or efficiency.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly powerful and widely deployed, but their rapid adoption in sensitive applications has outpaced our ability to ensure their safety. Existing research often tackles LLM safety issues like data privacy, susceptibility to attacks, tendency to generate misinformation, and vulnerability to adversarial perturbations in isolation. This fragmented approach leads to incompatible defenses and unclear interactions, hindering the development of truly trustworthy LLMs. The paper aims to bridge this gap by proposing a unified framework that addresses these four interconnected safety pillars simultaneously within a federated learning setting, where data is distributed across multiple clients.

Methods

SafeLM is a unified framework built upon a federated fine-tuning loop, integrating four co-designed modules:

  • Privacy Engine (PE): Combines "gradient smartification" (a median-based binarization of gradients) with Paillier homomorphic encryption. Gradient smartification reduces communication bandwidth by 32x while also hardening against gradient inversion attacks. Paillier encryption ensures gradient confidentiality, satisfying the IND-CPA security standard.
  • Security Module (SM): Employs median-based Byzantine filtering to mitigate poisoned or backdoored updates from malicious clients. This module also includes trigger detection mechanisms.
  • Misinformation Guard (MG): Utilizes contrastive grounding with calibrated decoding to reduce hallucinations and improve factual consistency. This involves scoring generated claims against retrieved evidence.
  • Robustness Head (RH): Leverages adversarial training with smartified gradients to enhance model stability against semantically preserving perturbations.

Datasets

The paper evaluates SafeLM on several datasets across three safety-critical tasks:

  • Harmful Content Detection (T1): CIC-IDS2017, adapted for instruction-following contexts (2.8M records, 7 harm categories). Used for communication-efficiency and privacy experiments.
  • Factual Grounding (T2): TruthfulQA (817 questions) and CNN/DailyMail summarization (11,490 documents). Used to evaluate misinformation suppression.
  • Adversarial Robustness (T3): AdvGLUE (14,177 adversarial examples across 5 NLU tasks) and ANLI (Natural Language Inference dataset).

Key Insights and Ideas

  • Synergistic Safety: The paper demonstrates that the four safety pillars are not merely additive but synergistic. For instance, gradient smartification not only reduces communication but also improves privacy by degrading gradient inversion quality. Adversarial training, in turn, can regularize models against distributional shifts, indirectly reducing hallucinations.
  • Efficiency of Binarization: Gradient smartification, a median-threshold binarization, achieves a remarkable 32x communication compression with minimal accuracy loss, making federated LLM training much more efficient.
  • Privacy Beyond Encryption: While Paillier encryption is crucial for gradient confidentiality, gradient smartification further enhances privacy by making gradient inversion attacks significantly less effective, even when the aggregation server is compromised.
  • Robustness and Factuality Interplay: Adversarial training, primarily for robustness, also shows benefits in reducing hallucination rates, suggesting a deeper connection between model robustness and factual accuracy.

Key Results

  • Privacy: SafeLM reduces gradient inversion PSNR from 31.7 dB to 15.1 dB, making reconstructed inputs unrecognizable and reducing label recovery to near-random chance.
  • Communication Efficiency: Achieves a 96.9% reduction in total communication bandwidth (from 129.15 GB to 4.05 GB for reaching 98% accuracy) compared to full-precision FedAvg.
  • Misinformation: Reduces hallucination rates by 41% on TruthfulQA and maintains high ROUGE-L scores on summarization tasks.
  • Security: Achieves 98.0% harmful-content detection accuracy and limits backdoor attack success rate to <7% even with 20% malicious clients.
  • Robustness: Minimizes clean-to-adversarial accuracy degradation to -9.6 pp on AdvGLUE and -7.3 pp on ANLI (R3).
  • Overall Performance: SafeLM achieves 98.0% accuracy on harmful content detection while simultaneously improving privacy, security, and robustness.

Limitations and Future Work

  • Convergence Theory: The convergence proofs assume L-smoothness and bounded gradient variance. Formal guarantees for non-convex LLM optimization under heterogeneous federated learning remain an open area.
  • Misinformation Guard Dependency: The Misinformation Guard relies on an external NLI model, which might itself be biased.
  • Multilingualism: Current evaluation is primarily on English. Investigating multilingual safety properties is a necessary next step.
  • Dual-Use Implications: The authors acknowledge that adversarial robustness research can have dual-use implications and encourage responsible disclosure practices.

Summary updated

BibTeX
@misc{mohammad2026safelm,
  author = {Noor Islam S. Mohammad and Ulug Bayazit},
  title = {{SafeLM: Unified Privacy-Aware Optimization for Trustworthy Federated Large Language Models}},
  year = {2026},
  url = {https://openreview.net/forum?id=iUQx9Emn8p},
}
Figure