Run this model with HF Jobs

Run Sayansantra/LFM3-2.0B-WSP-V4 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/Sayansantra/LFM3-2.0B-WSP-V4. 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/Sayansantra/LFM3-2.0B-WSP-V4 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/Sayansantra/LFM3-2.0B-WSP-V4. 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/Sayansantra/LFM3-2.0B-WSP-V4. 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.

Sayansantra/LFM3-2.0B-WSP-V4 (LFM3-2.0B-TV25-IrrGuard)

A 2.02B-parameter (29-layer, 262,144 context window, bfloat16) agentic and function-calling language model built from Sayansantra/LFM3-1.7B-WSP-V3 (derived from LiquidAI/LFM3-1.7B) through Selective Depth Expansion, New-Layer Agentic SFT with Task-Vector Fusion (λ = 0.25), and Surgical IrrGuard Weight-Space Programming (α = 0.05).

Despite having only 2.02B parameters (4.03 GB in bfloat16), this checkpoint achieves 88.88% Official Non-Live Python AST and 74.42% Live Simple AST on the UC Berkeley Gorilla Berkeley Function Calling Leaderboard (BFCL) (1,498 official tasks), outperforming models 13× its size (Qwen3.8-27B) on multi-call tool execution while matching or exceeding gpt-4.1-mini-2025-04-14 on multiple and live_simple.


Highlights & Frontier Standing

  • Beats Qwen3.8-27B (27B, 13.4× larger) on multi-call splits: 88.00% vs. 82.50% (+5.50 pts) on parallel and 84.50% vs. 83.50% (+1.00 pt) on parallel_multiple.
  • Matches / exceeds gpt-4.1-mini-2025-04-14 on multiple (91.50% vs. 91.50%) and live_simple (74.42% vs. 73.30%, +1.12 pts).
  • Within 0.25 pts of Gemma 4 26B-A4B-it (26B, 13× larger) on Official Non-Live Python AST (88.88% vs. 89.13%) and within 2.50 pts of Gemini 3.8 Flash on simple_python (91.50% vs. 94.00%).
  • Strong Single-Turn AST standing: 88.88% Non-Live Python AST and 74.42% Live Simple AST vs. #1 Claude-Opus-4-5-20251101 (FC) on the BFCL V4 Live Leaderboard (73.76% Non-Live AST across all languages / 70.97% Live AST).

Official UC Berkeley BFCL Benchmark Results (1,498 Tasks)

All evaluations were run deterministically (do_sample=False, BFCL official AST grader) directly against gorilla-llm/Berkeley-Function-Calling-Leaderboard (BFCL_v3_simple.json, BFCL_v3_multiple.json, BFCL_v3_parallel.json, BFCL_v3_parallel_multiple.json, BFCL_v3_live_simple.json, BFCL_v3_irrelevance.json).

1. Frontier & Large-Model Comparison

Model Active Size simple_python (400) multiple (200) parallel (200) parallel_multiple (200) Non-Live Python AST live_simple (258) irrelevance (240) 6-Split Macro Avg
LFM3-2.0B-WSP-V4 (Patched 1536t + Prompt Fix) 2.02B 91.50% 91.50% 88.00% 84.50% 88.88% 74.42% 48.75% 79.78%
LFM3-2.0B-WSP-V4 (Single-Pass 768t Baseline) 2.02B 90.00% 91.00% 85.00% 83.00% 87.25% 72.48% 48.75% 78.37%
Qwen3.8-27B (BF16) 27B — 97.00% 82.50% 83.50% — 87.98% — —
gpt-4.1-mini-2025-04-14 Cloud Mini — 91.50% 91.50% 87.00% — 73.30% — —
Gemma 4 26B-A4B-it 26B (3.8B act.) — 93.00% 93.00% 92.50% 89.13% 86.82% 91.25% —
Gemini 3.8 Flash Cloud Flash 94.00% — — — — — — —
Claude-Opus-4-5-20251101 (FC) Frontier — — — — 73.76%* 70.97%* — —

Notes on methodology & transparency:

  1. Single-Pass (768t) vs. Patched (1536t + Prompt Fix): In the single-pass 768-token evaluation (official_bfcl_ast_report_768tok.json), 38 / 1,498 (2.54%) generations hit the token ceiling and 6 zero-argument simple_python tasks echoed a literal KEY parameter placeholder shown in the eval system prompt. Re-evaluating those exact 45 targeted failed tasks with max_new_tokens=1536 and a clean prompt placeholder recovered 21 / 45 tasks (official_bfcl_ast_report_patched.json), cutting remaining truncations to 10 / 1,498 (0.67%). Both raw audited JSONL prediction files (eval_results/bfcl_raw_predictions_768tok.jsonl and eval_results/bfcl_raw_predictions_patched.jsonl) are included in this repository.
  2. Leaderboard scope: Official BFCL V4 Non-Live/Live leaderboard columns (*) also include Java, JavaScript, and Multi-Turn/Agentic splits. The scores reported here cover the 6 Python Single-Turn splits (1,498 tasks); multi_turn and agentic splits remain open for subsequent evaluation.

2. Development Progression

Iteration simple_python multiple parallel parallel_multiple Non-Live AST live_simple irrelevance 6-Split Avg
TV_lam20 (256t) 80.50% 84.00% 34.00% 18.50% 54.25% 55.04% 81.67% 58.95%
TV_lam25 (768t) 90.00% 91.00% 84.50% 83.00% 87.12% 72.48% 49.58% 78.43%
TV25 + IrrGuard (α=0.05) (768t) 90.00% 91.00% 85.00% 83.00% 87.25% 72.48% 48.75% 78.37%
TV25 + IrrGuard (α=0.05) (1536t + Prompt Fix) 91.50% 91.50% 88.00% 84.50% 88.88% 74.42% 48.75% 79.78%

Architecture & Construction Recipe

LFM3-2.0B-WSP-V4 preserves all 24 original layers from Sayansantra/LFM3-1.7B-WSP-V3 untouched during training and injects 5 specialized full_attention reasoning/agentic blocks, yielding a 29-layer hybrid short-convolution + GQA Transformer:

Parameter Specification
Architecture Lfm3ForCausalLM (trust_remote_code=True)
Parameters / Size ~2.02B (4.03 GB model.safetensors, bfloat16)
Layers 29 (conv, sliding_attention, full_attention; new full_attention layers at indices [13, 16, 19, 22, 25])
Hidden / FFN Size 2048 / 7680 SwiGLU
Attention 16 query heads, 4 KV heads (GQA), head_dim=128, sliding_window=256, conv_L_cache=7
Context Length 262,144 tokens (max_position_embeddings)
Vocabulary 128,000 (bos=124894, eos=124900, pad=124893)

3-Stage Build Pipeline

  1. Contrastive Layer Expansion (24 → 29 layers): Inserted 5 full_attention layers after original layers [12, 14, 16, 18, 20], initialized via 0.70 / 0.30 neighbor interpolation combined with rank-1 contrastive agentic subspace projection (ε = 1e-3, bg = 0.20 * ε) extracted on o_proj and feed_forward.w2.
  2. New-Layer-Only SFT + Task-Vector Fusion (TV_lam25): Froze all 24 base backbone layers and fine-tuned only the 5 inserted layers (lr = 2.5e-5, max_seq_len = 1280, 1 epoch DDP) on 2,400 masked assistant-response trajectories curated from deepseek-v4-pro-agent-tool-calling-trajectory, agenttracer-bfcl, fable-5-premium, and BFCL irrelevance examples, then fused at λ = 0.25: $$W_{\text{TV25}} = 0.75 , W_{\text{Step0}} + 0.25 , W_{\text{Stage1}}$$
  3. Surgical IrrGuard WSP (α = 0.05): Extracted normalized contrastive abstention-vs-tool-call vectors on the 5 new layers' FFN w2 matrices and selected α = 0.05 via a 240-task Pareto screen balancing parallel, parallel_multiple, and irrelevance.

Failure Analysis & Known Limitations

An automated 0-GPU audit (eval_results/bfcl_failure_analysis.json) of all 316 baseline (768-token) misses identified:

  • irrelevance abstention (48.75%): Passed irrelevance tasks averaged 193.5 generated tokens (explicit <think> reasoning before abstaining), whereas all 123 failures emitted reflexive tool calls (122 single calls, 1 3-call) averaging just 57.7 tokens. Dedicated irrelevance-abstention DPO/GRPO is recommended for production deployments where irrelevant tool sets are common.
  • Token budget for multi-call generation: Set max_new_tokens >= 1280 (ideally 1536) when calling multiple parallel tools with <think> reasoning traces.
  • System prompt hygiene: Avoid dummy placeholder syntax like <parameter=KEY>VAL</parameter> in system instructions so zero-argument functions do not echo literal keys.

Usage (transformers)

import json
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Sayansantra/LFM3-2.0B-WSP-V4"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True,
)

tools = [
    {
        "name": "get_weather",
        "description": "Fetch current weather for a city.",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    }
]

messages = [
    {
        "role": "system",
        "content": (
            "You are a precise agentic assistant.
"
            f"Available tools JSON:\n{json.dumps(tools)}\n"
            "Only call a tool when directly required by the user; wrap calls in "
            "<tool_call><function=NAME><parameter=ARG>VALUE</parameter></function></tool_call>."
        ),
    },
    {"role": "user", "content": "Check the weather in Tokyo and Osaka."},
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=1536, do_sample=False)

print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Repository Contents

  • Model Weights & Modeling Code: model.safetensors, config.json, configuration_lfm3.py, modeling_lfm3.py, lfm3_conv.py, generation_config.json, tokenizer.json, tokenizer_config.json, chat_template.jinja, LICENSE
  • Audited Evaluation Artifacts (eval_results/):
    • eval_results/official_bfcl_ast_report_patched.json — 1536-token + prompt-fix BFCL report (88.88% Non-Live Python AST)
    • eval_results/official_bfcl_ast_report_768tok.json — Single-pass 768-token baseline BFCL report (87.25% Non-Live Python AST)
    • eval_results/bfcl_failure_analysis.json — Full 1,498-task error taxonomy audit
    • eval_results/bfcl_raw_predictions_patched.jsonl — Patched predictions across all 1,498 BFCL tasks
    • eval_results/bfcl_raw_predictions_768tok.jsonl — Baseline single-pass predictions across all 1,498 BFCL tasks

License

Released under the LFM Open License v1.0 (LICENSE), inherited from LiquidAI/LFM3-1.7B.

Downloads last month
200
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 Sayansantra/LFM3-2.0B-WSP-V4

Finetuned
(1)
this model
Quantizations
1 model

Datasets used to train Sayansantra/LFM3-2.0B-WSP-V4

Collection including Sayansantra/LFM3-2.0B-WSP-V4

Evaluation results

  • BFCL Non-Live Python AST Avg (1,000 tasks, 1536t + Prompt Fix) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    88.880
  • BFCL simple_python (400 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    91.500
  • BFCL multiple (200 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    91.500
  • BFCL parallel (200 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    88.000
  • BFCL parallel_multiple (200 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    84.500
  • BFCL live_simple (258 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    74.420
  • BFCL irrelevance (240 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    48.750
  • BFCL 6-Split Single-Turn Macro Avg (1,498 tasks) on Berkeley Function Calling Leaderboard (BFCL v3 Official Splits, 1,498 Tasks)
    self-reported
    79.780