Instructions to use lemonilia/Mistral-Small-3-Reasoner-s1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use lemonilia/Mistral-Small-3-Reasoner-s1 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="lemonilia/Mistral-Small-3-Reasoner-s1", filename="mistral-small-3-reasoner-s1.epoch5.bf16.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use lemonilia/Mistral-Small-3-Reasoner-s1 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M # Run inference directly in the terminal: llama-cli -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M # Run inference directly in the terminal: llama-cli -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
Use Docker
docker model run hf.co/lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use lemonilia/Mistral-Small-3-Reasoner-s1 with Ollama:
ollama run hf.co/lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
- Unsloth Studio new
How to use lemonilia/Mistral-Small-3-Reasoner-s1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lemonilia/Mistral-Small-3-Reasoner-s1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lemonilia/Mistral-Small-3-Reasoner-s1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for lemonilia/Mistral-Small-3-Reasoner-s1 to start chatting
- Docker Model Runner
How to use lemonilia/Mistral-Small-3-Reasoner-s1 with Docker Model Runner:
docker model run hf.co/lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
- Lemonade
How to use lemonilia/Mistral-Small-3-Reasoner-s1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull lemonilia/Mistral-Small-3-Reasoner-s1:Q4_K_M
Run and chat with the model
lemonade run user.Mistral-Small-3-Reasoner-s1-Q4_K_M
List all available models
lemonade list
Mistral-Small-3-Reasoner-s1
A simple Mistral-Small-24B-Instruct-2501 finetune on the LIMA-like s1K reasoning dataset by Muennighoff et al. to give the original model basic reasoning capabilities within <think> tags, like DeepSeek R1. Surprisingly, the model can reason even outside math/STEM subjects.
Usage notes
Prepend the assistant response with <think> to make the model engage in a chain-of-thought. This should happen automatically with math questions on an empty context, but it needs to be forced in longer conversations. When done thinking, it will generate </think> and then the final response.
Make sure that the model's output length is long enough; be prepared to make the it continue its response if it stops prematurely.
Low-depth instructions (perhaps at depth-0, just before the assistant's response) can be beneficial in steering how the model should think. An additional [SYSTEM_PROMPT] could be used there.
From tests it seems beneficial to keep at least one chain-of-thought in the context in addition to the one being generated. More experimentation required here.
Prompting format
[INST]User question.[/INST]<think>
Chain of thought.
</think>
Model response.</s>
Observed quirks and issues
- Assistant responses may lack the final punctuation mark as a probable result of how the source training data was formatted.
- Not really a true issue, but information in the system prompt that contradicts that in the chat history or that is meant to be only temporarily valid may cause coherency issues with this model, since it will follow instructions very precisely.
- Without user control on chain-of-thought length, the model can ramble for several thousands of tokens.
- Besides multi-turn capabilities, other non-reasoning capabilities of the original
Mistral-Small-24B-Instruct-2501model might have degraded. - Most default guardrails apparently still work, but can be very easily bypassed with a suitable prompt as with the original model.
What's in this repository
- Checkpoints for epochs 1~5
- LoRA adapter for the final model
- Static GGUF quantizations
- HF FP16 weights
Dataset
Almost the entirety of the s1K dataset was used with minimal modifications to make it properly work with Mistral-Small-3-Instruct, except 4 rows that didn't fit within the training sequence length of 8192 tokens and 16 of the shortest ones that have been used as the test set instead. No samples have been clipped and no system prompt was added. All were single-turn.
Training hyperparameters
I tried to roughly follow indications from appendix C in the paper with the notable exception of using 4-bit LoRA finetuning and tuning the learning rate accordingly. The loss was not computed on questions within [INST]...[/INST] tags (including the tags), just on reasoning traces and solutions. The training sequence length was close to the maximum I could use on one NVidia RTX3090 24GB GPU. The total training time was about 18 hours.
Overfitting (increasing eval loss) occurred after 1 epoch, but the training loss behavior was similar to that observed in the paper.
lora_r = 32
lora_alpha = 64
lora_dropout = 0.05
load_in_4bit = True
max_seq_length = 8192
gradient_accumulation_steps = 16
eval_accumulation_steps = 16
learning_rate = 0.000400
weight_decay = 1e-4
num_train_epochs = 5
warmup_ratio = 0.05
lr_scheduler_type = "cosine"
optim = "adamw_8bit"
Training Graphs
Appears to more or less correspond to the general trend and values seen in Appendix C in the paper.
Some hyperparameters including the learning rate were changed before the end of the first epoch to better match those of the paper.
- Downloads last month
- 150
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit
Model tree for lemonilia/Mistral-Small-3-Reasoner-s1
Base model
mistralai/Mistral-Small-24B-Base-2501
