Text Generation
Transformers
Safetensors
English
llama
my-little-pony
mlp
fanfiction
small-language-model
from-scratch
lissa
roleplay
rp
character
edge-deployment
text-generation-inference
Instructions to use CastIronMind/LissaNano-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CastIronMind/LissaNano-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CastIronMind/LissaNano-Instruct")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CastIronMind/LissaNano-Instruct") model = AutoModelForCausalLM.from_pretrained("CastIronMind/LissaNano-Instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CastIronMind/LissaNano-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CastIronMind/LissaNano-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CastIronMind/LissaNano-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CastIronMind/LissaNano-Instruct
- SGLang
How to use CastIronMind/LissaNano-Instruct 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 "CastIronMind/LissaNano-Instruct" \ --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": "CastIronMind/LissaNano-Instruct", "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 "CastIronMind/LissaNano-Instruct" \ --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": "CastIronMind/LissaNano-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CastIronMind/LissaNano-Instruct with Docker Model Runner:
docker model run hf.co/CastIronMind/LissaNano-Instruct
File size: 7,139 Bytes
7ee55f1 a711131 7ee55f1 a711131 7ee55f1 a711131 7ee55f1 a711131 7ee55f1 36883d3 a711131 36883d3 a711131 36883d3 a711131 36883d3 a711131 36883d3 a711131 36883d3 7ee55f1 a711131 7ee55f1 36883d3 7ee55f1 a711131 7ee55f1 a711131 36883d3 7ee55f1 36883d3 7ee55f1 36883d3 a711131 36883d3 a711131 7ee55f1 5632649 10243c0 36883d3 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 a711131 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 a711131 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 a711131 7ee55f1 a711131 7ee55f1 a711131 7ee55f1 a711131 7ee55f1 36883d3 7ee55f1 36883d3 7ee55f1 a711131 7ee55f1 36883d3 a711131 7ee55f1 a711131 7ee55f1 36883d3 2efc89e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | ---
language:
- en
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
pretty_name: LissaNano-Instruct
tags:
- text-generation
- llama
- my-little-pony
- mlp
- fanfiction
- small-language-model
- from-scratch
- lissa
- roleplay
- rp
- character
- edge-deployment
model_card_authors:
- CastIronMind
---
<div align="center">
<img src="logo.png" width="60%" alt="LissaNano-Instruct" />
</div>
<hr>
<div align="center" style="line-height: 1;">
<a href="https://huggingface.co/CastIronMind/LissaNano-Instruct/blob/main/LICENSE" target="_blank" style="margin: 2px;">
<img alt="License" src="https://img.shields.io/badge/license-Apache%202.0-blue" style="display: inline-block; vertical-align: middle;" />
</a>
<a href="https://huggingface.co/CastIronMind/LissaNano-Instruct" target="_blank" style="margin: 2px;">
<img alt="Parameters" src="https://img.shields.io/badge/parameters-32M-2ea44f" style="display: inline-block; vertical-align: middle;" />
</a>
<a href="https://huggingface.co/CastIronMind/LissaNano-Instruct" target="_blank" style="margin: 2px;">
<img alt="Context" src="https://img.shields.io/badge/context-1%2C024%20tokens-orange" style="display: inline-block; vertical-align: middle;" />
</a>
<a href="https://huggingface.co/CastIronMind/LissaNano-Instruct" target="_blank" style="margin: 2px;">
<img alt="Vocabulary" src="https://img.shields.io/badge/vocab-16%2C384-blue" style="display: inline-block; vertical-align: middle;" />
</a>
<a href="https://huggingface.co/CastIronMind/LissaNano-Instruct" target="_blank" style="margin: 2px;">
<img alt="Weights" src="https://img.shields.io/badge/weights-64 MB-lightgrey" style="display: inline-block; vertical-align: middle;" />
</a>
</div>
# LissaNano-Instruct
## 1. Introduction
**The smallest My Little Pony language model we could find: 32 million parameters and 64 MB of weights.** This is the supervised checkpoint, tuned for character-driven conversation.
- **Trained from scratch.** No distilled weights and no borrowed backbone: a Llama architecture with a 16,384-token vocabulary, pretrained on a fandom corpus and then supervised on dialogue.
- **Built for character work.** The supervised stage uses roleplay and persona data, so the model spends its capacity on voice, character and scene.
- **Dialogue format is required.** The model expects the exact `<system>` / `<user>` / `<assistant>` layout described in section 6.
- **Trained by one person on one consumer GPU.** No cluster, no budget, no institutional support.
## 2. Model Overview
| field | value |
|---|---|
| Type | Causal Language Model |
| Training stage | Pretraining from scratch, then supervised fine-tuning |
| Architecture | Llama |
| Parameters | 31,990,272 (32M) |
| Layers | 8 |
| Hidden size | 512 |
| Attention heads | 16 (2 key/value heads) |
| Head dimension | 32 |
| Intermediate size | 1,536 |
| Context length | 1,024 tokens |
| Vocabulary | 16,384 (byte-level BPE) |
| Tied embeddings | yes |
| Precision | bfloat16 |
| License | Apache 2.0 |
## 3. The Lissa family
| model | parameters | weights | best for |
|---|---:|---:|---|
| [LissaNano-Base](https://huggingface.co/CastIronMind/LissaNano-Base) | 32M | 64 MB | continued pretraining, research |
| [LissaNano-Instruct](https://huggingface.co/CastIronMind/LissaNano-Instruct) | 32M | 64 MB | phones, single-board computers, embedded use |
| [LissaBrat-Base](https://huggingface.co/CastIronMind/LissaBrat-Base) | 103M | 206 MB | continued pretraining, research |
| [LissaBrat-Instruct](https://huggingface.co/CastIronMind/LissaBrat-Instruct) | 103M | 206 MB | laptops, longer and more coherent text |
| [Lissa 1.5B Instruct](https://huggingface.co/CastIronMind/Lissa-1.5B-Instruct) | 1.45B | 2.9 GB | a full roleplay partner |
| [Lissa 1.5B Base](https://huggingface.co/CastIronMind/Lissa-1.5B-Base) | 1.45B | 2.9 GB | pretraining, research |
**GGUF quantizations:** [LissaNano-Instruct-GGUF](https://huggingface.co/CastIronMind/LissaNano-Instruct-GGUF) — 15 files from Q8_0 down to IQ2, each with measured perplexity against this bf16 checkpoint.
**Demo:** [Lissa Playground](https://huggingface.co/spaces/CastIronMind/Lissa-Playground) — compare quantizations side by side in the browser, no server.
## 4. Requirements
```
pip install torch transformers
```
No custom kernels and no exotic dependencies: this is a plain Llama checkpoint and loads with any recent `transformers`.
## 5. Quick start
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "CastIronMind/LissaNano-Instruct"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16)
model.eval()
SYS, USR, AST, EOS = 2, 3, 4, 1
system = "You are Twilight Sparkle, a studious purple unicorn who loves books."
user = "Twilight, I found a strange book in the library."
ids = [SYS] + tok.encode(system, add_special_tokens=False) \
+ [USR] + tok.encode(user, add_special_tokens=False) + [AST]
x = torch.tensor([ids], dtype=torch.long)
out = model.generate(x, max_new_tokens=120, do_sample=True,
temperature=0.8, top_p=0.9, repetition_penalty=1.1,
pad_token_id=0, eos_token_id=EOS)
print(tok.decode(out[0][len(ids):], skip_special_tokens=True))
```
## 6. Prompt format
The model was supervised on exactly this layout:
```
<system>{persona}<user>{message}<assistant>{reply}<eos>
```
Tags are concatenated without spaces. A non-empty system message is required: every supervised example carried one.
**Special tokens.** `0 <pad>`, `1 <eos>`, `2 <system>`, `3 <user>`, `4 <assistant>`.
**Sampling.** Temperature 0.8, top_p 0.9, repetition penalty 1.1.
## 7. Data
**Pretraining.** Fandom prose and forums from the My Little Pony community, about 1 billion unique tokens, two epochs.
**Supervised fine-tuning.** Roleplay and persona dialogues with the `<system>` / `<user>` / `<assistant>` layout, two epochs.
## 8. Evaluation
This checkpoint is tuned for dialogue, so held-out perplexity is reported on the base model card, where it is measured on the same frozen set for every model in the family: see [LissaNano-Base](https://huggingface.co/CastIronMind/LissaNano-Base).
What the supervised stage targets: character voice, in-persona dialogue, and stable formatting across turns.
## 9. Hardware and cost
| item | value |
|---|---|
| Training hardware | one consumer GPU |
| Authors | one person |
| Weights on disk | 64 MB (bfloat16) |
| License | Apache 2.0 |
## 10. Intended use
- roleplay bots and character agents in chat applications
- embedded and offline deployments: games, visual novels, toys
- experiments with character consistency in small models
- further fine-tuning on a specific character; the model retrains in minutes
## 11. License
Apache License 2.0. Use it, fine-tune it, quantize it, embed it, and publish your own versions.
- ПАЦАНЫ, это малышок, она генерирует текст, и это иногда даже похоже на смысл!
|