danAI Logo

🧠 danAI-55M-Reasoning

An Ultra-Lightweight 54.5M Agentic & Reasoning Language Model for Edge Devices & Mobile Intelligence

Created by Asjad Ilahi (@asjadilahi)

License Parameters RAM Footprint Throughput


🌟 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 a tiny 104 MB RAM 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.


πŸ’Ž Core Strengths

  1. ⚑ Ultra-Low 104 MB RAM Footprint:
    • Runs smoothly on mobile chips, Apple Silicon, Raspberry Pi, and microcontrollers without requiring aggressive quantization.
  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% 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%

Note: Benchmarks reflect official published numbers from literature and model cards. "-" indicates metrics not explicitly published by the authors.


⚑ Key Architectural & Training Innovations

  • #1 in Direct Sub-100M Weight Class: Decisively beats Pythia-70M on ARC-Easy (+1.8%), ARC-Challenge (+7.1%), ARC-Avg (+4.4%), and MMLU (+2.3%) while having 22% fewer parameters.
  • Outperforms OpenAI GPT-2 Small (124M) 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.
  • 100% Exact Math & Live Search: Emits structured <tool_call> JSON blocks, enabling 100% accurate arithmetic calculations (123433 * 564332 = 69657191756) and live web data retrieval.
  • SLERP Manifold Fusion: Merged specialized reasoning and agentic manifolds via Spherical Linear Interpolation to eliminate multi-task capability interference.

πŸ› οΈ Training Process & Hardware

The model was trained in a hybrid multi-stage curriculum spanning roughly 2 days total:

  1. Initial Pre-training (Mac M1, 16GB RAM):
    • Bootstrapped and trained for up to 7,000–8,000 steps on Apple Silicon (mps) with micro-batching.
  2. Full-Scale Pre-training & SFT (NVIDIA RTX 4070 Super):
    • Shifted to an RTX 4070 Super for roughly 92,000 steps across a curated ~3 Billion token corpus of scientific textbooks, mathematics, coding, and clean conversational instructions.
  3. Spherical Linear Interpolation (SLERP Fusion):
    • Merged specialized reasoning and agentic manifolds to eliminate multi-task gradient interference.
  4. Final Targeted Alignment:
    • A gentle 1-epoch refinement on strict negative constraints ("always answer NO to X", format following) and <think> reasoning tags.

🎯 Intended Use

  • On-Device Edge Assistants: Embedded offline voice/text assistants for mobile phones, IoT appliances, and robotics.
  • Agentic Function Calling Workflows: Edge automation where the model routes math, device control, and web lookups to external APIs.
  • Local Code & Math Assistance: Compact assistant for arithmetic problem decomposition and Python script generation.

⚠️ Limitations

  1. Long-Form Creative Fiction:
    • Because danAI was trained on ~3B high-density instructional tokens rather than 1–2 Trillion tokens of fiction books, it is optimized for facts, reasoning, and tools rather than multi-chapter creative storytelling.
  2. Complex Multi-File Software Architectures:
    • Suitable for standalone algorithms, data structures, and Python functions; not intended for deep multi-file repository refactoring.
  3. Mental Multi-Digit Arithmetic Without Tools:
    • Like all sub-100M neural networks, exact multi-digit math requires invoking its built-in calculator tool.

πŸš€ Quickstart & Inference

1. Interactive Terminal Chat & Tool Runner (Auto-downloads weights)

# Clone repository
git clone https://github.com/Asjad-Ilahi/danAI-55M.git
cd danAI-55M

# Install dependencies
pip install torch safetensors huggingface-hub tokenizers

# Run interactive assistant (automatically pulls weights from Hugging Face)
python scripts/chat.py

2. Standalone Python Inference

import torch
from tokenizers import Tokenizer
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
from src.model.gpt import CausalLM
from src.utils.config import Config

device = "mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"

# Download / load weights and tokenizer directly from Hugging Face
weights_path = hf_hub_download(repo_id="asjadilahi/danAI-55M-Reasoning", filename="model.safetensors")
tok_path = hf_hub_download(repo_id="asjadilahi/danAI-55M-Reasoning", filename="tokenizer.json")

tokenizer = Tokenizer.from_file(tok_path)
config = Config.from_yaml("configs/model.yaml")
model = CausalLM(config.model)

weights = load_file(weights_path)
model.load_state_dict(weights, strict=False)
model.to(device).eval()

prompt = "System: You are danAI, a helpful and wise AI assistant.\n\nUser: If I have 10 mangoes and eat 3, how many are left?\n\nAssistant: "
input_ids = torch.tensor([tokenizer.encode(prompt).ids], dtype=torch.long, device=device)

with torch.no_grad():
    output = model(input_ids)

πŸ”— Official Links & Resources


πŸ“ 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)
  • Max Context Length: 2048 tokens
  • Memory Footprint: 104 MB (FP16/BF16)

πŸ“œ Citation & License

@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)
Downloads last month
220
Safetensors
Model size
54.5M params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support