Skip to content
Query Feedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  1. Home /
  2. AI Glossaries /
  3. LLMs /
  4. What is a Transformer?
LLMs

What is a Transformer?

Updated September 21, 2026 Read 3 min

A transformer is a neural network architecture that uses a mechanism called attention to relate every part of an input to every other part. Introduced in 2017, it is the foundation of nearly all modern large language models.

Contents 10
  1. 01Key takeaways
  2. 02A transformer explained in simple terms
  3. 03How self-attention works
  4. 04The parts of a transformer block
  5. 05Transformer variants
  6. 06Why transformers won
  7. 07Limitations
  8. 08Common Use Cases
  9. 09Frequently Asked Questions
  10. 10Related Terms

A transformer is a neural network architecture that uses a mechanism called self-attention to relate every part of an input to every other part at the same time. Introduced by Google researchers in the 2017 paper “Attention Is All You Need”, it replaced RNNs for most language tasks and now underpins nearly all large language models, as well as many image, audio and video models.

Key takeaways

  • Self-attention lets each token look at all other tokens to understand context.
  • Transformers process sequences in parallel, making training on GPUs far faster than RNNs.
  • Core parts: embeddings, positional information, multi-head attention, feed-forward layers, residual connections and normalisation.
  • Variants include encoder-only (BERT), decoder-only (GPT) and encoder-decoder (T5).
  • Attention cost grows quickly with sequence length, which limits the context window.

A transformer explained in simple terms

Read this sentence: “The trophy didn’t fit in the suitcase because it was too big.” To know what “it” means, you look back at “trophy” and “suitcase” and decide. Attention is the transformer’s way of doing this. For every word, it asks: which other words matter for understanding this one, and how much? It does this for all words at once, in many layers, building up a detailed understanding of the whole text.

How self-attention works

Each token is turned into three vectors:

  • Query: what this token is looking for.
  • Key: what this token offers.
  • Value: the information this token passes on.

The model compares each token’s query with every token’s key to get attention scores, turns the scores into weights with softmax, and takes a weighted mix of the values. In the example above, the query for “it” matches strongly with the key for “trophy”, so “trophy” contributes most to how “it” is understood.

Multi-head attention runs several attention operations in parallel. Different heads can track different relationships, such as grammar, meaning or references.

The parts of a transformer block

ComponentRole
Token embeddingsTurn tokens into vectors
Positional informationTells the model word order, since attention alone ignores order
Multi-head self-attentionMixes information across tokens
Feed-forward networkProcesses each token’s representation further
Residual connectionsAdd each layer’s input to its output, easing training of deep stacks
Layer normalisationStabilises training

Large models stack dozens of these blocks.

Transformer variants

VariantHow it worksBest atExamples
Encoder-onlyReads the full input in both directionsUnderstanding, classification, embeddingsBERT
Decoder-onlyGenerates left to right with a causal maskText generation, chat, codeGPT-style LLMs
Encoder-decoderEncoder reads input; decoder generates outputTranslation, summarisationOriginal transformer, T5
Vision transformerTreats image patches like tokensImage recognitionViT

Why transformers won

  • Parallel training: unlike RNNs, all positions are processed together.
  • Long-range context: any token can attend directly to any other.
  • Scalability: performance kept improving as models, data and compute grew.
  • Flexibility: the same design works for text, images, audio and more.

Limitations

  • Standard attention cost grows with the square of sequence length, making long contexts expensive.
  • Memory for the attention cache grows during inference.
  • Large transformers need huge data and compute.
  • Internal workings are hard to interpret.

Researchers address these with efficient attention methods, mixture-of-experts designs and alternatives such as state space models.

Common Use Cases

01

Large language models

Power chat, writing, coding and reasoning assistants.

02

Machine translation

Translate text between languages with encoder-decoder models.

03

Search and embeddings

Encoder models create embeddings for semantic search.

04

Image understanding

Vision transformers classify and analyse images.

05

Speech recognition

Transformer-based models transcribe audio into text.

06

Protein and science models

Model biological sequences for research and drug discovery.

Frequently Asked Questions

A neural network architecture that uses self-attention to relate all parts of an input, and the foundation of modern LLMs.

A team of Google researchers introduced it in the 2017 paper "Attention Is All You Need".

A mechanism where each token scores its relevance to every other token and combines their information accordingly.

They train in parallel, handle long-range context better and scale more effectively.

Yes. GPT models are decoder-only transformers.

Related Terms

  • Large Language Model
  • Self-Attention
  • GPT
  • Encoder
  • Decoder
  • Context Window

Related AI Terms

What is an Attention Head?An attention head is a single attention unit inside a transformer layer, with its own query, key and…What is Prefix Tuning?Prefix tuning is a parameter-efficient fine-tuning method that learns trainable vectors inserted into the attention keys and values…What is an Attention Mechanism?An attention mechanism is a technique that lets a neural network focus on the most relevant parts of…What is Self-Attention?Self-attention is a mechanism where each position in a sequence attends to every other position in the same…What is Multi-Head Attention?Multi-head attention runs several attention operations in parallel, each with its own learned projections, so a model can…What is RoPE (Rotary Positional Embedding)?RoPE (rotary positional embedding) encodes a token's position by rotating its query and key vectors by an angle…

Contents

  1. 01Key takeaways
  2. 02A transformer explained in simple terms
  3. 03How self-attention works
  4. 04The parts of a transformer block
  5. 05Transformer variants
  6. 06Why transformers won
  7. 07Limitations
  8. 08Common Use Cases
  9. 09Frequently Asked Questions
  10. 10Related Terms

AI Topic

  • LLMs

Related Terms

  • What is an Attention Head?
  • What is Prefix Tuning?
  • What is an Attention Mechanism?
  • What is Self-Attention?
  • What is Multi-Head Attention?
  • What is RoPE (Rotary Positional Embedding)?

Quick Navigation

  • Common Use Cases
  • Frequently Asked Questions
  • Related Terms
  • Back to top

Details

Updated
September 21, 2026
Read
3 min
  • Forum
  • Submit a tool
  • Submit Guest Post
  • List Your Startup
  • Privacy Policy
  • Editorial Policy
  • Account
  • Contact
  • AI Productivity
  • AI Video
  • AI Coding
  • AI Chatbots
  • Sales
  • AI Business
  • View All Tools

Subscribe our Newsletter

Get weekly exclusive content - No spam.

Copyright © 2026 -  Query Feedz

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}