How to use from the
Use from the
Transformers library
# 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]:]))
Quick Links

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

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, the licence of its training data.

Trained on text from Simple English Wikipedia by Wikipedia contributors, licensed under CC 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.

Downloads last month
-
Safetensors
Model size
13.8M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support