LFM2-24B-A2B — Phase 1 Reasoning (OGRE)

This is Phase 1 of the OGRE (OllamaGradingRubricEvaluator) fine-tuning pipeline.

LFM2-24B-A2B fine-tuned on 13,201 synthetic chain-of-thought reasoning examples to improve structured analytical reasoning before domain-specific grading fine-tuning in Phase 2.


Model Details

Field Value
Base model LiquidAI/LFM2-24B-A2B
Architecture LFM2 MoE (Mixture of Experts), 24B total / ~2.3B active params per token
Fine-tune method LoRA (rank 16, alpha 16) via Unsloth
Training data shuff57/ogre-phase1-synth — 13,201 synthetic reasoning examples
Training steps 1,568 steps (1 epoch)
Hardware Google Colab A100 40GB + High-RAM (80GB system RAM)
Export format Merged 16-bit safetensors
Phase Phase 1 of 2 — reasoning pre-training before OGRE grading fine-tune

Training Configuration

# LoRA config
LORA_RANK    = 16
LORA_ALPHA   = 16
LORA_DROPOUT = 0.0
LORA_TARGET_MODULES = [
    "q_proj", "k_proj", "v_proj",
    "out_proj", "in_proj",   # LFM2 attention projections
    "w1", "w2", "w3",        # MoE expert MLP layers
]

# SFTConfig
per_device_train_batch_size  = 1
gradient_accumulation_steps  = 8   # effective batch size = 8
num_train_epochs             = 1
learning_rate                = 2e-5
lr_scheduler_type            = "cosine"
warmup_ratio                 = 0.1
optim                        = "adamw_8bit"
bf16                         = True
packing                      = False  # disabled for MoE routing stability

Training Data

  • Dataset: shuff57/ogre-phase1-synth
  • Size: 13,201 synthetic chain-of-thought reasoning examples
  • Format: ChatML (system / user / assistant turns)
  • Split: 95% train (12,540 examples) / 5% validation (661 examples)
  • Loss masking: Response-only (assistant turns only) via train_on_responses_only

Installation Notes

LFM2-24B-A2B requires specific package versions:

pip install unsloth_zoo unsloth
pip install transformers==5.3.0  # >=5.0.0 required for lfm2_moe arch
pip install trl==0.22.2 datasets==4.3.0

Important: device_map="cpu" required during loading to avoid VRAM OOM during MoE expert weight conversion. Use a runtime with ≥50GB system RAM.


Usage

from unsloth import FastLanguageModel
import torch

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name     = "shuff57/lfm2-24b-phase1-reasoning",
    max_seq_length = 8192,
    load_in_4bit   = True,
    dtype          = torch.bfloat16,
    device_map     = "cpu",
)

FastLanguageModel.for_inference(model)

messages = [
    {"role": "system", "content": "You are a careful analytical reasoner."},
    {"role": "user",   "content": "Your question here."},
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
).to(model.device)

outputs = model.generate(
    input_ids          = inputs,
    max_new_tokens     = 1024,
    temperature        = 0.1,
    top_k              = 50,
    repetition_penalty = 1.05,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

OGRE Pipeline

This model is Phase 1 of a two-phase fine-tuning pipeline:

Phase Model Dataset Purpose
Phase 1 This model 13,201 synthetic reasoning examples Reasoning capability
Phase 2 shuff57/lfm2-24b-grader (coming soon) 239 OGRE grading examples Domain-specific grading

Phase 2 loads this model and fine-tunes further on OGRE statistics grading data, then exports as GGUF Q4_K_M for local Ollama deployment as lfm2-stat-grader.


Framework

Trained with Unsloth and HuggingFace TRL.

Unsloth

Downloads last month
6
Safetensors
Model size
24B params
Tensor type
F32
·
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for shuff57/lfm2-24b-phase1-reasoning

Adapter
(3)
this model
Finetunes
1 model

Dataset used to train shuff57/lfm2-24b-phase1-reasoning