Instructions to use Nessim/Nessim-48M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nessim/Nessim-48M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nessim/Nessim-48M-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Nessim/Nessim-48M-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nessim/Nessim-48M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nessim/Nessim-48M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nessim/Nessim-48M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Nessim/Nessim-48M-Base
- SGLang
How to use Nessim/Nessim-48M-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 "Nessim/Nessim-48M-Base" \ --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": "Nessim/Nessim-48M-Base", "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 "Nessim/Nessim-48M-Base" \ --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": "Nessim/Nessim-48M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Nessim/Nessim-48M-Base with Docker Model Runner:
docker model run hf.co/Nessim/Nessim-48M-Base
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("Nessim/Nessim-48M-Base", trust_remote_code=True, device_map="auto")Nessim-48M-Base
Nessim-48M-Base is a 48.1M-parameter base language model, pretrained from scratch with no teacher (no distillation).
- Intelligence Index 18.75 on the Open SLM leaderboard's benchmarks, measured with its own tools on this repository, against 18.36 for Mantis-50M-Base, the leader of the under-50M class when we submitted (pending the leaderboard's verification).
- 26.4B training tokens, 8.6% of the 308B that KLM 1.6, whose architecture it builds on, was trained on (15% of its 180B tokens of next-token prediction). It read at most 0.35 of an epoch of any of its sources: most of the prepared data is still unseen.
- 62 hours on two consumer GPUs (an RTX 5090 and an RTX 4090).
- Five additions to KLM 1.6, each computed cheaply from the input ids or the shared weights: a looped shared core and four token-level programs (a copy pointer, induction inputs, a previous-token front end and per-head distance biases). At 10M parameters they lower the held-out loss from 2.468 to 2.387 at equal tokens (see What the additions bring).
- The copy pointer needs care. Trained from the first step at the model's learning rate it makes the model worse (+0.029); given its own small learning rate and held at zero until the model has learned to copy on its own, it becomes a gain.
It is built on the KLM 1.6 architecture (Gated DeltaNet-2 and attention layers, Block Attention Residuals, exact n-gram memory; MinimaLabs/KLM-1.6, Apache-2.0).
Architecture
| Field | Value |
|---|---|
| Parameters | 48,126,630, of which 5,411,832 are the n-gram memory |
| Unshared layers | 10: 2 prelude, 6 core, 2 coda |
| Loops | the 6 core layers are applied 4 times with shared weights: 28 layer applications per token, 20 Gated DeltaNet-2 and 8 attention |
| Hidden size | 512 |
| Gated DeltaNet-2 | 4 heads x 128 |
| Attention | 8 query heads, 4 KV heads, head size 64, RoPE, QK-norm, output gate, a learned distance bias per head |
| Residuals | Block Attention Residuals |
| N-gram memory | 125,000 bigrams and 38,000 trigrams (163,000 rows), each with its own learned vector of size 32 |
| Feed-forward | SwiGLU, hidden size 1,536 |
| Context length | 2,048 tokens |
| Vocabulary | 4,100 tokens (KLM 1.6 tokenizer), 4,160 embedding rows, tied embeddings |
What is added to KLM 1.6:
- Loops. One shared core of 6 layers is applied 4 times between an unshared prelude and coda. Every application is its own Block Attention Residuals consumer with its own query, and loop l > 0 starts by adding a learned vector
loop_signal[l]to the newest residual source. - Copy pointer. A learned, gated boost is added to the logits of the tokens that already occur in the document: a fast and a slow copy of every earlier token, and continuation of earlier matches of the last 1, 2 and 3 or more tokens. It is trained with its own learning rate and held fixed at its zero initialisation for the first 1,000 steps.
- Induction inputs. For every position, the token after the most recent earlier occurrence of the current token, and of the current pair of tokens, in the same document is read through a shared low-rank map (rank 32) of the token embedding and enters the network as one more residual source.
- Previous-token front end. The embeddings of the 2 preceding tokens of the same document go through the same low-rank map and into the same residual source.
- Distance biases. Each attention layer adds a learned bias per head to its scores, a function of the query-key offset in 24 buckets (exact below 8, then two per octave up to 1,449 and beyond).
All four programs are computed from input_ids inside forward. Attention, the Gated DeltaNet-2 state and short convolutions, the n-gram history and all four programs restart after every <eos> (id 2), as in training; a sequence without <eos>, which is what lm-eval and the ArithMark-3 script feed, is one document.
What the additions bring
Each addition was compared with the same model without it, at 10M parameters (2 prelude, 4 core and 2 coda layers of width 256) on 400M tokens of the same data mixture, with the learning rates tuned for the plain looped model. The loss is the mixture-weighted cross-entropy on held-out documents of every source. At this size the benchmarks are still at chance, so the comparison is in loss; there is no matched comparison at 48M parameters yet.
| Design (10M parameters, 400M tokens) | Held-out loss | vs. first row | Seeds |
|---|---|---|---|
| KLM 1.6 design, core applied once | 2.468 | +0.000 | 2 |
| + looped core (4 applications) | 2.419 | -0.049 | 2 |
| + looped core + induction inputs | 2.407 | -0.061 | 2 |
| + looped core + distance biases | 2.416 | -0.052 | 2 |
| + looped core + copy pointer trained from step 0 (untuned) | 2.448 | -0.020 | 2 |
| + looped core + induction inputs, previous-token front end, distance biases | 2.399 | -0.069 | 1 |
| + looped core + all four programs, pointer held off for 600 steps (this model's recipe) | 2.387 | -0.080 | 1 |
| KLM 1.6 design, core applied once, 2.3x the tokens (same compute as the looped core) | 2.366 | -0.102 | 2 |
- Looped core: -0.049 at equal tokens and parameters. It costs compute: the core runs 4 times. At equal compute, the design without loops trained on 2.3x the tokens reaches 2.366, so the loops buy quality per parameter, which is what a parameter cap rewards, not quality per FLOP.
- Induction inputs: -0.012 on both seeds. Distance biases: -0.003, within the seed spread.
- Copy pointer: trained from step 0 with the shared learning rate it costs +0.029: it lowers the loss in the first few hundred steps and raises it from about step 400 on, which we read as the free copy delaying the model's own copying circuits (a reading we have not yet measured). With its own small learning rate and held at zero for the first 600 steps, the full recipe reaches 2.387, -0.012 against the same model without the pointer. In this model the pointer is held for the first 1,000 steps (213M tokens).
- Seed-to-seed spread at this size is 0.007 to 0.015; rows with one seed carry that uncertainty.
The loops are also what the score rests on. The same checkpoint evaluated with its shared core applied 2 or 6 times instead of 4 (each extra application reuses the last trained loop's residual queries and loop signal; with 2, the first and last trained loops are kept), float32, our scorer:
| Core applications at test time | Intelligence Index |
|---|---|
| 2 | 6.94 |
| 4 | 18.78 |
| 6 | 16.81 |
Parameter count
48,126,630 is the number of elements of every tensor stored in model.safetensors, the two n-gram key tables included (47,963,630 floating-point weights, 125,000 int32 bigram keys and 38,000 int64 trigram keys). This is how the 98,975,308 of KLM 1.6 is counted: the elements of every tensor in its model.safetensors, its n-gram key tables included. Weights are stored in float32 (the training parameters); the file is 193 MB.
Training data
Sources, their licences (as recorded in our data manifest at download time; for ATOMIC 2020 and CREAK, whose Hugging Face copies state none, the licence of the original release), and what the 26.4B training tokens drew from each (mixture weight times the tokens of its stage, the last 37,200 of 123,999 steps on a second mixture; epochs against the tokens of the training split of the frozen view):
| Dataset | Source name | Category | Licence | Tokens seen (M) | Share | Epochs |
|---|---|---|---|---|---|---|
| nvidia/Nemotron-ClimbMix | climbmix | web | cc-by-nc-4.0 | 7,120.9 | 26.96% | 0.21 |
| IFM/TxT360-v2 | txt360_web | web | cc-by-4.0 | 4,051.8 | 15.34% | 0.24 |
| HuggingFaceTB/smollm-corpus | cosmopedia_v2 | textbooks | odc-by | 3,282.5 | 12.43% | 0.26 |
| IFM/TxT360-v2 | txt360_qa | qa | cc-by-4.0 | 1,690.3 | 6.40% | 0.34 |
| allenai/dolma3_dolmino_mix-100B-1025 | dolmino_flashcards | qa | odc-by | 1,408.6 | 5.33% | 0.28 |
| openbmb/UltraData-Math | ultradata_math | math | apache-2.0 | 1,333.1 | 5.05% | 0.25 |
| IFM/Math-Reasoning | math_rewrite | math | apache-2.0 | 1,295.0 | 4.90% | 0.28 |
| openbmb/UltraX-Preview | ultrax | web | apache-2.0 | 1,240.4 | 4.70% | 0.21 |
| mlfoundations/dclm-baseline-1.0 | dclm_commonsense | commonsense | cc-by-4.0 | 1,176.5 | 4.45% | 0.35 |
| allenai/dolma3_dolmino_mix-100B-1025 | dolmino_synth_qa | qa | odc-by | 1,126.9 | 4.27% | 0.26 |
| allenai/dolma3_dolmino_mix-100B-1025 | dolmino_science_cc | science | odc-by | 792.3 | 3.00% | 0.32 |
| nvidia/OpenMathInstruct-2 | openmath2 | math | cc-by-4.0 | 761.7 | 2.88% | 0.27 |
| IFM/Pretrain-Behaviors | pretrain_reasoning | reasoning | apache-2.0 | 449.0 | 1.70% | 0.13 |
| allenai/dolma3_dolmino_mix-100B-1025 | dolmino_science_pdf | science | odc-by | 396.2 | 1.50% | 0.33 |
| allenai/dolma3_dolmino_mix-100B-1025 | dolmino_tinymath | math | odc-by | 228.5 | 0.87% | 0.27 |
| HuggingFaceTB/cosmopedia | cosmopedia_wikihow | textbooks | apache-2.0 | 45.3 | 0.17% | 0.19 |
| facebook/anli | anli | commonsense | cc-by-nc-4.0 | 4.6 | 0.02% | 0.20 |
| Estwld/atomic2020-origin | atomic2020 | commonsense | cc-by (original ATOMIC 2020 release) | 3.6 | 0.01% | 0.20 |
| community-datasets/glucose | glucose | commonsense | cc-by-4.0 | 3.0 | 0.01% | 0.20 |
| allenai/sciq | sciq | commonsense | cc-by-nc-3.0 | 0.4 | 0.00% | 0.20 |
| allenai/qasc | qasc | commonsense | cc-by-4.0 | 0.2 | 0.00% | 0.20 |
| amydeng2000/CREAK | creak | commonsense | mit (original CREAK release) | 0.1 | 0.00% | 0.20 |
The 26.4B tokens read at most 0.35 of an epoch of any source: the model saw a fraction of the data prepared for it.
A fixed share of every source's documents (1 in 1,000, chosen by a hash of the document) is held out of training. Every one of the 222 training shards of the view was filtered by 13-gram decontamination against the validation and test items of ARC-Easy, ARC-Challenge, HellaSwag, PIQA and ArithMark-3 (a document is dropped when any 13 consecutive words equal 13 consecutive words of an evaluation text). The weights are released under CC-BY-NC-4.0 to comply with these licences: three sources (Nemotron-ClimbMix and ANLI under CC-BY-NC-4.0, SciQ under CC-BY-NC-3.0) allow non-commercial use only, so the weights carry the same non-commercial restriction, and every source is credited above as the attribution (BY) terms of the CC-BY, ODC-BY, Apache-2.0 and MIT sources require. None of the sources is under a share-alike licence.
Training
- From scratch: random initialisation, no distillation, no pretrained weights.
- 123,999 optimizer steps of 104 sequences of 2,048 tokens = 26,410,795,008 tokens, in 62.3 hours on two consumer GPUs (an RTX 5090 and an RTX 4090).
- Muon on the weight matrices and AdamW on everything else, bfloat16 autocast with float32 parameters, a warmup of 200 steps, then a constant learning rate and a decay as 1 - sqrt(t) over the last 37,200 steps (30% of the run), where the data mixture changes to its decay mixture.
Evaluation
Zero-shot, length-normalised accuracy (acc_norm) in float32: ARC-Easy, ARC-Challenge, HellaSwag and PIQA with lm-eval 0.4.12; ArithMark-3 with the official ArithMark-3.0 script's computation. The Intelligence Index is the leaderboard's: (N(HellaSwag, 25) + N(ARC, 25) + N(PIQA, 50) + 0.65 N(ArithMark-3, 25)) / 3.65, with N(s, c) = 100 (s - c) / (100 - c) and ARC the mean of ARC-Easy and ARC-Challenge.
| Benchmark | Score (+- standard error) | Through this directory |
|---|---|---|
| ARC-Easy | 47.73 +- 1.02 | 47.69 |
| ARC-Challenge | 26.28 +- 1.29 | 26.28 |
| HellaSwag | 35.38 +- 0.48 | 35.39 |
| PIQA | 63.49 +- 1.12 | 63.49 |
| ArithMark-3 | 38.50 +- 1.54 | 38.60 |
| Intelligence Index | 18.78 +- 0.80 | 18.80 |
The middle column is the evaluation of the final checkpoint by our own scorer on the training code. The last column is the same scorer run on this directory's modeling_nessim.py (loaded with trust_remote_code=True, float32). On the first held-out window of 20 sources (2,048 tokens each), the logits of modeling_nessim.py differ from the training code's by 0.0048 on average (largest 0.16) and the next-token cross-entropy by at most 0.00006 nats.
With the leaderboard's own tools on this directory, in float32 (lm-eval 0.4.12's HFLM for the first four, acc_norm; the official ArithMark-3.0 script, acc_norm), which are the numbers submitted to the Open SLM leaderboard:
| Benchmark | lm-eval / official ArithMark-3 script on this directory, float32 |
|---|---|
| ARC-Easy | 47.69 |
| ARC-Challenge | 26.28 |
| HellaSwag | 35.39 |
| PIQA | 63.49 |
| ArithMark-3 | 38.40 |
| Intelligence Index | 18.75 |
Usage
The model code is plain PyTorch: it needs only torch and transformers (tested with torch 2.10.0+cu128 and transformers 5.23.0), runs on a CPU or any GPU, and uses no flash-linear-attention or Triton kernels.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Nessim/Nessim-48M-Base"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to(device)
inputs = tokenizer("The three primary colors are", return_tensors="pt").to(device)
outputs = model.generate(**inputs, max_new_tokens=40, do_sample=False)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
generate() keeps no cache: every new token runs the whole sequence again, so generation slows down as the text grows. Scoring is a single forward pass.
Evaluating
lm_eval --model hf --model_args pretrained=Nessim/Nessim-48M-Base,trust_remote_code=True,dtype=float32 \
--tasks arc_easy,arc_challenge,hellaswag,piqa --num_fewshot 0 --batch_size 32 --device cuda:0
python bencharithmark-3.py --model Nessim/Nessim-48M-Base --tokenizer Nessim/Nessim-48M-Base --dtype float32
lm-eval's hf backend imports accelerate, so install it as for any model; the model itself does not use it. lm-eval reports acc_norm for the first four. The model feeds the whole input as one document unless <eos> ids appear, pads on the right invisibly, and runs the Gated DeltaNet-2 recurrence token by token in float32 in plain PyTorch, so scoring is slower than with fused kernels. Scores in bfloat16 differ slightly from float32 (the ArithMark-3 script defaults to bfloat16).
Limitations
- A base model: it continues text and has not been trained to follow instructions or chat.
- Its knowledge is thin and the facts it states are often wrong.
- English only, with a 2,048-token context window.
- No safety alignment: add your own filtering before putting it in front of users.
- Generation has no cache and the recurrence is a Python loop, so it is slow.
License
The weights (model.safetensors) are released under the Creative Commons Attribution-NonCommercial 4.0 International license (CC-BY-NC-4.0, see LICENSE): non-commercial use only, with attribution, as the training data licences require (see Training data). modeling_nessim.py and configuration_nessim.py are derived from the KLM 1.6 files of the same role (Apache-2.0, MinimaLabs) and stay under Apache-2.0 (see LICENSE-CODE); their changes are listed at the top of each file. The tokenizer is KLM 1.6's (Apache-2.0).
- Downloads last month
- -
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nessim/Nessim-48M-Base", trust_remote_code=True)