← Back to list

Transformers in 2026: What Changed Beyond the Original Paper

The original Transformer was designed as a complete package: encoder, decoder, and cross-attention working together. But modern AI models…

priyam nagar · 2026-05-25 08:45 · 0 claps · 5.5 min read
#genai #transformers #improvement #architecture #llm
Open on Medium ↗
Wiki topics: LLM · Large Language Models AI · AI · General 🏛️ · Architecture

Transformers in 2026: What Changed Beyond the Original Paper

The original Transformer was designed as a complete package: encoder, decoder, and cross-attention working together. But modern AI models rarely use the full design anymore.

Why?

Because different tasks need different capabilities.

If a model only needs to understand text, using an autoregressive decoder is often unnecessary and expensive. And for generation tasks, researchers discovered that decoder-only models scale far more efficiently than traditional encoder-decoder systems.

This realization led to one of the biggest architectural shifts in deep learning: specialized Transformers optimized for either understanding or generation.

Decoder-only models

GPT, Generative Pre-trained Transformer, was the first decoder-only transformer. It completely removed the Encoder stack and the cross attention block.

Encoder-Decoder to Decoder-only model

Encoder-Decoder to Decoder-only model

Improvements in Decoder-only models

Rotary Position Encodings(RoPE): In traditional positional encodings, relative distances were inferred indirectly. RoPE improves over traditional encodings by naturally encoding relative distances between tokens.

It uses rotation matrices to inject both absolute and relative position information. It enables models to handle longer sequences more efficiently.

For position p, RoPE applies a rotation matrix with angle theta to query and value vectors.

θ is calculated the same way it happens in the original paper.

p is positional index

i is dimension index

d is total embedding dimention

RMS Norm: In place of using Layer normalization, we can use RMS Norm.

Its is computationally lighter, avoids unnecessary mean centering, and has been shown to perform comparably, or better in LLMs.

Like Layer Norm, it is also applied across features.

where g is a learned scaling parameter, and

Instead of subtracting the mean and divide by standard deviation, RMSNorm only re-scales by the RMS magnitude of the vector.

GLU activation function: Gated Linear Unit(GLU) splits the input into two halves, one is transformed linearly, the other acts as a gate using sigmoid.

Example: x = [ -2 -0.5, 1, 3 ]

First half: [-2 -0.5] , lets say xW = [-1,2]

Second half: [1 3], lets say xV = [0.5 -1]

sigmoid(xV) = [0.62 0.27]

GLU = [-1 2] . [0.62 0.27] = [-0.62 0.54]

This control how much of the signal passes through. Becaue it reduced the size of the vector, in Transformers we use a Linear layer to project the output vector to the same size as before.

SwiGLU activation function: We replace the sigmoid gate with a swish function.

where sigma is the sigmoid function.

This makes the output smooth and flexible to suppress, amplify or invert the signal.

SwiGLU can use a scaling factor beta,

It controls the sharpness of the gate.

If beta is 1, then it will act like a standard SwiGLU activation function.

If beta is large, it moves closer to ReLU activation function.

If beta is small, it moves closer to linear activation function.

More Efficient attentions

Attention calculation is the most computationally expensive part of the process. This lead to the creation of other attention variations:

Local/Sparse attention: It limits the context of previous tokens that the model can attend to. These sparse connections can be random, or we can limit the number of tokens left and right of the word, which it can use.

We cannot use this for all the transformer blocks as the quality of generation would vastly degrade, as the model could only see a small number of previous tokens.

Dense attention time complexity: O(n²)

Sparse attention can often get time complexity of O(nlogn) or even O(n), depending on the pattern.

Multi-query and Grouped-query attention: These methods tries to reduce the size of the matrices.

In General, each attention head has its own distinct query, key and value matrices, calculated for a given input.

The way multi-query attention optimizes this is by sharing the keys and values matrices between all the heads. So the only unique matrix for each head would be the query matrix.

This optimization can be too punishing and we can afford to use a little more memory to improve the quality of the models, this is where grouped-query attention comes in. Instead of cutting the number of keys and values matrix to one each, it allows the model to use more (but less than the number of heads).

Flash Attention: It speeds up the attention calculation by optimizing what values are loaded and moved between a GPUs shared memory(SRAM) and high bandwidth memory(HBM).

GPU memory types:

Traditional attention implementation constantly moves data between HBM and compute units.

Flash attention tries to keep everything inside fast SRAM as much as possible, by dividing matrices into blocks. Instead of computing the entire QK matrix,

Q = [Q1, Q2, Q3,…] and K = [K1, K2, K3,…]

Then it computes attention block by block, such that each chunk fits into fast SRAM.

Encoder-only models

Bi-Directional Encoder Representation from Transformers(BERT) was the first encoder-only model. Encoder only models are specialized for tasks where language understanding is important.

The original paper uses:

  1. WordPiece (Tokenization) algorithm.
  2. Masked language model(MLM) and Next sentence generation(NSP) for training.

MLM tries to predict a word in the input sentence, represented by [MASK] in the input, and NSP tries to predict if the two sentences used as the input are in the correct sequence.

Improvements in Encoder-only models

RoBERTa:

  1. Removed NSP completely: It was found that NSP was not helping much in understanding. This lead to simpler training, often better downstream performance.
  2. Dynamic masking: In BERT the [MASK] stays the same in a sentence for every epoch. It changes this [MASK] token for every epoch.
  3. Byte Pair Encoding: BPE is used instead of Word piece.

ELECTRA:

ELECTRA replaced MLM with Replaced token detection:

Instead of predicting masked tokens, A small generator corrupts text, Encoder predicts whether each token is real or fake.

Example: “I love eating pizza”

Corrupted: “I love eating cars”

Model predicts:

  • I → real
  • love → real
  • eating → real
  • cars → fake

Huge improvement:

  • Learns from every token
  • Much more sample efficient

Note: Same improvements in decoder-only models like positional encoding or attention are also be applied to Encoder-only models.

Summary:

Modern AI has shifted from the original all-in-one Transformer toward specialized architectures, favoring decoder-only models for efficient text generation and enhanced encoder-only models for language understanding. Key architectural refinements include the adoption of Rotary Position Embeddings (RoPE), RMS Norm, SwiGLU activations, and Flash Attention to optimize performance, memory, and speed.


메타데이터
post_id
5bcae2147da9
slug
transformers-in-2026-what-changed-beyond-the-original-paper-5bcae2147da9
url
https://medium.com/@priyamnagar/transformers-in-2026-what-changed-beyond-the-original-paper-5bcae2147da9
canonical_url
https://medium.com/@priyamnagar/transformers-in-2026-what-changed-beyond-the-original-paper-5bcae2147da9
author_url
https://medium.com/@priyamnagar
status
ok
fetched_at
2026-06-09 15:37:30