Downloads · 30 days
16
19% of all-time downloads
yasserrmd/LFM2.5-1.2B-onpolicy
LFM2.5-1.2B-onpolicy is a text generation model from yasserrmd. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A high-performance 1.2B parameter language model fine-tuned from LFM2.5-1.2B-Instruct using on-policy self-distillation, inspired by Self-Distillation Fine-Tuning (Shenfeld et al., 2026) but with simplified demonstrat…
Downloads · 30 days
16
19% of all-time downloads
All-time downloads
83
Public
Parameters
1.2B
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.3 GB · 100%
From the Hugging Face model README
A high-performance 1.2B parameter language model fine-tuned from LFM2.5-1.2B-Instruct using on-policy self-distillation, inspired by Self-Distillation Fine-Tuning (Shenfeld et al., 2026) but with simplified demonstration handling. Optimized for instruction-following and general-purpose assistant tasks.
| Attribute | Value |
|---|---|
| Base Model | LiquidAI/LFM2.5-1.2B-Instruct |
| Architecture | Transformer (1.2B parameters) |
| Fine-tuning Method | On-Policy Self-Distillation |
| Inspiration | SDFT (Shenfeld et al., 2026) |
| Training Data | OpenAssistant (OASST1) - 5,000 samples |
| Data Format | Query-response pairs (conversational) |
| Training Hardware | NVIDIA A100 (80GB GPU) |
| Precision | fp16 (float16) |
| Model Size | 2.4 GB |
| Training Status | Epoch 1 (production-ready checkpoint) |
This implementation is inspired by SDFT (Shenfeld et al., 2026) but uses a simplified approach to on-policy learning:
On-Policy Learning:
y ~ π_θ(·|x)Reverse KL Divergence:
D_KL(π_θ ∥ π)Teacher as Base Model:
EMA Teacher Updates:
8-Bit Quantization:
Demonstration Conditioning ⚠️
π(·|x, c)π(·|x)Demo-Aware Logits in Loss ⚠️
π_θ(y|x) vs π(y|x,c) divergenceπ_θ(y|x) vs π(y|x) divergenceAnalytic Per-Vocabulary KL ⚠️
Σ_y π_θ(y) log(π_θ/π)log π_θ(y_t) - log π(y_t)Explicit Demonstration Prompt Template ⚠️
<Query> This is an example: <Demo> Now answer...This simplified approach trades off the full SDFT mechanism for:
| Aspect | Details |
|---|---|
| Source | OpenAssistant/OASST1 (Hugging Face) |
| Total Samples | 5,000 query-response pairs |
| Sequence Length | Max 512 tokens (context) + 256 tokens (generation) |
| Total Tokens | 3.8M tokens (3.0M words) |
| Domains Covered | General knowledge, creative writing, problem-solving, technical, analysis |
| Quality Filter | Removed samples <10 chars or >2000 chars |
| Preprocessing | Shuffled, CSV format (query + demonstration columns) |
Note: Demonstrations are prepared and tokenized in dataset but not used in training loop (simplified approach).
| Parameter | Value | Rationale |
|---|---|---|
| Batch Size | 16 | Larger batches for stable gradient updates |
| Max Sequence Length | 512 | Balanced context length for efficiency |
| Max Generation Length | 256 | Sufficient for detailed responses |
| Learning Rate | 5e-6 | Conservative to prevent divergence |
| Optimizer | AdamW | Stable optimization with weight decay |
| Temperature | 1.0 | Standard probability scaling (no effect at 1.0) |
| LoRA Rank (r) | 8 | Efficient parameter-efficient fine-tuning |
| LoRA Alpha | 16 | Balances LoRA contribution scaling |
| Epochs Trained | 1 | Single epoch, production-ready |
| Total Training Time | 1 hour 23 minutes | 234 batches × 21.37 sec per batch |
| Final Loss | 0.1845 | Stable convergence at epoch completion |
Training Environment:
Memory Usage:
| Metric | Value |
|---|---|
| Average Response Length | 155 words |
| Response Range | 14-219 words |
| Comprehensive Responses (100-180 words) | 57.8% |
| Detailed Responses (180+ words) | 28.9% |
| Quality Score | 85/100 |
| Category | Avg Words | Consistency | Performance |
|---|---|---|---|
| General Knowledge | 172 | High (CV=0.12) | Excellent |
| Problem Solving | 175 | High (CV=0.04) | Excellent |
| Technical | 178 | High (CV=0.10) | Excellent |
| Instructions & How-To | 175 | High (CV=0.04) | Excellent |
| Analysis & Explanation | 175 | High (CV=0.12) | Excellent |
| Creative & Opinions | 162 | High (CV=0.16) | Very Good |
| Writing & Content | 137 | Moderate (CV=0.42) | Good |
| Miscellaneous | 129 | Moderate (CV=0.32) | Good |
| Question Answering | 90 | Variable (CV=0.69) | Good |
Key Findings:
pip install transformers torch
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load model
model = AutoModelForCausalLM.from_pretrained(
"yasserrmd/lfm2.5-1.2b-onpolicy",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("yasserrmd/lfm2.5-1.2b-onpolicy")
# Generate response
prompt = """<|im_start|>user
What is machine learning?
<|im_end|>
<|im_start|>assistant
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.95
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
| Parameter | Recommended | Range |
|---|---|---|
| temperature | 0.7 | 0.1-1.0 (lower = more deterministic) |
| top_p | 0.95 | 0.8-1.0 (nucleus sampling) |
| max_new_tokens | 256 | 64-512 (adjust based on task) |
| repetition_penalty | 1.2 | 1.0-2.0 (prevents repetition) |
This implementation follows the spirit of SDFT (on-policy learning) but uses a simplified approach:
| Aspect | Paper SDFT | This Model |
|---|---|---|
| Teacher Conditioning | Demo-conditioned π(·|x,c) | Base model π(·|x) |
| Demo Usage | Explicit signal in loss | Unused (simplified) |
| KL Estimator | Analytic (vocabulary) | Sampled (tokens) |
| Use Case | Continual learning from experts | General instruction fine-tuning |
| Goal | Extract implicit reward from demos | Preserve base model capabilities |
Result: On-policy self-distillation optimized for instruction tuning rather than demonstration-based continual learning.
The model is ready for:
| Use Case | Minimum GPU | Optimal GPU |
|---|---|---|
| Inference (batch=1) | 4GB (RTX 4060) | 8GB (RTX 4070) |
| Batch inference | 8GB (RTX 4070) | 16GB (A100 40GB) |
| Further fine-tuning | 16GB (A100 40GB) | 80GB (A100 80GB) |
If you use this model in your research, please cite:
@misc{lfm25_onpolicy_2026,
author = {Yasser RMD},
title = {LFM2.5-1.2B: On-Policy Self-Distillation Fine-Tuned Language Model},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/yasserrmd/lfm2.5-1.2b-onpolicy}},
note = {Inspired by Shenfeld et al. (2026) SDFT}
}
Self-Distillation Fine-Tuning (SDFT): Shenfeld, I., Damani, M., Hübotter, J., & Agrawal, P. (2026). "Self-Distillation Enables Continual Learning." arXiv preprint arXiv:2601.19897. https://arxiv.org/abs/2601.19897
Base Model: LiquidAI LFM2.5-1.2B. https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct
Dataset: OpenAssistant/OASST1. https://huggingface.co/datasets/OpenAssistant/oasst1
Training Framework: Hugging Face Transformers & PEFT (Parameter-Efficient Fine-Tuning). https://github.com/huggingface/peft
For improvements, issues, or collaborations:
This model follows the license of the base model (LFM2.5-1.2B-Instruct). Please refer to the original model repository for details.
Created: February 2026 Training Hardware: NVIDIA A100 80GB Status: Production Ready (Single Epoch, On-Policy Self-Distilled) Inspiration: SDFT (Shenfeld et al., 2026) Implementation Type: Simplified Instruction Fine-Tuning Variant