Run this model with HF Jobs

Run LRZ-ai/Llama-GENBA-10B-it on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/LRZ-ai/Llama-GENBA-10B-it. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/LRZ-ai/Llama-GENBA-10B-it on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/LRZ-ai/Llama-GENBA-10B-it. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/LRZ-ai/Llama-GENBA-10B-it. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Llama-GENBA-10B-IT

Llama-GENBA-10B-IT is the instruction-tuned release of Llama-GENBA-10B-base, a decoder-only language model focused on German, Bavarian, and English. It was developed to improve support for German and, in particular, Bavarian—a low-resource language variety that is weakly represented in most large language models.

The model inherits multilingual pretraining from Llama-GENBA-10B-base and was then supervised-fine-tuned on German, Bavarian, and English instruction–response data. The associated paper is Llama-GENBA-10B: A Trilingual Large Language Model for German, English and Bavarian.

Model details

Property Value
Model type Decoder-only causal language model
Size Approximately 10 billion parameters
Transformer layers 40
Hidden size 4,096
Feed-forward size 14,336
Attention heads 32
Key-value heads 8
Vocabulary size 153,853
Tied input/output embeddings No
Positional encoding Rotary position embeddings (RoPE), Llama-3 scaling recipe
RoPE theta 500,000
RoPE scaling Factor 8; low/high-frequency factors 1/4; original maximum 8,192
Supported context 8,192 tokens, combined input and generated output
Languages German, Bavarian, English
Post-training Supervised fine-tuning (SFT)

We started from Llama 3.1-8B and added eight Transformer blocks, resulting in the 40-layer GENBA architecture.

Context-length policy

The configured and supported context length is 8,192 tokens total. Prompt tokens and newly generated tokens share this budget. It is not 8,192 input tokens plus unlimited output.

Although the configuration contains a Llama-3 RoPE scaling factor of 8, that factor is part of the frequency recipe; it does not mean that the model supports 65,536 or 131,072 tokens. Training and SFT preprocessing used sequences of at most 8,192 tokens. We did not evaluate longer contexts.

Development and training

Architecture and tokenizer development

Before continued pretraining, we expanded the Llama 3.1-8B architecture by eight blocks. We initialized the inserted blocks' attention-output and final feed-forward projections to zero and froze the original backbone during this stage.

We expanded the Llama tokenizer for German and Bavarian. We compared 10%, 20%, and 30% vocabulary expansions using tokenizer fertility and selected the 20% option as the best trade-off between reduced fragmentation and compute cost. The resulting tokenizer has a vocabulary of 153,853 tokens.

Pretraining

We trained on an approximately 164-billion-token multilingual corpus:

Language Training corpus budget
English approximately 82 billion tokens
German approximately 82 billion tokens
Bavarian approximately 80 million tokens after upsampling

We trained the model in three phases:

  1. The main phase sampled German and English at 50% each.
  2. Bavarian continued pretraining branched from checkpoint 37,500.
  3. The final phase sampled approximately 45% German, 45% English, and 10% Bavarian and completed at checkpoint 41,707.

The token budgets above describe the training mixture. They are not counts of unique examples and do not imply that every available token was used exactly once.

Pretraining data sources

The training tables list published terms for the source datasets. The model release terms are in the License section.

Language Dataset Source license or terms
English Knowledge Pile Apache-2.0 for the authors' release
English Cosmopedia Apache-2.0
English UltraTextbooks-2.0 CC BY-SA 4.0
English Proof-Pile-2 Licenses of the underlying datasets
German occiglot-fineweb-v1.0 Individual licenses apply to datasets from LLM-Datasets, excluding OSCAR. Community-OSCAR uses CC0 1.0 for its packaging, metadata, and annotations. Its crawled text is subject to the Common Crawl Terms of Use.
Bavarian Boarische Wikipedia via Wortschatz Leipzig CC BY-SA 4.0 for Wikipedia text under the Wikimedia terms. Leipzig lists CC BY-NC 4.0 as its usual corpus license.
Bavarian OPUS WikiMatrix CC BY-SA 4.0
Bavarian OPUS XLEnt Source-specific terms for CCAligned, CCMatrix, and WikiMatrix. OPUS corpus catalog
Bavarian OPUS Wikimedia OPUS lists CC BY-SA 4.0 for release v20260327. The training snapshot is unspecified.
Bavarian OPUS Tatoeba Tatoeba lists CC BY 2.0 FR as its default text license and CC0 1.0 for designated sentences. Tatoeba download terms
Bavarian FineWeb (Bavarian extract) ODC-By 1.0 and Common Crawl's Terms of Use for the upstream dataset

The Bavarian sources included approximately 262,000 lines extracted from FineWeb using GlotLID-m. We collected approximately 20 million Bavarian tokens and upsampled them to approximately 80 million tokens for training. We did not attempt to separate individual Bavarian dialect regions.

Supervised instruction tuning

The Llama-GENBA-10B post-training collection contains approximately 867,000 instruction–response pairs built from the sources below.

Source Approximate pairs per language Approximate total Source dataset license or terms
Databricks Dolly 15k 15,000 45,000 CC BY-SA 3.0
Alpaca 61,000 183,000 Stanford Alpaca lists CC BY-NC 4.0 for the original dataset. Alpaca-Cleaned lists CC BY 4.0 in its metadata and CC BY-NC 4.0 in its licensing section.
OpenHermes 213,000 639,000 See the terms of the component datasets listed on the dataset card.
Total 289,000 867,000

The Alpaca and OpenHermes links follow the dataset citations in the model paper.

We used Gemini Flash for translation-based augmentation into German and Bavarian. During supervised fine-tuning, we sampled 40% German, 40% Bavarian, and 20% English examples.

For instruction tuning, we converted each record into one user prompt and one assistant completion. We did not use general multi-turn training, RLHF, DPO, or another preference-optimization phase.

We release checkpoint 740, saved after the second epoch of supervised fine-tuning.

Evaluation

We evaluated the Llama-GENBA model family with the EleutherAI evaluation harness and English, German, and Bavarian benchmark variants. The protocol covers ARC-Challenge, HellaSwag, MMLU, TruthfulQA, and WinoGrande; our trilingual-suite summary highlights ARC, HellaSwag, MMLU, and TruthfulQA.

Checkpoint 740 improved substantially over the base model. Its English and German results fell in the middle of the instruction-tuned models in our comparison. It scored 0.53992 in English, compared with 0.52707 for EuroLLM-9B-Instruct, and 0.44353 in German, compared with 0.44635 for EuroLLM-9B-Instruct. Its Bavarian mean accuracy was 0.40418, compared with 0.38094 for Gemma-2-9B-it and 0.38004 for Apertus-8B-Instruct-2509.

The checkpoint-740 mean accuracies, rounded to five decimal places, are:

Task group Mean accuracy
All tasks 0.46598
English 0.53992
German 0.44353
Bavarian 0.40418

We calculate these values as unweighted means of the task-level accuracy rows: six English, six German, and five Bavarian results.

These comparisons apply only to this evaluation set. They do not show that the model is universally best for Bavarian.

How to use

This release uses a custom tokenizer implementation. Review the repository's tokenization_genba.py before enabling trust_remote_code=True.

The model is large enough to require substantial accelerator or host memory. Choose an appropriate dtype, device mapping, sharding, or offloading strategy for your hardware.

The example below uses deterministic decoding, the installed chat template, explicit attention masks, left padding, and only decodes newly generated tokens. Set model_id to the Hugging Face repository ID or a local model directory.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "path/to/Llama-GENBA-10B-IT"

tokenizer = AutoTokenizer.from_pretrained(
    model_id,
    use_fast=True,
    trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
model.eval()


def generate_reply(prompt: str, max_new_tokens: int = 128) -> str:
    messages = [{"role": "user", "content": prompt}]

    # Render first, then tokenize without adding another BOS or special prefix.
    rendered = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True,
    )
    inputs = tokenizer(
        rendered,
        add_special_tokens=False,
        return_tensors="pt",
        return_attention_mask=True,
    )
    inputs = {name: tensor.to(model.device) for name, tensor in inputs.items()}

    prompt_length = inputs["input_ids"].shape[1]
    if prompt_length + max_new_tokens > 8192:
        raise ValueError("Prompt and generated output must fit within 8192 tokens")

    with torch.inference_mode():
        output_ids = model.generate(
            **inputs,
            max_new_tokens=max_new_tokens,
            do_sample=False,
            eos_token_id=[128001, 128009],
            pad_token_id=128009,
        )

    new_token_ids = output_ids[0, prompt_length:]
    return tokenizer.decode(
        new_token_ids,
        skip_special_tokens=True,
        clean_up_tokenization_spaces=False,
    )


# German example
print(generate_reply(
    "Erkläre in drei kurzen Sätzen, warum München die Hauptstadt Bayerns ist."
))

# Bavarian example
print(generate_reply(
    "Servus! Erzähl ma kurz auf Bairisch, was a Biergarten is."
))

The tokenizer uses:

pad_token     = <|eot_id|>
pad_token_id  = 128009
padding_side  = left

We tested full-model inference with Transformers 5.20.2. We also tested tokenizer loading, Unicode decoding, chat-template rendering, and isolated save/reload with Transformers 4.48.3 and 4.57.6. We did not run full-model inference with those two versions.

Chat template

Use tokenizer.apply_chat_template() rather than assembling headers manually. Pass messages as dictionaries with system, user, or assistant roles and set add_generation_prompt=True when requesting a new assistant response. The template inserts the beginning-of-sequence token, role headers, and end-of-turn tokens automatically. When rendering with tokenize=False, tokenize the rendered text with add_special_tokens=False to avoid adding a second beginning-of-sequence token. The complete pattern is shown in the usage example above.

Special tokens and stopping

Purpose Token ID
Beginning of sequence <|begin_of_text|> 128000
Document end <|end_of_text|> 128001
Chat end of turn <|eot_id|> 128009
Inference padding <|eot_id|> 128009
Generation stops — 128001, 128009

The template emits <|eot_id|> after messages. The generation configuration stops on either document-end or end-of-turn. Padding also uses ID 128009 but is masked by the attention mask; padding, document-end, and turn-end should not be treated as interchangeable concepts when constructing prompts.

Custom tokenizer and Unicode handling

Llama-GENBA-10B's extended vocabulary provides better coverage of German and Bavarian, including text with umlauts and ß. In the initial tokenizer export, 1,138 extended tokens could produce the replacement character U+FFFD (�) during decoding.

This release includes GenbaTokenizerFast, which decodes those extended tokens correctly while retaining all 153,853 token IDs and the model's original input tokenization. For example:

encode(" Ministerpräsident") = [9675, 130375, 82, 1748]
decode([9675, 130375, 82, 1748]) = " Ministerpräsident"

Across 300,294 comparison strings, the corrected tokenizer produced the same token IDs, offsets, and token pieces as the original tokenizer. We also tested all 1,138 affected tokens, full-sequence and incremental decoding, streaming, batched generation, and save/reload behavior.

Load the tokenizer with trust_remote_code=True so that Transformers uses GenbaTokenizerFast. Loading tokenizer.json directly with tokenizers.Tokenizer.from_file() bypasses this decoder and does not include the Unicode correction.

Runtime compatibility

We tested:

  • Hugging Face AutoTokenizer loading with reviewed custom code;
  • Transformers inference under 5.20.2;
  • German and Bavarian Unicode decoding;
  • deterministic and batched generation with attention masks;
  • TextIteratorStreamer output;
  • installed chat-template rendering;
  • tokenizer-level checks under Transformers 4.48.3 and 4.57.6.

We have not tested:

  • general vLLM compatibility;
  • portable GGUF/llama.cpp compatibility with an unmodified runtime;
  • raw Rust tokenizers.Tokenizer.from_file() decoding parity;
  • full-model inference under every tokenizer-compatible Transformers version.

The GGUF files and their runtime-specific tests are documented separately.

Intended uses

Potential uses include:

  • German-language text generation and instruction following;
  • Bavarian-language generation and dialect-focused experimentation;
  • English-language instruction following;
  • research on low-resource and dialect-centered language modeling;
  • multilingual NLP experiments involving German, Bavarian, and English.

Treat the model as a research-oriented generative system, not as an authoritative source. Do not use it for autonomous or high-stakes decisions.

Limitations and responsible use

  • The model can hallucinate, produce incorrect facts, or follow a false premise. Verify important claims against reliable sources.
  • Training data may contain social, cultural, geographic, and demographic biases, and generated text may reproduce them.
  • Bavarian has substantial regional and spelling variation. The training data did not distinguish all dialect regions, and output may mix Bavarian and Standard German or normalize dialectal forms.
  • The model may switch languages unexpectedly.
  • Instruction tuning used single user–assistant examples. We did not test general multi-turn conversation quality.
  • We did not test tool calling, even though the template contains tool-rendering branches.
  • We did not run a broad safety, harmful-content, red-teaming, or human-preference evaluation. Short smoke tests are not safety tests.
  • We did not evaluate translation accuracy, coding ability, advanced reasoning, or specialized medical, legal, or financial reliability.
  • Do not rely on the model for high-stakes medical, legal, financial, safety, or eligibility decisions.
  • Prompt plus generated output must fit within the 8,192-token context budget. Dedicated long-context performance testing was not performed.
  • Transformers 5.20.2 emits a nonfatal warning because the RoPE metadata has original_max_position_embeddings=8192 and max_position_embeddings=8192. We left these values unchanged rather than advertising an unsupported longer context.
  • The custom tokenizer requires executing reviewed repository code.

If a task is not listed in our tests, that does not mean the model cannot do it; it only means that we did not evaluate it here.

Reproducibility notes

We trained the released model in the following stages:

converted initialization checkpoint
  → balanced German/English pretraining
  → checkpoint 37,500
  → Bavarian continued pretraining
  → checkpoint 41,707
  → supervised instruction tuning
  → checkpoint 740 (after the second epoch)
  → Hugging Face export

We trained Llama-GENBA-10B on a Cerebras CS-2 system using Cerebras Model Zoo 2.5.0, Cerebras PyTorch 2.5.0, Transformers 4.45.2, tokenizers 0.20.1, and Python 3.8.8. For the Hugging Face files in this repository, we tested Transformers 5.20.2, tokenizers 0.23.3, and PyTorch 2.14.1.

Citation

If you use Llama-GENBA-10B-IT, cite the primary paper:

@article{hoffmann2025llamagenba10b,
  title         = {Llama-GENBA-10B: A Trilingual Large Language Model for German, English and Bavarian},
  author        = {Hoffmann, Michael and John, Jophin and Schweter, Stefan and Ramakrishnan, Gokul and Mak, Hoi-Fong and Zhang, Alice and Gaynullin, Dmitry and Hammer, Nicolay J.},
  year          = {2025},
  eprint        = {2509.05668},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL},
  url           = {https://arxiv.org/abs/2509.05668}
}

See our paper for the Cerebras CS-2 pretraining setup, full author affiliations, and broader research context.

License

Llama-Genba-10B is a derivative of Meta Llama 3.1 and is released under the following terms:

Built with Llama

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 1 Ask for provider support

Paper for LRZ-ai/Llama-GENBA-10B-it