[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"glossary-repetition-penalty::en":3,"gloss-cluster-repetition-penalty::en":26,"gloss-next-repetition-penalty::en":9},{"slug":4,"category":5,"name":6,"definition":7,"meta_desc":8,"faq":9,"schema_markup":9,"related":10},"repetition-penalty","core-ai","Repetition Penalty","A repetition penalty is a decoding parameter that lowers the probability of tokens the model has already produced, to stop generation collapsing into loops. Left unpenalised, a model can fall into a groove — repeating a phrase, restating the same bullet, or emitting the same sentence until it hits the token limit — because each repetition makes the next one look more likely given the context. Implementations vary: some divide the score of any previously seen token by a constant, some subtract a fixed amount (a presence penalty), and some scale the subtraction by how often the token has appeared (a frequency penalty). The distinction matters when you tune them, because a presence penalty discourages a word from appearing twice at all, while a frequency penalty only pushes back once it becomes common. The failure mode of over-penalising is subtler than the failure it fixes. Push the value too high and the model starts avoiding words it legitimately needs to repeat — a product name, a variable, a column heading in a table, the same key in a JSON object — which produces output that reads oddly or, in structured generation, does not parse. For that reason a repetition penalty is usually a poor tool for anything with a schema: constrained decoding or a JSON mode is the right control there. Treat it as a mild default for free prose, verify it against a real sample of your own outputs, and be aware that looping is often a symptom of a weak prompt or an over-long context rather than a decoding problem.","A repetition penalty lowers the odds of already-used tokens to stop generation looping — how presence and frequency variants differ, and when tuning it backfires.",null,[11,14,17,20,23],{"slug":12,"name":13},"logprobs","Logprobs (Log Probabilities)",{"slug":15,"name":16},"streaming-generation","Streaming Generation",{"slug":18,"name":19},"temperature","Temperature",{"slug":21,"name":22},"top-k","Top-k Sampling",{"slug":24,"name":25},"top-p","Top-p (Nucleus Sampling)",[27,31,35,39,42,45,48,51,54,57,60,63],{"slug":28,"category":5,"name":29,"updated_at":30},"agentic","Agentic AI","2026-08-24T02:46:36+00:00",{"slug":32,"category":5,"name":33,"updated_at":34},"alignment-tax","Alignment Tax","2026-08-24T02:46:37+00:00",{"slug":36,"category":5,"name":37,"updated_at":38},"artificial-intelligence","Artificial Intelligence (AI)","2026-08-24T02:46:38+00:00",{"slug":40,"category":5,"name":41,"updated_at":30},"attention","Attention",{"slug":43,"category":5,"name":44,"updated_at":38},"beam-search","Beam Search",{"slug":46,"category":5,"name":47,"updated_at":34},"benchmark-contamination","Benchmark Contamination",{"slug":49,"category":5,"name":50,"updated_at":34},"catastrophic-forgetting","Catastrophic Forgetting",{"slug":52,"category":5,"name":53,"updated_at":38},"computer-vision","Computer Vision",{"slug":55,"category":5,"name":56,"updated_at":34},"constitutional-ai","Constitutional AI",{"slug":58,"category":5,"name":59,"updated_at":30},"context-window","Context Window",{"slug":61,"category":5,"name":62,"updated_at":38},"deep-learning","Deep Learning",{"slug":64,"category":5,"name":65,"updated_at":30},"diffusion-model","Diffusion Model"]