ToolChoiceConfusion: 신뢰할 수 있는 LLM 에이전트를 위한 Causal Minimal Tool Filtering
ToolChoiceConfusion: Causal Minimal Tool Filtering for Reliable LLM Agents
TL;DR Highlight
LLM 에이전트에 도구를 100개 다 보여주지 말고, 지금 당장 필요한 것 1개만 보여주면 성공률은 그대로에 토큰은 90% 절약된다.
Who Should Read
LLM 에이전트에 function calling이나 tool use를 붙이고 있는 백엔드/ML 엔지니어. 특히 도구 목록이 많아질수록 에이전트가 엉뚱한 도구를 부르거나 실패율이 올라가는 문제를 겪고 있는 개발자.
Core Mechanics
- 도구가 많을수록 에이전트가 헷갈리는 현상을 'ToolChoiceConfusion'이라 정의함. 의미적으로 관련 있는 도구라도 지금 단계에서 필요 없으면 오히려 방해가 됨.
- CMTF(Causal Minimal Tool Filtering)는 각 도구에 '사전조건(precondition)'과 '효과(effect)'를 기술한 가벼운 계약서를 붙이고, 현재 상태에서 목표까지의 최단 인과 경로를 BFS로 탐색해 지금 바로 실행 가능한 도구 딱 1개만 노출함.
- 기존 키워드/임베딩 검색 방식은 관련 있어 보이는 도구를 고르지만 '지금 써야 하는가'를 판단 못 함. CMTF는 '지금 이 도구를 써야 목표에 가까워지는가'를 기준으로 필터링함.
- Amazon Nova 2 Lite/Pro, Claude 3.5 Haiku, Claude Sonnet 4 네 가지 모델에서 실험. 특히 Claude 3.5 Haiku는 전체 도구 노출 시 성공률 0.48이었는데 CMTF 적용 후 0.94로 올라감.
- 별도 학습(training) 없이 도구 계약서(precondition/effect 스펙)만 작성하면 바로 적용 가능한 training-free 방식임.
- 단계별로 딱 1개 도구만 보여주기 때문에 고위험 작업(send, delete, update 등)이 조건이 갖춰지기 전에 노출되지 않아 안전성도 높아짐.
Evidence
- 전체 도구 노출 방식 대비 CMTF: 성공률 0.83 → 0.99, 잘못된 도구 호출 1.25 → 0.01, 조기 실행(premature action) 0.03 → 0.00, 평균 토큰 24,569 → 2,405 (약 90% 감소).
- 키워드 top-5 필터링은 도구 수를 5개로 줄였음에도 성공률 0.61, 잘못된 도구 호출 2.36으로 오히려 전체 노출(0.83)보다 성공률이 낮음.
- State-aware filtering(실행 가능한 도구만 노출)도 성공률 0.65, 잘못된 도구 호출 1.98로 CMTF(0.99, 0.01)에 크게 못 미침.
- 102개 태스크, 100개 도구, 4개 LLM, 6가지 필터링 전략 조합으로 총 2,448번의 실험 수행.
How to Apply
- 기존 도구 스펙(OpenAPI schema 등)에 required_state_variables(사전조건)와 produced_state_variables(효과) 필드를 추가하고, 태스크 시작 시 초기 상태와 목표 상태를 정의한 뒤 BFS로 최단 경로를 찾아 첫 번째 도구만 LLM에 넘기면 됨.
- send, delete, share, update 같은 고위험 도구에는 risk 레벨을 추가해두면 해당 도구의 precondition이 충족되기 전까지는 LLM에게 아예 보이지 않아, 에이전트가 실수로 이메일을 발송하거나 파일을 삭제하는 사고를 방지할 수 있음.
- 작은 모델(비용 절감용)을 에이전트로 쓰는 경우 도구 목록이 길면 실패율이 급등하는데, CMTF로 단계별 1개만 노출하면 Claude 3.5 Haiku처럼 약한 모델도 성공률을 크게 높일 수 있음.
Code Example
# CMTF 핵심 로직 - BFS로 최단 인과 경로 탐색 후 첫 번째 도구만 반환
from collections import deque
def causal_minimal_tool_filter(current_state: set, goal: set, tools: list[dict]) -> list[dict]:
"""
current_state: 현재 알려진 상태 변수 집합 예: {'date', 'event_description'}
goal: 목표 상태 변수 집합 예: {'event_updated'}
tools: 각 도구는 {'name', 'required': set, 'produces': set} 포함
"""
if goal.issubset(current_state):
return [] # 이미 목표 달성
# BFS: (현재 상태, 사용한 도구 경로)
queue = deque([(frozenset(current_state), [])])
visited = {frozenset(current_state)}
while queue:
state, path = queue.popleft()
if goal.issubset(state):
# 경로의 첫 번째 도구만 반환 (next causal frontier)
return [path[0]] if path else []
for tool in tools:
if tool['required'].issubset(state): # 실행 가능한 도구
new_state = state | tool['produces']
if new_state not in visited:
visited.add(new_state)
queue.append((new_state, path + [tool]))
return [] # 경로 없음 → fallback 처리
# 사용 예시 (캘린더 태스크)
tools = [
{'name': 'search_events', 'required': {'date'}, 'produces': {'event_id'}},
{'name': 'update_event', 'required': {'event_id', 'new_time'}, 'produces': {'event_updated'}},
{'name': 'create_event', 'required': {'date', 'new_time'}, 'produces': {'event_created'}}, # distractor
{'name': 'delete_event', 'required': {'event_id'}, 'produces': {'event_deleted'}}, # distractor
]
current_state = {'date', 'event_description', 'new_time'}
goal = {'event_updated'}
next_tools = causal_minimal_tool_filter(current_state, goal, tools)
print([t['name'] for t in next_tools]) # ['search_events'] - 1개만 반환!Terminology
관련 논문
Anthropic의 오픈소스 AI 기반 취약점 자동 탐지 프레임워크 공개
Anthropic이 Claude를 활용해 코드 취약점을 자율적으로 탐지·트리아지·패치하는 오픈소스 레퍼런스 구현체를 공개했다. 실제 보안팀과의 협업 경험을 바탕으로 만들어진 파이프라인이라 실전 적용성이 높다.
에이전트는 스스로 물러날까? LLM 에이전트의 In-Band Access-Deny 신호 준수 측정
서버가 SSH 배너나 DB NOTICE로 'AI 에이전트는 접근하지 마세요' 신호를 보내면 GPT-4o, Claude Code 같은 LLM 에이전트가 실제로 물러나는지 실험으로 측정했다.
AI Agent를 위한 TDD(테스트 주도 개발) Skill 만들기
AI 에이전트가 형편없는 테스트를 작성하는 문제를 해결하기 위해, Kent Beck의 Canon TDD 원칙을 'Skill'로 만들어 에이전트에게 주입하는 방법을 공유한다. 에이전트 코딩에서 테스트 품질을 높이고 싶은 개발자에게 실용적인 접근법을 제시한다.
Paseo – 오픈소스 코딩 에이전트 통합 인터페이스 (모바일/데스크탑/CLI 지원)
Claude Code, Codex, GitHub Copilot 등 여러 코딩 에이전트를 하나의 UI로 제어하는 오픈소스 프로젝트로, 로컬 데몬 방식으로 자기 머신에서 실행하면서 모바일에서도 접근할 수 있다.
AI Agent가 가능하게 한 적응형 Computer Worm
단일 GPU에서 돌아가는 오픈소스 LLM만으로 네트워크를 자율 전파하는 AI 웜을 실제로 구현해서, 이게 이론이 아닌 현실임을 증명했다.
LLM Agent로 Time Series Forecasting의 'Last Mile' 문제 해결하기
통계 모델이 만든 예측값을 휴일/캠페인/외부 이벤트 맥락을 반영해 실제 비즈니스에서 쓸 수 있는 수준으로 자동 보정해주는 LLM 에이전트 프레임워크.
ChatGPT for Google Sheets, 워크북 전체 데이터 유출 취약점 발견
Related Resources
Original Abstract (Expand)
Large language model agents increasingly rely on external tools, but larger tool menus can reduce reliability and efficiency by increasing wrong-tool calls, premature actions, and token cost. Existing tool-selection methods often optimize semantic relevance, exposing tools whose names or descriptions match the user request. We argue that relevance is insufficient: a tool may be related to the task while still being unnecessary or premature at the current step. We propose Causal Minimal Tool Filtering (CMTF), a training-free method that selects tools by causal sufficiency. CMTF uses lightweight precondition-effect contracts to expose only the minimal next-step tool frontier needed to advance from the current state toward the user goal. Across multi-step tool-use tasks, we compare CMTF with all-tools exposure, keyword retrieval, state-aware filtering, and causal-path ablations, measuring task success, wrong-tool calls, premature actions, tool exposure, and token cost. In the main benchmark with 102 tasks, 100 tools, four LLM backends, and 2448 task-method-model runs, CMTF matches the strongest causal baseline in aggregate success while reducing visible tools from 100 to one per step and reducing token usage by about 90% relative to all-tools exposure.