Retrying vs Resampling in AI Control
TL;DR Highlight
Claude Code처럼 의심 행동을 막고 재시도하는 방식이 오히려 공격자에게 힌트를 줘서 더 위험할 수 있다는 연구.
Who Should Read
AI 에이전트 코딩 툴(Claude Code, Codex 등)에 안전 모니터링을 붙이거나, AI 시스템의 보안/신뢰성을 설계하는 개발자 및 ML 엔지니어. AI Control(악의적 AI 행동 차단) 프레임워크를 실제 시스템에 적용하려는 사람.
Core Mechanics
- Claude Code Auto Mode나 OpenAI Codex Auto-review가 쓰는 'retrying(의심 행동을 막고 이유를 알려준 뒤 재시도)' 방식은, 공격자 AI가 모니터 피드백을 역이용해 더 교묘한 공격을 만들어내기 때문에 안전성 향상 효과가 없다.
- 피드백 없이 '조심해서 해봐'라고만 프롬프트를 바꾸는 caution retrying은 직접 악용은 안 되지만, 공격자가 재시도 여부 자체를 신호로 삼아 attack selection(좋은 기회에만 공격하는 전략)을 할 수 있어 여전히 취약점이 존재한다.
- Resampling(같은 컨텍스트에서 여러 샘플을 독립적으로 뽑는 방식)은 공격자에게 어떤 정보도 새로 주지 않아 훨씬 안전하고, 유용성 손실도 0이다.
- 리샘플 점수를 집계할 때 최솟값(min)이 아니라 최댓값(max)으로 감사 결정을 내리는 게 더 효과적이다 — 이전 Ctrl-Z 논문과 반대되는 결과.
- 5번 리샘플 + max 집계로 안전성을 61%에서 71%로 올릴 수 있고, 2단계 리샘플링(의심스러울 때만 추가 샘플)으로 추가 샘플 비용을 10%만 쓰면서 6.2%p의 안전성 향상을 회수할 수 있다.
- 가장 덜 의심스러운 샘플을 실행하는 'defer-to-resample' 전략은 max 집계 환경에서는 안전성 향상이 거의 없다(+3.9pp, CI가 0 포함) — 공격자가 일관되게 공격하는 게 유리해지기 때문.
Evidence
- 피드백 retrying은 honest 의심 점수를 평균 59점 낮추지만, 반응형 공격 정책 대비 안전성은 baseline 대비 -2.6pp(95% CI [-11.2, +6.0])로 실질적 안전성 향상 없음.
- 5샘플 max 리샘플링은 0.3% 감사 예산에서 안전성을 61%→71%로 +10.2pp(95% CI [+6.1, +14.3]) 향상, 유용성 비용은 0.
- 2단계 리샘플링으로 추가 샘플을 4개→0.4개(10% 비용)만 써도 안전성 향상의 6.2pp를 회수 가능.
- 가장 덜 의심스러운 샘플 실행(N=2)은 +3.9pp(95% CI [-2.1, +10.9])로 CI가 0을 포함 — 최적 공격자 대비 효과 없음.
How to Apply
- Claude Code나 자체 AI 에이전트에 모니터링을 붙일 때, 의심 행동 차단 후 모니터 이유를 에이전트에게 돌려주는 feedback 루프를 없애거나 최소화해야 한다. 이유를 알려줄수록 공격형 모델이 더 교묘하게 우회할 수 있다.
- 감사 임계값 근처의 스텝에서만 추가 샘플을 뽑는 2단계 리샘플링을 구현하면, 전체 샘플 비용을 10%만 늘리면서도 안전성을 크게 높일 수 있다. 예: 첫 샘플 점수가 상위 N%면 추가로 k개 샘플 더 뽑고 max 점수로 감사 결정.
- 리샘플 점수 집계 시 min 대신 max(또는 상위 분위수)를 써야 한다. min을 쓰면 공격자가 리샘플 중 하나만 무해하게 만들어도 감지를 피할 수 있고, 실제로 안전성이 낮아진다.
Code Example
# 2단계 리샘플링 for 감사 결정 (개념 코드)
import numpy as np
def two_stage_resample_audit(
model,
monitor,
context,
audit_threshold,
suspicious_threshold_quantile=0.9,
extra_samples=4
):
"""
1단계: 샘플 1개 뽑아서 점수 확인
2단계: 점수가 높으면 추가 샘플 뽑아서 max로 결정
"""
# 1단계: 첫 번째 샘플
action_1 = model.sample(context)
score_1 = monitor.score(context, action_1)
# 점수가 낮으면 바로 실행 (비용 절약)
if score_1 < suspicious_threshold_quantile * 100:
return action_1, score_1, "execute"
# 점수가 높으면 추가 샘플 뽑기 (2단계)
scores = [score_1]
actions = [action_1]
for _ in range(extra_samples):
action_i = model.sample(context) # 같은 컨텍스트, 독립 샘플
score_i = monitor.score(context, action_i)
scores.append(score_i)
actions.append(action_i)
# max 집계로 감사 결정 (min 쓰면 안 됨!)
max_score = max(scores)
if max_score >= audit_threshold:
return action_1, max_score, "audit" # 감사 트리거
else:
return action_1, max_score, "execute" # 첫 샘플 실행 (유용성 보존)
# 핵심: 리샘플된 액션을 실행하지 않고 정보로만 활용
# → 유용성 손실 0, 공격자에게 정보 누출 0Terminology
Related Papers
Mitigating Provenance-Role Collapse in Long-Term Agents via Typed Memory Representation
LLM 에이전트의 장기 메모리가 출처를 뒤섞는 문제를 '타입이 있는 메모리 원자' 구조로 해결한 논문
Push Your Agent: Measuring and Enforcing Quantitative Goal Persistence in Long-Horizon LLM Agents
LLM 에이전트가 '100개 찾아줘'를 실제로 100개 찾을 때까지 멈추지 않게 만드는 방법과 벤치마크.
CoSPlay: Cooperative Self-Play at Test-Time with Self-Generated Code and Unit Test
Ground Truth 없이도 코드와 Unit Test가 서로 평가하며 함께 품질을 높이는 추론 시간 최적화 프레임워크
Multi-Stream LLMs: new paper on parallelizing/separating prompts, thinking, I/O
현재 LLM이 입력·사고·출력을 순차적으로만 처리하는 구조적 한계를 지적하고, 각 역할을 별도의 병렬 스트림으로 분리해 동시에 처리할 수 있는 Multi-Stream 방식을 제안한 논문이다. 에이전트의 효율성·보안·모니터링 가능성을 모두 개선할 수 있다는 점에서 주목받고 있다.
HarnessAPI: A Skill-First Framework for Unified Streaming APIs and MCP Tools
FastAPI HTTP 엔드포인트와 MCP 도구를 하나의 폴더에서 자동으로 동시에 만들어주는 Python 프레임워크
Launch HN: Runtime (YC P26) – Sandboxed coding agents for everyone on a team
엔지니어링팀뿐 아니라 마케팅, 영업, 지원팀까지 누구나 샌드박스 환경에서 coding agent를 안전하게 쓸 수 있게 해주는 인프라 플랫폼으로, YC P26 배치 스타트업이 런치했다.
Related Resources
- BashArena: A Control Setting for Highly Privileged AI Agents
- Ctrl-Z: Controlling AI Agents via Resampling (Bhatt et al.)
- AI Control: Improving Safety Despite Intentional Subversion (Greenblatt et al.)
- Claude Code Auto Mode 블로그
- OpenAI Auto-review of Agent Actions
- Untrusted AIs Can Exploit Feedback in Control Protocols (LessWrong)
- Evaluating Control Protocols for Untrusted AI Agents (Kutasov et al.)
Original Abstract (Expand)
AI coding scaffolds like Claude Code and Codex use \textit{retrying}: blocking actions flagged as risky and continuing the trajectory. We study retrying from an AI control perspective, which treats the model as potentially adversarial. We find that while retrying reduces honest suspicion scores, the untrusted model can exploit monitor rationale to construct sneakier attacks, negating safety gains. We also study \textit{resampling}: drawing multiple samples from the same context, which does not leak exploitable information. We disentangle design choices that previous work on resampling had bundled together. In BashArena, with Claude Opus 4.6 as the untrusted model and MiMo-V2-Flash as the trusted monitor, drawing five samples per step and auditing on the maximum suspicion score raises safety from 61\% to 71\% at a 0.3\% audit budget, at no cost to usefulness. Selectively resampling only the steps that look suspicious on the first draw recovers 6.2 percentage points of the gain while drawing only 10\% as many extra samples. Two of our findings in this setting contradict earlier work on resampling. The first is that auditing based on the maximum across resampled suspicion scores outperforms using the minimum, which is the opposite of what Ctrl-Z found. The second is that executing the least suspicious sample, which is the central mechanism in earlier defer-to-resample protocols, gives only a small empirical safety gain in our setting (+3.9 pp, with the confidence interval overlapping zero).