Split View: 정규화와 활성화 — 학습을 무너뜨리지 않는 법
정규화와 활성화 — 학습을 무너뜨리지 않는 법
- 들어가며
- RMSNorm이 표준이 된 이유
- 프리노름과 포스트노름
- SwiGLU 계열
- 어텐션 로짓이 폭주할 때
- QK-Clip: 다른 접근
- 정규화를 더 넣는 경우
- 안정성은 학습률 스케줄에도 있다
- 마치며
- 참고 자료
- 직접 해보기
- 시리즈
들어가며
앞선 글들은 파라미터와 메모리를 다뤘습니다. 이번 글의 주제는 조금 다릅니다. 정규화와 활성화 함수는 파라미터 수에 거의 기여하지 않지만, 이것이 잘못되면 학습 자체가 멈춥니다. 수천 장의 GPU가 몇 주를 도는 작업에서 손실 발산은 가장 비싼 실패입니다.
config에서 보이는 단서는 rms_norm_eps, hidden_act, 그리고 최근 모델의 use_qk_norm 정도입니다. 그 뒤에 어떤 설계가 있는지 살펴봅니다.
수치는 2026-08-12에 논문·공식 리포트·config.json에서 직접 확인했습니다. 모델은 갱신되므로 원본을 다시 확인하세요.
RMSNorm이 표준이 된 이유
지금 확인한 모든 모델의 config에 rms_norm_eps가 있습니다. Qwen3와 DeepSeek-V3, Kimi K2는 1e-06, Mixtral과 GLM-4.5는 1e-05입니다. 예외 없이 RMSNorm입니다.
원래의 레이어 정규화는 평균을 빼고 분산으로 나눕니다. RMSNorm은 평균을 빼는 단계를 없애고 제곱평균제곱근으로만 나눕니다. 계산이 줄고, 더 중요하게는 평균을 구하기 위한 추가적인 축소 연산이 사라져 분산 학습에서 통신과 동기화 비용이 줄어듭니다.
rms_norm_eps는 0으로 나누는 것을 막는 작은 값입니다. 사소해 보이지만 저정밀도 학습에서는 이 값이 너무 작으면 수치가 불안정해지고 너무 크면 정규화가 흐려집니다.
프리노름과 포스트노름
정규화를 어디에 두느냐가 안정성을 크게 좌우합니다. 원래 트랜스포머는 잔차 연결을 더한 다음 정규화했습니다. 포스트노름입니다. 지금은 거의 모두 잔차에 더하기 전에 정규화하는 프리노름을 씁니다. Qwen3 리포트도 사전 정규화와 함께 RMSNorm을 쓴다고 명시합니다(arXiv:2505.09388).
차이는 잔차 경로에 있습니다. 프리노름에서는 입력에서 출력까지 정규화를 거치지 않는 항등 경로가 유지되어, 층이 깊어져도 기울기가 잘 전달됩니다. 대가는 있습니다. 프리노름은 깊은 층의 출력 크기가 누적되어 커지는 경향이 있고, 그래서 최종 정규화를 따로 두어야 합니다. 앞 글의 파라미터 계산에서 마지막에 더한 4,096이 바로 그 최종 정규화입니다.
SwiGLU 계열
hidden_act가 silu인 것은 SwiGLU 계열이라는 신호입니다. 확인한 모델 중 Qwen3, Qwen2.5, Mixtral, DeepSeek-V3, GLM-4.5가 모두 silu입니다. Llama 3 리포트의 표 3도 활성화 함수를 SwiGLU로 적습니다(arXiv:2407.21783).
게이트 구조는 두 개의 선형 사영을 만들어 하나에 비선형을 적용한 뒤 원소별로 곱합니다. 관련 논문은 게이트 선형 유닛의 변형들을 트랜스포머 FFN에 넣어 시험한 결과 일부가 통상적인 ReLU나 GELU보다 품질 향상을 보였다고 보고합니다(Shazeer, arXiv:2002.05202).
여기에 실무적으로 중요한 대가가 있습니다. 행렬이 두 개에서 세 개로 늘어납니다. 그래서 같은 파라미터 예산을 맞추려면 FFN 내부 차원을 줄여야 합니다. Llama 3.1 8B는 폭 4096에 FFN 14336으로 3.5배이고, Qwen3-8B는 4096에 12288로 3배입니다. 게이트가 없던 시절의 관행인 4배와 다른 이유가 이것입니다.
어텐션 로짓이 폭주할 때
최근 리포트들이 공통으로 다루는 실패 모드가 있습니다. 학습이 진행되면서 어텐션 로짓이 계속 커지는 현상입니다. 소프트맥스 입력이 지나치게 커지면 분포가 한 점에 몰리고 기울기가 사라지며, 저정밀도에서는 수치 오버플로로 이어집니다.
Qwen3의 대응은 QK-Norm입니다. 리포트는 Qwen2에서 쓰던 QKV 편향을 제거하고 어텐션에 QK-Norm을 도입해 학습을 안정화했다고 밝힙니다(arXiv:2505.09388). 쿼리와 키를 정규화해 내적의 크기에 상한을 두는 방식입니다.
config에서도 확인됩니다. Qwen3-8B의 파라미터를 셀 때 층마다 128 x 2, 즉 256개의 추가 파라미터가 있었습니다. 이것이 헤드 차원 크기의 쿼리 정규화와 키 정규화입니다. GLM-4.5는 아예 use_qk_norm 필드를 true로 노출합니다. 비용은 층당 256개 파라미터와 약간의 연산, 즉 거의 공짜입니다.
QK-Clip: 다른 접근
Kimi K2는 옵티마이저 쪽에서 같은 문제를 풀었습니다. 리포트에 따르면 토큰 효율이 좋은 Muon 옵티마이저를 쓰되 그 불안정성을 QK-Clip으로 완화한 MuonClip을 제안하고, 이를 통해 15.5조 토큰을 손실 스파이크 없이 사전학습했다고 보고합니다(arXiv:2507.20534).
QK-Clip은 쿼리와 키 사영 가중치를 갱신 후에 다시 스케일해 어텐션 로짓의 성장을 억제합니다. 리포트는 중간 규모 실험에서 어텐션 로짓이 빠르게 1000을 넘었다고 적고, K2 학습에서는 임계값을 100으로 두었으며 최대 로짓이 상한값까지 빠르게 올랐다가 전체 학습 스텝의 약 30퍼센트를 지난 뒤 안정 구간으로 내려왔다고 보고합니다.
주목할 설계는 개입을 최소화한 점입니다. 실제로는 일부 헤드만 로짓이 폭주하므로 헤드별 스케일 계수를 계산해 해당 헤드에만 적용합니다.
정규화를 더 넣는 경우
DeepSeek-V3는 압축 구조 때문에 정규화를 추가로 넣었습니다. 리포트는 압축된 잠재 벡터 뒤에 RMSNorm 층을 추가하고 폭이 좁아지는 지점에 스케일링 계수를 곱한다고 밝힙니다(arXiv:2412.19437).
여기에 일반적인 교훈이 있습니다. 메모리를 아끼려고 표현을 압축하면 그 지점에서 값의 크기 분포가 왜곡되기 쉽고, 그래서 정규화를 덧대야 합니다. 3편에서 MLA가 연산과 복잡도를 내준다고 했던 것의 구체적인 모습입니다.
안정성은 학습률 스케줄에도 있다
구조만으로 안정성이 확보되지는 않습니다. DeepSeek-V3 리포트는 학습률을 처음 2000 스텝 동안 0에서 2.2e-4까지 선형으로 올린 뒤 10조 토큰까지 유지하고, 이어 4.3조 토큰에 걸쳐 코사인 곡선으로 2.2e-5까지 낮췄다고 적습니다. 기울기 클리핑 노름은 1.0이고, 배치 크기는 처음 4690억 토큰 동안 3072에서 15360까지 점진적으로 늘렸습니다.
Llama 3의 표 3에 적힌 최고 학습률은 8B가 3e-4, 70B가 1.5e-4, 405B가 8e-5입니다. 모델이 커질수록 학습률을 낮춥니다. 큰 모델일수록 발산에 취약하다는 경험칙이 숫자로 드러납니다.
마치며
정규화와 활성화는 config에서 가장 눈에 덜 띄는 부분이지만, 리포트에서는 가장 많은 지면을 차지하는 주제입니다. RMSNorm과 프리노름과 SwiGLU가 사실상의 표준이 된 지금, 리포트가 다루는 것은 그다음 문제인 어텐션 로짓 폭주입니다. Qwen3는 QK-Norm으로 구조에서, Kimi K2는 QK-Clip으로 옵티마이저에서 풀었습니다. 새 모델의 리포트를 읽을 때 이 부분에 무엇이 추가되었는지 보면, 그 팀이 무엇 때문에 고생했는지가 보입니다.
참고 자료
- GLU Variants Improve Transformer (Shazeer, arXiv:2002.05202): https://arxiv.org/abs/2002.05202
- Qwen3 Technical Report (arXiv:2505.09388): https://arxiv.org/abs/2505.09388
- Kimi K2 (arXiv:2507.20534): https://arxiv.org/abs/2507.20534
- DeepSeek-V3 Technical Report (arXiv:2412.19437): https://arxiv.org/abs/2412.19437
- The Llama 3 Herd of Models (arXiv:2407.21783): https://arxiv.org/abs/2407.21783
- GLM-4.5 config.json: https://huggingface.co/zai-org/GLM-4.5/raw/main/config.json
직접 해보기
- 뉴럴넷 실습실 — 활성화 함수를 바꿔 가며 학습 곡선이 어떻게 달라지는지 관찰해 보세요.
- 신경망 아키텍처 탐색기 — 층 구성과 정규화 위치를 살펴보세요.
- VRAM 계산기 — FFN 내부 차원이 메모리에 미치는 영향을 확인해 보세요.
시리즈
Normalization and Activation — Keeping Training From Falling Apart
- Introduction
- Why RMSNorm Became the Default
- Pre-Norm and Post-Norm
- The SwiGLU Family
- When Attention Logits Explode
- QK-Clip: A Different Approach
- When More Normalization Is Added
- Stability Also Lives in the Learning Rate Schedule
- Closing
- References
- Try It Yourself
- Series
Introduction
The previous posts dealt with parameters and memory. This one has a different subject. Normalization and activation functions contribute almost nothing to parameter count, but get them wrong and training itself stops. On a job where thousands of GPUs run for weeks, a diverging loss is the most expensive failure there is.
The clues visible in the config are rms_norm_eps, hidden_act, and in recent models use_qk_norm. Let us look at the design sitting behind them.
All figures were verified directly against papers, official reports, and config.json files on 2026-08-12. Models get updated, so check the originals again.
Why RMSNorm Became the Default
Every config examined here contains rms_norm_eps. Qwen3, DeepSeek-V3, and Kimi K2 use 1e-06, while Mixtral and GLM-4.5 use 1e-05. RMSNorm without exception.
The original layer normalization subtracts the mean and divides by the variance. RMSNorm drops the mean-subtraction step and divides only by the root mean square. Compute goes down, and more importantly the extra reduction needed to compute a mean disappears, which lowers communication and synchronization cost in distributed training.
rms_norm_eps is the small value that prevents division by zero. It looks trivial, but in low-precision training a value too small makes the arithmetic unstable while one too large blurs the normalization.
Pre-Norm and Post-Norm
Where you put the normalization strongly determines stability. The original transformer normalized after adding the residual connection, which is post-norm. Today nearly everyone uses pre-norm, normalizing before adding to the residual. The Qwen3 report explicitly states that it uses RMSNorm with pre-normalization (arXiv:2505.09388).
The difference lies in the residual path. Under pre-norm an identity path runs from input to output without passing through a normalization, so gradients propagate well even as layers stack up. There is a cost. Pre-norm tends to let the magnitude of deep-layer outputs accumulate, which is why a final normalization must be added separately. The 4,096 added at the end of the parameter count in the first post is exactly that final normalization.
The SwiGLU Family
A hidden_act of silu signals the SwiGLU family. Among the models checked, Qwen3, Qwen2.5, Mixtral, DeepSeek-V3, and GLM-4.5 all use silu. Table 3 of the Llama 3 report likewise lists the activation function as SwiGLU (arXiv:2407.21783).
The gated structure builds two linear projections, applies a nonlinearity to one of them, and multiplies element-wise. The relevant paper reports that testing gated linear unit variants in the feed-forward sublayers of the Transformer found some of them yielding quality improvements over the typically used ReLU or GELU activations (Shazeer, arXiv:2002.05202).
There is a practically important cost here. The number of matrices goes from two to three. To hold the same parameter budget you must therefore shrink the FFN inner dimension. Llama 3.1 8B pairs a width of 4096 with an FFN of 14336, a ratio of 3.5, and Qwen3-8B pairs 4096 with 12288, a ratio of 3. This is why the old convention of 4 times, from the days before gating, no longer holds.
When Attention Logits Explode
Recent reports share a failure mode. As training proceeds, attention logits keep growing. When the softmax input becomes too large the distribution collapses onto a single point and gradients vanish, and at low precision it leads to numerical overflow.
The Qwen3 answer is QK-Norm. The report states that the QKV bias used in Qwen2 was removed and QK-Norm was introduced into the attention mechanism to ensure stable training (arXiv:2505.09388). The approach normalizes queries and keys, putting a ceiling on the magnitude of their dot product.
You can see it in the config too. When counting the parameters of Qwen3-8B there were 128 x 2, or 256, extra parameters per layer. Those are the query normalization and key normalization, each the size of the head dimension. GLM-4.5 exposes a use_qk_norm field set to true outright. The cost is 256 parameters per layer plus a little compute, which is to say almost free.
QK-Clip: A Different Approach
Kimi K2 solved the same problem from the optimizer side. According to its report, the team proposes MuonClip, which uses the token-efficient Muon optimizer while mitigating its instabilities with QK-Clip, and reports pre-training on 15.5 trillion tokens without a single loss spike (arXiv:2507.20534).
QK-Clip rescales the query and key projection weights after the update to bound the growth of attention logits. The report notes that in a mid-scale training run attention logits rapidly exceeded 1000, that K2 training used a threshold of 100, and that maximum logits rose quickly to the capped value and only decayed to a stable range after roughly 30 percent of the training steps.
The notable design choice is minimizing intervention. In practice only a small subset of heads exhibits exploding logits, so a per-head scaling factor is computed and applied to just those heads.
When More Normalization Is Added
DeepSeek-V3 added extra normalization because of its compression structure. The report states that additional RMSNorm layers are employed after the compressed latent vectors, and that additional scaling factors are multiplied in at the width bottlenecks (arXiv:2412.19437).
There is a general lesson here. Compressing a representation to save memory tends to distort the distribution of magnitudes at that point, so normalization has to be patched in. This is the concrete shape of what the third post described as MLA giving up compute and complexity.
Stability Also Lives in the Learning Rate Schedule
Structure alone does not secure stability. The DeepSeek-V3 report states that the learning rate was raised linearly from 0 to 2.2e-4 over the first 2K steps, held there until the model consumed 10T tokens, then decayed to 2.2e-5 over 4.3T tokens following a cosine curve. The gradient clipping norm is 1.0, and the batch size was gradually increased from 3072 to 15360 over the first 469B tokens.
The peak learning rates in Table 3 of Llama 3 are 3e-4 for 8B, 1.5e-4 for 70B, and 8e-5 for 405B. The larger the model, the lower the learning rate. The rule of thumb that bigger models are more prone to divergence shows up directly in the numbers.
Closing
Normalization and activation are the least conspicuous part of a config, yet they occupy the most pages in the reports. Now that RMSNorm, pre-norm, and SwiGLU are effectively standard, what reports actually discuss is the next problem: exploding attention logits. Qwen3 solved it structurally with QK-Norm, Kimi K2 solved it in the optimizer with QK-Clip. When you read a new model report, looking at what was added here tells you what that team struggled with.
References
- GLU Variants Improve Transformer (Shazeer, arXiv:2002.05202): https://arxiv.org/abs/2002.05202
- Qwen3 Technical Report (arXiv:2505.09388): https://arxiv.org/abs/2505.09388
- Kimi K2 (arXiv:2507.20534): https://arxiv.org/abs/2507.20534
- DeepSeek-V3 Technical Report (arXiv:2412.19437): https://arxiv.org/abs/2412.19437
- The Llama 3 Herd of Models (arXiv:2407.21783): https://arxiv.org/abs/2407.21783
- GLM-4.5 config.json: https://huggingface.co/zai-org/GLM-4.5/raw/main/config.json
Try It Yourself
- Neural net lab — swap activation functions and watch how the training curve changes.
- Neural network architecture explorer — inspect layer configuration and normalization placement.
- VRAM calculator — check how the FFN inner dimension affects memory.