CoolFace
Modelpublic

169Pi/Alpie-Core

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
9likes62downloads
README.md448 linesDownload Raw Back to root
1---2tags:3- text-generation4- reasoning5- coding6- mathematics7- quantization8- 4-bit model9- state-of-the-art10license: apache-2.011datasets:12- synthetic13base_model: deepseek-ai/DeepSeek-R1-Distill-Qwen-32B14language:15- en16- hi17library_name: transformers18pipeline_tag: text-generation19---20 21# Alpie Core: 4-bit Quantized Reasoning Model22 23<p align="center">24  <a href="https://169pi.ai/"><img src="https://img.shields.io/badge/๐ŸŒ%20Website-169Pi%20AI-blue" alt="Website"></a>25  <a href="https://huggingface.co/169Pi"><img src="https://img.shields.io/badge/๐Ÿค—%20Hugging%20Face-169Pi%20AI-yellow" alt="Hugging Face"></a>26  <a href="https://pypi.org/project/pi169/0.1/"><img src="https://img.shields.io/badge/PyPI-pi169-blue" alt="PyPI"></a>27  <a href="https://www.linkedin.com/company/169pi/"><img src="https://img.shields.io/badge/LinkedIn-169Pi%20AI-blue" alt="LinkedIn"></a>28  <a href="https://x.com/169Pi_ai"><img src="https://img.shields.io/badge/X-169Pi%20AI-black" alt="X"></a>29</p>30 31##  TL;DR32 33- **32B reasoning model**, trained & served at **4-bit quantization**34- **Competitive with GPT-4o / Claude 3.5 Sonnet** on reasoning & coding benchmarks35- **65K context length** for long-document reasoning36- **Open source** (Apache 2.0) - fully permissive for commercial use37- Available via **Ollama**, **Hugging Face**, and **hosted API** with 5M free tokens38 39๐Ÿ“„ **[Technical Report: Alpie Core.pdf](./Alpie_Core.pdf)**40 41---42 43## How to Use Alpie Core44 45### Option 1: Local Inference with Ollama (Recommended for Quick Start)46 47```bash48# Pull the model (20GB)49ollama pull 169pi/alpie-core50 51# Run inference52ollama run 169pi/alpie-core53```54 55**Requirements**: 20GB RAM/VRAM minimum56 57### Option 2: Hosted Inference via 169Pi API58 59Get started instantly with our **hosted API** - no setup required!60 61 **Get your first free API key** including **5 million tokens** to test real workloads62 63- **OpenAI-compatible** - drop-in replacement for OpenAI SDK64- Supports **streaming**, **async**, and **long-context reasoning**65- Production-ready with low latency66 67 **[Get your API key at 169pi.ai](https://169pi.ai/)**68 69### Option 3: Programmatic Access with Python SDK70 71```bash72# Install the official SDK73pip install pi16974 75# Set your API key76export ALPIE_API_KEY="your_key_here"77 78# Use via CLI79pi169 "Explain quantum entanglement"80 81# Or use in Python82from pi169 import AlpieClient83 84client = AlpieClient(api_key="your_key_here")85response = client.chat.completions.create(86    model="alpie-core",87    messages=[{"role": "user", "content": "Solve this coding problem..."}],88    stream=True89)90```91 92**SDK Features**: Streaming, async/await, OpenAI compatibility, type-safe interface93 94### Option 4: Load Directly with Transformers (Advanced)95 96```python97from transformers import AutoModelForCausalLM, AutoTokenizer98from peft import PeftModel, PeftConfig99import torch100 101# Load LoRA adapter configuration102peft_model_id = "169Pi/Alpie-Core"103config = PeftConfig.from_pretrained(peft_model_id)104 105# Load base model + LoRA weights106base_model = AutoModelForCausalLM.from_pretrained(107    config.base_model_name_or_path,108    torch_dtype=torch.float16,109    device_map="auto"110)111tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)112model = PeftModel.from_pretrained(base_model, peft_model_id)113 114# Inference115prompt = "Solve: What is the integral of x^2?"116inputs = tokenizer(prompt, return_tensors="pt").to(model.device)117outputs = model.generate(**inputs, max_new_tokens=1000)118print(tokenizer.decode(outputs[0], skip_special_tokens=True))119```120 121---122 123##  Why Alpie Core?124 125**Alpie Core is one of the first fine-tuned 4-bit reasoning models from India, and among the first worldwide at this scale.** Trained on just 8 Hopper GPUs using LoRA and QLoRA 4-bit quantization with synthetic STEM-rich datasets, it proves that aggressive quantization can match and even surpass full-precision baselines.126 127With a dramatically reduced memory footprint, Alpie Core delivers competitive, frontier-level reasoning performance, even beating top proprietary models. It achieves:128 129- **81.28% on MMLU** (5-shot)130- **92.75% on GSM8K** (8-shot)  131- **57.8% on SWE-Bench Verified** 132 133This demonstrates that efficient models can rival frontier systems while remaining practical for real-world deployment at scale.134 135![Bench](https://cdn-uploads.huggingface.co/production/uploads/66e2f8a815879154e1f9e023/i2SOWOOHdsTx5RajIkyrE.png)136 137---138 139## Model Summary140 141- **Base Architecture**: DeepSeek-R1-Distill-Qwen-32B142- **Parameters**: 32 billion (quantized to 4-bit)143- **Training Method**: Supervised Fine-Tuning (SFT) using LoRA/QLoRA144- **Quantization**: 4-bit NF4 with double quantization145- **Context Length**: 65k tokens146- **Max Output Length**: 16,384 tokens147- **Training Data**: Synthetic (STEM, reasoning, coding) + curated data (law, Indian context, exams, multilingual)148- **License**: Apache 2.0149 150---151 152##  Approach153 154**Alpie Core** underwent extensive **supervised fine-tuning (SFT)** to strengthen reasoning, robustness, and safety. The training leveraged a diverse mixture of curated open-source datasets and proprietary synthetic data, optimized with high-quality LLM-generated responses. The fine-tuning process emphasized:155 1561. **User Understanding and Clarity** โ€“ ensuring outputs are direct, interpretable, and pedagogically sound1572. **Security and Ethical Guidelines** โ€“ filtering unsafe or harmful generations1583. **Limitations and Knowledge Boundaries** โ€“ transparently communicating uncertainty1594. **Handling Complex and Sensitive Topics** โ€“ balancing informativeness with responsible guardrails1605. **Safety and Respectful Engagement** โ€“ maintaining politeness, inclusivity, and cultural sensitivity1616. **Confidentiality and Responsible Use** โ€“ preventing leakage of private data or internal reasoning traces162 163This approach enables Alpie Core to deliver reliable, aligned, and context-aware responses while maintaining safety across a broad range of use cases, generalizing across global and Indian contexts.164 165---166 167##  Model Features168 1691.  **Supports Streaming** โ€“ Real-time token-level responses1702.  **OpenAI-Compatible API** โ€“ Seamless integration with OpenAI client libraries1713.  **65K Context Length** โ€“ Handles very large inputs and conversations1724.  **16,384 Max Output Length** โ€“ Enables extremely long generations1735.  **4-Bit Quantization** โ€“ Memory-efficient and optimized for deployment1746.  **High Throughput Inference** โ€“ Powered by vLLM for efficient large-scale serving1757.  **Low Latency Inference** โ€“ Fast response times optimized for production1768.  **Customizable Safety & Moderation** โ€“ Built-in guardrails for safer outputs1779.  **Supports Function Calling / Tool Use** โ€“ Structured outputs and external API integration17810. **Instruction Following** โ€“ Optimized for reasoning and chain-of-thought answers17911. **Education & Research Ready** โ€“ Tailored for competitive exams, STEM reasoning, and knowledge tasks180 181---182 183##  Key Highlights184 1851. **First 4-bit Reasoning Model from India**: Competitive globally with frontier models1862. **Benchmark Competitiveness**: Outperforms or matches 70B+ models across reasoning, math, and coding1873. **STEM & Coding Strength**: Excellent on GSM8K, MATH-500, HumanEval, SWE-Bench Verified1884. **Efficiency & Deployment**: 16 GB VRAM footprint, runs on commodity GPUs1895. **Extended Context Length**: 65K tokens for research papers, multi-document reasoning1906. **Environmental Benefits**: ~298โ€“835 kg COโ‚‚e, 2โ€“3ร— more efficient than FP16 training1917. **Open-Source Commitment**: Released under Apache 2.0 for global use192 193---194 195## Benchmark Results196 197![Combined Benchmark](combined_benchmark.png)198 199### Core Benchmarks200 201| Benchmark | Alpie Core (32B-4bit) | DeepSeek-V2 (236B) | Qwen2.5 72B | Llama 3.1 405B | Llama 3.1 70B | Gemma-3 27B-PT | Mistral-Small-24B |202|-----------|----------------------|-------------------|-------------|---------------|---------------|----------------|-------------------|203| MMLU (5-shot) | **81.28%** | 78.4% | 85.0% | 84.4% | 79.3% | 78.6% | 80.73% |204| GSM8K (8-shot) | **92.75%** | 81.6% | 88.3% | 83.5% | - | 82.2% | 80.73% |205| BBH (3-shot) | **85.12%** | 78.8% | 79.8% | 82.9% | 81.6% | 77.7% | - |206| MMLU-Pro (5-shot) | **64.78%** | 51.4% | 58.3% | 52.8% | 53.8% | 52.2% | 54.37% |207| MBPP (pass@1) | **75.20%** | 65.0% | 72.6% | 68.4% | - | 65.6% | 69.64% |208| HumanEval (pass@1) | **57.23%** | 43.3% | 53.0% | 54.9% | - | 48.8% | - |209 210### SWE-Bench Verified Performance211 212| Rank | Model | Accuracy (%) | vs Alpie |213|------|-------|-------------|----------|214| **1** | **Alpie Core** | **57.8** | **โ€”** |215| 2 | Qwen3-Coder-30B-A3B-Instruct | 51.6 | -6.2% |216| 3 | o1 | 48.9 | -8.9% |217| 4 | o3-mini (high) | 49.3 | -8.5% |218| 5 | Claude 3.5 Sonnet | 49.0 | -8.8% |219| 6 | DeepSeek R1 | 49.2 | -8.6% |220| 7 | Devstral | 46.8 | -11.0% |221 222### Humanity's Last Exam Leaderboard223 224| Rank | Model | Accuracy (%) | vs Alpie |225|------|-------|-------------|----------|226| 1 | GPT 4.5 Preview | 5.8 | +0.39% |227| 2 | Claude Sonnet 4 | 5.42 | +0.01% |228| **3** | **Alpie Core 32B (4-bit)** | **5.41** | **โ€”** |229| 4 | Llama 4 Maverik | 5.34 | -0.07% |230| 5 | GPT 4.1 | 4.97 | -0.44% |231| 6 | Kimi K2 Instruct | 4.68 | -0.73% |232| 7 | DeepSeek V3 | 4.55 | -0.86% |233 234![Humanity's Last Exam](HLE.png)235 236### Additional Benchmarks237 238| Benchmark | Alpie Core | Category |239|-----------|-----------|----------|240| AIME | **47.34%** | Advanced Mathematics |241| GPQA (Diamond) | **40.91%** | Graduate-level QA |242| TruthfulQA (MC2) | **60.05%** | Truthfulness |243| HellaSwag | **84.66%** | Commonsense |244| PIQA | **83.24%** | Physical Reasoning |245| ARC Challenge | **67.58%** | Science QA |246| CommonSenseQA | **87.06%** | Commonsense |247| AGIEval | **64.98%** | General Intelligence |248| Winogrande | **79.53%** | Commonsense Reasoning |249| MATH-500 | **70.00%** | Advanced Mathematics |250 251![AIME Benchmark](AIME.png)252 253---254 255## Training Details256 257- **Hardware**: 8ร— NVIDIA H100-80GB GPUs258- **Fine-tuning Method**: LoRA/QLoRA259  - LoRA Alpha: 16260  - LoRA Dropout: 0.05261  - LoRA Rank: 16262- **Quantization**: 4-bit NF4 + Double Quantization + FP16 compute263- **Dataset Domains**: Mathematics, coding, reasoning, science, competitive exams, Indian context + law, multilingual (Hindi/Hinglish)264- **Synthetic Data Advantage**: +15-20% performance boost in STEM & coding265- **Training Strategy**: Multi-stage distillation โ†’ SFT โ†’ safety alignment266- **Total Training Time**: 408 hours267 268---269 270## Environmental Impact271 272![Carbon Footprint](carbon_footprint.png)273 274We estimated the carbon footprint of training Alpie Core on 8ร— NVIDIA H100-80GB GPUs:275 276**Formula**: COโ‚‚e (kg) = Grid COโ‚‚ Factor ร— Runtime ร— Power per GPU ร— Number of GPUs277 278**Training Parameters**:279- Grid COโ‚‚ Factor (Azure): 0.364 kg COโ‚‚e/kWh280- Runtime: 408 hours281- GPUs: 8ร— H100-80GB282 283**Results**:284- **Realistic mode** (250W avg per GPU): **~298 kg COโ‚‚e**285- **Conservative mode** (700W TDP per GPU): **~835 kg COโ‚‚e**286 287*This makes Alpie Core one of the most carbon-efficient reasoning models released to date.*288 289---290 291## Use Cases292 293Best for **STEM**, **complex mathematical reasoning**, **coding**, and **Indian context**294 2951. **STEM Education**: Advanced problem-solving in science, technology, engineering, mathematics2962. **Mathematical Reasoning**: Multi-step logical and quantitative reasoning2973. **Software Development**: Code generation, debugging, algorithmic problem-solving2984. **Indian Context**: Competitive exam assistance (JEE, NEET, UPSC), Hindi/Hinglish support2995. **Research & Legal**: 65K context for academic papers, legal documents, long-form analysis300 301---302 303## Safety and Limitations304 305### Enhanced Content Access306 307Unlike the base DeepSeek model, Alpie Core provides factual, balanced responses to geopolitically sensitive questions, offering global accessibility on topics like Taiwan's status, Arunachal Pradesh sovereignty, and other sensitive issues.308 309### Current Limitations310 311- Multilingual reasoning in Hindi/Hinglish shows room for improvement312- Fixed knowledge cutoff without real-time information retrieval313- Occasional struggles with complex multi-hop mathematical reasoning314- Potential hallucinations in factual question-answering315- Should not be used for medical/legal advice without expert oversight316 317### Mitigations318 319- Safety classifiers and output filtering systems320- Model-assisted safety pipeline using RLHF321- Comprehensive adversarial testing by domain experts322 323---324 325## Python SDK Quick Start326 327```bash328# Install329pip install pi169330 331# Set API key332export ALPIE_API_KEY="your_key_here"333 334# CLI usage335pi169 "Explain 4-bit quantization"336```337 338### SDK Features339 340- **CLI Integration** for quick interactions341- **Streaming & Non-Streaming** completions342- **Async/Await Support** for concurrent requests343- **Type-safe Interface** with dataclasses344- **Robust Error Handling**345- **OpenAI-Compatible**: Drop-in replacement346 347[Full SDK documentation on PyPI](https://pypi.org/project/pi169/0.1/)348 349---350 351## Advanced Usage Examples352 353### Streaming Inference with Transformers354 355```python356from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer357from peft import PeftModel, PeftConfig358import torch359 360peft_model_id = "169Pi/Alpie-Core"361config = PeftConfig.from_pretrained(peft_model_id)362 363base_model = AutoModelForCausalLM.from_pretrained(364    config.base_model_name_or_path,365    torch_dtype=torch.float16,366    device_map="auto"367)368 369tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)370model = PeftModel.from_pretrained(base_model, peft_model_id)371model.eval()372 373streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)374 375prompt = "Explain the P vs NP problem"376inputs = tokenizer(prompt, return_tensors="pt").to(model.device)377 378print("Streaming Response:")379with torch.no_grad():380    outputs = model.generate(381        **inputs,382        max_new_tokens=1000,383        streamer=streamer,384        do_sample=True,385        temperature=0.7,386        top_p=0.9387    )388```389 390### Deployment Options391 392- **Transformers**: Python, PyTorch integration393- **vLLM**: High-throughput inference server394- **Ollama**: Easy local deployment (20GB model size)395- **169Pi API**: Production-ready hosted inference396 397---398 399## Citation400 401```bibtex402@misc{169pi2025alpiecore,403  title     = {Alpie-Core: A 4-Bit Quantized Reasoning Model from India that Outperforms Full-Precision Models},404  author    = {169Pi AI},405  year      = {2025},406  url       = {https://huggingface.co/169Pi/Alpie-Core}407}408```409 410---411 412## Community & Contributions413 414Released under Apache 2.0 - we welcome the community to build, extend, and improve!415 4161. **Issues & Discussions**: Report bugs or suggest features on Hugging Face4172. **Contributions**: Pull requests welcome for improvements4183. **Share Results**: Post your fine-tuning experiments and benchmarks4194. **Collaborate**: Join us in shaping the future of efficient AI420 421---422 423## License424 425**Apache 2.0 License** โ€“ Permissive for research and commercial use426 427---428 429## Acknowledgements430 431Thanks to **DeepSeek** for the original model foundation. We also acknowledge:432 433- **Hugging Face** ecosystem (Transformers, PEFT, vLLM, bitsandbytes)434- Open-source datasets (MMLU, GSM8K, SWE-Bench, etc.)435- Cloud infrastructure providers436- The broader AI research community437 438---439 440## Contact441 442**Technical Support**: support@169pi.com443 444---445 446*Alpie Core represents a milestone for open-source AI from India, demonstrating that 4-bit reasoning models can rival frontier-scale systems. We hope this release empowers developers, researchers, and organizations worldwide to build more efficient, inclusive, and impactful AI.*447 448**Get started today with 5 million free tokens at [169pi.ai](https://169pi.ai/)**