CoolFace
Modelpublic

sascha-frank-ai-research/tsft-rag-gemma-3-12b-it

sourceHugging Facegemmaupdated 2mo agoView on Hugging Face
1likes111downloads
Model Card

TSFT-RAG Gemma-3-12B-IT

Task-Specific Full Fine-Tuning for Retrieval-Augmented Generation

Part of the TSFT-RAG model family for Retrieval-Augmented Generation across Gemma, Qwen and Llama architectures.

This repository contains TSFT-RAG Gemma-3-12B-IT, a full-parameter fine-tuned derivative of Google's Gemma-3-12B-IT developed within the TSFT-RAG (Task-Specific Full Fine-Tuning for Retrieval-Augmented Generation) research project.

The objective is to investigate how supervised full fine-tuning changes the behaviour of modern language models when used as Retrieval-Augmented Generation (RAG) systems.


TSFT-RAG Model Series

ModelParametersStatus
Gemma-3-1B-IT1BReleased
Gemma-3-4B-IT4BReleased
Gemma-3-12B-IT12BReleased

Abstract

General-purpose instruction models are optimized for broad conversational abilities but not specifically for Retrieval-Augmented Generation.

The TSFT-RAG project investigates whether full supervised fine-tuning can specialize foundation models for:

  • —grounded question answering
  • —unsupported question detection
  • —structured information extraction
  • —citation generation
  • —reliable JSON generation

without changing the underlying transformer architecture.

The 12B model represents the largest Gemma model currently released within the TSFT-RAG project.


Research Background

Reliable Retrieval-Augmented Generation requires considerably more than fluent language generation.

An effective RAG model should

  • —answer only from retrieved evidence,
  • —reject unsupported questions,
  • —preserve factual grounding,
  • —generate machine-readable structured outputs,
  • —remain deterministic across repeated executions.

The TSFT-RAG project evaluates these properties using identical datasets, prompts and evaluation procedures across Gemma, Qwen and Llama model families.


Model Details

PropertyValue
Base modelgoogle/gemma-3-12b-it
Training implementationunsloth/gemma-3-12b-it
ArchitectureGemma3ForConditionalGeneration
Parameters~12 Billion
Hidden Size3840
Transformer Layers48
Attention Heads16
Context Window131,072 tokens
Training Length1,024 tokens
Precisionbfloat16
Fine-tuningFull Parameter

Training Dataset

The TSFT-RAG benchmark contains supervised examples covering

  • —Grounded Question Answering
  • —Unsupported Question Detection
  • —Topic Extraction
  • —Key Message Extraction
  • —Argument Extraction
  • —Structured JSON Generation

The identical benchmark is used for every TSFT-RAG model to enable direct scientific comparison.


Evaluation Results

MetricBaseTSFT-RAGImprovement
Aggregate Score0.4500.686+0.236
Hard Negative QA0.1620.829+0.667
Grounded QA0.6130.594-0.019
Topic Extraction0.6510.632-0.019
Key Message0.6050.580-0.026
Main Arguments0.5890.614+0.025
JSON Validity0.8720.987+0.115
Citation Precision0.0000.950+0.950
Citation Recall0.0000.950+0.950

Discussion

Among the currently released Gemma models, the 12B variant achieves the strongest overall performance.

The most notable improvements are observed for

  • —unsupported-question detection,
  • —structured JSON generation,
  • —citation accuracy,
  • —argument extraction.

Unlike many task-specific fine-tuning approaches, the model preserves strong grounded reasoning while substantially improving rejection behaviour and structured output quality.

These results demonstrate that full-parameter fine-tuning can effectively specialize large language models for Retrieval-Augmented Generation without architectural modifications.


Intended Use

Recommended for

  • —Retrieval-Augmented Generation
  • —Enterprise Knowledge Assistants
  • —Scientific Information Systems
  • —University Information Systems
  • —Document Question Answering
  • —Structured Information Extraction

Not intended as a general-purpose conversational assistant.


Example Usage

python
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained(
    "sascha-frank-ai-research/tsft-rag-gemma-3-12b-it"
)

model = AutoModelForCausalLM.from_pretrained(
    "sascha-frank-ai-research/tsft-rag-gemma-3-12b-it"
)

Reproducibility

Training was performed using

  • —Hugging Face Transformers
  • —TRL
  • —Unsloth

All relevant configuration files, tokenizer files, evaluation summaries and licensing information are included in this repository.


Limitations

  • —Optimized specifically for Retrieval-Augmented Generation.
  • —General open-domain conversation was not the primary optimization objective.
  • —Evaluated primarily on German-language benchmark datasets.
  • —No multimodal benchmark has yet been conducted.

Ethical Considerations

The model should always be used together with appropriate source attribution and human oversight.

It should not replace expert judgement in legal, medical or other safety-critical domains.


License

This repository contains a modified derivative of Google's Gemma model.

Please consult

  • —LICENSE
  • —NOTICE
  • —MODIFICATIONS.md

for detailed licensing information.


Associated Publication

This model was developed and evaluated as part of the following research:

Frank, S., & Singh, R. (2026). Task-Specific Full Fine-Tuning for Retrieval-Augmented Generation: A Multi-Family Evaluation Across Open-Weight Language Models.

Zenodo. DOI: 10.5281/zenodo.21638352

If you use this model in academic work, please cite the publication above.

bibtex
@misc{Frank2026TSFTRAG,
  author       = {Frank, Sascha and Singh, Rawel},
  title        = {Task-Specific Full Fine-Tuning for Retrieval-Augmented Generation:
                  A Multi-Family Evaluation Across Open-Weight Language Models},
  year         = {2026},
  month        = jul,
  version      = {v1},
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.21638352},
  url          = {https://doi.org/10.5281/zenodo.21638352},
  note         = {Preprint}
}

Project

The complete TSFT-RAG research project, including training scripts, evaluation pipeline, benchmark methodology and documentation, is available at:

Project repository https://github.com/frankmst/rag-task-specific-full-finetuning

TSFT-RAG model family https://huggingface.co/sascha-frank-ai-research


Author

Sascha Frank

Independent AI Researcher

ORCID https://orcid.org/0000-0002-0588-0081

GitHub https://github.com/frankmst

Hugging Face https://huggingface.co/sascha-frank-ai-research