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.

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.


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

Evaluation Comparison

Training Curves (W&B Telemetry — V1 vs. V2 Async GRPO)

Async GRPO V1 vs V2 Telemetry


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,398 trajectories, 1 epoch / 275 steps, L40S 48GB, bf16, lr=2e-5, LoRA r=16, alpha=32 on all 7 attention+MLP projections, assistant-only loss 0.8316 → 0.4421). Merged into standalone bf16.
  • Stage 2 — 2-GPU Async Multi-Turn GRPO (V2): FineEnvs/SmolDataEnvs (1,024 shuffled tasks, 2× A10G, 8 Daytona sandboxes, max_turns=6, G=8, 60 optimizer steps with grad_accum=8 = 1,086 trained rollouts in 16m 45s, cosine lr=2e-6 + 5% warmup, max_staleness=4, reward 1.0 × reward_correct + 0.05 × reward_submitted_file). Merged into Stage 1 SFT weights as standalone bf16.

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 bash commands 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=10 or cons@8 majority voting over valid sandboxed submissions).
Downloads last month
67
Safetensors
Model size
2B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for abhinav0231/Lily-1.5B-Code

Finetuned
(3)
this model
Quantizations
2 models

Datasets used to train abhinav0231/Lily-1.5B-Code

Evaluation results

  • pass@1 on SmolDataEnvs (eval_matched, 88 tasks, max_turns=6)
    self-reported
    23.860
  • Tool Execution Success Rate on SmolDataEnvs (eval_matched, 88 tasks, max_turns=6)
    self-reported
    80.810
  • Hard Tier pass@1 on SmolDataEnvs (eval_matched, 88 tasks, max_turns=6)
    self-reported
    7.690