arXiv:2502.07864 공식 코드 · Papers with Code

TransMLA: Multi-Head Latent Attention Is All You Need

Fanxu Meng, Zengwei Yao, Muhan Zhang

제출 2025-02-11

원문 초록

Modern large language models (LLMs) often encounter communication bottlenecks on current hardware, rather than purely computational constraints. Multi-head Latent Attention (MLA) tackles this challenge by using low-rank matrices in the key-value (KV) layers, thereby allowing compressed latent KV states to be cached. This approach significantly reduces the KV cache size relative to traditional multi-head attention, leading to faster inference. Moreover, MLA employs an up-projection matrix to increase expressiveness, trading additional computation for reduced communication overhead. Although MLA has demonstrated efficiency and effectiveness in Deepseek V2/V3/R1, many major model providers still rely on Group Query Attention (GQA) and have not announced any plans to adopt MLA. In this paper, we show that GQA can always be represented by MLA while maintaining the same KV cache overhead, but the converse does not hold. To encourage broader use of MLA, we introduce TransMLA, a post-training method that converts widely used GQA-based pre-trained models (e.g., LLaMA, Qwen, Mixtral) into MLA-based models. After conversion, the model can undergo additional training to boost expressiveness without increasing the KV cache size. Furthermore, we plan to develop MLA-specific inference acceleration techniques to preserve low latency in transformed models, thus enabling more efficient distillation of Deepseek R1.

함께 살펴볼 논문

공통 태그를 근거로 연결했습니다. 실제 인용 관계나 논문의 우수성을 뜻하지 않습니다.

arXiv:2503.05840v3cs.LG공통 태그 All공식 코드 · Papers with Code

슬림 어텐션: 손실 없이 컨텍스트 메모리를 절반으로 줄이다 -- MHA에는 K-캐시만 있으면 된다

Slim attention: cut your context memory in half without loss -- K-cache is all you need for MHA

슬림 어텐션(slim attention)은 MHA(멀티 헤드 어텐션)를 사용하는 트랜스포머 모델의 컨텍스트 메모리 크기를 2배 줄이며, 큰 컨텍스트 윈도우에서 추론 속도를 최대 2배까지 높일 수 있다. 슬림 어텐션은 표준 어텐션 메커니즘을 수학적으로 동일하게 정확히 구현한 것이므로 모델 정확도를 저하시키지 않는다. 다시 말해, 슬림 어텐션은 컨텍스트 메모리를 2배로 무손실 압축한다. 인코더-디코더 트랜스포머의 경우 컨텍스트 메모리 크기를 더욱 줄일 수 있다. 예를 들어 Whisper 모델에서는 슬림 어텐션이 컨텍스트 메모리를 8배 줄이며, 예컨대 배치 크기 64에서 토큰 생성 속도를 5배 높일 수 있다. 또한 예를 들어 T5-11B 모델에서는 MHA 투영 차원이 임베딩 차원보다 크기 때문에 메모리를 32배 줄일 수 있다. 코드와 더 많은 트랜스포머 기법은 https://github.com/OpenMachine-ai/transformer-tricks 를, 본 논문의 유튜브 영상은 https://www.youtube.com/watch?v=uVtk3B6YO4Y 를 참조하라.

arXiv:2502.06806v5cs.LG공통 태그 All공식 코드 · Papers with Code

폐쇄형 모델 적응에 필요한 것은 로짓뿐이다

Logits are All We Need to Adapt Closed Models

많은 상용 대규모 언어 모델(LLM)은 종종 폐쇄형(closed-source)이어서, 개발자가 특정 응용에 맞게 콘텐츠 생성을 정렬(alignment)하기 위해 프롬프트 튜닝에만 의존하게 제한된다. 이러한 모델은 현재 토큰 로짓에 대한 접근을 제공하지 않지만, 그러한 접근이 가능하다면 프롬프트 엔지니어링을 넘어선 더 강력한 적응(adaptation) 기법을 가능하게 할 것이라고 주장한다. 본 논문에서는 로짓 접근과 소량의 태스크별 데이터가 주어졌을 때, 블랙박스 LLM을 응용별 콘텐츠 생성 방향으로 효과적으로 유도할 수 있는 토큰 수준 확률 재가중(reweighting) 프레임워크를 제안한다. 우리 접근법은 다음 토큰 예측을 지도 분류(supervised classification)의 관점에서 본다. 블랙박스 LLM을 태스크별 데이터와 정렬하는 문제를 레이블 노이즈 보정(label noise correction) 문제로 형식화할 수 있음을 보이며, 이는 로짓만으로 동작하는 자기회귀(autoregressive) 확률 재가중 모델인 Plugin 모델로 이어진다. 태스크 적응을 위해 로짓 재가중만으로 충분한 이유에 대한 이론적 근거를 제공한다. 다양한 데이터셋, LLM, 재가중 모델을 사용한 광범위한 실험은 본 방법의 효과를 보여 주며, 폐쇄형 모델에서 토큰 로짓에 대한 더 넓은 접근을 촉구한다.

토론

이 논문과 연결된 포럼 글이 아직 없습니다.