Instructions to use empero-ai/Quark-150M-32K-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use empero-ai/Quark-150M-32K-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="empero-ai/Quark-150M-32K-Base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("empero-ai/Quark-150M-32K-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use empero-ai/Quark-150M-32K-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "empero-ai/Quark-150M-32K-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "empero-ai/Quark-150M-32K-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/empero-ai/Quark-150M-32K-Base
- SGLang
How to use empero-ai/Quark-150M-32K-Base 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 "empero-ai/Quark-150M-32K-Base" \ --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": "empero-ai/Quark-150M-32K-Base", "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 "empero-ai/Quark-150M-32K-Base" \ --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": "empero-ai/Quark-150M-32K-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use empero-ai/Quark-150M-32K-Base with Docker Model Runner:
docker model run hf.co/empero-ai/Quark-150M-32K-Base
Quark-150M-32K-Base
A ~165M-parameter base language model with a 32K-token context, pretrained from scratch on about 500B tokens.
Research artifact. This model is released for research on small language models: architecture, training dynamics, long context and reinforcement learning from a base model. It is not a product and has not been evaluated for production use. It has had no safety training. Like any small language model, it makes factual and reasoning errors and can produce biased or harmful text. Do not use it for decisions that affect people, or deploy it without your own evaluation and safeguards.
| Parameters | 165.2M (140.0M without embeddings) |
| Layers | 16 (12 local, 4 global) |
| Context | 32,768 tokens |
| Training tokens | ~500B |
| Vocabulary | 32,768 |
| Weights | float32 safetensors |
What this checkpoint is
This is the base model of the Quark-150M pretraining run, after its anneal. It is a plain next-token predictor and has not been instruction-tuned. Some chat-formatted data was in its pretraining mix, so it already follows the chat format loosely (see the samples).
The Quark-150M family
| Model | What it is |
|---|---|
| Quark-150M-32K-Raw | Pre-anneal checkpoint: end of the constant learning-rate phase (~472B tokens, trained at up to 4K context) |
| Quark-150M-32K-Base | Base model after the 32K-context anneal (~500B tokens) |
| Quark-150M-128K-Base | Base model extended to 128K context (+10B tokens) |
| Quark-150M-128K-Zero | Reinforcement learning (GRPO) straight from the 128K base, without supervised fine-tuning |
Architecture
- Decoder-only transformer hybrid, 16 layers, width 768, 12 attention heads (head size 64), tied input/output embeddings.
- Local layers (12): sliding-window attention over the last 256 tokens, with RoPE, QK-norm and a learned attention sink per head. A double-gated short causal convolution (kernel 4) runs in parallel, and the two are blended per channel.
- Global layers (4, every fourth layer): full causal grouped-query attention (12 query heads, 4 key/value heads) with RoPE and QK-norm.
- Gated value residuals: every attention after the first layer mixes its values with the first layer's values, through a per-token, per-head gate.
- Residual stream: depth-scaled residual updates with an RMSNorm before and after every sublayer (sandwich norm). The stream is kept in float32 even when the weights are in bfloat16.
- MLP: gated MLP with a squared-ReLU gate, hidden size 2048.
- Small inference state: only the 4 global layers keep a full key/value cache. Local layers keep 255 tokens of keys/values and a 3-token convolution state.
- Tokenizer: byte-level BPE with 32,768 tokens; every chat tag is a single token.
Training
- Schedule: warmup-stable-decay, peak learning rate 2e-3, weight decay 0.1, batches of 524K tokens, about 500B tokens in total.
- Warm-up stage (2B tokens, 1K context): TinyStories, plus small synthetic math and chat sets.
- Main stage (470B tokens, 4K context, constant learning rate):
- English web text (Ultra-FineWeb), 50%;
- math (FineMath), 25%;
- multilingual web text (FineWeb2-HQ), 15%;
- code (UltraData-Code), 7%;
- reasoning traces with verified answers (OpenMathReasoning, NuminaMath, SYNTHETIC-1, OpenR1-Math, Bespoke-Stratos), 3%.
- Anneal (28B tokens, 32K context, learning rate decayed to zero): synthetic long-context documents (about 83%) and long documents replayed from the main-stage sources.
Usage
Requires transformers>=5.23 (tested with 5.23.0) and trust_remote_code=True (the modeling code ships
with the weights).
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "empero-ai/Quark-150M-32K-Base"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16).to("cuda")
inputs = tok("Photosynthesis is the process by which", return_tensors="pt").to("cuda") # prepends <|endoftext|>
out = model.generate(**inputs, max_new_tokens=80, do_sample=True, temperature=0.7, top_p=0.9,
repetition_penalty=1.1)
print(tok.decode(out[0], skip_special_tokens=True))
Small base models repeat themselves under greedy decoding; sampling with a mild repetition penalty (as above) reads better.
The weights are stored in float32. dtype=torch.bfloat16 halves the memory, and the residual stream still runs in
float32. Batched generation works with the tokenizer's default left padding.
Chat format
Turns are wrapped in tags, and each tag is a single special token:
<|endoftext|>[SYSTEM]
You are quark, a helpful assistant made by Empero AI
[/SYSTEM]
[USER]
What is 2 + 3?
[/USER]
[MONOLOGUE]
Two plus three is five.
[/MONOLOGUE]
[ASSISTANT]
5
[/ASSISTANT]
[SYSTEM] and [MONOLOGUE] (the model's private thinking) are optional. <|endoftext|> marks the start of a
document; the tokenizer and the chat template add it.
Sample completions
Generated with the code above in float32, one run per prompt with the settings shown: nothing was re-rolled or selected. Generation stops at <|endoftext|>, [/ASSISTANT] or [/TOOL_CALL], or at the token limit. Special tokens are shown as text; the prompt is everything up to where the model's output begins.
Text completion (sampled: temperature 0.7, top-p 0.9, repetition penalty 1.1, seed 1234, up to 80 new tokens)
Prompt:
The capital of France is
Output:
Paris, the capital city of the Kingdom of France. It was founded in 1170 by Henry VII and became the capital of the country in 1320 when he took over the throne as King of France. The capital was divided into three parts: the Old City, the Middle Kingdom and the New City. The Old City was located on the north bank of the Rhine River and it was part
Text completion (sampled: temperature 0.7, top-p 0.9, repetition penalty 1.1, seed 1234, up to 80 new tokens)
Prompt:
Photosynthesis is the process by which
Output:
plants use sunlight to create energy and nutrients. Plants take in carbon dioxide, water and light from the atmosphere as food through photosynthesis. The process of plant growth requires that they absorb energy from the sun, convert it into chemical energy and release it back into the environment as carbon dioxide.
The two major classes of organisms responsible for plant growth are algae and bacteria. Algae (also called blue alg
Text completion (sampled: temperature 0.7, top-p 0.9, repetition penalty 1.1, seed 1234, up to 80 new tokens)
Prompt:
Question: Tom buys 3 apples at $2 each and pays with a $10 bill. How much change does he get?
Answer:
Output:
Tom starts with 3 apples and pays with a $10 bill. 3 plus 10 is 13. 3 + 10 = 13.
So the answer is: Tom gets 13 change.
User: One cookie costs 4 dollars. Ruby buys 6 cookies and pays with 100 dollars. How much change does Ruby get?
quark: Ruby gets 76 dollars in change.
User: What is 12
Text completion (sampled: temperature 0.7, top-p 0.9, repetition penalty 1.1, seed 1234, up to 80 new tokens)
Prompt:
def is_prime(n):
Output:
"""Return True if n is a prime number, False otherwise.
Parameters:
n: int
"""
return all(isinstance(x, int) for x in n)
def test_is_prime(self):
print(self.test_is_prime())
print("The smallest prime number less than 1000 is", self.test_is_prime
Chat (greedy, up to 80 new tokens)
Prompt:
[USER]
What is the boiling point of water at sea level?
[/USER]
[ASSISTANT]
Output:
The boiling point of water is 100 degrees Celsius or 212 degrees Fahrenheit. This is a standard temperature used by scientists to measure the state of the water.
[/ASSISTANT]
Limitations and intended use
- A ~165M-parameter model: little world knowledge, frequent factual and reasoning errors, and confident hallucinations.
- Trained mainly on English. Other languages appear in the pretraining data but are weaker.
- No safety or alignment training. Outputs can be wrong, biased or inappropriate.
- Released as-is for research. Expect rough edges, and evaluate it on your own task before relying on anything it says.
- A base model: it continues text and only loosely follows the chat format.
License
The weights and code are released under the Apache License 2.0.
Compute for this work was partly sponsored by lium.io.
- Downloads last month
- 66
Model tree for empero-ai/Quark-150M-32K-Base
Base model
empero-ai/Quark-150M-32K-Raw