Compactbot / repetition-diagnostic

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: October 09 2026

Introduction of repetition-diagnostic

Model Details of repetition-diagnostic

Repetition Diagnostic

A builder tool for tiny language model developers. Sweeps repetition_penalty values and measures how they affect generation quality.

Why

Tiny models (<50M params) are extremely prone to degenerate repetition loops. The default repetition_penalty=1.0 means no penalty — the model can output the same token forever. Most training scripts don't test generation quality, so you discover this at inference time with no idea what to do.

This tool gives you a quick diagnostic: sweep the penalty, see where quality peaks, and know what to set in your inference config.

What it measures
Metric Description
Repetition rate Fraction of output tokens that already appeared earlier in the sequence
Unique token ratio Unique tokens / total tokens (diversity)
Max loop length Longest repeated n-gram (how deep the loop goes)
Repeated trigrams Count of 3-token sequences appearing 2+ times
Usage
# Basic: sweep penalties on a single prompt
python3 repetition_diagnostic.py --model gpt2 --prompt "Once upon a time"

# Multiple prompts
python3 repetition_diagnostic.py --model gpt2 --prompts "Once upon a time|The cat sat|I want to"

# Custom penalty range
python3 repetition_diagnostic.py --model gpt2 --penalties "1.0,1.05,1.1,1.2,1.5"

# Save results as JSON
python3 repetition_diagnostic.py --model gpt2 --output results.json
Example output
Model: gpt2
Prompts: ['Once upon a time']
Penalties: [1.0, 1.1, 1.2, 1.5, 2.0]

Prompt                   RP Tokens   Repet  Unique  MaxLoop  RepTri
------------------------------------------------------------------------
Once upon a time        1.0     48   25.5%   72.9%        3       1
Once upon a time        1.1     48    0.0%  100.0%        0       0
Once upon a time        1.2     48    0.0%  100.0%        0       0
Once upon a time        1.5     48    0.0%  100.0%        0       0
Once upon a time        2.0     48    0.0%  100.0%        0       0
Interpretation
  • rp=1.0 with high repetition rate : Your model has a repetition problem. Try rp=1.1 or 1.2.
  • rp=1.1 already fixes it : Good — your model is mostly fine, just needs a small nudge.
  • Even rp=2.0 still shows loops : The model is severely undertrained or has a degenerate mode. No penalty will save it.
  • rp=1.0 shows no repetition : Your model is robust. You can use the default.
Requirements
  • Python 3.8+
  • torch
  • transformers
pip install torch transformers
Notes
  • Uses the same seed for all penalty values so the comparison is fair (same random draws, different penalty).
  • Generation is done manually (not model.generate() ) so the penalty is applied exactly as specified, without HuggingFace's internal logic.
  • Works with any model that AutoModelForCausalLM can load.

Runs of Compactbot repetition-diagnostic on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About repetition-diagnostic huggingface.co Model

repetition-diagnostic huggingface.co

repetition-diagnostic huggingface.co is an AI model on huggingface.co that provides repetition-diagnostic's model effect (), which can be used instantly with this Compactbot repetition-diagnostic model. huggingface.co supports a free trial of the repetition-diagnostic model, and also provides paid use of the repetition-diagnostic. Support call repetition-diagnostic model through api, including Node.js, Python, http.

repetition-diagnostic huggingface.co Url

https://huggingface.co/Compactbot/repetition-diagnostic

Compactbot repetition-diagnostic online free

repetition-diagnostic huggingface.co is an online trial and call api platform, which integrates repetition-diagnostic's modeling effects, including api services, and provides a free online trial of repetition-diagnostic, you can try repetition-diagnostic online for free by clicking the link below.

Compactbot repetition-diagnostic online free url in huggingface.co:

https://huggingface.co/Compactbot/repetition-diagnostic

repetition-diagnostic install

repetition-diagnostic is an open source model from GitHub that offers a free installation service, and any user can find repetition-diagnostic on GitHub to install. At the same time, huggingface.co provides the effect of repetition-diagnostic install, users can directly use repetition-diagnostic installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

repetition-diagnostic install url in huggingface.co:

https://huggingface.co/Compactbot/repetition-diagnostic

Url of repetition-diagnostic

repetition-diagnostic huggingface.co Url

Provider of repetition-diagnostic huggingface.co

Compactbot
ORGANIZATIONS

Other API from Compactbot

huggingface.co

Total runs: 301
Run Growth: 301
Growth Rate: 100.00%
Updated:September 28 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 21 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 28 2026