ni-co-la-s/gemmeh

Model

Gemmeh

0

5 commits

2 linked in READMEs

updated Jun 1, 2026

See the code

README

Gemmeh

Gemmeh is a 1.1B-parameter decoder-only transformer trained for educational purposes from scratch on 20B tokens of pre-2024 FineWeb-Edu.

Architecture is Gemma 3-inspired without sliding-window attention. Custom 32k SentencePiece BPE tokenizer trained on the same corpus.

This repository contains:

  • config.json
  • modeling_gemmeh.py
  • model.safetensors
  • tokenizer.model

For GGUF quantizations, see ni-co-la-s/gemmeh-GGUF.

For the instruction-tuned model, see ni-co-la-s/gemmeh-it-GGUF.

Usage

This model uses custom modeling code, so trust_remote_code=True is required.

from transformers import AutoModelForCausalLM
from sentencepiece import SentencePieceProcessor
from huggingface_hub import hf_hub_download
import torch

# Load model
model = AutoModelForCausalLM.from_pretrained(
    "ni-co-la-s/gemmeh",
    trust_remote_code=True,
    torch_dtype="bfloat16",
    token=True,
)
model.eval()
print("Model loaded")

# Load tokenizer
sp_path = hf_hub_download(
    repo_id="ni-co-la-s/gemmeh",
    filename="tokenizer.model",
    token=True,
)
sp = SentencePieceProcessor()
sp.Load(sp_path)
print("Tokenizer loaded")

# Test generation
def generate(prompt, max_new_tokens=40, temperature=0.0):
    ids = sp.Encode(prompt, out_type=int)
    input_ids = torch.tensor([ids], dtype=torch.long)
    with torch.no_grad():
        for _ in range(max_new_tokens):
            out = model(input_ids)
            next_logits = out.logits[0, -1, :]
            if temperature == 0:
                next_id = next_logits.argmax().item()
            else:
                probs = torch.softmax(next_logits / temperature, dim=-1)
                next_id = torch.multinomial(probs, 1).item()
            if next_id == sp.eos_id():
                break
            input_ids = torch.cat([input_ids, torch.tensor([[next_id]])], dim=1)
    return sp.Decode(input_ids[0][len(ids):].tolist())

print(generate("The capital of France is", max_new_tokens=40, temperature=0.0))

Training details

Parameters1.1B
ArchitectureGemma 3-inspired
Vocab32,768 (SentencePiece BPE, English-only)
Context4,096
Pretraining dataFineWeb-Edu sample, 20B tokens
Knowledge cutoffPre-2024 (intentional)

Benchmarks (base 1B model, 20B tokens)

Evaluated through the BF16 GGUF served via llama.cpp with lm-eval. Other results are sourced from SmolLM2 and Gemma3 technical reports.

BenchmarkMetricGemmeh 1BGemma 3 1B PTSmolLM2-1.7BLlama-1BQwen2.5-1.5BSmolLM1-1.7B
PIQA0-shot70.273.877.674.876.176.0
ARC-Challenge25-shot38.438.4β€”β€”β€”β€”
ARC-Easy0-shot57.373.0β€”β€”β€”β€”
WinoGrande5-shot52.258.259.457.859.354.7

Trained on roughly 10–100Γ— less data than the references, with a much smaller (32k vs 262k) vocabulary, and no distillation.

Limitations

  • Smaller and less benchmark-competitive than similarly-sized models trained on more data.
  • English only.
  • 4,096 token context.
  • Pre-2024 knowledge only.
custom_code
gemmeh
safetensors

ni-co-la-s/gemmeh

Model

Gemmeh

0

5 commits

2 linked in READMEs

updated Jun 1, 2026

See the code

README

Gemmeh

Gemmeh is a 1.1B-parameter decoder-only transformer trained for educational purposes from scratch on 20B tokens of pre-2024 FineWeb-Edu.

Architecture is Gemma 3-inspired without sliding-window attention. Custom 32k SentencePiece BPE tokenizer trained on the same corpus.

This repository contains:

  • config.json
  • modeling_gemmeh.py
  • model.safetensors
  • tokenizer.model

For GGUF quantizations, see ni-co-la-s/gemmeh-GGUF.

For the instruction-tuned model, see ni-co-la-s/gemmeh-it-GGUF.

Usage

This model uses custom modeling code, so trust_remote_code=True is required.

from transformers import AutoModelForCausalLM
from sentencepiece import SentencePieceProcessor
from huggingface_hub import hf_hub_download
import torch

# Load model
model = AutoModelForCausalLM.from_pretrained(
    "ni-co-la-s/gemmeh",
    trust_remote_code=True,
    torch_dtype="bfloat16",
    token=True,
)
model.eval()
print("Model loaded")

# Load tokenizer
sp_path = hf_hub_download(
    repo_id="ni-co-la-s/gemmeh",
    filename="tokenizer.model",
    token=True,
)
sp = SentencePieceProcessor()
sp.Load(sp_path)
print("Tokenizer loaded")

# Test generation
def generate(prompt, max_new_tokens=40, temperature=0.0):
    ids = sp.Encode(prompt, out_type=int)
    input_ids = torch.tensor([ids], dtype=torch.long)
    with torch.no_grad():
        for _ in range(max_new_tokens):
            out = model(input_ids)
            next_logits = out.logits[0, -1, :]
            if temperature == 0:
                next_id = next_logits.argmax().item()
            else:
                probs = torch.softmax(next_logits / temperature, dim=-1)
                next_id = torch.multinomial(probs, 1).item()
            if next_id == sp.eos_id():
                break
            input_ids = torch.cat([input_ids, torch.tensor([[next_id]])], dim=1)
    return sp.Decode(input_ids[0][len(ids):].tolist())

print(generate("The capital of France is", max_new_tokens=40, temperature=0.0))

Training details

Parameters1.1B
ArchitectureGemma 3-inspired
Vocab32,768 (SentencePiece BPE, English-only)
Context4,096
Pretraining dataFineWeb-Edu sample, 20B tokens
Knowledge cutoffPre-2024 (intentional)

Benchmarks (base 1B model, 20B tokens)

Evaluated through the BF16 GGUF served via llama.cpp with lm-eval. Other results are sourced from SmolLM2 and Gemma3 technical reports.

BenchmarkMetricGemmeh 1BGemma 3 1B PTSmolLM2-1.7BLlama-1BQwen2.5-1.5BSmolLM1-1.7B
PIQA0-shot70.273.877.674.876.176.0
ARC-Challenge25-shot38.438.4β€”β€”β€”β€”
ARC-Easy0-shot57.373.0β€”β€”β€”β€”
WinoGrande5-shot52.258.259.457.859.354.7

Trained on roughly 10–100Γ— less data than the references, with a much smaller (32k vs 262k) vocabulary, and no distillation.

Limitations

  • Smaller and less benchmark-competitive than similarly-sized models trained on more data.
  • English only.
  • 4,096 token context.
  • Pre-2024 knowledge only.
custom_code
gemmeh
safetensors