SpanCall Lean v3
fast non-autoregressive tool calling
2 min readupdated
SpanCall Lean v3 (spancall_lean_modernbert architecture) by convoicon handles tool call detection and extraction. Instead of slowly generating JSON token by token like standard LLMs, it extracts the target function and its arguments in a single forward pass. Built on the bidirectional answerdotai/ModernBERT-large encoder with two specialized heads (H1 for tool selection and an H3 pointer head for parameter span extraction), it is ideal for AI agent and router developers who need low-latency user query parsing.
Key features
- Single forward pass: constructs a ready-to-use function call without autoregressive JSON generation.
- ModernBERT-large backbone: uses a bidirectional encoder supporting context lengths up to 4096 tokens (
max_seq_len). - Two-step extraction: runs in
two_stepmode using a paired H1 tool head and H3 pointer head. - Single-call focus: configured to extract one tool call at a time (
Single-call only: True) with amin_joint_margin: 0.02threshold.
What you can do
- Speed up voice and chat assistants: replace slow JSON generation when routing user commands to APIs.
- Build long-context AI agents: process conversations and tool schemas up to 4096 tokens in a single pass.
Example
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("convoicon/spancall-lean-v3")
cfg = json.load(open(hf_hub_download("convoicon/spancall-lean-v3", "resolve_config.json")))
weights = hf_hub_download('convoicon/spancall-lean-v3', 'model.pt')
# далее инициализируются SpanCallTransformerEncoder и LeanSpanCallModel
Read more
Detailshermes_eval benchmark (limit=2000, n_F=1157): exact_F — 0.681, hit_F — 0.872, param_F1_F — 0.83, exact_all — 0.509.
For comparison, the B1a regex baseline scores exact_F 0.022 and param_F1_F 0.03 on the same data.
Limitations: supports only a single tool call per request (Single-call only), and running it requires recreating the model classes from the author's notebook.










Comments