Text Generation
Transformers
Safetensors
PyTorch
English
neolm
causal-lm
custom-code
pretrained
foundation
custom_code
Instructions to use MaagDeveloper/NeoLM-Small-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaagDeveloper/NeoLM-Small-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MaagDeveloper/NeoLM-Small-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MaagDeveloper/NeoLM-Small-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MaagDeveloper/NeoLM-Small-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MaagDeveloper/NeoLM-Small-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MaagDeveloper/NeoLM-Small-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MaagDeveloper/NeoLM-Small-Base
- SGLang
How to use MaagDeveloper/NeoLM-Small-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 "MaagDeveloper/NeoLM-Small-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": "MaagDeveloper/NeoLM-Small-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 "MaagDeveloper/NeoLM-Small-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": "MaagDeveloper/NeoLM-Small-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MaagDeveloper/NeoLM-Small-Base with Docker Model Runner:
docker model run hf.co/MaagDeveloper/NeoLM-Small-Base
docs: update model card for Foundation Continued 30K
Browse files
README.md
CHANGED
|
@@ -17,11 +17,19 @@ metrics:
|
|
| 17 |
library_name: transformers
|
| 18 |
---
|
| 19 |
|
| 20 |
-
# NeoLM-Small-Base (61M) — Stage 1: Foundation
|
| 21 |
|
| 22 |
-
**NeoLM-Small-Base** is an English-focused, decoder-only Transformer language model trained from scratch with PyTorch and Hugging Face Transformers.
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Architecture
|
| 27 |
|
|
@@ -37,7 +45,7 @@ The fixed Foundation release can be loaded using the `stage1-foundation` revisio
|
|
| 37 |
| Context length | 1,024 tokens |
|
| 38 |
| Vocabulary | 49,152 (custom ByteLevel BPE) |
|
| 39 |
| Special tokens | EOS ID 0, PAD ID 1; no BOS |
|
| 40 |
-
|
|
| 41 |
| Model implementation | Custom `NeoLMForCausalLM` (`trust_remote_code=True`) |
|
| 42 |
|
| 43 |
## Tokenizer
|
|
@@ -58,14 +66,14 @@ Special-token spellings and IDs (kept outside the Markdown table to preserve lit
|
|
| 58 |
- EOS: `<|endoftext|>` — ID **0**
|
| 59 |
- PAD: `<|pad|>` — ID **1**
|
| 60 |
|
| 61 |
-
The tokenizer passed local encode/decode round-trip, special-token, and save/reload checks. It can
|
| 62 |
|
| 63 |
```python
|
| 64 |
from transformers import AutoTokenizer
|
| 65 |
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 67 |
"MaagDeveloper/NeoLM-Small-Base",
|
| 68 |
-
revision="
|
| 69 |
trust_remote_code=True,
|
| 70 |
)
|
| 71 |
print(tokenizer.encode("Hello, NeoLM!"))
|
|
@@ -73,19 +81,39 @@ print(tokenizer.encode("Hello, NeoLM!"))
|
|
| 73 |
|
| 74 |
## Training data
|
| 75 |
|
| 76 |
-
Foundation pretraining uses the **`foundation`** configuration of [NeoCorpus](https://huggingface.co/datasets/MaagDeveloper/NeoCorpus), derived from a filtered English-focused subset of [Karpathy ClimbMix Shuffle](https://huggingface.co/datasets/karpathy/climbmix-400b-shuffle), based on [NVIDIA Nemotron-ClimbMix](https://huggingface.co/datasets/nvidia/Nemotron-ClimbMix). The
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
## Load and generate text
|
| 81 |
|
| 82 |
-
Install compatible versions of `torch` and `transformers`. The model requires custom Python code, so review the repository code before enabling `trust_remote_code=True`.
|
| 83 |
|
| 84 |
```python
|
| 85 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 86 |
|
| 87 |
repo_id = "MaagDeveloper/NeoLM-Small-Base"
|
| 88 |
-
revision = "
|
| 89 |
|
| 90 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 91 |
repo_id, revision=revision, trust_remote_code=True
|
|
@@ -105,9 +133,9 @@ inputs = tokenizer(
|
|
| 105 |
|
| 106 |
outputs = model.generate(
|
| 107 |
**inputs,
|
| 108 |
-
max_new_tokens=200,
|
| 109 |
do_sample=True,
|
| 110 |
-
temperature=0.3,
|
| 111 |
top_p=0.9,
|
| 112 |
repetition_penalty=1.15,
|
| 113 |
eos_token_id=tokenizer.eos_token_id,
|
|
@@ -117,16 +145,15 @@ outputs = model.generate(
|
|
| 117 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 118 |
```
|
| 119 |
|
| 120 |
-
|
| 121 |
## Streaming Text Generation
|
| 122 |
|
| 123 |
-
|
| 124 |
|
| 125 |
```python
|
| 126 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
|
| 127 |
|
| 128 |
repo_id = "MaagDeveloper/NeoLM-Small-Base"
|
| 129 |
-
revision = "
|
| 130 |
|
| 131 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 132 |
repo_id,
|
|
@@ -153,9 +180,9 @@ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
|
| 153 |
_ = model.generate(
|
| 154 |
**inputs,
|
| 155 |
streamer=streamer,
|
| 156 |
-
max_new_tokens=100,
|
| 157 |
do_sample=True,
|
| 158 |
-
temperature=0.3,
|
| 159 |
top_p=0.9,
|
| 160 |
repetition_penalty=1.15,
|
| 161 |
eos_token_id=tokenizer.eos_token_id,
|
|
@@ -163,18 +190,18 @@ _ = model.generate(
|
|
| 163 |
)
|
| 164 |
```
|
| 165 |
|
| 166 |
-
|
| 167 |
|
| 168 |
-
##
|
| 169 |
|
| 170 |
-
The
|
| 171 |
|
| 172 |
-
|
| 173 |
|
| 174 |
## Provenance and licensing
|
| 175 |
|
| 176 |
- Dataset: [MaagDeveloper/NeoCorpus](https://huggingface.co/datasets/MaagDeveloper/NeoCorpus), `foundation` configuration.
|
| 177 |
-
- NeoCorpus's attribution and CC BY-NC 4.0 notice do not automatically establish a separate license for model weights. **
|
| 178 |
-
-
|
| 179 |
|
| 180 |
-
NeoLM is an independent project and is not affiliated with NVIDIA, Andrej Karpathy, or Hugging Face.
|
|
|
|
| 17 |
library_name: transformers
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# NeoLM-Small-Base (61M) — Stage 1: Foundation Continued 30K
|
| 21 |
|
| 22 |
+
**NeoLM-Small-Base** is an English-focused, decoder-only Transformer language model trained from scratch with PyTorch and Hugging Face Transformers. The `main` branch publishes the **Stage 1 Foundation Continued 30K** base-model checkpoint in **bfloat16** (`safetensors`) format. This is a **base next-token prediction model**, not an instruction-tuned chat assistant.
|
| 23 |
|
| 24 |
+
## Available revisions
|
| 25 |
+
|
| 26 |
+
| Revision | Description |
|
| 27 |
+
| --- | --- |
|
| 28 |
+
| `main` | Current stable Base weights: Foundation continued for 30K additional optimizer steps; BF16 release |
|
| 29 |
+
| `stage1-foundation` | Historical original Foundation checkpoint, preserved separately |
|
| 30 |
+
| `stage1-foundation-continued-30k` | Planned immutable tag for this 30K release; created **after** this README is committed and the release is verified |
|
| 31 |
+
|
| 32 |
+
The original Foundation checkpoint was trained for approximately **202K optimizer steps** before a system interruption. The selected continuation added **20K steps from that checkpoint**, followed by **10K more steps from the 20K checkpoint** (approximately **232K steps total along the selected training trajectory**). Independent 5K and 20K continuation experiments were also performed; they should not be summed together as one run. The original planned three-epoch Foundation schedule was not completed.
|
| 33 |
|
| 34 |
## Architecture
|
| 35 |
|
|
|
|
| 45 |
| Context length | 1,024 tokens |
|
| 46 |
| Vocabulary | 49,152 (custom ByteLevel BPE) |
|
| 47 |
| Special tokens | EOS ID 0, PAD ID 1; no BOS |
|
| 48 |
+
| Published weight format | BF16, safetensors |
|
| 49 |
| Model implementation | Custom `NeoLMForCausalLM` (`trust_remote_code=True`) |
|
| 50 |
|
| 51 |
## Tokenizer
|
|
|
|
| 66 |
- EOS: `<|endoftext|>` — ID **0**
|
| 67 |
- PAD: `<|pad|>` — ID **1**
|
| 68 |
|
| 69 |
+
The tokenizer passed local encode/decode round-trip, special-token, and save/reload checks. It can be loaded **without loading model weights**:
|
| 70 |
|
| 71 |
```python
|
| 72 |
from transformers import AutoTokenizer
|
| 73 |
|
| 74 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 75 |
"MaagDeveloper/NeoLM-Small-Base",
|
| 76 |
+
revision="main",
|
| 77 |
trust_remote_code=True,
|
| 78 |
)
|
| 79 |
print(tokenizer.encode("Hello, NeoLM!"))
|
|
|
|
| 81 |
|
| 82 |
## Training data
|
| 83 |
|
| 84 |
+
Foundation pretraining uses the **`foundation`** configuration of [NeoCorpus](https://huggingface.co/datasets/MaagDeveloper/NeoCorpus), derived from a filtered English-focused subset of [Karpathy ClimbMix Shuffle](https://huggingface.co/datasets/karpathy/climbmix-400b-shuffle), based on [NVIDIA Nemotron-ClimbMix](https://huggingface.co/datasets/nvidia/Nemotron-ClimbMix). The training split contains **1,889,952 documents / 1,147,218,931 tokens**, counted with this release's tokenizer (including document EOS separators). The validation split contains **5,000 documents / 3,084,132 tokens**; the test split contains **20,000 documents / 12,094,582 tokens**. Validation and test were held out from pretraining. See the dataset card for preparation, attribution, and licensing details.
|
| 85 |
+
|
| 86 |
+
The tokenizer is trained on the Foundation training split, and pretraining consumes contiguous `uint16` token streams with EOS between documents and 1,024-token windows at stride 1,023 (one-token overlap).
|
| 87 |
+
|
| 88 |
+
## Evaluation
|
| 89 |
+
|
| 90 |
+
The **selected 30K continuation checkpoint** was evaluated on held-out Foundation token streams:
|
| 91 |
|
| 92 |
+
| Checkpoint | Full validation loss | Full validation PPL | Test loss | Test PPL |
|
| 93 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 94 |
+
| Foundation continued 20K | 3.2685 | 26.27 | 3.2498 | 25.78 |
|
| 95 |
+
| **Foundation continued 30K** | **3.2677** | **26.25** | **3.2489** | **25.76** |
|
| 96 |
+
|
| 97 |
+
The 30K continuation improves the reported full validation loss over the 20K checkpoint by approximately **0.0008**; this is a small measured improvement, not evidence of a qualitative capability jump. Checkpoint selection should use validation rather than repeatedly consulted test results.
|
| 98 |
+
|
| 99 |
+
For the BF16 release, the model was exported separately from the FP32 master, reloaded, and used successfully for text generation. A local **256-block quick validation comparison**, using the same BF16 autocast compute settings for both weight versions, reported:
|
| 100 |
+
|
| 101 |
+
| Weight version | Quick validation loss | Quick validation PPL |
|
| 102 |
+
| --- | ---: | ---: |
|
| 103 |
+
| FP32 source | 3.236623 | 25.4476 |
|
| 104 |
+
| BF16 export | 3.236627 | 25.4477 |
|
| 105 |
+
|
| 106 |
+
The observed difference was **+0.000004 loss**. This is a *quick-subset parity check*, not a separate full-validation result or proof that every generated output will be identical. Published weights are BF16; the local FP32 master is retained separately.
|
| 107 |
|
| 108 |
## Load and generate text
|
| 109 |
|
| 110 |
+
Install compatible versions of `torch` and `transformers`. The model requires custom Python code, so review the repository code before enabling `trust_remote_code=True`. Use `revision="stage1-foundation"` to load the original historical release instead of the latest stable Base.
|
| 111 |
|
| 112 |
```python
|
| 113 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 114 |
|
| 115 |
repo_id = "MaagDeveloper/NeoLM-Small-Base"
|
| 116 |
+
revision = "main"
|
| 117 |
|
| 118 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 119 |
repo_id, revision=revision, trust_remote_code=True
|
|
|
|
| 133 |
|
| 134 |
outputs = model.generate(
|
| 135 |
**inputs,
|
| 136 |
+
max_new_tokens=200,
|
| 137 |
do_sample=True,
|
| 138 |
+
temperature=0.3,
|
| 139 |
top_p=0.9,
|
| 140 |
repetition_penalty=1.15,
|
| 141 |
eos_token_id=tokenizer.eos_token_id,
|
|
|
|
| 145 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 146 |
```
|
| 147 |
|
|
|
|
| 148 |
## Streaming Text Generation
|
| 149 |
|
| 150 |
+
Stream generated text progressively using Hugging Face Transformers' `TextStreamer`:
|
| 151 |
|
| 152 |
```python
|
| 153 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
|
| 154 |
|
| 155 |
repo_id = "MaagDeveloper/NeoLM-Small-Base"
|
| 156 |
+
revision = "main"
|
| 157 |
|
| 158 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 159 |
repo_id,
|
|
|
|
| 180 |
_ = model.generate(
|
| 181 |
**inputs,
|
| 182 |
streamer=streamer,
|
| 183 |
+
max_new_tokens=100,
|
| 184 |
do_sample=True,
|
| 185 |
+
temperature=0.3,
|
| 186 |
top_p=0.9,
|
| 187 |
repetition_penalty=1.15,
|
| 188 |
eos_token_id=tokenizer.eos_token_id,
|
|
|
|
| 190 |
)
|
| 191 |
```
|
| 192 |
|
| 193 |
+
Both examples are **text completion**, not role-based chat. For generation within the trained 1,024-token context, keep the total prompt-plus-generation length within the model's context window.
|
| 194 |
|
| 195 |
+
## Capabilities and limitations
|
| 196 |
|
| 197 |
+
The Base checkpoint can generate fluent English passages and frequently follows broad topical cues in its prompt. These observations are **not** evidence of reliable instruction following, robust reasoning, or factual accuracy. Exploratory generation also exhibits repetition, invented facts, inconsistent entities, topic drift, and occasional malformed endings.
|
| 198 |
|
| 199 |
+
The model is small and English-focused; it can hallucinate, reproduce undesirable patterns, generate harmful or biased material, and fail on multi-step reasoning, factual recall, long-range coherence, or strict output formats. Do not treat generated material as verified information. A future instruction-tuned model, if released, will live in a separate repository.
|
| 200 |
|
| 201 |
## Provenance and licensing
|
| 202 |
|
| 203 |
- Dataset: [MaagDeveloper/NeoCorpus](https://huggingface.co/datasets/MaagDeveloper/NeoCorpus), `foundation` configuration.
|
| 204 |
+
- NeoCorpus's attribution and CC BY-NC 4.0 notice do not automatically establish a separate license for model weights. **Verify the appropriate model-weight license and source-data obligations before commercial use.**
|
| 205 |
+
- `stage1-foundation` preserves the historical original release. The 30K release tag is intended to preserve a separate immutable weights-and-documentation snapshot after the README update.
|
| 206 |
|
| 207 |
+
NeoLM is an independent project and is not affiliated with NVIDIA, Andrej Karpathy, or Hugging Face.
|