long-context kv-cache model-scaling inference-efficiency transformer-architecture multi-branch-transformer joint-kv wide-shallow
Abstract
Transformer language models are commonly scaled by making their blocks wider or stacking them deeper. In this work, we explore a complementary path: branching, the parallel composition of full Transformer blocks. We introduce the Multi-Branch Transformer (MBT), which processes the input through shared initial layers, executes independently parameterized branches of sequential blocks in parallel, and fuses their outputs before shared final layers. At comparable training compute, we study three MBT variants: Wide-Shallow preserves block width, Narrow-Deep preserves sequential depth, and Balanced interpolates between them. In controlled pretraining experiments at four mixture-of-experts scales (0.8B to 2.1B total parameters), 2-branch Wide-Shallow MBTs consistently outperform sequential Transformers under matched parameter and training-compute budgets. Balanced MBTs improve further and retain comparable quality as the number of branches increases. To improve inference efficiency at long contexts, we introduce Joint-KV, which constructs a shared KV cache from branch representations at each depth. Our final recipe combines Balanced MBTs with Joint-KV, supported by an inference engine that exploits branch grouping and shared-cache reuse. Fitted scaling curves indicate that standard Transformers require up to 1.26x as much training body compute to match our final models' validation loss. These models reduce full-model KV-cache storage by up to 34% and deliver up to 51.4% higher decoding throughput on a single H200 GPU. Ablation studies show that branching yields gains beyond changes in width and depth, enables an effective KV-sharing strategy (Joint-KV), remains robust across fusion functions, and performs best in the middle layers. These findings show that branching offers a practical path for scaling language models toward both better modeling quality and faster inference.
한국어 요약
한 줄 요약
Multi-Branch Transformer(MBT)는 병렬 브랜치 구조를 도입하여 언어 모델의 성능과 추론 효율성을 동시에 향상시키는 새로운 아키텍처를 제안한다.
핵심 기여도
- MBT는 Wide-Shallow, Narrow-Deep, Balanced 세 가지 브랜치 구조를 제안하며, Balanced MBT가 2.1B 파라미터 모델에서 가장 우수한 성능을 보임.
- Joint-KV를 도입하여 KV 캐시 저장 공간을 최대 34% 감소시키고, H200 GPU에서 최대 51.4% 높은 디코딩 처리량을 달성함.
- 1.26×의 학습 컴퓨트를 요구하는 표준 트랜스포머 대비, MBT는 동일한 성능을 1.16–1.26×의 학습 컴퓨트로 달성함.
- 브랜치 구조는 퓨전 함수 선택에 강건하며, 중간 레이어에 배치할 때 최적의 성능을 보임.
핵심 아이디어
기존 트랜스포머는 블록의 깊이나 너비를 확장하는 방식으로 스케일링되지만, MBT는 전체 트랜스포머 블록을 병렬 브랜치로 구성함으로써 새로운 스케일링 차원을 제시한다. 이는 `prelude`와 `coda` 사이에 독립적으로 파라미터화된 브랜치를 병렬 실행하고, 결과를 퓨전함으로써 이루어진다. 핵심 아이디어는 각 브랜치 내에서는 순차적 구조를 유지하면서, 여러 변형 경로의 결과를 공유 레이어에서 결합하는 것이다. 이는 기존의 블록 병렬화 접근과는 구조적으로 차별화되며, Joint-KV를 통해 KV 캐시 공유를 가능하게 하여 추론 효율성을 높인다.
기술적 접근법
- **MBT 아키텍처**: 입력은 `prelude`를 거쳐, `K`개의 독립적으로 파라미터화된 브랜치(`branch stacks`)로 분기되고, 각 브랜치는 `L_i`개의 블록을 포함함.
- **Fusion**: 각 브랜치 출력은 RMSNorm 후, 히든 차원에 따라 연결되고, `W_F`를 통해 공유 너비 `d`로 매핑됨.
- **Joint-KV**: 모든 브랜치의 키-밸류 캐시를 공유하여, 브랜치 수 `K`에 따라 캐시 저장 공간을 `1/K`로 줄임.
- **Inference Engine**: `branch grouping`과 `head folding`을 활용해 순차 실행 단계와 중복된 KV 읽기 횟수를 줄임.
주요 결과
- 0.8B~2.1B 파라미터의 MoE 모델에서 2-브랜치 Wide-Shallow MBT는 1.23×의 학습 컴퓨트를 요구하는 표준 트랜스포머와 동등한 성능을 보임.
- Balanced MBT는 브랜치 수가 증가할수록 성능 저하 없이 유지되며, 1.26×의 학습 컴퓨트로 표준 트랜스포머와 동등한 검증 손실을 달성함.
- Joint-KV를 적용한 MBT는 KV 캐시 저장 공간을 최대 34% 감소시키고, H200 GPU에서 최대 51.4% 높은 디코딩 처리량을 보임.
의의 및 한계
MBT는 기존의 너비와 깊이 기반 스케일링에 대안적인 브랜치 구조를 제시하며, 모델 품질과 추론 효율성을 동시에 향상시킬 수 있음을 입증한다. 특히, Joint-KV는 장문 컨텍스트 처리 시 효율성을 높이는 새로운 전략을 제시한다. 그러나 브랜치 수가 증가할수록 퓨전 전략의 선택이 중요하며, 이에 대한 최적화가 필요하다. 또한, 브랜치 구조는 모델 복잡도를 증가시키므로, 추론 엔진의 최적화가 필수적이다.
실용적 활용
MBT는 대규모 언어 모델의 효율적인 학습 및 추론이 필요한 산업, 예를 들어, 챗봇, 번역, 코드 생성 등에 적용 가능하다. 특히, Joint-KV와 병렬 브랜치 구조는 GPU 자원이 제한된 환경에서 성능 향상과 에너지 효율성을 동시에 달성할 수 있는 실용적 솔루션이 될 수 있다.