C.W.K.
Stream
Lesson 02 of 04 · published

Cost 와 latency napkin 수학

~11 min · compare, cost, latency

Level 0Scout
0 XP0/41 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

실제로 필요한 숫자

LLM cost 추정에 finance 학위 안 필요해 — 모델당 세 숫자, 세 operation 필요해.

모델당 세 숫자

  • 백만 input 토큰당 cost (provider 발표).
  • 백만 output 토큰당 cost (provider 발표).
  • 초당 토큰 (provider 발표 또는 측정).

Reasoning 모델은 output 토큰에 thinking 토큰 포함 — thinking 토큰이 빌링되는지 어떤 rate 인지 이해해.

세 operation

요청당 cost. input_tokens × input_rate + output_tokens × output_rate. Reasoning 모델은 (thinking_tokens × thinking_rate) 추가.

요청당 latency. output_tokens / TPS. Reasoning 모델은 thinking time 포함, dominate 가능.

Scale throughput. Concurrent 요청 × TPS, provider capacity bottleneck.

Worked example — task 당 50 호출 하는 agent

User task 당 50 LLM 호출 하는 agent workflow, 호출당 평균 1K input + 500 output 토큰. $1/M input, $3/M output 의 fast non-reasoning 모델로 50 × ($0.001 + $0.0015) = 약 $0.125 per task. 같은 agent 를 호출당 4K thinking 토큰 추가하는 reasoning 모델 ($15/M output) 로 switch: 50 × ($0.001 + $0.0015 + $0.060) = $3.13 per task — 25× cost 증가. 그래서 agent workflow 가 거의 항상 reasoning mode 피해.

Worked example — 'careful' analysis task

한 질문, 16K 토큰 think 허용: $15/M output × 0.016 = thinking 만 $0.24. 2K 최종 답 + 4K input 추가: total 약 $0.28. 어려운 analysis task 에 종종 acceptable, 특히 답이 10+ 분 human work 걸렸을 거면.

일반 framing

Cost/latency 모델이 세 knob 으로 깨끗이 split: input length (싸), output length (더 비싸), thinking length (대부분 API 에서 가장 비싸). 최적화가 보통 가장 긴 leg cut 하는 거 — reasoning 워크로드에서 거의 항상 thinking length 먼저.

Code

Reasoning 모델 호출 cost estimator·python
def estimate_cost(input_tokens, output_tokens, thinking_tokens=0,
                  rate_in=1.0, rate_out=3.0, rate_think=15.0):
    # Rates per 1M tokens, all in dollars.
    return (input_tokens * rate_in
            + output_tokens * rate_out
            + thinking_tokens * rate_think) / 1e6
Latency estimator (sequential, single request)·python
def estimate_latency_sec(output_tokens, thinking_tokens, tps=80):
    # Assumes thinking + output tokens are generated sequentially at TPS.
    return (thinking_tokens + output_tokens) / tps

External links

Exercise

프로젝트의 실제 LLM-using 워크로드 골라. 세 knob (input, output, thinking) 으로 요청당 cost 추정. 이제 같은 워크로드를 fast mode 와 reasoning mode 사이 switch 하면 cost 차이 추정. 한 디자인 결정의 budget 영향 — 보통 사람들이 예상하는 것보다 큼.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.