Text Generation
Transformers
Safetensors
English
llama
small-language-model
efficient
edge-deployment
speculative-decoding
150m-parameters
tpu-trained
research
low-resource
portimbria
gqa
fineweb
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use StentorLabs/Portimbria-150M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use StentorLabs/Portimbria-150M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="StentorLabs/Portimbria-150M") 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("StentorLabs/Portimbria-150M") model = AutoModelForCausalLM.from_pretrained("StentorLabs/Portimbria-150M", 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 StentorLabs/Portimbria-150M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "StentorLabs/Portimbria-150M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "StentorLabs/Portimbria-150M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/StentorLabs/Portimbria-150M
- SGLang
How to use StentorLabs/Portimbria-150M 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 "StentorLabs/Portimbria-150M" \ --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": "StentorLabs/Portimbria-150M", "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 "StentorLabs/Portimbria-150M" \ --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": "StentorLabs/Portimbria-150M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use StentorLabs/Portimbria-150M with Docker Model Runner:
docker model run hf.co/StentorLabs/Portimbria-150M
Update README.md
Browse files
README.md
CHANGED
|
@@ -174,7 +174,9 @@ Portimbria-150M is a `LlamaForCausalLM` model with Grouped Query Attention (GQA)
|
|
| 174 |
| **Total Parameters** | 151,026,432 | |
|
| 175 |
| **Positional Encoding** | RoPE | `rope_theta = 50,000.0` |
|
| 176 |
|
| 177 |
-
|
|
|
|
|
|
|
| 178 |
|
| 179 |
### Full Core Configuration
|
| 180 |
|
|
@@ -249,6 +251,9 @@ total = 25,165,824 + 125,859,840 + 768 = 151,026,432 ✓
|
|
| 249 |
|
| 250 |
With a standard 32K vocabulary, embedding takes only 16.7% of the parameter budget — leaving 83.3% for the transformer stack that actually learns language patterns. This represents a healthy allocation at this scale, especially with GQA dramatically cutting the attention head count without sacrificing hidden dimension depth.
|
| 251 |
|
|
|
|
|
|
|
|
|
|
| 252 |
---
|
| 253 |
|
| 254 |
## Head-to-Head: StentorLabs Model Family
|
|
@@ -319,7 +324,9 @@ print(tokenizer.decode(generated, skip_special_tokens=True))
|
|
| 319 |
|
| 320 |
> ℹ️ **No custom tokenizer required.** Portimbria-150M uses the Mistral BPE tokenizer via `AutoTokenizer`. No additional packages needed beyond `transformers`.
|
| 321 |
|
| 322 |
-
|
|
|
|
|
|
|
| 323 |
|
| 324 |
### 4. Using the Pipeline
|
| 325 |
|
|
@@ -355,6 +362,9 @@ print(result[0]["generated_text"])
|
|
| 355 |
|
| 356 |
> **max_new_tokens guidance:** Don't set this too low for creative tasks — the model often generates an EOS token and stops on its own before hitting the ceiling anyway. Setting a generous ceiling (e.g. 2000) for open-ended generation costs nothing if the model stops early.
|
| 357 |
|
|
|
|
|
|
|
|
|
|
| 358 |
---
|
| 359 |
|
| 360 |
## ⚠️ Important Limitations
|
|
@@ -415,7 +425,9 @@ These are candid, first-hand observations about this model.
|
|
| 415 |
| **Orchestration** | HuggingFace Accelerate + torchrun |
|
| 416 |
| **Process Group Init** | `env://` (XLA backend) |
|
| 417 |
|
| 418 |
-
|
|
|
|
|
|
|
| 419 |
|
| 420 |
### Software Stack
|
| 421 |
|
|
@@ -437,11 +449,16 @@ These are candid, first-hand observations about this model.
|
|
| 437 |
| Total training tokens | ~6,000,000,000 |
|
| 438 |
| Total wall-clock time (epoch) | 28,871s (~8.02h) |
|
| 439 |
|
|
|
|
|
|
|
|
|
|
| 440 |
---
|
| 441 |
|
| 442 |
## Training Hyperparameters — Complete Reference
|
| 443 |
|
| 444 |
-
|
|
|
|
|
|
|
| 445 |
|
| 446 |
### Core Training Parameters
|
| 447 |
|
|
@@ -503,11 +520,16 @@ Phase 2 — Cosine Decay (steps 1,144–22,889):
|
|
| 503 |
LR decays from 8e-4 → 0 following a cosine curve
|
| 504 |
```
|
| 505 |
|
|
|
|
|
|
|
|
|
|
| 506 |
---
|
| 507 |
|
| 508 |
## Precision Stability Recipe
|
| 509 |
|
| 510 |
-
|
|
|
|
|
|
|
| 511 |
|
| 512 |
Training on TPU v5e in BF16 requires deliberate precision management to avoid gradient instabilities at 150M scale.
|
| 513 |
|
|
@@ -548,6 +570,9 @@ Not applied. PyTorch SDPA handles softmax numerical stability internally and req
|
|
| 548 |
| FP32 critical layers | **2** | First + last transformer layers |
|
| 549 |
| FP32 softmax modules | **0** | Skipped — SDPA incompatible |
|
| 550 |
|
|
|
|
|
|
|
|
|
|
| 551 |
---
|
| 552 |
|
| 553 |
## Data Pipeline
|
|
@@ -562,7 +587,9 @@ Training used a **web/code/math curriculum** with the following source mix:
|
|
| 562 |
|
| 563 |
**Total tokens processed:** ~6,000,000,000 (single epoch over source data)
|
| 564 |
|
| 565 |
-
|
|
|
|
|
|
|
| 566 |
|
| 567 |
### Curriculum Design
|
| 568 |
|
|
@@ -594,11 +621,16 @@ return text
|
|
| 594 |
|
| 595 |
Samples are packed into fixed 4,096-token blocks. Labels are identical to `input_ids` (causal LM objective). No cross-document attention masking is applied between packed samples — this is standard practice for web-text pretraining.
|
| 596 |
|
|
|
|
|
|
|
|
|
|
| 597 |
---
|
| 598 |
|
| 599 |
## Weight Initialization
|
| 600 |
|
| 601 |
-
|
|
|
|
|
|
|
| 602 |
|
| 603 |
```python
|
| 604 |
def initialize_weights(model, std=0.02, num_hidden_layers=20):
|
|
@@ -624,6 +656,9 @@ module.weight.data.fill_(1.0)
|
|
| 624 |
|
| 625 |
- RMSNorm scales start at 1.0 (identity).
|
| 626 |
|
|
|
|
|
|
|
|
|
|
| 627 |
---
|
| 628 |
|
| 629 |
## Evaluation & Results
|
|
@@ -650,7 +685,9 @@ module.weight.data.fill_(1.0)
|
|
| 650 |
|
| 651 |
> **Comparison note:** PPL values are not directly comparable across this family for two reasons: different tokenizers (TokenMonster 8K vs Mistral BPE 32K produce different token spaces) and different training data mixes (all prior StentorLabs models trained on web text only; Portimbria-150M is the first to include code and math). Both factors make a raw PPL number-to-number comparison misleading — Portimbria-150M's real improvement over Stentor2 is larger than the headline numbers suggest.
|
| 652 |
|
| 653 |
-
|
|
|
|
|
|
|
| 654 |
|
| 655 |
| Step | Eval Loss | Perplexity | Notes |
|
| 656 |
|---|---|---|---|
|
|
@@ -669,6 +706,9 @@ module.weight.data.fill_(1.0)
|
|
| 669 |
| **18,000** | **2.8906** | **18.03** | **Best checkpoint saved** |
|
| 670 |
| Final (epoch end) | 2.8906 | **18.00** | Final model |
|
| 671 |
|
|
|
|
|
|
|
|
|
|
| 672 |
---
|
| 673 |
|
| 674 |
## Benchmark Results
|
|
@@ -885,7 +925,9 @@ The first three are the first three responses obtained with no cherry-picking
|
|
| 885 |
|
| 886 |
## Training Dynamics
|
| 887 |
|
| 888 |
-
|
|
|
|
|
|
|
| 889 |
|
| 890 |
The training run processed approximately **6 billion tokens** across a single epoch (epoch 0), running for **22,889 optimizer steps** before the token budget was exhausted.
|
| 891 |
|
|
@@ -899,6 +941,9 @@ The training run processed approximately **6 billion tokens** across a single ep
|
|
| 899 |
|
| 900 |
**Total wall-clock time:** ~8.02 hours (epoch training) + ~8 minutes (final eval and save).
|
| 901 |
|
|
|
|
|
|
|
|
|
|
| 902 |
---
|
| 903 |
|
| 904 |
## Use Cases & Intended Uses
|
|
@@ -937,7 +982,9 @@ The training run processed approximately **6 billion tokens** across a single ep
|
|
| 937 |
|
| 938 |
## Ethical Considerations & Societal Impact
|
| 939 |
|
| 940 |
-
|
|
|
|
|
|
|
| 941 |
|
| 942 |
### Inherited Data Biases
|
| 943 |
|
|
@@ -963,11 +1010,16 @@ No RLHF, DPO, constitutional AI, or content filtering of any kind has been appli
|
|
| 963 |
|
| 964 |
- **Minimal environmental footprint** — ~8 hours of TPU compute is negligible versus large-scale pretraining runs.
|
| 965 |
|
|
|
|
|
|
|
|
|
|
| 966 |
---
|
| 967 |
|
| 968 |
## Inference Guide
|
| 969 |
|
| 970 |
-
|
|
|
|
|
|
|
| 971 |
|
| 972 |
### CPU Inference (INT8 Dynamic Quantization)
|
| 973 |
|
|
@@ -1016,6 +1068,9 @@ return tokenizer.decode(output[0][input_ids.shape[1]:], skip_special_tokens=True
|
|
| 1016 |
print(generate("Once upon a time in a distant kingdom"))
|
| 1017 |
```
|
| 1018 |
|
|
|
|
|
|
|
|
|
|
| 1019 |
---
|
| 1020 |
|
| 1021 |
## 🚀 Free Inference — Try It Now
|
|
@@ -1032,7 +1087,9 @@ StentorLabs hosts a free demo space for all Stentor models:
|
|
| 1032 |
|
| 1033 |
## Quantization
|
| 1034 |
|
| 1035 |
-
|
|
|
|
|
|
|
| 1036 |
|
| 1037 |
### FP16 (GPU)
|
| 1038 |
|
|
@@ -1068,6 +1125,9 @@ device_map="auto",
|
|
| 1068 |
)
|
| 1069 |
```
|
| 1070 |
|
|
|
|
|
|
|
|
|
|
| 1071 |
---
|
| 1072 |
|
| 1073 |
## 🌍 Community Contributions — Build on This Model
|
|
@@ -1096,7 +1156,9 @@ If you build something with Portimbria-150M, please share it on HuggingFace and
|
|
| 1096 |
|
| 1097 |
## Format Conversion
|
| 1098 |
|
| 1099 |
-
|
|
|
|
|
|
|
| 1100 |
|
| 1101 |
### Convert to GGUF (llama.cpp)
|
| 1102 |
|
|
@@ -1121,13 +1183,18 @@ optimum-cli export onnx \\
|
|
| 1121 |
portimbria-150m-onnx/
|
| 1122 |
```
|
| 1123 |
|
|
|
|
|
|
|
|
|
|
| 1124 |
---
|
| 1125 |
|
| 1126 |
## Speculative Decoding
|
| 1127 |
|
| 1128 |
Portimbria-150M can serve as a fast **draft model** to accelerate inference from larger Llama-family target models. Because it shares vocabulary with standard Llama/Mistral models (32K BPE), the acceptance rate should be substantially higher than Stentor2 models (which use a different 8K tokenizer).
|
| 1129 |
|
| 1130 |
-
|
|
|
|
|
|
|
| 1131 |
|
| 1132 |
```python
|
| 1133 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
@@ -1154,6 +1221,9 @@ print(target_tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 1154 |
|
| 1155 |
> **Vocabulary compatibility:** Portimbria-150M uses the **Mistral-7B tokenizer** (32K BPE), which is *not* identical to the LLaMA-3 tokenizer (also 32K but with different token merges). It is compatible with models that use the same Mistral BPE vocabulary (e.g. `mistralai/Mistral-7B-v0.1` and derivatives). Vocabulary-compatible speculative decoding will yield higher acceptance rates; vocabulary-mismatched pairs will still work via HuggingFace's assisted generation but with lower acceptance rates.
|
| 1156 |
|
|
|
|
|
|
|
|
|
|
| 1157 |
---
|
| 1158 |
|
| 1159 |
## Bias, Risks & Limitations
|
|
@@ -1191,7 +1261,9 @@ print(target_tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 1191 |
| OPT-125M | 125M | 50K BPE | 2,048 | Meta; 180B tokens |
|
| 1192 |
| TinyLlama-1.1B | 1,100M | 32K BPE | 2,048 | 3T tokens; different scale tier |
|
| 1193 |
|
| 1194 |
-
|
|
|
|
|
|
|
| 1195 |
|
| 1196 |
| Paper | Relevance |
|
| 1197 |
|---|---|
|
|
@@ -1203,6 +1275,9 @@ print(target_tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 1203 |
| [Pythia](https://arxiv.org/abs/2304.01373) — Biderman et al., 2023 | Comparable small-model scaling study |
|
| 1204 |
| [Speculative Decoding](https://arxiv.org/abs/2211.17192) — Leviathan et al., 2023 | Primary deployment use case |
|
| 1205 |
|
|
|
|
|
|
|
|
|
|
| 1206 |
---
|
| 1207 |
|
| 1208 |
## Environmental Impact
|
|
|
|
| 174 |
| **Total Parameters** | 151,026,432 | |
|
| 175 |
| **Positional Encoding** | RoPE | `rope_theta = 50,000.0` |
|
| 176 |
|
| 177 |
+
<details>
|
| 178 |
+
<summary>▶ Full architecture spec, GQA explanation & parameter count breakdown</summary>
|
| 179 |
+
|
| 180 |
|
| 181 |
### Full Core Configuration
|
| 182 |
|
|
|
|
| 251 |
|
| 252 |
With a standard 32K vocabulary, embedding takes only 16.7% of the parameter budget — leaving 83.3% for the transformer stack that actually learns language patterns. This represents a healthy allocation at this scale, especially with GQA dramatically cutting the attention head count without sacrificing hidden dimension depth.
|
| 253 |
|
| 254 |
+
|
| 255 |
+
</details>
|
| 256 |
+
|
| 257 |
---
|
| 258 |
|
| 259 |
## Head-to-Head: StentorLabs Model Family
|
|
|
|
| 324 |
|
| 325 |
> ℹ️ **No custom tokenizer required.** Portimbria-150M uses the Mistral BPE tokenizer via `AutoTokenizer`. No additional packages needed beyond `transformers`.
|
| 326 |
|
| 327 |
+
<details>
|
| 328 |
+
<summary>▶ Pipeline usage & recommended generation settings</summary>
|
| 329 |
+
|
| 330 |
|
| 331 |
### 4. Using the Pipeline
|
| 332 |
|
|
|
|
| 362 |
|
| 363 |
> **max_new_tokens guidance:** Don't set this too low for creative tasks — the model often generates an EOS token and stops on its own before hitting the ceiling anyway. Setting a generous ceiling (e.g. 2000) for open-ended generation costs nothing if the model stops early.
|
| 364 |
|
| 365 |
+
|
| 366 |
+
</details>
|
| 367 |
+
|
| 368 |
---
|
| 369 |
|
| 370 |
## ⚠️ Important Limitations
|
|
|
|
| 425 |
| **Orchestration** | HuggingFace Accelerate + torchrun |
|
| 426 |
| **Process Group Init** | `env://` (XLA backend) |
|
| 427 |
|
| 428 |
+
<details>
|
| 429 |
+
<summary>▶ Software stack & throughput details</summary>
|
| 430 |
+
|
| 431 |
|
| 432 |
### Software Stack
|
| 433 |
|
|
|
|
| 449 |
| Total training tokens | ~6,000,000,000 |
|
| 450 |
| Total wall-clock time (epoch) | 28,871s (~8.02h) |
|
| 451 |
|
| 452 |
+
|
| 453 |
+
</details>
|
| 454 |
+
|
| 455 |
---
|
| 456 |
|
| 457 |
## Training Hyperparameters — Complete Reference
|
| 458 |
|
| 459 |
+
<details>
|
| 460 |
+
<summary>▶ Full hyperparameter tables (optimizer, batch, schedule, checkpointing)</summary>
|
| 461 |
+
|
| 462 |
|
| 463 |
### Core Training Parameters
|
| 464 |
|
|
|
|
| 520 |
LR decays from 8e-4 → 0 following a cosine curve
|
| 521 |
```
|
| 522 |
|
| 523 |
+
|
| 524 |
+
</details>
|
| 525 |
+
|
| 526 |
---
|
| 527 |
|
| 528 |
## Precision Stability Recipe
|
| 529 |
|
| 530 |
+
<details>
|
| 531 |
+
<summary>▶ FP32 norm patching, critical layer wrapping & recipe summary</summary>
|
| 532 |
+
|
| 533 |
|
| 534 |
Training on TPU v5e in BF16 requires deliberate precision management to avoid gradient instabilities at 150M scale.
|
| 535 |
|
|
|
|
| 570 |
| FP32 critical layers | **2** | First + last transformer layers |
|
| 571 |
| FP32 softmax modules | **0** | Skipped — SDPA incompatible |
|
| 572 |
|
| 573 |
+
|
| 574 |
+
</details>
|
| 575 |
+
|
| 576 |
---
|
| 577 |
|
| 578 |
## Data Pipeline
|
|
|
|
| 587 |
|
| 588 |
**Total tokens processed:** ~6,000,000,000 (single epoch over source data)
|
| 589 |
|
| 590 |
+
<details>
|
| 591 |
+
<summary>▶ Curriculum design, text preprocessing code & sequence packing details</summary>
|
| 592 |
+
|
| 593 |
|
| 594 |
### Curriculum Design
|
| 595 |
|
|
|
|
| 621 |
|
| 622 |
Samples are packed into fixed 4,096-token blocks. Labels are identical to `input_ids` (causal LM objective). No cross-document attention masking is applied between packed samples — this is standard practice for web-text pretraining.
|
| 623 |
|
| 624 |
+
|
| 625 |
+
</details>
|
| 626 |
+
|
| 627 |
---
|
| 628 |
|
| 629 |
## Weight Initialization
|
| 630 |
|
| 631 |
+
<details>
|
| 632 |
+
<summary>▶ Initialization scheme & residual scaling code</summary>
|
| 633 |
+
|
| 634 |
|
| 635 |
```python
|
| 636 |
def initialize_weights(model, std=0.02, num_hidden_layers=20):
|
|
|
|
| 656 |
|
| 657 |
- RMSNorm scales start at 1.0 (identity).
|
| 658 |
|
| 659 |
+
|
| 660 |
+
</details>
|
| 661 |
+
|
| 662 |
---
|
| 663 |
|
| 664 |
## Evaluation & Results
|
|
|
|
| 685 |
|
| 686 |
> **Comparison note:** PPL values are not directly comparable across this family for two reasons: different tokenizers (TokenMonster 8K vs Mistral BPE 32K produce different token spaces) and different training data mixes (all prior StentorLabs models trained on web text only; Portimbria-150M is the first to include code and math). Both factors make a raw PPL number-to-number comparison misleading — Portimbria-150M's real improvement over Stentor2 is larger than the headline numbers suggest.
|
| 687 |
|
| 688 |
+
<details>
|
| 689 |
+
<summary>▶ Full checkpoint history (14-step loss & perplexity table)</summary>
|
| 690 |
+
|
| 691 |
|
| 692 |
| Step | Eval Loss | Perplexity | Notes |
|
| 693 |
|---|---|---|---|
|
|
|
|
| 706 |
| **18,000** | **2.8906** | **18.03** | **Best checkpoint saved** |
|
| 707 |
| Final (epoch end) | 2.8906 | **18.00** | Final model |
|
| 708 |
|
| 709 |
+
|
| 710 |
+
</details>
|
| 711 |
+
|
| 712 |
---
|
| 713 |
|
| 714 |
## Benchmark Results
|
|
|
|
| 925 |
|
| 926 |
## Training Dynamics
|
| 927 |
|
| 928 |
+
<details>
|
| 929 |
+
<summary>▶ Step-by-step training phase breakdown & throughput details</summary>
|
| 930 |
+
|
| 931 |
|
| 932 |
The training run processed approximately **6 billion tokens** across a single epoch (epoch 0), running for **22,889 optimizer steps** before the token budget was exhausted.
|
| 933 |
|
|
|
|
| 941 |
|
| 942 |
**Total wall-clock time:** ~8.02 hours (epoch training) + ~8 minutes (final eval and save).
|
| 943 |
|
| 944 |
+
|
| 945 |
+
</details>
|
| 946 |
+
|
| 947 |
---
|
| 948 |
|
| 949 |
## Use Cases & Intended Uses
|
|
|
|
| 982 |
|
| 983 |
## Ethical Considerations & Societal Impact
|
| 984 |
|
| 985 |
+
<details>
|
| 986 |
+
<summary>▶ Data biases, safety considerations & societal impact</summary>
|
| 987 |
+
|
| 988 |
|
| 989 |
### Inherited Data Biases
|
| 990 |
|
|
|
|
| 1010 |
|
| 1011 |
- **Minimal environmental footprint** — ~8 hours of TPU compute is negligible versus large-scale pretraining runs.
|
| 1012 |
|
| 1013 |
+
|
| 1014 |
+
</details>
|
| 1015 |
+
|
| 1016 |
---
|
| 1017 |
|
| 1018 |
## Inference Guide
|
| 1019 |
|
| 1020 |
+
<details>
|
| 1021 |
+
<summary>▶ CPU inference (INT8) & GPU inference (FP16) code</summary>
|
| 1022 |
+
|
| 1023 |
|
| 1024 |
### CPU Inference (INT8 Dynamic Quantization)
|
| 1025 |
|
|
|
|
| 1068 |
print(generate("Once upon a time in a distant kingdom"))
|
| 1069 |
```
|
| 1070 |
|
| 1071 |
+
|
| 1072 |
+
</details>
|
| 1073 |
+
|
| 1074 |
---
|
| 1075 |
|
| 1076 |
## 🚀 Free Inference — Try It Now
|
|
|
|
| 1087 |
|
| 1088 |
## Quantization
|
| 1089 |
|
| 1090 |
+
<details>
|
| 1091 |
+
<summary>▶ FP16, BF16 & 4-bit (bitsandbytes) quantization code</summary>
|
| 1092 |
+
|
| 1093 |
|
| 1094 |
### FP16 (GPU)
|
| 1095 |
|
|
|
|
| 1125 |
)
|
| 1126 |
```
|
| 1127 |
|
| 1128 |
+
|
| 1129 |
+
</details>
|
| 1130 |
+
|
| 1131 |
---
|
| 1132 |
|
| 1133 |
## 🌍 Community Contributions — Build on This Model
|
|
|
|
| 1156 |
|
| 1157 |
## Format Conversion
|
| 1158 |
|
| 1159 |
+
<details>
|
| 1160 |
+
<summary>▶ Convert to GGUF (llama.cpp) & ONNX</summary>
|
| 1161 |
+
|
| 1162 |
|
| 1163 |
### Convert to GGUF (llama.cpp)
|
| 1164 |
|
|
|
|
| 1183 |
portimbria-150m-onnx/
|
| 1184 |
```
|
| 1185 |
|
| 1186 |
+
|
| 1187 |
+
</details>
|
| 1188 |
+
|
| 1189 |
---
|
| 1190 |
|
| 1191 |
## Speculative Decoding
|
| 1192 |
|
| 1193 |
Portimbria-150M can serve as a fast **draft model** to accelerate inference from larger Llama-family target models. Because it shares vocabulary with standard Llama/Mistral models (32K BPE), the acceptance rate should be substantially higher than Stentor2 models (which use a different 8K tokenizer).
|
| 1194 |
|
| 1195 |
+
<details>
|
| 1196 |
+
<summary>▶ Speculative decoding code & vocabulary compatibility notes</summary>
|
| 1197 |
+
|
| 1198 |
|
| 1199 |
```python
|
| 1200 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
| 1221 |
|
| 1222 |
> **Vocabulary compatibility:** Portimbria-150M uses the **Mistral-7B tokenizer** (32K BPE), which is *not* identical to the LLaMA-3 tokenizer (also 32K but with different token merges). It is compatible with models that use the same Mistral BPE vocabulary (e.g. `mistralai/Mistral-7B-v0.1` and derivatives). Vocabulary-compatible speculative decoding will yield higher acceptance rates; vocabulary-mismatched pairs will still work via HuggingFace's assisted generation but with lower acceptance rates.
|
| 1223 |
|
| 1224 |
+
|
| 1225 |
+
</details>
|
| 1226 |
+
|
| 1227 |
---
|
| 1228 |
|
| 1229 |
## Bias, Risks & Limitations
|
|
|
|
| 1261 |
| OPT-125M | 125M | 50K BPE | 2,048 | Meta; 180B tokens |
|
| 1262 |
| TinyLlama-1.1B | 1,100M | 32K BPE | 2,048 | 3T tokens; different scale tier |
|
| 1263 |
|
| 1264 |
+
<details>
|
| 1265 |
+
<summary>▶ Related research papers</summary>
|
| 1266 |
+
|
| 1267 |
|
| 1268 |
| Paper | Relevance |
|
| 1269 |
|---|---|
|
|
|
|
| 1275 |
| [Pythia](https://arxiv.org/abs/2304.01373) — Biderman et al., 2023 | Comparable small-model scaling study |
|
| 1276 |
| [Speculative Decoding](https://arxiv.org/abs/2211.17192) — Leviathan et al., 2023 | Primary deployment use case |
|
| 1277 |
|
| 1278 |
+
|
| 1279 |
+
</details>
|
| 1280 |
+
|
| 1281 |
---
|
| 1282 |
|
| 1283 |
## Environmental Impact
|