Text Generation
Transformers
ONNX
Safetensors
English
llama
tool-use
wikipedia
simple-english
small-language-model
from-scratch
conversational
text-generation-inference
Instructions to use Flickwire/sew-slm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Flickwire/sew-slm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Flickwire/sew-slm") 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("Flickwire/sew-slm") model = AutoModelForCausalLM.from_pretrained("Flickwire/sew-slm", 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 Flickwire/sew-slm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Flickwire/sew-slm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Flickwire/sew-slm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Flickwire/sew-slm
- SGLang
How to use Flickwire/sew-slm 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 "Flickwire/sew-slm" \ --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": "Flickwire/sew-slm", "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 "Flickwire/sew-slm" \ --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": "Flickwire/sew-slm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Flickwire/sew-slm with Docker Model Runner:
docker model run hf.co/Flickwire/sew-slm
|
Download README.md from Flickwire/sew-slm: direct link, hf CLI and curl.
- Browser
- Download file 5.77 kB
-
https://huggingface.co/Flickwire/sew-slm/resolve/main/README.md
- Command line
-
hf download hf://Flickwire/sew-slm/README.md
-
curl -L -o README.md https://huggingface.co/Flickwire/sew-slm/resolve/main/README.md
5.77 kB
| license: cc-by-sa-4.0 | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - tool-use | |
| - wikipedia | |
| - simple-english | |
| - small-language-model | |
| - from-scratch | |
| # SEW-SLM | |
| A 13.8M-parameter language model trained from scratch **only on Simple English | |
| Wikipedia**. It is fine-tuned to **look things up on Simple English Wikipedia with tool | |
| calls**, so it can answer about articles written or changed after it was trained. | |
| Code, training pipeline and model-independent tools: https://github.com/Flickwire/sew-slm | |
| ## Quick start | |
| ```bash | |
| pip install torch transformers | |
| git clone https://huggingface.co/Flickwire/sew-slm && cd sew-slm | |
| python agent.py -v "What is a volcano?" # uses a GPU if available (--device cpu to force CPU) | |
| ``` | |
| `agent.py` runs the tool loop against the live site (simple.wikipedia.org); add | |
| `--offline articles.jsonl` to use a local dump instead. Plain `generate()` works too, but | |
| it only *writes* the tool call. Something has to run it and append the result, which is what | |
| `agent.py` does. | |
| ## Tool-call format | |
| ``` | |
| <|user|>What is a volcano?<|end|><|assistant|><|call|>search: volcano<|/call|><|result|>[1] Volcano: A volcano is a mountain ... | |
| [2] ...<|/result|>A volcano is a mountain that has lava ...<|end|> | |
| ``` | |
| | Call | Result | | |
| |---|---| | |
| | `search: <query>` | Top 3 articles, each `[n] Title: opening sentences` | | |
| | `read: <title>` | `Title: opening paragraphs` of one article | | |
| Stop generation on `<|/call|>`, `<|end|>` or `<|endoftext|>` (already set in | |
| `generation_config.json`). The tokenizer's chat template renders standard messages, with | |
| assistant `tool_calls` (`{"function": {"name": "search", "arguments": {"query": "..."}}}`) and | |
| `role: "tool"` results, into this format. | |
| ## Browser / ONNX | |
| `onnx/model.onnx` (full precision) and `onnx/model_quantized.onnx` (8-bit weights, about 14 MB) | |
| use the transformers.js layout with KV cache, so the model runs in the browser on WASM or | |
| WebGPU. On real tool-use conversations the 8-bit model picks the same next token as the full | |
| model 99.9% of the time. | |
| ## Training | |
| | | | | |
| |---|---| | |
| | Architecture | Llama-style decoder: 6 layers, d_model 384, 6 heads, RoPE, RMSNorm, SwiGLU, tied embeddings | | |
| | Context | 512 tokens during training | | |
| | Tokenizer | 8192-token byte-level BPE, trained on the same corpus | | |
| | Pretraining data | Simple English Wikipedia dump (newest revision 2026-11-02): ~258k articles, ~77M tokens, converted to plain text | | |
| | Fine-tuning data | 150k tool-use conversations built from the same articles, mixed 80/20 with pretraining text | | |
| | Compute | One AMD Radeon RX 7700 XT (ROCm): 26 min pretraining (6,000 steps at batch 64×512, ~197M tokens), 9 min fine-tuning (2,000 steps at batch 64) | | |
| No other corpus, pretrained weights or teacher model was used. The fine-tuning | |
| conversations add a small amount of fixed scaffolding around the Wikipedia content: | |
| question templates (for example "What is {title}?") and one refusal sentence. Every fact | |
| in them comes from a Simple English Wikipedia article. The answer is always copied from the | |
| tool result, and loss is computed only on the model's own tokens, so the model learns to | |
| answer from what the tool returns rather than from memory. | |
| About 15% of the conversations teach failure handling: reading an article by title when | |
| search misses it, saying it found nothing when no article matches, and saying it could not | |
| reach Wikipedia when a tool call fails. | |
| ## Evaluation | |
| | Lookup questions | Questions | Tool called | Article found | Answer copied from article | Answer F1 | | |
| |---|---|---|---|---|---| | |
| | Random articles from the training dump (offline tool) | 200 | 100% | 98% | 94% | 0.94 | | |
| | Search never returns the article (should read it by title) | 200 | 100% | 66% | 56% | 0.63 | | |
| | Articles created after the training dump (live tool) | 30 | 100% | 93% | 93% | 0.89 | | |
| | Failure handling | Questions | Tool called | Gave the expected reply | | |
| |---|---|---|---| | |
| | No such article (should say it found nothing) | 200 | 100% | 84% | | |
| | Every tool call fails (should say it could not reach Wikipedia) | 200 | 100% | 100% | | |
| - *Tool called*: the model made at least one tool call. | |
| - *Article found*: one of its calls returned the article the question was about. | |
| - *Answer copied from article*: the answer matches the start of that article's opening text. | |
| - *Answer F1*: word-overlap F1 between the answer and the article's first two sentences. | |
| - *Gave the expected reply*: the exact "could not find" or "could not reach" sentence the model was trained to give. | |
| ## Limitations | |
| - At this size the model is mainly a *reader* of what the tool returns. On its own it | |
| writes simple but often inaccurate text. Do not rely on it for facts without a tool result. | |
| - It handles single questions of the form "what/who/where is X" or "tell me (more) about X". It | |
| was not trained on multi-turn chat or on questions that need reasoning across several articles. | |
| - Answers are only as accurate as the Simple English Wikipedia article it retrieves. | |
| ## Licence and attribution | |
| The model is released under | |
| [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/), the licence of its | |
| training data. | |
| Trained on text from [Simple English Wikipedia](https://simple.wikipedia.org) by Wikipedia | |
| contributors, licensed under | |
| [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). Source: | |
| `simplewiki-latest-pages-articles.xml.bz2` from https://dumps.wikimedia.org/simplewiki/ (newest | |
| revision 2026-11-02). Changes: wikitext was converted to plain text (templates, tables, | |
| references and some sections removed), and tool-use conversations were built from it. | |
| This project is not affiliated with or endorsed by the Wikimedia Foundation. | |
| "Wikipedia" is a trademark of the Wikimedia Foundation. | |