Text Generation
Transformers
Safetensors
English
llama
small-language-model
slm
from-scratch
tiny
nexus-erebus
arithmetic
text-generation-inference
Instructions to use MaliosDark/Nexus-Erebus-3M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaliosDark/Nexus-Erebus-3M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MaliosDark/Nexus-Erebus-3M", device_map="auto")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MaliosDark/Nexus-Erebus-3M") model = AutoModelForCausalLM.from_pretrained("MaliosDark/Nexus-Erebus-3M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MaliosDark/Nexus-Erebus-3M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MaliosDark/Nexus-Erebus-3M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MaliosDark/Nexus-Erebus-3M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MaliosDark/Nexus-Erebus-3M
- SGLang
How to use MaliosDark/Nexus-Erebus-3M 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 "MaliosDark/Nexus-Erebus-3M" \ --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": "MaliosDark/Nexus-Erebus-3M", "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 "MaliosDark/Nexus-Erebus-3M" \ --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": "MaliosDark/Nexus-Erebus-3M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MaliosDark/Nexus-Erebus-3M with Docker Model Runner:
docker model run hf.co/MaliosDark/Nexus-Erebus-3M
Nexus-Erebus-3M: verified 70.72 ArithMark (beats Atom), reproducible LSD tokenizer
Browse files- README.md +45 -44
- config.json +1 -1
- model.safetensors +1 -1
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
library_name: transformers
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
language:
|
|
@@ -11,58 +11,52 @@ tags:
|
|
| 11 |
- tiny
|
| 12 |
- nexus-erebus
|
| 13 |
- arithmetic
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
-

|
| 17 |
|
| 18 |
# Nexus-Erebus-3M
|
| 19 |
|
| 20 |
-
A
|
| 21 |
|
| 22 |
-
It
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
##
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
| Hidden size | 192 |
|
| 33 |
-
| Layers | 5 |
|
| 34 |
-
| Attention heads | 4 |
|
| 35 |
-
| Vocab size | 4096 |
|
| 36 |
-
| Context length | 512 |
|
| 37 |
-
| Precision | bfloat16 |
|
| 38 |
-
|
| 39 |
-
## Results
|
| 40 |
-
|
| 41 |
-
0-shot, `acc_norm` for multiple choice, accuracy for ArithMark-2. Full test sets, no subsampling.
|
| 42 |
-
|
| 43 |
-
| Task | Score |
|
| 44 |
-
|---|---:|
|
| 45 |
-
| ARC-easy | 26.98 |
|
| 46 |
-
| ARC-challenge | 21.67 |
|
| 47 |
-
| HellaSwag | 26.74 |
|
| 48 |
-
| PIQA | 50.49 |
|
| 49 |
-
| ArithMark-2 | 36.60 |
|
| 50 |
-
| **Average** | **32.50** |
|
| 51 |
-
|
| 52 |
-
## Usage
|
| 53 |
-
|
| 54 |
-
The tokenizer ships with the model and requires `trust_remote_code=True`.
|
| 55 |
|
| 56 |
```python
|
| 57 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 58 |
tok = AutoTokenizer.from_pretrained("MaliosDark/Nexus-Erebus-3M", trust_remote_code=True)
|
| 59 |
model = AutoModelForCausalLM.from_pretrained("MaliosDark/Nexus-Erebus-3M")
|
| 60 |
-
|
| 61 |
-
prompt = "16 + 4 * 3 ="
|
| 62 |
-
print(tok.decode(model.generate(**tok(prompt, return_tensors="pt"), max_new_tokens=6)[0]))
|
| 63 |
```
|
| 64 |
|
| 65 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
```bash
|
| 68 |
python benchmark_nexus_arithmark.py MaliosDark/Nexus-Erebus-3M
|
|
@@ -70,13 +64,20 @@ python benchmark_nexus_arithmark.py MaliosDark/Nexus-Erebus-3M
|
|
| 70 |
|
| 71 |
## Training
|
| 72 |
|
| 73 |
-
Pretrained from scratch
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
## License
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
Built by
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
library_name: transformers
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
language:
|
|
|
|
| 11 |
- tiny
|
| 12 |
- nexus-erebus
|
| 13 |
- arithmetic
|
| 14 |
+
- specialist
|
| 15 |
---
|
| 16 |
|
| 17 |
+

|
| 18 |
|
| 19 |
# Nexus-Erebus-3M
|
| 20 |
|
| 21 |
+
A **3-million-parameter** language model trained from scratch by [MaliosDark](https://huggingface.co/MaliosDark).
|
| 22 |
|
| 23 |
+
**It holds the record for tiny integer arithmetic.** On ArithMark-2 it scores **70.72%**, which beats
|
| 24 |
+
the previous best tiny model, Atom 2.7M (69.40%), on that task. It is an arithmetic *specialist*: near
|
| 25 |
+
chance on general tasks, sharp on math, at a size that runs anywhere.
|
| 26 |
|
| 27 |
+
## How it works
|
| 28 |
|
| 29 |
+
The model reads and writes numbers **least-significant-digit first** (LSD), with a digit-atomic
|
| 30 |
+
tokenizer. That alignment of carry propagation with reading order is what lets a 3M model do arithmetic.
|
| 31 |
+
The digit reversal is handled inside the tokenizer, so you pass and receive normal text. This requires
|
| 32 |
+
`trust_remote_code=True`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
```python
|
| 35 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 36 |
tok = AutoTokenizer.from_pretrained("MaliosDark/Nexus-Erebus-3M", trust_remote_code=True)
|
| 37 |
model = AutoModelForCausalLM.from_pretrained("MaliosDark/Nexus-Erebus-3M")
|
|
|
|
|
|
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |
+
## Results
|
| 41 |
+
|
| 42 |
+
Measured on the full test sets. 0-shot, `acc_norm` for multiple choice, accuracy for ArithMark-2.
|
| 43 |
+
Weighting follows the Open SLM Leaderboard (HellaSwag 25%, PIQA 25%, ArithMark-2 25%, ARC-Easy 12.5%,
|
| 44 |
+
ARC-Challenge 12.5%).
|
| 45 |
+
|
| 46 |
+
| Task | Nexus-Erebus-3M | Atom 2.7M |
|
| 47 |
+
|---|---:|---:|
|
| 48 |
+
| **ArithMark-2** | **70.72** | 69.40 |
|
| 49 |
+
| PIQA | 51.41 | 52.94 |
|
| 50 |
+
| HellaSwag | 26.59 | 27.10 |
|
| 51 |
+
| ARC-Easy | 27.02 | 31.19 |
|
| 52 |
+
| ARC-Challenge | 20.65 | 21.50 |
|
| 53 |
+
| **Weighted average** | 43.14 | 43.95 |
|
| 54 |
+
|
| 55 |
+
**Honest reading:** #1 on arithmetic itself (70.72 beats 69.40), #2 on the blended average by 0.81,
|
| 56 |
+
because Atom has slightly higher commonsense scores. As a 3M specialist, the non-arithmetic tasks sit
|
| 57 |
+
near chance, which is expected at this size.
|
| 58 |
+
|
| 59 |
+
## Reproduce the ArithMark-2 score
|
| 60 |
|
| 61 |
```bash
|
| 62 |
python benchmark_nexus_arithmark.py MaliosDark/Nexus-Erebus-3M
|
|
|
|
| 64 |
|
| 65 |
## Training
|
| 66 |
|
| 67 |
+
Pretrained from scratch with a digit-atomic 4k tokenizer, LSD digit order, and a large stream of
|
| 68 |
+
**freshly generated** synthetic integer arithmetic matched to the ArithMark-2 distribution (addition,
|
| 69 |
+
subtraction, multiplication, exact division, mixed and parenthesised multi-operator expressions), mixed
|
| 70 |
+
with TinyStories for language. Then a short fine-tune on public benchmark train splits plus more
|
| 71 |
+
arithmetic. No evaluation items were used at any stage. Fresh generation (never reusing a fixed pool)
|
| 72 |
+
is what stops the model from memorising instead of learning.
|
| 73 |
+
|
| 74 |
+
## Limitations
|
| 75 |
+
|
| 76 |
+
- It is an arithmetic specialist. On non-math tasks it performs near chance, by design.
|
| 77 |
+
- It reasons over integers in the ArithMark-2 style; it is not a general assistant.
|
| 78 |
|
| 79 |
## License
|
| 80 |
|
| 81 |
+
MIT.
|
| 82 |
|
| 83 |
+
Built by MaliosDark.
|
config.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
"intermediate_size": 512,
|
| 15 |
"max_position_embeddings": 512,
|
| 16 |
"mlp_bias": false,
|
| 17 |
-
"model_name": "scratch/nexus-3m-
|
| 18 |
"model_type": "llama",
|
| 19 |
"num_attention_heads": 4,
|
| 20 |
"num_hidden_layers": 5,
|
|
|
|
| 14 |
"intermediate_size": 512,
|
| 15 |
"max_position_embeddings": 512,
|
| 16 |
"mlp_bias": false,
|
| 17 |
+
"model_name": "scratch/nexus-3m-forpush",
|
| 18 |
"model_type": "llama",
|
| 19 |
"num_attention_heads": 4,
|
| 20 |
"num_hidden_layers": 5,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 6005832
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85325ab199b66d88fb3572e6b9de1a49d68651a2d410b4d98ccd005430ca3f0d
|
| 3 |
size 6005832
|