Papers › SPORK: Self-Speculative Forking to Accelerate Agentic LLM Inference

SPORK: Self-Speculative Forking to Accelerate Agentic LLM Inference

3 Jul 2026arXiv:2607.03333added by Syntology

Huajun Bai, Weiwei Lv, Huichuan Zheng, Youyou Lu, Jiwu Shu

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

LLM agents are becoming a common interface for research, coding, and question answering, yet their Thought-Action-Observation loop is often serial: the model reasons, emits a tool call, then idles the GPU until the result returns. This wait consumes 16-37% of wall time in our workloads and 35-61% in prior reports. Speculative tool execution can hide this wait, but existing systems need auxiliary predictors, historical traces, or static workflow graphs, leaving a gap for training-free, day-one deployment. We observe that the model can be its own predictor: a probe forked at the start of generation predicts Qwen3-32B's upcoming tool name with 74.6-99.6% accuracy across five benchmarks. We present SPORK (Self-sPeculative fORKing), a training-free controller that dispatches the speculated tool call early, overlapping its execution with the remaining chain-of-thought decode. A cost model captures when speculation breaks even, and each component improves one of its terms: a prefix-cache fork cuts probe cost, a confidence gate filters mispredictions, and partial-token accept turns rejected probes into speculative-decoding drafts. On acceptance, the tool result is ready when reasoning ends; on rejection, SPORK falls back to serial execution with no correctness penalty. On real-tool benchmarks, SPORK cuts Qwen3-32B's GAIA P95 by 18% (131.9 to 108.1 s); the mechanism holds across model sizes from 4B to 32B and across dense and mixture-of-experts models, with task accuracy within 1 pp of baseline or better wherever measured. SPORK deploys as a thin controller over standard completion APIs (no retraining, no auxiliary models, no offline traces) and is orthogonal to token-level speculative decoding. SPORK is open source at https://github.com/baihuajun24/spork.

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2607.03333")

Code

Syntology Ran 8 of 14 code samples harvested from 1 repository linked to this paper; 6 have no recorded run. Of those that ran: 5 ran · our draft was wrong; 3 ran with no contract checked.

By repository: found in paper text by Syntology: 14 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

baihuajun24/spork found in paper text by Syntology report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 8 ran; 0 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

5ran · our draft was wrong
3ran
6unverified

Licence: 0 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from baihuajun24/spork. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

SpeculativeToolExecution baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran MIT (permissive) · c60dad4cfc7209ef · report
TurnConfig baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · metamorphic tier: deterministic MIT (permissive) · e3c81f52c0296dc1 · report
VllmClient baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · metamorphic tier: deterministic MIT (permissive) · 77e39343aa23f72a · report
_first_structured_tool_call baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · ffe291ef6cf32185 · report
_fork_point baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · our draft was wrong fingerprinted MIT (permissive) · 574db1fd7f3069bb · report
_normalize_openai_tool_call baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · ddb27f427c8c2439 · report
chat_logprobs_to_flat baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · f8273ebb3f96eb2f · report
execute_speculative baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · 297b367d320815a8 · report
ModelAdapter baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology unverified MIT (permissive) · 0f385849dee554dc · report
ToolExecutor baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology unverified MIT (permissive) · 721415d6742a7312 · report
_append_tool_messages baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology unverified MIT (permissive) · 49ea5e2531e401db · report
_bounded_chat_max_tokens baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology unverified MIT (permissive) · 01440a64899671ed · report
commit_speculative baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology unverified MIT (permissive) · e187e63c5973947d · report
run_spork_turn baihuajun24/spork/spork_core/turn_runner.py found in paper text by Syntology unverified MIT (permissive) · 45f47653170a6c77 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2607.03333, was issued in July 2026, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections