Ayodele01/Gemma-4-12B-Gemini-3.5-flash-Reasoning-Distill
118
Gemma-4-12B-Gemini-3.5-flash-Reasoning-Distill
This model is a fine-tuned version of Google's Gemma-4-12B-it (Instruction-tuned) base model, optimized via QLoRA SFT on the full 25,000 synthetic reasoning example dataset WithinUsAI/gemini_3.5_flash_distilled_25k using Unsloth.
๐ Model Highlights
- Task Alignment: Fine-tuned on high-quality synthetic traces distilled from Gemini 3.5 Flash, covering agentic code synthesis, dense context reasoning, mathematical engine traces, and systemic execution.
- Structured Math JSON Engine Traces: The model has learned to represent complex mathematical reasoning as structured JSON engine traces (specifying
problem_type,input_dimensions,execution_trace, anderror_bounds), mimicking themathematical_engine_tracessubset (14% of the training dataset). - Robust Instruction Following: The fine-tuned model successfully mitigates long-tail repetition behaviors found in the base model (e.g. infinite regex loops) and guarantees clean, valid JSON schemas.
- Stable Training: Achieved excellent training convergence (Final SFT loss: 0.2652) over 1 full epoch (6,250 steps) on a single RTX 4090.
๐ Evaluation & Capability Comparison
Both the base model and this fine-tuned model were evaluated side-by-side using identical prompts across six capability dimensions.
1. Quantitative Performance (25K SFT Run)
Generation Length & Speed by Category
2. Qualitative Discoveries & Alignment Analysis
- Mathematical Reasoning (JSON Trace Alignment): When given a math word problem ("A fair 6-sided die is rolled 5 times..."), the fine-tuned model formats its thinking process as a structured JSON engine execution trace (specifying inputs, convolution steps, and error bounds). This mimics the
mathematical_engine_tracessubset (14% of training dataset). - Instruction Following: The base model generated invalid JSON schemas due to repetitive long-tail regex loops that hit the maximum token limit. The fine-tuned model successfully generated clean, complete, and valid JSON schemas for library book inventory, rate limiting, and pagination.
- Debugging: Both models successfully identified and corrected critical logic bugs (infinite loops, float divisions, index bounds) in python algorithms, with the fine-tuned model showing a preference for structured code blocks.
๐ Base Model Benchmarks
According to Google DeepMind's official benchmarks for the Gemma model family (with instruction-tuned evaluations):
โ๏ธ Hyperparameters & Training Settings
The model was trained with the following hyperparameters:
๐ How to Use
Loading the LoRA adapter natively with Unsloth:
import torch
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="Ayodele01/Gemma-4-12B-Gemini-3.5-flash-Reasoning-Distill",
max_seq_length=2048,
load_in_4bit=True,
)
FastModel.for_inference(model)
# Inference Example
messages = [{"role": "user", "content": "Write a thread-safe LRU cache with TTL in Python."}]
inputs = tokenizer(text=tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True), return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))Prompt Template
This model uses the standard Gemma-4 chat format:
<|turn>user
{ prompt }<|turn>model๐ License & Usage
This model is subject to the Gemma Terms of Use.
