Run this model with HF Jobs
Run abhinav0231/Lily-1.5B-Code on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/abhinav0231/Lily-1.5B-Code. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/abhinav0231/Lily-1.5B-Code on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/abhinav0231/Lily-1.5B-Code. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/abhinav0231/Lily-1.5B-Code. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use abhinav0231/Lily-1.5B-Code with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abhinav0231/Lily-1.5B-Code with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="abhinav0231/Lily-1.5B-Code") 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("abhinav0231/Lily-1.5B-Code") model = AutoModelForCausalLM.from_pretrained("abhinav0231/Lily-1.5B-Code", 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 abhinav0231/Lily-1.5B-Code with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "abhinav0231/Lily-1.5B-Code" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abhinav0231/Lily-1.5B-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/abhinav0231/Lily-1.5B-Code
- SGLang
How to use abhinav0231/Lily-1.5B-Code 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 "abhinav0231/Lily-1.5B-Code" \ --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": "abhinav0231/Lily-1.5B-Code", "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 "abhinav0231/Lily-1.5B-Code" \ --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": "abhinav0231/Lily-1.5B-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use abhinav0231/Lily-1.5B-Code with Docker Model Runner:
docker model run hf.co/abhinav0231/Lily-1.5B-Code
Lily-1.5B-Code
Lily-1.5B-Code is a 1.5B-parameter (Qwen2.5-1.5B architecture, standalone merged bfloat16) autonomous data-analysis and coding agent fine-tuned from abhinav0231/Lily-1.5b-v0.3.
- Training Code & Full Pipeline (
Smoldataenv):github.com/theabhinav0231/Lily-1.5B-Code - Full Run & Findings Report:
REPORT.md(also on GitHub) - Upstream Environment & Datasets: Built on FineEnvs
04-smoldataenvs(FineEnvs/SmolDataEnvs&FineEnvs/SmolDataEnvs-sft)
Benchmark Results (FineEnvs/SmolDataEnvs, eval_matched)
Evaluated greedily (temperature=0.0, max_turns=6 for multi-turn models) on the 88-task verified eval_matched split (25 easy / 50 medium / 13 hard, 0 ungraded) using the official SmolDataEnvs deterministic grader.py:
| Metric | Base Single-Turn (Lily-1.5b-v0.3) |
Single-Turn GRPO (04 Baseline) |
Stage 1: Multi-Turn SFT (max_turns=6) |
Stage 2: Multi-Turn Async GRPO (Lily-1.5B-Code, max_turns=6) |
|---|---|---|---|---|
Overall pass@1 (88) |
4.55% (4/88) |
6.82% (6/88) |
23.86% (21/88) |
23.86% (21/88) (5.25× vs. base) |
easy pass@1 (25) |
8.00% (2/25) |
16.00% (4/25) |
52.00% (13/25) |
48.00% (12/25) |
medium pass@1 (50) |
4.00% (2/50) |
4.00% (2/50) |
16.00% (8/50) |
16.00% (8/50) (4.0× vs. base) |
hard pass@1 (13) |
0.00% (0/13) |
0.00% (0/13) |
0.00% (0/13) |
7.69% (1/13) (+7.69 pp over SFT) |
| Execution Success Rate | 14.77% |
13.64% |
80.08% |
80.81% (+0.73 pp over SFT) |
tool_used_rate |
— | — | 100.0% |
100.0% |
submitted_file_rate |
— | — | 40.91% (36/88) |
40.91% (36/88) |
avg_turns / avg_tool_calls |
1.0 |
1.0 |
4.24 / 3.62 |
4.20 / 3.58 |
Training Curves (W&B Telemetry — V1 vs. V2 Async GRPO)
Citation & Improvements Over Original FineEnvs/04-smoldataenvs
This model and its training codebase (Smoldataenv) build directly on the tasks, trajectories, and deterministic grader from FineEnvs 04-smoldataenvs by Adithya S. Kolavi and the FineEnvs team.
The original 04-smoldataenvs reference RL scripts ran single-turn blind-schema Python generation on a single synchronous GPU, where a 1.5B model could not inspect CSV schemas or recover from runtime errors (~85% script crash rate, 4.55–6.82% pass@1). To overcome those limits, we built the following upgrades (all open-sourced in theabhinav0231/Lily-1.5B-Code):
| Area | Original 04-smoldataenvs Reference |
Upgrades Built for Lily-1.5B-Code |
|---|---|---|
| Interaction Loop | Single-turn blind-schema Python (14.8% execution success, 4.55–6.82% pass@1). |
Multi-turn bash tool calling aligned with FineEnvs/SmolDataEnvs-sft (ls, head, python3, /workdir/answer.txt), lifting execution success to 80.81% and pass@1 to 23.86% (5.25×). |
| SFT Loss Masking | Standard / template-dependent loss. | Exact assistant-only span masking (-100 on system, user, and <tool_response> tokens) without modifying tokenizer.chat_template. |
| Sandbox Isolation | Shared /workdir and inline shell quoting. |
Per-rollout /tmp/rollout_<uuid> isolation + .sh script upload so multiline python3 << 'EOF' heredocs never break quoting and concurrent rollouts have 0 collisions. |
| RL Engine | 1-GPU sync colocated GRPO (~74% GPU idle time). | 2-GPU Async Multi-Turn GRPO (TRL 1.19 AsyncGRPOTrainer + vLLM 0.19.1 on A10G:2) with sub-second HTTP LoRA hot-swap (~0.35–0.41s), tree_attention, and exact env_mask. |
| RL Stability (V1 → V2) | Constant LR, strict curriculum, small step batch causing stale drops & late-run forgetting. | grad_accum=8 (~18.1 rollouts/step), cosine LR + 5% warmup, shuffled task order, max_staleness=4 → 4× fewer stale drops, 2× wall-clock MFU (8.5% → 17.5%), IS_ratio = 0.9999, zero_std = 17.9%. |
| Infra Hygiene | Potential leaked sandboxes on worker shutdown. | Union-recorded Daytona sandbox-ID registry swept in parent finally: (0 leaked sandboxes) + all-None unscorable handling on SandboxUnavailable. |
Training Summary
- Stage 1 — Multi-Turn LoRA SFT:
FineEnvs/SmolDataEnvs-sft(4,398trajectories, 1 epoch /275steps,L40S 48GB,bf16,lr=2e-5, LoRAr=16, alpha=32on all 7 attention+MLP projections, assistant-only loss0.8316 → 0.4421). Merged into standalonebf16. - Stage 2 — 2-GPU Async Multi-Turn GRPO (V2):
FineEnvs/SmolDataEnvs(1,024shuffled tasks,2× A10G,8Daytona sandboxes,max_turns=6,G=8,60optimizer steps withgrad_accum=8=1,086trained rollouts in16m 45s, cosinelr=2e-6+ 5% warmup,max_staleness=4, reward1.0 × reward_correct + 0.05 × reward_submitted_file). Merged into Stage 1 SFT weights as standalonebf16.
See REPORT.md for the complete V1 vs. V2 telemetry comparison, training curves, and diagnostic analysis.
Usage
Transformers (Multi-Turn bash Tool Calling)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "abhinav0231/Lily-1.5B-Code"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
tools = [
{
"type": "function",
"function": {
"name": "bash",
"description": (
"Run a shell command in the sandbox and return its combined stdout+stderr. "
"The shell is non-stateful between calls (each call is a fresh `bash -c`). "
"Use it to explore files (ls, head, cat), run Python (`python3 -c ...`), "
'and write the final answer (`echo -n "<value>" > /workdir/answer.txt`).'
),
"parameters": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The shell command to execute.",
}
},
"required": ["command"],
},
},
}
]
messages = [
{
"role": "system",
"content": (
"You are an autonomous data-analysis agent operating in a sandboxed Linux container. "
"Your only tool is `bash`. The dataset files are in /home/user/input/. "
"Python 3 + pandas + numpy + scikit-learn + scipy are pre-installed.\n\n"
"Work the problem step-by-step: first inspect the data (ls, head, shape, dtypes), "
"then plan, then compute, then submit.\n\n"
"To submit your final answer you MUST call the `bash` tool to write it to "
'/workdir/answer.txt, e.g. `echo -n "<value>" > /workdir/answer.txt`. '
"Keep the answer short and concise. Do NOT end your turn without submitting."
),
},
{
"role": "user",
"content": (
"Files (in /home/user/input, no subfolders):\n- sales.csv\n\n"
"Question:\nWhat is the total revenue in Q4?\n\n"
'Write only that value to /workdir/answer.txt (e.g. `echo -n "<value>" > /workdir/answer.txt`), then stop.'
),
},
]
prompt = tokenizer.apply_chat_template(
messages,
tools=tools,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=False))
Serving with vLLM
vllm serve abhinav0231/Lily-1.5B-Code \
--dtype bfloat16 \
--enable-auto-tool-choice \
--tool-call-parser hermes
Limitations & Safety
- Always execute generated
bashcommands inside an isolated sandbox/container (e.g., Docker, Daytona, E2B, Firecracker) — never directly on a host machine. - As a compact 1.5B model, it performs strongest on structured tabular/CSV analysis and multi-step Python scripting within 6 turns; complex
hard-tier tasks benefit from test-time scaling (max_turns=10orcons@8majority voting over valid sandboxed submissions).
- Downloads last month
- 67
Model tree for abhinav0231/Lily-1.5B-Code
Base model
Qwen/Qwen2.5-1.5BDatasets used to train abhinav0231/Lily-1.5B-Code
FineEnvs/SmolDataEnvs-sft
Evaluation results
- pass@1 on SmolDataEnvs (eval_matched, 88 tasks, max_turns=6)self-reported23.860
- Tool Execution Success Rate on SmolDataEnvs (eval_matched, 88 tasks, max_turns=6)self-reported80.810
- Hard Tier pass@1 on SmolDataEnvs (eval_matched, 88 tasks, max_turns=6)self-reported7.690

