Instructions to use iamabhayaditya/EfficientMath-AI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use iamabhayaditya/EfficientMath-AI with PEFT:
Task type is invalid.
- Transformers
How to use iamabhayaditya/EfficientMath-AI with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iamabhayaditya/EfficientMath-AI")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("iamabhayaditya/EfficientMath-AI") model = AutoModelForCausalLM.from_pretrained("iamabhayaditya/EfficientMath-AI") - llama-cpp-python
How to use iamabhayaditya/EfficientMath-AI with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="iamabhayaditya/EfficientMath-AI", filename="Meta-Llama-3.1-8B.Q4_K_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use iamabhayaditya/EfficientMath-AI with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf iamabhayaditya/EfficientMath-AI:Q4_K_M # Run inference directly in the terminal: llama-cli -hf iamabhayaditya/EfficientMath-AI:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf iamabhayaditya/EfficientMath-AI:Q4_K_M # Run inference directly in the terminal: llama-cli -hf iamabhayaditya/EfficientMath-AI: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 iamabhayaditya/EfficientMath-AI:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf iamabhayaditya/EfficientMath-AI: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 iamabhayaditya/EfficientMath-AI:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf iamabhayaditya/EfficientMath-AI:Q4_K_M
Use Docker
docker model run hf.co/iamabhayaditya/EfficientMath-AI:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use iamabhayaditya/EfficientMath-AI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iamabhayaditya/EfficientMath-AI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iamabhayaditya/EfficientMath-AI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/iamabhayaditya/EfficientMath-AI:Q4_K_M
- SGLang
How to use iamabhayaditya/EfficientMath-AI 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 "iamabhayaditya/EfficientMath-AI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iamabhayaditya/EfficientMath-AI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "iamabhayaditya/EfficientMath-AI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iamabhayaditya/EfficientMath-AI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use iamabhayaditya/EfficientMath-AI with Ollama:
ollama run hf.co/iamabhayaditya/EfficientMath-AI:Q4_K_M
- Unsloth Studio
How to use iamabhayaditya/EfficientMath-AI 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 iamabhayaditya/EfficientMath-AI 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 iamabhayaditya/EfficientMath-AI to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for iamabhayaditya/EfficientMath-AI to start chatting
- Docker Model Runner
How to use iamabhayaditya/EfficientMath-AI with Docker Model Runner:
docker model run hf.co/iamabhayaditya/EfficientMath-AI:Q4_K_M
- Lemonade
How to use iamabhayaditya/EfficientMath-AI with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull iamabhayaditya/EfficientMath-AI:Q4_K_M
Run and chat with the model
lemonade run user.EfficientMath-AI-Q4_K_M
List all available models
lemonade list
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,20 +1,67 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
- gguf
|
| 4 |
-
- llama.cpp
|
| 5 |
-
- unsloth
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
# EfficientMath-AI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: meta-llama/Meta-Llama-3.1-8B
|
| 3 |
+
library_name: peft
|
| 4 |
+
license: llama3.1
|
| 5 |
+
datasets:
|
| 6 |
+
- openai/gsm8k
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
metrics:
|
| 10 |
+
- accuracy
|
| 11 |
+
- perplexity
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
tags:
|
| 14 |
+
- gguf
|
| 15 |
+
- llama.cpp
|
| 16 |
+
- unsloth
|
| 17 |
+
- transformers
|
| 18 |
+
- math
|
| 19 |
+
- lora
|
| 20 |
+
- custom-instruction
|
| 21 |
---
|
| 22 |
|
| 23 |
+
# 🧮 EfficientMath-AI (Llama 3.1 8B)
|
| 24 |
+
|
| 25 |
+
## 📌 Project Overview
|
| 26 |
+
EfficientMath-AI is a parameter-efficient fine-tuned (PEFT) version of Meta's **Llama-3.1-8B**, specifically optimized to solve multi-step, grade-school math word problems. It was trained using LoRA (Low-Rank Adaptation) and compressed into a 4-bit quantized GGUF format, allowing it to perform high-level mathematical reasoning efficiently on standard CPU hardware.
|
| 27 |
+
|
| 28 |
+
**Creator:** Abhay Aditya
|
| 29 |
+
**Live Interactive Demo:** [EfficientMath-AI Web App](https://huggingface.co/spaces/iamabhayaditya/EfficientMath-AI)
|
| 30 |
+
|
| 31 |
+
## 🧠 Model Details
|
| 32 |
+
* **Base Model:** `meta-llama/Meta-Llama-3.1-8B`
|
| 33 |
+
* **Fine-Tuning Method:** LoRA (Rank = 16, Alpha = 16) via Unsloth
|
| 34 |
+
* **Dataset:** GSM8K (Grade School Math 8K)
|
| 35 |
+
* **Quantization:** `Q4_K_M` (4-bit GGUF)
|
| 36 |
+
* **Parameters:** 8 Billion
|
| 37 |
+
* **Deployment Context:** Designed for high-speed, CPU-only inference via `llama.cpp`.
|
| 38 |
+
|
| 39 |
+
## 📊 Evaluation & Performance
|
| 40 |
+
The model was evaluated against a rigorous test split of the GSM8K dataset, focusing on strict numeric extraction and step-by-step reasoning coherence.
|
| 41 |
+
* **Overall Accuracy:** 66%
|
| 42 |
+
* **Training Hardware:** Single NVIDIA T4 GPU (Free Tier)
|
| 43 |
+
* **Inference Hardware Requirement:** ~8GB RAM (Basic CPU)
|
| 44 |
+
|
| 45 |
+
### Diagnostic Insights:
|
| 46 |
+
1. **Perplexity:** The model exhibits a tightly clustered, low perplexity distribution (between 2.5 and 4.0), demonstrating high confidence and fluency in generating mathematical syntax.
|
| 47 |
+
2. **Complexity Ceiling:** The model achieves near 80% accuracy on short word problems, maintaining a concise and highly accurate "Chain of Thought" without hallucinating verbose responses. Like many 8B class models, accuracy scales inversely with prompt length on highly complex, multi-paragraph logic puzzles.
|
| 48 |
+
|
| 49 |
+
## 💻 Usage Example (Python)
|
| 50 |
+
If you wish to run this model locally, you can use `llama-cpp-python`:
|
| 51 |
|
| 52 |
+
```python
|
| 53 |
+
from llama_cpp import Llama
|
| 54 |
|
| 55 |
+
llm = Llama(
|
| 56 |
+
model_path="Meta-Llama-3.1-8B.Q4_K_M.gguf",
|
| 57 |
+
n_ctx=2048,
|
| 58 |
+
n_threads=4
|
| 59 |
+
)
|
| 60 |
|
| 61 |
+
output = llm(
|
| 62 |
+
"Below is a math word problem. Solve it step by step and provide the final answer.\n\n### Problem:\nIf the cost of 18 apples is 90 rupees, what is the cost of 24 apples?\n\n### Solution:\n",
|
| 63 |
+
max_tokens=256,
|
| 64 |
+
temperature=0.2,
|
| 65 |
+
stop=["<|eot_id|>"]
|
| 66 |
+
)
|
| 67 |
+
print(output["choices"][0]["text"])
|