Introducing commit-messages-from-diffs v1.0 — 110 expert-crafted git diff → commit message pairs
What is this dataset?
commit-messages-from-diffs is a synthetic benchmark dataset that pairs realistic git unified diffs with high-quality Conventional Commits messages.
It was created to address a gap in the HF ecosystem: most commit message datasets are scraped from GitHub with noisy, inconsistent message quality. This dataset prioritizes quality over quantity — every record was hand-authored to reflect realistic engineering patterns.
Stats at a glance
| Dimension | Values |
|---|---|
| Total examples | 110 (88 train / 11 val / 11 test) |
| Languages | Python, TypeScript, JavaScript, Go, Java, Rust |
| Commit types | feat, fix, refactor, chore, test, perf, docs |
| Difficulty levels | simple, medium, complex |
| Breaking changes | 3 examples with ! annotation |
| Format | Parquet (native HF browsing) + JSONL |
| License | Apache 2.0 |
Example record
diff --git a/auth/jwt.py b/auth/jwt.py
--- a/auth/jwt.py
+++ b/auth/jwt.py
@@ -18,7 +18,10 @@ def verify_token(token: str) -> dict:
try:
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
- return payload
+ if payload.get("exp") is None:
+ raise ValueError("Token missing expiration claim")
+ return payload
except jwt.ExpiredSignatureError:
raise HTTPException(status_code=401, detail="Token expired")
→ Commit: fix(auth): reject tokens missing exp claim and surface decode errors
Intended use
- Fine-tuning LLMs to generate structured commit messages from diffs
- Benchmarking code-to-text generation
- Prompt engineering evaluation
- Combined with real-world datasets for hybrid training
Roadmap
v1.1 will expand to 300+ examples, adding revert and ci types plus more complex multi-file scenarios. Feedback welcome!
Published by SalutefaceAAC
Follow-up: fine-tuning quickstart + augmentation notes
Since a few people have asked in DMs how to actually use this dataset for training, here's a minimal quickstart and some notes on the augmentation methodology.
Loading the dataset
from datasets import load_dataset
ds = load_dataset("SalutefaceAAC/commit-messages-from-diffs")
# Splits: train (77), validation (17), test (16)
# Each row has:
# - diff: the raw git diff text
# - message: the target commit message
# - language: python | javascript | go | rust | java | typescript
# - commit_type: feat | fix | refactor | docs | test | chore | perf
# - complexity: low | medium | high
print(ds["train"][0])
Fine-tuning with transformers (minimal)
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, Seq2SeqTrainer, Seq2SeqTrainingArguments
from datasets import load_dataset
model_name = "Salesforce/codet5-base-codexglue-sum-python" # good starting point
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
ds = load_dataset("SalutefaceAAC/commit-messages-from-diffs")
def preprocess(batch):
inputs = tokenizer(batch["diff"], max_length=512, truncation=True, padding="max_length")
labels = tokenizer(batch["message"], max_length=64, truncation=True, padding="max_length")
inputs["labels"] = labels["input_ids"]
return inputs
tokenized = ds.map(preprocess, batched=True)
args = Seq2SeqTrainingArguments(
output_dir="./commit-msg-model",
num_train_epochs=10,
per_device_train_batch_size=8,
predict_with_generate=True,
logging_steps=10,
)
trainer = Seq2SeqTrainer(model=model, args=args, train_dataset=tokenized["train"], eval_dataset=tokenized["validation"])
trainer.train()
For decoder-only models (LLaMA, Mistral), format each example as:
### Diff:
{diff}
### Commit message:
{message}
How the augmented examples were generated
The 110 examples split into two layers:
- 70 hand-crafted (base): Written manually, one per commit type × language combination, reviewed for realism (no toy examples, no trivially short diffs).
- 40 augmented: Generated by parametric templates — taking a base example, varying the scope (single-file vs multi-file), the change type (add/remove/refactor), and injecting language-specific idioms. Each augmented example was inspected and edited for message quality before inclusion.
What we deliberately avoided: LLM-generated commit messages (circular for a benchmark), synthetic diffs that wouldn't appear in real repos, and examples where the message just restates the diff without interpretation.
Known gaps and v2 plans
- JavaScript/TypeScript coverage is lighter than Python/Go/Rust — contributions welcome
- No coverage of monorepo-style commits with multiple concerns in one diff
- We're planning v2 with 300+ examples, broader coverage of merge commits and dependency bumps, and BLEU/ROUGE baselines from common models
If you use this dataset in a project or paper, a link back is appreciated. Happy to answer questions about the methodology.