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 Repetition Penalty?
LLMs

What is Repetition Penalty?

Updated September 26, 2026 Read 3 min

Repetition penalty is a decoding setting that lowers the probability of tokens that have already appeared, discouraging a language model from repeating the same words or phrases in a loop.

Contents 11
  1. 01Key takeaways
  2. 02Repetition penalty explained in simple terms
  3. 03How it works
  4. 04Choosing a value
  5. 05Why repetition happens at all
  6. 06Side effects to watch
  7. 07Where you will find it
  8. 08Limitations
  9. 09Common Use Cases
  10. 10Frequently Asked Questions
  11. 11Related Terms

Repetition penalty is a decoding setting that reduces the probability of tokens that have already appeared in the text, so the model is less likely to repeat itself. It was introduced with the CTRL model in 2019 and is widely used in open-source generation tools. It applies a multiplicative adjustment to the logits of tokens already seen.

Key takeaways

  • A value of 1.0 means no penalty; higher values penalise repetition more.
  • Typical useful values are 1.05 to 1.2.
  • It applies to any token that has appeared, regardless of how often.
  • Too high a value harms fluency, since some repetition is natural.
  • It differs from OpenAI’s frequency and presence penalties, which are additive.

Repetition penalty explained in simple terms

Imagine an editor who crosses out any word you have already used, making you reach for alternatives. Used lightly, your writing becomes more varied. Used heavily, you can no longer write “the” or “and” naturally, and the text falls apart. That balance is what the penalty value controls.

How it works

For each token that has already appeared, its logit is divided by the penalty value if the logit is positive, or multiplied by it if negative. Both cases push the token’s probability down. The adjusted logits then go through softmax and sampling as usual.

Worked example with a penalty of 1.2. The token ” however” has already appeared and has a logit of 3.0.

  • Adjusted logit: 3.0 ÷ 1.2 = 2.5.
  • After softmax, its probability falls relative to unused tokens, making a repeat less likely but not impossible.

Choosing a value

ValueEffect
1.0No penalty
1.05–1.1Light touch; usually safe
1.1–1.2Common range for reducing loops
1.3+Often degrades grammar and coherence

Why repetition happens at all

Language models trained with next-token prediction tend to assign rising probability to text they have already produced, especially with greedy decoding or low temperature. This can create loops where a phrase repeats indefinitely. Penalties are one fix; better sampling with top-p is another.

Side effects to watch

  • Legitimate repetition suffers: lists, names, technical terms and code identifiers.
  • In code generation, penalising repeated variable names can break output.
  • In structured output, repeated JSON keys are necessary, so penalties should usually be off.
  • Long outputs penalise more tokens over time, which can cause drift.

Where you will find it

Repetition penalty is standard in open-source stacks such as Hugging Face Transformers, llama.cpp and vLLM. Commercial APIs more often expose frequency and presence penalties instead. Some tools also offer a “no repeat n-gram size” setting, which blocks exact repeats of a phrase of a given length.

Limitations

  • A blunt instrument: it does not know which repetition is desirable.
  • Penalty strength that works for prose may break code.
  • Interacts with temperature and top-p, complicating tuning.
  • Does not fix the underlying cause of degenerate output.

Common Use Cases

01

Story generation

Prevent looping phrases in long creative text.

02

Chat replies

Avoid repeating the same sentence across a conversation.

03

Local model tuning

Configure sampling in llama.cpp, Ollama and similar tools.

04

Summarisation

Reduce repeated points in generated summaries.

05

Long-form drafting

Keep vocabulary varied across long documents.

06

Debugging degenerate output

Diagnose and fix repetition loops.

Frequently Asked Questions

A decoding setting that lowers the probability of tokens that have already appeared, reducing repetition.

Usually between 1.05 and 1.2. Values of 1.3 or higher often harm grammar.

Repetition penalty divides logits multiplicatively for any seen token. Frequency penalty subtracts an amount that grows with how often a token appeared.

Usually not, or only very lightly, since code legitimately repeats identifiers and keywords.

No. It reduces the probability of repeats rather than blocking them outright.

Related Terms

  • Frequency Penalty
  • Presence Penalty
  • Top-p Sampling
  • Temperature in LLMs
  • Greedy Decoding
  • Logit

Related AI Terms

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 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 Encoder-Decoder Model?An encoder-decoder model, also called a sequence-to-sequence model, uses one component to read and understand the input and…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 Positional Encoding?Positional encoding is the method transformers use to represent the order of tokens in a sequence, because the…

Contents

  1. 01Key takeaways
  2. 02Repetition penalty explained in simple terms
  3. 03How it works
  4. 04Choosing a value
  5. 05Why repetition happens at all
  6. 06Side effects to watch
  7. 07Where you will find it
  8. 08Limitations
  9. 09Common Use Cases
  10. 10Frequently Asked Questions
  11. 11Related Terms

AI Topic

  • LLMs

Related Terms

  • What is Multi-Head Attention?
  • What is Prefix Tuning?
  • What is an Encoder-Decoder Model?
  • What is an Attention Mechanism?
  • What is Self-Attention?
  • What is Positional Encoding?

Quick Navigation

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

Details

Updated
September 26, 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}