Instructions to use q-project/N-Q-26M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use q-project/N-Q-26M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="q-project/N-Q-26M", 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("q-project/N-Q-26M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use q-project/N-Q-26M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "q-project/N-Q-26M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "q-project/N-Q-26M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/q-project/N-Q-26M
- SGLang
How to use q-project/N-Q-26M 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 "q-project/N-Q-26M" \ --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": "q-project/N-Q-26M", "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 "q-project/N-Q-26M" \ --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": "q-project/N-Q-26M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use q-project/N-Q-26M with Docker Model Runner:
docker model run hf.co/q-project/N-Q-26M
N-Q-26M
A 26M-class Russian/English base model — mini Qwen3.8-Flash-Next, pretrained from scratch on one V100
This is a research release, not a product. A plain text-continuation model: grammatical Russian and English, confident tone, invented facts. For dialogue and exact tool calls use N-Q-26M-Chat.
Model summary
N-Q-26M is the base model of the smallest rung of N-Q, the Q Project's MiniMind-style ladder of small RU/EN models trained from scratch on a single 16GB V100. Architecture: a mini Qwen3.8-Flash-Next — Gated DeltaNet linear attention interleaved 3:1 with gated full attention, a 4-stream Gated Residual, and a hashed n-gram embedding — chosen over the ternary Q-164M design by a controlled ablation (see the chat model card for the table).
29.7M backbone parameters + 16.8M n-gram table (46.5M stored), 8,256-token RU+EN byte-level BPE, pretrained on
2.0B tokens in 6.6 hours (30,517 steps, 64×1024 tokens/step, WSD schedule, Muon + AdamW, torch.compile,
85k tokens/s). 5% of rows were dialogues and <CALC> circuit rows from step 1 (the Q-164M recipe), so even the base
model knows the chat and tool formats.
Results (final checkpoint, step 30,517)
| held-out set (never trained on) | loss | perplexity (this tokenizer) |
|---|---|---|
| FineWeb-Edu (EN) | 2.381 | 10.8 |
| Cultura-Ru-Edu (RU) | 2.651 | 14.2 |
| Russian Wikipedia | 2.323 | 10.2 |
Perplexities are per token of this 8,256-token tokenizer and are not comparable to models with other tokenizers. For scale: the same architecture after 0.5B tokens (ablation run) reached a mean loss of 2.616; 2.0B tokens bring it to 2.452.
Samples (temperature 0.7):
Москва — столица Московской области. Парк расположен в 35 км от Москвы… В годы Великой Отечественной войны город подвергся нападению…
Once upon a time, in ancient times, a small town called Polar, was located on the town of Benedict in Poland. In the 14th century…
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("q-project/N-Q-26M", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("q-project/N-Q-26M", trust_remote_code=True)
ids = tok("Москва — столица", return_tensors="pt")
out = model.generate(ids, max_new_tokens=80, temperature=0.7, top_p=0.9, stop_ids=(2,))
print(tok.decode(out[0], skip_special_tokens=True))
The model has its own generate() (recurrent Gated DeltaNet state + KV cache). Pass tokenizer=tok to switch on the
exact <CALC> circuits if you prompt it in the chat format.
Packed single-file format (model.qpack)
QPACK1 container (same format as Q-164M / Q-Omni): weights, config, tokenizer and a self-test in one mmap-friendly
file, 89 MiB vs 177 MiB safetensors. A folder or repo with model.qpack and no *.safetensors loads through
AutoModelForCausalLM.from_pretrained(..., trust_remote_code=True); python qpack.py --selftest model.qpack prints
SELFTEST 5/5. Matrices fp16, 1-D tensors fp32, n-gram hash tables exact int64.
Architecture
- 8 layers, pattern
LLLA×2: Gated DeltaNet (3 key / 6 value heads, dim 64, conv k=4) ×3, then gated attention (8 query / 2 KV heads, dim 64, zero-centred QK-norm, partial RoPE 25% θ=1e6, sigmoid output gate). - hidden 512, SwiGLU 512→704→512, Gated Residual with 4 residual streams, zero-centred RMSNorm, untied output head.
- Hashed 3-gram embedding (PLE) after layer 2: 16.8M parameters in prime-sized tables.
- Token layout: ids 0–8191 text (0
<pad>, 1<bos>, 2<eos>), 8192–8255 control tokens (<USER><MODEL><EOT><THINK><ETHINK><CALC><EQ><ECALC><NEED><QUOTE><SYSTEM>, reserved<R11>…<R63>).
Limitations
- Facts are frequently wrong; thin general knowledge; repetitive under greedy decoding. No safety tuning.
- Base model: no instruction following beyond the 5% dialogue rows it saw in pretraining.
- Research and education only.
License and data terms
Code and weights: Apache-2.0 (see LICENSE). Training data keeps its own terms — check before commercial use:
FineWeb-Edu (ODC-By 1.0), Cultura-Ru-Edu, Russian Wikipedia 20231101.ru (CC BY-SA / GFDL); dialogue/circuit rows
from SmolTalk, GrandMaster-PRO-MAX, saiga_scored and our own <CALC> corpus.
- Downloads last month
- -