HuggingFaceFW/fineweb-edu
Viewer • Updated • 3.5B • 359k • 1.27k
How to use vedantjadhav701/SparkAI-47m-llama-instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="vedantjadhav701/SparkAI-47m-llama-instruct")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("vedantjadhav701/SparkAI-47m-llama-instruct")
model = AutoModelForCausalLM.from_pretrained("vedantjadhav701/SparkAI-47m-llama-instruct", 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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use vedantjadhav701/SparkAI-47m-llama-instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "vedantjadhav701/SparkAI-47m-llama-instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "vedantjadhav701/SparkAI-47m-llama-instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/vedantjadhav701/SparkAI-47m-llama-instruct
How to use vedantjadhav701/SparkAI-47m-llama-instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "vedantjadhav701/SparkAI-47m-llama-instruct" \
--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": "vedantjadhav701/SparkAI-47m-llama-instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "vedantjadhav701/SparkAI-47m-llama-instruct" \
--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": "vedantjadhav701/SparkAI-47m-llama-instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use vedantjadhav701/SparkAI-47m-llama-instruct with Docker Model Runner:
docker model run hf.co/vedantjadhav701/SparkAI-47m-llama-instruct
Instruction-tuned checkpoint of SparkAI-47M-Llama (~48M parameter decoder-only transformer), fine-tuned for chat and instruction following.
🌟 Key Highlights & Unique Features
- ⚡ Ultra-Low Memory Footprint (~95.4 MB): Fits in under 100MB of RAM, making it suitable for edge devices, mobile apps, WebGPU, and microcontrollers.
- 🏋️ Data-Saturated Pretraining (10 Billion Tokens): Pretrained on 10B tokens (210 tokens/param) of high-quality FineWeb-Edu + Cosmopedia-v2 text, providing an empirical benchmark on capacity saturation for sub-50M models.
- 🏗️ Modern LLaMA 3 Architecture: Built with Grouped Query Attention (GQA), SwiGLU activations, RoPE positional encodings, RMSNorm pre-normalization, and tied embeddings.
- 💬 Full ChatML SFT Alignment: Fine-tuned with ChatML
<|im_start|>instruction formatting and template support (chat_template.jinja).
vedantjadhav701/SparkAI-47m-llama-10b-tokensample-100BT) + Cosmopedia-v2 (85% / 15% mix, 10.00B tokens)| Tokens | Perplexity |
|---|---|
| 630M | 43.49 |
| 3.77B | 31.30 |
| 7.00B | — |
| 10.00B | 31.46 |
Note on Saturation: Perplexity plateaued between 3.77B and 10.00B tokens despite continued training, indicating the model has saturated its representational capacity at this size.
| Feature | Typical Sub-50M Models | SparkAI-47M-Llama / Instruct |
|---|---|---|
| Token Budget | ~1B – 2B tokens | 10.00 Billion Tokens (210 tokens/param) |
| Data Quality | Raw web text / C4 | FineWeb-Edu (85%) + Cosmopedia-v2 (15%) |
| Architecture | Basic MHA / GPT-2 style | Modern LLaMA 3 (GQA, SwiGLU, RoPE, RMSNorm) |
| Model Size | ~100MB – 200MB | ~95.4 MB (model.safetensors) |
| SFT Alignment | Rare / None | Instruction-tuned with ChatML (chat_template.jinja) |
| Benchmarking | Few metrics | Empirical capacity saturation documented at 10B tokens |
transformers
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "vedantjadhav701/SparkAI-47m-llama-instruct"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForCausalLM.from_pretrained(repo_id)
messages = [
{"role": "user", "content": "What is a computer program?"}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=80, do_sample=True, temperature=0.6)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
pip install -r requirements.txt
python app.py
Open http://127.0.0.1:7860 in your web browser.
Base model
vedantjadhav701/SparkAI-47m-llama-10b-token