slm-bench / README.md
PY-AI-Dev's picture
Upload README.md with huggingface_hub
fccdfd0 verified
|
Raw
History Blame Contribute Delete
4.35 kB
metadata
annotations_creators:
  - machine-generated
language:
  - en
license:
  - apache-2.0
multilinguality:
  - monolingual
pretty_name: SLM-Bench
size_categories:
  - 1K<n<10K
source_datasets:
  - original
task_categories:
  - question-answering
  - text-generation
task_ids:
  - multiple-choice-qa
  - language-modeling

SLM-Bench: A Benchmark for Sub-10M Language Models

SLM-Bench is a comprehensive, fully programmatic benchmark designed specifically for evaluating sub-10M parameter language models. It covers six core capability areas with 500 questions each (3,000 total), providing granular insights into model strengths and weaknesses.

Dataset Summary

Category Questions Description
arithmetic 500 Math problems with plausible distractors (off-by-one, sign errors)
pattern 500 Sequence completion (arithmetic, geometric, fibonacci, cubic progressions)
grammar 500 Grammatical correctness MCQs (tense, articles, prepositions, pronouns)
vocabulary 500 WordNet-based questions (antonyms, synonyms, definitions, categories)
logic 500 Syllogism and logical reasoning (valid/invalid inference detection)
word_analogy 500 Word relationship analogies (antonym, hypernym, part-to-whole, function)

Data Splits

Each category is split into:

  • train: 200 examples (for few-shot prompting)
  • validation: 150 examples (primary evaluation)
  • test: 150 examples (hold-out evaluation)

Total: 3,000 questions across all categories.

Data Format

Each example follows a consistent multiple-choice schema:

{
  "id": "arithmetic_0001",
  "question": "What is 47 + 23?",
  "choices": ["70", "69", "71", "68"],
  "answer": 0,
  "category": "arithmetic",
  "difficulty": "easy"
}

Usage with lm-evaluation-harness

SLM-Bench is registered as a task suite in lm-evaluation-harness:

# Full benchmark
lm_eval --model hf \
  --model_args pretrained=liodon-ai/slm-10m,trust_remote_code=True \
  --tasks slm_bench \
  --device cuda:0 --batch_size 64

# Single category
lm_eval --model hf \
  --model_args pretrained=liodon-ai/slm-10m,trust_remote_code=True \
  --tasks slm_bench_arithmetic \
  --device cuda:0

# All subtasks individually
lm_eval --model hf \
  --model_args pretrained=liodon-ai/slm-10m,trust_remote_code=True \
  --tasks slm_bench_tasks \
  --device cuda:0

Usage with HuggingFace Datasets

from datasets import load_dataset

# Load a specific category
ds = load_dataset("liodon-ai/slm-bench", "arithmetic")
print(ds["test"][0])
# {'id': 'arithmetic_0164', 'question': 'What is (43 + 5) * 5 - 1?', 
#  'choices': ['239', '240', '932', '229'], 'answer': 0, ...}

# Load all categories
for category in ["arithmetic", "pattern", "grammar", "vocabulary", "logic", "word_analogy"]:
    ds = load_dataset("liodon-ai/slm-bench", category)
    print(f"{category}: {len(ds['test'])} test examples")

Generation

The dataset is fully programmatically generated — no manual annotation. The generation scripts are open-source at github.com/Liodon-AI/slm-bench.

To regenerate:

pip install nltk numpy datasets huggingface_hub
python assemble.py --n_per_category 500 --seed 42

Why SLM-Bench?

Existing benchmarks (ARC, HellaSwag, MMLU) are designed for models with billions of parameters. SLM-Bench fills the gap by providing:

  1. Appropriate difficulty — calibrated for sub-10M models
  2. Diverse capabilities — arithmetic, language, logic, patterns
  3. Plausible distractors — wrong answers that test real understanding, not just pattern matching
  4. Fully reproducible — deterministic generation with fixed seed
  5. Zero manual effort — entirely algorithmic, no human annotation bias

Citation

@dataset{slm_bench_2024,
  author = {Liodon AI},
  title = {SLM-Bench: A Benchmark for Sub-10M Language Models},
  year = {2024},
  url = {https://huggingface.co/datasets/liodon-ai/slm-bench},
  publisher = {Hugging Face}
}

License

Apache-2.0

Contact