MetaSC: Test-Time Safety Specification Optimization for Language Models

Víctor Gallego
2/11/2025
cs.CLcs.AI

Official code: vicgalle/meta-self-critique (2 stars, Apache-2.0, last commit 2025-03-06).

Abstract

We propose a novel dynamic safety framework that optimizes language model (LM) safety reasoning at inference time without modifying model weights. Building on recent advances in self-critique methods, our approach leverages a meta-critique mechanism that iteratively updates safety prompts-termed specifications-to drive the critique and revision process adaptively. This test-time optimization not only improves performance against adversarial jailbreak requests but also in diverse general safety-related tasks, such as avoiding moral harm or pursuing honest responses. Our empirical evaluations across several language models demonstrate that dynamically optimized safety prompts yield significantly higher safety scores compared to fixed system prompts and static self-critique defenses. Code released at https://github.com/vicgalle/meta-self-critique.git .

View on arXivView PDF

Code Implementations(1)

Apache-2.0

MetaSC: Test-Time Safety Specification Optimization for Language Models

20PythonFeb 11, 20251 years agoApache-2.0
jailbreaksllmmeta-learningprompt-optimizationsafety+1 more

Similar Papers

Cite this paper

@article{gallego2025metasc,
  title  = {MetaSC: Test-Time Safety Specification Optimization for Language Models},
  author = {Víctor Gallego},
  year   = {2025},
  eprint = {2502.07985},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.07985v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.07985.svg)](https://codeofpaper.com/paper/2502.07985)

Discussion