Instructions to use PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early") model = AutoModelForCausalLM.from_pretrained("PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early
- SGLang
How to use PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early 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 "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early" \ --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": "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early", "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 "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early" \ --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": "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early with Docker Model Runner:
docker model run hf.co/PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early
Lewi Surge Preview 3B (Chat, Early)
An early, partially fine-tuned chat checkpoint of Lewi Surge, an open mixture-of-experts language model for programming trained from scratch by one person in Ukraine.
⚠️ Read this first. This checkpoint went through less than a quarter of the planned chat fine-tuning (SFT). The run had to stop when the compute budget ran out. It already answers in the chat format and stops on its own, but it is not a finished assistant. We publish it as it is, so you can see the real state of the project.
💛 Why it's unfinished, and how you can help. Lewi is built without funding, on free and donated compute. The full fine-tuning (identity, instruction following, code and multilingual conversations) is prepared and ready to run; what's missing is GPU time. About $3 buys one hour on an NVIDIA GH200, and just $50 would unlock ~120 hours on a GH200 (the provider gives us access after a $50 deposit, and our free credits cover the rest), enough to finish SFT and fix the problems below. If you'd like to see Lewi finished, you can support it on Ko-fi.
Known problems
All of these come from the fine-tuning being cut short, not from the architecture. The data to fix them is already prepared (382k conversations, including identity and instruction-following sets).
| Problem | What you'll see | Fix (needs compute) |
|---|---|---|
| Weak identity | May claim to be "a software engineer" or another persona instead of Lewi | Identity conversations in the full SFT |
| Ignores format and language instructions | "Only code" or "answer in Ukrainian" is often not followed | Instruction-following data in the full SFT |
| Loops in long lists | Long enumerations can repeat items | More SFT steps + long-context stage |
| Short context | Trained on up to 16k-token conversations; 128k stage is in progress | Long-context stage on TPU (queued) |
| Factual errors | States wrong facts confidently, especially outside code | Larger model and more data (Lewi Surge 24B2A) |
Model
| Base | Lewi-Surge-Preview-3B-Base (HumanEval 25.0%, MBPP 29.6% as a base model) |
| Parameters | ~3.45B total, ~0.5B active per token |
| Layers | 16 = 4 × (3 Gated DeltaNet + 1 full attention) |
| Experts | 128 per layer, top-6 routed + 1 shared |
| Chat format | ChatML (<|im_start|> / <|im_end|>), no system prompt required, no thinking mode |
Usage
Requires transformers >= 5.0.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "Write a Python function that checks if a string is a palindrome."}]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=256, do_sample=False, repetition_penalty=1.1)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
A light repetition_penalty (1.05–1.1) helps with the looping issue. Runs on a single consumer GPU (~7 GB in bf16).
Limitations
Early checkpoint of a small model: expect wrong facts, uneven instruction following and weak non-Python code. Not safety-tuned. Do not use it for anything where mistakes matter.
Links
- Downloads last month
- 315
Model tree for PoliteChainsaw/Lewi-Surge-Preview-3B-Chat-Early
Base model
PoliteChainsaw/Lewi-Surge-Preview-3B-Base