Datasets:
nero commited on
Upload folder using huggingface_hub
Browse filesFiles changed (5)
- .gitattributes+1
- README.mdAdded+112
- __pycache__/scorer.cpython-314.pycAdded
- scorer.pyAdded+124
- test.jsonlAdded+3
57 unmodified lines58596057 unmodified lines# Video files - compressed*.mp4 filter=lfs diff=lfs merge=lfs -text*.webm filter=lfs diff=lfs merge=lfs -text57 unmodified lines5859606157 unmodified lines# Video files - compressed*.mp4 filter=lfs diff=lfs merge=lfs -text*.webm filter=lfs diff=lfs merge=lfs -texttest.jsonl filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112---license: cc-by-4.0pretty_name: TitleBenchtask_categories:- text-generation- summarizationlanguage:- entags:- benchmark- chat-title- title-generation- small-language-modelssize_categories:- 10K<n<100K---
# TitleBench
**A benchmark for small chat-title generation models.**
TitleBench evaluates a model's ability to turn a chat conversation into a short,human-quality title. It is a deterministic, reproducible test split built fromthe [j0no12/chat-titles-unified](https://huggingface.co/datasets/j0no12/chat-titles-unified)pipeline, and includes reference leaderboard results for several mini titlemodels (all under 360M parameters).
## Benchmark content
`test.jsonl` — **21,448 examples**, one JSON object per line:
| Field | Present for | Description ||-------|-------------|-------------|| `input` | public-source rows | The chat conversation text to be titled || `target` | all rows | The reference title || `source` | all rows | Origin: `spitfire`, `michionlion`, or `bananamind-lmsys` || `lmsys_row_id` | `bananamind-lmsys` rows | Row index in `lmsys/lmsys-chat-1m` — reconstruct the input from the gated dataset || `conversation_id` | `bananamind-lmsys` rows | LMSYS conversation identifier |
**Gating note:** 8,124 rows are derived from the gated[`lmsys/lmsys-chat-1m`](https://huggingface.co/datasets/lmsys/lmsys-chat-1m).Following the pattern of[BananaMind/BananaMind-Chat-Title-200K](https://huggingface.co/datasets/BananaMind/BananaMind-Chat-Title-200K),those rows ship **ID-only**: the input is not redistributed, but can bereconstructed locally by anyone with LMSYS access:
```pythonfrom datasets import load_datasetlmsys = load_dataset("lmsys/lmsys-chat-1m", split="train")row_id = 52136 # example lmsys_row_id from the benchmarkfirst_user_message = lmsys[row_id]["conversation"][0]["content"]```
(Because the merged corpus is shuffled, `lmsys_row_id` is the stable,primary reconstruction key; `conversation_id` is also provided forcross-checking. The remaining 13,324 rows are from the public`spitfire4794/chat-titles-245k` and `Michionlion/chat-titles-english`datasets and ship with full text.)
## Evaluation protocol (reproducible)
1. Sample a deterministic subset if you want a quick pass: `random.Random(42).shuffle(rows); subset = rows[:N]`2. For each conversation, generate a title (any decoding — greedy or temperature sampling; note the decoding in your report).3. Score against `target` with the metrics below.4. Report **all** metrics — never cherry-pick.
### Metrics
| Metric | Definition ||--------|-----------|| **ROUGE-1/2/L F1** | Unigram / bigram / LCS token overlap F1 (standard ROUGE) || **BLEU-4** | Smooth n-gram precision with brevity penalty || **chrF** | Character 6-gram F1 (robust to word-boundary noise) || **Exact Match (EM)** | Fraction of outputs matching the target after lowercasing + stripping punctuation || **Repetition %** | Fraction of generated tokens that repeat an earlier token (degeneracy probe) |
A self-contained scorer (no external metric libraries) is in[`scorer.py`](scorer.py) in this repo:
```bashpython scorer.py predictions.jsonl # predictions: [{"output": "..."}] aligned to test.jsonl order```
## Reference leaderboard
Every model evaluated on **all 21,448** examples (seed-42 order preserved);generation: temperature 0.8, top-k 50, repetition penalty 1.2, max 32 tokens(our model) / greedy with the model's documented prompt (competitors).
| Rank | Model | Params | ROUGE-1 | ROUGE-2 | ROUGE-L | BLEU-4 | chrF | EM% | Repet% ||------|-------|-------:|--------:|--------:|--------:|-------:|-----:|----:|-------:|| 1 | [SupraLabs/supra-title-50m-pre](https://huggingface.co/SupraLabs/supra-title-50m-pre) | 50M | **0.328** | **0.149** | **0.304** | **0.148** | **0.232** | 3.4 | 2.4 || 2 | [j0no12/NeroT-29M](https://huggingface.co/j0no12/NeroT-29M) (this project) | 29M | 0.296 | 0.141 | 0.289 | 0.145 | 0.201 | **8.9** | 2.7 || 3 | [SupraLabs/Supra-50M-Instruct](https://huggingface.co/SupraLabs/Supra-50M-Instruct) (general chat) | 50M | 0.057 | 0.022 | 0.071 | 0.054 | 0.042 | 0.8 | 32.6 |
*BananaMind/BananaMind-Title-1.0* (354M) and *BananaMind-2-Nano-Chat* evaluationin progress on this split — full leaderboard updates will be posted here whenthey complete.
Key finding: **task-specialized mini models dramatically outperform generalchat models at title generation** (Supra-50M-Instruct scores 5.2× lower onROUGE-1 and 11× lower on EM, and degenerates into 32.6% repetition).
## Datasets referenced
- `spitfire4794/chat-titles-245k` (itself a merge of `SupraLabs/supra-wild-titles-130k` [ODC-BY] and `SupraLabs/chat-titles-filtered-115K` [CC-BY-4.0])- `Michionlion/chat-titles-english`- `BananaMind/BananaMind-Chat-Title-200K` (titles generated by gemma-4-26b via OpenRouter, from gated `lmsys/lmsys-chat-1m` conversations)
All source datasets are credited; the benchmark itself is **CC-BY-4.0**.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124#!/usr/bin/env python3"""TitleBench scorer — self-contained, no external metric libraries.
Usage: python scorer.py predictions.jsonl predictions.jsonl: one JSON object per line, in the SAME ORDER as test.jsonl, each with an "output" field: {"output": "My Generated Title"}
Prints the full metric table (ROUGE-1/2/L F1, BLEU-4, chrF, EM%, Repet%)."""import jsonimport mathimport reimport sysfrom collections import Counter
_PUNC = re.compile(r"[^a-z0-9\s]")
def normalize(text: str) -> str: return " ".join(_PUNC.sub(" ", text.lower()).split())
def tokens(text: str): return normalize(text).split()
def _ngrams(toks, n): return Counter(zip(*[toks[i:] for i in range(n)]) if len(toks) >= n else [])
def rouge_n_f1(g, r, n): g, r = _ngrams(g, n), _ngrams(r, n) if not g or not r: return 0.0 inter = sum((g & r).values()) prec = inter / max(1, sum(g.values())) rec = inter / max(1, sum(r.values())) return 0.0 if prec + rec == 0 else 2 * prec * rec / (prec + rec)
def rouge_l_f1(g, r): m, n = len(g), len(r) if m == 0 or n == 0: return 0.0 dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(1, n + 1): dp[i][j] = dp[i - 1][j - 1] + 1 if g[i - 1] == r[j - 1] else max(dp[i - 1][j], dp[i][j - 1]) lcs = dp[m][n] prec, rec = lcs / m, lcs / n return 0.0 if prec + rec == 0 else 2 * prec * rec / (prec + rec)
def bleu4(g, r): gl, rl = len(g), len(r) if gl == 0: return 0.0 scores = [] for n in range(1, 5): g_, r_ = _ngrams(g, n), _ngrams(r, n) inter = sum((g_ & r_).values()) total = sum(g_.values()) scores.append(inter / total if inter > 0 and total > 0 else (inter + 1) / (total + 1)) geo = math.exp(sum(math.log(max(s, 1e-9)) for s in scores) / 4) return geo * min(1.0, math.exp(1 - rl / max(gl, 1)))
def chrf(gen, ref): t = lambda s: [normalize(s).replace(" ", "")[i:i + 6] for i in range(len(normalize(s).replace(" ", "")) - 5)] g, r = Counter(t(gen)), Counter(t(ref)) if not g or not r: return 0.0 inter = sum((g & r).values()) prec, rec = inter / max(1, sum(g.values())), inter / max(1, sum(r.values())) return 0.0 if prec + rec == 0 else 2 * prec * rec / (prec + rec)
def repetition_rate(g): if len(g) <= 1: return 0.0 seen, reps = set(), 0 for t in g: if t in seen: reps += 1 seen.add(t) return reps / len(g)
def main(): if len(sys.argv) < 2: print(__doc__) sys.exit(1) with open(sys.argv[1]) as f: preds = [json.loads(l) for l in f if l.strip()] print(f"scoring {len(preds):,} predictions")
acc = {k: 0.0 for k in ["rouge1", "rouge2", "rougeL", "bleu4", "chrf", "em", "repet"]} for p in preds: g = tokens(p["output"]) r = tokens(p["target"]) acc["rouge1"] += rouge_n_f1(g, r, 1) acc["rouge2"] += rouge_n_f1(g, r, 2) acc["rougeL"] += rouge_l_f1(g, r) acc["bleu4"] += bleu4(g, r) acc["chrf"] += chrf(p["output"], p["target"]) acc["em"] += 1.0 if normalize(p["output"]) == normalize(p["target"]) else 0.0 acc["repet"] += repetition_rate(g) n = len(preds) print(f"\n{'metric':<10}{'value':>10}") print("-" * 22) print(f"{'ROUGE-1':<10}{acc['rouge1']/n:>10.3f}") print(f"{'ROUGE-2':<10}{acc['rouge2']/n:>10.3f}") print(f"{'ROUGE-L':<10}{acc['rougeL']/n:>10.3f}") print(f"{'BLEU-4':<10}{acc['bleu4']/n:>10.3f}") print(f"{'chrF':<10}{acc['chrf']/n:>10.3f}") print(f"{'EM%':<10}{100*acc['em']/n:>10.2f}") print(f"{'Repet%':<10}{100*acc['repet']/n:>10.2f}")
if __name__ == "__main__": main()123version https://git-lfs.github.com/spec/v1oid sha256:c8f37cbf62136661ab9168b20673f8ccb53a64b4e33a4fee64f0c1c865613e9csize 13807288.gitattributes+1
README.mdAdded+112
__pycache__/scorer.cpython-314.pycAdded
scorer.pyAdded+124
test.jsonlAdded+3