Text Generation
Safetensors
GGUF
English
danai
small-language-model
slm
edge-ai
agentic
tool-calling
reasoning
cot
mobile
quantization
ollama
llama-cpp
4bit
8bit
2bit
conversational
Instructions to use asjadilahi/danAI-55M-Reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use asjadilahi/danAI-55M-Reasoning 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 asjadilahi/danAI-55M-Reasoning:Q4_K_M # Run inference directly in the terminal: llama cli -hf asjadilahi/danAI-55M-Reasoning:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf asjadilahi/danAI-55M-Reasoning:Q4_K_M # Run inference directly in the terminal: llama cli -hf asjadilahi/danAI-55M-Reasoning: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 asjadilahi/danAI-55M-Reasoning:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf asjadilahi/danAI-55M-Reasoning: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 asjadilahi/danAI-55M-Reasoning:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf asjadilahi/danAI-55M-Reasoning:Q4_K_M
Use Docker
docker model run hf.co/asjadilahi/danAI-55M-Reasoning:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use asjadilahi/danAI-55M-Reasoning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "asjadilahi/danAI-55M-Reasoning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "asjadilahi/danAI-55M-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/asjadilahi/danAI-55M-Reasoning:Q4_K_M
- Ollama
How to use asjadilahi/danAI-55M-Reasoning with Ollama:
ollama run hf.co/asjadilahi/danAI-55M-Reasoning:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use asjadilahi/danAI-55M-Reasoning with Docker Model Runner:
docker model run hf.co/asjadilahi/danAI-55M-Reasoning:Q4_K_M
- Lemonade
How to use asjadilahi/danAI-55M-Reasoning with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull asjadilahi/danAI-55M-Reasoning:Q4_K_M
Run and chat with the model
lemonade run user.danAI-55M-Reasoning-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Release multi-bit quantization suite: GGUF (F16, BF16, Q8_0, Q6_K, Q5_K_M, Q4_K_M, Q4_0, Q3_K_M, Q2_K) + PyTorch INT8/INT4/INT2 Safetensors + Ollama Modelfile
8fc2b78 verified |
Download README.md from asjadilahi/danAI-55M-Reasoning: direct link, hf CLI and curl.
- Browser
- Download file 10.2 kB
-
https://huggingface.co/asjadilahi/danAI-55M-Reasoning/resolve/main/README.md
- Command line
-
hf download hf://asjadilahi/danAI-55M-Reasoning/README.md
-
curl -L -o README.md https://huggingface.co/asjadilahi/danAI-55M-Reasoning/resolve/main/README.md
10.2 kB
| language: | |
| - en | |
| license: apache-2.0 | |
| tags: | |
| - danai | |
| - small-language-model | |
| - slm | |
| - edge-ai | |
| - agentic | |
| - tool-calling | |
| - reasoning | |
| - cot | |
| - mobile | |
| - gguf | |
| - quantization | |
| - ollama | |
| - llama-cpp | |
| - 4bit | |
| - 8bit | |
| - 2bit | |
| pipeline_tag: text-generation | |
| inference: false | |
| <div align="center"> | |
| <img src="danai.jpeg" alt="danAI Logo" width="500" style="border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);"/> | |
| # π§ danAI-55M-Reasoning | |
| **An Ultra-Lightweight 54.5M Agentic & Reasoning Language Model for Edge Devices, Mobile Intelligence, and Microcontrollers** | |
| *Created by **Asjad Ilahi** ([@asjadilahi](https://huggingface.co/asjadilahi))* | |
| [](https://opensource.org/licenses/Apache-2.0) | |
| []() | |
| []() | |
| []() | |
| [-purple.svg)]() | |
| </div> | |
| --- | |
| ### π About danAI (*Ψ―Ψ§ΩΨ§ - Wise / Intelligent*) | |
| **danAI-55M-Reasoning** is an ultra-compact **54.5 Million parameter Small Language Model (SLM)** designed from the ground up to bring high-grade reasoning, instruction following, and autonomous agentic capabilities to low-power edge hardware, mobile processors, and IoT devices in an ultra-low **13 MB to 104 MB memory footprint**. | |
| Named after the Urdu word ***DΔnΔ (Ψ―Ψ§ΩΨ§)*** meaning *wise* or *intelligent*, **danAI** proves that extreme efficiency and agentic intelligence can coexist without requiring multi-gigabyte models. | |
| --- | |
| ## β‘ Quantized Models & Formats (16-bit, 8-bit, 4-bit, 2-bit) | |
| All official quantizations and weights are hosted directly in this repository: | |
| | Bit Width | Format | Target File | File Size | Memory Footprint | Recommended Use Case / Target Hardware | | |
| | :---: | :---: | :---: | :---: | :---: | :---: | | |
| | **16-bit** | PyTorch Safetensors | [`model.safetensors`](./model.safetensors) | 104 MB | 104 MB | Standard PyTorch / Hugging Face BF16 inference | | |
| | **16-bit** | PyTorch Safetensors | [`model.fp16.safetensors`](./model.fp16.safetensors) | 104 MB | 104 MB | Standard Half-Precision CUDA GPUs | | |
| | **16-bit** | Master FP32 | [`model.fp32.safetensors`](./model.fp32.safetensors) | 208 MB | 208 MB | Research, analysis & master precision benchmarking | | |
| | **16-bit** | GGUF F16 | [`danAI-55M-Reasoning-F16.gguf`](./danAI-55M-Reasoning-F16.gguf) | 137 MB | 137 MB | llama.cpp / Ollama unquantized reference baseline | | |
| | **16-bit** | GGUF BF16 | [`danAI-55M-Reasoning-BF16.gguf`](./danAI-55M-Reasoning-BF16.gguf) | 137 MB | 137 MB | Apple Silicon Metal & modern CPU engines | | |
| | **8-bit** | GGUF Q8_0 | [`danAI-55M-Reasoning-Q8_0.gguf`](./danAI-55M-Reasoning-Q8_0.gguf) | 73.5 MB | **~74 MB** | **β Recommended for Ollama / llama.cpp (Near 0% quality loss)** | | |
| | **8-bit** | PyTorch INT8 | [`danAI-55M-Reasoning-INT8.safetensors`](./danAI-55M-Reasoning-INT8.safetensors) | 52.2 MB | **~52 MB** | High-speed PyTorch 8-bit symmetric weight inference | | |
| | **6-bit** | GGUF Q6_K | [`danAI-55M-Reasoning-Q6_K.gguf`](./danAI-55M-Reasoning-Q6_K.gguf) | 57.1 MB | ~57 MB | High-precision K-quant balance | | |
| | **5-bit** | GGUF Q5_K_M | [`danAI-55M-Reasoning-Q5_K_M.gguf`](./danAI-55M-Reasoning-Q5_K_M.gguf) | 50.9 MB | ~51 MB | Compact balanced K-quant | | |
| | **4-bit** | GGUF Q4_K_M | [`danAI-55M-Reasoning-Q4_K_M.gguf`](./danAI-55M-Reasoning-Q4_K_M.gguf) | 45.0 MB | **~45 MB** | **β Optimal Edge Balance: Mobile chips, Raspberry Pi, Edge AI** | | |
| | **4-bit** | GGUF Q4_0 | [`danAI-55M-Reasoning-Q4_0.gguf`](./danAI-55M-Reasoning-Q4_0.gguf) | 43.7 MB | ~44 MB | Universal 4-bit block quant for embedded platforms | | |
| | **4-bit** | PyTorch INT4 | [`danAI-55M-Reasoning-INT4.safetensors`](./danAI-55M-Reasoning-INT4.safetensors) | 26.4 MB | **~26 MB** | Ultra-compact 4-bit packed weights for PyTorch on-device | | |
| | **3-bit** | GGUF Q3_K_M | [`danAI-55M-Reasoning-Q3_K_M.gguf`](./danAI-55M-Reasoning-Q3_K_M.gguf) | 38.6 MB | ~39 MB | Sub-40MB K-quant compression | | |
| | **2-bit** | GGUF Q2_K | [`danAI-55M-Reasoning-Q2_K.gguf`](./danAI-55M-Reasoning-Q2_K.gguf) | 32.8 MB | **~33 MB** | 2-bit K-quant for microcontrollers & extreme RAM limits | | |
| | **2-bit** | PyTorch INT2 | [`danAI-55M-Reasoning-INT2.safetensors`](./danAI-55M-Reasoning-INT2.safetensors) | 13.4 MB | **~13 MB** | Ultra-low 2-bit packed representation (4 weights/byte) | | |
| --- | |
| ## π Quickstart & Inference | |
| ### 1. Ollama (1-Command Local Run) | |
| ```bash | |
| # Download GGUF and Modelfile | |
| huggingface-cli download asjadilahi/danAI-55M-Reasoning danAI-55M-Reasoning-Q8_0.gguf Modelfile --local-dir . | |
| # Create and run with Ollama | |
| ollama create danai -f Modelfile | |
| ollama run danai "What is 5 + 7?" | |
| ``` | |
| ### 2. llama.cpp / llama-cli | |
| ```bash | |
| # Download any GGUF quant (e.g. Q8_0 or Q4_K_M) | |
| huggingface-cli download asjadilahi/danAI-55M-Reasoning danAI-55M-Reasoning-Q8_0.gguf --local-dir . | |
| # Run with llama-cli (>300 tokens/sec on Apple Silicon / CPU) | |
| llama-cli -m danAI-55M-Reasoning-Q8_0.gguf -p "System: You are danAI, a helpful AI assistant.\n\nUser: Solve 25 * 4.\n\nAssistant: <think>" -n 128 | |
| ``` | |
| ### 3. Interactive Python Chat with Live Tool Calling | |
| ```bash | |
| # Clone repository | |
| git clone https://github.com/Asjad-Ilahi/danAI-55M.git | |
| cd danAI-55M | |
| pip install torch safetensors huggingface-hub tokenizers | |
| # Run interactive assistant (automatically pulls weights from Hugging Face) | |
| python scripts/chat.py | |
| ``` | |
| ### 4. Standalone Quantized PyTorch Runner (INT8, INT4, INT2, BF16) | |
| ```python | |
| import torch | |
| from tokenizers import Tokenizer | |
| from safetensors.torch import load_file | |
| from scripts.quantized_chat import load_quantized_model | |
| # Load 8-bit, 4-bit, or 2-bit quantized safetensors | |
| model, mode = load_quantized_model("hf_export/danAI-55M-Reasoning-INT8.safetensors") | |
| tokenizer = Tokenizer.from_file("tokenizer/tokenizer.json") | |
| prompt = "System: You are danAI, a helpful AI assistant.\n\nUser: What is 2 + 2?\n\nAssistant: <think>" | |
| input_ids = torch.tensor([tokenizer.encode(prompt).ids], dtype=torch.long) | |
| with torch.no_grad(): | |
| for _ in range(30): | |
| logits = model(input_ids)[0] | |
| next_token = torch.argmax(logits[0, -1, :]).item() | |
| input_ids = torch.cat([input_ids, torch.tensor([[next_token]])], dim=1) | |
| if next_token in [0, tokenizer.token_to_id("<|endoftext|>")]: | |
| break | |
| print(tokenizer.decode(input_ids[0].tolist())) | |
| ``` | |
| --- | |
| ## π Core Strengths | |
| 1. **β‘ Ultra-Low 13 MB to 104 MB RAM Footprint**: | |
| * Runs smoothly on mobile chips, Apple Silicon, Raspberry Pi, and microcontrollers. | |
| 2. **π οΈ Native Agentic Tool Calling (100% Invocation Rate)**: | |
| * Automatically emits structured `<tool_call>` JSON blocks to offload exact multi-digit math to a `calculator` tool (`123433 * 564332 = 69657191756`) and live real-time queries to `search_web`. | |
| 3. **π Chain-of-Thought (`<think>`) Step-by-Step Reasoning**: | |
| * Decomposes multi-step arithmetic, logic, and planning inside `<think>` tokens before emitting the final answer. | |
| 4. **π₯ #1 in Direct Sub-100M Science Benchmarks**: | |
| * Decisively outperforms **Pythia-70M** across ARC-Easy (39.2% vs 37.4%), ARC-Challenge (25.2% vs 18.1%), and MMLU (27.4% vs 25.1%) while being **22% smaller**. | |
| 5. **π Outperforms OpenAI GPT-2 Small (124M)**: | |
| * Beats GPT-2 on ARC-Easy (39.2% vs 35.8%), ARC-Challenge (25.2% vs 21.4%), and MMLU (27.4% vs 26.2%) at **less than half the memory**. | |
| --- | |
| ## π Full-Dataset Benchmark Leaderboard | |
| Evaluated across **100% of all official test and validation samples** (>20,000+ test questions) against all major sub-150M open models: | |
| | Model | Active Params | Training Scale | GSM8K (Direct) | Agentic Tools | ARC-Challenge *(Hard Science)* | ARC-Easy *(2,376 q)* | ARC (Avg) | MMLU *(1,520 q)* | RAM Footprint | PIQA *(1,838 q)* | | |
| | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | |
| | **danAI-55M-Reasoning** | **54.5M** | **~3B tokens** | **3.0%** | **100.0% (Native)** | **25.2%** | **39.2%** | **32.2%** | **27.4%** | **13MB β 104 MB** | **56.1%** | | |
| | **Pythia-70M** *(EleutherAI)* | 70M | 300B tokens | 0.0% | 0.0% | 18.1% | 37.4% | 27.8% | 25.1% | 140 MB | 59.5% | | |
| | **GPT-2 Small** *(OpenAI)* | 124M | 40B tokens | 0.0% | 0.0% | 21.4% | 35.8% | 28.6% | 26.2% | 248 MB | 63.3% | | |
| | **MobileLLM-125M** *(Meta AI)* | 125M | 1,000B tokens | 0.5% | 0.0% | 27.7% | 45.5% | 36.6% | - | 250 MB | 64.6% | | |
| | **SmolLM-135M** *(Hugging Face)* | 135M | 600B tokens | 1.0% | 0.0% | - | - | 42.4% | 30.2% | 270 MB | 68.4% | | |
| | **SmolLM2-135M** *(Hugging Face)* | 135M | 2,000B tokens | 1.4% | 0.0% | - | - | 43.9% | 31.5% | 270 MB | 68.4% | | |
| --- | |
| ## π Architecture Specifications | |
| * **Model Name**: `danAI-55M-Reasoning` | |
| * **Total Parameters**: 54,525,952 (54.5M) | |
| * **Layers**: 12 Transformer Blocks | |
| * **Hidden Dimension**: 512 | |
| * **Attention Heads**: 8 Query Heads | |
| * **KV Heads**: 4 Key/Value Heads (Grouped Query Attention - GQA) | |
| * **Head Dimension**: 64 | |
| * **Intermediate Dimension**: 1376 (SwiGLU MLP) | |
| * **Vocab Size**: 32,768 (Byte-Pair Encoding, Tied Embeddings) | |
| * **Positional Embeddings**: RoPE (Rotary Position Embeddings, Base theta=10000.0, NTK Extension factor=2.0) | |
| * **Max Context Length**: 2048 tokens | |
| * **Memory Footprint**: 13 MB (INT2) / 26 MB (INT4) / 45 MB (Q4_K_M) / 74 MB (Q8_0) / 104 MB (FP16/BF16) | |
| --- | |
| ## π Official Links & Resources | |
| * **GitHub Repository**: [https://github.com/Asjad-Ilahi/danAI-55M](https://github.com/Asjad-Ilahi/danAI-55M) | |
| * **Hugging Face Hub**: [https://huggingface.co/asjadilahi/danAI-55M-Reasoning](https://huggingface.co/asjadilahi/danAI-55M-Reasoning) | |
| --- | |
| ## π Citation & License | |
| ```bibtex | |
| @misc{ilahi2026danai55m, | |
| author = {Asjad Ilahi}, | |
| title = {danAI-55M-Reasoning: Ultra-Lightweight Agentic and Reasoning Language Model}, | |
| year = {2026}, | |
| publisher = {Hugging Face}, | |
| howpublished = {\url{https://huggingface.co/asjadilahi/danAI-55M-Reasoning}} | |
| } | |
| ``` | |
| * **License**: Apache 2.0 (Open-source, commercial use permitted) | |
| * **Author**: Asjad Ilahi ([@asjadilahi](https://huggingface.co/asjadilahi)) | |