Instructions to use ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma" --prompt "Once upon a time"
ChairReasoner β Full SFT on Gemma 4 E4B (MLX)
A full-parameter supervised fine-tune of Google Gemma 4 E4B on a diverse synthetic reasoning and instruction dataset, converted to MLX for Apple Silicon.
Model: ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma
Base: google/gemma-4-E4B (4.5B effective / ~8B total params)
Format: MLX, bfloat16 (unquantized) β optimised for Apple Silicon Macs
Context length: 128K tokens
License: Apache 2.0 (inherited from Gemma 4)
Model Details
Why full SFT?
Unlike LoRA or QLoRA adapters which only train a small subset of parameters, this run performs true full-parameter SFT β every weight in the 8B-parameter model is updated. This was done on a 16 GB Apple Silicon Mac using MLX with aggressive memory management (lazy weight loading, gradient checkpointing, short sequence lengths).
Architecture
| Property | Value |
|---|---|
| Base model | Gemma 4 E4B (dense) |
| Total parameters | ~8B (4.5B effective) |
| Layers | 42 (hybrid sliding + full attention) |
| Hidden size | 2560 |
| Attention heads | 8 Γ 256-dim |
| KV heads | 2 (with 18 KV shared layers) |
| Sliding window | 512 |
| Context length | 128K |
| Vocabulary | 262K tokens (SentencePiece) |
| Precision | bfloat16 |
Training Configuration
| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW |
| Learning rate | 2e-5 |
| Batch size | 1 (gradient accumulation: 8) |
| Max sequence length | 512 |
| Total iterations | 1500 |
| Hardware | Apple Silicon Mac (16 GB unified memory) |
| Framework | MLX + mlx-lm |
Inference Settings (recommended)
temperature = 1.0
top_p = 0.95
top_k = 64
Training Data
The model was fine-tuned on a synthetic multi-turn instruction dataset covering a broad range of expert domains. Each conversation is grounded in a specific system persona.
Dataset stats:
| Stat | Value |
|---|---|
| Training examples | 8,706 |
| Validation examples | 435 |
| Multi-turn conversations (3+ messages) | ~95% |
| Max conversation turns | 13 |
| Average messages per conversation | 4.1 |
| Total message turns | 35,373 |
| Unique system personas | 5,516 |
Domain Coverage
The data spans a wide range of expert domains, each with tailored system prompts:
- π§ͺ Science & Technology β physics, chemistry, biology, engineering
- π» Coding & Engineering β software engineering, DevOps, data engineering, frontend, security
- π Humanities β philosophy, history, comparative literature, political science
- βοΈ Creative Writing β narrative craft, comedy, unreliable narrators, story structure
- π§ Cognitive Science β psychology, behavioral ecology, neuroscience
- π₯ Medicine β oncology, clinical decision-making, pharmacology
- π° Economics & Social Science β economic theory, game theory, research methodology
- π€ AI & ML β machine learning, reasoning, agentic systems
Thinking Mode
Training data leverages Gemma 4's built-in reasoning capability via <think> tags, where the model produces step-by-step reasoning before answering:
<think>
Step-by-step reasoning...
</think>
Final response.
Usage
The model is stored in MLX safetensors format and is intended for use with MLX and mlx-lm.
Loading with MLX
from mlx_lm.utils import load_model, load_tokenizer
model, _ = load_model("/path/to/chairreasoner-full-sft-gemma")
tokenizer = load_tokenizer("/path/to/chairreasoner-full-sft-gemma")
Loading with Transformers (via conversion)
The model originates from the Transformers-compatible Gemma 4 format. To use it with Hugging Face Transformers, convert the MLX weights back or download the base separately.
Technical Notes
- This model was trained fully offline β no internet access during training (
HF_HUB_OFFLINE=1) - Weights are unquantized bf16 β the
model.safetensorsfile is ~15 GB - The training script (
train.py) includes full-parameter unfreezing viamodel.unfreeze(), as opposed to the default LoRA mode inmlx-lm - Training was tuned to fit within 16 GB unified memory on Apple Silicon using memory-mapped weight loading and aggressive Metal cache clearing
- Checkpoints (if any) are stored in
checkpoints/as full weight dumps
Repository Structure
βββ README.md # This file
βββ train.py # Full SFT training script
βββ mlx_unquantized_gemma/ # Base model + fine-tuned weights
β βββ model.safetensors # ~15 GB unquantized weights
β βββ config.json # Model configuration
β βββ generation_config.json # Generation hyperparameters
β βββ tokenizer.json # SentencePiece tokenizer
β βββ tokenizer_config.json # Tokenizer configuration
β βββ processor_config.json # Multimodal processor config
β βββ chat_template.jinja # Chat template (with thinking support)
β βββ .gitattributes # Git LFS config
βββ local_dataset/ # Original Hugging Face Arrow dataset
β βββ data-00000-of-00001.arrow # 66 MB β source training data
β βββ dataset_info.json # Dataset metadata
β βββ state.json # Dataset state
βββ mlx_data/ # Cached JSONL files
β βββ train.jsonl # 64 MB β 8,271 training examples
β βββ valid.jsonl # 3.4 MB β 435 validation examples
βββ checkpoints/ # Training checkpoints (if resumed)
βββ model_params/ # Reserved for parameter exports
Acknowledgements
- Google DeepMind for the Gemma 4 model family (Apache 2.0)
- Apple MLX team for the MLX framework enabling full SFT on Mac
- Built with mlx-lm
License
This repository is licensed under Apache 2.0, inherited from the Gemma 4 base model license.
Quantized
Model tree for ElijahSdjsiaofjdasiofjs/chairreasoner-full-sft-gemma
Base model
google/gemma-4-E4B