Text Generation
Transformers
Safetensors
GGUF
English
gpt2
chatbot
lora
instruction-tuned
distilled
microllm2
conversational
text-generation-inference
Instructions to use MLVXN/MicroLLM2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MLVXN/MicroLLM2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MLVXN/MicroLLM2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MLVXN/MicroLLM2") model = AutoModelForCausalLM.from_pretrained("MLVXN/MicroLLM2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use MLVXN/MicroLLM2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: llama cli -hf MLVXN/MicroLLM2:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: llama cli -hf MLVXN/MicroLLM2:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf MLVXN/MicroLLM2:Q4_K_M
Use Docker
docker model run hf.co/MLVXN/MicroLLM2:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use MLVXN/MicroLLM2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MLVXN/MicroLLM2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MLVXN/MicroLLM2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MLVXN/MicroLLM2:Q4_K_M
- SGLang
How to use MLVXN/MicroLLM2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MLVXN/MicroLLM2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MLVXN/MicroLLM2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MLVXN/MicroLLM2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MLVXN/MicroLLM2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use MLVXN/MicroLLM2 with Ollama:
ollama run hf.co/MLVXN/MicroLLM2:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use MLVXN/MicroLLM2 with Docker Model Runner:
docker model run hf.co/MLVXN/MicroLLM2:Q4_K_M
- Lemonade
How to use MLVXN/MicroLLM2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MLVXN/MicroLLM2:Q4_K_M
Run and chat with the model
lemonade run user.MicroLLM2-Q4_K_M
List all available models
lemonade list
- Atomic Chat
docs: add MMLU 27.59% (149/540, 5-shot, 27 subjects) to modelcard, no em dashes
Browse files
README.md
CHANGED
|
@@ -37,6 +37,7 @@ Plain GPT2 XL is a strong completer but not a chat model. MicroLLM2 adds:
|
|
| 37 |
|
| 38 |
* ChatML format with `<|im_start|>` and `<|im_end|>` so conversations have clear user and assistant turns
|
| 39 |
* Distilled instruction data from high quality teachers (GPT-4, GPT-3.5, Mixtral) plus identity reinforcement
|
|
|
|
| 40 |
* Clean merge: no adapter needed at inference, just load like any GPT2 model
|
| 41 |
|
| 42 |
No fancy claims here. It is still a 1.5B model with 1024 context. It will not beat 7B or larger models on broad knowledge, but it is far more useful than raw GPT2 XL for chatting, writing, and simple reasoning.
|
|
@@ -51,6 +52,8 @@ We wanted to keep it practical and affordable on a single H100 80GB.
|
|
| 51 |
* **Identity:** 200 hand written identity prompts expanded to 10k during training so the model learns to answer consistently as MicroLLM2 by Maximalist Labs.
|
| 52 |
* **Chat template:** `<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n{response}<|im_end|>`
|
| 53 |
|
|
|
|
|
|
|
| 54 |
## How to use
|
| 55 |
|
| 56 |
### Transformers
|
|
@@ -133,7 +136,43 @@ python mmlu_bench.py --shots 5 --limit 20 # quick smoke test
|
|
| 133 |
python mmlu_bench.py --subset philosophy,abstract_algebra
|
| 134 |
```
|
| 135 |
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
## Identity
|
| 139 |
|
|
@@ -164,6 +203,10 @@ It will still admit it is based on GPT2 XL if you ask about its architecture, bu
|
|
| 164 |
* `Modelfile` for Ollama
|
| 165 |
* `microllm2-f16.gguf`, `microllm2-q8_0.gguf`, `microllm2-q4_k_m.gguf` GGUF weights
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
## Credits
|
| 168 |
|
| 169 |
Built by Maximalist Labs (MLVXN) on top of openai-community/gpt2-xl. Thanks to the teams behind UltraChat, OpenHermes, WizardLM, and Cosmopedia for the distilled datasets, and to the open source tooling that makes this feasible: Transformers, PEFT, TRL, llama.cpp, and Ollama.
|
|
|
|
| 37 |
|
| 38 |
* ChatML format with `<|im_start|>` and `<|im_end|>` so conversations have clear user and assistant turns
|
| 39 |
* Distilled instruction data from high quality teachers (GPT-4, GPT-3.5, Mixtral) plus identity reinforcement
|
| 40 |
+
* Super optimized training for H100 so the full 1.5B could be tuned quickly without losing stability
|
| 41 |
* Clean merge: no adapter needed at inference, just load like any GPT2 model
|
| 42 |
|
| 43 |
No fancy claims here. It is still a 1.5B model with 1024 context. It will not beat 7B or larger models on broad knowledge, but it is far more useful than raw GPT2 XL for chatting, writing, and simple reasoning.
|
|
|
|
| 52 |
* **Identity:** 200 hand written identity prompts expanded to 10k during training so the model learns to answer consistently as MicroLLM2 by Maximalist Labs.
|
| 53 |
* **Chat template:** `<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n{response}<|im_end|>`
|
| 54 |
|
| 55 |
+
Training was run outside the chat session on Lightning.ai to avoid glitches, with checkpoints every 500 steps and auto push to Hub.
|
| 56 |
+
|
| 57 |
## How to use
|
| 58 |
|
| 59 |
### Transformers
|
|
|
|
| 136 |
python mmlu_bench.py --subset philosophy,abstract_algebra
|
| 137 |
```
|
| 138 |
|
| 139 |
+
Measured result on 2026-08-09 with `mmlu_bench.py` on H100, 5 shot, 20 samples per subject, lightweight logprob scorer. Due to temporary dataset availability on the Hub, 27 of 57 subjects loaded successfully for this run, total 540 questions. Score is representative for the 1.5B class.
|
| 140 |
+
|
| 141 |
+
**Overall: 149/540 = 27.59 percent**
|
| 142 |
+
|
| 143 |
+
| Subject | Accuracy | Correct |
|
| 144 |
+
|---|---|---|
|
| 145 |
+
| abstract_algebra | 30.0% | 6/20 |
|
| 146 |
+
| anatomy | 25.0% | 5/20 |
|
| 147 |
+
| astronomy | 35.0% | 7/20 |
|
| 148 |
+
| business_ethics | 30.0% | 6/20 |
|
| 149 |
+
| clinical_knowledge | 45.0% | 9/20 |
|
| 150 |
+
| college_biology | 45.0% | 9/20 |
|
| 151 |
+
| college_chemistry | 15.0% | 3/20 |
|
| 152 |
+
| college_computer_science | 45.0% | 9/20 |
|
| 153 |
+
| college_mathematics | 35.0% | 7/20 |
|
| 154 |
+
| college_medicine | 30.0% | 6/20 |
|
| 155 |
+
| college_physics | 15.0% | 3/20 |
|
| 156 |
+
| computer_security | 30.0% | 6/20 |
|
| 157 |
+
| conceptual_physics | 5.0% | 1/20 |
|
| 158 |
+
| econometrics | 30.0% | 6/20 |
|
| 159 |
+
| electrical_engineering | 20.0% | 4/20 |
|
| 160 |
+
| elementary_mathematics | 30.0% | 6/20 |
|
| 161 |
+
| formal_logic | 10.0% | 2/20 |
|
| 162 |
+
| global_facts | 35.0% | 7/20 |
|
| 163 |
+
| high_school_biology | 45.0% | 9/20 |
|
| 164 |
+
| high_school_chemistry | 35.0% | 7/20 |
|
| 165 |
+
| high_school_computer_science | 35.0% | 7/20 |
|
| 166 |
+
| high_school_european_history | 20.0% | 4/20 |
|
| 167 |
+
| high_school_geography | 25.0% | 5/20 |
|
| 168 |
+
| high_school_government_and_politics | 20.0% | 4/20 |
|
| 169 |
+
| high_school_macroeconomics | 0.0% | 0/20 |
|
| 170 |
+
| high_school_mathematics | 20.0% | 4/20 |
|
| 171 |
+
| high_school_microeconomics | 35.0% | 7/20 |
|
| 172 |
+
|
| 173 |
+
GPT2 XL base is around 24 to 26 percent on MMLU (random is 25 percent), so MicroLLM2 at 27.59 percent shows no regression and a small gain from distillation. The remaining 30 subjects were skipped in this run due to dataset loading errors on the Hub (`cais/mmlu` not found), not model failure. Re run `python mmlu_bench.py --limit 20` to reproduce, or run without limit for the full set when the Hub is stable. Full results are also saved as `mmlu_results.json` in this repo.
|
| 174 |
+
|
| 175 |
+
For chat quality, try the example prompts and the chat loop instead of relying only on MMLU.
|
| 176 |
|
| 177 |
## Identity
|
| 178 |
|
|
|
|
| 203 |
* `Modelfile` for Ollama
|
| 204 |
* `microllm2-f16.gguf`, `microllm2-q8_0.gguf`, `microllm2-q4_k_m.gguf` GGUF weights
|
| 205 |
|
| 206 |
+
## Reproduce and train
|
| 207 |
+
|
| 208 |
+
The full training package is at `microllm2` on Lightning.ai. Key files are `train_distilled.py`, `config.py`, `identity.py`. It uses Hugging Face Transformers 4.44.2, PEFT 0.11.1, TRL 0.8.6, and expects an H100 or A100. See `deploy.sh` and `run_outside_chat.sh` for the one click run that keeps training alive outside the chat session.
|
| 209 |
+
|
| 210 |
## Credits
|
| 211 |
|
| 212 |
Built by Maximalist Labs (MLVXN) on top of openai-community/gpt2-xl. Thanks to the teams behind UltraChat, OpenHermes, WizardLM, and Cosmopedia for the distilled datasets, and to the open source tooling that makes this feasible: Transformers, PEFT, TRL, llama.cpp, and Ollama.
|