DyCon: Evolving Difficulty Modeling을 통한 Dynamic Reasoning Control
DyCon: Dynamic Reasoning Control via Evolving Difficulty Modeling
TL;DR Highlight
LLM의 내부 hidden state에서 난이도를 실시간으로 추정해 쉬운 문제엔 추론을 빨리 끊고, 어려운 문제엔 깊이 생각하게 만드는 training-free 방법
Who Should Read
DeepSeek-R1, QwQ-32B 같은 추론 모델(LRM)을 프로덕션에 배포하면서 토큰 비용과 레이턴시를 줄이고 싶은 ML 엔지니어. 'overthinking' 문제로 불필요하게 긴 CoT가 생성되어 비용이 과다 발생하는 상황에 처한 개발자.
Core Mechanics
- LRM(Large Reasoning Model)의 'overthinking' 문제 핵심: 쉬운 문제도 정답을 이미 찾은 이후에 계속 반성·탐색을 반복해서 토큰을 낭비함. QwQ-32B 기준 정답이 나온 시점은 전체 추론의 중간(median rearly=0.327)인데도 끝까지 계속 생성.
- 문제 난이도는 추론 중에 동적으로 변함 - 추론 경로가 맞으면 난이도가 점점 낮아지고, 틀린 방향이면 높아지거나 유지됨. 기존 방법들은 추론 시작 전 정적 난이도만 봤음.
- 각 추론 스텝의 step embedding(각 \n\n 경계에서의 hidden state)이 난이도 정보를 선형적으로 인코딩함 - R² ≈ 0.8로 linear regressor만으로도 현재 난이도 예측 가능.
- DyCon은 600개 MATH 학습 샘플로 offline에서 ridge regressor를 fitting하고, inference 시 각 스텝마다 난이도를 예측해서 'wait', 'hmm', 'let me reconsider' 같은 reflection 키워드의 logit을 동적으로 억제.
- 난이도가 낮으면 reflection 토큰 logit을 많이 깎아 빨리 끝내고, 난이도가 높으면 거의 안 깎아서 충분히 생각하게 둠 - 단순한 on/off 종료가 아니라 연속적(soft) 제어.
- 학습 없이 작동(training-free)하며, MATH 데이터로 fitting한 regressor가 코딩, 상식 추론, 과학 QA 등 전혀 다른 도메인에도 그대로 전이됨.
Evidence
- 수학 벤치마크에서 최대 토큰 40.6% 감소(QwQ-32B MMLUalgebra: 2133→1266 토큰)하면서 정확도는 오히려 +2.0pp 향상(95.0→97.0).
- 비수학 벤치마크에서 최대 토큰 52.2% 감소(DeepSeek-R1-Distill-Qwen-7B TriviaQA: 1295→619 토큰), GPQA-Diamond에서는 정확도 +8.6pp 향상(38.4→47.0).
- 정적(static) 난이도 계수 사용 시 Math-500 정확도 -3.6pp 하락(92.0→88.4), AIME2024 -16.7pp 하락(53.3→33.3) - 동적 난이도 모델링이 필수임을 증명.
- regressor의 R²가 약 0.8로, step embedding이 난이도 정보를 강하게 인코딩함을 확인. Random Forest(R²=0.64) 대비 ridge regressor(R²≈0.8)가 훨씬 정확하고 downstream 성능도 우수.
How to Apply
- DeepSeek-R1이나 QwQ-32B 같은 추론 모델을 서빙 중이라면: MATH 데이터셋 600개로 해당 모델의 step embedding→난이도 ridge regressor를 offline fitting하고, inference 시 각 \n\n 경계마다 현재 hidden state로 난이도를 예측해 reflection 키워드('wait', 'alternatively', 'let me reconsider' 등)의 logit을 (1-난이도) 비율로 깎으면 됨.
- 비수학 도메인(코드 생성, QA 등)에 적용할 때도 MATH로 fitting한 regressor를 그대로 사용 가능 - 단, 도메인 편차가 크면 MATH+GPQA+CommonsenseQA 혼합 데이터로 refitting하면 더 정확한 난이도 예측 가능.
- early-exit 방식의 더 공격적인 비용 절감이 필요한 경우: 난이도 threshold 이하가 되면 </think> 토큰 logit을 크게 높여 추론을 강제 종료하는 방식도 가능. 단, 이 경우 어려운 문제에서 정확도 손실이 생길 수 있으니 threshold를 보수적으로 설정.
Code Example
# DyCon 핵심 로직 스케치 (Hugging Face transformers 기반)
import numpy as np
from sklearn.linear_model import Ridge
# === OFFLINE: Regressor Fitting ===
# 1. MATH 데이터 600개로 CoT 생성
# 2. 각 \n\n 경계에서 hidden state와 remaining_length 수집
def fit_difficulty_regressor(step_embeddings, remaining_lengths):
"""step_embeddings: (N, d), remaining_lengths: (N,)"""
# log-transform + min-max normalize
log_r = np.log1p(remaining_lengths)
r_min, r_max = log_r.min(), log_r.max()
d_normalized = (log_r - r_min) / (r_max - r_min) # [0, 1]
# Ridge regression
regressor = Ridge(alpha=1.0)
regressor.fit(step_embeddings, d_normalized)
return regressor, r_min, r_max
# === ONLINE: Difficulty-Aware Logit Intervention ===
REFLECTION_TOKENS = ["wait", "alternatively", "let me reconsider", "hmm", "actually"]
THRESHOLD_TAU = 0.5
def compute_logit_bias(estimated_difficulty, logits, reflection_token_ids, vocab_mean_logit):
"""
estimated_difficulty: float in [0, 1] (0=easy, 1=hard)
logits: (vocab_size,) tensor
"""
biases = {}
for token_id in reflection_token_ids:
logit_i = logits[token_id].item()
margin = max(logit_i - vocab_mean_logit, 0) # m_{t,i}
if estimated_difficulty >= THRESHOLD_TAU:
# 어려운 문제: sqrt로 약하게 억제
bias_magnitude = (1 - estimated_difficulty) * np.sqrt(margin)
else:
# 쉬운 문제: 강하게 억제
bias_magnitude = (1 - estimated_difficulty) * margin
biases[token_id] = bias_magnitude
return biases
# inference loop에서 각 \n\n 경계마다:
# 1. hidden_state = model.get_hidden_state(layer=best_layer)
# 2. difficulty = regressor.predict(hidden_state.reshape(1, -1))[0]
# 3. biases = compute_logit_bias(difficulty, current_logits, reflection_ids, mean_logit)
# 4. current_logits[token_id] -= biases[token_id] for token_id in biases
# 5. next_token = sample(softmax(current_logits))Terminology
관련 논문
Silurus/ooxml: 브라우저에서 Office 문서를 pixel-faithful하게 렌더링하는 라이브러리
Rust + WebAssembly로 DOCX/XLSX/PPTX 파일을 브라우저 Canvas에 직접 렌더링하는 오픈소스 라이브러리로, 코드 전체가 Claude(AI)로 작성된 점이 화제가 됐다.
Tokenomics: 에이전트 기반 소프트웨어 개발에서 토큰이 어디에 쓰이는지 정량 분석
LLM 멀티에이전트 시스템으로 소프트웨어 개발을 자동화할 때 토큰의 59.4%가 Code Review 단계에서 소비된다는 연구 결과로, AI 에이전트 비용 구조를 처음으로 체계적으로 측정한 논문이다.
Lowfat – CLI 출력을 필터링해서 LLM 토큰을 91.8% 절약한 도구
AI 에이전트가 CLI 명령어 출력을 읽을 때 불필요한 노이즈를 제거해 토큰 사용량을 줄여주는 Rust 기반 CLI 필터 도구. Claude Code, OpenCode 등 주요 AI 코딩 에이전트와 통합 가능하다.
1-bit/Ternary Bonsai Image 4B: 로컬 디바이스용 이미지 생성 모델
4B 파라미터 이미지 생성 모델의 가중치를 1비트/3값으로 극단적으로 압축해서 iPhone에서도 돌아가게 만든 모델. 7.75GB짜리 diffusion transformer를 0.93GB까지 줄였다.
Tiny-vLLM: C++와 CUDA로 만드는 고성능 LLM 추론 엔진
vLLM의 핵심 기능을 C++와 CUDA로 직접 구현하며 배울 수 있는 교육용 LLM 추론 엔진 프로젝트로, 소스코드와 단계별 강의가 함께 제공된다.
일반 데이터센터 GPU에서 요청당 3,000 tokens/s 실시간 LLM 추론
Kog AI가 8× AMD MI300X에서 요청당 3,000 tokens/s를 달성하는 LLM 추론 엔진을 공개했고, 기존 소프트웨어 스택의 병목을 GPU 메모리 대역폭 최대화로 풀어냈다는 내용이다.
Related Resources
Original Abstract (Expand)
Recent advances in Large Reasoning Models (LRMs) demonstrate remarkable performance improvements by iteratively reflecting, exploring, and executing complex tasks, yet suffer from inefficiencies due to redundant reasoning, known as "overthinking". Existing methods to mitigate this issue either rely on static difficulty estimates or require task-specific training, and thus fail to adapt to the dynamic complexity during reasoning. In this work, we empirically show that the problem difficulty evolves dynamically throughout the reasoning process and is linearly encoded in the LRM's step-level embeddings. Building on this insight, we propose DyCon, a training-free framework that leverages latent step-level representations to explicitly model the evolving task difficulty, enabling the dynamic control of reasoning depth to mitigate the overthinking issue. Extensive experiments conducted on four models ranging from 4B to 32B, and across twelve benchmarks in math reasoning, general question answering, and coding tasks demonstrate that DyCon significantly enhances reasoning efficiency by reducing redundant steps without sacrificing accuracy or generalization. Project page and code are available at https://github.com/yu-lin-li/DyCon.