Instructions to use cttyyyy/BLYAT-7-144M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cttyyyy/BLYAT-7-144M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cttyyyy/BLYAT-7-144M") 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("cttyyyy/BLYAT-7-144M") model = AutoModelForCausalLM.from_pretrained("cttyyyy/BLYAT-7-144M", 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 cttyyyy/BLYAT-7-144M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cttyyyy/BLYAT-7-144M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cttyyyy/BLYAT-7-144M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cttyyyy/BLYAT-7-144M
- SGLang
How to use cttyyyy/BLYAT-7-144M 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 "cttyyyy/BLYAT-7-144M" \ --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": "cttyyyy/BLYAT-7-144M", "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 "cttyyyy/BLYAT-7-144M" \ --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": "cttyyyy/BLYAT-7-144M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cttyyyy/BLYAT-7-144M with Docker Model Runner:
docker model run hf.co/cttyyyy/BLYAT-7-144M
BLYAT-7-144M
BLYAT 7 is a small (144M parameter) English-only chat language model that was trained completely from scratch (tokenizer, pretraining and fine-tuning) by an independent developer on a single GTX 1060 6GB. It is a hobby / learning project, published for transparency and experimentation. It is not a reliable assistant: it often states false things confidently.
Its one real strength is step-by-step arithmetic, thanks to a tokenizer in which every digit is its own token (see below).
Quick start
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "cttyyyy/BLYAT-7-144M"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo).eval()
messages = [{"role": "user", "content": "What is 347 plus 286?"}]
prompt = tok.apply_chat_template(messages, tokenize=False) # <bos><|user|>...<|end|><|assistant|>
ids = tok(prompt, add_special_tokens=False, return_tensors="pt")
out = model.generate(**ids) # greedy, stops at <|end|>
print(tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True))
Tips
generation_config.jsonis greedy withrepetition_penalty=1.0andno_repeat_ngram_size=10. Do not use a repetition penalty or short n-gram blocking for arithmetic: the working repeats+,=,xand digits on every line and a penalty corrupts it.- Prompt layout (identical to training):
<bos>[<|system|>text<|end|>]<|user|>text<|end|><|assistant|>; answers end with<|end|>. A system message is supported but was only seen in a few training examples. - Ask one self-contained question at a time. Multi-turn chats work for ordinary conversation, but arithmetic and identity answers get confused when they follow other questions. The context window is 1024 tokens. English only.
Model
| Architecture | decoder-only Transformer, Llama layout (RMSNorm, SwiGLU, rotary embeddings, tied embeddings, no biases) |
| Parameters | 144.3M (12 layers, 14 heads, hidden 896, MLP 2368, context 1024) |
| Tokenizer | custom 32,768-token byte-level BPE trained for this project (English); every digit 0-9 is a single token; 16 reserved special ids |
| Precision | float32 weights (model.safetensors, about 577 MB) |
The weights were converted from the original training format (fused qkv, interleaved rotary pairs) to the standard Llama layout. The conversion was verified numerically before publishing: logits match the original model and greedy generations are identical.
Training
- Pretraining from scratch - 90,000 steps x 32 sequences x 1024 tokens, about 2.95B tokens, on one GTX 1060 6GB (about 14 days), fp32, AdamW, peak learning rate 6e-4, linear decay to 6e-5. Data: FineWeb-Edu, Cosmopedia, a Python source corpus and Wikitext. Held-out FineWeb-Edu validation loss: about 3.08.
- Supervised fine-tuning, answer-only loss (loss only on the assistant text and its closing
<|end|>) in four rounds: general instruction/chat data (SmolTalk, Dolly, OASST English, Alpaca-cleaned), a hand-written identity set, small talk, real shell commands, "I don't know" answers for invented people, and synthetic step-by-step arithmetic.
How the arithmetic works
Small facts are answered directly. Larger problems are solved in written place-value steps that each need only a table fact or one simple add/subtract:
347 + 286: 347 + 200 = 547, then 547 + 80 = 627, then 627 + 6 = 633. So 347 plus 286 is 633.
47 x 23: 40 x 20 = 800, 40 x 3 = 120, 7 x 20 = 140, 7 x 3 = 21, 800 + 120 = 920, 920 + 140 = 1060, 1060 + 21 = 1081.
156 / 12: 12 x 10 = 120, 156 - 120 = 36, 12 x 1 = 12, 12 x 2 = 24, 12 x 3 = 36. So 156 divided by 12 is 13.
Arithmetic results (520 problems, greedy decoding, no repetition penalty)
| Category | Accuracy |
|---|---|
| 2-digit addition | 100% |
| 3-digit addition | 100% |
| 2-digit subtraction | 100% |
| 3-digit subtraction | 100% |
| 2-digit x 1-digit multiplication | 100% |
| 3-digit x 1-digit multiplication | 100% |
| 2-digit x 2-digit multiplication | 90% |
| word problems (add / subtract / multiply) | 100% |
| times table (1-12) | 100% |
| division table | 100% |
| which number is larger / smaller | 100% |
| Total | 516 / 520 (99.2%) |
The times-table and division-table items (80 of the 520) are small facts the model was trained on directly, so they measure recall.
The other categories were generated separately and checked to have no overlap with the training data.
Fresh problems tried by hand after training also worked (156 / 12, 7243 + 1958, 83 x 67, 99999 vs 100000), but not all:
1000 / 8 came out as 15 instead of 125 (quotients with a hundreds digit are rare in the training data).
Raw logs are in eval/.
Try it on Windows 11 (CPU only, no GPU needed)
Open PowerShell in an empty folder and run these blocks one after another. The first run downloads about 577 MB; each answer then takes a few seconds on a normal CPU.
- Install Python 3.12 or newer from python.org (tick "Add python.exe to PATH"), then open a new PowerShell window and check it:
python --version
- Create a virtual environment and install the libraries:
python -m venv .venv
Set-ExecutionPolicy -Scope Process Bypass
.\.venv\Scripts\Activate.ps1
pip install torch transformers
- Create the chat script (the
@'and'@lines must stay at the very start of their lines):
@'
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "cttyyyy/BLYAT-7-144M"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo).eval()
print("BLYAT 7 ready. One self-contained question at a time; an empty line quits.")
while True:
q = input("\nYou: ").strip()
if not q:
break
prompt = tok.apply_chat_template([{"role": "user", "content": q}], tokenize=False)
ids = tok(prompt, add_special_tokens=False, return_tensors="pt")
out = model.generate(**ids)
print("Blyat:", tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True))
'@ | Set-Content -Encoding utf8 chat.py
- Run it, and try "What is 347 plus 286?", "What is 156 divided by 12?" and "Who are you?":
python chat.py
Ask one self-contained question at a time (each is answered with no history). Next time, just run .\.venv\Scripts\Activate.ps1 and then python chat.py;
the model is cached after the first download. The same Python script works on Linux and macOS; only the activation command differs.
What it can and cannot do
Works reasonably: greetings and small talk, short explanations, short Python snippets (right shape, sometimes a wrong detail), common shell commands, arithmetic as above, saying it does not know about made-up people, saying what it is.
Does not work: facts (it still invents or confuses authors, plots and commands - for example it answers "Shakespeare" for Don Quixote), long answers (they drift and repeat; a short poem loops), multi-step reasoning, other languages, long multi-turn conversations, anything where being wrong matters.
Limitations, bias and intended use
- Trained on web text and model-generated chat data, so it can repeat inaccurate, biased or offensive content.
- Intended for learning, experiments and as a baseline for small-model research. Not for production, advice, or anything safety-relevant.
Data and licenses
This model is released under CC BY-NC 4.0 (non-commercial) because the fine-tuning data is mixed:
| Data | License / note |
|---|---|
| FineWeb-Edu | ODC-By 1.0 |
| Cosmopedia | see the dataset card; synthetic text generated by another language model |
| Wikitext | CC BY-SA 3.0 |
| Python source corpus | Source and license not recorded (assembled for earlier BLYAT experiments); treated as unverified. |
| SmolTalk (smol-smoltalk) | see the dataset card; parts are generated by other language models |
| Databricks Dolly 15k | CC BY-SA 3.0 |
| OpenAssistant (OASST1) English | Apache 2.0 |
| Alpaca-cleaned | CC BY-NC 4.0; generated with OpenAI models, OpenAI terms apply |
| Identity, small-talk, shell, unknown-person and arithmetic sets | written / generated for this project |
This is a good-faith summary, not legal advice. Check the original dataset cards before reusing the weights commercially.
- Downloads last month
- 15