[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110565":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":13,"stars30d":11,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":14,"rankGlobal":8,"rankLanguage":8,"license":15,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":16,"hasPages":16,"topics":18,"createdAt":8,"pushedAt":19,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":13,"starSnapshotCount":13,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},110565,"TraceSpec","Robot2050\u002FTraceSpec","Robot2050",null,"Python",66,1,65,0,38,"Apache License 2.0",false,"main",[],"2026-10-25 14:02:29","2026-11-14 02:56:51","\u003Ch1 align=center>TraceSpec\u003C\u002Fh1>\n\u003Cp align=center>\u003Cstrong>Trajectory-Level Evaluation for Speculative Decoding in LLM Agents\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Cp align=center>Dynamic execution and fixed-prefix replay with unified acceptance, throughput, and episode-cost measurements\u003C\u002Fp>\n\n## 🔎 Why TraceSpec\n\nSpeculative decoding is usually evaluated on isolated prompts. Agent serving presents a different workload: every action extends the history, tool feedback changes the next prediction, and calls within one task can have very different contexts and purposes. A single average accepted length cannot show where a draft succeeds or how acceptance affects task completion.\n\nTraceSpec evaluates speculative decoding at the trajectory level. It combines dynamic interaction with controlled replay, then resolves the measurements by context length, execution phase, workload, and task progress.\n\n* **For inference and serving researchers:** Measure both draft agreement and the cost of processing complete agent histories.\n* **For speculative decoding researchers:** Compare methods on identical decision states and inspect where their context and phase profiles diverge.\n* **For agent system developers:** Connect per-call decoding behavior with model time, tool time, and end-to-end episode latency.\n\n## ✨ Core Contributions\n\n1. **Dynamic agent evaluation.**\n   TraceSpec runs multi-step episodes on BrowseComp-Plus and SWE-bench Verified. Browsing agents search and read benchmark documents. Repository agents inspect real checkouts, while edit and test operations receive simulated feedback.\n\n2. **Controlled replay with TraceSpec-Traj.**\n   The included test set contains 2,500 fixed prefixes across Web research and software engineering, four execution phases, and five nominal context strata. Every method receives the same saved history and generates one assistant continuation.\n\n3. **Diagnostics beyond aggregate averages.**\n   Reports resolve context length and episode progress jointly, with separate views for planning, action, reflection, and answer generation. This makes it possible to distinguish a change in agreement from a change in workload composition.\n\n4. **A shared comparison protocol.**\n   DFlash, EAGLE-3, DSpark, DLite, and LongSpark use common trajectory records and metric definitions. An autoregressive target baseline and a deterministic mock backend are also included.\n\n## 📊 What the Evaluation Reveals\n\n* **DSpark leads the overall comparisons.** It has the highest overall accepted length and verification yield in all 18 workload, target size, and temperature combinations. All 72 paired accepted-length comparisons have positive lower bounds on their pointwise 95% intervals.\n* **Higher acceptance does not translate one to one into faster tasks.** Across six greedy dynamic configurations, DSpark improves accepted length over DFlash by 10.1% to 13.8%, while mean episode latency decreases by 2.7% to 7.1%.\n* **Aggregate context curves can conceal conditional degradation.** For DSpark with Qwen3-8B at temperature 0, accepted length in matched late browsing actions falls from 6.194 at 8k to 16k tokens to 5.322 at 16k to 32k tokens. The change is -0.872 with a pointwise 95% interval of [-1.205, -0.473].\n* **Context behavior depends on the workload.** In DSpark replay with Qwen3-8B at temperature 0, Web research acceptance falls from 5.242 below 2k tokens to 3.442 at 16k to 32k. Software engineering acceptance instead rises from 3.073 to 4.321 across the same intervals.\n* **Sampling temperature changes draft agreement.** Increasing temperature from 0 to 1 lowers accepted length in all 45 matched comparisons.\n\n## 🧪 Evaluation at a Glance\n\n| Protocol | Workload | Evaluation units | Purpose |\n|---|---|---:|---|\n| Dynamic execution | BrowseComp-Plus | 100 tasks | Measure retrieval episodes as histories evolve |\n| Dynamic execution | SWE-bench Verified | 100 tasks | Measure repository episodes with tool feedback |\n| Fixed-prefix replay | TraceSpec-Traj | 2,500 test states | Compare methods on identical decision inputs |\n\nThe full study covers 90 configurations: three workloads, five speculative methods, Qwen3-4B, Qwen3-8B, and Qwen3-14B targets, and temperatures 0 and 1. Dynamic episodes allow 50 action steps and 32,768 context tokens. Replay uses a 36,864-token context limit. Both protocols allow up to 4,096 new tokens per model call.\n\nNative PyTorch throughput comparisons cover DFlash, EAGLE-3, DSpark, and DLite. LongSpark uses SGLang and is included in acceptance comparisons. Its runtime measurements should not be compared directly with native PyTorch measurements without controlling for the serving stack.\n\n## 🛠️ Quick Start\n\n### Installation\n\nUse Python 3.10 or newer. Run the commands from the repository root.\n\n```bash\npython -m pip install -r requirements.txt\n```\n\nUse a CUDA-enabled PyTorch installation compatible with the target hardware and checkpoints. Model weights are not bundled. The command-line interface accepts local model paths or Hugging Face identifiers.\n\n### Data Preparation\n\n* **TraceSpec-Traj:** The compressed test set is included at `datasets\u002Ftracespec-traj\u002Ftest.jsonl.gz` and needs no additional preparation.\n* **BrowseComp-Plus:** Place the document collection at `datasets\u002Fbrowsecomp-plus\u002Fcorpus\u002Fdocuments.jsonl`. The SQLite FTS5 index is built on first use and cached under the dataset root.\n* **SWE-bench Verified:** Place full-history repository clones under `datasets\u002Fswe-bench-verified\u002Frepos\u002F`. Directory names replace the slash in each repository identifier with an underscore. A preflight check verifies the selected base commits before model loading.\n\nUpstream benchmark data, repository snapshots, and model weights remain subject to their original terms.\n\n### Pipeline Check Without a GPU\n\n```bash\npython run_agent_eval.py --dataset tracespec-traj --backend mock \\\n  --max-samples 2 --max-new-tokens 32 \\\n  --output-dir outputs\u002Fsmoke\n```\n\nThe mock backend checks data loading, replay, record writing, aggregation, and report generation. Its metrics have no physical interpretation.\n\n### Fixed-Prefix Replay\n\n```bash\nCUDA_VISIBLE_DEVICES=0 python run_agent_eval.py \\\n  --dataset tracespec-traj --backend spec \\\n  --target \u002Fmodels\u002FQwen3-8B \\\n  --draft \u002Fmodels\u002Fdspark_qwen3_8b_block7 \\\n  --max-context-tokens 36864\n```\n\nThe default replay run uses all 2,500 test states. Use `--traj-phase`, `--traj-bucket`, and `--traj-mode` to select phases, nominal context buckets, and workloads. The default task-sampling seed is 980406.\n\n### Dynamic Evaluation\n\n```bash\nCUDA_VISIBLE_DEVICES=0 python run_agent_eval.py \\\n  --dataset browsecomp-plus --backend spec \\\n  --target \u002Fmodels\u002FQwen3-8B \\\n  --draft \u002Fmodels\u002Fdspark_qwen3_8b_block7 \\\n  --max-samples 100 --max-steps 50\n```\n\nUse `--dataset swe-bench-verified` for repository episodes. The backend detects the native draft architecture from its checkpoint configuration.\n\n### Batch Evaluation\n\nRun one native dynamic job with the batch launcher:\n\n```bash\nMODEL_ROOT=\u002Fmodels DRAFT_ROOT=\u002Fmodels \\\nGPUS=0 METHODS=dspark TARGETS=Qwen3-8B DATASETS=browsecomp-plus \\\nbash eval.sh\n```\n\nRun one native replay job with the replay launcher:\n\n```bash\nMODEL_ROOT=\u002Fmodels DRAFT_ROOT=\u002Fmodels \\\nGPUS_SPEC=0 METHODS=dspark TARGETS=Qwen3-8B \\\nbash eval_traj.sh\n```\n\nBoth scripts accept space-separated GPU, method, target, and dataset lists through environment variables. Native jobs use one GPU each. LongSpark replay uses one target GPU and one draft GPU per worker.\n\nBefore using LongSpark, extract `agentspec\u002Fvendor\u002Fsglang.tar.gz` into `agentspec\u002Fvendor\u002F` to restore the required `sglang\u002F` source tree.\n\nLongSpark requires a separate environment because its PyTorch ABI requirements differ from the native evaluators. Install it with:\n\n```bash\nbash scripts\u002Finstall_longspark_env.sh\n```\n\nSet `LONGSPARK_PYTHON_BIN` to the resulting interpreter when the replay method list includes LongSpark. Run `python run_agent_eval.py --help` for all model, decoding, filtering, and runtime options.\n\n## 📏 Metrics and Reports\n\nFor call `i`, `A_i` is the number of emitted accepted tokens including the correction or bonus token, `V_i` is the number of verification rounds, `P_i` is the number of proposed draft tokens, `N_i` is the number of output tokens, and `t_i` is model-call time.\n\n| Metric | Definition | Measurement scope |\n|---|---|---|\n| Accepted length | `sum(A_i) \u002F sum(V_i)` | Emitted accepted tokens per verification round |\n| Verification yield | `sum(A_i) \u002F sum(P_i + V_i)` | Accepted output relative to proposal and verification positions |\n| Generation throughput | `sum(N_i) \u002F sum(t_i)` | Output tokens per second, including prefill and decoding |\n| Episode latency | Full episode wall time | Complete interaction, including model calls and tool execution |\n\nRatios use summed counters rather than averages of per-request averages. The autoregressive baseline has accepted length 1 by definition.\n\nEach run writes a directory under `outputs\u002F` containing:\n\n* `records\u002F`: One JSONL shard per worker, with generation-level counters and episode-level outcomes.\n* `summary.json`: Overall, context, context by progress, phase, step, and latency aggregates.\n* `report.txt`: Formatted tables for interactive inspection.\n* `config.json`: The complete command-line configuration for the run.\n\n## 📁 Repository Structure\n\n```text\nTraceSpec\u002F\n├── run_agent_eval.py          # Evaluation entry point\n├── eval.sh                    # Dynamic batch launcher\n├── eval_traj.sh               # Fixed-prefix replay launcher\n├── agentspec\u002F\n│   ├── agents\u002F                # Dynamic agents and trajectory replay\n│   ├── backends\u002F              # Native, SGLang, autoregressive, and mock backends\n│   ├── tools\u002F                 # Repository and retrieval tools\n│   ├── datasets.py            # Dataset loading and replay filters\n│   ├── metrics.py             # Records and global aggregation\n│   ├── report.py              # Report rendering\n│   └── vendor\u002F                # Vendored evaluator and runtime components\n├── datasets\u002F                  # Evaluation metadata and TraceSpec-Traj test states\n├── scripts\u002F                   # Runtime installation and backend smoke checks\n└── tests\u002F                     # Offline unit tests\n```\n\n## ⚠️ Scope and Limitations\n\n* TraceSpec measures inference behavior, not task correctness. It does not score SWE-bench patches or BrowseComp answers.\n* Dynamic repository episodes execute allow-listed read commands on real checkouts. Edit and test operations are simulated, so their observations do not represent actual repository changes or test outcomes.\n* Native evaluators process one request at a time and prefill the complete history on every call. They do not provide persistent cross-call KV reuse or continuous batching.\n* Native PyTorch and SGLang measurements reflect different serving stacks. Compare their runtime results only under an explicitly controlled protocol.\n\n## 📄 License\n\nThe TraceSpec code is released under the [Apache License 2.0](LICENSE). Vendored components retain their original licenses and notices. See [NOTICE](NOTICE) for attribution and data terms.\n","TraceSpec 是一个面向大语言模型智能体（LLM Agents）的轨迹级推测解码评估框架。它支持动态交互执行与固定前缀重放，统一测量接受长度、吞吐量和单任务全程开销，并按上下文长度、执行阶段、工作负载类型和任务进度进行细粒度归因分析。核心特点包括：基于真实代理任务（如网页搜索、代码编辑）的多步动态评估；提供2500条覆盖多场景、多阶段、多上下文层级的标准化轨迹测试集（TraceSpec-Traj）；输出可分解的诊断指标，区分规划、动作、反思、回答等阶段行为差异。适用于推理服务优化、推测解码算法对比及智能体系统性能调优等研究与工程场景。",2,"2026-11-24 04:39:18","CREATED_QUERY"]