Text Generation
Transformers
Safetensors
English
llama
causal-lm
small-language-model
base-model
trained-from-scratch
tiny-model
text-generation-inference
Instructions to use BenjaminHelle/Matriisi-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BenjaminHelle/Matriisi-1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BenjaminHelle/Matriisi-1.0")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BenjaminHelle/Matriisi-1.0") model = AutoModelForCausalLM.from_pretrained("BenjaminHelle/Matriisi-1.0", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BenjaminHelle/Matriisi-1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BenjaminHelle/Matriisi-1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BenjaminHelle/Matriisi-1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BenjaminHelle/Matriisi-1.0
- SGLang
How to use BenjaminHelle/Matriisi-1.0 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 "BenjaminHelle/Matriisi-1.0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BenjaminHelle/Matriisi-1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "BenjaminHelle/Matriisi-1.0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BenjaminHelle/Matriisi-1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BenjaminHelle/Matriisi-1.0 with Docker Model Runner:
docker model run hf.co/BenjaminHelle/Matriisi-1.0
|
Download README.md from BenjaminHelle/Matriisi-1.0: direct link, hf CLI and curl.
- Browser
- Download file 5.27 kB
-
https://huggingface.co/BenjaminHelle/Matriisi-1.0/resolve/main/README.md
- Command line
-
hf download hf://BenjaminHelle/Matriisi-1.0/README.md
-
curl -L -o README.md https://huggingface.co/BenjaminHelle/Matriisi-1.0/resolve/main/README.md
5.27 kB
| language: | |
| - en | |
| license: apache-2.0 | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - causal-lm | |
| - llama | |
| - small-language-model | |
| - base-model | |
| - trained-from-scratch | |
| - tiny-model | |
| # Matriisi 1.0 | |
| **Matriisi** (Finnish for "matrix") is a compact, Llama-style causal language model built for experimentation and tinkering. It is a **base model**: it continues text, it doesn't follow instructions, like a chat assistant. | |
| Its main strength is **token efficiency**. Models in this size range are typically trained on several billion tokens or more. Matriisi sees only about 500M. It gives up a little benchmark performance in exchange for a much smaller training budget, and still handles short English text, simple math and small code snippets. | |
| | | | | |
| |---|---| | |
| | Type | Base (pretrained) causal LM, not instruction-tuned | | |
| | Size | 9,992,448 parameters (~40 MB in float32) | | |
| | Context | 4,096 tokens | | |
| | Training data | 502M tokens, one pass | | |
| | Domains | English prose, code, math and science, general knowledge | | |
| | Runs on | Anything, including a plain CPU | | |
| ## Model details | |
| | Property | Value | | |
| |---|---| | |
| | Architecture | Llama-style decoder (`LlamaForCausalLM`) | | |
| | Parameters | 9,992,448 (about 10M) | | |
| | Layers | 10 | | |
| | Hidden size | 256 | | |
| | Attention heads | 4 (head dimension 64) | | |
| | Feed-forward size | 686 | | |
| | Context length | 4,096 tokens | | |
| | Vocabulary | 8,192-token byte-level BPE | | |
| | Embeddings | Input and output weights tied | | |
| | Model format | Safetensors, float32 | | |
| | Training checkpoint | Step 15,332; validation loss 2.7431 | | |
| The model uses RMSNorm, RoPE and SwiGLU, with no attention or MLP biases. The tokenizer and its special-token IDs are part of the model and must be used together with these weights. | |
| ## Training data | |
| Matriisi was pretrained for one pass over a prepared stream of 502,383,824 tokens, around 50 training tokens per parameter. The measured mixture: | |
| | Category | Training tokens | Share | | |
| |---|---:|---:| | |
| | English | 274,764,764 | 54.7% | | |
| | Code | 76,047,126 | 15.1% | | |
| | Math and science | 76,839,148 | 15.3% | | |
| | General knowledge and reasoning | 74,732,786 | 14.9% | | |
| Sources include project and open-source code, English prose, FineWeb-Edu, FineMath, Sci-Base textbook text, Wikipedia and HotpotQA. | |
| ## Intended use | |
| Good fits: | |
| - Local experimentation with small language models | |
| - Generating or completing short text and code snippets | |
| - A starting point for domain adaptation or fine-tuning | |
| Not a good fit: | |
| - Question answering, factual lookup or anything where correctness matters | |
| - Chat or instruction following (prompts are treated as text to continue, not requests) | |
| ## Evaluation | |
| Zero-shot multiple-choice evaluation with `lm-eval` 0.4.13 and Arithmark-3. All results are `acc_norm`. | |
| | Benchmark | Score | | |
| |---|---:| | |
| | HellaSwag | 27.13% | | |
| | ARC-Easy | 33.04% | | |
| | ARC-Challenge | 21.50% | | |
| | PIQA | 54.19% | | |
| | Arithmark-3 | 34.6% | | |
| ## Limitations | |
| - With fewer than 10M parameters, capacity is very limited. Expect incoherent continuations, wrong answers, repetitive text and invalid code. | |
| - Training data may contain errors, biases, unsafe material or copyrighted content inherited from its sources. | |
| - English only, in practice. | |
| ## Use with Transformers | |
| Recommended starting settings, from short local sampling trials: temperature `0.6`, top-k `40`, top-p `0.8`, repetition penalty `1.1`, and up to `128` new tokens. For code, greedy decoding (`temperature=0`) may give simpler completions, but it does not ensure correctness. | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_id = "BenjaminHelle/Matriisi-1.0" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained(model_id) | |
| prompt = "# A function that returns the square of a number\n" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=128, | |
| do_sample=True, | |
| temperature=0.6, | |
| top_k=40, | |
| top_p=0.8, | |
| repetition_penalty=1.1, | |
| pad_token_id=tokenizer.pad_token_id, | |
| eos_token_id=tokenizer.eos_token_id, | |
| ) | |
| print(tokenizer.decode(outputs[0], skip_special_tokens=False)) | |
| ``` | |
| ### Prompting tips | |
| Matriisi continues text, so write prompts as the *beginning* of something rather than as a request. | |
| - **General text:** start a sentence or paragraph and let the model finish it. | |
| - **Code:** the training format uses a file marker and path, so mimic it for source-code continuation: | |
| ```text | |
| <|file|>main.c | |
| #include <stdio.h> | |
| ``` | |
| - **Comments as prompts:** a leading comment describing a function (as in the example above) also works as a prompt. | |
| ## Training procedure | |
| Matriisi was trained from scratch on a RX 7600 with a custom training pipeline and exported to the standard Transformers Llama causal-LM format, which supports a 4,096-token context. Training used a 500M-token prepared corpus, a byte-level BPE tokenizer built for the project, and a single pass over the shuffled training stream. `export_metadata.json` records the source checkpoint step, validation loss, parameter count and tokenizer hash. | |
| ## Citation | |
| If you use this model, please cite it as: | |
| ```bibtex | |
| @misc{matriisi_1_0, | |
| title = {Matriisi 1.0}, | |
| author = {Benjamin Helle}, | |
| year = {2026} | |
| } | |
| ``` |