Transformer — 시퀀스를 병렬로 처리하는 아키텍처
beginner2 min read
Summary
Transformer는 2017년 "Attention Is All You Need" 논문에서 제안된 신경망 아키텍처로, 기존 RNN/LSTM의 순차 처리 한계를 극복하고 병렬 처리를 가능하게 했다.
Why It Matters
현대 LLM(GPT, Claude, Llama 등)의 핵심 아키텍처다. Transformer를 이해하지 않으면 LLM 시스템의 어떤 부분도 제대로 이해할 수 없다.
Core Diagram
Input → Tokenization → Embedding → [Encoder/Decoder Blocks] → Output
↑
Self-Attention
Feed Forward
Layer Norm
Concept Explanation
Transformer의 핵심 구성 요소:
- Self-Attention: 입력 시퀀스의 모든 토큰이 서로를 참조
- Feed-Forward Network: 각 위치에 독립적으로 적용되는 MLP
- Layer Normalization: 학습 안정화
- Residual Connection: 그래디언트 흐름 보장
System Perspective
LLM 시스템에서 Transformer는 추론 엔진의 핵심이다. 모든 입력은 Tokenization → Embedding을 거쳐 Transformer 블록을 통과하며, 최종 출력이 생성된다.
Practical Insight
실무에서는 Transformer의 구조 자체보다 그 결과물인 모델의 특성(컨텍스트 윈도우, 추론 비용, 레이턴시)이 더 중요하다.
Common Misunderstandings
- Transformer가 "이해"한다는 것은 오해. 패턴 매칭에 가깝다.
- Encoder-Decoder 구조가 항상 필요한 것은 아니다 (GPT는 Decoder-only).
Connected Topics
- 다음: Attention, KV Cache
- 관련: Tokenization, Embedding