Views
No views yet
<think> tags, followed by the final answer inside <answer> tags.| Property | Value |
|---|---|
| Base model | Qwen/Qwen2.5-1.5B-Instruct |
| Parameters | 1.5B |
| Context length | 4096 tokens |
| Fine-tuning | Supervised fine-tuning (SFT) on chain-of-thought formatted data |
| Output format | <think>...</think> reasoning + <answer>...</answer> final response |
| License | Apache 2.0 |
<think>
[Step-by-step reasoning, working through the problem before committing to an answer]
</think>
<answer>
[Final response — structured, precise, and direct]
</answer><think> block is Lily's scratchpad — it plans, evaluates, and drafts before producing the answer. This makes the model's reasoning transparent and auditable.1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "abhinav0231/Lily-1.5b-v0.1"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.float16,
10 device_map="auto",
11)
12
13SYSTEM_PROMPT = (
14 "You are Lily, a precise and thoughtful AI assistant.\n\n"
15 "Always reason step by step inside <think></think> tags, "
16 "then write your final answer inside <answer></answer> tags.\n\n"
17 "When answering:\n"
18 "- Be thorough: cover all relevant aspects, not just the surface question\n"
19 "- Be specific: use exact values, names, and examples rather than vague generalities\n"
20 "- Structure long responses with markdown headers, code blocks, and lists where appropriate\n"
21 "- Lead with the most important information first\n"
22 "- Match the depth of your answer to the complexity of the question\n\n"
23 "Tone: direct and confident. Never use filler phrases like \"Certainly!\", "
24 "\"Great question!\", or \"Of course!\". Be helpful without being sycophantic."
25)
26
27def ask(question, max_new_tokens=512):
28 messages = [
29 {"role": "system", "content": SYSTEM_PROMPT},
30 {"role": "user", "content": question},
31 ]
32 prompt = tokenizer.apply_chat_template(
33 messages,
34 tokenize=False,
35 add_generation_prompt=True,
36 )
37 inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
38 with torch.no_grad():
39 output = model.generate(
40 **inputs,
41 max_new_tokens=max_new_tokens,
42 temperature=0.7,
43 top_p=0.9,
44 do_sample=True,
45 pad_token_id=tokenizer.eos_token_id,
46 )
47 response = tokenizer.decode(
48 output[0][inputs["input_ids"].shape[-1]:],
49 skip_special_tokens=True,
50 )
51 return response
52
53print(ask("What is the difference between a list and a tuple in Python?"))| Quant | Size | Use case |
|---|---|---|
Q4_K_M | ~1.0 GB | Best balance of speed and quality for CPU inference |
Q5_K_M | ~1.2 GB | Better quality, still fast on CPU |
Q8_0 | ~1.6 GB | Near-lossless, recommended if VRAM/RAM allows |
F16 | ~3.1 GB | Full precision, GPU only |
1# Download a quant
2huggingface-cli download abhinav0231/Lily-1.5b-v0.1-GGUF \
3 Lily-1.5b-v0.1-Q4_K_M.gguf \
4 --local-dir ./
5
6# Run the server
7./llama.cpp/build/bin/llama-server \
8 -m Lily-1.5b-v0.1-Q4_K_M.gguf \
9 --ctx-size 4096 \
10 --port 80801# Create a Modelfile
2cat > Modelfile << 'EOF'
3FROM ./Lily-1.5b-v0.1-Q4_K_M.gguf
4SYSTEM "You are Lily, a precise and thoughtful AI assistant.
5
6Always reason step by step inside <think></think> tags, then write your final answer inside <answer></answer> tags.
7
8When answering:
9- Be thorough: cover all relevant aspects, not just the surface question
10- Be specific: use exact values, names, and examples rather than vague generalities
11- Structure long responses with markdown headers, code blocks, and lists where appropriate
12- Lead with the most important information first
13- Match the depth of your answer to the complexity of the question
14
15Tone: direct and confident. Never use filler phrases like \"Certainly!\", \"Great question!\", or \"Of course!\". Be helpful without being sycophantic."
16EOF
17
18# Build and run
19ollama create lily -f Modelfile
20ollama run lily "Explain how transformers work"apply_chat_template. You do not need to set it manually if using the Transformers pipeline — it is already the default.<think>/<answer> format — kept verbatim from training — is:Always reason step by step inside<think></think>tags, then write your final answer inside<answer></answer>tags.
system message.<think> step makes it especially useful in applications where reasoning transparency matters — grading, debugging, tutoring, or any workflow where you need to see why the model gave a particular answer, not just the answer itself.Qwen/Qwen2.5-1.5B-Instruct using supervised fine-tuning on a dataset of chain-of-thought formatted examples. Each training example uses the <think>/<answer> output structure. Training was performed on a single T4 GPU via Google Colab.@misc{lily-1.5b-v0.1,
author = {abhinav0231},
title = {Lily 1.5B v0.1: A chain-of-thought fine-tune of Qwen 2.5 1.5B},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/abhinav0231/Lily-1.5b-v0.1}
}