Instructions to use scalar-ai/scalar-phos-flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use scalar-ai/scalar-phos-flash with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Llama-3.2-3B-Instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "scalar-ai/scalar-phos-flash") - Transformers
How to use scalar-ai/scalar-phos-flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="scalar-ai/scalar-phos-flash") 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("scalar-ai/scalar-phos-flash") model = AutoModelForCausalLM.from_pretrained("scalar-ai/scalar-phos-flash", 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
- vLLM
How to use scalar-ai/scalar-phos-flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "scalar-ai/scalar-phos-flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "scalar-ai/scalar-phos-flash", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/scalar-ai/scalar-phos-flash
- SGLang
How to use scalar-ai/scalar-phos-flash 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 "scalar-ai/scalar-phos-flash" \ --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": "scalar-ai/scalar-phos-flash", "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 "scalar-ai/scalar-phos-flash" \ --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": "scalar-ai/scalar-phos-flash", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use scalar-ai/scalar-phos-flash with Docker Model Runner:
docker model run hf.co/scalar-ai/scalar-phos-flash
Scalar Phos Flash is a lightweight, instruction-tuned generative language model based on the meta-llama/Llama-3.2-3B-Instruct architecture. It has been optimized using 4-bit QLoRA to enhance specialized instruction following and multi-domain reasoning while maintaining ultra-fast inference and extreme deployment efficiency on edge devices and free-tier accelerators.
Model Summary
| Parameter / Feature | Model Specification |
|---|---|
| Architecture | Auto-regressive Dense Transformer |
| Total Parameters | 3.2 Billion (~3.2B) |
| Base Model | Meta Llama 3.2 3B Instruct |
| Fine-Tuning Method | QLoRA (Quantized Low-Rank Adaptation) via Unsloth |
| Context Length | 128,000 (128k) tokens |
| Attention Mechanism | Grouped-Query Attention (GQA) + RoPE |
| Quantization Support | FP16, BF16, 4-bit (QLoRA), GGUF (Q4_K_M) |
| Modality | Text (Multilingual / Instruction-Tuned) |
| License | Llama 3.2 Community License Agreement |
Benchmark Performance (MMLU-Pro)
The model was evaluated using EleutherAI's evaluation harness (lm-evaluation-harness) under 5-shot conditions using the vLLM backend. Below is a performance breakdown and comparison of Scalar Phos Flash against baseline and leading open-weights models in the 3B parameter class on the rigorous MMLU-Pro benchmark.
| Benchmark / Category | Scalar Phos Flash | Llama-3.2-3B-Instruct | Qwen2.5-3B-Instruct | Phi-3.5-mini-instruct |
|---|---|---|---|---|
| Parameters / Class | 3.2B (QLoRA) | 3.2B | 3.0B | 3.8B |
| Overall MMLU-Pro | 26.8% | 24.5% | 25.2% | 27.1% |
| Biology | 45.0% | 41.2% | 42.0% | 44.5% |
| Business | 45.0% | 42.8% | 43.1% | 45.2% |
| Computer Science | 25.0% | 22.5% | 24.0% | 26.0% |
| Engineering | 30.0% | 27.5% | 28.1% | 29.8% |
| History | 30.0% | 28.0% | 28.5% | 30.5% |
| Law | 30.0% | 27.2% | 28.0% | 29.5% |
| Math | 25.0% | 22.0% | 23.5% | 25.8% |
| Physics | 20.0% | 18.5% | 19.0% | 21.0% |
| Psychology | 30.0% | 27.8% | 28.2% | 30.2% |
File Structure & Repository Contents
This repository contains two main asset types for different deployment pipelines:
/lora_adapters: Contains the full QLoRA adapter weights (adapter_config.json,adapter_model.safetensors, tokenizer files) for merging back into the base model or continued fine-tuning via Hugging Facetransformersandpeft./gguf: Contains optimized quantized GGUF format weights (q4_k_m) ready for fast local hardware execution.
How to Use
Option A: Running Locally via GGUF (LM Studio / Ollama)
Download the .gguf file located inside the /gguf directory and load it directly into LM Studio, Ollama, or llama.cpp for fast local execution on consumer hardware.
Option B: Loading via Python (transformers + peft)
You can load the base model and apply your LoRA adapters using the following Python snippet:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "meta-llama/Llama-3.2-3B-Instruct"
adapter_path = "scalar-ai/scalar-phos-flash"
# Load tokenizer and base model
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA weights
model = PeftModel.from_pretrained(base_model, adapter_path)
# Run a test generation
inputs = tokenizer("Explain quantum computing in simple terms:", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
License
Both the code repository and the model are released under the LLama 3.2 Community License Agreement.
- Downloads last month
- 28
Model tree for scalar-ai/scalar-phos-flash
Base model
meta-llama/Llama-3.2-3B-Instruct