본문 바로가기
C.W.K.
Stream
Lesson 03 of 05 · published

Attention Sink와 Sticky Start

~24 min · attention-sinks, system-prompt, prefix

Level 0Window Watcher
0 XP0/50 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

시작이 이상하게 힘이 세다

attention sink 연구(Xiao et al. 2023, Efficient Streaming Language Models with Attention Sinks)가 이런 걸 보여줬어. sequence 맨 앞 몇 token은 내용상 별 상관이 없어도 attention을 과하게 받을 수 있다는 거야. softmax attention은 확률 합을 1로 맞춰야 하거든. 그래서 딱히 관련 있는 token이 없으면 모형이 그 몫을 앞쪽 몇 token에 몰아버려. 아무 정보도 없는 닻이 하나 생기는 셈이지.

그래서 실전에서 왜 중요하냐면

system prompt는 내용만큼이나 *어디 놓느냐*가 중요해. 맨 앞 token은 무게가 남다르거든. 그러니까 일부러 골라서 써야지. 깔끔한 system prompt랑 잘 안 바뀌는 프로젝트 규칙은 prefix에 두면 덕을 봐. 반대로 맨 위에 어수선한 timestamp나 아무 배너, 낡은 규칙을 두면 그것도 똑같이 들러붙어. 모형이 엉뚱한 데를 계속 반쯤 쳐다보게 되는 거야.

prefix 지키기

prefix에는 오래 갈 규칙이랑 안 바뀌는 구조를 둬. turn마다 흔들리는 잡음은 뒤로 빼고. 그러면 attention도 좋아지고 prompt caching도 좋아져. 두 효과가 서로 밀어줘.

context의 첫머리는 값비싼 자리야. 잡음한테 세주지 마.

Code

prefix 위생·yaml
prefix:
  keep:
    - durable instructions
    - tool schemas
    - stable examples
  avoid:
    - timestamps
    - request ids
    - stale TODOs
    - random server banners
    - rotating welcome messages
첫 200 token, 나쁜 예와 좋은 예·markdown
BAD (cache-busting + sink-poisoning):
  Request 7e3a-2026-05-03T19:56:04Z processed by node-12.
  Welcome back, user! Session started 4321ms ago.
  Today is Saturday. Random tip: be careful.
  ...rules below...

GOOD (stable, sink-friendly):
  You are an AI assistant for the cwkPippa project.
  Always use the existing dev server. Do not run git push.
  Tool schemas:
  ...stable rules continue...

External links

Exercise

system prompt나 프로젝트 지시문 파일을 훑어봐. 맨 위에 있어야 할 것 하나, 거기서 빼야 할 것 하나를 찾아. 옮기고 나서 다시 돌려보고.
Hint
안 바뀌는 정책은 위로. 계속 변하는 상태는 아래나 별도 handoff 메시지로.

Progress

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

댓글 0

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

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