Skip to content

Official Inference Code of EAGLE-4

EAGLE-4 v0.1.0

Seyfal Sultanov75436712e741
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..1e0a4b0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,19 @@
+**
+!pyproject.toml
+!README.md
+!LICENSE
+!NOTICE
+!TRADEMARKS.md
+!THIRD_PARTY_NOTICES.md
+!docs/
+!docs/release.env
+!LICENSES/
+!LICENSES/**
+!eagle_harness/
+!eagle_harness/**
+!docker/
+!docker/**
+!.docker-release/
+!.docker-release/index/
+!.docker-release/index/**
+**/__pycache__/
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..40edeb6
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,19 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{py,cu,cuh,toml,sh}]
+indent_style = space
+indent_size = 4
+max_line_length = 120
+
+[*.{yml,yaml,json,cff}]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..ca8ef88
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+* text=auto eol=lf
+*.so binary
+*.whl binary
+*.pdf binary
+tests/golden/*.json linguist-generated=true
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000..2c5f25f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,46 @@
+name: Bug report
+description: Something fails, gives wrong output or is slower than it should be.
+labels: [bug]
+body:
+ - type: textarea
+ id: what
+ attributes:
+ label: What happened
+ description: What you ran, what you expected, and what happened instead. Paste the full error.
+ validations:
+ required: true
+ - type: textarea
+ id: check
+ attributes:
+ label: eagle-harness-check output
+ description: Output of `eagle-harness-check --kernels`.
+ render: text
+ validations:
+ required: true
+ - type: textarea
+ id: command
+ attributes:
+ label: Server command and config
+ description: The full launch command, including the `--speculative-algorithm-config` or `--speculative-config` JSON.
+ render: shell
+ validations:
+ required: true
+ - type: input
+ id: model
+ attributes:
+ label: Target and draft models
+ placeholder: Qwen3.8-27B with its EAGLE-4 draft
+ validations:
+ required: true
+ - type: input
+ id: hardware
+ attributes:
+ label: GPUs, tensor-parallel size, CUDA and driver versions
+ placeholder: 4x B300, TP4, CUDA 13.0, driver 580
+ validations:
+ required: true
+ - type: textarea
+ id: more
+ attributes:
+ label: Anything else
+ description: Workload, batch size, logs, or a measurement against a server without speculation.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..0fe609e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Report a security vulnerability
+ url: https://github.com/eagle-hq/EAGLE-4/security/advisories/new
+ about: Report vulnerabilities privately, never in a public issue (see SECURITY.md).
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000..1bdde88
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,16 @@
+name: Feature request
+description: Support for a model, engine version, GPU or feature.
+labels: [enhancement]
+body:
+ - type: textarea
+ id: need
+ attributes:
+ label: What you need and why
+ description: The model, engine, hardware or feature, and what it would let you do.
+ validations:
+ required: true
+ - type: textarea
+ id: tried
+ attributes:
+ label: What you tried
+ description: Commands, error messages or measurements, if any.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..a5ee313
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,35 @@
+### Licensing, attribution, and third-party content
+
+- [ ] I have checked whether my changes contain or modify Eagle 4-licensed files,
+ and have preserved required license, copyright, attribution, and NOTICE text.
+- [ ] Materially modified Eagle files are identified with the date, modifier,
+ and the affected file or component (or an appropriately mapped change log).
+- [ ] Any added third-party code, data, or weights are compatible with the
+ repository's licensing and contain required third-party notices.
+- [ ] If this is a public fork or derivative distribution, I have followed
+ the [Eagle Trademark Policy](../TRADEMARKS.md) and preserved the required
+ non-affiliation and distinguishable-branding disclosures.
+- [ ] I have reviewed the [contribution terms](../docs/legal/Eagle-Contribution-Terms-v1.0.pdf) (PDF)
+ and any requirements stated in CONTRIBUTING.md.
+
+## Change summary
+
+<!-- What changed, why, and which components or files it touches. Title: Conventional Commits, e.g. fix(kernels): ... -->
+
+## Testing and impact
+
+<!-- Tests you ran and their results (pytest, GPU tests, greedy parity, benchmarks with hardware, model, workload and
+baseline). Known limits, compatibility effects, security implications. -->
+
+## Third-party materials and dependencies
+
+<!-- Copied or adapted code, new dependencies, models, weights, datasets: source and license of each. Write "None" if
+there are none. -->
+
+## AI-assisted or generated content
+
+<!-- The tool, what it generated or helped write, and how you reviewed and tested it. Write "None" if there is none. -->
+
+## Documentation and notices
+
+<!-- README or docs/ pages you updated, and any change to THIRD_PARTY_NOTICES.md or file headers. -->
diff --git a/.github/workflows/publish-engines.yml b/.github/workflows/publish-engines.yml
new file mode 100644
index 0000000..f2b2bb5
--- /dev/null
+++ b/.github/workflows/publish-engines.yml
@@ -0,0 +1,60 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+name: publish-engines
+
+on:
+ workflow_dispatch:
+ inputs:
+ release_tag:
+ description: "Published release whose engine assets replace the channel indices"
+ type: choice
+ options: [v0.1.0]
+ default: v0.1.0
+ required: true
+
+permissions:
+ contents: read
+
+concurrency:
+ group: engine-pages
+ cancel-in-progress: false
+
+jobs:
+ build:
+ if: github.repository == 'eagle-hq/EAGLE-4'
+ runs-on: ubuntu-24.04
+ timeout-minutes: 60
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: "3.12"
+ - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
+ - name: Download release wheels and verify both channel manifests
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_TAG: ${{ inputs.release_tag }}
+ run: python tools/engine_release.py pages "$RELEASE_TAG" _site
+ - uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
+ with:
+ path: _site
+ retention-days: 7
+
+ deploy:
+ if: github.repository == 'eagle-hq/EAGLE-4'
+ needs: build
+ runs-on: ubuntu-24.04
+ timeout-minutes: 10
+ permissions:
+ pages: write
+ id-token: write
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - name: Deploy the wheel-free index
+ id: deployment
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
diff --git a/.github/workflows/publish-images.yml b/.github/workflows/publish-images.yml
new file mode 100644
index 0000000..f0d457b
--- /dev/null
+++ b/.github/workflows/publish-images.yml
@@ -0,0 +1,118 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+name: publish-images
+
+on:
+ workflow_dispatch:
+ inputs:
+ release_tag:
+ description: "Release source and image version; deploy its Pages index first"
+ type: choice
+ options: [v0.1.0]
+ default: v0.1.0
+ required: true
+ rocm_base_image:
+ description: "Approved Python 3.10 / ROCm 7.2 MI355X base image pinned by @sha256"
+ type: string
+ required: true
+ tokenspeed_base_image:
+ description: "Approved Python 3.12 / CUDA 13.0 TokenSpeed base image pinned by @sha256"
+ type: string
+ required: true
+ runner:
+ description: "Approved larger GitHub-hosted Linux x64 runner label (enough disk for base images and build layers)"
+ type: string
+ required: true
+
+permissions:
+ contents: read
+
+concurrency:
+ group: engine-images
+ cancel-in-progress: false
+
+jobs:
+ images:
+ if: github.repository == 'eagle-hq/EAGLE-4'
+ runs-on: ${{ inputs.runner }}
+ timeout-minutes: 180
+ permissions:
+ contents: read
+ packages: write
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - engine: sglang
+ channel: cu130
+ base_image: ""
+ - engine: sglang-rocm
+ channel: rocm
+ base_image: ${{ inputs.rocm_base_image }}
+ - engine: vllm
+ channel: cu130
+ base_image: ""
+ - engine: tokenspeed
+ channel: cu130
+ base_image: ${{ inputs.tokenspeed_base_image }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: ${{ inputs.release_tag }}
+ persist-credentials: false
+ - name: Check the published index and Dockerfile contract
+ env:
+ ENGINE: ${{ matrix.engine }}
+ CHANNEL: ${{ matrix.channel }}
+ RELEASE_TAG: ${{ inputs.release_tag }}
+ BASE_IMAGE: ${{ matrix.base_image }}
+ RUNNER_ENVIRONMENT: ${{ runner.environment }}
+ run: |
+ test "$RUNNER_ENVIRONMENT" = github-hosted
+ test "$RELEASE_TAG" = v0.1.0
+ test "$(uname -m)" = x86_64
+ docker info
+ docker buildx version
+ df -h
+ test -f "docker/$ENGINE.Dockerfile"
+ . ./docs/release.env
+ test "$EAGLE_VERSION" = "${RELEASE_TAG#v}"
+ test "$EAGLE_CUDA_INDEX" = https://eagle-hq.github.io/EAGLE-4/whl/cu130/
+ test "$EAGLE_ROCM_INDEX" = https://eagle-hq.github.io/EAGLE-4/whl/rocm/
+ if [[ "$ENGINE" == sglang-rocm || "$ENGINE" == tokenspeed ]]; then
+ [[ "$BASE_IMAGE" =~ ^[^[:space:]]+@sha256:[a-f0-9]{64}$ ]]
+ fi
+ curl --fail --silent --show-error --retry 3 \
+ "https://eagle-hq.github.io/EAGLE-4/whl/$CHANNEL/SHA256SUMS"
+ - name: Log in to GHCR
+ env:
+ GH_TOKEN: ${{ github.token }}
+ GH_USER: ${{ github.actor }}
+ run: printf '%s' "$GH_TOKEN" | docker login ghcr.io -u "$GH_USER" --password-stdin
+ - name: Build, check and push the release image
+ env:
+ ENGINE: ${{ matrix.engine }}
+ CHANNEL: ${{ matrix.channel }}
+ RELEASE_TAG: ${{ inputs.release_tag }}
+ BASE_IMAGE: ${{ matrix.base_image }}
+ run: |
+ image="ghcr.io/eagle-hq/eagle-4-$ENGINE:${RELEASE_TAG#v}"
+ bash tools/check_image_tag.sh "$image"
+ build_args=()
+ if [ -n "$BASE_IMAGE" ]; then
+ build_args+=(--build-arg "BASE_IMAGE=$BASE_IMAGE")
+ fi
+ docker build --pull --platform linux/amd64 "${build_args[@]}" \
+ --file "docker/$ENGINE.Dockerfile" \
+ --label "org.opencontainers.image.source=https://github.com/eagle-hq/EAGLE-4" \
+ --label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
+ --label "org.opencontainers.image.version=${RELEASE_TAG#v}" \
+ --tag "$image" .
+ docker run --rm --entrypoint eagle-harness "$image" calibrate --help
+ bash tools/check_image_tag.sh "$image"
+ docker push "$image"
+ docker buildx imagetools inspect "$image"
+ - name: Log out of GHCR
+ if: always()
+ run: docker logout ghcr.io
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..bf5dd01
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,50 @@
+# Public eagle-harness: upload a release to PyPI. Publishing a GitHub release vX.Y.Z on this repo builds the files with
+# wheels.yml and uploads them with PyPI trusted publishing (no API token) once a maintainer approves the `pypi`
+# environment, then attaches them to the release. In the private source repo this workflow is skipped: releases there
+# come from release-please, and the upload happens on this repo after the export.
+name: publish
+
+on:
+ release:
+ types: [published]
+
+permissions:
+ contents: read
+
+jobs:
+ wheels:
+ if: github.repository == 'eagle-hq/EAGLE-4'
+ uses: ./.github/workflows/wheels.yml
+ with:
+ ref: ${{ github.event.release.tag_name }}
+
+ publish:
+ needs: wheels
+ runs-on: ubuntu-24.04
+ environment:
+ name: pypi
+ url: https://pypi.org/project/eagle-harness/
+ permissions:
+ contents: write # attach the files to the release
+ id-token: write # PyPI trusted publishing
+ steps:
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ with:
+ name: dist
+ path: dist
+ - name: The upload set (sdist, binary wheel, pure wheel) carries the tag's version
+ env:
+ TAG: ${{ github.event.release.tag_name }}
+ run: |
+ mkdir upload
+ cp dist/*.tar.gz dist/*.whl dist/pure/*.whl upload/
+ ls -l upload
+ test -f "upload/eagle_harness-${TAG#v}.tar.gz"
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
+ with:
+ packages-dir: upload
+ - name: Attach the files to the release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ TAG: ${{ github.event.release.tag_name }}
+ run: gh release upload "$TAG" upload/* --repo "$GITHUB_REPOSITORY"
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
new file mode 100644
index 0000000..822a834
--- /dev/null
+++ b/.github/workflows/wheels.yml
@@ -0,0 +1,86 @@
+# Build the sdist, the binary wheel and the pure wheel with tools/build_wheel.sh, then check them (twine check and
+# tools/check_dist.py: name, version, extras, entry points, contents, license state). Nothing is uploaded here: the
+# files are a workflow artifact; publish.yml and the source repo's release workflow call this workflow.
+#
+# The binary wheel carries the native candidate-head library prebuilt for CUDA 12.9 and 13.0
+# (eagle_harness/kernels/build.py), so `pip install` needs no nvcc; the sdist and the pure wheel build it on first use.
+name: wheels
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - pyproject.toml
+ - setup.py
+ - MANIFEST.in
+ - LICENSE
+ - NOTICE
+ - TRADEMARKS.md
+ - THIRD_PARTY_NOTICES.md
+ - LICENSES/**
+ - README.md
+ - eagle_harness/__init__.py
+ - eagle_harness/kernels/build.py
+ - eagle_harness/kernels/csrc/**
+ - tools/build_wheel.sh
+ - tools/check_dist.py
+ - .github/workflows/wheels.yml
+ pull_request:
+ paths:
+ - pyproject.toml
+ - setup.py
+ - MANIFEST.in
+ - LICENSE
+ - NOTICE
+ - TRADEMARKS.md
+ - THIRD_PARTY_NOTICES.md
+ - LICENSES/**
+ - README.md
+ - eagle_harness/__init__.py
+ - eagle_harness/kernels/build.py
+ - eagle_harness/kernels/csrc/**
+ - tools/build_wheel.sh
+ - tools/check_dist.py
+ - .github/workflows/wheels.yml
+ workflow_dispatch:
+ workflow_call:
+ inputs:
+ ref:
+ description: "git ref to build; empty: the commit that triggered the caller"
+ type: string
+ default: ""
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: ${{ inputs.ref }}
+ persist-credentials: false
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: "3.12"
+ - name: CUDA 12.9 and 13.0 compilers (nvcc and the static runtime only)
+ run: |
+ curl -sSLO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
+ sudo dpkg -i cuda-keyring_1.1-1_all.deb
+ sudo apt-get update -q
+ sudo apt-get install -y -q --no-install-recommends \
+ cuda-nvcc-12-9 cuda-cudart-dev-12-9 cuda-nvcc-13-0 cuda-cudart-dev-13-0
+ - run: python -m pip install build auditwheel patchelf twine
+ - run: bash tools/build_wheel.sh . dist /usr/local/cuda-12.9 /usr/local/cuda-13.0
+ - name: Build log (toolkits, glibc symbols, wheel contents)
+ if: always()
+ run: cat dist/build.txt || true
+ - run: python -m twine check --strict dist/*.tar.gz dist/*.whl dist/pure/*.whl
+ - run: python tools/check_dist.py dist
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: dist
+ path: dist
+ retention-days: 14
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b0481f2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+.DS_Store
+__pycache__/
+*.egg-info/
+build/
+.pytest_cache/
+REVISION
+eagle_harness/kernels/_native/
+.docker-release/
+eagle-calibration-*/
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..1ecb6d6
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+# Changelog
+
+## 0.1.0 (2026-10-20)
+
+- Serve EAGLE-4 drafts with SGLang on NVIDIA B300 and AMD MI355X.
+- Serve EAGLE-4 drafts with vLLM and the experimental TokenSpeed integration.
+- Use packaged cost profiles to select speculative decoding schedules.
+- Install the harness from wheels or source with the matching engine wheels and platform-specific quickstarts.
+
+See the [0.1.0 release notes](docs/release-notes/0.1.0.md) for supported configurations and known limits.
diff --git a/CITATION.cff b/CITATION.cff
new file mode 100644
index 0000000..adcd3d8
--- /dev/null
+++ b/CITATION.cff
@@ -0,0 +1,65 @@
+cff-version: 1.2.0
+message: "If you use eagle-harness in your work, cite the EAGLE-4 paper below."
+type: software
+title: "eagle-harness"
+abstract: >-
+ EAGLE-Harness for sglang and vLLM: cost-model-driven dynamic-tree speculative decoding with EAGLE-4 drafts, as an
+ out-of-tree engine plugin.
+authors:
+ - name: "Eagle AI Team"
+repository-code: "https://github.com/eagle-hq/EAGLE-4"
+url: "https://eagle.ai"
+keywords:
+ - speculative decoding
+ - EAGLE
+ - LLM inference
+ - sglang
+ - vLLM
+preferred-citation:
+ type: generic
+ title: "EAGLE-4: One Flexible Drafter for All Batch Sizes and Hardware"
+ authors:
+ - name: "Eagle AI Team"
+ year: 2026
+ notes: "Preprint"
+ url: "https://github.com/eagle-hq/EAGLE-4/blob/main/EAGLE4_Paper.pdf"
+references:
+ - type: conference-paper
+ title: "EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty"
+ authors:
+ - given-names: Yuhui
+ family-names: Li
+ - given-names: Fangyun
+ family-names: Wei
+ - given-names: Chao
+ family-names: Zhang
+ - given-names: Hongyang
+ family-names: Zhang
+ collection-title: "International Conference on Machine Learning"
+ year: 2024
+ - type: conference-paper
+ title: "EAGLE-2: Faster Inference of Language Models with Dynamic Draft Trees"
+ authors:
+ - given-names: Yuhui
+ family-names: Li
+ - given-names: Fangyun
+ family-names: Wei
+ - given-names: Chao
+ family-names: Zhang
+ - given-names: Hongyang
+ family-names: Zhang
+ collection-title: "Empirical Methods in Natural Language Processing"
+ year: 2024
+ - type: conference-paper
+ title: "EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Test"
+ authors:
+ - given-names: Yuhui
+ family-names: Li
+ - given-names: Fangyun
+ family-names: Wei
+ - given-names: Chao
+ family-names: Zhang
+ - given-names: Hongyang
+ family-names: Zhang
+ collection-title: "Annual Conference on Neural Information Processing Systems"
+ year: 2025
diff --git a/COMMERCIAL-LICENSE-AGREEMENT.md b/COMMERCIAL-LICENSE-AGREEMENT.md
new file mode 100644
index 0000000..b7ec0b4
--- /dev/null
+++ b/COMMERCIAL-LICENSE-AGREEMENT.md
@@ -0,0 +1,145 @@
+# Eagle 4 Commercial License Agreement
+
+Effective Date: the date on which this Agreement first becomes binding under Section 1
+
+This Eagle 4 Commercial License Agreement (the “Agreement”) is entered into as of the Effective Date by and between:
+
+Eagle AI Corp (“Licensor”); and
+
+the person or entity identified in the applicable signature, executed Order Form, or other written acceptance by Eagle AI Corp (“Licensee”).
+
+Licensor and Licensee may each be called a “Party” and together the “Parties.”
+
+## 1. Parties and Acceptance
+
+**a.** This Agreement becomes binding between Eagle AI Corp and Licensee only when both Parties sign it, both Parties execute a written Order Form that incorporates it, or Eagle AI Corp provides another written acceptance of Licensee’s written request for Commercial License Rights. An individual signing or accepting on behalf of an entity represents that the individual has authority to bind the identified entity. Downloading, cloning, forking, copying, modifying, using, hosting, or distributing public code does not by itself form this Agreement or grant Commercial License Rights.
+
+**b.** The Source-Available License accompanying Eagle 4 public code applies by conduct when a person downloads, clones, forks, copies, accesses, modifies, uses, hosts, distributes, or otherwise exercises any licensed right in that code. That conduct forms an agreement only under the Source-Available License, not under this Agreement, and does not grant Commercial License Rights under this Agreement.
+
+## 2. Definitions and Commercial-License Requirement
+
+**a.** “Affiliate” means an entity that directly or indirectly Controls, is Controlled by, or is under common Control with a Party.
+
+**b.** “Control” means ownership of more than 50 percent of the voting interests of an entity or the power to direct its management and policies.
+
+**c.** “Aggregate Revenue” means the total gross revenue of Licensee and all Affiliates from all sources, determined on a consolidated basis over the applicable Consecutive 12-Month Period under consistently applied generally accepted accounting principles or International Financial Reporting Standards, with intercompany revenue eliminated and without duplication.
+
+**d.** “Commercial License Rights” means rights, exceptions, permissions, or proprietary treatment expressly granted by Licensor under this Agreement or an executed Order Form beyond rights available under the Source-Available License.
+
+**e.** “Commercial Use” means using the Software, a Modification, a Derivative Work, or their functionality for direct or indirect commercial advantage or revenue generation, including in or for any paid product or service, customer-facing production use, software as a service, application programming interface, hosting, consulting, integration, original-equipment-manufacturer or embedded use, advertising-supported service, commercialization of a fork or Derivative Work, or use that materially supports a revenue-generating product or service. Commercial Use does not include genuine internal evaluation, academic research, nonprofit research, education, personal noncommercial use, or internal noncommercial experimentation, in each case only where the use is not customer-facing, does not generate revenue or commercial advantage, and does not materially support a revenue-generating product or service.
+
+**f.** “Consecutive 12-Month Period” means any rolling period of 12 consecutive calendar months.
+
+**g.** “Derivative Work” means a work based on or derived from the Software.
+
+**h.** “Modification” means any change to the Software or Derivative Work based on the Software.
+
+**i.** “Software” means the Eagle 4 materials made available under the Source-Available License or identified in an executed Order Form or otherwise provided by Licensor for use under this Agreement, including applicable model architecture, model weights and parameters, source code, object code, configuration files, inference and training code, documentation, and any portion or Modification of them.
+
+**j.** “Source-Available License” means the Eagle 4 Source-Available License accompanying the public code and incorporating the Eagle Trademark Policy.
+
+**k.** “Order Form” means a short written ordering document executed by both Parties that identifies applicable fees and payment terms, the commercial contact, and any specifically negotiated rights. An Order Form may identify applicable Eagle 4 components, revenue or user metrics used under this Agreement, fees, hosting, APIs, embedding, original-equipment-manufacturer use, distribution, attribution, white-label treatment, and other negotiated rights.
+
+The Source-Available License requires a person or entity whose Aggregate Revenue exceeds US $20,000,000, or the equivalent in other currencies, in total during any Consecutive 12-Month Period to enter into a separate written commercial agreement with Eagle AI Corp before beginning or continuing any Commercial Use of the Software or its Derivative Works. Revenue denominated in another currency must be converted to U.S. dollars using a commercially reasonable exchange rate consistently applied as of the end of the applicable Consecutive 12-Month Period. This Agreement may satisfy that requirement only when it is binding under Section 1 between Eagle AI Corp and Licensee and all applicable fees and conditions under this Agreement and any executed Order Form have been satisfied. Once those requirements are satisfied, Licensee is not required to enter into this Agreement again for the same Commercial License Rights. Eagle AI Corp has no obligation to grant a commercial license.
+
+For clarity, this Agreement is separate from the Source-Available License. It grants Commercial License Rights only as expressly stated in this Agreement or an executed Order Form and does not alter the terms that govern possession, inspection, or noncommercial exercise of rights in public code. No download, clone, fork, copy, access, modification, use, hosting, distribution, or other exercise of a right in public code obligates Eagle AI Corp to grant Commercial License Rights.
+
+## 3. Separation of Licenses
+
+**a.** This Agreement governs only Commercial License Rights expressly granted by Eagle AI Corp under this Agreement or an executed Order Form. Rights to the public code arise solely under the Source-Available License and not under this Agreement.
+
+**b.** Conduct governed by the Source-Available License does not grant any benefit under this Agreement, including proprietary exceptions, expanded distribution rights, white-label rights, support, warranties, indemnity, or trademark permissions. Downloading or otherwise using the public code alone does not form this Agreement or satisfy a separate-commercial-license requirement under the Source-Available License.
+
+**c.** Licensee may not claim or exercise a negotiated Commercial License Right or exception while rejecting or avoiding the restrictions, payment obligations, and other conditions attached to that right under this Agreement or the applicable executed Order Form.
+
+**d.** Forks, Modifications, and Derivative Works may be made and distributed only under applicable rights granted by the Source-Available License, this Agreement, or an executed Order Form. Each distributed fork, Modification, or Derivative Work must preserve required attribution and notices, identify Eagle AI Corp and Eagle 4 as the origin, use a distinguishable primary name, and avoid suggesting official status, affiliation, certification, sponsorship, or endorsement. Eagle materials remain subject to Sections 6 and 8.
+
+## 4. License Grant and Permitted Uses
+
+**a.** After this Agreement becomes binding under Section 1 and Licensee pays all applicable fees, Licensor grants Licensee, while this Agreement and any applicable executed Order Form remain in effect, a limited, nonexclusive, nontransferable, nonsublicensable license to access, use, reproduce, run, modify, and create Derivative Works of the Software solely for Licensee’s internal business purposes and to develop and operate Licensee’s own products or services, in each case only within the scope expressly stated in this Agreement or an applicable executed Order Form.
+
+**b.** Licensee may permit its employees and contractors to exercise those rights on its behalf if they are bound by protective obligations at least as strong as this Agreement. Licensee remains responsible for their acts and omissions.
+
+**c.** Distribution, sublicensing, hosting for third parties, original-equipment-manufacturer use, white-label use, trademark use, and proprietary or closed-source treatment are permitted only if this Agreement or an applicable executed Order Form expressly grants the applicable right and states any conditions or limits.
+
+**d.** All rights not expressly granted are reserved. No Commercial License Right arises by implication, estoppel, public-code access, or otherwise. Any specifically negotiated rights must be stated in an applicable executed Order Form or another writing accepted by Eagle AI Corp under Section 1.
+
+## 5. Fees and Payment
+
+Licensee will pay the fees on the payment terms stated in an applicable executed Order Form or other written commercial terms binding under Section 1. Unless otherwise stated, undisputed invoices are due within 30 days, fees are nonrefundable, and Licensee is responsible for applicable transaction taxes other than taxes on Licensor’s net income.
+
+## 6. Attribution, Notices, and Trademarks
+
+**a.** For all Software used under Commercial License Rights, Licensee will preserve and reproduce the Eagle LICENSE file and NOTICE file, all applicable copyright, patent, source-file, modification, license, attribution, authorship, trademark, and other proprietary notices supplied with the Software, and customary third-party notices. Every authorized distribution must include the Eagle LICENSE and NOTICE files and applicable source-file and modification notices, state conspicuously that the Software is subject to the Source-Available License and that the license is not an OSI-approved open-source license, provide reasonable directions for locating the Eagle Trademark Policy, and reproduce required notices in the corresponding files or a customary third-party notices location. Each authorized distribution must also state conspicuously that downloading, cloning, forking, copying, accessing, modifying, using, hosting, distributing, or otherwise exercising any licensed right constitutes acceptance of the Source-Available License and the incorporated Eagle Trademark Policy.
+
+**b.** Licensee must identify each materially modified file and state the date of the material modification and the modifying person or entity, although a consolidated change log may be used if it clearly maps each material modification to the affected files. Every public repository, publication, demonstration, distributed software release, or public description of a Derivative Work must include a reasonably prominent statement substantially similar to: “This project includes or is derived from Eagle 4 technology developed by Eagle AI Corp. It is not an official Eagle AI Corp project unless expressly stated otherwise.” These requirements are subject only to an express written white-label, proprietary-treatment, or alternative-attribution provision in an applicable executed Order Form.
+
+**c.** No trademark or branding right is granted except as expressly stated in an applicable executed Order Form. The Eagle Trademark Policy is incorporated by reference into this Agreement for any use of Eagle names, marks, logos, or branding under Commercial License Rights. All use of Licensor’s names, logos, and marks must comply with that policy and inure solely to Licensor’s benefit. Licensee may make truthful, nonmisleading nominative references to Eagle 4 solely to identify compatibility, origin, or the Software used, if the reference is no more prominent than reasonably necessary and complies with the Eagle Trademark Policy. Licensee may not imply affiliation with, certification by, sponsorship by, or endorsement from Licensor.
+
+## 7. Restrictions.
+
+Except as expressly authorized in this Agreement or an applicable executed Order Form, Licensee shall not exceed the licensed scope; distribute, sublicense, sell, lease, transfer, host, or make the Software available to a third party; remove, conceal, obscure, materially alter, or materially reduce required notices or attribution; circumvent technical or usage limits; use the Software unlawfully; falsely claim original authorship of Eagle 4 or Licensor’s work; or represent that Licensor endorses Licensee or its products.
+
+## 8. Prohibition on Unauthorized Competing Offerings, Derivative Works, and Forks.
+
+**a.** “Competing Offering” means a product or service whose principal functionality substantially substitutes for the principal functionality of Eagle 4, or that incorporates material Eagle 4 technology into a model, inference, training, acceleration, or serving framework that competes with Eagle 4. It does not include a product or service merely because it interoperates with Eagle 4, calls or is called by Eagle 4 through documented interfaces, complements Eagle 4, uses outputs generated by Eagle 4, or includes only incidental or immaterial use of Eagle 4 that does not provide a material portion of the product’s or service’s principal functionality. Except as expressly authorized in an applicable executed Order Form or other written amendment, Licensee shall not, directly or indirectly:
+
+**i.** develop, offer, sell, license, host, provide, or otherwise commercialize a Competing Offering, including through a fork, Modification, adaptation, or Derivative Work of the Software;
+
+**ii.** evade the Competing Offering restriction by copying, forking, renaming, rebranding, translating, wrapping, porting, making superficial changes to Eagle 4, or placing material Eagle 4 technology in another framework; or
+
+**iii.** authorize, enable, or assist any third party in engaging in the foregoing activities. This Section 8 applies to Commercial License Rights exercised under this Agreement.
+
+**iv.** Forks, Modifications, and Derivative Works independently permitted by the Source-Available License remain governed by that license, including its source, attribution, notice, modification, trademark, and separate-commercial-license requirements. Renaming, rebranding, translating, wrapping, porting, integrating, modifying, or moving any Software file or Eagle 4 code into another file, directory, repository, framework, package, or distribution does not remove or reduce applicable obligations under the Source-Available License or this Agreement. The substance and origin of the code control, not its name, location, packaging, interface, or surrounding repository license.
+
+## 9. Ownership
+
+**a.** As between the Parties, Licensor and its licensors own all right, title, and interest in and to the Software, Eagle 4 technology, Licensor-provided materials, and all intellectual-property rights in them. Licensee owns its original contributions to a Modification, and its data, products, and technology developed independently of the Software, subject to Licensor’s ownership of the Software and the conditions and licenses in this Agreement and the Source-Available License. No ownership transfers under this Agreement.
+
+**b.** Licensee may provide feedback. Licensor may use feedback without restriction or payment, but may not identify Licensee as its source without permission.
+
+## 10. Confidentiality.
+
+This Section applies only if a Party provides nonpublic information that is marked confidential or reasonably should be understood as confidential. The recipient will use it only to perform or exercise rights under this Agreement, protect it with reasonable care, and disclose it only to personnel and contractors who need to know and are bound to protect it. These duties do not apply to information the recipient can document was lawfully known without restriction, independently developed, lawfully received from another source, or made public without breach. A required legal disclosure is permitted after reasonable notice, if lawful. These duties last five years after disclosure, except trade secrets remain protected while they qualify as trade secrets.
+
+## 11. Limited Records and Audit.
+
+For three years after each Commercial Use or distribution of the Software or a Modification, Licensee will keep reasonably complete records sufficient to verify fees and compliance with this Agreement, including the Aggregate Revenue threshold, Commercial Use, Competing Offering, attribution, source, trademark, modification, and notice requirements. Licensee need not disclose unrelated product data, personal data, source code unrelated to the Software, or legally privileged material. No more than once in any 12-month period, Licensor may have an independent auditor bound by written confidentiality obligations inspect only the relevant records during normal business hours and without unreasonable disruption. An audit of fees requires at least 10 business days’ written notice. An audit of other compliance requires at least 30 days’ written notice and a reasonable, documented basis to suspect a material violation, except that the frequency and notice limits do not apply where Licensor has a reasonable, documented basis to suspect fraud or intentional circumvention. Licensor pays the audit cost unless the audit finds a material scope violation or an underpayment exceeding five percent, in which case Licensee will pay the reasonable audit cost and promptly cure the violation or underpayment.
+
+## 12. Warranties and Disclaimer
+
+**a.** Each Party warrants that it has authority to enter into this Agreement. Licensor warrants that it has the right to grant the Commercial License Rights expressly granted under this Agreement.
+
+**b.** EXCEPT FOR THE EXPRESS WARRANTIES ABOVE, THE SOFTWARE, DOCUMENTATION, OUTPUTS, RESULTS, AND ANY SERVICES ARE PROVIDED “AS IS” AND “AS AVAILABLE,” WITH ALL FAULTS. TO THE MAXIMUM EXTENT PERMITTED BY LAW, LICENSOR AND ITS AFFILIATES, LICENSORS, AND CONTRIBUTORS DISCLAIM ALL EXPRESS, IMPLIED, STATUTORY, AND OTHER WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, ACCURACY, SECURITY, AND WARRANTIES ARISING FROM COURSE OF DEALING OR USAGE OF TRADE. LICENSEE IS SOLELY RESPONSIBLE FOR EVALUATING FITNESS, SAFETY, SECURITY, AND LEGAL COMPLIANCE.
+
+## 13. Indemnity
+
+**a.** Licensee will defend Licensor and its officers, directors, and employees against third-party claims arising from Licensee’s products or services, Licensee’s modification, distribution, or use of the Software, or Licensee’s breach of Sections 6 or 7, and will pay resulting finally awarded damages, settlements approved by Licensee, and reasonable legal fees.
+
+**b.** Licensor will promptly notify Licensee of a claim, provide reasonable cooperation at Licensee’s expense, and allow Licensee to control the defense and settlement. Licensee may not settle a claim in a manner that admits fault by or imposes nonmonetary obligations on Licensor without Licensor’s written consent.
+
+## 14. Limitation of Liability
+
+**a.** TO THE MAXIMUM EXTENT PERMITTED BY LAW, NEITHER PARTY WILL BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR FOR LOST PROFITS, REVENUE, GOODWILL, OR DATA, ARISING OUT OF THIS AGREEMENT, EVEN IF ADVISED OF THE POSSIBILITY.
+
+**b.** EACH PARTY’S AGGREGATE LIABILITY ARISING OUT OF THIS AGREEMENT WILL NOT EXCEED THE FEES PAID OR PAYABLE UNDER IT DURING THE 12 MONTHS BEFORE THE EVENT GIVING RISE TO LIABILITY. THE CAP AND DAMAGES EXCLUSION DO NOT APPLY TO LICENSEE’S PAYMENT OBLIGATIONS, BREACH OF SECTIONS 6, 7, OR 9, INDEMNITY OBLIGATIONS, OR INFRINGEMENT OR MISAPPROPRIATION OF THE OTHER PARTY’S INTELLECTUAL-PROPERTY RIGHTS, OR TO LIABILITY THAT CANNOT LAWFULLY BE LIMITED.
+
+## 15. Term and Termination
+
+**a.** This Agreement begins on the Effective Date and continues until terminated. An executed Order Form may state a fixed term for the rights it grants.
+
+**b.** Either Party may terminate this Agreement or an affected executed Order Form if the other Party materially breaches it and does not cure the breach within 30 days after written notice, or within 10 days for nonpayment. Licensor may suspend Commercial License Rights or terminate immediately for an unauthorized Competing Offering, willful infringement or misappropriation, unlawful use, fraud, intentional circumvention, or a breach that cannot be cured. Either Party may terminate upon the other Party’s insolvency, bankruptcy filing not dismissed within 60 days, or cessation of business.
+
+**c.** On expiration or termination, the Commercial License Rights end and Licensee will stop exercising them, pay accrued amounts, and return or destroy Licensor’s Confidential Information on request. Rights independently available under the Source-Available License are unaffected, but Licensee must stop any Commercial Use that requires Commercial License Rights and stop claiming any proprietary exception or other benefit granted only by this Agreement. Authorized end-user rights survive only if an executed Order Form expressly provides for survival. Sections 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, and 15 survive to the extent their nature requires.
+
+## 16. General
+
+**a.** This Agreement is governed by New York law, without regard to conflict-of-laws rules. The state and federal courts located in New York County, New York have exclusive jurisdiction and venue, and each Party consents to them.
+
+**b.** Notices must be in writing and sent by email with confirmation of transmission, personal delivery, or nationally recognized overnight courier to the commercial contact in the applicable executed Order Form or signature block. Licensor’s commercial contact is [email protected]. A notice is effective on confirmed email transmission or receipt.
+
+**c.** Licensee may not assign or transfer this Agreement or any Commercial License Right without Licensor’s prior written consent. Licensor may assign this Agreement to an affiliate or in connection with a merger, reorganization, financing, or sale of all or substantially all of the relevant business or assets. Any prohibited assignment is void.
+
+**d.** This Agreement and each executed Order Form are the entire agreement concerning their subject matter and replace prior discussions. An executed Order Form controls only for the specific commercial terms and rights it expressly states. Any amendment or waiver must be in a writing signed by the Party to be charged. No schedule is required unless the Parties expressly incorporate it.
+
+**e.** The Parties are independent contractors. If a provision is unenforceable, it will be modified only as necessary and the remainder will continue. A failure to enforce is not a waiver. Neither Party is liable for delay caused by events beyond its reasonable control, except payment obligations. Counterparts and electronic signatures are effective.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..3057938
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,95 @@
+# Contributing to eagle-harness
+
+Open an issue before you start a large change (a new engine hook, a new kernel, a change to the cost model or the
+configuration keys), so the design can be agreed before the code. Small fixes can go straight to a pull request.
+
+## Contribution terms
+
+By submitting, uploading, pushing, committing, proposing, or otherwise providing a pull request, patch, issue
+attachment, model, weight, dataset, documentation, or other contribution to this repository, you agree to the
+[Eagle Contribution License and Submission Terms](docs/legal/Eagle-Contribution-Terms-v1.0.pdf) (PDF, v1.0,
+7 October 2026). If you do not agree, do not submit a contribution. If you act for an employer, client, partner or
+other entity, you represent that you have authority to submit the contribution and have obtained all required
+permissions.
+
+No signature, certification form, separate submission or other acceptance procedure is required, and there is no CLA
+to sign and no sign-off to add to your commits. Merely viewing this repository or the terms does not accept them.
+Contact [[email protected]](mailto:[email protected]) with questions about licensing, authority or permissions.
+
+### Licensing structure
+
+Submitting a contribution does **not** change the license of existing Eagle code.
+
+Under the contribution terms, Eagle AI Corp controls outbound licensing for accepted contributions. Depending on the
+project and use case, Eagle may distribute or use a contribution under an Eagle source-available license, an Eagle
+commercial license, a proprietary license, Apache-2.0, a model, weight or dataset license, another open-source or
+source-available license, or a future licensing structure the contribution terms permit. Do not assume that
+submitting code here makes that code Apache-2.0, open source, or eligible for contribution to another project.
+
+EAGLE-4 itself is source-available, not open source: the [Eagle 4 Source-Available License](LICENSE) governs the code
+and incorporates the [Eagle Trademark Policy](TRADEMARKS.md). See [`NOTICE`](NOTICE) for the short-form notice.
+
+## Set up
+
+```bash
+git clone https://github.com/eagle-hq/EAGLE-4 && cd EAGLE-4
+python -m venv .venv && source .venv/bin/activate
+pip install -e ".[test]"
+```
+
+Install sglang, vLLM or TokenSpeed with the eagle-harness hooks ([Compatibility](docs/compatibility.md)) to run that engine's
+tests. Each engine's tests skip without it.
+
+## Test
+
+```bash
+pytest tests # CPU tests (the *_gpu.py files skip without a GPU)
+pytest tests/test_*_gpu.py # GPU kernel tests against their torch references, on a supported GPU
+pipx run ruff==0.15.1 check . # lint (line length 120)
+```
+
+A change to a kernel needs a test against a reference (torch or the kernel it replaces), and a performance claim
+needs a measurement with its hardware, model, workload and baseline. `tools/greedy_parity.py` compares a speculative
+server token for token with a server without speculation. `tools/bench_kernels.py` times kernels.
+
+To build the release files:
+
+```bash
+tools/build_wheel.sh <source tree> <out dir> /usr/local/cuda-12.9 /usr/local/cuda-13.0
+python tools/check_dist.py <out dir>
+```
+
+## Commit messages
+
+Commits follow [Conventional Commits](https://www.conventionalcommits.org/): `type(scope): summary`, in the
+imperative, with a body that says why and gives the evidence.
+
+| part | values |
+|---|---|
+| type | `feat`, `fix`, `perf`, `refactor`, `test`, `docs`, `build`, `chore` |
+| scope | `sglang`, `vllm`, `tokenspeed`, `kernels`, `core`, `pkg` |
+
+Releases and the changelog are built from these messages: `feat` raises the minor version, `fix` and `perf` the
+patch version. Mark a breaking change with `!` after the scope or a `BREAKING CHANGE:` footer. Keep one logical
+change per commit.
+
+## Pull requests
+
+The pull request template asks for a summary, the tests you ran, third-party material and AI-assisted content. Fill
+in every section, and write "None" where one does not apply.
+
+## Third-party code
+
+Say in the pull request where any copied or adapted code comes from and under which license. A file derived from
+another project keeps that project's copyright notices and names its source in a header, and the project goes into
+[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) with its license text in [`LICENSES/`](LICENSES/). Do not add or
+change a license header, an SPDX identifier or a license file without a maintainer's written approval.
+
+## How a pull request is merged
+
+The repository on GitHub is exported from the maintainers' repository. When a maintainer accepts your pull request,
+it is merged there and comes back to this repository with you as the author, and the pull request closes.
+
+## Security issues
+
+Do not open a public issue for a vulnerability. Follow [`SECURITY.md`](SECURITY.md).
diff --git a/EAGLE4_Paper.pdf b/EAGLE4_Paper.pdf
new file mode 100644
index 0000000..08f5e51
Binary files /dev/null and b/EAGLE4_Paper.pdf differ
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..45e0b6a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,424 @@
+ Eagle 4 Source-Available License
+
+SOURCE-AVAILABLE LICENSE. NOT AN OSI-APPROVED OPEN-SOURCE
+LICENSE.
+
+Copyright © 2026 Eagle AI Corp. All rights reserved except as expressly granted in this License.
+
+This Eagle 4 Source-Available License, the “License,” governs use of the Software and
+incorporates the Eagle Trademark Policy. By downloading, cloning, forking, copying,
+accessing, modifying, using, hosting, distributing, or otherwise exercising any right in the
+Software, Licensee accepts and agrees to this License and the incorporated Eagle
+Trademark Policy. If Licensee does not agree, Licensee may possess or inspect the public
+repository only to the extent permitted by law and may not exercise any licensed right.
+
+Acceptance and Repository Access.
+
+By downloading, cloning, forking, copying, accessing, modifying, using, hosting, distributing, or
+otherwise exercising any right in the Software, a user accepts and agrees to this License and the
+incorporated Eagle Trademark Policy. If the user acts for an entity, the user represents that the
+user has authority to bind that entity. A user who does not agree may possess or inspect the
+public repository only to the extent permitted by law but may not exercise any licensed right.
+
+The LICENSE file, repository README, repository notice, source-file notices, and NOTICE
+file provide conspicuous notice that this License and the incorporated Eagle Trademark Policy
+apply to the Software. No click-through, gated download, checkbox, or repository assent record
+is required for acceptance by conduct under this section.
+
+A copy obtained from a permitted downstream distribution is subject to this License as provided
+in Section 4. Any downstream recipient accepts and agrees to this License and the incorporated
+Eagle Trademark Policy by downloading, cloning, forking, copying, accessing, modifying, using,
+hosting, distributing, or otherwise exercising any licensed right. A recipient who does not agree
+may possess or inspect the copy only to the extent permitted by law and may not exercise any
+licensed right.
+
+1. Definitions.
+
+ a. “Affiliate” means an entity that directly or indirectly Controls, is Controlled by, or is
+ under common Control with a party. “Control” means ownership of more than 50 percent
+ of the voting interests of an entity or the power to direct its management and policies.
+
+ b. “Aggregate Revenue” means the total gross revenue of Licensee and all Affiliates from
+ all sources, determined on a consolidated basis over the applicable consecutive 12-month
+ period under consistently applied generally accepted accounting principles or International
+ Financial Reporting Standards, with intercompany revenue eliminated and without
+ duplication.
+
+ c. “Commercial Use” means using the Software, a Modification, or their functionality for
+ direct or indirect commercial advantage or revenue generation, including in or for any
+ paid product or service, customer-facing production use, software as a service,
+ application programming interface, hosting, consulting, integration, original-equipment-
+ manufacturer or embedded use, advertising-supported service, commercialization of a
+ fork or derivative work, or use that materially supports a revenue-generating product or
+ service.
+
+ Commercial Use does not include genuine internal evaluation, academic research,
+ nonprofit research, education, personal noncommercial use, or internal noncommercial
+ experimentation, in each case only where the use is not customer-facing, does not
+ generate revenue or commercial advantage, and does not materially support a revenue-
+ generating product or service.
+
+ d. “Competing Offering” means a product or service whose principal functionality
+ substantially substitutes for the principal functionality of Eagle 4, or that incorporates
+ material Eagle 4 technology into a model, inference, training, acceleration, or serving
+ framework that competes with Eagle 4. A separate commercial license is required for
+ every Competing Offering.
+
+ A Competing Offering does not include a product or service merely because it
+ interoperates with Eagle 4, calls or is called by Eagle 4 through documented interfaces,
+ complements Eagle 4, uses outputs generated by Eagle 4, or includes only incidental or
+ immaterial use of Eagle 4 that does not provide a material portion of the product’s or
+ service’s principal functionality.
+
+ e. “Eagle 4” means the Software and the technology embodied in it, including EAGLE-
+ Harness and EAGLE Efficient LM Head technology, but excluding independently
+ developed technology that merely interoperates with the Software.
+
+ f. “Eagle Files” means files or other materials that contain, reproduce, modify, implement,
+ port, or are derived from any portion of the Software. A file is governed by Apache
+ License, Version 2.0, “Apache-2.0,” only if its copyright owner expressly designates that
+ file as Apache-2.0.
+
+ g. “Licensor” means Eagle AI Corp.
+
+ h. “Licensee” means the individual or entity exercising rights under this License.
+
+ i. “Modification” means any change to the Software or derivative work based on the
+ Software. “Distribute” means to provide a copy of the Software or a Modification to a
+ third party, excluding remote access to functionality without transfer of a copy.
+
+ j. “Software” means the Eagle 4 materials made available with this License, including
+ applicable model architecture, model weights and parameters, source code, object code,
+ configuration files, inference and training code, documentation, and any portion or
+ Modification of them.
+
+2. License Grant.
+
+ a. Subject to this License, Licensor grants Licensee a worldwide, royalty-free,
+ nonexclusive, nontransferable except under Section 11, and nonsublicensable license,
+ except as expressly permitted below, under Licensor’s copyright and similar rights to
+ access, use, reproduce, run, evaluate, study, analyze, benchmark, teach with, modify,
+ create derivative works of, and Distribute the Software for research, evaluation,
+ education, personal use, internal noncommercial experimentation, academic research,
+ nonprofit research, and other noncommercial purposes and, subject to Sections 3 and 4,
+ Commercial Use.
+
+ b. Subject to Sections 3 and 4, Licensee may use, reproduce, modify, and Distribute the
+ Software and Modifications for the noncommercial purposes expressly permitted above
+ and for Commercial Use only to the extent permitted by Section 3, and may permit
+ contractors and service providers to do so solely on Licensee’s behalf if their activities
+ comply with this License, are not a Competing Offering, and Licensee remains
+ responsible for their compliance. Any Commercial Use not permitted by Section 3
+ requires a separate written commercial license with Eagle AI Corp before it begins.
+ Nothing in this License requires Eagle AI Corp to offer a commercial license or agree to
+ any particular fees or terms.
+
+ c. No right is granted by implication, estoppel, or otherwise. Rights not expressly granted
+ are reserved. A separate written commercial license may grant additional rights.
+ Commercial-license inquiries may be sent to [email protected].
+
+3. Commercial and Competitive Restrictions.
+
+ a. Licensee may not develop, offer, sell, license, host, provide, or otherwise commercialize
+ a Competing Offering under this License. Any such activity requires a separate written
+ commercial license from Licensor before the activity begins, regardless of Aggregate
+ Revenue.
+
+ b. Licensee may not evade the Competing Offering restriction by copying, forking,
+ renaming, rebranding, translating, wrapping, rewriting, porting, or making superficial
+ changes to Eagle 4, or by placing material Eagle 4 technology in another framework.
+ The substance and principal functionality of the offering control, not its name,
+ packaging, interface, or stated purpose.
+
+ c. Commercial Use that is not a Competing Offering is permitted under this License only
+ while Aggregate Revenue from all sources of the Licensee and all Affiliates has not
+ exceeded 20 million US dollars (or the equivalent in other currencies) in total over any
+ consecutive 12 months, and only to the extent otherwise permitted by this License. If
+ Aggregate Revenue exceeds that threshold, Licensee must enter into a separate agreement
+ with Eagle AI Corp before Licensee or any Affiliate uses the Software or any derivative
+ work of the Software, including a Modification, for any Commercial Use. This
+ requirement applies prospectively beginning on the date the threshold is first exceeded
+ and, once triggered, continues thereafter notwithstanding any later decrease in Aggregate
+ Revenue. It does not retroactively prohibit Commercial Use occurring before that date.
+
+ d. Upon exceeding the Aggregate Revenue threshold in this Section, Licensee must cease
+ any Commercial Use unless the required separate agreement is already in effect, and must
+ contact Eagle AI Corp at [email protected] before beginning or continuing that use. No
+ negotiation period, grace period, or temporary commercial-use permission applies after
+ the threshold is exceeded.
+ e. Licensor has no obligation to offer a commercial license or agree to any particular fees or
+ terms. Unless and until a separate written commercial license is executed when required
+ under this Section, Licensee may exercise only the rights otherwise permitted by this
+ License and may not begin or continue the Commercial Use or Competing Offering for
+ which the separate license is required.
+
+ f. Licensee must not divide activities or revenue among Affiliates, customers, contractors,
+ resellers, or other persons, or otherwise structure activities or transactions for the purpose
+ of avoiding this Section. Licensee and all Affiliates are treated as one licensee for
+ purposes of Aggregate Revenue and the Commercial Use, Competing Offering, and
+ compliance restrictions.
+
+4. Distribution, Source, and Attribution Conditions.
+
+ a. Every permitted distribution of the Software or a Modification must include this License
+ in a file named LICENSE, the NOTICE file, and all applicable source-file notices, and
+ must preserve all copyright, patent, license, NOTICE, attribution, and other proprietary
+ notices supplied with the Software. Each such distribution must include a conspicuous
+ statement that the Software is subject to this source-available License, which is not an
+ OSI-approved open-source license, and reasonable directions for locating the Eagle
+ Trademark Policy. Each distribution must also state conspicuously that downloading,
+ cloning, forking, copying, accessing, modifying, using, hosting, distributing, or
+ otherwise exercising any licensed right constitutes acceptance of this License and the
+ incorporated Eagle Trademark Policy. Licensee must reproduce required notices in the
+ corresponding files or in a customary third-party notices location.
+
+ b. Licensee must identify each materially modified file and include a prominent
+ modification notice stating that the file was modified, the date of the material
+ modification, and the modifying person or entity. A consolidated change log is permitted
+ if it clearly maps each material modification to the affected files.
+
+ c. If Licensee Distributes a Modification in source or executable form, Licensee must make
+ the complete corresponding source form of that Modification available to each recipient,
+ at no additional license fee, under this License. The source must include the modified
+ source code, configuration, scripts, adapters, patches, or weight deltas reasonably
+ necessary to use and reproduce the distributed Modification, but need not include
+ separable proprietary components that are not derived from or modifications of the
+ Software.
+
+ d. Every permitted use beyond private possession or inspection must provide clear
+ attribution to Eagle AI Corp and Eagle 4 in documentation, repository materials, or a
+ customary third-party notices location. Attribution requires preservation of all copyright
+ notices, the LICENSE file, the NOTICE file, applicable source-file notices, and required
+ modification notices. Every public repository, publication, demonstration, distributed
+ software release, or public description of a derivative work must include a reasonably
+ prominent statement substantially similar to: “This project includes or is derived from
+ Eagle 4 technology developed by Eagle AI Corp. It is not an official Eagle AI Corp
+ project unless expressly stated otherwise.” No user-interface badge, splash screen,
+ persistent display, or other badgeware is required for purely noncommercial use, but a
+ separate commercial agreement may establish negotiated attribution terms.
+
+ e. Licensee may not remove, conceal, obscure, materially alter, or materially reduce
+ required attribution; falsely claim original authorship of Eagle 4 or Licensor’s work;
+ misleadingly rename or rebrand the Software or a Modification; or state or imply that a
+ fork, Modification, project, product, service, or distribution is official or is an official
+ Eagle 4 release unless Licensor has authorized that statement in writing.
+
+ f. Forks and derivative works may be made and Distributed under the rights otherwise
+ granted by this License if they remain subject to this License and preserve the required
+ attribution. A Distributed fork or Modification must use a distinguishable primary
+ name, preserve the Eagle LICENSE and NOTICE files and applicable source-file and
+ modification notices, identify Eagle AI Corp and Eagle 4 as the origin, and avoid
+ suggesting official status, affiliation, certification, sponsorship, or endorsement. This
+ License does not prohibit a truthful new name that complies with Section 5; it
+ prohibits removal of attribution, false claims of original authorship, and confusing use
+ of Eagle marks.
+
+ g. Renaming, rebranding, translating, wrapping, porting, integrating, modifying, or
+ moving any Eagle File or Eagle 4 code into another file, directory, repository,
+ framework, package, or distribution does not remove or reduce this License’s
+ attribution, Commercial Use, source, trademark, notice, modification, or other
+ obligations. The substance and origin of the code control, not its name, location,
+ packaging, interface, or surrounding repository license.
+
+ h. Eagle AI Corp may separately designate a minimal administrative, registration, or
+ loader file as Apache-2.0 by an express file-level notice. Any such designation applies
+ only to the identified file and does not relicense any Eagle File. Recommended
+ compliance language appears in Exhibits A and E.
+
+5. Trademarks and Names.
+
+ a. Licensor reserves all rights in EAGLE, Eagle 4, EAGLE-Harness, EAGLE Efficient LM
+ Head, all associated logos, and all related names, marks, trade dress, and goodwill.
+ Except for the limited permission below, this License grants no trademark or branding
+ rights.
+
+ b. The Eagle Trademark Policy is incorporated by reference solely with respect to use of
+ Eagle names, marks, logos, and branding. Acceptance of this License includes agreement
+ to comply with that policy. The policy does not expand the copyright, patent, or other
+ Software restrictions in this License.
+
+ c. Licensee may make truthful, nonmisleading nominative references to Eagle 4 solely to
+ identify compatibility, origin, or the Software used, provided the reference is no more
+ prominent than reasonably necessary and complies with the Eagle Trademark Policy.
+
+ d. A Modification or fork that is Distributed or offered to third parties must use a
+ distinguishable primary name and must not use “Eagle,” “Eagle 4,” or a confusingly
+ similar term as its primary product, service, project, or company name without Licensor’s
+ prior written consent.
+
+ e. Licensee must not state or imply affiliation with, certification by, sponsorship by, or
+ endorsement from Licensor, or use any mark or logo in a manner likely to cause
+ confusion as to source, sponsorship, or official status. The form in Exhibit D may be used
+ to clarify non-affiliation.
+
+6. Limited Patent License and Retaliation.
+
+ a. Subject to this License, Licensor grants Licensee a worldwide, royalty-free,
+ nonexclusive, nontransferable except under Section 11 patent license, without the right to
+ sublicense except to contractors acting solely for Licensee, to make, have made, use,
+ offer to sell, sell, import, and otherwise transfer the Software solely to the extent
+ necessary for a use expressly permitted by this License and only under patent claims
+ Licensor can license that are necessarily infringed by the unmodified Software or by their
+ combination with Licensor-provided components.
+
+ b. If Licensee or an Affiliate initiates or maintains a patent claim alleging that the Software
+ or a compliant use of it infringes a patent, the patent license in this Section terminates
+ upon filing of that claim. This retaliation provision does not apply to a compulsory
+ counterclaim or defensive response that Licensee withdraws within 30 days after it may
+ lawfully do so.
+
+7. Ownership.
+
+ a. As between the parties, Licensor and its licensors own all right, title, and interest in and
+ to the Software, Eagle 4 technology, Licensor-provided materials, and all intellectual
+ property rights in them. No title transfers to Licensee.
+
+ b. As between the parties, Licensee owns its original contributions to a Modification,
+ subject to Licensor’s ownership of the Software and the conditions and licenses in this
+ License. No Modification limits Licensor’s right to develop, license, or use similar or
+ competing technology, provided Licensor does not use Licensee’s confidential
+ information.
+
+8. Records and Limited Audit.
+
+ a. For three years after each use or distribution of the Software or a Modification,
+ Licensee must keep reasonably complete records sufficient to verify Aggregate
+ Revenue and compliance with the Commercial Use and Competing Offering
+ restrictions and Section 4, including records reasonably necessary to investigate
+ whether the Aggregate Revenue threshold has been exceeded, unauthorized
+ Commercial Use, unauthorized relicensing, or failure to identify and preserve the
+ licensing and notices applicable to Eagle Files. Licensee need not disclose unrelated
+ product data, personal data, source code unrelated to the Software, or legally
+ privileged material.
+
+ b. If Licensor has a reasonable, documented basis to suspect Commercial Use or another
+ material violation of Sections 3 or 4, Licensor may, no more than once in any 12-month
+ period and on at least 30 days’ written notice, have an independent auditor bound by
+ written confidentiality obligations inspect the relevant records during normal business
+ hours solely to verify compliance with Sections 3, 4, and 8. The audit must minimize
+ disruption, and the auditor may report only compliance findings reasonably necessary for
+ enforcement. Licensor bears the cost unless the audit finds a material breach, in which
+ case Licensee must reimburse reasonable audit costs. The frequency and notice limits do
+ not apply where Licensor has a reasonable, documented basis to suspect fraud or
+ intentional circumvention.
+
+9. Term and Termination.
+
+ a. This License begins when Licensee accepts it by conduct as described in the
+ Acceptance and Repository Access section and continues until terminated. A material
+ breach automatically terminates this License if the breach is curable and Licensee fails
+ to cure it within 30 days after written notice describing the breach in reasonable detail.
+ A noncurable breach, fraud, willful circumvention of Section 3, unauthorized
+ Commercial Use, or a knowingly false claim of official status may be terminated
+ immediately by written notice.
+
+ b. Upon termination, Licensee must stop exercising rights under this License and stop
+ distributing the Software, and within 30 days delete or destroy copies under its control
+ except one archival copy kept solely for legal compliance. Termination does not affect
+ compliant licenses previously granted to recipients, but Licensee remains liable for pre-
+ termination breaches. The Acceptance and Repository Access section and Sections 1, 5, 7,
+ 8, 9, 10, 11, and 12 survive termination.
+
+10. Enforcement; Disclaimer; Limitation of Liability.
+
+a. Licensee acknowledges that unauthorized Commercial Use, competitive use,
+relicensing, disclosure, distribution, or misuse of Licensor’s intellectual property, or
+failure to preserve the licensing, attribution, source, trademark, modification, and notice
+obligations applicable to Eagle Files, may cause irreparable harm for which damages are
+inadequate. Licensor may seek injunctive or equitable relief, in addition to all other
+cumulative remedies, without posting bond to the extent permitted by law. Delay or
+failure to enforce is not a waiver. In an action to enforce this License, the prevailing
+party is entitled to reasonable attorneys’ fees and costs to the extent permitted by law.
+
+b. THE SOFTWARE, DOCUMENTATION, OUTPUTS, AND RESULTS ARE
+PROVIDED “AS IS” AND “AS AVAILABLE,” WITH ALL FAULTS. TO THE
+MAXIMUM EXTENT PERMITTED BY LAW, LICENSOR AND ITS AFFILIATES,
+LICENSORS, AND CONTRIBUTORS DISCLAIM ALL EXPRESS, IMPLIED,
+STATUTORY, AND OTHER WARRANTIES, INCLUDING MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT,
+ACCURACY, SECURITY, AND WARRANTIES ARISING FROM COURSE OF
+DEALING OR USAGE OF TRADE. LICENSEE IS SOLELY RESPONSIBLE FOR
+EVALUATING FITNESS, SAFETY, SECURITY, AND LEGAL COMPLIANCE. TO
+THE MAXIMUM EXTENT PERMITTED BY LAW, LICENSOR AND ITS
+AFFILIATES, LICENSORS, AND CONTRIBUTORS WILL NOT BE LIABLE FOR
+ANY INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR
+CONSEQUENTIAL DAMAGES, OR FOR LOST PROFITS, REVENUE, DATA,
+GOODWILL, OR BUSINESS INTERRUPTION, ARISING FROM OR RELATED TO
+THE SOFTWARE OR THIS LICENSE, EVEN IF ADVISED OF THE POSSIBILITY.
+THEIR AGGREGATE LIABILITY WILL NOT EXCEED THE GREATER OF US $100
+OR THE AMOUNT LICENSEE PAID LICENSOR FOR THE SOFTWARE DURING
+THE 12 MONTHS BEFORE THE EVENT GIVING RISE TO LIABILITY. THESE
+LIMITS APPLY REGARDLESS OF THEORY AND TO THE EXTENT PERMITTED
+BY LAW.
+
+11. General.
+
+a. Licensee must comply with applicable laws, including export-control, sanctions, privacy,
+and safety laws. Licensee may not assign this License without Licensor’s prior written
+consent, except with written notice in connection with a merger, reorganization, or sale of
+substantially all assets relating to the Software if the assignee agrees in writing to be
+bound and is not a Competing Offering provider; any other attempted assignment is void.
+Licensor may assign this License and its rights. If any provision is unenforceable, it will
+be modified to the minimum extent necessary and the remainder will remain effective.
+This License is governed by the laws of the state of New York, excluding conflict-of-laws
+rules, and the parties consent to exclusive jurisdiction and venue in the state and federal
+courts located in New York County, New York.
+
+b. This License is the entire agreement concerning its subject matter and may be amended
+or waived only in a writing signed by Licensor. Headings are for convenience, and
+“including” means “including without limitation.”
+
+c. Notices and Commercial Licensing. Legal notices to Licensor and commercial-license
+inquiries must be sent to [email protected]. A Licensee must contact Eagle AI Corp and
+enter into a separate written commercial agreement before beginning or continuing any
+Commercial Use for which Section 3 requires that agreement. Notices to Licensee may
+be sent to the contact information Licensee provides to Licensor or, if none, to a publicly
+listed legal contact. Email notice is effective when sent, absent a delivery-failure
+message.
+EXHIBIT A. SOURCE-FILE NOTICE
+
+Copyright © 2026 Eagle AI Corp. This file is part of Eagle 4 and remains licensed under the
+Eagle 4 Source-Available License, which incorporates the Eagle Trademark Policy and is not an
+OSI-approved open-source license. Commercial Use may require a separate written commercial
+license from Eagle AI Corp. By downloading, cloning, forking, copying, accessing, modifying,
+using, hosting, distributing, or otherwise exercising any licensed right in this file, you accept
+and agree to the Eagle 4 Source-Available License and Eagle Trademark Policy. The Eagle
+LICENSE and NOTICE files and all applicable source-file and modification notices must
+accompany this file.
+
+EXHIBIT B. NOTICE-FILE LANGUAGE
+
+This project includes or is derived from Eagle 4 technology developed by Eagle AI Corp. It is not
+an official Eagle AI Corp project unless expressly stated otherwise. Eagle 4 is provided under the
+Eagle 4 Source-Available License, which is not an OSI-approved open-source license and
+incorporates the Eagle Trademark Policy. The applicable LICENSE file, NOTICE file, source-
+file notices, and modification notices accompany this distribution. Downloading, cloning,
+forking, copying, accessing, modifying, using, hosting, distributing, or otherwise exercising any
+licensed right constitutes acceptance of that license and policy.
+
+EXHIBIT C. MODIFICATION NOTICE
+
+MODIFICATION NOTICE. This file or component has been materially modified from Eagle 4.
+The accompanying change log identifies the modifying person or entity, the date of each material
+modification, the affected files or components, and a summary of the material changes. This
+modified version is not an official Eagle 4 release and is provided subject to the Eagle 4 Source-
+Available License.
+
+EXHIBIT D. TRADEMARK AND NON-AFFILIATION STATEMENT
+
+EAGLE, Eagle 4, EAGLE-Harness, EAGLE Efficient LM Head, and associated logos are
+trademarks or other protected designations of Eagle AI Corp. This product is an independent
+modification or offering. It is not affiliated with, certified by, sponsored by, or endorsed by Eagle
+AI Corp. References to Eagle 4 are solely truthful nominative references identifying origin,
+compatibility, or technology used.
+
+EXHIBIT E. DIRECTORY-LEVEL LICENSE NOTICE
+
+DIRECTORY LICENSE NOTICE. Files in this directory that contain, reproduce, modify,
+implement, port, or derive from Eagle 4, including EAGLE-Harness, EAGLE Efficient LM
+Head, model materials, and other core Eagle 4 features, are Eagle Files governed by the Eagle 4
+Source-Available License and the incorporated Eagle Trademark Policy. A file is governed by
+Apache-2.0 only if its copyright owner expressly designates that file as Apache-2.0. See the Eagle
+LICENSE and NOTICE files for file-level identification. Preserve all applicable copyright,
+attribution, source-file, trademark, and modification notices. Commercial Use may require a
+separate written commercial license from Eagle AI Corp.
diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSES/Apache-2.0.txt
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSES/BSD-3-Clause-causal-conv1d.txt b/LICENSES/BSD-3-Clause-causal-conv1d.txt
new file mode 100644
index 0000000..5860e4b
--- /dev/null
+++ b/LICENSES/BSD-3-Clause-causal-conv1d.txt
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSES/MIT-flash-linear-attention.txt b/LICENSES/MIT-flash-linear-attention.txt
new file mode 100644
index 0000000..7ced501
--- /dev/null
+++ b/LICENSES/MIT-flash-linear-attention.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023-2026 Songlin Yang, Yu Zhang, Zhiyuan Li
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..4c9bae2
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,8 @@
+# The sdist is the source: the prebuilt native libraries go into the wheel only (tools/build_wheel.sh).
+include LICENSE NOTICE TRADEMARKS.md README.md THIRD_PARTY_NOTICES.md
+recursive-include LICENSES *.txt
+recursive-include eagle_harness/core *.csv
+recursive-include eagle_harness/kernels/csrc *.cu
+graft tests
+prune eagle_harness/kernels/_native
+global-exclude __pycache__ *.py[cod] *.so
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..da4af20
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,29 @@
+EAGLE-4
+Copyright © 2026 Eagle AI Corp.
+
+EAGLE-4 software in this repository is made available under the Eagle 4
+Source-Available License in the root LICENSE file. This license is not an
+OSI-approved open-source license and incorporates the Eagle Trademark Policy
+in TRADEMARKS.md.
+
+Downloading, cloning, forking, copying, accessing, modifying, using, hosting,
+distributing, or otherwise exercising any licensed right constitutes acceptance
+of the Eagle 4 Source-Available License and incorporated Eagle Trademark Policy.
+Mere viewing or inspection of the repository does not itself constitute
+trademark use.
+
+EAGLE, Eagle 4, EAGLE-Harness, and EAGLE Efficient LM Head are trademarks or
+claimed trademarks of Eagle AI Corp. All other names and marks are the property
+of their respective owners.
+
+Source-file notices are per file: each first-party source file carries a
+copyright line and SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available.
+Files derived from other projects carry their upstream copyright and provenance
+headers instead, and are listed in THIRD_PARTY_NOTICES.md with the full license
+texts in LICENSES/.
+
+Commercial licensing and trademark permissions: [email protected]
+
+This NOTICE is for the official EAGLE-4 repository. Derivative distributions
+must also comply with the attribution, modification, non-affiliation, and
+notice requirements in the license and trademark policy.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..34a5828
--- /dev/null
+++ b/README.md
@@ -0,0 +1,269 @@
+<div align="center">
+
+<img src="docs/assets/Eagle.svg" alt="Eagle" width="180">
+
+<h1>EAGLE-4</h1>
+
+<p>
+ <b>One Flexible Drafter for All Batch Sizes and Hardware</b>
+</p>
+
+<p>
+ <a href="EAGLE4_Paper.pdf"><b>Paper (EAGLE-4)</b></a> ·
+ <a href="https://huggingface.co/EAGLE-corp/EAGLE4-Qwen3.8-27B"><b>EAGLE-4 draft for Qwen3.8-27B</b></a> ·
+ <a href="docs/README.md"><b>Documentation</b></a>
+</p>
+
+<p align="center">
+ <a href="https://github.com/eagle-hq/EAGLE-4/releases/tag/v0.1.0"><img src="https://img.shields.io/badge/eagle--harness-v0.1.0-orange.svg" alt="eagle-harness 0.1.0"></a>
+ <a href="https://github.com/eagle-hq/EAGLE-4/issues" target="_blank"><img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" alt="Maintenance"></a>
+ <a href="https://github.com/eagle-hq/EAGLE-4/pulls" target="_blank"><img src="https://img.shields.io/badge/Contributions-welcome-brightgreen.svg" alt="Contributions welcome"></a>
+</p>
+
+<p align="center">
+ <a href="https://eagle.ai/"><img src="https://img.shields.io/badge/Website-eagle.ai-FCCC36?labelColor=171819&color=FCCC36" alt="Eagle website"></a>
+ <a href="https://www.linkedin.com/company/eagle/posts/?feedView=all"><img src="https://img.shields.io/badge/LinkedIn-Eagle-FCCC36?logo=linkedin&labelColor=171819&color=2B2D30&logoColor=FCCC36" alt="Eagle on LinkedIn"></a>
+ <a href="https://x.com/EagleCorp"><img src="https://img.shields.io/badge/X-@EagleCorp-FCCC36?logo=x&labelColor=171819&color=2B2D30&logoColor=FCCC36" alt="Eagle on X"></a>
+ <a href="https://github.com/eagle-hq"><img src="https://img.shields.io/badge/GitHub-eagle--hq-FCCC36?logo=github&labelColor=171819&color=2B2D30&logoColor=FCCC36" alt="GitHub organization"></a>
+ <a href="https://huggingface.co/EAGLE-Corp" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-EAGLE--Corp-FCCC36" alt="HuggingFace"></a>
+</p>
+
+<p align="center">
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Eagle--4-FCCC36" alt="License"></a>
+</p>
+
+</div>
+
+<br />
+
+<p align="center">
+ <img src="docs/assets/paper_results.png" alt="EAGLE-4 single-request speedup over vanilla decoding, from the paper" width="65%">
+</p>
+
+<p align="center">
+ <sub>
+ Figure 1(a) of the EAGLE-4 paper: Qwen3.8-27B on the SPEED-Bench qualitative split, 4× NVIDIA B300, one request, temperature 0.
+ The numbers this release measured with EAGLE-4 are in the <a href="docs/support-matrix.md">support matrix</a>.
+ </sub>
+</p>
+
+## EAGLE-4
+
+EAGLE-4 (Extrapolation Algorithm for Greater Language-model Efficiency) is the latest generation of the EAGLE family
+for accelerating large language model inference. One drafter adapts its speculative decoding strategy to the batch
+size, the hardware and the workload, and keeps the target model's output distribution.
+
+The EAGLE-4 draft uses a sliding-window draft layer, a low-rank candidate head and an append-only draft cache. Dense
+and latent-MoE draft structures are implemented. Qwen3.8-27B with its
+[EAGLE-4 draft](https://huggingface.co/EAGLE-corp/EAGLE4-Qwen3.8-27B) is the measured target pair.
+
+## Engines
+
+This repository is `eagle-harness`, a pip-installable package (`eagle_harness`) that serves EAGLE-4 drafts on
+SGLang, vLLM and TokenSpeed through engine plugins. EAGLE-4 sizes the speculative tree from measured draft and
+verification costs for the batch size, hardware and workload it is running on. It registers through hooks the engine
+exposes and does not patch the engine at runtime.
+
+The patched engines ship as pinned wheels and container images, not as source trees in this repository:
+
+| Engine | Hardware | Wheel index | Image | Source |
+| --- | --- | --- | --- | --- |
+| SGLang | NVIDIA B300, CUDA 13.0 | [cu130](https://eagle-hq.github.io/EAGLE-4/whl/cu130/) | `ghcr.io/eagle-hq/eagle-4-sglang:0.1.0` | [eagle-hq/sglang](https://github.com/eagle-hq/sglang) |
+| SGLang | AMD MI355X, ROCm 7.2 | [rocm](https://eagle-hq.github.io/EAGLE-4/whl/rocm/) | `ghcr.io/eagle-hq/eagle-4-sglang-rocm:0.1.0` | [eagle-hq/sglang](https://github.com/eagle-hq/sglang) |
+| vLLM | NVIDIA B300, CUDA 13.0 | [cu130](https://eagle-hq.github.io/EAGLE-4/whl/cu130/) | `ghcr.io/eagle-hq/eagle-4-vllm:0.1.0` | [eagle-hq/vllm](https://github.com/eagle-hq/vllm) |
+| TokenSpeed, experimental | NVIDIA CUDA only | [cu130](https://eagle-hq.github.io/EAGLE-4/whl/cu130/) | `ghcr.io/eagle-hq/eagle-4-tokenspeed:0.1.0` | [eagle-hq/tokenspeed](https://github.com/eagle-hq/tokenspeed) |
+
+Stock engine packages do not carry the hooks. [Release settings](docs/release.env) is the one place that holds
+every version pin, index URL and image tag. The wheels are also attached to the
+[v0.1.0 GitHub release](https://github.com/eagle-hq/EAGLE-4/releases/tag/v0.1.0).
+
+## Measured results
+
+The [support matrix](docs/support-matrix.md) reports every measurement with its conditions, separately for
+loading, greedy correctness, request features and throughput. Throughput is generated tokens per second of
+workload time, higher is better. The rows below are the shapes the quickstarts ship. Each one is the mean of
+two server starts on the SPEED-Bench client at temperature 0.
+
+| Engine | GPUs | Client concurrency | No-spec tokens/s | EAGLE-4 tokens/s | Speedup |
+| --- | --- | ---: | ---: | ---: | ---: |
+| SGLang | 4× B300, TP4 | 8 | 1479.4 | 2820.6 | 1.91× |
+| SGLang | 4× B300, TP4 | 64 | 3925.3 | 5281.3 | 1.35× |
+| SGLang | 1× MI355X, TP1 | 8 | 552.7 | 1145.9 | 2.07× |
+| SGLang | 1× MI355X, TP1 | 32 | 1269.2 | 1980.8 | 1.56× |
+| vLLM | 4× B300, TP4 | 1 | 241.6 | 722.8 | 2.99× |
+| vLLM | 4× B300, TP4 | 8 | 1699.9 | 2883.9 | 1.70× |
+
+Each speedup divides EAGLE-4 throughput by the same engine's matched no-speculation control.
+No TokenSpeed throughput is claimed. An unexplained greedy mismatch fails the correctness gate even when the
+speculative server is faster.
+
+## Install
+
+Install one patched engine per environment, then `eagle-harness==0.1.0`. The release publishes `eagle-harness` to PyPI
+and attaches the same wheel and sdist to the [v0.1.0 GitHub release](https://github.com/eagle-hq/EAGLE-4/releases/tag/v0.1.0).
+Use Python 3.12 for the CUDA engines and Python 3.10 for the ROCm wheel. The commands read their pins from the
+release settings file in this checkout:
+
+```bash
+git clone https://github.com/eagle-hq/EAGLE-4 && cd EAGLE-4
+. ./docs/release.env
+```
+
+SGLang on CUDA:
+
+```bash
+python3.12 -m venv .venv-sglang && source .venv-sglang/bin/activate
+python -m pip install --upgrade pip
+python -m pip install --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" "sglang==$EAGLE_SGLANG_VERSION" 'flashinfer-python>=0.7.2'
+python -m pip install "eagle-harness==$EAGLE_VERSION"
+eagle-harness-check
+```
+
+Or open the release image, which has the engine and EAGLE-4 installed:
+
+```bash
+docker run --rm --gpus all --ipc host -it \
+ -p 127.0.0.1:30000:30000 -v "$PWD/models:/models:ro" \
+ --entrypoint bash "$EAGLE_SGLANG_IMAGE"
+eagle-harness-check
+```
+
+`eagle-harness-check` exits zero when the installed engine provides every hook the plugin needs. It does not
+prove that kernels run or that generation is correct, so send the quickstart request before you measure anything.
+
+The [installation guide](docs/install.md) has the same steps for [vLLM](docs/install.md#vllm-cuda) and
+[TokenSpeed](docs/install.md#tokenspeed-cuda-experimental), which needs its scheduler and kernel wheels from the
+same index. The SGLang ROCm fresh-install path is
+[still under qualification](docs/install.md#sglang-rocm-on-amd), so the [AMD recipe](docs/quickstart-amd.md)
+applies to an already-qualified MI355X environment only.
+
+## Serve
+
+Serve Qwen3.8-27B BF16 with its EAGLE-4 draft on four B300 GPUs. SGLang prices the tree from costs it measures
+during served rounds, so this recipe needs no offline calibration. The full command with its environment is in
+the [SGLang quickstart](docs/quickstart-sglang.md):
+
+```bash
+python -m sglang.launch_server --model-path "$MODEL" --tp-size 4 --dtype bfloat16 \
+ --trust-remote-code --attention-backend flashinfer --page-size 1 \
+ --max-running-requests 32 --cuda-graph-max-bs-decode 32 \
+ --disable-overlap-schedule --disable-prefill-cuda-graph --cuda-graph-backend-decode full \
+ --mem-fraction-static 0.75 --context-length 196608 --max-total-tokens 196608 \
+ --chunked-prefill-size 16384 --mamba-ssm-dtype bfloat16 --disable-radix-cache \
+ --reasoning-parser qwen3 --random-seed 721 --skip-server-warmup \
+ --host 127.0.0.1 --port 30000 \
+ --speculative-algorithm EAGLE_HARNESS --speculative-draft-model-path "$DRAFT" \
+ --speculative-draft-model-quantization unquant --speculative-draft-attention-backend flashinfer \
+ --speculative-attention-mode prefill --speculative-num-steps 12 \
+ --speculative-eagle-topk 4 --speculative-num-draft-tokens 16 \
+ --speculative-algorithm-config '{"mode":"serve"}'
+```
+
+Then send a greedy request and check that the response carries generated text:
+
+```bash
+curl --fail http://127.0.0.1:30000/generate \
+ -H 'Content-Type: application/json' \
+ -d '{"text":"Explain how a hash table works.","sampling_params":{"temperature":0,"max_new_tokens":128}}'
+```
+
+The first request compiles kernels and seeds the cost tables, so repeat it before timing.
+
+The other engines have their own recipes. [vLLM](docs/quickstart-vllm.md) uses a static tree whose depth stops on
+calibrated costs, produced once with `eagle-harness calibrate --engine vllm --model "$MODEL" --draft "$DRAFT" --tp 4`
+while the GPUs are idle, plus the shipped rounds file. [SGLang on MI355X](docs/quickstart-amd.md) selects the
+packaged MI355X cost profile automatically. [TokenSpeed](docs/quickstart-tokenspeed.md) is experimental and
+CUDA-only, with a fixed-shape mode for checking generation without cost tables. The
+[calibration guide](docs/calibration.md) explains the measurement, and [new-model onboarding](docs/new-model.md)
+covers training and exporting a draft for another target.
+
+## What it supports
+
+- Drafts: EAGLE-4 drafts with the low-rank candidate head, tested with Qwen3.8-27B including its GDN layers.
+ Mamba2 targets and latent-MoE drafts have adapters on SGLang and vLLM. Per-model correctness coverage is in the
+ support matrix.
+- Engines: SGLang (V2 speculative worker), vLLM (Model Runner V2) and experimental TokenSpeed, each through the
+ eagle-harness hooks. On SGLang and vLLM a draft top-k of 1 gives a chain and a larger top-k gives a tree.
+ TokenSpeed implements static and calibrated trees, chains and sampled trees, without prompt logprobs or native
+ no-speculation rounds, and its coverage is limited to the configurations in the support matrix.
+- GPUs: NVIDIA sm_80 and newer, and AMD CDNA2 to CDNA4, through Triton kernels. The kernel tests run on B300
+ and the other architectures are compile-checked. MI355X is covered by the serving measurements in the support
+ matrix. See [kernels](docs/kernels.md).
+- Requests: text only. vLLM tree verification handles greedy and sampled requests and needs an unquantized KV
+ cache. Constrained output takes the correctness fallback in [compatibility](docs/compatibility.md).
+- Batch: SGLang and vLLM trees and chains admit up to 512 running requests within the engine's KV and
+ recurrent-state capacity. The SGLang tree default is 32, so set `--max-running-requests` for larger batches.
+ No pipeline parallelism. Admission is not a throughput or correctness guarantee. Check the
+ [support matrix](docs/support-matrix.md) and the [known limits](docs/known-limits.md).
+
+## Documentation
+
+[Architecture](docs/architecture.md) · [Configuration](docs/configuration.md) · [Calibration](docs/calibration.md) ·
+[Kernels](docs/kernels.md) · [Compatibility](docs/compatibility.md) · [Troubleshooting](docs/troubleshooting.md) ·
+[FAQ](docs/faq.md) · [Release notes](docs/release-notes/0.1.0.md) · [Contributing](CONTRIBUTING.md) ·
+[Security](SECURITY.md)
+
+## Citation
+
+If you use EAGLE-4, cite the EAGLE-4 paper. EAGLE-4 builds on EAGLE, EAGLE-2 and EAGLE-3, which
+[`CITATION.cff`](CITATION.cff) also lists.
+
+```bibtex
+@misc{eagle4,
+ author = {EAGLE-4 Team},
+ title = {{EAGLE-4}: One Flexible Drafter for All Batch Sizes and Hardware},
+ year = {2026},
+ note = {Preprint}
+}
+```
+
+## Acknowledgements
+
+- Thanks to Aditya Nandakumar (@proaditya) and the contributors to the original EAGLE-4 PR 1 for the ROCm port of EAGLE-4 on AMD Instinct MI355X.
+- Thanks to Andy Luo (@andyluo7) and the contributors to the original EAGLE-4 PR 2 for the AMD AITER and Triton kernels on GFX950.
+- Thanks to Andy Luo (@andyluo7), Aditya Nandakumar (@proaditya) and the contributors to the merged AMD series in the original EAGLE-4 PR 4 for AITER/FA3 and Split-KV on GFX950.
+- Thanks to Nicolas Perrin (@nperrin-fr) and the TokenSpeed/LightSeek contributors for the TokenSpeed implementation in the original EAGLE-4 PR 3, including the MLP L2 warm-ahead and TGV SwiGLU work used in the TokenSpeed fork.
+- SPEED-Bench is by NVIDIA. Model weights are licensed by their owners.
+
+## License and trademark policy
+
+Eagle 4 is **source-available software, not OSI-approved open-source software**.
+The terms of the [Eagle 4 Source-Available License](LICENSE) govern its use,
+modification, and distribution, and incorporate the [Eagle Trademark Policy](TRADEMARKS.md).
+See also the [NOTICE](NOTICE) file.
+
+Commercial Use of a Competing Offering requires a separate written commercial
+license regardless of revenue. Other Commercial Use is permitted only within
+the conditions of the license, including the US $20 million Aggregate Revenue
+threshold measured over any consecutive 12-month period. If the threshold is
+exceeded, a separate commercial agreement is required before beginning or
+continuing any Commercial Use. The license specifies that the requirement
+continues after a subsequent revenue decrease.
+
+Downloading, cloning, forking, copying, accessing, modifying, using, hosting,
+distributing, or otherwise exercising any licensed right constitutes acceptance
+of the Source-Available License and incorporated Eagle Trademark Policy.
+Mere viewing or inspection does not itself constitute trademark use.
+
+For separate commercial terms, see the
+[Commercial License Agreement](COMMERCIAL-LICENSE-AGREEMENT.md) and contact
+[[email protected]](mailto:[email protected]). Publishing that agreement does
+**not** grant commercial-license rights; it becomes binding only as stated in
+its Section 1. Files derived from
+sglang, vLLM, FlashInfer and other projects keep those projects' notices, listed in
+[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).
+
+## Contributing
+
+By submitting, uploading, pushing, committing, proposing, or otherwise providing
+a pull request, patch, issue attachment, model, weight, dataset, documentation,
+or other contribution to this repository, you agree to the [Eagle Contribution
+License and Submission Terms](docs/legal/Eagle-Contribution-Terms-v1.0.pdf)
+(PDF). If you do not agree, do not submit a contribution. If you act for an
+employer, client, partner or other entity, you represent that you have authority
+to submit the contribution and have obtained all required permissions.
+Submitting a contribution does not change the license of existing Eagle code;
+Eagle AI Corp controls outbound licensing for accepted contributions. See
+[`CONTRIBUTING.md`](CONTRIBUTING.md) for the licensing structure and for how to
+build, test and open a pull request.
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..47fa033
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,19 @@
+# Security policy
+
+Report a vulnerability privately, never in a public issue, discussion or pull request. Use either:
+
+- GitHub's private vulnerability reporting: the "Report a vulnerability" button on this repository's Security tab, or
+- email to [email protected].
+
+Include the affected version or commit, the steps to reproduce, the impact you expect, any proof-of-concept, and
+whether you disclosed the issue anywhere else. Do not test beyond what you need to confirm the issue, and do not
+access or keep data that belongs to others.
+
+Disclose publicly only after the maintainers have had a reasonable chance to investigate and fix the issue.
+
+## Scope
+
+eagle-harness runs inside a serving engine (sglang or vLLM), in the engine's processes. Report a vulnerability of
+the engine itself to that project. Report one in eagle-harness here, including one that the plugin makes reachable
+in the engine. The native CUDA library loads from `$EAGLE_HARNESS_NATIVE_LIB` when that variable is set, so treat it
+like `LD_PRELOAD`: anyone who can set it can run code in the server.
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
new file mode 100644
index 0000000..27b952b
--- /dev/null
+++ b/THIRD_PARTY_NOTICES.md
@@ -0,0 +1,87 @@
+# Third-party notices
+
+eagle-harness contains a few files derived from open-source projects. Each such file names its source and the changes
+in a header at its top. This file lists them, reproduces the notices those projects ask derived works to keep, and
+points to the full license texts in [`LICENSES/`](LICENSES/).
+
+## Derived files
+
+| eagle-harness file | derived from | project | license |
+|---|---|---|---|
+| `eagle_harness/kernels/gdn_tree.py`, `eagle_harness/kernels/gdn_tree_conv.py` | `python/sglang/kernels/ops/mamba/causal_conv1d_triton.py` (tree links and tables, tree conv1d, conv window and state layout) | sglang, which adapted it from vLLM and causal-conv1d | Apache-2.0 (sglang, vLLM), BSD-3-Clause (causal-conv1d) |
+| `eagle_harness/kernels/gdn_tree_recurrence.py` | `python/sglang/kernels/ops/attention/fla/fused_sigmoid_gating_recurrent.py` (gated delta rule recurrence) | sglang, whose `fla` kernels are adapted from flash-linear-attention | Apache-2.0 (sglang), MIT (flash-linear-attention) |
+| `eagle_harness/kernels/gdn_tree_gluon.py` | the recurrence of `gdn_tree_recurrence.py` above, rewritten in Gluon | as above | as above |
+| `eagle_harness/kernels/mamba2_tree.py` | `vllm/model_executor/layers/mamba/ops/mamba_ssm.py` (per-token selective state update) and `python/sglang/kernels/ops/mamba/triton_ops/mamba_ssm.py` (parent-state reload of the tree-mode update) | vLLM and sglang, which adapted it from mamba (state-spaces/mamba) | Apache-2.0 (vLLM, sglang, mamba) |
+| `eagle_harness/sglang/models/llama_eagle4.py` | `python/sglang/srt/models/llama_eagle3.py` (decoder layer with the concatenated embedding and hidden-state input) | sglang, which adapted it from SafeAILab EAGLE `eagle/model/cnets.py` | Apache-2.0 (sglang, EAGLE) |
+| `eagle_harness/sglang/tail_mask.py` | `include/flashinfer/attention/variants.cuh` (`DefaultAttention`, as the attention variant's template) | FlashInfer | Apache-2.0 |
+
+The engine adapters (`eagle_harness/sglang/`, `eagle_harness/vllm/`) also import, subclass and call sglang, vLLM and
+FlashInfer classes at run time. That code is not copied into eagle-harness: it comes from the engine you install,
+under that engine's license.
+
+## Notices
+
+### sglang
+
+Copyright 2023-2024 SGLang Team. Licensed under the Apache License, Version 2.0
+([`LICENSES/Apache-2.0.txt`](LICENSES/Apache-2.0.txt)). Source: <https://github.com/sgl-project/sglang>.
+
+### vLLM
+
+Copyright contributors to the vLLM project. Licensed under the Apache License, Version 2.0
+([`LICENSES/Apache-2.0.txt`](LICENSES/Apache-2.0.txt)). Source: <https://github.com/vllm-project/vllm>.
+
+### causal-conv1d
+
+Copyright (c) 2024, Tri Dao. Licensed under the BSD 3-Clause License
+([`LICENSES/BSD-3-Clause-causal-conv1d.txt`](LICENSES/BSD-3-Clause-causal-conv1d.txt)).
+Source: <https://github.com/Dao-AILab/causal-conv1d>.
+
+### mamba
+
+Copyright (c) 2023, Tri Dao, Albert Gu. Licensed under the Apache License, Version 2.0
+([`LICENSES/Apache-2.0.txt`](LICENSES/Apache-2.0.txt)). Source: <https://github.com/state-spaces/mamba>.
+
+### flash-linear-attention
+
+Licensed under the MIT License, whose copyright line and permission notice are in
+[`LICENSES/MIT-flash-linear-attention.txt`](LICENSES/MIT-flash-linear-attention.txt).
+Source: <https://github.com/fla-org/flash-linear-attention>.
+
+### FlashInfer
+
+The NOTICE file of FlashInfer begins:
+
+```text
+FlashInfer
+Copyright 2025-2026 NVIDIA
+Copyright 2023-2026 FlashInfer community (https://flashinfer.ai/)
+```
+
+Licensed under the Apache License, Version 2.0 ([`LICENSES/Apache-2.0.txt`](LICENSES/Apache-2.0.txt)).
+Source: <https://github.com/flashinfer-ai/flashinfer>.
+
+### EAGLE (SafeAILab)
+
+Copyright 2025 SafeAI Lab (SAIL). Licensed under the Apache License, Version 2.0
+([`LICENSES/Apache-2.0.txt`](LICENSES/Apache-2.0.txt)). Source: <https://github.com/SafeAILab/EAGLE>.
+
+## Prebuilt native library
+
+The binary wheel ships `eagle_harness/kernels/_native/cu<major>/`, built from `eagle_harness/kernels/csrc/candidate.cu`
+with the CUDA runtime linked statically (`-cudart static`, in `eagle_harness/kernels/build.py`). The CUDA runtime is
+NVIDIA software under the NVIDIA CUDA Toolkit End User License Agreement (<https://docs.nvidia.com/cuda/eula/>).
+
+That agreement asks for no notice or attribution text in return, so none appears above. Attachment A lists
+`libcudart_static.a` among the redistributable portions of the SDK, and the one notice the agreement prescribes
+(section 1.1.2) covers modifications and derivative works of its sample source code, which this project does not
+ship. The conditions that do apply are met: the library adds material functionality of its own beyond the runtime,
+nothing but eagle-harness reaches the runtime it links, the runtime is redistributed unmodified, and no NVIDIA
+copyright or proprietary notice has been removed.
+
+Section 1.2 also forbids using the SDK so as to make it subject to a license that requires it to be disclosed in
+source form, licensed for the purpose of making derivative works, or redistributable at no charge. The Eagle 4
+Source-Available License is not such a license: it is not an open-source license, and its source condition (section
+4c) excludes "separable proprietary components that are not derived from or modifications of the Software". No source
+distribution carries the runtime in any case, because `MANIFEST.in` prunes `eagle_harness/kernels/_native` from the
+sdist and a source install compiles `candidate.cu` against the CUDA toolkit already on the machine.
diff --git a/TRADEMARKS.md b/TRADEMARKS.md
new file mode 100644
index 0000000..a85571a
--- /dev/null
+++ b/TRADEMARKS.md
@@ -0,0 +1,1163 @@
+# Eagle Trademark Policy
+
+Trademark Owner: Eagle AI Corp. Effective Date: October 8, 2026
+
+Commercial and Permissions Contact: [email protected]
+
+## 1. Purpose
+
+Eagle AI Corp supports source-available development, collaboration, modification, redistribution, and interoperability for software released by the Eagle project through its public GitHub repository, subject to the applicable source-available license and any required written commercial license.
+
+The applicable source-available software license and any separate written commercial agreement govern rights in the software, including software use and Commercial Use restrictions. Trademark law separately protects names, logos, and other designations that identify the source of products, services, and projects. This Policy governs use of the Eagle Marks, project identity, branding, attribution, and representations of origin or affiliation, and explains how members of the community, software distributors, service providers, commercial organizations, and other parties may refer to and use the Eagle Marks. This Policy is intended to:
+
+- Allow truthful references to Eagle projects and technology;
+
+- Encourage community discussion, education, collaboration, and interoperability;
+
+- Protect users from confusion about the source, status, quality, sponsorship, or approval of software and services;
+
+- Distinguish official Eagle projects from modified distributions, forks, and independently developed implementations;
+
+- Protect the goodwill associated with the Eagle Marks; and
+
+- Preserve all rights to use the Eagle Marks that applicable law provides, including truthful nominative use.
+
+This Policy does not independently grant or restrict rights to use, copy, modify, distribute, combine, host, or commercially exploit the software. Those rights and restrictions are governed by the applicable source-available license and any separate written commercial agreement. As a summary of the software-license requirement, if the aggregate revenue of a licensee and its Affiliates exceeds US $20 million, or the equivalent, during any consecutive 12-month period, the source-available license requires the licensee to enter into a separate written agreement with Eagle AI Corp before Commercial Use of Eagle 4 or derivative works. This Policy does not itself impose that revenue condition, and trademark law and this Policy do not, by themselves, prohibit commercial software use.
+
+## 2. Scope
+
+This Policy applies to trademarks, service marks, logos, trade names, project names, product names, feature names, stylizations, visual identities, and other source-identifying designations owned or claimed by Eagle AI Corp, including:
+
+- EAGLE
+
+- Eagle
+
+- Eagle 4
+
+- EAGLE-Harness
+
+- EAGLE Efficient LM Head
+
+- Eagle logos and icons;
+
+- Stylized forms of the foregoing names;
+
+- Names of official Eagle distributions, modules, features, tools, services, and documentation;
+
+- Names that are confusingly similar to any of the foregoing; and
+
+- Other designations that Eagle AI Corp adopts to identify its projects, software, products, services, or community initiatives.
+
+These are collectively referred to as the “Eagle Marks.”
+
+This Policy governs the Eagle Marks, including EAGLE, Eagle 4, EAGLE-Harness, EAGLE Efficient LM Head, and Eagle logos, as well as project identity, branding, attribution, and representations of origin or affiliation.
+
+This Policy applies to use of the Eagle Marks in connection with, among other things:
+
+- Software and source-code repositories;
+
+- Modified distributions and forks;
+
+- Modules, packages, plug-ins, extensions, and libraries;
+
+- Hosted services and APIs;
+
+- Websites, domain names, and subdomains;
+
+- Social-media accounts and handles;
+
+- Package registries and application stores;
+
+- Documentation, publications, and training materials;
+
+- Advertising and promotional materials;
+
+- Conferences, events, meetups, and community groups;
+
+- Merchandise; and
+
+- Certification, compatibility, interoperability, or endorsement claims.
+
+## 3. Ownership and Reservation of Rights
+
+Eagle AI Corp owns or claims rights in the Eagle Marks and the goodwill associated with them.
+
+Except for uses expressly permitted by this Policy, authorized in writing by Eagle AI Corp, or available under applicable law, no trademark license or other right to use an Eagle Mark is granted.
+
+All goodwill arising from an authorized use of an Eagle Mark will benefit Eagle AI Corp. A permitted user does not acquire ownership of, or independent rights in, an Eagle Mark through that use.
+
+Nothing in this Policy:
+
+- Transfers ownership of an Eagle Mark;
+
+- Grants a right to register an Eagle Mark or a confusingly similar designation;
+
+- Authorizes use that falsely suggests affiliation, sponsorship, endorsement, certification, or approval;
+
+- Prevents truthful nominative use;
+
+- Limits fair use or other rights provided by applicable law; or
+
+- Expands or restricts the copyright, patent, or other rights granted under a software license.
+
+## 4. Relationship to Software Licenses
+
+### 4.1. Separate rights
+
+Software licenses and trademark rights are separate.
+
+The applicable source-available license and any separate written commercial agreement determine whether and how a person may use, copy, modify, distribute, combine, host, or commercially exploit the software. Those permissions do not, by themselves, authorize the person to use an Eagle Mark as the name or branding of a modified product, service, project, or distribution.
+
+Conversely, compliance with this Policy does not excuse compliance with the applicable software license.
+
+### 4.2. Software rights and restrictions
+
+This Policy does not independently authorize or prohibit activities governed by the applicable source-available license or a separate written commercial agreement. Subject to those agreements, the software terms determine whether and how a person may engage in the following activities:
+
+- Modifying Eagle-licensed code;
+
+- Distributing original or modified code;
+
+- Combining Eagle-licensed code with other software;
+
+- Using Eagle-licensed code in a commercial product or service where the aggregate revenue of the licensee and its Affiliates exceeds US $20 million, or the equivalent, during any consecutive 12-month period, which, as a summary of the software-license requirement, requires a separate written agreement with Eagle AI Corp before Commercial Use of Eagle 4 or derivative works;
+
+- Creating a fork or derivative work;
+
+- Providing hosted or managed services using Eagle-licensed code; or
+
+- Competing with Eagle AI Corp.
+
+A person authorized to exercise software rights must nevertheless comply with this Policy when using the Eagle Marks and must avoid branding, attribution, or representations of origin or affiliation that are confusing, misleading, or otherwise unauthorized.
+
+### 4.3. License and attribution notices
+
+A recipient must preserve all copyright, patent, license, attribution, disclaimer, trademark ownership, and other notices that the applicable source-available license requires to be preserved. This Policy does not authorize removal, concealment, or alteration of any such notice.
+
+Preserving a legally required reference to Eagle 4 does not authorize the recipient to use an Eagle Mark as the recipient’s own brand.
+
+### 4.4. Public GitHub notice and acceptance by exercise of rights
+
+The public GitHub repository, its LICENSE file, README, NOTICE file, and applicable source-file notices provide notice of the source-available license and this Policy. No “I Agree,” “Accept,” click-through control, gated access, or assent-record system is required. This Policy governs use of the Eagle Marks, branding and project identity, attribution, and representations concerning origin, sponsorship, affiliation, certification, or endorsement.
+
+Downloading, cloning, forking, copying, modifying, using, hosting, distributing, or otherwise exercising licensed rights in the software constitutes acceptance of the applicable source-available license and agreement to comply with this Policy concerning use of the Eagle Marks. Mere viewing or inspection of the repository or software does not itself constitute use of an Eagle Mark or acceptance based on exercising licensed rights.
+
+The public GitHub repository should present a conspicuous notice that the software is offered under the applicable source-available license and that use of EAGLE, Eagle 4, EAGLE-Harness, EAGLE Efficient LM Head, Eagle logos, and other Eagle Marks is governed by applicable trademark law and this Policy. The notice does not replace or modify the software license or any separate written commercial agreement.
+
+Every distribution must preserve all attribution and trademark ownership statements required by the applicable source-available license. Separately, this Policy prohibits removing, concealing, or altering Eagle attribution or a trademark ownership statement in a manner that is likely to cause confusion, falsely claim original authorship, or falsely present Eagle technology as the distributor’s original branded technology.
+
+Nothing in this section limits truthful nominative use or truthful statements of compatibility or interoperability. This section also does not prevent a fork permitted under the applicable software license or law from competing with Eagle AI Corp under distinguishable branding that does not create confusion about origin, official status, sponsorship, affiliation, certification, or endorsement.
+
+Recommended GitHub repository notice:
+
+This repository contains Eagle software made available under the source-available license in the LICENSE file. The README, NOTICE file, source-file notices, and Eagle Trademark Policy provide additional notices. By downloading, cloning, forking, copying, modifying, using, hosting, distributing, or otherwise exercising licensed rights, you accept the source-available license and agree to comply with the Eagle Trademark Policy concerning use of the Eagle Marks. Mere viewing or inspection does not itself constitute trademark use.
+
+## 5. Uses That Generally Do Not Require Permission
+
+Subject to the conditions in this Policy, prior written permission is generally not required for the uses described in this section.
+
+### 5.1. Truthful nominative references
+
+You may use an Eagle Mark to identify the genuine Eagle project, software, component, feature, or service to which the mark refers.
+
+Permitted references include:
+
+- Discussing Eagle 4 in an article, presentation, review, or technical analysis;
+
+- Identifying Eagle 4 as a software dependency;
+
+- Providing instructions for installing, configuring, or using Eagle 4;
+
+- Reporting accurately on the Eagle project;
+
+- Comparing Eagle 4 with another product or framework;
+
+- Describing a project’s origin or relationship to Eagle 4;
+
+- Stating truthfully that software interoperates or is compatible with Eagle 4;
+
+- Identifying an unmodified Eagle component included in a larger product; and
+
+- Providing support, consulting, integration, or training services for Eagle 4.
+
+A nominative use should:
+
+1. Use only as much of the Eagle Mark as reasonably necessary to identify the relevant Eagle software or technology;
+
+2. Be factually accurate;
+
+3. Not use the Eagle Mark as the user’s own primary brand;
+
+4. Not suggest official status, sponsorship, endorsement, certification, or approval; and
+
+5. Include a non-affiliation statement when the surrounding circumstances could otherwise cause confusion.
+
+### 5.2. Accurate statements of origin or derivation
+
+You may accurately identify software as originating from, based on, or derived from Eagle 4. Recommended wording:
+
+Based on Eagle 4.
+
+When additional clarification is appropriate:
+
+This project is based on Eagle 4 and contains modifications that have not been reviewed or approved by Eagle AI Corp.
+
+A statement of origin must not be presented more prominently than the modified project’s own distinguishable primary name.
+
+### 5.3. Accurate interoperability and compatibility statements
+
+You may state truthfully that software interoperates with or is compatible with Eagle 4, provided the statement:
+
+- Is supported by reasonable technical testing;
+
+- Identifies any material limitations;
+
+- Does not suggest certification unless Eagle AI Corp has issued written certification;
+
+- Does not use an Eagle logo without permission; and
+
+- Does not present an Eagle Mark as the name of your product.
+
+Recommended wording:
+
+Compatible with Eagle 4.
+
+Where appropriate, include:
+
+Compatibility has not been certified or endorsed by Eagle AI Corp.
+
+Do not use claims such as “Eagle certified,” “officially compatible,” or “approved for Eagle” without written authorization.
+
+**Identification of an unmodified component**
+
+You may identify a genuine, unmodified Eagle component included in a larger product. Recommended wording:
+
+Includes an unmodified EAGLE-Harness component from the Eagle 4 project.
+
+The statement must not imply that Eagle AI Corp developed, approved, certified, or supports the larger product.
+
+### 5.4. Community and noncommercial uses
+
+You may use the word marks, but not ordinarily the Eagle logos, for good-faith community and noncommercial activities such as:
+
+- User groups;
+
+- Educational discussions;
+
+- Community forums;
+
+- Unofficial tutorials;
+
+- Noncommercial workshops;
+
+- Academic presentations;
+
+- Fan pages; and
+
+- Community-organized meetups.
+
+The name and presentation of the activity must make its unofficial status clear. Acceptable examples include:
+
+- “New York Eagle 4 Users Group — Unofficial”
+
+- “Community Workshop for Eagle 4 Developers”
+
+- “Independent Eagle 4 Discussion Forum”
+
+Unacceptable examples include:
+
+- “Official Eagle 4 New York”
+
+- “Eagle AI Developer Conference”
+
+- “Eagle 4 Certification Institute”
+
+The noncommercial nature of an activity does not excuse misleading claims of official status or affiliation.
+
+### 5.5. Commentary, criticism, and comparative advertising
+
+You may use an Eagle Mark in truthful commentary, criticism, reviews, news reporting, or comparative advertising, subject to applicable law.
+
+Comparisons must not:
+
+- Contain false or misleading statements;
+
+- Misrepresent the nature or qualities of an Eagle product or service;
+
+- Suggest that Eagle AI Corp approved the comparison;
+
+- Alter an Eagle logo or visual identity to disparage or confuse; or
+
+- Use an Eagle Mark more prominently than reasonably necessary to identify the subject of the comparison.
+
+### 5.6. Screenshots and documentation
+
+You may reproduce unaltered screenshots of official Eagle software, interfaces, repositories, or documentation for:
+
+- Instruction;
+
+- Commentary;
+
+- Review;
+
+- News reporting;
+
+- Academic discussion;
+
+- Troubleshooting; or
+
+- Accurate product documentation.
+
+Screenshots must not be used in a way that:
+
+- Misrepresents the displayed software;
+
+- Conceals modifications that materially affect the subject being discussed;
+
+- Suggests that another product is an official Eagle product;
+
+- Uses an Eagle interface as the primary visual identity of another product; or
+
+- Implies sponsorship, certification, or endorsement.
+
+Visible copyright, trademark, attribution, and legal notices should not be removed from a screenshot unless removal is reasonably necessary for privacy, security, or accurate editorial presentation.
+
+## 6. General Conditions for Permitted Uses
+
+Any use of an Eagle Mark under this Policy must comply with the following conditions:
+
+- The use must be truthful and not misleading.
+
+- The Eagle Mark must refer to the genuine Eagle project, product, service, component, or technology.
+
+- The use must not suggest unauthorized affiliation, sponsorship, endorsement, approval, certification, or official status.
+
+- The Eagle Mark must not be used as the user’s own company, organization, project, product, or service name.
+
+- The user’s own name and branding must be the primary and most prominent branding.
+
+- The Eagle Mark must not be incorporated into another trademark or logo.
+
+- The Eagle Mark must not be altered, abbreviated, translated, pluralized, or combined with other terms in a manner that creates a new source-identifying designation.
+
+- The LICENSE file, NOTICE file, applicable source-file notices, required modification notices, and any copyright, patent, license, attribution, or trademark ownership statements required by the applicable source-available license must be preserved and must not be removed or concealed.
+
+- A non-affiliation statement must be included when necessary to prevent confusion.
+
+- Use must comply with applicable law.
+
+## 7. Modified Distributions and Forks
+
+### 7.1. Forks are permitted under the applicable software license
+
+This Policy does not prohibit forks, modified distributions, derivative works, or competing implementations when permitted by the applicable software license or law.
+
+A modified distribution may accurately state that it is based on or derived from Eagle 4. It may not present itself as Eagle 4 or as an official Eagle distribution.
+
+### 7.2. Distinguishable primary name
+
+A public fork, modified distribution, or derivative project must use a distinguishable primary name that is reasonably distinguishable from the Eagle Marks.
+
+The new name must appear:
+
+- As the principal name in the repository;
+
+- In package metadata;
+
+- In application or service interfaces;
+
+- In documentation and promotional materials;
+
+- In package registries and application stores; and
+
+- In domain names and social-media accounts.
+
+The Eagle reference should be secondary and explanatory. Example:
+
+- Permitted: “FalconLM — based on Eagle 4”
+
+- Not permitted: “Eagle 4 Falcon Edition”
+
+- Not permitted: “Eagle Pro”
+
+- Not permitted: “Official Eagle Community Edition”
+
+- Not permitted: A modified distribution whose dominant branding is “Eagle”
+
+### 7.3. No official-project claims
+
+Unless Eagle AI Corp provides prior written authorization, a modified distribution or fork may not:
+
+- Be called Eagle, EAGLE, Eagle 4, EAGLE-Harness, EAGLE Efficient LM Head, or a confusingly similar name;
+
+- Be described as an official Eagle release;
+
+- Use terms such as “official,” “authorized,” “certified,” “approved,” or “endorsed” in connection with an Eagle Mark;
+
+- Use an Eagle logo or an imitation of an Eagle logo;
+
+- Represent that Eagle AI Corp maintains or supports the distribution;
+
+- Represent that the distribution is part of the official Eagle project;
+
+- Use version numbering, release labels, or presentation that could cause users to mistake it for an official Eagle release;
+
+- Use EAGLE, Eagle 4, EAGLE-Harness, EAGLE Efficient LM Head, or a confusingly similar mark as the primary name of an unauthorized fork, derivative project, competing offering, or company; or
+
+- Falsely claim original authorship of Eagle software or remove or conceal required Eagle attribution.
+
+### 7.4. Modification disclosures
+
+Where a modified distribution refers to Eagle 4, its documentation should clearly identify:
+
+- That the distribution has been modified;
+
+- The person or organization responsible for the modified distribution;
+
+- That the modifications have not been reviewed or approved by Eagle AI Corp, unless that statement is true; and
+
+- Where users can obtain information about the modifications.
+
+As a summary of the applicable source-available license, each materially modified file must carry a prominent modification notice identifying that the file was modified, the date of the material modification, and the modifying person or entity, although a consolidated change log may be used if it clearly maps each material modification to the affected files. This section does not impose a source-code disclosure or modification-notice obligation beyond the obligations in the applicable software license.
+
+### 7.5. Required non-affiliation statement
+
+Every public fork, modified distribution, or derivative project must include a reasonably prominent statement identifying its Eagle origin and stating that it is not affiliated with, sponsored by, endorsed by, or an official project of Eagle AI Corp.
+
+Model wording:
+
+This project is based on Eagle 4 but is not affiliated with, sponsored by, endorsed by, or an official project of Eagle AI Corp.
+
+The statement may be adapted for accuracy but must not be weakened or contradicted elsewhere.
+
+## 8. EAGLE-Harness
+
+### 8.1. Unmodified official component
+
+You may use EAGLE-Harness to identify a genuine, unmodified component originating from the official Eagle project.
+
+For example:
+
+Includes an unmodified EAGLE-Harness component from the Eagle 4 project.
+
+The name may appear in:
+
+- Dependency disclosures;
+
+- Technical documentation;
+
+- Attribution notices;
+
+- Architecture diagrams;
+
+- Compatibility descriptions; and
+
+- Customary third-party software notices.
+
+It should not appear as the primary name of the larger product or service.
+
+### 8.2. Modified components
+
+A materially modified version of EAGLE-Harness must use a distinguishable primary name. A modified component may be described as:
+
+- “Based on the EAGLE-Harness component”;
+
+- “Derived from EAGLE-Harness”; or
+
+- “Compatible with EAGLE-Harness,”
+
+provided the statement is accurate and does not suggest that the modified component is the official EAGLE-Harness component.
+
+A materially modified component may not be named:
+
+- EAGLE-Harness;
+
+- Eagle Harness;
+
+- EAGLE-Harness Pro;
+
+- EAGLE-Harness Community Edition;
+
+- EAGLE-Harness Plus; or
+
+- Another name likely to suggest an official version, extension, or edition.
+
+### 8.3. Independently developed implementations
+
+An independently developed implementation may state truthfully that it is interoperable or compatible with EAGLE-Harness.
+
+It may not use EAGLE-Harness as its own product, module, service, or project name. Recommended wording:
+
+Independently developed for compatibility with EAGLE-Harness. Not affiliated with or endorsed by Eagle AI Corp.
+
+## 9. EAGLE Efficient LM Head
+
+### 9.1. Unmodified official component
+
+You may use EAGLE Efficient LM Head to identify the genuine, unmodified Eagle component bearing that name.
+
+Permitted uses include technical documentation, dependency notices, accurate architecture descriptions, and customary attribution notices.
+
+### 9.2. Modified implementations
+
+A materially modified version must use a distinguishable primary name. It may state accurately that it is based on or derived from EAGLE Efficient LM Head.
+
+It may not use EAGLE Efficient LM Head, or a confusingly similar variation, as the modified implementation’s own primary name without written permission.
+
+Recommended wording:
+
+This component is based on EAGLE Efficient LM Head and contains modifications not reviewed or approved by Eagle AI Corp.
+
+### 9.3. Independent implementations
+
+An independently developed implementation may refer to EAGLE Efficient LM Head solely as reasonably necessary to describe interoperability, compatibility, comparative performance, or intended functionality.
+
+It may not:
+
+- Be branded as EAGLE Efficient LM Head;
+
+- Suggest that it is an official implementation;
+
+- Suggest that Eagle AI Corp has verified its performance or compatibility; or
+
+- Use an Eagle logo without written permission.
+
+## 10. Certification and Compatibility Claims
+
+### 10.1. Compatibility claims
+
+You may make an unregistered, truthful compatibility statement if:
+
+- You have conducted reasonable testing;
+
+- The statement accurately describes the versions and functions tested;
+
+- Material limitations are disclosed;
+
+- The claim is kept current; and
+
+- The presentation does not resemble an official Eagle certification seal.
+
+A compatibility claim should identify the applicable version where practical, such as:
+
+Tested for compatibility with Eagle 4 version.
+
+### 10.2. Certification claims
+
+You may not use any of the following without written authorization from Eagle AI Corp:
+
+- “Eagle Certified”
+
+- “Certified for Eagle 4”
+
+- “Eagle Approved”
+
+- “Official Eagle Partner”
+
+- “Eagle Authorized”
+
+- “Eagle Verified”
+
+- “EAGLE-Harness Certified”
+
+- Any certification badge, seal, or logo; or
+
+- Any substantially similar statement or designation.
+
+Participation in the Eagle community, contribution to source code, interoperability with Eagle software, or compliance with the applicable source-available license does not by itself confer certification, partnership, sponsorship, or authorized status.
+
+### 10.3. Revocation of certification
+
+If Eagle AI Corp authorizes a certification claim, the authorization may be subject to:
+
+- Technical requirements;
+
+- Testing standards;
+
+- Version limitations;
+
+- Security requirements;
+
+- Documentation requirements;
+
+- Periodic reevaluation;
+
+- Quality-control requirements; and
+
+- Separate written terms.
+
+Certification may be suspended or revoked if those requirements are no longer satisfied.
+
+## 11. Logos, Stylizations, and Visual Identity
+
+### 11.1. Permission generally required
+
+Eagle logos, icons, stylized word marks, color schemes used as source identifiers, and other elements of the Eagle visual identity may not be used without prior written permission, except where applicable law permits the use.
+
+Permission to use the word “Eagle” nominatively does not include permission to use an Eagle logo.
+
+### 11.2. Authorized logo uses
+
+An authorized user must:
+
+- Use the current artwork supplied or approved by Eagle AI Corp;
+
+- Follow applicable brand guidelines;
+
+- Preserve the logo’s proportions, colors, and clear space;
+
+- Avoid adding text, images, or effects to the logo;
+
+- Avoid rotating, distorting, cropping, animating, or recoloring the logo;
+
+- Avoid combining the logo with another logo or trademark;
+
+- Avoid using the logo as an application icon without express permission; and
+
+- Avoid using the logo more prominently than the authorized user’s own branding unless the written authorization permits otherwise.
+
+### 11.3. Prohibited imitations
+
+You may not create or use a logo, icon, mascot, trade dress, or visual presentation that is confusingly similar to an Eagle visual identity or that is likely to suggest an official Eagle project.
+
+## 12. Domains, Social Media, Packages, and App Stores
+
+### 12.1. Domain names
+
+Without written permission, an Eagle Mark may not be registered or used as the principal or dominant portion of:
+
+- A domain name;
+
+- A subdomain used as a product or service brand;
+
+- A URL-shortening identity; or
+
+- Another online address that suggests official status.
+
+A domain used for an independent community resource should include distinguishing terms and clearly disclose its unofficial status.
+
+For example, a descriptive domain associated with an independent user group may be acceptable if the website prominently identifies its operator and includes the required non-affiliation statement. A domain that appears to be the official Eagle website is not permitted.
+
+### 12.2. Social-media accounts and handles
+
+An Eagle Mark may not be used in a social-media handle, account name, avatar, or profile presentation in a manner that suggests the account is official.
+
+Independent accounts must:
+
+- Identify the actual account operator;
+
+- Use distinguishable primary branding;
+
+- State clearly that the account is unofficial; and
+
+- Avoid using an Eagle logo as the account avatar without permission.
+
+### 12.3. Package and repository names
+
+A third-party package, repository, image, plug-in, extension, or distribution must not use an Eagle Mark as its primary name if doing so could suggest that the package is maintained or approved by Eagle AI Corp.
+
+Descriptive names may be acceptable when they clearly indicate the package’s function and independent origin, such as:
+
+- “[Independent Name] connector for Eagle 4”
+
+- “[Independent Name] integration with Eagle 4”
+
+- “[Independent Name] compatibility tools for Eagle 4”
+
+Names such as “official-eagle,” “eagle-core,” “eagle4-pro,” or “eagle-certified” require written permission.
+
+### 12.4. Application stores and service listings
+
+An application-store or service-marketplace listing must:
+
+- Use the provider’s distinguishable name as the application’s primary name;
+
+- Identify the provider accurately;
+
+- Avoid an Eagle logo unless authorized;
+
+- Avoid suggesting that the application is published by Eagle AI Corp; and
+
+- Include a non-affiliation statement when an Eagle reference could create confusion.
+
+## 13. Events, Groups, and Educational Programs
+
+### 13.1. Independent events and groups
+
+Independent community events and groups may make nominative reference to Eagle 4 if:
+
+- Their independent status is clear;
+
+- Their own distinguishable name is primary;
+
+- They do not suggest that Eagle AI Corp organizes or sponsors the activity;
+
+- They do not use an Eagle logo without permission; and
+
+- They include an appropriate non-affiliation statement.
+
+### 13.2. Official designations
+
+The following terms require prior written permission when used with an Eagle Mark:
+
+- Official;
+
+- Authorized;
+
+- Certified;
+
+- Sponsored;
+
+- Approved;
+
+- Partner;
+
+- Foundation;
+
+- Institute;
+
+- Academy; and
+
+- Conference, when the overall name suggests an official Eagle conference.
+
+### 13.3. Training and credentials
+
+A person may truthfully advertise independent training or consulting relating to Eagle 4. A person may not issue an “Eagle certification” or use an Eagle Mark as the name of a credential without written permission.
+
+An independent course should be described using wording such as:
+
+Independent training for developers using Eagle 4. This course is not affiliated with or endorsed by Eagle AI Corp.
+
+## 14. Merchandise
+
+You may not manufacture, sell, or distribute merchandise bearing an Eagle logo, stylized Eagle Mark, or other Eagle visual identity without written permission.
+
+Limited, noncommercial use of an Eagle word mark on materials for an independent community event may be permitted where:
+
+- The materials are distributed at or below cost;
+
+- The use is incidental and informational;
+
+- The event is clearly identified as unofficial;
+
+- No Eagle logo is used without permission; and
+
+- The merchandise does not create an impression of sponsorship or official status.
+
+Commercial merchandise, fundraising merchandise, promotional giveaways, and products offered through print-on-demand services require written permission.
+
+## 15. Advertising, Marketing, and Promotions
+
+You may use an Eagle word mark in truthful advertising to describe:
+
+- Compatibility;
+
+- Interoperability;
+
+- Support services;
+
+- Training;
+
+- Integration services;
+
+- Migration services;
+
+- Products containing an Eagle component; or
+
+- A product’s origin from Eagle-licensed code.
+
+The advertisement must:
+
+- Use the advertiser’s own name as the primary brand;
+
+- Avoid an Eagle logo unless authorized;
+
+- Avoid false or unsubstantiated claims;
+
+- Avoid claims of certification or approval;
+
+- Identify material modifications or compatibility limitations where omission would be misleading; and
+
+- Include a non-affiliation statement where reasonably necessary.
+
+An Eagle Mark may not be purchased or used as advertising metadata in a manner that causes a misleading advertisement, impersonates Eagle AI Corp, or obscures the identity of the actual advertiser.
+
+## 16. Prohibited Uses
+
+Unless expressly authorized in writing or permitted by applicable law, you may not:
+
+- Use an Eagle Mark as your company, organization, project, product, service, framework, primary feature name, or the primary name of a fork, derivative project, or competing offering;
+
+- Call a modified distribution or fork “Eagle,” “Eagle 4,” or a confusingly similar name;
+
+- Represent a project as an official Eagle project;
+
+- Use an Eagle Mark in a way likely to cause confusion about source, origin, affiliation, sponsorship, endorsement, certification, or approval;
+
+- Use an Eagle logo, stylization, or visual identity;
+
+- Incorporate an Eagle Mark into another trademark, logo, slogan, or source-identifying designation;
+
+- Register or seek to register an Eagle Mark, a confusingly similar designation, or a translation or transliteration of an Eagle Mark;
+
+- Challenge the ownership or validity of an Eagle Mark while exercising a permission granted under this Policy or a separate trademark authorization, except to the extent such a restriction is prohibited by law;
+
+- Use an Eagle Mark in a domain name, social-media handle, package name, or app-store listing that suggests official status;
+
+- Use an Eagle Mark in connection with unlawful, fraudulent, deceptive, malicious, or harmful conduct;
+
+- Use an Eagle Mark in a manner that materially harms or dilutes its source-identifying significance;
+
+- Apply an Eagle Mark to a materially modified component as though it were the official, unmodified component;
+
+- Make false or unsupported compatibility claims;
+
+- Use an Eagle certification seal or claim certification without authorization;
+
+- Falsely claim original authorship of Eagle software, or remove or conceal Eagle attribution, a required trademark ownership statement, or a disclaimer in a manner that creates a false impression of origin or affiliation; or
+
+- State or imply that compliance with the applicable source-available license makes a product official, authorized, or certified by Eagle AI Corp.
+
+This section does not prohibit truthful criticism, commentary, comparison, nominative reference, or another use protected by applicable law.
+
+## 17. Attribution and Non-Affiliation Statements
+
+### 17.1. Trademark attribution
+
+When appropriate, use the following notice:
+
+EAGLE, Eagle 4, EAGLE-Harness, and EAGLE Efficient LM Head are trademarks or claimed trademarks of Eagle AI Corp. All other names and marks are the property of their respective owners.
+
+A shorter notice may be used when space is limited:
+
+Eagle 4 is a trademark or claimed trademark of Eagle AI Corp.
+
+A trademark attribution statement does not replace the LICENSE file, NOTICE file, README or repository notices, applicable source-file notices, required modification notices, or other copyright, patent, license, attribution, trademark ownership, or proprietary-notice obligations under the applicable source-available license. All required statements and notices must be preserved.
+
+### 17.2. Non-affiliation statement
+
+Use the following where a reference could otherwise suggest an official relationship:
+
+This project is not affiliated with, certified by, sponsored by, endorsed by, or an official project of Eagle AI Corp.
+
+For a fork or modified distribution:
+
+This project is based on Eagle 4 but is not affiliated with, certified by, sponsored by, endorsed by, or an official project of Eagle AI Corp.
+
+### 17.3. Placement
+
+A required disclaimer should be:
+
+- Reasonably prominent;
+
+- Close to the principal Eagle reference where practical;
+
+- Included in the project README or equivalent introductory documentation;
+
+- Included on the principal website or listing page; and
+
+- Presented in a manner that an ordinary user can read and understand.
+
+A disclaimer cannot cure an otherwise confusing project or product name.
+
+## 18. Trademark Symbols
+
+### 18.1. Use of ™ and SM
+
+The ™ symbol may be used to indicate that Eagle AI Corp claims trademark rights in a name or designation used for goods. The SM symbol may be used for a service mark.
+
+Eagle AI Corp may use these symbols regardless of whether a federal trademark registration has issued.
+
+Third parties are not required to apply ™ or SM to every nominative reference. If a trademark symbol is used, it should be accurate and should not suggest that the third party owns the Eagle Mark.
+
+### 18.2. Use of ®
+
+The ® symbol may be used only for a mark that is federally registered and only in connection with the goods or services covered by the applicable registration.
+
+Do not assume that every Eagle Mark is federally registered. Unless Eagle AI Corp identifies a particular mark and use as registered, use the mark without the ® symbol or use ™ where appropriate.
+
+### 18.3. Style
+
+Where a symbol is appropriate, ordinarily place it after the first or most prominent use of the mark, for example:
+
+- EAGLE™
+
+- Eagle 4™
+
+- EAGLE-Harness™
+
+- EAGLE Efficient LM Head™
+
+Repeated symbols are generally unnecessary after the first prominent use in the same document or page.
+
+## 19. Quality Control for Authorized Uses
+
+A written authorization to use an Eagle Mark may require compliance with reasonable quality standards to protect users and the goodwill associated with the mark.
+
+An authorized user may be required to:
+
+- Follow current brand guidelines;
+
+- Use approved artwork and wording;
+
+- Maintain appropriate technical, security, and service standards;
+
+- Submit representative samples for review;
+
+- Correct inaccurate, defective, or misleading materials;
+
+- Limit use to specified products, services, territories, channels, or periods;
+
+- Maintain records sufficient to demonstrate compliance;
+
+- Cooperate in addressing user confusion;
+
+- Avoid sublicensing the authorization;
+
+- Notify Eagle AI Corp of material complaints or security issues; and
+
+- Stop using obsolete marks or materials after receiving reasonable notice.
+
+Review by Eagle AI Corp does not make Eagle AI Corp responsible for the authorized user’s product, service, statements, legal compliance, security, or conduct.
+
+## 20. Requesting Permission
+
+To request permission to use an Eagle Mark beyond the uses allowed by this Policy, contact:
+
+
+A request should include:
+
+- The requesting person’s or entity’s legal name;
+
+- Contact information;
+
+- The Eagle Mark to be used;
+
+- The proposed product, service, project, event, or activity;
+
+- The proposed wording, artwork, and placement;
+
+- Representative mockups or samples;
+
+- Whether the use will be commercial;
+
+- The expected duration, territory, and distribution channels;
+
+- Any proposed certification, partnership, or endorsement claim; and
+
+- Any deadline for the proposed use.
+
+Submission of a request does not grant permission. Permission is effective only when provided in writing by an authorized representative of Eagle AI Corp.
+
+Eagle AI Corp may approve, reject, limit, or condition a request in its discretion, subject to applicable law. Silence or failure to respond does not constitute approval.
+
+## 21. Enforcement, Correction, and Revocation
+
+### 21.1. Requests for correction
+
+If Eagle AI Corp believes a use violates this Policy, it may request that the user:
+
+- Correct inaccurate wording;
+
+- Add or revise a disclaimer;
+
+- Change a project, product, package, account, or service name;
+
+- Remove an Eagle logo or unauthorized visual identity;
+
+- Transfer or discontinue a misleading domain name or account;
+
+- Stop making an unauthorized certification or affiliation claim; or
+
+- Discontinue another unauthorized use.
+
+Where appropriate, Eagle AI Corp may provide a reasonable period to correct an inadvertent violation. Nothing in this Policy requires Eagle AI Corp to provide notice or a cure period before exercising rights or seeking relief.
+
+### 21.2. Revocation of permission
+
+Eagle AI Corp may revoke a discretionary permission or separate trademark authorization if:
+
+- The user violates this Policy or the written authorization;
+
+- The use becomes false, misleading, unlawful, or harmful;
+
+- Required quality standards are not maintained;
+
+- The authorized relationship ends;
+
+- Continued use is likely to cause confusion;
+
+- The user fails to make a requested correction; or
+
+- Revocation is otherwise permitted by the governing written authorization.
+
+Following revocation, the user must discontinue the authorized trademark use within the period specified in the notice, subject to applicable law.
+
+Revocation of a trademark permission does not revoke copyright or patent rights independently granted under the applicable source-available license or a separate written commercial agreement.
+
+### 21.3. Reservation of remedies
+
+Eagle AI Corp reserves all remedies available under applicable law. This may include relief relating to trademark infringement, unfair competition, false designation of origin, false advertising, dilution, cybersquatting, passing off, or breach of an applicable written authorization.
+
+## 22. Reporting Misuse
+
+Suspected misuse of an Eagle Mark may be reported to [email protected]. A report should include, where available:
+
+- The mark being misused;
+
+- The identity of the person or organization involved;
+
+- Relevant URLs, repository locations, or listings;
+
+- Screenshots or archived materials;
+
+- The date the use was observed;
+
+- A description of the likely confusion or harm; and
+
+- The reporter’s contact information.
+
+Submitting a report does not create an attorney-client relationship, enforcement obligation, or entitlement to information about any investigation.
+
+## 23. No Waiver
+
+A delay or failure by Eagle AI Corp to enforce a provision of this Policy or a trademark right does not waive that provision or right.
+
+Permission for one use does not authorize:
+
+- Another use;
+
+- Use of another Eagle Mark;
+
+- Use by another person;
+
+- Use in another territory or channel;
+
+- Use after the authorization expires; or
+
+- Any broader use than the written authorization permits.
+
+Any waiver must be in writing and signed by an authorized representative of Eagle AI Corp.
+
+## 24. No Warranties or Endorsement
+
+Permission to make a reference under this Policy does not constitute a warranty, certification, representation, sponsorship, or endorsement by Eagle AI Corp.
+
+Unless Eagle AI Corp expressly agrees otherwise in a signed writing:
+
+- Eagle AI Corp does not review or approve third-party products or services;
+
+- Eagle AI Corp is not responsible for a third party’s modifications, products, services, statements, security, support, or conduct;
+
+- References to compatibility do not guarantee continued compatibility; and
+
+- No trademark permission creates a partnership, agency, franchise, joint venture, fiduciary relationship, or other formal relationship.
+
+## 25. Policy Updates
+
+Eagle AI Corp may update this Policy periodically.
+
+An updated Policy will apply prospectively from the date it is published. A previously issued written trademark authorization remains subject to its own terms, including any provision permitting updated brand or quality-control requirements.
+
+Users should consult the current version before beginning a new use of an Eagle Mark.
+
+A Policy update does not retroactively restrict copyright or patent rights granted under the applicable source-available license or a separate written commercial agreement.
+
+## 26. Governing Law and Jurisdiction
+
+To the extent that a dispute concerning this Policy is governed by an agreement created through a permission or authorization granted under it, that agreement and dispute will be governed by the laws of the State of New York, without regard to conflict-of-law principles.
+
+The parties to such an agreement consent to the exclusive jurisdiction of the state and federal courts located in New York County, New York, for disputes arising from or relating to that agreement or authorized trademark use. This section does not:
+
+- Create contractual obligations merely because a person engages in nominative use or exercises rights provided by law;
+
+- Limit Eagle AI Corp’s ability to enforce its rights in another jurisdiction where infringement or other unlawful conduct occurs;
+
+- Limit any nonwaivable right or remedy; or
+
+- Modify the governing-law terms of the applicable source-available license or a separate written commercial agreement.
+
+## 27. Interpretation and Applicable-Law Rights
+
+This Policy should be interpreted to protect the source-identifying function of the Eagle Marks without independently expanding or restricting software rights governed by the applicable source-available license or a separate written commercial agreement.
+
+Nothing in this Policy is intended to prohibit or restrict:
+
+- Truthful nominative use;
+
+- Fair use;
+
+- News reporting;
+
+- Commentary or criticism;
+
+- Comparative advertising permitted by law;
+
+- Accurate statements of compatibility, interoperability, origin, or derivation;
+
+- Use required to comply with the applicable source-available license; or
+
+- Any other right provided by applicable law.
+
+If a provision of this Policy is unenforceable in a particular circumstance, it will be applied to the maximum extent permitted by law, and the remaining provisions will continue to apply.
+
+## 28. Quick-Reference Guide
+
+| Proposed use | Permission generally required? | Principal conditions |
+| ------------------------------------------------------ | ------------------------------ | ----------------------------------------------------------------------------- |
+| Truthfully discussing or reviewing Eagle 4 | No | Do not imply affiliation or endorsement |
+| Stating that a project is based on Eagle 4 | No | Use distinguishable primary branding and an appropriate disclaimer |
+| Stating that a product is compatible with Eagle 4 | No | Test the claim, disclose material limitations, and do not imply certification |
+| Identifying an unmodified EAGLE-Harness component | No | Use the name descriptively and do not imply approval of the larger product |
+| Naming a fork “Eagle 4” | Yes; ordinarily not approved | Modified distributions require a distinguishable primary name |
+| Naming a modified component “EAGLE-Harness Pro” | Yes; ordinarily not approved | Use a distinguishable primary name and describe derivation secondarily |
+| Using an Eagle logo | Yes | Written authorization and brand-guideline compliance required |
+| Operating an unofficial Eagle user group | Usually no | Clearly identify the group as independent and unofficial |
+| Using an Eagle Mark in a domain or social-media handle | Usually yes | The name must not suggest an official Eagle channel |
+| Offering independent Eagle 4 consulting or training | No | Use truthful descriptive language and avoid certification claims |
+| Claiming “Eagle Certified” or “Official Eagle Partner” | Yes | Written authorization required |
+| Selling merchandise bearing an Eagle logo | Yes | Written authorization required |
+| Making truthful references required by law | No | Applicable-law rights remain available |
+
+## 29. Model Wording
+
+**Based on Eagle 4**
+
+Based on Eagle 4. This project contains modifications that have not been reviewed or approved by Eagle AI Corp.
+
+**Compatible with Eagle 4**
+
+Compatible with Eagle 4. Compatibility has not been certified or endorsed by Eagle AI Corp.
+
+**Unmodified EAGLE-Harness component**
+
+Includes an unmodified EAGLE-Harness component from the Eagle 4 project.
+
+**Modified EAGLE-Harness component**
+
+This independently named component is based on EAGLE-Harness and contains modifications not reviewed or approved by Eagle AI Corp.
+
+**Independent compatible implementation**
+
+Independently developed for compatibility with EAGLE-Harness. Not affiliated with, certified by, sponsored by, or endorsed by Eagle AI Corp.
+
+**General non-affiliation disclaimer**
+
+This project is not affiliated with, certified by, sponsored by, endorsed by, or an official project of Eagle AI Corp.
+
+**Fork or modified-distribution disclaimer**
+
+This project includes or is derived from Eagle 4 technology developed by Eagle AI Corp. It is not affiliated with, certified by, sponsored by, endorsed by, or an official project of Eagle AI Corp.
+
+**Trademark attribution**
+
+EAGLE, Eagle 4, EAGLE-Harness, and EAGLE Efficient LM Head are trademarks or claimed trademarks of Eagle AI Corp.
+
+## 30. Contact
+
+Questions, permission requests, and reports of suspected misuse should be directed to:
+
+Eagle AI Corp Commercial and Trademark Contact: [email protected]
+
+Copyright © 2026 Eagle AI Corp. Policy text may be reproduced for the purpose of accurately explaining or complying with this Policy.
diff --git a/docker/sglang-rocm.Dockerfile b/docker/sglang-rocm.Dockerfile
new file mode 100644
index 0000000..c05a23c
--- /dev/null
+++ b/docker/sglang-rocm.Dockerfile
@@ -0,0 +1,21 @@
+# syntax=docker/dockerfile:1
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+# Sketch only. Supply an approved Python 3.10 / ROCm 7.2 MI355X base
+# with matching PyTorch, Triton, AITER and FlyDSL already installed.
+# No default tag is invented. This file has not been built or served.
+ARG BASE_IMAGE
+FROM ${BASE_IMAGE}
+COPY pyproject.toml README.md LICENSE NOTICE TRADEMARKS.md THIRD_PARTY_NOTICES.md /src/
+COPY LICENSES/ /src/LICENSES/
+COPY eagle_harness/ /src/eagle_harness/
+COPY docs/release.env /opt/eagle-release.env
+RUN . /opt/eagle-release.env \
+ && python3 -c 'import sys, torch; assert sys.version_info[:2] == (3, 10); assert torch.version.hip' \
+ && python3 -m pip install --no-cache-dir --no-deps --extra-index-url "$EAGLE_ROCM_INDEX" \
+ "sglang==$EAGLE_ROCM_VERSION" \
+ && python3 -m pip install --no-cache-dir --no-deps --force-reinstall /src \
+ && eagle-harness calibrate --help
+# Run eagle-harness-check with /dev/kfd and /dev/dri available, then follow
+# docs/quickstart-amd.md. A CPU build-time import is not GPU qualification.
diff --git a/docker/sglang.Dockerfile b/docker/sglang.Dockerfile
new file mode 100644
index 0000000..7767318
--- /dev/null
+++ b/docker/sglang.Dockerfile
@@ -0,0 +1,21 @@
+# syntax=docker/dockerfile:1
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+# Sketch only. Base and final image need clean-build qualification.
+FROM lmsysorg/sglang:nightly-dev-cu13-20261018-b234b5c3
+COPY pyproject.toml README.md LICENSE NOTICE TRADEMARKS.md THIRD_PARTY_NOTICES.md /src/
+COPY LICENSES/ /src/LICENSES/
+COPY eagle_harness/ /src/eagle_harness/
+COPY docs/release.env /opt/eagle-release.env
+# Keep the release closure separate from unrelated base-image Python packages.
+RUN python3 -m venv --without-pip /opt/eagle \
+ && python3 -m pip --python /opt/eagle install --no-cache-dir --upgrade pip
+ENV VIRTUAL_ENV=/opt/eagle
+ENV PATH="/opt/eagle/bin:${PATH}"
+RUN . /opt/eagle-release.env \
+ && python3 -m pip install --no-cache-dir --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" "sglang==$EAGLE_SGLANG_VERSION" 'flashinfer-python>=0.7.2' \
+ && python3 -m pip install --no-cache-dir --no-deps --force-reinstall /src \
+ && python3 -m pip check \
+ && eagle-harness calibrate --help
diff --git a/docker/tokenspeed.Dockerfile b/docker/tokenspeed.Dockerfile
new file mode 100644
index 0000000..609b9a1
--- /dev/null
+++ b/docker/tokenspeed.Dockerfile
@@ -0,0 +1,28 @@
+# syntax=docker/dockerfile:1
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+# Sketch only. Supply an approved Python 3.12 / CUDA 13.0 TokenSpeed base.
+# Scheduler and kernel wheels must be built from the matching release source.
+# This file has not been built or served.
+ARG BASE_IMAGE
+FROM ${BASE_IMAGE}
+COPY pyproject.toml README.md LICENSE NOTICE TRADEMARKS.md THIRD_PARTY_NOTICES.md /src/
+COPY LICENSES/ /src/LICENSES/
+COPY eagle_harness/ /src/eagle_harness/
+COPY docs/release.env /opt/eagle-release.env
+# Keep the release closure separate from unrelated base-image Python packages.
+RUN python3 -m venv --without-pip /opt/eagle \
+ && python3 -m pip --python /opt/eagle install --no-cache-dir --upgrade pip
+ENV VIRTUAL_ENV=/opt/eagle
+ENV PATH="/opt/eagle/bin:${PATH}"
+RUN . /opt/eagle-release.env \
+ && python3 -c 'import sys; assert sys.version_info[:2] == (3, 12)' \
+ && test -n "$EAGLE_TOKENSPEED_AUX_REQUIREMENTS" \
+ && python3 -m pip install --no-cache-dir --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" \
+ "tokenspeed==$EAGLE_TOKENSPEED_VERSION" $EAGLE_TOKENSPEED_AUX_REQUIREMENTS \
+ && python3 -m pip install --no-cache-dir --no-deps --force-reinstall /src \
+ && python3 -m pip check
+# Run eagle-harness-check with NVIDIA GPU access, then follow
+# docs/quickstart-tokenspeed.md. Hook imports may require a visible GPU.
diff --git a/docker/vllm.Dockerfile b/docker/vllm.Dockerfile
new file mode 100644
index 0000000..0b3e503
--- /dev/null
+++ b/docker/vllm.Dockerfile
@@ -0,0 +1,21 @@
+# syntax=docker/dockerfile:1
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+# Sketch only. Base and final image need clean-build qualification.
+FROM vllm/vllm-openai:nightly-49cb2bbf71cfd36ee5aa33d1e184b1cddff55294
+COPY pyproject.toml README.md LICENSE NOTICE TRADEMARKS.md THIRD_PARTY_NOTICES.md /src/
+COPY LICENSES/ /src/LICENSES/
+COPY eagle_harness/ /src/eagle_harness/
+COPY docs/release.env /opt/eagle-release.env
+# Keep the release closure separate from unrelated base-image Python packages.
+RUN python3 -m venv --without-pip /opt/eagle \
+ && python3 -m pip --python /opt/eagle install --no-cache-dir --upgrade pip
+ENV VIRTUAL_ENV=/opt/eagle
+ENV PATH="/opt/eagle/bin:${PATH}"
+RUN . /opt/eagle-release.env \
+ && python3 -m pip install --no-cache-dir --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" "vllm==$EAGLE_VLLM_VERSION" \
+ && python3 -m pip install --no-cache-dir --no-deps --force-reinstall /src \
+ && python3 -m pip check \
+ && eagle-harness calibrate --help
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..c2a6d03
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,29 @@
+---
+type: explanation
+owner: eagle-harness
+last_verified: 2026-10-19
+---
+
+# eagle-harness documentation
+
+Install a pinned engine and check generation with live costs on SGLang or a fixed tree on vLLM.
+TokenSpeed is experimental. Measure the setup you will deploy.
+Start with the measured model pairs rather than treating config admission as proof of support.
+
+| Task | Guide |
+|---|---|
+| Install wheels or run a release Docker image | [Install](install.md) |
+| Generate text on SGLang CUDA | [SGLang quickstart](quickstart-sglang.md) |
+| Generate text on AMD MI355X | [AMD quickstart](quickstart-amd.md) |
+| Generate text on experimental TokenSpeed | [TokenSpeed quickstart](quickstart-tokenspeed.md) |
+| Generate text on vLLM | [vLLM quickstart](quickstart-vllm.md) |
+| Measure and fit serving costs | [Calibration](calibration.md) |
+| Train, export and qualify a draft for another target | [New-model onboarding](new-model.md) |
+| Check measured models, TP sizes and request features | [Support matrix](support-matrix.md) |
+| Check unsupported or unmeasured behavior | [Known limits](known-limits.md) |
+| Look up config keys and defaults | [Configuration](configuration.md) |
+| Understand plugin hooks and decode rounds | [Architecture](architecture.md) |
+| Check kernel implementations and fallbacks | [Kernels](kernels.md) |
+| Check host versions and release numbering | [Compatibility](compatibility.md) |
+| Diagnose startup and generation errors | [Troubleshooting](troubleshooting.md) |
+| Find short answers | [FAQ](faq.md) |
diff --git a/docs/architecture.md b/docs/architecture.md
new file mode 100644
index 0000000..5311155
--- /dev/null
+++ b/docs/architecture.md
@@ -0,0 +1,131 @@
+# Architecture
+
+eagle-harness adds one speculative decoding method to an existing serving engine. The engine keeps prefill,
+scheduling, KV cache, sampling and the HTTP server. eagle-harness supplies the draft tree, the cost model that sizes
+it, the EAGLE-4 draft model and the kernels of the tree round. It never edits or patches the engine: it plugs in
+through the engine's plugin entry point and a set of generic hooks the engine exposes.
+
+## How the plugin loads
+
+Each engine loads installed plugins in every process at startup, before it resolves the model config.
+
+| engine | entry point group | function | what it registers |
+|---|---|---|---|
+| sglang | `sglang.srt.plugins` | `eagle_harness.sglang.plugin:register` | the speculative algorithm `EAGLE_HARNESS` and the draft class `LlamaForCausalLMEagle4` |
+| vLLM | `vllm.general_plugins` | `eagle_harness.vllm.plugin:register` | the speculative method `eagle_harness`, the draft architecture `LlamaForCausalLMEagle4` and the tree attention backend `CUSTOM` |
+| TokenSpeed | `tokenspeed.plugins` | `eagle_harness.tokenspeed.plugin:register` | the drafter `EAGLE_HARNESS` (reading the target's aux hidden states) and the draft architecture `LlamaForCausalLMEagle4` |
+
+Before it registers anything, the plugin checks that every hook it uses is present in the installed engine. The
+contract lives in code: `eagle_harness/sglang/hooks.py` lists every sglang attribute the plugin overrides or calls,
+with its parameter names, `eagle_harness/vllm/adapter.py` (`HOOK_MAP`) lists every vLLM hook by name, and
+`eagle_harness/tokenspeed/hooks.py` lists every TokenSpeed name and parameter the adapter relies on. If one is
+missing or changed, the plugin registers nothing and logs one error naming the engine version, each mismatch and the
+fix. The engine keeps working without the method. [Compatibility](compatibility.md) has the version rules and
+[Troubleshooting](troubleshooting.md) shows the messages.
+
+## The hooks each engine provides
+
+sglang runs the method on its V2 speculative worker with either overlap or synchronous scheduling.
+`--disable-overlap-schedule` selects synchronous scheduling. The plugin uses these hooks of
+sglang's `CustomSpecAlgo` and related classes:
+
+| hook | what eagle-harness does with it |
+|---|---|
+| `handle_server_args` | parses the method's JSON config, checks the tree shape and the hardware, turns off mixed chunked prefill |
+| `supports_mm_inputs` | refuses multimodal inputs (sglang's `validate_request` gives the reason) |
+| `req_to_token_extra_len` | reserves block-table room for the largest tree |
+| `create_decode_graph_variants` | captures one target-verify CUDA graph per verify width |
+| `create_linear_attn_verify_extension` | runs the GDN tree verify kernels in hybrid (gated delta net) targets, and the tree conv1d in Mamba2 hybrids (NemotronH) |
+| `SpecInput.flashinfer_verify_variant` | gives FlashInfer a tree-tail mask attention variant for batch-size-1 verify graphs |
+| `accept_step` of `run_eagle_verify` | replaces the accept bookkeeping of a greedy batch-size-1 round with two fused launches |
+
+vLLM runs the method on its Model Runner V2. The plugin uses its speculative-method registry, the speculator hooks
+`prepare_verify_inputs`, `make_rejection_sampler` and `post_accept`, the linear-attention verify extension for GDN
+layers, and the `CUSTOM` attention backend slot.
+
+TokenSpeed runs the method as a drafter on its plugin registries. The plugin uses `register_drafter` and
+`register_model` from TokenSpeed main and generic hooks of the eagle-hq TokenSpeed build: the method's JSON
+config (`--speculative-algorithm-config`, delivered to `BaseDrafter.configure_algorithm`), the target's aux hidden
+states for a plugin algorithm, and tree drafting by a plugin drafter. The same branch lets a plugin draft bind its
+cache under a hybrid target and adds sliding-window attention to tree lanes. See [TokenSpeed](#tokenspeed) below.
+
+## One decode round
+
+Every decode step of a request is a round: draft a tree, verify it with one target forward, accept a path, then
+prepare the next round.
+
+1. The EAGLE-4 draft model drafts: it grows a token tree one level at a time from the last accepted token. Each step
+ expands the best `K` frontier nodes (`--speculative-eagle-topk` on sglang, `node_top_k` on vLLM). The draft reads
+ three hidden states of the target, attends to its own sliding window plus each row's tree ancestors, and scores
+ the vocabulary with a low-rank candidate head: a rank-r estimate picks a few candidates per vocabulary shard, and
+ only those are re-scored exactly with the full LM head rows.
+2. The tree is ranked: a node's score is its parent's score times its probability. The verify set is the best
+ `width - 1` nodes plus the root, ordered parent first, so any prefix of it is a tree too.
+3. The cost model sizes the round. On sglang it decides, after every second draft level, whether another level pays for
+ its draft time, and picks the round's verify width from the measured verify cost of each width. It reads the
+ [cost tables](calibration.md) of the batch size and context length at hand. On vLLM the scheduler fixes the verify
+ width per batch size, so the per-round decision is the draft depth: a step runs only while a deeper node could
+ still enter the verify set, and, with cost tables, only while its expected gain pays for its measured cost.
+4. One target forward verifies the tree: it scores every node of the verify set. Full-attention layers attend each row to the
+ committed context and to its own ancestors (a tree mask). GDN layers run the tree versions of the causal conv1d
+ and the gated delta rule recurrence, each node continuing from its parent's state.
+5. The target's token at each node decides which child, if any, the walk follows from the root. For a greedy
+ request it is the target's argmax. For a sampled request it is a draw from the target's distribution at that
+ node (temperature, top-k, top-p, min-p): on vLLM the draw vLLM's sampler makes at that position, with noise
+ keyed by the request's seed and the node's depth; on sglang, sglang's tree speculative sampling. The accepted
+ path plus one bonus token from the target are committed. Every committed token is the target's own token given
+ the accepted prefix, so the output has the target's distribution. Greedy output matches greedy decoding without
+ speculation, up to near-ties in the target's logits that a different batch shape can flip. The accepted rows'
+ KV and GDN states are moved to the request's chain positions.
+6. The draft extend runs the draft over the accepted tokens, which updates its KV cache and yields the next round's
+ first candidates.
+
+On sglang the round runs as CUDA graph replays: one graph per draft step, one per verify width on the target, one for
+the draft extend and small graphs for ranking and building the verify input. The host only reads the cost model's
+inputs, one step late, so it rarely waits for the GPU. While the scheduler processes a round, the next round's
+draft extend and first draft steps already run. Synchronous scheduling uses a side stream. Overlap scheduling
+uses the forward stream so the engine can relay the draft outputs in order.
+
+## TokenSpeed
+
+The TokenSpeed adapter is experimental. The paths below describe implementation, not qualification for every workload.
+
+TokenSpeed's tree attention, GDN tree verification, accept walk and accepted-path compaction serve both adapter modes.
+In static mode the target forward, acceptance and all draft steps replay as one decode CUDA graph.
+eagle-harness supplies the tree policy and the draft model:
+
+- `HarnessDrafter` is TokenSpeed's EAGLE tree drafter with EAGLE-4's seed, expand and finalize steps. The draft
+ extend and the `steps - 1` lane forwards of `K` rows per request are TokenSpeed's.
+- The EAGLE-4 draft model (`LlamaForCausalLMEagle4`) uses a low-rank candidate head. Its exit returns candidate-head
+ rows without logits, so no draft step runs the whole-vocabulary LM head.
+- Static mode uses the shared core draft tree to score nodes, keep the frontier and pick verify nodes. Given the
+ same draft outputs, it selects the same tree as the sglang and vLLM adapters
+ (`tests/test_tokenspeed_adapter.py`). `eagle_harness/tokenspeed/tree_lanes.py` turns the frontier choices into
+ TokenSpeed's 64-bit lane masks (each lane sees its ancestors' draft slots) and the verify window and parents.
+
+The EAGLE-4 draft layer has a sliding window. TokenSpeed main refuses a sliding-window layer in its tree lanes; the
+hooks branch adds that path (every lane of a request sits at one position, so all lanes see the same committed keys).
+
+Serve mode captures the target, sampling and draft extend together. The host launches the first draft-depth graph.
+The GPU cost policy decides whether to continue and tail-launches later depths and finalization. Calibration parsing,
+cost adjustments and depth thresholds come from the shared core cost model. `CostModel.tree_policy_costs()` exports
+immutable host cost records once at binding. The installed TokenSpeed engine packs these records and owns the
+device policy, draft-round graphs, tree kernels and tail-launch runtime; those implementations are not vendored in
+eagle-harness. Its GPU policy consumes the shared thresholds without a second host cost model.
+
+For trees, the physical verify width stays fixed at `--speculative-num-draft-tokens`. A round can select fewer meaningful nodes
+and pad the rest with unconnected roots. Draft lane slots `(steps - 1) * K` have their own KV reservation and must fit
+in a 64-bit lane mask, rather than in the verify width. Per-round lane page-table snapshots isolate deferred work
+and direct padded rows to null pages. Round completion fences protect request-slot reuse and cache mutation.
+
+## Package layout
+
+| path | contents |
+|---|---|
+| `eagle_harness/core/` | cost model, cost tables, calibration fits, draft tree bookkeeping, `HarnessConfig` (pure Python, tested on CPU) |
+| `eagle_harness/kernels/` | Triton, Gluon and native CUDA kernels, hardware dispatch in `arch.py` (no engine imports) |
+| `eagle_harness/models/` | EAGLE-4 draft config validation and the low-rank head |
+| `eagle_harness/sglang/` | sglang plugin, algorithm hooks, workers, draft steps, verify graphs, draft model |
+| `eagle_harness/vllm/` | vLLM plugin, speculator, tree drafter, tree attention backend, GDN tree verify, tree accept, draft model |
+| `eagle_harness/tokenspeed/` | TokenSpeed plugin, hook check, drafter (tree policy), lane masks and verify window, draft model |
+| `eagle_harness/compat.py` | the supported engine versions and the hook check behind `eagle-harness-check` |
diff --git a/docs/assets/Eagle.svg b/docs/assets/Eagle.svg
new file mode 100644
index 0000000..48865b6
--- /dev/null
+++ b/docs/assets/Eagle.svg
@@ -0,0 +1,11 @@
+<svg width="1200" height="1200" viewBox="0 0 1200 1200" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_3729_2)">
+<path d="M1200 0H0V1200H1200V0Z" fill="#FFD658"/>
+<path d="M1037.52 254.908L693.942 483.822L727.394 577.956L947.007 430.775L945.682 437.822L942.416 455.219L940.926 463.177L727.881 605.952L705.691 653.93L668.137 679.083L707.411 594.148L708.009 593.753L707.835 593.256V593.238L701.836 576.319L701.588 575.684L656.057 447.565L676.297 434.078L686.895 463.968L690.023 463.987C703.86 432.909 705.019 418.346 692.351 405.042C686.932 399.357 678.523 395.99 666.297 395.99H637.694L647.142 422.596L594.38 395.99H637.657L627.335 366.927H501.58V370.966L551.103 395.99C551.103 395.99 534.46 442.965 517.542 490.658L163.627 252.276L158.217 254.126L183.471 388.188L222.111 414.252L250.502 563.954L252.766 575.96L508.434 747.853L541.637 652.614L265.627 467.796L264.67 462.671L262.554 451.374L259.555 435.402L570.138 643.543L488.571 876.533L595.696 948.624L702.821 876.533L671.531 787.155L611.262 827.433L611.501 799.023L663.5 764.201L954.128 569.575L955.195 563.945H955.213L983.954 412.412L1016.49 390.792L1041.81 256.361L1037.55 254.908H1037.52Z" fill="black"/>
+</g>
+<defs>
+<clipPath id="clip0_3729_2">
+<rect width="1200" height="1200" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/docs/assets/paper_results.png b/docs/assets/paper_results.png
new file mode 100644
index 0000000..19d7466
Binary files /dev/null and b/docs/assets/paper_results.png differ
diff --git a/docs/calibration.md b/docs/calibration.md
new file mode 100644
index 0000000..92d3b6b
--- /dev/null
+++ b/docs/calibration.md
@@ -0,0 +1,243 @@
+---
+type: how-to
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# Calibrate your serving setup
+
+## Costs measured on the served rounds
+
+On SGLang the cost-model modes need no offline step: without `data_path`, the server prices the draft step and the
+target verify on its own served rounds. The first rounds at each batch bucket (a captured graph batch size) force
+every captured verify width a few times, timed with CUDA events around the exact kernels served at the real
+context length; after that every round refines its cell (an exponential moving average per batch bucket, verify
+width and 1024-token context interval) and the cost model reads the resulting tables. The cells are cached under
+`cost_cache` (default `~/.cache/eagle-harness/costs/<key>.json`), keyed by GPU name, TP size, the target's and the
+draft's `config.json` digests, the engine version and the dtype, so a restart on the same setup starts with the
+costs it ended with and a different setup measures again. All TP ranks decide from rank 0's cells.
+
+The live cache also checks the draft top-k and depth, because they change the work being timed. Invalid or
+unreadable caches are ignored and remeasured. Cached and refreshed curves outside the cost model's supported
+ratios keep the fixed-shape policy until usable measurements arrive; they do not fail the next decode round.
+Seeding is bounded by the captured widths and sample count, not a wall-clock deadline, and occurs on served
+rounds (including engine warmup requests), not during graph capture. Live timings alone do not establish
+optimal acceptance or no-loss behavior at high concurrency; compare sustained workloads against native no-spec.
+After seeding, a draft prefix is timed once per table-refresh period; target timings continue on served verifies.
+Prelaunched draft samples use that batch's bucket and context, not the preceding batch's seed key.
+
+Offline calibration below remains the precise mode: it times isolated steps on dummy batches over a fine context
+grid. Its tables carry the same key in `key.json`; a server refuses tables keyed for another setup, and accepts
+tables without a key (measured before keys existed) with a warning.
+
+## Offline calibration
+
+Use `eagle-harness calibrate` to measure costs on the GPUs and engine you will serve with. It starts and stops
+its own engine processes, retains raw measurements and prints a matching serving command. Stop other servers
+on your allocated GPUs first.
+
+## Run the command
+
+SGLang requires the host graph contract with per-variant forward modes. The calibration driver measures
+native decode as well as speculative chains. An older host without that contract fails with an explicit error.
+
+Set `MODEL`, `DRAFT` and `TP` to your target, compatible exported draft and tensor-parallel size:
+
+```bash
+eagle-harness calibrate --model "$MODEL" --draft "$DRAFT" --tp "$TP"
+```
+
+The command selects the sole installed engine. If both engines are installed, specify `--engine sglang` or
+`--engine vllm`. TP defaults to one. No private dataset or calibration directory is required.
+
+| Engine | Default measurement | Default output |
+|---|---|---|
+| vLLM | Batch-one tree, verify widths 8, 16, 32 and 64, with context lengths below 4096 | `eagle-calibration-vllm/` |
+| SGLang | Served chains up to width 8, at concurrency 1 and 8, with 1024 new tokens per request | `eagle-calibration-sglang/` |
+
+SGLang requires a package build containing the served-chain calibration driver. It does not produce dynamic-tree
+cost tables. vLLM prices isolated whole steps and draft graph replays, not a full high-concurrency served round.
+Neither command establishes a speedup or replaces a correctness check against no-spec generation.
+
+Preview the settings without importing an engine, loading a model or creating output:
+
+```bash
+eagle-harness calibrate --engine vllm --model "$MODEL" --draft "$DRAFT" --tp "$TP" --dry-run
+```
+
+Use `--output` to choose a fresh directory. The command refuses to overwrite one, including partial results
+from a failed run. GPU allocation, model downloads and compilation can make a calibration take much longer
+than five minutes.
+
+## Use representative SGLang prompts
+
+The default built-in prompts are a command smoke test. Acceptance depends on the workload, so use held-out
+requests that resemble your traffic for a deployable profile. A JSONL file uses the SPEED-Bench first-turn format:
+
+```json
+{"category":"coding","turns":["Explain a database transaction with an example."]}
+{"category":"writing","turns":["Write a short science lesson about rainfall."]}
+```
+
+Only the first turn is used. The target tokenizer applies its chat template. Prompts are repeated if a
+concurrency level needs more requests than the file contains.
+
+```bash
+eagle-harness calibrate --engine sglang --model "$MODEL" --draft "$DRAFT" --tp "$TP" \
+ --data heldout.jsonl --batch-sizes 1,8 --output calibration-workload
+```
+
+The driver records served round periods and the widest chain's accepted-token counts, then reports the chosen
+width by batch size. Width one verifies only the root and still extends draft KV. Width zero runs native target
+decode without draft forward, verification or prelaunch. Calibration measures it last and keeps affected requests
+OFF until they finish. A mixed batch containing an OFF request stays OFF, so no request resumes with stale draft KV.
+
+Native OFF requires DP1 and disabled Mamba prefix-cache tracking. The generated command disables radix caching.
+It retains the synchronous EAGLE-4 scheduler and the loaded draft model, so it is not guaranteed to match a
+separately started no-spec engine. Compare measured throughput against that engine before deployment. These are
+measured choices for the supplied workload, not a universal no-loss guarantee.
+
+## Match the serving settings
+
+Use `--engine-args` for settings that affect kernel time, such as vLLM's linear backend:
+
+```bash
+eagle-harness calibrate --engine vllm --model "$MODEL" --draft "$DRAFT" --tp "$TP" \
+ --engine-args '{"linear_backend":"flashinfer_cutedsl"}' --output calibration-cutedsl
+```
+
+Keys are engine Python keyword names with underscores. The command refuses overrides of the model, draft,
+TP, process controls or speculative configuration. The same permitted settings go into the generated server
+command. vLLM calibration supports only batch size one through this command.
+
+A successful run writes `settings.json` and `serve.sh` alongside the measurements. Start the measured setup with:
+
+```bash
+sh calibration-workload/serve.sh
+```
+
+Use the output directory from your own run in that command. The server binds to loopback by default.
+Move the generated command to your service configuration before deploying it, and configure authentication
+or a private proxy before exposing the API.
+
+## Read the artifacts
+
+| Path below the output directory | Contents |
+|---|---|
+| `settings.json` | Model identifiers, TP, engine, batch sizes and engine overrides |
+| `raw/width-*.json` | vLLM whole-step timings |
+| `cost/bs_1/model_llm/` | Fitted vLLM target verify costs |
+| `cost/bs_1/model_slm/` | Fitted vLLM draft costs |
+| `config/measure_config.json` | Fit grid and measurement parameters |
+| `raw/sglang_rounds.json` | SGLang served round observations |
+| `rounds/chain.json` | SGLang chain round costs |
+| `accept/chain.json` | SGLang accepted counts per draft position |
+| `*.log` | Engine startup, measurement and fit logs |
+| `serve.sh` | Matching server command, written only after success |
+
+The vLLM sweep takes `context_stop` from the resolved `max_model_len` (including engine overrides),
+records it in each raw file, and fits that same range. The default engine limit remains 4608.
+The limit must be a multiple of the context step, with room for the widest verify after the
+last sample; unsupported grids fail rather than silently measuring a shorter context.
+Raw files without `context_stop` must be regenerated. Context-indexed cost tables log once
+per table when a request exceeds the calibrated range and the last interval is reused.
+
+The core fit and file schema live in `eagle_harness/core/calibration.py` and `cost_table.py`.
+The shared context-indexed cost model selects the nearest calibrated batch size, with ties going to the larger
+size, and clamps context lengths to the measured range. The generated vLLM static-tree command instead uses
+median costs across context intervals for depth stopping. It does not reprice each request by context length.
+Extrapolated workload behavior is not a measurement.
+
+## Retry a failed calibration
+
+The command returns nonzero if a worker fails or expected output is absent. It stops its own process group,
+including TP workers, and keeps partial files for diagnosis. Read the log named in the error. Fix model access,
+unsupported structure or memory settings, then retry with a fresh output directory.
+
+`--timeout` bounds each vLLM subprocess or SGLang startup, in seconds. It does not bound SGLang's request loop.
+A stalled request is subject to the engine driver's request timeout. Ctrl-C stops the CLI-owned server.
+Do not reuse costs across GPUs, TP sizes, model revisions, precision, attention backends or engine builds:
+the server checks the tables' `key.json` (GPU, TP size, model pair, engine version, dtype) and refuses a
+mismatch; the attention backend is not part of the key. Tables are also validated at load: a curve that is not
+finite and positive with an increasing query index is refused with its directory, and the cost-model modes
+refuse a target / draft cost ratio outside 5..100 or a verify cost at 8 tokens below 0.85x the cost at 1 token
+(0.7x for MoE targets).
+
+## Chain widths
+
+vLLM's chain loop verifies a fixed number of drafts per batch size, so the width of a chain is chosen once per batch
+size at startup (`eagle_harness/core/chain_width.py`). A round of width `w` gains `1 + a_1 + ... + a_{w-1}` tokens per
+request, where `a_d` is the share of rounds that accept the first `d` drafted tokens, and takes `V(B, w) + (w - 1) D(B)`:
+the target's verify forward of `w` tokens per request and `w - 1` draft steps at batch size `B`, from the cost tables
+(median over the context intervals). The width with the most tokens per unit of time wins. Width `1` verifies
+only the root and can still run draft KV extension. Width `0` means native in-engine decode with no draft
+forward or draft KV update. It requires separate measured round times and adapter support.
+On a vLLM host exposing `SpeculativeConfig.native_decode_batch_sizes`, automatic chains pass
+selected width-0 ranges separately from the draft-count schedule. The host stops draft work,
+drains pending verification and uses native target metadata and graphs. Suspension lasts until
+request finish and spreads to requests merged into the same batch, because resuming would require
+draft KV catch-up. Fresh requests can speculate after those requests finish.
+This requires synchronous Model Runner V2 with prefix caching and KV transfer disabled, and eager
+execution or full decode graphs. Trees and unsupported host configurations refuse native OFF.
+Older hosts still reject a selected width 0. Width 1 and explicit K=0 schedules keep their
+root-only speculative semantics. Draft weights and KV reservations stay allocated, so width-0
+round times must be measured with the plugin installed rather than copied from a separate no-spec engine.
+The separate startup comparison is in `tools/serving_choice.py`, outside the runtime policy.
+Small batches read weights, so the widest chain wins there; large batches compute, and the width narrows.
+
+The `a_d` come from `<data_path>/accept/chain.json`:
+
+```json
+{"drafts": 41234, "accepted_per_position": [36610, 32012, 27740]}
+```
+
+These are vLLM's `spec_decode_num_drafts` and `spec_decode_num_accepted_tokens_per_pos` counters after serving the
+workload with the widest chain. Acceptance depends on the workload (short answers accept differently from long
+ones), not on the batch size, so measure it on the requests you serve. Widths past the measured positions are not
+considered. Without the file, or without timings that price a chain at every calibrated batch size, chains verify
+`max_verify_width` tokens at every batch size.
+
+### Served round costs
+
+Use served round costs when isolated forward timings do not predict throughput. Put the measured periods in
+`<data_path>/rounds/chain.json`:
+
+```json
+{"rounds": [{"batch_size": 64, "width": 1, "round_us": 10000, "count": 120},
+ {"batch_size": 64, "width": 4, "round_us": 22000, "count": 120}]}
+```
+
+Each period covers a whole decode round, including scheduling, sampling and drafting. These measurements replace
+`V(B, w) + (w - 1) D(B)` in the chain policy. The acceptance profile is still required. Measure width 1 at every
+batch size so the policy can choose no drafts when wider chains lose. Keep the engine settings and the maximum
+speculative-state reservation identical across widths, warm the full workload, and exclude prefill and batch changes.
+
+Width 1 disables proposals within the speculative engine. It does not unload the draft, release its KV cache or
+remove the target's speculative-state reservation. Compare throughput against a separate no-spec engine at the
+concurrency you serve. A zero-draft schedule does not establish the same cost as native no-speculation decoding.
+
+The shared chain policy uses accepted-prefix counts and measured round costs to choose tokens per second,
+not the largest acceptance length. Without a complete matching profile, do not assume the runtime has selected
+an optimal width. The configuration reference describes [chain scheduling](configuration.md#engine-arguments).
+
+## GEMM solutions (SGLang, ROCm)
+
+The BLAS library's default heuristic can pick a slow kernel for the skinny GEMMs of a decode round.
+PyTorch's TunableOp times solutions for each GEMM shape offline. EAGLE-4 serves the saved picks from
+`<data_path>/gemm_solutions.csv` with GEMM tuning disabled, so server starts reuse the recorded choices.
+Every rank uses the same saved kernels.
+
+1. Record the serving shapes once: start the server with `PYTORCH_TUNABLEOP_ENABLED=1 PYTORCH_TUNABLEOP_TUNING=0
+ PYTORCH_TUNABLEOP_RECORD_UNTUNED=1 PYTORCH_TUNABLEOP_UNTUNED_FILENAME=/tmp/untuned.csv` and run a short
+ workload (`tools/greedy_parity.py run` at the serving concurrency). TunableOp writes `/tmp/untuned0.csv`
+ (one file per rank).
+2. `python tools/tune_gemm_solutions.py --data-path "$DATA" --untuned /tmp/untuned0.csv` tunes the decode-round
+ shapes (at most `--max-rows` rows, default 64; prefill shapes keep the default solution) with inputs rotated
+ through a 1 GB buffer so weights stream from HBM as they do in serving, and writes the file.
+ For a larger serving batch, use `--decode-rows 1-8 4 8,16,32` instead of `--max-rows` to select only
+ row counts for batches 1 through 8, draft top-k 4, and verify widths 8, 16, and 32. This avoids tuning
+ unrelated prefill lengths from the same recording. It does not invent shapes absent from the recording.
+
+The file carries the PyTorch, ROCm, hipBLASLt/rocBLAS and GPU identity it was tuned on; on any other stack the
+runtime logs a warning and keeps the default kernels. Tuned picks are not bit-identical to the default ones
+(another accumulation order), so re-run the greedy parity check after tuning.
diff --git a/docs/compatibility.md b/docs/compatibility.md
new file mode 100644
index 0000000..7197879
--- /dev/null
+++ b/docs/compatibility.md
@@ -0,0 +1,80 @@
+---
+type: reference
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# Compatibility and versioning
+
+An engine must provide every hook the plugin uses. A version number alone does not prove compatibility.
+Use the exact release pins in [release settings](release.env), then run the checks in
+[installation](install.md). Hook ranges below describe admission, not a promise that stock upstream
+packages include the hooks or that every configuration in the range has been measured.
+
+## Engine and runtime selection
+
+| Component | Hook admission range or requirement | Release setting or recipe |
+|---|---|---|
+| SGLang CUDA | `>=0.5.23.dev0,<0.6` with hooks | `EAGLE_SGLANG_VERSION` in release settings |
+| SGLang ROCm | SGLang hooks plus the ROCm verification integration | `EAGLE_ROCM_VERSION`, [AMD recipe](quickstart-amd.md) |
+| vLLM | `>=0.32.0rc1.dev283,!=0.32.0` with hooks and Model Runner V2 | `EAGLE_VLLM_VERSION` |
+| TokenSpeed, experimental | `>=0.1.1,<0.2` with hooks and matching native packages | `EAGLE_TOKENSPEED_VERSION` and `EAGLE_TOKENSPEED_AUX_REQUIREMENTS` |
+| FlashInfer, CUDA SGLang | `>=0.7.2` | CUDA installation, not ROCm |
+| Python | Package metadata allows 3.10 and newer | Release recipes use 3.12 |
+| PyTorch and GPU runtime | Match the engine's dependency closure | [CUDA and ROCm requirements](install.md#requirements) |
+| GPU and model pair | Configuration-specific qualification | [Support matrix](support-matrix.md) |
+
+The release index carries patched engines with local version labels. Install those exact versions rather
+than assuming that the extras resolve to a compatible stock engine. TokenSpeed's scheduler and kernel
+packages must come from the same release source as its runtime package.
+
+The pinned vLLM build includes KV cache group sizing, a decode GEMM used with
+`--linear-backend flashinfer_cutedsl`, and native target decoding for configured batch sizes.
+Native target decoding stays off unless `native_decode_batch_sizes` is set.
+
+The same ranges are in two places that a test keeps equal: the `sglang`, `vllm` and `tokenspeed` extras in
+`pyproject.toml` and `HOSTS` in `eagle_harness/compat.py`.
+
+## What happens at load time
+
+Each engine process loads the plugin and checks the hooks:
+
+| situation | result |
+|---|---|
+| every hook matches, version in range | the method registers |
+| every hook matches, version outside the range | the method registers, and a warning says the pair is untested |
+| a hook is missing or its parameters changed | nothing registers, one error names each mismatch and the fix, the engine runs without the method |
+| hardware outside the kernel tiers | the server refuses `EAGLE_HARNESS` at startup with the reason |
+
+The plugin never raises during loading, so installing eagle-harness cannot break an engine install. Run
+`eagle-harness-check` to see the same verdict without starting a server ([Troubleshooting](troubleshooting.md)).
+
+## Structured output on vLLM
+
+Tree-mode batches containing JSON, regex, or forced-tool grammar requests emit only the root token of each verify
+round. vLLM supplies grammar masks for a linear draft sequence, which are not valid for the different ancestry of a
+tree node. EAGLE-4 rejects all non-root candidates in these batches rather than accept a token under the wrong
+mask. This also disables multi-token acceptance for unconstrained requests sharing that batch. Chain mode continues
+to use vLLM's own rejection sampler.
+
+This is a correctness fallback, not accelerated tree-constrained decoding. Tree acceleration for these requests
+requires the host to supply grammar masks for each node's actual ancestry. A token limit can still truncate a valid
+JSON prefix; clients must check the finish reason and validate the completed response against their schema.
+
+## Model-specific hooks
+
+For Mamba2 / NemotronH targets, tree verification also requires `Mamba2SpecRows` and the Mamba2 metadata and mixer
+integration of `LinearAttnVerifyExtension`. The model initialization refuses tree mode if that integration is absent.
+
+Nemotron latent-MoE drafts require `SharedExperts.disable_aux_stream()`. The draft disables its shared expert's
+auxiliary stream before graph capture because conditional graph bodies cannot join that stream. Other layers retain
+their stream settings. These model-specific checks run when the model is constructed, after general plugin checks.
+
+## Versioning
+
+eagle-harness versions follow `MAJOR.MINOR.PATCH`. Releases are cut from Conventional Commits: before 1.0, a `feat`
+commit or a breaking change raises the minor version and a `fix` or `perf` commit the patch version. Each release's
+`CHANGELOG.md` entry lists them.
+
+Pin the exact engine build in [release settings](release.env). The patched wheels use the release index,
+not the upstream PyPI projects. Unpinned resolution can select a different build without the required hooks.
diff --git a/docs/configuration.md b/docs/configuration.md
new file mode 100644
index 0000000..9e6318b
--- /dev/null
+++ b/docs/configuration.md
@@ -0,0 +1,145 @@
+# Configuration reference
+
+The method takes one JSON object. On sglang it goes in `--speculative-algorithm-config`, inline or as a path to a
+JSON file. On vLLM it goes in the `method_config` of `--speculative-config`. On TokenSpeed it goes in
+`--speculative-algorithm-config` (inline JSON). The adapters share the core configuration parser and add
+engine-specific keys and restrictions described below. Unknown keys are
+rejected with the list of valid keys, so a typo cannot fall back to a default silently.
+
+Source of truth: `eagle_harness/core/config.py` (`HarnessConfig` and its parts), `eagle_harness/vllm/config.py`
+(the vLLM-only keys) and `eagle_harness/tokenspeed/config.py` (what TokenSpeed accepts).
+For legacy environment variables and CLI flags, see [Migration](migration.md).
+
+## Top-level keys
+
+| key | type | default | meaning |
+|---|---|---|---|
+| `mode` | string | `"serve"` | `serve`: the cost model sizes every round. `eval`: cost sizing with evaluation settings (see the inactive-policy note below). `calibrate`: reserved for cost measurement (see [Calibration](calibration.md)). `static`: the fixed tree of the shape flags every round, no cost model (on SGLang the same EAGLE-4 round, graphs and kernels as the cost-model modes). |
+| `data_path` | string | none | Offline calibration directory whose `cost/` subdirectory holds the cost tables and whose `key.json` names the setup they were measured on (GPU, TP size, model pair, engine, dtype); a directory keyed for another setup is refused. Without it, the cost-model modes measure the costs on the served rounds ([Calibration](calibration.md#costs-measured-on-the-served-rounds)). |
+| `cost_cache` | string | `~/.cache/eagle-harness/costs` | Directory of the live-cost cache files (one per setup key). |
+| `intensity` | string | `"high_intensity"` | Draft shape family of the cost tables: `high_intensity`, `low_intensity` (trees) or `chain_intensity` (one candidate per step). It sets the batch limit and the verify widths that get a CUDA graph. |
+| `draft_family` | string | `"eagle4"` | `eagle4`. Sets the cost model's depth loss when `cost_model.depth_loss_ratio` is not given. |
+| `cost_model` | object | see below | Cost model constants. |
+| `ragged` | object | see below | Per-request verify budgets (eval mode with `chain_intensity` only). |
+| `draft_model` | object | see below | EAGLE-4 draft model options. |
+| `l2_warm` | object | see below | L2 prefetches of target weights inside the sglang verify graphs. |
+
+## `cost_model`
+
+Dimensionless constants of the cost model's stopping rules. The defaults are the values the cost tables were fitted
+with. Change them only together with a measurement.
+
+| key | type | default | meaning |
+|---|---|---|---|
+| `threshold` | number | `2.5` | Gain per unit cost a tree level must reach to be drafted. Higher stops trees earlier. |
+| `async_layer_ratio` | number | `0.9` | Factor on a level's gain per unit cost before it is compared with the bar. |
+| `depth_loss_ratio` | number or `null` | `null` | Raises the bar by this fraction per depth level. `null` derives it: `0.04` for `eagle4`, doubled for MoE targets (chains keep the base value). |
+| `chain_tiny`, `chain_small`, `chain_medium`, `chain_large` | 3 numbers | `[2.60, 0.24, 0.00]`, `[2.85, 0.24, 0.00]`, `[2.54, 0.24, 0.70]`, `[1.55, 0.24, 0.00]` | Per chain size class: threshold, depth loss, cost power. |
+| `chain_scale_tiny`, `chain_scale_small`, `chain_scale_medium` | number | `1.25`, `1.45`, `2.00` | Bounds on the target's verify cost ratio that separate the chain size classes. |
+| `chain_tiny_max_bs` | integer | `2` | Largest batch size of the tiny chain class. |
+| `ragged_draft_relax` | 3 numbers | `[0.75, 0.75, 0.75]` | Draft threshold relaxation per size class when ragged budgets are on. |
+| `ragged_verify_threshold` | 3 numbers | `[1.35, 1.60, 1.40]` | Verify threshold per size class when ragged budgets are on. |
+
+## `ragged`
+
+| key | type | default | meaning |
+|---|---|---|---|
+| `enabled` | boolean | `true` | Per-request verify budgets. Applies only in `eval` mode with `chain_intensity` and an engine path that supports ragged attention. |
+| `force_uniform` | boolean | `false` | Test aid: every request verifies the whole chain. |
+
+The bundled adapters do not activate the ragged-budget policy or the evaluation-tail stopping rule. They also do not
+call the core model's adaptive chain-depth policy (`cost_model.chain_*`); vLLM's served-chain widths instead use the
+measured costs and acceptance profile described below. These keys remain accepted for configuration compatibility.
+
+## `draft_model`
+
+| key | type | default | meaning |
+|---|---|---|---|
+| `moe_gate_acc` | string | `"fp32"` | Router GEMM accumulation of a SwiGLU-MoE draft: `fp32` or `bf16`. The latent MoE's router is sglang's `NemotronHMoE`, which ignores it. |
+| `cuda_candidate_kernels` | boolean | `true` | Use the native CUDA candidate kernels where the GPU supports them. With `false` the Triton kernels run (same results). |
+| `embed_full` | boolean | `true` | Keep the full draft embedding table on every rank, so a draft step looks tokens up without an all-reduce. |
+| `embed_triton` | boolean | `true` | Look draft embeddings up with sglang's Triton kernel (needs the full table on the rank). |
+
+The supported latent-MoE draft uses the host engine's expert implementation. Its router ignores `moe_gate_acc`.
+
+## `l2_warm` (sglang)
+
+Each entry is `[share, ctas]`: prefetch the last `share` (0 to 1) of a weight's bytes into L2 with `ctas` thread
+blocks on a side stream, or `null` for off. The prefetches only read memory, so results do not change.
+
+| key | default | what is warmed, and when |
+|---|---|---|
+| `gate_up_gdn` | `[0.42, 16]` | the MLP gate/up weight, after a GDN layer's input projection |
+| `gate_up_attention` | `[0.3, 74]` | the MLP gate/up weight, after an attention layer's QKV projection |
+| `down_proj` | `null` | the MLP down weight, after the mixer's output projection |
+| `next_input` | `null` | the next layer's input projection, after the MLP's down projection |
+
+## Engine arguments
+
+sglang reads the largest tree shape from its own server arguments, and all three are required:
+
+| sglang argument | meaning |
+|---|---|
+| `--speculative-num-steps` | maximum draft depth |
+| `--speculative-eagle-topk` | frontier nodes expanded per step (at most 8) |
+| `--speculative-num-draft-tokens` | maximum verify width, root included |
+
+In the cost-model modes each round's depth and width are chosen within that shape.
+
+vLLM takes these extra keys in `method_config`:
+
+| key | type | default | meaning |
+|---|---|---|---|
+| `max_verify_width` | integer | `32` (trees), `16` (chains) | Largest verify width, root included. vLLM's `num_speculative_tokens` is the widest verify the batch-size schedule runs minus one (this minus one without a schedule): vLLM keeps that many extra linear-attention state slots per request. Set only one of the two. |
+| `node_top_k` | integer | `8` (trees), `1` (chains) | Frontier nodes expanded per draft step. `1` uses vLLM's own EAGLE chain loop. |
+| `tree_depth` | integer | `12` (trees), `15` (chains) | Maximum draft depth. It sizes the draft's KV lookahead. |
+| `depth_stop_gain` | `"derived"`, number or `null` | `"derived"` | What one more draft step must add to the expected accepted length. `"derived"`: the step's measured cost from the cost tables under `data_path`, or a startup error in automatic serving when a scheduled shape is unpriced. Static mode retains a lossless stop. A number sets a fixed gain. `0` stops only when no deeper node can enter the verify set. `null` always drafts `tree_depth` steps. |
+
+In `serve` and `eval` mode vLLM fixes the verify width per batch size (`num_speculative_tokens_per_batch_size`).
+Automatic trees require cost tables for every scheduled shape; set `depth_stop_gain` explicitly to opt out.
+Automatic chains require timings and an acceptance profile; an explicit `max_verify_width` or batch schedule opts into unpriced operation.
+Trees get the widest graph width of their cost buckets. A chain (`node_top_k` 1) verifies exactly its width, so the
+width of each batch size is derived from the cost tables and the chain acceptance profile under `data_path`
+(`<data_path>/accept/chain.json`): the width with the most expected tokens per unit of time, `1` (no speculation) when
+no chain pays. Without a profile startup fails, unless `max_verify_width` or a batch schedule is explicitly supplied. See
+[calibration](calibration.md#chain-widths).
+
+Chains on vLLM: leave the target on vLLM's default attention backend and give only the draft FlashAttention,
+`"attention_backend": "FLASH_ATTN"` next to `"method"` in `--speculative-config`. FlashInfer cannot serve the
+multi-head EAGLE-4 draft on the 128-token pages a hybrid target needs, and `--attention-backend FLASH_ATTN` moves the
+whole target off FlashInfer. Keep the target backend unchanged for a matched speculation comparison.
+
+TokenSpeed is experimental. It takes the draft shape from its server arguments. `"mode": "static"` is the default and uses every configured
+draft step. `"mode": "serve"` uses calibrated GPU-side decisions to stop drafting and select meaningful verify nodes.
+Tree modes keep one physical verify width per server. Serve-mode trees pad unused nodes with unconnected roots.
+Pass `--sampling-backend greedy` because the default FlashInfer sampler cannot verify draft trees.
+
+For calibrated tree serving, provide `data_path` containing the calibration `cost/` directory.
+The README example uses a running cap of 32, not a general performance recommendation.
+The calibration must match the target, draft, hardware, tensor-parallel setup and recurrent-state dtype.
+`eval`, `calibrate` and live costs are not supported by this adapter. Chains use top-k 1 and `chain_intensity`.
+An explicit `chain_width_table` contains increasing `[minimum_batch_size, verify_width]` pairs in `serve` mode.
+A complete schedule starting at batch size 1 does not need cost files. This describes the configuration interface,
+not a measured high-concurrency speed claim. Sampled-tree distribution quality is unqualified.
+
+| TokenSpeed argument | Meaning |
+|---|---|
+| `--speculative-num-steps` | Maximum draft depth, subject to the installed engine's shape checks |
+| `--speculative-eagle-topk` | Frontier nodes expanded per step, 1 for a chain |
+| `--speculative-num-draft-tokens` | Physical verify width, root included, large enough for the selected top-k |
+
+The lane window `(steps - 1) * topk` must fit in 64 slots. Its KV reservation is independent of the verify width,
+so depth 12, top-k 4 and verify width 16 are supported in serve mode.
+
+## Shape limits
+
+From `eagle_harness/core/limits.py`. A shape outside them is refused at startup with the reason.
+SGLang and vLLM share the tree batch limit. SGLang retains its memory-conservative default of 32 tree requests
+(48 for chains) when `max_running_requests` is omitted. Explicit larger limits are admitted.
+
+| limit | trees | chains |
+|---|---|---|
+| running requests | 512 | 512 |
+| draft depth | 31 | 15 |
+| verify width | 64 | 16 |
+| frontier nodes per step | 8 | 1 |
diff --git a/docs/faq.md b/docs/faq.md
new file mode 100644
index 0000000..8ac56b6
--- /dev/null
+++ b/docs/faq.md
@@ -0,0 +1,85 @@
+# FAQ
+
+## Does speculative decoding change the output?
+
+Greedy verification commits the target model's argmax at each accepted position. Different verification shapes can
+change target arithmetic, so this does not establish exact equality to a no-spec server. Some measured model pairs
+have unexplained divergences beyond the near-tie threshold. Check the [support matrix](support-matrix.md) rather
+than treating loading or native-engine equivalence as a no-spec parity guarantee.
+
+## How does EAGLE-4 choose a draft tree shape?
+
+The engines' built-in EAGLE methods verify a draft tree of fixed shape every step. eagle-harness sizes the tree each
+round from measured costs: on sglang the cost model picks the draft depth and the verify width per round, and on vLLM
+the draft depth stops as soon as more steps cannot pay. It also brings the EAGLE-4 draft model (sliding-window draft
+layer, low-rank candidate head) and tree versions of the GDN kernels for hybrid targets.
+
+## Which engine should I use?
+
+Choose an engine with measured coverage for your model pair and request features in the
+[support matrix](support-matrix.md). SGLang picks the verify width per round. vLLM fixes that width per batch size,
+so only the draft depth adapts per round.
+
+## Do I need cost tables?
+
+SGLang measures costs on the served rounds when no `data_path` is supplied. Offline tables remain an option.
+vLLM static trees need no tables, while automatic policies require matching measured costs. Experimental
+TokenSpeed needs offline costs for calibrated decisions, or a complete explicit chain schedule.
+See [calibration](calibration.md).
+
+## Does it patch sglang or vLLM?
+
+No. It registers through the engines' plugin entry points and uses hooks the engine exposes. An engine without those
+hooks keeps working: the plugin logs why and registers nothing.
+
+## Which models work?
+
+Targets need the engine's EAGLE-style auxiliary hidden states. Single-layer EAGLE-4 drafts use the low-rank
+candidate head (`efficient_lm_head_config`).
+Qwen3.8-27B has EAGLE-4 coverage. On sglang the draft may also use the latent ReLU^2 MoE, `attn_norm` and no rotary
+positions, as in Nemotron 3.5 Super drafts. vLLM also implements those structures. Model-specific correctness
+coverage is separate from admission and is listed in the support matrix. Multi-layer drafts are not supported.
+
+## Does it support batch sizes above 1?
+
+Configuration limits are not serving qualifications. Trees and chains (`chain_intensity`) admit up to 512 running requests. The engine's KV and recurrent-state
+capacity can impose a lower limit. The sglang tree default is 32 requests. Set `--max-running-requests` explicitly
+to raise it. vLLM uses `--max-num-seqs`.
+
+A larger request cap does not guarantee higher throughput. Wider trees reserve more recurrent-state snapshots
+and verify more tokens per round. Compare your tree shape against no speculation at the intended concurrency,
+and calibrate the full batch-size range instead of treating a small-batch cost table as a large-batch measurement.
+The fused accept step and tree-tail mask attention cover batch size 1 only. Other batch sizes use the engine's
+own code for those parts.
+
+## Does it support sampling, logprobs or images?
+
+SGLang and vLLM support sampled requests with the engine-specific restrictions below.
+`tools/sampling_check.py` compares a speculative server with a no-spec server. Sampling smoke tests alone
+do not establish distribution equivalence for every model and workload.
+
+- vLLM: a seeded request decodes the same text as without speculation, up to the logits' numerics. vLLM itself
+ refuses min-p and logit bias with any speculative method. A batch with
+ repetition, frequency or presence penalties, bad words, a thinking budget or a custom logits processor is
+ verified as chains. That is exact but accepts fewer tokens.
+- sglang: sampled requests go through sglang's own tree speculative sampling. min-p, and top-k together with top-p,
+ need an sglang build with the verify filter fix: older builds ignore min-p in verify and cut top-p after top-k.
+ Penalties use sglang's relaxed form (counts of committed tokens only), as in sglang's own EAGLE, so they are not
+ exact. Seeds need `--enable-deterministic-inference`.
+
+Logprobs are supported on SGLang and vLLM. Each request gets the logprobs of its accepted tokens. SGLang
+input logprobs come from its prefill. Use the matching engine with the FlashInfer verify-wrapper graph fix.
+TokenSpeed is experimental and refuses prompt logprobs.
+
+Requests with images are refused with a reason on sglang.
+
+## Which GPUs work?
+
+NVIDIA from sm_80 (A100) and AMD CDNA2 to CDNA4 through the Triton kernels, with faster native and Gluon kernels on
+newer NVIDIA GPUs. Serving measurements cover B300 and SGLang on MI355X. Other architectures have compilation
+coverage, not serving qualification. See [kernels](kernels.md).
+
+## How do I cite it?
+
+Cite the EAGLE-4 paper. `CITATION.cff` at the repository root has the entry, and GitHub shows it under "Cite this
+repository".
diff --git a/docs/install.md b/docs/install.md
new file mode 100644
index 0000000..9ca25a5
--- /dev/null
+++ b/docs/install.md
@@ -0,0 +1,162 @@
+---
+type: how-to
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# Install eagle-harness 0.1.0
+
+Install one patched engine per environment, then install `eagle-harness==0.1.0` from PyPI.
+Stock engine packages do not provide the required plugin hooks. Choose the pip or Docker path below,
+then follow that engine's quickstart.
+
+## Release locations and availability
+
+[Release settings](release.env) is the single source for package pins, wheel indexes and container tags.
+The engine wheels belong to the GitHub release named by `EAGLE_RELEASE_ASSETS`. Its PEP 503 indexes
+separate CUDA and ROCm wheels. `eagle-harness` is a separate PyPI package.
+
+These are release destinations, not evidence that publication has completed. Before distribution,
+the release owner must publish the wheels, indexes and images and qualify a clean installation.
+The recipes have not been clean-installed or container-built as part of this documentation check.
+Do not replace an unavailable artifact with the stock engine or an unpinned package.
+
+Use the release checkout containing these docs. Run commands from its root:
+
+```bash
+. ./docs/release.env
+```
+
+## Requirements
+
+- Linux x86-64. Use Python 3.12 for CUDA engines and Python 3.10 for the ROCm wheel.
+- NVIDIA wheels target CUDA 13.0 and require a compatible host driver. The serving recipes use B300 GPUs.
+ Runtime compilation also needs a CUDA toolkit compatible with the host C/C++ headers.
+ On the tested Ubuntu 26.04 / glibc 2.43 host, CUDA 13.0 `nvcc` fails with `rsqrt`/`rsqrtf`
+ exception-specification errors. Use `export CUDA_HOME=/usr/local/cuda-13.2` for that host's JIT
+ compilation, or use the release container's compatible toolchain. This does not change the wheel index.
+- SGLang ROCm requires the measured ROCm 7.2 runtime on MI355X, including compatible PyTorch, Triton,
+ AITER and FlyDSL. The measured PyTorch build is `2.9.1+rocm7.2.0.lw.git7e1940d4`.
+ A CUDA PyTorch wheel is not a replacement. Use the complete ROCm runtime image rather than mixing
+ arbitrary PyPI dependencies into it.
+- Docker needs NVIDIA GPU access for CUDA, or `/dev/kfd` and `/dev/dri` access for ROCm.
+- Obtain readable target and compatible draft weights before serving. The quickstarts use
+ Qwen3.8-27B BF16 and its EAGLE-4 draft. Check the [support matrix](support-matrix.md) for other pairs.
+
+## SGLang CUDA
+
+Create a Python 3.12 environment and install the pinned CUDA engine:
+
+```bash
+python3.12 -m venv .venv-sglang
+source .venv-sglang/bin/activate
+python -m pip install --upgrade pip
+python -m pip install --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" "sglang==$EAGLE_SGLANG_VERSION" 'flashinfer-python>=0.7.2'
+python -m pip install "eagle-harness==$EAGLE_VERSION"
+eagle-harness-check
+```
+
+For Docker, open the release image and check the hooks:
+
+```bash
+docker run --rm --gpus all --ipc host -it \
+ -p 127.0.0.1:30000:30000 -v "$PWD/models:/models:ro" \
+ --entrypoint bash "$EAGLE_SGLANG_IMAGE"
+eagle-harness-check
+```
+
+Inside the container, use `/models` paths and `--host 0.0.0.0` in the
+[SGLang CUDA quickstart](quickstart-sglang.md). The host port stays bound to loopback.
+
+## SGLang ROCm on AMD
+
+The fresh-install path is under qualification and deferred to a follow-up guide. No pip or Docker
+installation command is qualified here. The ROCm wheel requires Python 3.10 (`cp310`), not Python 3.12,
+and a complete compatible ROCm 7.2 runtime. A successful import or `eagle-harness-check` alone does not
+qualify the dependency closure for serving.
+
+The [AMD quickstart](quickstart-amd.md) records the measured serving recipe for an already-qualified
+MI355X environment. Do not use that recipe to assemble a fresh runtime or install CUDA FlashInfer
+packages into a ROCm environment.
+
+## vLLM CUDA
+
+Use a separate environment:
+
+```bash
+python3.12 -m venv .venv-vllm
+source .venv-vllm/bin/activate
+python -m pip install --upgrade pip
+python -m pip install --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" "vllm==$EAGLE_VLLM_VERSION"
+python -m pip install "eagle-harness==$EAGLE_VERSION"
+eagle-harness-check
+```
+
+For Docker, mount a writable directory for the calibration output:
+
+```bash
+mkdir -p calibration
+docker run --rm --gpus all --ipc host -it \
+ -p 127.0.0.1:8000:8000 -v "$PWD/models:/models:ro" \
+ -v "$PWD/calibration:/calibration" --entrypoint bash "$EAGLE_VLLM_IMAGE"
+eagle-harness-check
+```
+
+Follow the [vLLM quickstart](quickstart-vllm.md). Inside the container, use `/models` paths,
+place calibration output under `/calibration`, and bind the server to `0.0.0.0`.
+
+## TokenSpeed CUDA, experimental
+
+TokenSpeed requires the matching engine, scheduler and kernel wheels pinned in `release.env`.
+Install all three from the CUDA release index. Stock scheduler and kernel wheels are not substitutes.
+Keep an nvcc-equipped CUDA 13.0 toolkit available: tree-round CUDA sources compile at first use even
+though the runtime wheel itself has a `py3-none-any` tag. The scheduler and kernel wheels contain native code:
+
+```bash
+python3.12 -m venv .venv-tokenspeed
+source .venv-tokenspeed/bin/activate
+python -m pip install --upgrade pip
+: "${EAGLE_TOKENSPEED_AUX_REQUIREMENTS:?release native-wheel pins are required}"
+# Intentional word splitting: this variable contains pinned package requirements.
+python -m pip install --extra-index-url "$EAGLE_CUDA_INDEX" \
+ --extra-index-url "$EAGLE_TORCH_CUDA_INDEX" \
+ "tokenspeed==$EAGLE_TOKENSPEED_VERSION" $EAGLE_TOKENSPEED_AUX_REQUIREMENTS
+python -m pip install "eagle-harness==$EAGLE_VERSION"
+eagle-harness-check
+```
+
+For Docker, use the complete experimental runtime image:
+
+```bash
+docker run --rm --gpus all --ipc host -it \
+ -p 127.0.0.1:30000:30000 -v "$PWD/models:/models:ro" \
+ --entrypoint bash "$EAGLE_TOKENSPEED_IMAGE"
+eagle-harness-check
+```
+
+Follow the [TokenSpeed quickstart](quickstart-tokenspeed.md). Inside the container, use `/models` paths
+and bind to `0.0.0.0`. This path is NVIDIA-only, not a ROCm recipe.
+
+## Check the installation
+
+`eagle-harness-check` must exit zero and report the installed engine's hook checks. A failure means the
+engine does not provide the expected contract. Fix that before loading weights. This check does not
+prove GPU kernels work or generation is correct. The quickstart's generated response is a separate check.
+
+For the SGLang and vLLM calibration CLI, also run:
+
+```bash
+eagle-harness calibrate --help
+```
+
+Do not install multiple engines in one environment. Use only the trusted release indexes above.
+The [troubleshooting guide](troubleshooting.md) covers hook failures and startup errors.
+
+## Dockerfile sketches
+
+The files under `docker/` document how to layer the release wheels and this source checkout onto
+engine runtimes. They are not qualified image builds. The ROCm and TokenSpeed sketches require an
+explicit compatible `BASE_IMAGE`; do not infer a tested base from a successful syntax check.
+The release tags above are the user-facing Docker path. Building or publishing them is a separate release step.
diff --git a/docs/kernels.md b/docs/kernels.md
new file mode 100644
index 0000000..465794a
--- /dev/null
+++ b/docs/kernels.md
@@ -0,0 +1,92 @@
+# Kernels
+
+Every kernel of the tree round has a Triton version, so the package runs on any GPU the Triton tier covers. Faster
+versions (a native CUDA library and a Gluon kernel) run only where the hardware has the feature and fall back to the
+Triton kernel otherwise, with the same results. `eagle_harness/kernels/arch.py` is the one place that reads a GPU's
+architecture and answers which version may run.
+
+To see what your GPUs get:
+
+```bash
+python -m eagle_harness.kernels.arch
+```
+
+## Hardware tiers
+
+| tier | hardware | what runs |
+|---|---|---|
+| Triton | NVIDIA sm_80 and newer (A100, H100, H200, B200, B300, sm_120), AMD CDNA2, CDNA3 and CDNA4 (gfx90a, gfx942, gfx950) | every kernel |
+| native CUDA library | NVIDIA only: the candidate tail from sm_80, the cluster shard top-k from sm_90 | the candidate head |
+| programmatic dependent launch | NVIDIA sm_90 and newer | launch overlap between dependent kernels |
+| Gluon GDN tree verify | NVIDIA sm_103 (B300) | the GDN tree recurrence at one request |
+
+On a GPU outside these tiers, or without an importable Triton, the server refuses `EAGLE_HARNESS` at startup with the
+reason, for example `... is older than NVIDIA sm_80 (A100)`.
+
+Runtime tests run on B300. The other architectures are compile-checked: nvcc builds the native library for each of
+them and Triton cross-compiles the kernels for each target.
+
+## The kernels
+
+| kernel | module | when it runs |
+|---|---|---|
+| candidate head: shard top-k, exact re-scoring of candidates (fp32 products), candidate tail | `candidate_ops`, `gather_dot`, `candidate_triton`, `csrc/candidate.cu` | every draft step and draft extend |
+| draft tree step: scores, next frontier, ancestors, the cost model's work deltas | `tree_step` | every draft step |
+| draft row attention: each row's sliding window plus its own tree ancestors, split over the keys (the split count follows the SM count and the draft heads per rank, fixed per server) | `sglang/row_attention.py`, `vllm/draft_attention.py` | every draft step and draft extend |
+| GDN tree verify: ancestor tables, tree causal conv1d, tree gated delta rule recurrence | `gdn_tree`, `gdn_tree_gluon` | every verify of a hybrid (GDN) target |
+| Mamba2 tree verify: ancestor tables, tree causal conv1d | `gdn_tree`, `gdn_tree_conv` | every verify of a Mamba2 hybrid (NemotronH) target on sglang |
+| tree verify attention, split over the committed context | `vllm/verify_attention.py` | every verify on vLLM |
+| tree-tail mask attention variant of FlashInfer's prefill | `sglang/tail_mask.py`, `verify_prep` | batch-size-1 verify graphs on sglang |
+| accept tail: tree walk, accept lengths, bonus token, KV slots, compaction | `accept_tail` | greedy batch-size-1 rounds on sglang |
+| L2 prefetch of a weight range | `l2_prefetch` | inside the sglang verify graphs (`l2_warm` config) |
+
+## Native CUDA library
+
+The candidate head has a native CUDA version (`eagle_harness/kernels/csrc/candidate.cu`), bit-identical to its Triton
+version. It has a plain C ABI over raw pointers and links the CUDA runtime statically, so one binary per CUDA major
+version serves every Python and torch version. It loads from the first of:
+
+1. the file named by `$EAGLE_HARNESS_NATIVE_LIB`,
+2. the prebuilt binary in the wheel (`_native/cu12/` or `_native/cu13/`, matching torch's CUDA major version),
+3. an nvcc build for the visible GPUs, cached in `$EAGLE_HARNESS_CACHE` (default `~/.cache/eagle_harness`),
+4. none: the Triton kernels run and a warning says why.
+
+The prebuilt binaries hold SASS for sm_80, sm_90, sm_100, sm_103 and sm_120 plus sm_90 PTX for newer GPUs, and need
+glibc 2.34 or newer. `draft_model.cuda_candidate_kernels: false` turns the library off. `eagle-harness-check
+--kernels` loads it on the visible GPU and says where it came from.
+
+To build or check the library yourself:
+
+```bash
+python -m eagle_harness.kernels.build prebuild --cuda-home /usr/local/cuda-13.0 # into the package
+python -m eagle_harness.kernels.build check # one compile per architecture
+```
+
+## GDN tree verify
+
+Hybrid targets such as Qwen3.8 interleave full-attention layers with gated delta net (GDN) layers. A tree verify of a
+GDN layer runs the width-4 causal conv1d and the gated delta rule recurrence per tree node, each node continuing from
+its parent's state. The kernels derive the tree once per verify forward (parent table, the conv window ancestors of
+each node) instead of following tree links in every layer. Conv outputs, conv windows and the parent table are
+bit-identical to the engine's own tree kernels. The recurrence computes the same math, and its state snapshots can
+differ in the last bit.
+
+The recurrence has three forms. The default walks the nodes in order over narrow tiles of the value dimension. With
+an fp32 state and few (request, head) pairs, it replays each first-child chain from the request state instead. On
+B300 at one request, the Gluon kernel replaces the serial walk at every per-rank head shape with 128-wide keys and
+values and whole GQA groups (TP1 to TP8 of Qwen3.8-27B measured, 1.3x to 1.7x faster than the walk at width 16):
+
+- the first launch of each new shape runs a self-check that compares the Gluon kernel bitwise with the Triton kernel
+ on that shape,
+- a shape not yet checked during CUDA graph capture runs the Triton kernel (serving warms every verify graph before
+ capture, so serving shapes are checked),
+- any self-check failure, compile error or launch error turns the Gluon kernel off for the process, and a Triton
+ build without Gluon keeps the Triton kernel.
+
+## Mamba2 tree verify
+
+Mamba2 hybrids such as NemotronH have the same width-4 causal conv1d in front of their selective state update. On
+sglang the Mamba2 layers run the GDN ancestor tables and tree conv1d (bit-identical conv outputs, conv windows and
+parent table); the selective state update stays sglang's own tree kernel, reading the parent table built once per
+verify forward. This needs an sglang whose Mamba2 backend asks the method for a verify extension
+(`LinearAttnStateLayout` with `kind`); older sglang builds run their own kernels for both steps.
diff --git a/docs/known-limits.md b/docs/known-limits.md
new file mode 100644
index 0000000..bdafe4a
--- /dev/null
+++ b/docs/known-limits.md
@@ -0,0 +1,60 @@
+---
+type: reference
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# Known limits
+
+Use the [support matrix](support-matrix.md) for measured model, hardware and workload combinations.
+A loaded model, an admitted request cap or a compiled kernel does not establish serving correctness or speed.
+
+## Models and hardware
+
+- EAGLE-4 drafts need the trained candidate head and a supported draft structure.
+- Dense and latent-MoE EAGLE-4 drafts and Mamba2 targets have adapters. Nemotron's SGLang comparison has
+ unresolved first divergences under the fp32 gate. vLLM and experimental TokenSpeed do not have a complete
+ release-stack Nemotron performance and correctness result. Do not treat architecture admission as qualification.
+- Serving measurements cover NVIDIA B300 and SGLang on AMD MI355X. Compilation on another NVIDIA or AMD
+ architecture is separate evidence. Multi-node deployment and pipeline parallelism are not qualified.
+- Throughput depends on the model, draft, engine, precision, TP size, attention backend, context length and
+ workload. A result at one concurrency does not establish a result at another.
+
+## Requests
+
+- Client concurrency can exceed the server's running cap and include queued requests. Keep both values with
+ benchmark results. A cap of 512 is an admission limit, not a claim of acceleration or correctness at that load.
+- SGLang supports accepted-token and input logprobs with the required host hooks. Images are refused.
+- vLLM tree verification needs an unquantized KV cache. The target's sampling restrictions still apply.
+ Sampling smoke tests do not prove distribution equivalence on every workload.
+- Structured output and tool calls require the model's engine parser. Raw tool syntax in text is not a structured
+ response. A vLLM tree batch containing a grammar constraint emits only the root token per verify round,
+ including unconstrained requests in that batch. Check finish reasons and validate the completed output.
+ See [compatibility](compatibility.md#structured-output-on-vllm).
+
+## TokenSpeed (experimental)
+
+TokenSpeed implements static and calibrated trees, chains and sampled trees. Its engine and adapter must be
+installed together with the matching hooks. Performance and correctness claims apply only to reported
+configurations, not every implemented path. The sampled-output distribution is unqualified.
+
+Prompt logprobs, per-request sampled-tree overrides, live cost measurement and native no-speculation rounds
+are not supported. A zero-draft speculative round is not a native no-speculation round.
+Tree and chain cost data must match the served shape, TP size, target, draft and recurrent-state dtype.
+
+## Calibration
+
+Cost tables are configuration-specific. Keep the recorded settings with them and measure again after changing
+the model, draft, TP size, precision, attention backend or engine. Keyed tables are checked at loading, but the
+key does not encode every setting. A cache or table is not evidence of an optimal policy for every workload.
+
+The vLLM public sweep measures batch-one tree forwards, not complete high-concurrency serving rounds.
+The SGLang served-chain driver measures a separate path from dynamic-tree calibration. Built-in smoke prompts
+check the command, not representative acceptance. A failed run retains partial output for diagnosis and does
+not write a successful `serve.sh`. See [calibration](calibration.md).
+
+## Distribution
+
+The [install guide](install.md) uses supplied wheel bundles and source builds. Its local index is not a claim
+of a public package service or anonymously accessible model weights. GPU serving and clean-machine container
+installation require their own checks.
diff --git a/docs/legal/Eagle-Contribution-Terms-v1.0.pdf b/docs/legal/Eagle-Contribution-Terms-v1.0.pdf
new file mode 100644
index 0000000..010634e
Binary files /dev/null and b/docs/legal/Eagle-Contribution-Terms-v1.0.pdf differ
diff --git a/docs/migration.md b/docs/migration.md
new file mode 100644
index 0000000..cb726f7
--- /dev/null
+++ b/docs/migration.md
@@ -0,0 +1,107 @@
+# Migrating existing EAGLE-4 configurations
+
+Eagle-harness reads JSON configuration, not these environment variables. Use the field in the table inside
+`--speculative-algorithm-config` (sglang) or `method_config` (vLLM). See [Configuration](configuration.md) for supported
+engine paths and defaults. A mapped field does not imply both engines implement it.
+
+Dotted paths describe nested JSON objects, not literal keys. For example, `cost_model.chain_tiny` becomes
+`{"cost_model": {"chain_tiny": [2.60, 0.24, 0.00]}}`. Use JSON booleans for switches and arrays for coefficient
+triples. An indexed path such as `cost_model.ragged_draft_relax[0]` identifies an element of a complete three-element
+array. The unindexed `SGLANG_EAGLE_HARNESS_RAGGED_DRAFT_RELAX` value sets all three elements.
+
+`Dropped` means there is no corresponding option: the switch controlled a fixed optimization, a removed kernel,
+or diagnostic output. The defaults below describe the legacy environment-variable configuration, not an
+environment parser.
+
+## Removed unused fields
+
+Remove `draft_model.moe_top_k` and `draft_model.packed_candidate_gather` from old JSON.
+Neither field affected execution; they are now rejected as unknown keys. Expert counts come
+from the checkpoint. The unused internal `CostModel.ragged_recent_verify_nums` state is also removed.
+`moe_gate_acc` remains for compatibility with the draft adapters.
+
+## Environment variables
+
+| Environment variable | JSON field | Legacy default | Conversion |
+|---|---|---|---|
+| `SGLANG_EAGLE_HARNESS_CHAIN_TINY` | `cost_model.chain_tiny` | `2.60,0.24,0.00` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_SMALL` | `cost_model.chain_small` | `2.85,0.24,0.00` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_MEDIUM` | `cost_model.chain_medium` | `2.54,0.24,0.70` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_LARGE` | `cost_model.chain_large` | `1.55,0.24,0.00` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_SCALE_TINY` | `cost_model.chain_scale_tiny` | `1.25` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_TINY_MAX_BS` | `cost_model.chain_tiny_max_bs` | `2` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_SCALE_SMALL` | `cost_model.chain_scale_small` | `1.45` | Set the field |
+| `SGLANG_EAGLE_HARNESS_CHAIN_SCALE_MEDIUM` | `cost_model.chain_scale_medium` | `2.00` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_DRAFT_RELAX` | `cost_model.ragged_draft_relax` | `0.75 (all three)` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_RELAX_SMALL` | `cost_model.ragged_draft_relax[0]` | `0.75` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_RELAX_MEDIUM` | `cost_model.ragged_draft_relax[1]` | `0.75` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_RELAX_LARGE` | `cost_model.ragged_draft_relax[2]` | `0.75` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_VERIFY_SMALL` | `cost_model.ragged_verify_threshold[0]` | `1.35` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_VERIFY_MEDIUM` | `cost_model.ragged_verify_threshold[1]` | `1.60` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_VERIFY_LARGE` | `cost_model.ragged_verify_threshold[2]` | `1.40` | Set the field |
+| `SGLANG_EAGLE_HARNESS_VERIFY_RAGGED` | `ragged.enabled` | `1` | Set the field |
+| `SGLANG_EAGLE_HARNESS_RAGGED_FORCE_UNIFORM` | `ragged.force_uniform` | `0` | Set the field |
+| `SGLANG_EAGLE4_MOE_TOP_K` | — | `unset` | Dropped; use checkpoint `num_experts_per_tok` |
+| `SGLANG_EAGLE4_MOE_GATE_ACC` | `draft_model.moe_gate_acc` | `fp32` | Set the field |
+| `SGLANG_EAGLE4_PACKED_CANDIDATE_GATHER` | — | `1` | Dropped; the implementation chooses the gather path |
+| `SGLANG_EAGLE4_CUDA_CANDIDATE_KERNELS` | `draft_model.cuda_candidate_kernels` | `1` | Set the field |
+| `SGLANG_EAGLE_DRAFT_EMBED_FULL` | `draft_model.embed_full` | `1` | Set the field |
+| `SGLANG_EAGLE4_REPLICATED_DRAFT_EMBED` | `draft_model.embed_full` | `1 (deprecated alias)` | Set the field |
+| `SGLANG_DISABLE_EAGLE_DRAFT_EMBED_TRITON` | `draft_model.embed_triton` | `0` | Invert the boolean |
+| `SGLANG_DISABLE_EAGLE_HARNESS_VERIFY_ARGMAX` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_SAMPLED_TREE` | — | `0` | Dropped |
+| `SGLANG_DISABLE_FLASHINFER_VERIFY_EMPTY_OUT` | — | `0` | Dropped |
+| `SGLANG_DISABLE_FLASHINFER_VERIFY_TAIL_MASK` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_FUSED_VERIFY_PREP` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_VERIFY_REPLAY_TRIMS` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_FOLD_COMMIT_STEPS` | — | `0` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DRAFT_GRAPH_OPT` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DRAFT_STRIDED_Q` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DRAFT_ATTN_OUT` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DRAFT_NORM_HALVES` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DRAFT_GATHER_DOT_BK1` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_EXTEND_LAST_ROW_GATHER` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_EXTEND_FC_NORM_THIRDS` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_EXTEND_FC_STRIDED_INPUT` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_EXTEND_STRIDED_Q` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_FUSED_STEP_UPDATE` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_FUSED_STEP_ZERO_COPY` | — | `1` | Dropped |
+| `SGLANG_EXACT_SOFTMAX` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_SIDE_STREAM_VERIFY_SCORES` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_REUSE_EXTEND_DRAFT_TOPK` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_CHECK_EXTEND_DRAFT_TOPK` | — | `0` | Dropped |
+| `SGLANG_EAGLE_HARNESS_FUSED_POST_VERIFY` | — | `1` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_DRAFT_PRELAUNCH` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_SIDE_STREAM_STATE_COMMIT` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_LEAN_DRAFT_INIT` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_LEAN_DRAFT_STEP` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_SKIP_NOOP_MOE_CONTEXTS` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_DRAFT_STEP_META` | — | `0` | Dropped |
+| `SGLANG_DISABLE_EAGLE_HARNESS_DRAFT_PREP_ONE_LAUNCH` | — | `0` | Dropped |
+| `SGLANG_EAGLE_HARNESS_VERIFY_PREALLOC` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_CACHED_VERIFY_BATCH` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DEVICE_ACCEPT` | — | `1` | Dropped |
+| `SGLANG_EAGLE_HARNESS_DEVICE_UPDATE_TREE` | — | `1` | Dropped |
+| `SGLANG_OPT_GDN_TREE_GLUON` | — | `1` | Dropped |
+| `SGLANG_OPT_GDN_TREE_GLUON_PDL` | — | `1` | Dropped |
+| `SGLANG_OPT_GDN_TREE_GLUON_V2` | — | `1` | Dropped |
+| `SGLANG_OPT_GDN_TREE_GLUON_V3` | — | `1` | Dropped |
+| `SGLANG_DISABLE_GDN_TREE_VERIFY_IN_PLACE` | — | `0` | Dropped |
+| `SGLANG_EAGLE_HARNESS_CHAIN_DEBUG` | — | `0` | Dropped |
+| `SGLANG_EAGLE_HARNESS_CHAIN_HIST` | — | `unset` | Dropped |
+| `SGLANG_EAGLE4_SWA_AUDIT` | — | `unset` | Dropped |
+| `SGLANG_EAGLE4_SWA_AUDIT_DIR` | — | `unset` | Dropped |
+| `DRAFT_TREE_PATH` | `data_path` | `--speculative-data-path` | Set the field |
+| `COMPUTE_INTENSITY` | `intensity` | `--speculative-compute-intensity` | Set the field |
+| `DEBUG_STEP` | — | `0 (never read)` | Dropped |
+
+## Command-line arguments
+
+| Legacy argument | JSON field |
+|---|---|
+| `--speculative-exec-mode` | `mode`: `-1` → `static`, `0` → `serve`, `1` → `eval`, `2` → `calibrate` |
+| `--speculative-data-path` | `data_path` |
+| `--speculative-compute-intensity` | `intensity` |
+| `--speculative-algorithm EAGLE4` | `draft_family`: `eagle4` |
+
+Use `--speculative-algorithm EAGLE_HARNESS` on sglang or `method: "eagle_harness"` on vLLM to select the plugin.
diff --git a/docs/new-model.md b/docs/new-model.md
new file mode 100644
index 0000000..5b39d30
--- /dev/null
+++ b/docs/new-model.md
@@ -0,0 +1,197 @@
+---
+type: how-to
+owner: eagle-harness
+last_verified: 2026-10-19
+---
+
+# Onboard a target model
+
+Train a draft whose structure the serving adapter implements, export its trained candidate head, then check
+correctness before calibrating. Changing an architecture name or adding a candidate-head config to untrained
+weights does not make a compatible draft.
+
+The export steps below follow TorchSpec's `tools/convert_to_hf.py` and a real EAGLE4 safetensors export.
+A complete training-to-serving run for an arbitrary new target is not measured. Treat the admission and greedy
+checks as required stop points, not as proof that every target is supported.
+
+## Check the target and draft contract
+
+First serve the target without speculation in your pinned engine. Confirm that its tokenizer, chat template,
+precision and attention backend work. Keep those settings for the speculative comparison.
+
+For the measured EAGLE4 ports, train a dense single-layer draft with rotary positions, full target vocabulary,
+three auxiliary hidden-state inputs and a low-rank candidate head. The draft query and KV head counts must match
+for the measured tree adapter. The target itself can use a hybrid architecture if the engine and EAGLE-4 support
+its verify and state-commit paths.
+
+Use the target's hidden size, vocabulary and token IDs when building your draft configuration. Keep its trained
+RoPE parameters, auxiliary layer IDs, sliding window and normalization settings in the export. Only choose
+structures admitted by `eagle_harness/models/eagle4_config.py` and the selected engine's draft loader.
+See the [support matrix](support-matrix.md) for measured pairs.
+
+## Train with TorchSpec
+
+The upstream training project is [TorchSpec](https://github.com/lightseekorg/TorchSpec).
+Obtain a source bundle with the efficient-head training and export support below from the training maintainer.
+A reproducible repository revision for the inspected bundle is not available with this release. The commands
+below are an external recipe checked against its exporter source, not a verified end-to-end training path.
+Do not substitute an arbitrary TorchSpec revision. Install its training backend in a separate environment
+from serving, following that bundle's setup instructions. Its
+`docs/draft_training_guide.md` and `configs/recipes/` contain the training recipes.
+
+Prepare a target-specific YAML, `train.yaml`, with these fields set rather than copied from another target:
+
+| Field | What to supply |
+|---|---|
+| `model.target_model_path` | Target weights and tokenizer |
+| `model.draft_model_config` | Compatible draft architecture JSON |
+| `model.embedding_key`, `model.lm_head_key`, `model.norm_key` | Exact target checkpoint tensor names |
+| `inference.aux_hidden_states_layers` | Three training layer-output indices |
+| `dataset.train_data_path`, `dataset.chat_template`, `dataset.prompt_key` | Training conversations in the target's template |
+| `inference.inference_num_gpus`, `training.training_num_gpus_per_node` | Allocated inference and training resources |
+| `training.num_train_steps`, `training.save_interval`, `output_dir` | Run length and saved checkpoint locations |
+
+Train the dense drafter first and retain a saved checkpoint. From the TorchSpec checkout:
+
+```bash
+python -m torchspec.train_entry --config train.yaml --print-config-only
+python -m torchspec.train_entry --config train.yaml
+```
+
+The resolved config must name the intended target, layers and output directory. Do not use a smoke recipe with
+checkpoint saving disabled for this step.
+
+Next train the low-rank candidate factors from the trained dense drafter. In a second YAML,
+`train-candidates.yaml`, retain the same target and draft architecture and set:
+
+```yaml
+model:
+ initial_draft_model_path: ./dense-export
+training:
+ efficient_lm: true
+ efficient_lm_rank: 128
+ efficient_lm_top_k: 128
+ loss_type: forward_kl
+```
+
+`dense-export` is the dense checkpoint exported by the command in the next section. Merge these fields into the
+complete target-specific training YAML, not a standalone four-field recipe. Rank 128 and 128 candidates are
+an explicit example, not a tuned choice for your target. TorchSpec requires a pretrained drafter through
+`model.initial_draft_model_path` or `training.load_path`, and checks that its output head is dense.
+Choose a fresh `output_dir` and a nonzero checkpoint interval, then run:
+
+```bash
+python -m torchspec.train_entry --config train-candidates.yaml --print-config-only
+python -m torchspec.train_entry --config train-candidates.yaml
+```
+
+Check held-out candidate recall and served acceptance. A low training loss alone does not establish a useful
+speculative draft.
+
+## Export the checkpoint
+
+Set `CHECKPOINT` to the saved iteration directory and `EXPORT` to a fresh output directory. Run this from the
+TorchSpec checkout, once for the dense initialization and again for the trained candidate-head checkpoint:
+
+```bash
+python tools/convert_to_hf.py --input-dir "$CHECKPOINT" --output-dir "$EXPORT"
+```
+
+The converter uses the checkpoint's `config.json` and discovers its `model/` distributed-checkpoint directory.
+If the config is stored elsewhere, pass `--config` with the exact training config JSON. Avoid regenerating a
+config from the target when doing so would lose trained draft settings. If embeddings must be supplied from
+the target, use `--target-model-path` and the correct `--embedding-key` prefix.
+
+Do not pass `--prune-vocab`. The efficient-head export requires the full target vocabulary. Do not pass
+`--vllm` for this export either, because TorchSpec's efficient-head converter refuses that option. EAGLE-4
+vLLM adapter consumes the EAGLE4 native export and translates its auxiliary layer indices itself.
+Keep output-layer indices in `eagle_config.eagle_aux_hidden_state_layer_ids`, without manually adding one.
+
+The serving directory contains:
+
+```text
+export/
+ config.json
+ model.safetensors
+```
+
+A real inspected export also contained `conversion_validation.json`. That report is useful provenance,
+but it is not required by the loader. The weight header carries `torchspec_version`, and the config carries
+`_torchspec_version` and the output dtype.
+
+Check these candidate-head tensors before serving. `V` is the full target vocabulary, `H` the draft hidden
+size and `R` the trained candidate rank:
+
+| Tensor | Expected shape |
+|---|---|
+| `lm_head.weight` | `[V, H]` |
+| `efficient_lm_head_down_proj.weight` | `[R, H]` |
+| `efficient_lm_head.weight` | `[V, R]` |
+| `embed_tokens.weight` | Target-compatible embedding shape |
+| `fc.weight` | Projection from the three auxiliary hidden states |
+| `fc_norm.0.weight`, `.1.weight`, `.2.weight` | Present when the trained draft uses feature normalization |
+
+The config must contain `efficient_lm_head_config` with `type: low_rank`, the same rank and the candidate count.
+TorchSpec refuses missing candidate factors or incompatible shapes. A safetensors header can be inspected
+without loading the full weights onto a GPU:
+
+```bash
+export EXPORT
+python - <<'PY'
+import json
+import os
+from pathlib import Path
+from safetensors import safe_open
+
+root = Path(os.environ["EXPORT"])
+config = json.loads((root / "config.json").read_text())
+head = config["efficient_lm_head_config"]
+assert head["type"] == "low_rank"
+vocab, hidden, rank = config["vocab_size"], config["hidden_size"], head["rank"]
+expected = {
+ "lm_head.weight": [vocab, hidden],
+ "efficient_lm_head_down_proj.weight": [rank, hidden],
+ "efficient_lm_head.weight": [vocab, rank],
+}
+with safe_open(root / "model.safetensors", framework="pt", device="cpu") as weights:
+ for name, shape in expected.items():
+ actual = weights.get_slice(name).get_shape()
+ assert actual == shape, (name, actual, shape)
+ print(name, actual)
+PY
+```
+
+The inspected Nemotron draft used this format, including a rank-128 candidate head, but also used MoE,
+attention normalization and no RoPE. Those structural fields are rejected by the measured release adapters.
+Do not remove them or claim Nemotron support from the format check.
+
+## Check generation before calibration
+
+In your serving environment, run `eagle-harness-check`, then use the matching
+[SGLang](quickstart-sglang.md) or [vLLM](quickstart-vllm.md) launch recipe with `DRAFT` pointing to the export.
+These are release-specific recipes, not generic fixed-tree examples. SGLang seeds live costs, while vLLM needs
+matching calibrated costs and rounds. For vLLM, prepare those inputs with the [calibration guide](calibration.md)
+before launching if they are absent. Do not reuse another model/draft pair's calibration. Start with one request.
+Refused config fields require an adapter implementation or a compatible trained draft, not a renamed architecture.
+
+Compare greedy token IDs on held-out prompts against the same engine without speculation. For each first
+mismatch, inspect the no-spec token logprobs and separate a near-tie from a genuine error. Record acceptance
+length as well. Acceptance near one can indicate a wrong export, wrong hidden layers or an incomplete head
+mapping even when the target verifies every output token.
+
+Then test your required stops, concurrency, logprobs and sampling behavior. Keep every unsupported request
+feature out of the deployment contract.
+
+## Calibrate and serve
+
+Stop the test servers and measure the admitted pair:
+
+```bash
+eagle-harness calibrate --model "$MODEL" --draft "$EXPORT" --tp "$TP" --output calibration-new-model &&
+ sh calibration-new-model/serve.sh
+```
+
+Specify `--engine` if both engines are installed. Supply a representative `--data` file for SGLang.
+The [calibration guide](calibration.md) explains the different per-engine measurements. Benchmark against a
+matched no-spec server at your deployment concurrency. Save the model and draft revisions, engine build,
+GPU type, TP, precision and calibration settings alongside the result before calling the new pair supported.
diff --git a/docs/quickstart-amd.md b/docs/quickstart-amd.md
new file mode 100644
index 0000000..ac84ad6
--- /dev/null
+++ b/docs/quickstart-amd.md
@@ -0,0 +1,84 @@
+---
+type: tutorial
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# SGLang on AMD MI355X
+
+Serve Qwen3.8-27B BF16 with its EAGLE-4 draft on one MI355X using the ROCm SGLang engine.
+The matching MI355X cost profile is packaged with EAGLE-4 and selected automatically.
+No `data_path` or profile environment variable is needed.
+
+## Before starting
+
+The fresh-install path remains under qualification and is deferred to a follow-up guide.
+Use this measured serving recipe only in an already-qualified MI355X environment. It is not a
+fresh-install procedure. See the [ROCm installation status](install.md#sglang-rocm-on-amd).
+Run `eagle-harness-check`, but do not treat its import checks as runtime qualification.
+Use the ROCm 7.2 runtime and locally downloaded target and draft directories. Profile selection compares
+both local `config.json` files with the measured pair, so an unresolved Hub identifier is not sufficient.
+The profile applies to MI355X, including VF, BF16, TP1 and no quantization. It is not a generic AMD profile.
+Only enable `--trust-remote-code` for model code you have reviewed.
+
+## Set the ROCm environment
+
+Use the environment from the packaged-profile serving recipe:
+
+```bash
+: "${MODEL:?set the local Qwen3.8-27B BF16 target directory}"
+: "${DRAFT:?set the local compatible EAGLE-4 draft directory}"
+export HF_HUB_OFFLINE=1 TOKENIZERS_PARALLELISM=false
+export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 SGLANG_DISABLE_CUDNN_CHECK=1
+export SGLANG_SET_CPU_AFFINITY=1 SGLANG_INT4_WEIGHT=0 SGLANG_USE_ROCM700A=1
+export SGLANG_ROCM_DISABLE_LINEARQUANT=0 SGLANG_USE_AITER=1 SGLANG_MOE_PADDING=1
+export SGLANG_ROCM_FUSED_DECODE_MLA=1
+export SGLANG_SPLITKV_VERIFY_FLYDSL=0 SGLANG_SPLITKV_VERIFY_FLYDSL_COMBINE=0
+```
+
+Do not copy source-overlay `PYTHONPATH` settings into the installed environment.
+Keep HIP prelaunch disabled and rounded recurrence enabled, as in the packaged-profile measurements.
+The environment switch named `ROCM700A` is retained by the ROCm engine despite the runtime's 7.2 version.
+
+## Start the server
+
+The measured eight-request recipe uses AITER target attention, Triton draft attention and explicit
+HIP graph batch sizes. Its padding setting differs from the CUDA recipe:
+
+```bash
+python -m sglang.launch_server --model-path "$MODEL" --tp-size 1 --dtype bfloat16 \
+ --host 127.0.0.1 --port 30000 --trust-remote-code --attention-backend aiter --page-size 1 \
+ --disable-overlap-schedule --disable-cuda-graph-padding --disable-prefill-cuda-graph \
+ --cuda-graph-backend-decode full --cuda-graph-bs-decode 1 2 3 4 5 6 7 8 \
+ --max-running-requests 8 --max-mamba-cache-size 8 --mem-fraction-static 0.90 \
+ --context-length 32768 --chunked-prefill-size 8192 --max-total-tokens 65536 \
+ --mamba-ssm-dtype bfloat16 --disable-radix-cache --reasoning-parser qwen3 \
+ --random-seed 721 --skip-server-warmup \
+ --speculative-algorithm EAGLE_HARNESS --speculative-draft-model-path "$DRAFT" \
+ --speculative-draft-model-quantization unquant --speculative-draft-attention-backend triton \
+ --speculative-attention-mode prefill --speculative-num-steps 12 \
+ --speculative-eagle-topk 4 --speculative-num-draft-tokens 32 \
+ --speculative-algorithm-config '{"mode":"serve"}'
+```
+
+Look for `selected packaged MI355X cost profile` in the startup log. If it is absent, check the
+GPU, dtype, TP size and local model configurations before assuming the measured profile is in use.
+An explicit `data_path` overrides automatic selection. The packaged profile includes measured costs
+for batch sizes 1, 8 and 32, but that does not qualify every batch size or context length.
+See the [support matrix](support-matrix.md) for correctness coverage.
+
+## Generate text
+
+In another terminal, wait for the model listing, then generate:
+
+```bash
+curl --fail http://127.0.0.1:30000/v1/models
+curl --fail http://127.0.0.1:30000/generate \
+ -H 'Content-Type: application/json' \
+ -d '{"text":"Explain how a hash table works.","sampling_params":{"temperature":0,"max_new_tokens":128}}'
+```
+
+The response must contain generated text and token metadata. The first request includes cold work because
+the measured launch skips server warmup. Repeat it before timing. In Docker, bind the server to `0.0.0.0`
+inside the container while publishing only the loopback host port.
+Stop the server with Ctrl-C before changing its graph sizes or starting another GPU process.
diff --git a/docs/quickstart-sglang.md b/docs/quickstart-sglang.md
new file mode 100644
index 0000000..fb0f2df
--- /dev/null
+++ b/docs/quickstart-sglang.md
@@ -0,0 +1,74 @@
+---
+type: tutorial
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# SGLang CUDA quickstart
+
+Serve Qwen3.8-27B BF16 with its EAGLE-4 draft on four B300 GPUs. SGLang measures the draft and
+verification costs during served rounds, so this recipe needs no offline calibration directory.
+For MI355X, use the separate [AMD quickstart](quickstart-amd.md).
+
+## Before starting
+
+Complete the [SGLang CUDA installation](install.md#sglang-cuda) and run `eagle-harness-check`.
+Set `MODEL` and `DRAFT` to readable local target and compatible draft directories.
+The release recipe below uses TP4 and a running-request cap of 32. See the
+[support matrix](support-matrix.md) before changing the model, hardware or tensor-parallel size.
+Only enable `--trust-remote-code` for model code you have reviewed.
+
+## Start the server
+
+Use the release tree shape and keep CUDA graph padding enabled:
+
+```bash
+: "${MODEL:?set the local Qwen3.8-27B BF16 target directory}"
+: "${DRAFT:?set the local compatible EAGLE-4 draft directory}"
+export HF_HUB_OFFLINE=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
+export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 SGLANG_TIMEOUT_KEEP_ALIVE=3600
+python -m sglang.launch_server --model-path "$MODEL" --tp-size 4 --dtype bfloat16 \
+ --trust-remote-code --attention-backend flashinfer --page-size 1 \
+ --max-running-requests 32 --cuda-graph-max-bs-decode 32 \
+ --disable-overlap-schedule --disable-prefill-cuda-graph --cuda-graph-backend-decode full \
+ --mem-fraction-static 0.75 --context-length 196608 --max-total-tokens 196608 \
+ --chunked-prefill-size 16384 --mamba-ssm-dtype bfloat16 --disable-radix-cache \
+ --reasoning-parser qwen3 --random-seed 721 --skip-server-warmup \
+ --host 127.0.0.1 --port 30000 \
+ --speculative-algorithm EAGLE_HARNESS --speculative-draft-model-path "$DRAFT" \
+ --speculative-draft-model-quantization unquant --speculative-draft-attention-backend flashinfer \
+ --speculative-attention-mode prefill --speculative-num-steps 12 \
+ --speculative-eagle-topk 4 --speculative-num-draft-tokens 16 \
+ --speculative-algorithm-config '{"mode":"serve"}'
+```
+
+Do not add `--disable-cuda-graph-padding` to this CUDA recipe. The release benchmark uses a separate
+client warmup, hence `--skip-server-warmup`. With this exact command, the first generation below performs
+cold compilation and cost seeding. Remove that flag if you want the engine's startup warmup instead,
+but do not call the modified startup sequence an identical benchmark reproduction.
+
+The shape flags bound the tree. Initial served rounds price captured verification widths and later
+rounds refine their costs. The cache is keyed by GPU, TP size, model configurations, engine and dtype
+under `~/.cache/eagle-harness/costs`. No private cost-table path is required.
+
+## Generate text
+
+In another terminal, wait until the model listing succeeds, then send a greedy request:
+
+```bash
+curl --fail http://127.0.0.1:30000/v1/models
+curl --fail http://127.0.0.1:30000/generate \
+ -H 'Content-Type: application/json' \
+ -d '{"text":"Explain how a hash table works.","sampling_params":{"temperature":0,"max_new_tokens":128}}'
+```
+
+The response must contain generated text and token metadata. Repeat the generation request after
+compilation before measuring latency. A successful model listing alone does not check decoding.
+For Docker, bind the server to `0.0.0.0` inside the container and keep the published host port on loopback.
+
+## Next step
+
+Use representative prompts and compare against the same engine without speculation before deployment.
+The [calibration guide](calibration.md) explains live costs and offline chain calibration.
+The [known limits](known-limits.md) distinguish greedy checks, sampled requests, logprobs and multimodal support.
+Stop the server with Ctrl-C before starting another server or calibration on the same GPUs.
diff --git a/docs/quickstart-tokenspeed.md b/docs/quickstart-tokenspeed.md
new file mode 100644
index 0000000..3c131aa
--- /dev/null
+++ b/docs/quickstart-tokenspeed.md
@@ -0,0 +1,90 @@
+---
+type: tutorial
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# TokenSpeed quickstart, experimental
+
+Run the experimental TokenSpeed adapter on NVIDIA CUDA hardware. This is not a ROCm path.
+The release serving recipe uses Qwen3.8-27B BF16 and its EAGLE-4 draft on four B300 GPUs.
+
+## Before starting
+
+Complete the [TokenSpeed installation](install.md#tokenspeed-cuda-experimental), including its scheduler
+and kernel wheels, and run `eagle-harness-check`. Keep the CUDA 13.0 toolkit and `nvcc` available for
+first-use tree-round compilation. Set `MODEL` and `DRAFT` to readable local directories.
+The measured cost-model recipe also requires matching calibrated target and draft tables under
+`COST_ROOT/cost/`. EAGLE-4 does not include a TokenSpeed calibration CLI or automatically select
+an installed TokenSpeed profile. Do not substitute vLLM or ROCm tables.
+
+If you do not have matching TokenSpeed costs, use the fixed-shape option below to check generation.
+It does not reproduce the cost-model benchmark or establish the same performance.
+
+## Start the server
+
+With matching costs, construct the configuration using JSON encoding:
+
+```bash
+: "${COST_ROOT:?set the matching TokenSpeed TP4 calibrated cost directory}"
+export COST_ROOT
+STEPS=12
+test -d "$COST_ROOT/cost"
+CONFIG=$(python -c 'import json, os; print(json.dumps({"mode":"serve","data_path":os.environ["COST_ROOT"]}))')
+```
+
+Alternatively, select a fixed tree without cost files:
+
+```bash
+CONFIG='{"mode":"static"}'
+STEPS=10
+```
+
+The static path supports at most ten draft steps because the engine stores its depth-first sort key
+in 64 bits. Do not reuse the twelve-step cost-model bound with `mode=static`.
+
+Use the release launch flags with the selected configuration:
+
+```bash
+: "${MODEL:?set the local Qwen3.8-27B BF16 target directory}"
+: "${DRAFT:?set the local compatible EAGLE-4 draft directory}"
+: "${CONFIG:?select cost-model or fixed-shape mode above}"
+: "${STEPS:?set the step bound with the selected mode above}"
+export HF_HUB_OFFLINE=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
+python -m tokenspeed.cli serve "$MODEL" --tensor-parallel-size 4 \
+ --attention-backend trtllm --max-model-len 65536 --max-num-seqs 4 \
+ --disable-kvstore --seed 721 --gpu-memory-utilization 0.6 --disable-prefix-caching \
+ --host 127.0.0.1 --port 30000 --reasoning-parser qwen3 \
+ --speculative-draft-model-path "$DRAFT" --speculative-num-steps "$STEPS" \
+ --speculative-eagle-topk 4 --speculative-num-draft-tokens 16 \
+ --speculative-algorithm EAGLE_HARNESS --speculative-algorithm-config "$CONFIG" \
+ --sampling-backend greedy
+```
+
+The running-request cap is four in the single-client release recipe. The concurrent release recipe
+uses `--max-num-seqs 32` with the same TP4 and context settings. Neither setting promises a speedup
+for your workload. The fixed-shape option changes the policy and draft-step bound, not the engine.
+In Docker, bind the server to `0.0.0.0` inside the container and keep the published host port on loopback.
+If using cost files in Docker, mount their directory read-only and set `COST_ROOT` to that container path.
+
+## Generate text
+
+In another terminal, read the served model identifier and send a greedy chat request:
+
+```bash
+MODEL=$(curl --fail --silent http://127.0.0.1:30000/v1/models | python -c 'import json,sys; print(json.load(sys.stdin)["data"][0]["id"])')
+export MODEL
+python -c 'import json, os; print(json.dumps({"model":os.environ["MODEL"],"messages":[{"role":"user","content":"Explain how a hash table works."}],"temperature":0,"max_tokens":128}))' | \
+ curl --fail http://127.0.0.1:30000/v1/chat/completions \
+ -H 'Content-Type: application/json' --data-binary @-
+```
+
+The response must contain a generated choice. A reasoning model may place its output in the reasoning
+field rather than `message.content`. Repeat after warmup before timing.
+
+## Experimental limits
+
+Prompt logprobs, per-request sampled trees and native-OFF are not supported by this adapter.
+This greedy quickstart does not enable sampled decoding.
+See the [support matrix](support-matrix.md) for model-specific correctness and performance qualifications.
+Stop the server with Ctrl-C before starting another engine on the same GPUs.
diff --git a/docs/quickstart-vllm.md b/docs/quickstart-vllm.md
new file mode 100644
index 0000000..52c43e4
--- /dev/null
+++ b/docs/quickstart-vllm.md
@@ -0,0 +1,90 @@
+---
+type: tutorial
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# vLLM quickstart
+
+Serve Qwen3.8-27B BF16 with its EAGLE-4 draft on four B300 GPUs using the release tree configuration.
+Load the shipped rounds file into matching calibrated costs to enable its batch-dependent verification width.
+The rounds file is packaged, but the target and draft `cost/` tables must be measured separately.
+
+## Before starting
+
+Complete the [vLLM installation](install.md#vllm-cuda) and run `eagle-harness-check`.
+Set `MODEL` and `DRAFT` to readable local directories. This recipe is specific to the Qwen3.8-27B / EAGLE-4
+v3 pair at TP4. Do not reuse its rounds file for another GPU, tensor-parallel size or model pair.
+See the [support matrix](support-matrix.md) for other configurations.
+
+## Prepare the costs and shipped rounds
+
+If you already have matching calibrated TP4 costs, set `COST_ROOT` to that directory and skip calibration.
+Otherwise, with the GPUs idle, create them with the installed CLI:
+
+```bash
+: "${MODEL:?set the local Qwen3.8-27B BF16 target directory}"
+: "${DRAFT:?set the local compatible EAGLE-4 draft directory}"
+export MODEL DRAFT
+export COST_ROOT="$PWD/calibration-vllm-tp4"
+eagle-harness calibrate --engine vllm --model "$MODEL" --draft "$DRAFT" --tp 4 \
+ --engine-args '{"linear_backend":"flashinfer_cutedsl"}' --output "$COST_ROOT"
+```
+
+Calibration refuses an existing output directory. It measures batch-one costs, not full high-concurrency
+serving. New measurements are not the exact table bytes used by the release benchmark. In Docker, choose
+a fresh directory beneath the writable `/calibration` mount instead of `$PWD`.
+
+Copy the shipped measured rounds without replacing the calibrated `cost/` tables:
+
+```bash
+: "${COST_ROOT:?set the matching calibrated TP4 cost directory}"
+export COST_ROOT
+TREE_ROUNDS=$(python -c 'from importlib.resources import files; print(files("eagle_harness.core").joinpath("profiles/vllm-qwen38-tp4/rounds/tree.json"))')
+test -d "$COST_ROOT/cost"
+mkdir -p "$COST_ROOT/rounds"
+cp "$TREE_ROUNDS" "$COST_ROOT/rounds/tree.json"
+```
+
+This file keeps width 16 below batch size 20 and selects width 4 at larger batches. It does not enable
+native-OFF. The [profile notes](../eagle_harness/core/profiles/vllm-qwen38-tp4/README.md) describe its scope.
+
+## Start the server
+
+Build the speculative configuration with JSON encoding so paths with spaces or quotes remain valid:
+
+```bash
+: "${MODEL:?set the target directory}"
+: "${DRAFT:?set the draft directory}"
+: "${COST_ROOT:?set the prepared cost directory}"
+export MODEL DRAFT COST_ROOT
+SPEC=$(python -c 'import json, os; print(json.dumps({"method":"eagle_harness","model":os.environ["DRAFT"],"method_config":{"mode":"static","node_top_k":4,"tree_depth":14,"max_verify_width":16,"data_path":os.environ["COST_ROOT"]}}))')
+export VLLM_USE_V2_MODEL_RUNNER=1 HF_HUB_OFFLINE=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
+python -m vllm.entrypoints.cli.main serve "$MODEL" --tensor-parallel-size 4 \
+ --max-model-len 32768 --gpu-memory-utilization 0.85 --max-num-seqs 64 \
+ --seed 721 --host 127.0.0.1 --port 8000 --no-enable-prefix-caching \
+ --linear-backend flashinfer_cutedsl --reasoning-parser qwen3 \
+ --attention-backend CUSTOM --speculative-config "$SPEC"
+```
+
+Model Runner V2 and `CUSTOM` attention are required for this tree. The static shape supplies the bounds,
+the calibrated costs supply depth stopping, and the rounds file selects width by batch size.
+Without `rounds/tree.json`, the configured width stays fixed. Do not point `data_path` at the packaged
+rounds-only directory because it lacks the depth-stop cost tables.
+
+## Generate text
+
+In another terminal, read the served model identifier and send a completion:
+
+```bash
+MODEL=$(curl --fail --silent http://127.0.0.1:8000/v1/models | python -c 'import json,sys; print(json.load(sys.stdin)["data"][0]["id"])')
+export MODEL
+python -c 'import json, os; print(json.dumps({"model":os.environ["MODEL"],"prompt":"Explain how a hash table works.","temperature":0,"max_tokens":128}))' | \
+ curl --fail http://127.0.0.1:8000/v1/completions \
+ -H 'Content-Type: application/json' --data-binary @-
+```
+
+The response must contain a generated choice. Repeat after warmup before timing. In Docker, bind the server
+to `0.0.0.0` inside the container while publishing the host port on loopback.
+Sampling and logprobs have separate checks in the support matrix. This plain-text example does not qualify
+multimodal requests or quantized KV caches. Stop the server with Ctrl-C before another calibration.
diff --git a/docs/release-notes/0.1.0.md b/docs/release-notes/0.1.0.md
new file mode 100644
index 0000000..b731317
--- /dev/null
+++ b/docs/release-notes/0.1.0.md
@@ -0,0 +1,56 @@
+---
+type: reference
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# Release notes for 0.1.0
+
+This is a draft for the initial eagle-harness release, not a publication announcement. It describes merged source
+features. Final engine builds, install pins and release qualification remain pending. Performance evidence lives
+in the [measured support matrix](../support-matrix.md), not in release-wide speed claims.
+
+## Serving and draft models
+
+- Install eagle-harness as an out-of-tree SGLang or vLLM plugin. Hook checks refuse registration when the host
+ interface is missing or incompatible.
+- Serve EAGLE-4 drafts with the low-rank candidate head and tree-aware GDN verification for hybrid targets.
+ Matching cost tables control SGLang draft depth and verify width, and vLLM draft-depth stopping.
+- Select vLLM chain widths from measured draft/verify costs and acceptance profiles. High-load behavior still needs a
+ matched no-spec comparison.
+- Use SGLang Mamba2 tree-verification convolution through the engine extension. This alone does not include the
+ real Nemotron draft integration or qualify its performance.
+
+## Request correctness
+
+- Return vLLM logprobs in accepted tree-path order rather than physical verify-row order.
+- Serve SGLang accepted-token, top-k and input logprobs with the matching host fixes or documented eager workaround.
+- Sample vLLM tree verification from the target distribution and preserve request-slot indexing during chunked
+ verification. SGLang sampled-filter correctness requires the corresponding host fix.
+- Use root-only tree verification for vLLM grammar-constrained batches. This preserves constraints without
+ promising accelerated constrained decoding.
+- Order SGLang prelaunch publication and request-slot reads before scheduler filtering, merging and slot reuse.
+ The fence follows result-copy work rather than delaying that work behind the next draft.
+- Pass dense parent lists to the SGLang tree kernel to avoid the batched draft-selection crash.
+
+## Calibration, tests and packaging
+
+The installed `eagle-harness calibrate` command detects the engine, preserves raw measurements, refuses an
+existing output directory and writes a serving command only after successful output checks. The public vLLM
+measurement/fitting driver is included. The SGLang served-chain driver remains a separate integration dependency.
+
+The source includes correctness checks for greedy output, sampling, mixed stop conditions, draft attention and
+concurrent verification. GDN recurrence code has clearer tensor-layout and ownership documentation without an
+intended numerical change. Wheel/source packaging and CI are present, but their existence is not proof that
+release assets have been published or installed on a clean machine.
+
+## Before deploying
+
+Read [installation](../install.md), [known limits](../known-limits.md) and the matching
+[SGLang CUDA](../quickstart-sglang.md), [SGLang ROCm](../quickstart-amd.md),
+[vLLM](../quickstart-vllm.md) or [experimental TokenSpeed](../quickstart-tokenspeed.md) quickstart.
+The selected package versions and distribution destinations are in `docs/release.env`. Their presence does not
+assert that artifacts have been published. AMD ROCm and CUDA-only TokenSpeed are included in the release source,
+with qualification restricted to the configurations in the [support matrix](../support-matrix.md).
+Real Nemotron draft integration and the deferred optimizations in [known limits](../known-limits.md) remain
+outside that support contract. Final artifact installation and serving checks remain publication gates.
diff --git a/docs/release.env b/docs/release.env
new file mode 100644
index 0000000..b7b97ac
--- /dev/null
+++ b/docs/release.env
@@ -0,0 +1,21 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+# Source from the repository root: . ./docs/release.env
+# Distribution locations for 0.1.0. Publication is a separate release gate.
+export EAGLE_VERSION='0.1.0'
+export EAGLE_WHEEL_ROOT='https://eagle-hq.github.io/EAGLE-4/whl'
+export EAGLE_CUDA_INDEX="$EAGLE_WHEEL_ROOT/cu130/"
+export EAGLE_ROCM_INDEX="$EAGLE_WHEEL_ROOT/rocm/"
+export EAGLE_RELEASE_ASSETS='https://github.com/eagle-hq/EAGLE-4/releases/tag/v0.1.0'
+export EAGLE_IMAGE_ROOT='ghcr.io/eagle-hq/eagle-4'
+export EAGLE_SGLANG_IMAGE="$EAGLE_IMAGE_ROOT-sglang:$EAGLE_VERSION"
+export EAGLE_ROCM_IMAGE="$EAGLE_IMAGE_ROOT-sglang-rocm:$EAGLE_VERSION"
+export EAGLE_VLLM_IMAGE="$EAGLE_IMAGE_ROOT-vllm:$EAGLE_VERSION"
+export EAGLE_TOKENSPEED_IMAGE="$EAGLE_IMAGE_ROOT-tokenspeed:$EAGLE_VERSION"
+export EAGLE_SGLANG_VERSION='0.5.23.dev252+eagle.4'
+export EAGLE_ROCM_VERSION='0.5.23.dev252+eagle.4.rocm'
+export EAGLE_VLLM_VERSION='0.32.0rc1.dev283+eagle.4'
+export EAGLE_TOKENSPEED_VERSION='0.1.1+eagle.4'
+export EAGLE_TORCH_CUDA_INDEX='https://download.pytorch.org/whl/cu130'
+# These are coupled native packages from the same TokenSpeed release source.
+export EAGLE_TOKENSPEED_AUX_REQUIREMENTS='tokenspeed-scheduler==0.1.40+eagle.4 tokenspeed-kernel==0.1.4+eagle.4'
diff --git a/docs/support-matrix.md b/docs/support-matrix.md
new file mode 100644
index 0000000..9d76f40
--- /dev/null
+++ b/docs/support-matrix.md
@@ -0,0 +1,139 @@
+---
+type: reference
+owner: eagle-harness
+last_verified: 2026-10-20
+---
+
+# Measured support matrix
+
+EAGLE-4 sizes speculative trees from measured serving costs. The EAGLE-4 tables report Qwen3.8-27B with an
+EAGLE-4 draft on NVIDIA B300 and AMD MI355X. TokenSpeed is experimental.
+
+Throughput is generated tokens divided by elapsed workload time, in tokens/s. Higher is better.
+An engine's speedup divides EAGLE-4 throughput by its own matched no-speculation control.
+Client concurrency is distinct from the server's running-request cap. A client above that cap queues.
+
+These are configuration-specific measurements, not a claim of a speedup at every batch size. Rows from
+short replays, full multi-turn workloads and synthetic contexts are not interchangeable. In particular, these
+replays do not replace EAGLE-4's full SPEED-Bench qualitative result or its HumanEval closed-loop results.
+Raw launch manifests and request traces are retained by the maintainers, not shipped in this source package.
+
+## SGLang on NVIDIA B300
+
+The target and EAGLE-4 v3 draft use BF16. The dynamic tree has maximum depth 12, top-k 4 and verify width 16.
+Target and draft attention use FlashInfer with page size 1. The SPEED-Bench HTTP client uses temperature 0.
+Concurrency 1 uses 22 conversations and 31 turns with at most 1024 new tokens per turn. Concurrency 8 uses
+88 first turns with at most 512 new tokens. Concurrency 64 uses 220 first turns with the same 512-token cap.
+Every timed pass follows a warm pass. EAGLE-4 measures live costs. Each EAGLE-4 configuration has two starts.
+
+| GPUs / TP | Client concurrency | Running cap | Graph padding | No-spec tokens/s | EAGLE-4 tokens/s | Speedup |
+|---|---:|---:|---|---:|---:|---:|
+| 1 | 1 | 1 | Irrelevant at batch 1 | 103.1 | 343.1 | 3.33× |
+| 1 | 8 | 8 | Disabled in measurement | 711.7 | 1503.7 | 2.11× |
+| 4 | 8 | 32 | Default, enabled | 1479.4 | 2820.6 | 1.91× |
+| 4 | 64 | 32 | Disabled in measurement | 3925.3 | 5281.3 | 1.35× |
+| 8 | 1 | 1 | Irrelevant at batch 1 | 241.7 | 828.6 | 3.43× |
+
+TP4 concurrency 8 measures 2749.5 and 2891.8 tokens/s across its two starts.
+TP8 concurrency 1 has a throughput result but its configuration-specific correctness check is incomplete.
+Correctness from another TP8 run is not substituted.
+
+Concurrency 64 queues into 32 running slots. The measured padding-disabled settings identify those results,
+not a recommendation to disable padding. Concurrent serving commands keep SGLang's default padding enabled.
+
+## SGLang on AMD MI355X
+
+Qwen3.8-27B and its EAGLE-4 draft run on one MI355X at TP1 with BF16 target, KV cache and recurrent state.
+AMD ROCm is included at all supported batch sizes.
+The measured-profile workload uses the original SPEED-Bench client, 44 conversations and 60 turns,
+temperature 0, at most 1024 new tokens per turn and a full matching warm pass. The running cap matches client
+concurrency. The tree has maximum depth 12, top-k 4 and verify width 32. It uses measured MI355X costs,
+AITER target attention, rounded recurrent-state updates and disabled draft prelaunch. The measured launches
+disable graph padding but capture every integer batch size up to the running cap. These are recorded
+measurement conditions, not a recommendation to disable padding.
+
+| Configuration | Client concurrency | No-spec tokens/s | EAGLE-4 tokens/s | Speedup | EAGLE-4 starts |
+|---|---:|---:|---:|---:|---:|
+| Earlier one-request profile | 1 | — | 289.4 | — | 2 |
+| Measured profile, explicit path | 8 | 552.7 | 1145.9 | 2.07× | 2 |
+| Measured profile, explicit path | 32 | 1269.2 | 1980.8 | 1.56× | 2 |
+| Packaged profile, automatic selection | 8 | — | 1209.2 | — | 1 |
+
+The earlier one-request profile uses 22 conversations and 31 turns with the same temperature and token cap,
+a running cap of 1 and two starts at 291.8 and 287.0 tokens/s. A separate packaged-profile check at concurrency 1
+reaches 290.9 tokens/s on the 60-turn workload in one start. No matched no-speculation speedup is reported for
+these one-request results or the packaged-profile row. The explicit-profile no-spec controls use one start each.
+
+The explicit-profile starts are 1144.9 and 1146.8 tokens/s at concurrency 8, and 1991.7 and 1969.9 tokens/s at
+concurrency 32. The packaged profile contains the same measured tables, but its one-start result is not pooled
+with the earlier starts. Its twenty-prompt checks give 7 exact / 13 near tie at concurrency 1 and
+6 exact / 14 near tie at concurrency 8, with no failures.
+
+The explicit-profile concurrency-8 checks each give 5 exact / 15 near tie. At concurrency 32, start 1 gives
+3 exact / 14 near tie / 3 fp32-tolerance passes. Start 2 gives 5 exact / 13 near tie / 1 fp32-tolerance pass /
+1 candidate-is-fp32-argmax pass. Both starts have zero failures under the stated rule. The argmax pass is
+separate from a tolerance pass and does not imply equality to the native BF16 token stream.
+
+## vLLM on NVIDIA B300
+
+These speedups use vLLM's own matched no-speculation control.
+Qwen3.8-27B BF16 uses the EAGLE-4 v3 draft and the SPEED-Bench HTTP client that preserves reasoning text between
+turns. Temperature is 0. Concurrency 1 uses 22 conversations and 31 turns with at most 1024 new tokens per turn.
+Concurrency 8 uses 88 first turns with at most 512 new tokens. Each timed pass follows a full matching warm pass.
+
+| GPUs / TP | Client concurrency | Running cap | Mode | No-spec tokens/s | EAGLE-4 tokens/s | Speedup | EAGLE-4 starts |
+|---|---:|---:|---|---:|---:|---:|---:|
+| 1 | 1 | 8 | Static tree | 104.0 | 279.9 | 2.69× | 2 |
+| 1 | 8 | 8 | Static tree | 715.5 | 1389.1 | 1.94× | 2 |
+| 4 | 1 | 64 | Static tree | 241.6 | 722.8 | 2.99× | 2 |
+| 4 | 8 | 64 | Static tree | 1699.9 | 2883.9 | 1.70× | 2 |
+| 8 | 1 | 8 | Static tree | 317.2 | 745.4 | 2.35× | 2 |
+| 8 | 8 | 8 | Static tree | 2063.0 | 2890.0 | 1.40× | 2 |
+
+The tree uses top-k 4, depth 14 and verify width 16 with `CUSTOM` attention. TP4 uses the derived depth stop.
+TP1 and TP8 use fixed depth. No-spec uses the engine's default FlashInfer attention with the same cap.
+The two TP8 concurrency-8 starts differ by 11%, and both are included in the mean.
+
+### Measured high-load tree schedule
+
+A one-start TP4 qualification of the served-round schedule reaches 2906.7 tokens/s at concurrency 8,
+compared with the fixed-width tree's two-start mean of 2883.9 above. At concurrency 64 it reaches
+7036.3 tokens/s, 1.025× its matched no-speculation control. These one-start results are not pooled with
+the fixed-width results. The twenty-prompt check gives 5 exact / 14 near tie / 1 previously arbitrated
+fp32-tolerance pass; the last case has the same common prefix as the earlier passing arbitration.
+This is not bitwise equality to no-speculation decoding.
+
+Use the [packaged rounds file with matching calibrated costs](../eagle_harness/core/profiles/vllm-qwen38-tp4/README.md).
+The schedule narrows the verify width from 16 to 4 at batch size 20 and above, without enabling native-OFF.
+No rounds file means no width change.
+
+## TokenSpeed (experimental)
+
+The adapter implements static and calibrated trees, chains and sampled trees. This is implementation coverage,
+not a performance or distribution-quality claim for every configuration.
+Prompt logprobs, live cost measurement and native no-speculation rounds are not supported.
+No TokenSpeed throughput number is claimed for an unmeasured or non-matching workload.
+
+## Correctness and request features
+
+The greedy gate reports exact, near-tie, fp32-tolerance, candidate-is-fp32-argmax and failed outputs separately.
+A first-divergence reference-logprob gap of at most 0.13 is a near tie. Larger gaps require an fp32 forward
+at the exact common prefix. A pair within two BF16 steps at that logit magnitude passes the tolerance check.
+EAGLE-4 token equal to the fp32 argmax also passes, reported in its own category. Passing either rule
+is not bitwise equality to the native BF16 token stream.
+
+| Configuration or feature | Evidence |
+|---|---|
+| SGLang Qwen TP4 concurrency 8/64 replay | Twenty-prompt comparisons give 5 exact / 15 near tie / 0 fp32 / 0 failed in both starts |
+| SGLang Qwen TP1 live costs | Concurrency 1 gives 6 exact / 14 near tie; concurrency 8 gives 5 exact / 14 near tie / 1 fp32-tolerance pass, in both starts |
+| vLLM Qwen TP4 tree and chain | Twenty-prompt checks pass with fp32 arbitration for one prompt in each mode |
+| vLLM Qwen TP1 tree | Twenty-prompt check gives 8 exact / 12 near tie / 0 fp32 / 0 failed |
+| vLLM emitted-token logprobs | All 768 checked tokens per configuration are own-row top-1, shared-prefix deltas are below 0.12 |
+| vLLM stop strings, stop IDs, EOS and `ignore_eos` | All 32 requests pass per checked server under concurrency 16 |
+| vLLM temperature-1 smoke | All 18 requests per checked server finish legally and samples differ across seeds |
+| vLLM prefix caching | All eight second-pass outputs match the first pass per checked configuration |
+| SGLang logprobs and sampling | Accepted-token and input logprobs and target-side speculative sampling are implemented |
+| Nemotron / Mamba2 | Adapters are implemented on SGLang and vLLM, but a general correctness-qualified speed claim is not established |
+
+See [known limits](known-limits.md) for configuration restrictions and [compatibility](compatibility.md) for
+required engine hooks. Kernel compilation on another GPU does not establish serving correctness or speed there.
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
new file mode 100644
index 0000000..58c0170
--- /dev/null
+++ b/docs/troubleshooting.md
@@ -0,0 +1,78 @@
+# Troubleshooting
+
+Start with `eagle-harness-check` (also `python -m eagle_harness.compat`). It checks the installed engines against the
+hooks the plugin needs, without starting a server, and exits 1 when something is wrong.
+
+```bash
+eagle-harness-check # engines and hooks
+eagle-harness-check --kernels # also loads the native CUDA library on the visible GPU
+```
+
+## Reading `eagle-harness-check`
+
+The first line names the eagle-harness version and where Python imports it from. Then one line per engine:
+
+| line | meaning | what to do |
+|---|---|---|
+| `sglang <version>: ok, every hook matches` | the plugin registers in this engine | nothing |
+| `... ok, every hook matches (untested version, expected sglang>=0.5.23.dev0,<0.6)` | the hooks match, but this engine version was not tested with this eagle-harness | it runs, test before you serve |
+| `sglang <version>: FAILED` followed by `eagle-harness <v> is disabled: ... lacks N of the hooks it needs (...)` | the engine has no eagle-harness hooks, or a different version of them | install the engine build listed in [Compatibility](compatibility.md), or the eagle-harness release your engine build pins |
+| `vllm: not installed` | no importable vLLM in this environment | nothing, if you serve with another engine |
+| `no supported host installed (one of: sglang, vllm, tokenspeed)` | no engine imports | install one, in the same environment as eagle-harness |
+
+With `--kernels`, the last line says where the native library came from:
+
+| line | meaning |
+|---|---|
+| `native CUDA kernels: prebuilt: <path>` | the wheel's library for this CUDA major version loaded |
+| `native CUDA kernels: from $EAGLE_HARNESS_NATIVE_LIB: <path>` | your own build loaded |
+| `native CUDA kernels: built by nvcc on first use: <path>` | no prebuilt library matched, nvcc built one |
+| `native CUDA kernels: not loaded (the Triton kernels run; see the warning above)` | no library could load. The results are the same, the candidate head is slower. The warning before it names each reason. |
+
+On a machine without engines and without a GPU the output is:
+
+```text
+eagle-harness 0.1.0.dev0 (.../eagle_harness/__init__.py)
+sglang: not installed
+vllm: not installed
+tokenspeed: not installed
+no supported host installed (one of: sglang, vllm, tokenspeed)
+```
+
+## Server errors at startup
+
+| message | cause | fix |
+|---|---|---|
+| `Unknown speculative algorithm name: EAGLE_HARNESS` (sglang), vLLM rejects the method `eagle_harness`, or TokenSpeed does not know the algorithm `EAGLE_HARNESS` | the plugin did not register | run `eagle-harness-check` and read the error the engine logged at startup |
+| `EAGLE_HARNESS needs --speculative-algorithm-config (JSON or a path to JSON), ...` | sglang got no config | pass `{}` (live costs), `{"data_path": "<calibration dir>"}` or `{"mode": "static"}` |
+| `Cost tables under ... were measured on another setup (stored vs this server): {...}` | `data_path` tables keyed for another GPU, TP size, model pair, engine build or dtype | calibrate for this setup, or drop `data_path` to measure the costs on the served rounds |
+| `EAGLE-Harness mode 'serve' needs data_path (the calibration directory).` | a cost-model mode without cost tables (TokenSpeed) | set `data_path` ([Calibration](calibration.md)) or use `"mode": "static"` |
+| `config: unknown keys ['intensty']; valid keys are [...]` | a misspelt key | use a key from the list ([Configuration](configuration.md)) |
+| `mode: 'fast' is not one of static, serve, eval, calibrate.` | a bad value | use one of the listed values |
+| `EAGLE_HARNESS needs --speculative-num-steps, --speculative-eagle-topk and --speculative-num-draft-tokens ...` | sglang got no tree shape | pass all three |
+| `max_running_requests=... exceeds the tree draft batch limit 512.` | the explicit request cap exceeds the supported range | set `--max-running-requests` to at most 512, and check that KV and recurrent-state memory can hold the requested batch |
+| `eagle-harness kernels are off: ... is older than NVIDIA sm_80 (A100).` | the GPU is outside the kernel tiers | use a supported GPU ([Kernels](kernels.md)) |
+| `page_size > 1 needs --speculative-draft-attention-backend flashinfer, fa3 or fa4 for EAGLE_HARNESS.` | the draft backend cannot serve paged KV | set one of those backends |
+| `Unexpected FlashInfer page size 128 without trtllm-gen GQA` (vLLM) | the draft runs on FlashInfer, which serves a multi-head draft only on pages up to 64 tokens; a hybrid target needs 128 or more | set `"attention_backend": "FLASH_ATTN"` in `--speculative-config` (the draft's backend only) |
+| `num_speculative_tokens=... disagrees with method_config.max_verify_width=...` (vLLM) | both were set and do not differ by one | set only `max_verify_width` |
+| `the draft tree has fewer nodes than the verify width needs; raise tree_depth or node_top_k` (vLLM) | the tree cannot fill the verify width | raise `tree_depth` or `node_top_k`, or lower `max_verify_width` |
+| `EAGLE_HARNESS on TokenSpeed supports static and serve modes` (TokenSpeed) | an unsupported evaluation or calibration mode | use `static`, or `serve` with matching cost tables |
+| `tree drafting topk=... exceeds verify width ...` (TokenSpeed) | a draft step needs more write locations than the verify-sized buffer holds | raise `--speculative-num-draft-tokens` or lower top-k |
+| `FlashInferSamplingBackend cannot verify draft trees; use --sampling-backend greedy or triton` (TokenSpeed) | TokenSpeed's default sampling backend | pass `--sampling-backend greedy` |
+| `--speculative-num-draft-tokens N verifies more nodes than a tree of depth ... holds` (TokenSpeed) | the tree cannot fill the verify width | raise `--speculative-num-steps` or `--speculative-eagle-topk`, or lower the width |
+| `EAGLE-4 drafts with [...] are not ported to eagle-harness yet (dense drafts only).` | a draft structure the engine does not build (see the FAQ, "Which models work?") | use a supported single-layer EAGLE-4 draft |
+
+## Requests refused
+
+sglang refuses requests with multimodal inputs (`Speculative algorithm EAGLE_HARNESS does not support multimodal
+inputs.`). Serve them from a server without the method.
+
+## Slower than expected
+
+- Check that the cost tables match your GPU, TP size, tree shape and engine build ([Calibration](calibration.md)).
+ Tables from another setup load without an error and make worse choices.
+- Look for the startup warning `native CUDA kernels unavailable`. The Triton fallback gives the same results more
+ slowly.
+- On vLLM, look for the startup line about the depth stop: `no cost tables price a draft step ...` means the stop
+ drafts every step that could still change the verify set.
+- Run `python -m eagle_harness.kernels.arch` to see which kernel tier each GPU gets.
diff --git a/eagle_harness/__init__.py b/eagle_harness/__init__.py
new file mode 100644
index 0000000..801ff71
--- /dev/null
+++ b/eagle_harness/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-Harness: dynamic-tree speculative decoding driven by a measured cost model.
+
+Layout:
+ core/ cost model, calibration, draft-tree bookkeeping, HarnessConfig (engine-agnostic, CPU-testable)
+ kernels/ CUDA / Triton kernels (candidate head, GDN tree verify), built lazily
+ models/ EAGLE-4 draft config validation and the low-rank LM head
+ sglang/ sglang plugin: algorithm (hooks), workers, draft steps, tree attention, draft model
+"""
+
+__version__ = "0.1.0" # x-release-please-version
diff --git a/eagle_harness/cli.py b/eagle_harness/cli.py
new file mode 100644
index 0000000..d07ca55
--- /dev/null
+++ b/eagle_harness/cli.py
@@ -0,0 +1,345 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""User commands, with engine imports deferred until calibration starts."""
+
+from __future__ import annotations
+
+import argparse
+import importlib
+import importlib.util
+import json
+import os
+import shlex
+import signal
+import socket
+import subprocess
+import sys
+import time
+from contextlib import contextmanager
+from pathlib import Path
+from urllib.error import URLError
+from urllib.request import urlopen
+
+
+def _positive(value: str) -> int:
+ number = int(value)
+ if number < 1:
+ raise argparse.ArgumentTypeError("must be a positive integer")
+ return number
+
+
+def _sizes(value: str) -> list[int]:
+ try:
+ sizes = sorted({_positive(item) for item in value.split(",")})
+ except (ValueError, argparse.ArgumentTypeError) as exc:
+ raise argparse.ArgumentTypeError("use comma-separated positive integers, such as 1,8") from exc
+ if sizes[-1] > 512:
+ raise argparse.ArgumentTypeError("batch sizes must not exceed 512")
+ return sizes
+
+
+def _object(value: str) -> dict:
+ try:
+ result = json.loads(value)
+ except ValueError as exc:
+ raise argparse.ArgumentTypeError("must be a JSON object") from exc
+ if not isinstance(result, dict):
+ raise argparse.ArgumentTypeError("must be a JSON object")
+ return result
+
+
+def _engine(requested: str | None) -> str:
+ installed = [name for name in ("sglang", "vllm") if importlib.util.find_spec(name) is not None]
+ if requested:
+ if requested not in installed:
+ raise ValueError(f"{requested} is not installed. Install the pinned engine from docs/install.md.")
+ return requested
+ if len(installed) != 1:
+ raise ValueError("choose --engine sglang or --engine vllm in an environment with that engine installed")
+ return installed[0]
+
+
+def _cli_args(options: dict, *, negative_bools: bool = False) -> list[str]:
+ result = []
+ for name, value in options.items():
+ flag = "--" + name.replace("_", "-")
+ if value is False:
+ if negative_bools:
+ result.append("--no-" + name.replace("_", "-"))
+ continue
+ result.append(flag)
+ if value is not True:
+ values = value if isinstance(value, list) else [value]
+ result.extend(json.dumps(v) if isinstance(v, dict) else str(v) for v in values)
+ return result
+
+
+def serving_command(args: argparse.Namespace) -> list[str]:
+ """Return a shell-safe command matching the measured engine settings."""
+ if args.engine == "sglang":
+ config = {"mode": "serve", "intensity": "chain_intensity", "data_path": str(args.output)}
+ options = {
+ "model_path": args.model,
+ "tp_size": args.tp,
+ "host": "127.0.0.1",
+ "port": 30000,
+ "attention_backend": "flashinfer",
+ "page_size": 1,
+ "mem_fraction_static": 0.70,
+ "context_length": 4608,
+ "max_running_requests": max(args.batch_sizes),
+ "disable_radix_cache": True,
+ "speculative_algorithm": "EAGLE_HARNESS",
+ "speculative_draft_model_path": args.draft,
+ "speculative_eagle_topk": 1,
+ "speculative_num_steps": 7,
+ "speculative_num_draft_tokens": 8,
+ "speculative_algorithm_config": json.dumps(config),
+ # A chain verify on a GDN hybrid target replays the accepted draft inputs into the state at the
+ # commit instead of writing one state snapshot per draft token: at batch 64-256 those snapshots
+ # are the largest GDN verify cost and their cache takes 36 GB per GPU at width 8.
+ "enable_linear_replayssm_spec": True,
+ }
+ options.update(args.engine_args)
+ return [sys.executable, "-m", "sglang.launch_server", *_cli_args(options)]
+ config = {
+ "method": "eagle_harness",
+ "model": args.draft,
+ "method_config": {
+ "mode": "static",
+ "node_top_k": 8,
+ "tree_depth": 12,
+ "max_verify_width": 32,
+ "data_path": str(args.output),
+ },
+ }
+ options = {
+ "tensor_parallel_size": args.tp,
+ "host": "127.0.0.1",
+ "port": 8000,
+ "attention_backend": "CUSTOM",
+ "max_model_len": 4608,
+ "gpu_memory_utilization": 0.85,
+ "max_num_seqs": 1,
+ "max_num_batched_tokens": 8192,
+ "seed": 0,
+ }
+ options.update(args.engine_args)
+ return [
+ "env",
+ "VLLM_USE_V2_MODEL_RUNNER=1",
+ sys.executable,
+ "-m",
+ "vllm.entrypoints.cli.main",
+ "serve",
+ args.model,
+ "--speculative-config",
+ json.dumps(config),
+ *_cli_args(options, negative_bools=True),
+ ]
+
+
+@contextmanager
+def _process(command: list[str], log_path: Path):
+ # Kill only our process group, including TP workers reparented by the engine.
+ with log_path.open("w", encoding="utf-8") as log:
+ process = subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT, start_new_session=True)
+ try:
+ yield process
+ finally:
+ try:
+ os.killpg(process.pid, signal.SIGTERM)
+ except ProcessLookupError:
+ pass
+ try:
+ process.wait(timeout=30)
+ except subprocess.TimeoutExpired:
+ pass
+ try:
+ os.killpg(process.pid, signal.SIGKILL)
+ except ProcessLookupError:
+ pass
+ process.wait()
+
+
+def _run(command: list[str], log_path: Path, timeout: int) -> None:
+ print(f"Running calibration, log: {log_path}", flush=True)
+ with _process(command, log_path) as process:
+ try:
+ code = process.wait(timeout=timeout)
+ except subprocess.TimeoutExpired as exc:
+ raise RuntimeError(f"calibration timed out after {timeout}s. Read {log_path}.") from exc
+ if code:
+ raise RuntimeError(f"calibration exited {code}. Read {log_path}.")
+
+
+def _vllm(args: argparse.Namespace) -> None:
+ common = [
+ sys.executable,
+ "-m",
+ "eagle_harness.vllm.calibrate",
+ "--model",
+ args.model,
+ "--draft",
+ args.draft,
+ "--tp",
+ str(args.tp),
+ "--engine-args",
+ json.dumps(args.engine_args),
+ ]
+ raws = []
+ # The fitter needs all high-intensity verify buckets, even when serving a narrower tree.
+ for width in (8, 16, 32, 64):
+ raw = str(args.output / "raw" / f"width-{width}.json")
+ _run([*common, "measure", raw, str(width)], args.output / f"width-{width}.log", args.timeout)
+ raws.append(raw)
+ _run([*common, "fit", str(args.output), *raws], args.output / "fit.log", args.timeout)
+ from eagle_harness.vllm.calibrate import validate_tables
+
+ validate_tables(str(args.output))
+
+
+def _sglang(args: argparse.Namespace) -> None:
+ try:
+ driver = importlib.import_module("eagle_harness.sglang.calibrate")
+ except ModuleNotFoundError as exc:
+ if exc.name != "eagle_harness.sglang.calibrate":
+ raise
+ raise RuntimeError(
+ "this wheel lacks the SGLang calibration driver. Install a build with SGLang calibration."
+ ) from exc
+ data = args.data
+ if data is None:
+ data = args.output / "smoke-prompts.jsonl"
+ prompts = [
+ "Explain how a hash table works and give a Python example.",
+ "Describe the water cycle in detail for a high school student.",
+ "Write a short story about a scientist solving a problem on a remote island.",
+ "Compare merge sort and quicksort, including examples and their time complexity.",
+ ]
+ data.write_text("".join(json.dumps({"category": "smoke", "turns": [p]}) + "\n" for p in prompts))
+ print("Using built-in smoke prompts. Supply --data for workload-specific acceptance.", flush=True)
+ command = serving_command(args)
+ with socket.socket() as sock:
+ sock.bind(("127.0.0.1", 0))
+ port = sock.getsockname()[1]
+ command[command.index("--port") + 1] = str(port)
+ config_index = command.index("--speculative-algorithm-config") + 1
+ config = json.loads(command[config_index])
+ config["mode"] = "calibrate"
+ command[config_index] = json.dumps(config)
+ log = args.output / "server.log"
+ with _process(command, log) as process:
+ deadline = time.monotonic() + args.timeout
+ while True:
+ if process.poll() is not None:
+ raise RuntimeError(f"SGLang exited before readiness. Read {log}.")
+ if time.monotonic() > deadline:
+ raise RuntimeError(f"SGLang startup timed out. Read {log}.")
+ try:
+ with urlopen(f"http://127.0.0.1:{port}/v1/models", timeout=2) as response:
+ if response.status == 200:
+ break
+ except (URLError, TimeoutError):
+ pass
+ time.sleep(1)
+ driver.measure(
+ port, str(data), args.engine_args.get("tokenizer_path", args.model), args.batch_sizes, args.max_new_tokens
+ )
+ driver.report(str(args.output), 8, max(args.batch_sizes))
+ for file in ("rounds/chain.json", "accept/chain.json"):
+ if not (args.output / file).is_file():
+ raise RuntimeError(f"SGLang produced no {file}. Read {log}.")
+
+
+def main(argv: list[str] | None = None) -> int:
+ """Calibrate the installed engine, returning nonzero on incomplete measurements."""
+ parser = argparse.ArgumentParser(
+ prog="eagle-harness", description="Calibrate EAGLE-Harness for your serving setup."
+ )
+ sub = parser.add_subparsers(dest="command", required=True)
+ cal = sub.add_parser(
+ "calibrate",
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ help="measure and fit a calibration, then print the matching serve command",
+ description="SGLang measures served chains. vLLM measures batch-one tree costs. "
+ "GPU calibration can take longer than five minutes and reserves the selected GPUs.",
+ )
+ cal.add_argument("--model", required=True, help="target model directory or Hugging Face repository")
+ cal.add_argument("--draft", required=True, help="exported draft directory or Hugging Face repository")
+ cal.add_argument("--tp", type=_positive, default=1, help="tensor-parallel GPU count")
+ cal.add_argument("--engine", choices=("sglang", "vllm"), help="auto-detected if exactly one engine is installed")
+ cal.add_argument("--output", type=Path, help="fresh directory (default: ./eagle-calibration-ENGINE)")
+ cal.add_argument("--data", type=Path, help="SGLang workload JSONL with category and turns fields")
+ cal.add_argument("--batch-sizes", type=_sizes, help="SGLang defaults to 1,8. vLLM supports only 1")
+ cal.add_argument("--max-new-tokens", type=_positive, default=1024, help="tokens per SGLang calibration request")
+ cal.add_argument(
+ "--engine-args", type=_object, default={}, help="engine keyword arguments as JSON, also used for serving"
+ )
+ cal.add_argument("--timeout", type=_positive, default=1800, help="seconds per vLLM subprocess or SGLang startup")
+ cal.add_argument(
+ "--dry-run",
+ action="store_true",
+ help="print settings and serving command without loading models or writing files",
+ )
+ args = parser.parse_args(argv)
+
+ # Unwind the subprocess context on scheduler termination, not only Ctrl-C.
+ def terminate(signum, frame):
+ raise KeyboardInterrupt
+
+ previous = signal.signal(signal.SIGTERM, terminate)
+ try:
+ args.engine = args.engine if args.dry_run and args.engine else _engine(args.engine)
+ args.batch_sizes = args.batch_sizes or ([1, 8] if args.engine == "sglang" else [1])
+ if args.engine == "vllm" and (args.batch_sizes != [1] or args.data):
+ raise ValueError("vLLM tree calibration supports only --batch-sizes 1 and does not consume --data")
+ reserved = {
+ "model",
+ "model_path",
+ "tp_size",
+ "tensor_parallel_size",
+ "host",
+ "port",
+ "worker_extension_cls",
+ "max_num_seqs",
+ "max_running_requests",
+ }
+ if any(not key.isidentifier() for key in args.engine_args):
+ raise ValueError("--engine-args keys must be Python keyword names with underscores, not CLI flags")
+ if any(value is None for value in args.engine_args.values()):
+ raise ValueError("--engine-args values must not be null. Omit the option to use its default.")
+ conflicts = [key for key in args.engine_args if key in reserved or key.startswith("speculative")]
+ if conflicts:
+ raise ValueError(f"--engine-args cannot override calibration controls: {conflicts}")
+ args.output = (args.output or Path(f"eagle-calibration-{args.engine}")).resolve()
+ settings = {key: str(value) if isinstance(value, Path) else value for key, value in vars(args).items()}
+ if args.dry_run:
+ print(json.dumps(settings, indent=2))
+ print(shlex.join(serving_command(args)))
+ return 0
+ if args.data and not args.data.is_file():
+ raise ValueError(f"workload file does not exist: {args.data}")
+ args.output.mkdir(parents=True, exist_ok=False)
+ (args.output / "raw").mkdir()
+ (args.output / "settings.json").write_text(json.dumps(settings, indent=2) + "\n")
+ (_sglang if args.engine == "sglang" else _vllm)(args)
+ command = shlex.join(serving_command(args))
+ (args.output / "serve.sh").write_text("#!/bin/sh\nset -eu\nexec " + command + "\n")
+ print(
+ f"Calibration saved in {args.output}. Start the matching server with:\nsh {shlex.quote(str(args.output / 'serve.sh'))}"
+ )
+ return 0
+ except (ValueError, OSError, RuntimeError) as exc:
+ print(f"eagle-harness: {exc}", file=sys.stderr)
+ return 1
+ except KeyboardInterrupt:
+ print("eagle-harness: interrupted. Partial measurements remain in the output directory.", file=sys.stderr)
+ return 130
+ finally:
+ signal.signal(signal.SIGTERM, previous)
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/eagle_harness/compat.py b/eagle_harness/compat.py
new file mode 100644
index 0000000..18a8742
--- /dev/null
+++ b/eagle_harness/compat.py
@@ -0,0 +1,193 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Which serving engines (hosts) this eagle-harness runs on, and the load-time check of the installed one.
+
+The contract with a host is its hooks: each host adapter pins the hook names and signatures it uses, and its plugin
+refuses to register when the installed host differs. The host version does not decide on its own (a source checkout
+without git tags reports a placeholder such as ``0.0.0.dev0``); it goes into every message, and a host that passes
+the hook check but is outside :attr:`Host.versions` gets a warning that the pair is untested.
+
+ python -m eagle_harness.compat [--kernels] # also: eagle-harness-check
+
+prints the report for every installed host and exits 1 when an installed host lacks a hook (or, with ``--kernels``,
+when the native CUDA library does not load).
+"""
+
+from __future__ import annotations
+
+import argparse
+import importlib
+import importlib.metadata
+import logging
+import os
+import sys
+from collections.abc import Callable, Sequence
+from dataclasses import dataclass
+
+from packaging.specifiers import SpecifierSet
+from packaging.version import InvalidVersion, Version
+
+from eagle_harness import __version__
+
+logger = logging.getLogger(__name__)
+
+
+@dataclass(frozen=True)
+class Host:
+ name: str
+ versions: SpecifierSet # versions that can carry the hooks; no release has them yet
+ tested: str # the host commit the hook table was checked against
+ problems: str # "module:function" returning the hook mismatches of the installed host
+
+
+HOSTS = (
+ Host(
+ "sglang",
+ SpecifierSet(">=0.5.23.dev0,<0.6"), # = the `sglang` extra in pyproject.toml
+ "sglang 0.5.23.dev252+eagle.1 = main 05c1539098 + eagle-harness hooks (eagle/v1)",
+ "eagle_harness.sglang.hooks:hook_problems",
+ ),
+ Host(
+ "vllm",
+ SpecifierSet(">=0.32.0rc1.dev283,!=0.32.0"), # = the `vllm` extra in pyproject.toml
+ "vLLM 0.32.0rc1.dev283+eagle.4 = main 074c83a09a + eagle-harness hooks and fixes",
+ "eagle_harness.vllm.adapter:missing_hooks",
+ ),
+ Host(
+ "tokenspeed",
+ SpecifierSet(">=0.1.1,<0.2"), # = the `tokenspeed` extra in pyproject.toml
+ "TokenSpeed 0.1.1+eagle.4 with eagle-harness plugin hooks (see docs/install.md)",
+ "eagle_harness.tokenspeed.hooks:hook_problems",
+ ),
+)
+
+
+@dataclass(frozen=True)
+class Report:
+ host: Host
+ version: str | None # None: the host is not installed
+ problems: list[str] # hook mismatches; empty when every hook matches
+
+ @property
+ def installed(self) -> bool:
+ return self.version is not None
+
+ @property
+ def ok(self) -> bool:
+ return self.installed and not self.problems
+
+ @property
+ def tested_version(self) -> bool:
+ """Checks whether the host version is in :attr:`Host.versions` (False for an unparsable version)."""
+ try:
+ return Version(self.version or "") in self.host.versions
+ except InvalidVersion:
+ return False
+
+ def refusal(self) -> str:
+ """What is wrong and how to fix it, for a host that fails the hook check."""
+ return (
+ f"eagle-harness {__version__} is disabled: {self.host.name} {self.version} lacks "
+ f"{len(self.problems)} of the hooks it needs ({'; '.join(self.problems)}). "
+ f"Fix: install {self.host.name} with the eagle-harness hooks ({self.host.name}{self.host.versions}; "
+ f"tested: {self.host.tested}), or the eagle-harness release that your {self.host.name} pins."
+ )
+
+ def untested(self) -> str:
+ return (
+ f"eagle-harness {__version__}: {self.host.name} {self.version} is outside the tested versions "
+ f"({self.host.name}{self.host.versions}); every hook matches, so the plugin is registered"
+ )
+
+
+def host(name: str) -> Host:
+ return next(h for h in HOSTS if h.name == name)
+
+
+def _resolve(path: str) -> Callable[[], list[str]]:
+ module_name, _, attr = path.partition(":")
+ return getattr(importlib.import_module(module_name), attr)
+
+
+def host_version(name: str) -> str | None:
+ """The version of the importable host module (what actually runs), or None if it is not installed."""
+ try:
+ module = importlib.import_module(name)
+ except ImportError:
+ return None
+ version = getattr(module, "__version__", None)
+ if version is None: # a package without the attribute (TokenSpeed): its distribution's version
+ try:
+ version = importlib.metadata.version(name)
+ except importlib.metadata.PackageNotFoundError:
+ version = "unknown"
+ return str(version)
+
+
+def check(name: str) -> Report:
+ """Checks the installed host ``name`` against this package's hook table."""
+ spec = host(name)
+ version = host_version(name)
+ return Report(spec, version, _resolve(spec.problems)() if version is not None else [])
+
+
+def check_for_registration(name: str) -> bool:
+ """Checks the host before a plugin registers: logs the refusal or the untested-version warning; True to proceed."""
+ report = check(name)
+ if not report.ok:
+ logger.error(report.refusal())
+ return False
+ if not report.tested_version:
+ logger.warning(report.untested())
+ return True
+
+
+def _kernels_line() -> tuple[bool, str]:
+ from eagle_harness.kernels import build, native
+
+ lib = native.library()
+ if lib is None:
+ return False, "native CUDA kernels: not loaded (the Triton kernels run; see the warning above)"
+ if lib._name.startswith(str(build.PREBUILT)):
+ where = "prebuilt"
+ elif lib._name == os.environ.get("EAGLE_HARNESS_NATIVE_LIB"):
+ where = "from $EAGLE_HARNESS_NATIVE_LIB"
+ else:
+ where = "built by nvcc on first use"
+ return True, f"native CUDA kernels: {where}: {lib._name}"
+
+
+def main(argv: Sequence[str] | None = None) -> int:
+ """Command line: report every installed host; exit 1 on a hook mismatch (or unloadable kernels with --kernels)."""
+ ap = argparse.ArgumentParser(description="Check eagle-harness against the installed serving engines.")
+ ap.add_argument("--kernels", action="store_true", help="also load the native CUDA library (needs a GPU)")
+ args = ap.parse_args(argv)
+ logging.basicConfig(level=logging.WARNING, format="%(levelname)s %(message)s")
+ import eagle_harness
+
+ print(f"eagle-harness {__version__} ({eagle_harness.__file__})")
+ reports = [check(h.name) for h in HOSTS]
+ failed = False
+ for report in reports:
+ name = report.host.name
+ if not report.installed:
+ print(f"{name}: not installed")
+ elif report.ok:
+ note = "" if report.tested_version else f" (untested version, expected {name}{report.host.versions})"
+ print(f"{name} {report.version}: ok, every hook matches{note}")
+ else:
+ failed = True
+ print(f"{name} {report.version}: FAILED\n {report.refusal()}")
+ if not any(r.installed for r in reports):
+ failed = True
+ print(f"no supported host installed (one of: {', '.join(h.name for h in HOSTS)})")
+ if args.kernels:
+ ok, line = _kernels_line()
+ failed |= not ok
+ print(line)
+ return 1 if failed else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/eagle_harness/core/__init__.py b/eagle_harness/core/__init__.py
new file mode 100644
index 0000000..6ef296d
--- /dev/null
+++ b/eagle_harness/core/__init__.py
@@ -0,0 +1,4 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Engine-agnostic core: cost model, calibration, configuration."""
diff --git a/eagle_harness/core/aiter_gemm_bf16.csv b/eagle_harness/core/aiter_gemm_bf16.csv
new file mode 100644
index 0000000..60bbf06
--- /dev/null
+++ b/eagle_harness/core/aiter_gemm_bf16.csv
@@ -0,0 +1 @@
+gfx,cu_num,M,N,K,bias,dtype,outdtype,scaleAB,bpreshuffle,libtype,solidx,splitK,us,kernelName,err_ratio,tflops,bw
diff --git a/eagle_harness/core/attention_sweeps.py b/eagle_harness/core/attention_sweeps.py
new file mode 100644
index 0000000..ff8d537
--- /dev/null
+++ b/eagle_harness/core/attention_sweeps.py
@@ -0,0 +1,140 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""GPU timing sweeps of attention cost vs context length (calibration step 1).
+
+:func:`sweep` times every (query length, context length) of a plan through a
+``Timer`` (CUDA events around ``num_layers`` repeated calls, warm-up lengths
+below ``kv_step`` dropped) and writes the jsonl records
+:func:`eagle_harness.core.calibration.fit_cache_costs` reads. The FlashInfer
+timer calls the kernel directly, not through an engine.
+"""
+
+from __future__ import annotations
+
+import logging
+import os
+from dataclasses import dataclass
+from typing import List, Protocol, Sequence
+
+import torch
+
+from eagle_harness.core.calibration import CacheSweepPlan, MeasureRecord, save_jsonl
+
+logger = logging.getLogger(__name__)
+
+
+@dataclass(frozen=True)
+class HeadLayout:
+ """Per-rank attention heads of a model under tensor parallelism."""
+
+ num_qo_heads: int
+ num_kv_heads: int
+ head_dim: int
+
+ @classmethod
+ def for_rank(
+ cls, num_qo_heads_total: int, num_kv_heads_total: int, head_dim: int, tp_size: int, *, replicate_kv: bool = True
+ ) -> "HeadLayout":
+ """KV heads fewer than the ranks are replicated (one per rank) when ``replicate_kv``."""
+ if num_qo_heads_total % tp_size != 0:
+ raise ValueError("Total number of query heads must be divisible by tp_size.")
+ if replicate_kv:
+ if num_kv_heads_total % tp_size != 0 and tp_size % num_kv_heads_total != 0:
+ raise ValueError("KV heads and tp_size must divide one another.")
+ kv = max(1, num_kv_heads_total // tp_size)
+ else:
+ if num_kv_heads_total % tp_size != 0:
+ raise ValueError("Total number of KV heads must be divisible by tp_size.")
+ kv = num_kv_heads_total // tp_size
+ return cls(num_qo_heads_total // tp_size, kv, head_dim)
+
+
+class Timer(Protocol):
+ """Times batched attention calls for the sweeps."""
+
+ def time_us(self, batch_size: int, qo_len: int, kv_len: int, num_layers: int) -> int:
+ """Microseconds for ``num_layers`` attention calls at this shape."""
+
+
+def _timed(fn, num_layers: int) -> int:
+ start = torch.cuda.Event(enable_timing=True)
+ end = torch.cuda.Event(enable_timing=True)
+ torch.cuda.synchronize()
+ start.record()
+ for _ in range(num_layers):
+ fn()
+ end.record()
+ torch.cuda.synchronize()
+ return int(start.elapsed_time(end) * 1000)
+
+
+class FlashInferTimer:
+ """Paged prefill with a causal custom mask (the tree-verify kernel family)."""
+
+ def __init__(self, heads: HeadLayout, tp_size: int, device: str = "cuda", page_size: int = 1):
+ import flashinfer
+
+ self.heads, self.device, self.page_size = heads, device, page_size
+ workspace = torch.empty(min(8, tp_size) * 128 * 1024 * 1024, dtype=torch.uint8, device=device)
+ self.wrapper = flashinfer.BatchPrefillWithPagedKVCacheWrapper(workspace, "NHD")
+
+ def time_us(self, batch_size: int, qo_len: int, kv_len: int, num_layers: int) -> int:
+ """Microseconds of ``num_layers`` paged-prefill calls at this shape."""
+ h, dev, page = self.heads, self.device, self.page_size
+ nnz_qo = qo_len * batch_size
+ pages_per_seq = (kv_len + page - 1) // page
+ last_page_len = kv_len - (pages_per_seq - 1) * page
+ num_pages = pages_per_seq * batch_size
+ mask = torch.tril(torch.ones(qo_len, kv_len, dtype=torch.bool, device=dev), diagonal=kv_len - qo_len)
+ self.wrapper.plan(
+ torch.arange(0, nnz_qo + 1, qo_len, dtype=torch.int32, device=dev),
+ torch.arange(0, num_pages + 1, pages_per_seq, dtype=torch.int32, device=dev),
+ torch.arange(num_pages, dtype=torch.int32, device=dev),
+ torch.full((batch_size,), last_page_len, dtype=torch.int32, device=dev),
+ h.num_qo_heads,
+ h.num_kv_heads,
+ h.head_dim,
+ page,
+ custom_mask=mask.expand(batch_size, -1, -1).flatten(),
+ )
+ q = torch.randn(nnz_qo, h.num_qo_heads, h.head_dim, dtype=torch.float16, device=dev)
+ kv = torch.randn(num_pages, 2, page, h.num_kv_heads, h.head_dim, dtype=torch.float16, device=dev)
+ return _timed(lambda: self.wrapper.run(q, kv), num_layers)
+
+
+def sweep(
+ timer: Timer,
+ *,
+ category: str,
+ batch_size: int,
+ qo_lens: Sequence[int],
+ plan: CacheSweepPlan,
+ save_dir: str,
+ device: str = "cuda",
+) -> List[str]:
+ """Time every (qo_len, kv_len) of the plan; write ``cache_qo_len_<q>.jsonl`` per qo_len."""
+ written = []
+ for qo_len in qo_lens:
+ records = []
+ for kv_len in plan.cache_lengths():
+ kv_len = max(kv_len, 1)
+ us = timer.time_us(batch_size, qo_len, kv_len, plan.num_layers)
+ if kv_len >= plan.kv_step: # shorter lengths are warm-up
+ records.append(MeasureRecord(us, plan.num_layers, qo_len, kv_len, category, batch_size))
+ _release_if_low(device)
+ if not records:
+ raise RuntimeError(f"No valid measurements collected for qo_len = {qo_len}.")
+ path = os.path.join(save_dir, f"cache_qo_len_{qo_len}.jsonl")
+ save_jsonl(path, records)
+ written.append(path)
+ return written
+
+
+def _release_if_low(device: str) -> None:
+ if not torch.cuda.is_available():
+ return
+ free, total = torch.cuda.mem_get_info(device)
+ if free / total < 0.05:
+ logger.warning("Low GPU memory during the attention sweep; timings may be slower.")
+ torch.cuda.empty_cache()
diff --git a/eagle_harness/core/calibration.py b/eagle_harness/core/calibration.py
new file mode 100644
index 0000000..958eb47
--- /dev/null
+++ b/eagle_harness/core/calibration.py
@@ -0,0 +1,621 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Calibration: measurement records, the cost fits, and the on-disk layout.
+
+The files written here match the golden fixtures for the same raw measurements
+(``tests/test_cost_golden.py``), preserving the calibrated cost-table layout.
+
+Layout under a calibration ``data_path``::
+
+ config/measure_config.json MeasureParams of the batch being measured
+ config/task_normal.json [{"task_normal": bool}]: false = unstable, retry
+ test/bs_<N>/{model,cache}_{slm,llm}/ raw timings (jsonl, one record per line)
+ cost/bs_<N>/{cache,query,model}_{slm,llm}/ fitted costs (json)
+
+``slm`` is the draft model, ``llm`` the target.
+"""
+
+from __future__ import annotations
+
+import json
+import logging
+import os
+from collections import defaultdict
+from dataclasses import asdict, dataclass
+from typing import Dict, List, Optional, Sequence, Tuple
+
+import numpy as np
+
+from eagle_harness.core.limits import (
+ ComputeIntensity,
+ draft_query_lens,
+ verify_buckets,
+)
+
+logger = logging.getLogger(__name__)
+
+DRAFT = "slm"
+TARGET = "llm"
+
+
+# --------------------------------------------------------------------- records
+@dataclass
+class MeasureRecord:
+ """One timing: ``time_us`` for ``measure_count`` repeats of one shape."""
+
+ time_us: int
+ measure_count: int = 1
+ query_length: int = 1
+ cache_length: int = 64
+ task_category: str = "cache_llm"
+ batch_size: int = 1
+
+ def to_dict(self) -> dict:
+ """The measurement record in the on-disk JSON format."""
+ return {
+ "time_intervals": self.time_us,
+ "measure_count": self.measure_count,
+ "query_length": self.query_length,
+ "cache_length": self.cache_length,
+ "task_category": self.task_category,
+ "batch_size": self.batch_size,
+ }
+
+
+def save_jsonl(path: str, records: Sequence[MeasureRecord]) -> None:
+ """Write ``records`` to ``path``, one JSON object per line."""
+ os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
+ with open(path, "w", encoding="utf-8") as f:
+ for record in records:
+ f.write(json.dumps(record.to_dict(), ensure_ascii=False) + "\n")
+
+
+def load_jsonl(path: str) -> List[dict]:
+ """Read the JSON objects of a JSON-lines file."""
+ rows = []
+ with open(path, encoding="utf-8") as f:
+ for line in f:
+ if not line.strip():
+ continue
+ try:
+ rows.append(json.loads(line.strip()))
+ except json.JSONDecodeError:
+ logger.warning("Skipping malformed JSON line in %s", path)
+ return rows
+
+
+def _save_json_lines(path: str, rows: Sequence[dict]) -> None:
+ os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
+ with open(path, "w", encoding="utf-8") as f:
+ for row in rows:
+ json.dump(row, f, ensure_ascii=False)
+ f.write("\n")
+
+
+def _write_json(path: str, data: dict) -> None:
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ with open(path, "w", encoding="utf-8") as f:
+ json.dump(data, f, indent=4)
+
+
+# ---------------------------------------------------------------- parameters
+@dataclass
+class MeasureParams:
+ """What one batch size's calibration measures (``config/measure_config.json``)."""
+
+ context_step: int
+ context_stop: int
+ batch_size: int
+ verify_num: int
+ node_top_k: int
+ loop_top_m: int
+ repeat_cnt: int
+ enable_fast_measurement: bool = False
+ cache_len: int = 1
+ query_llm: int = 1
+ query_slm: int = 1
+
+
+@dataclass(frozen=True)
+class CalibrationPaths:
+ """Layout of a calibration directory: ``test/`` raw measurements, ``cost/`` fitted tables, ``config/``."""
+
+ data_path: str
+
+ @property
+ def cost(self) -> str:
+ """Directory of the fitted cost tables."""
+ return os.path.join(self.data_path, "cost")
+
+ @property
+ def test(self) -> str:
+ """Directory of the raw measurements."""
+ return os.path.join(self.data_path, "test")
+
+ @property
+ def config(self) -> str:
+ """Directory of the calibration settings."""
+ return os.path.join(self.data_path, "config")
+
+ def raw(self, batch_size: int, kind: str, model: str) -> str:
+ """Raw measurement file of one batch size, kind and model."""
+ return os.path.join(self.test, f"bs_{batch_size}", f"{kind}_{model}")
+
+ def fitted(self, batch_size: int, kind: str, model: str) -> str:
+ """Fitted cost file of one batch size, kind and model."""
+ return os.path.join(self.cost, f"bs_{batch_size}", f"{kind}_{model}")
+
+ def write_measure_params(self, params: MeasureParams) -> None:
+ """Store the measurement settings."""
+ _save_json_lines(os.path.join(self.config, "measure_config.json"), [asdict(params)])
+
+ def set_task_normal(self, normal: bool) -> None:
+ """Store the ``task_normal`` flag of the calibration run."""
+ _save_json_lines(os.path.join(self.config, "task_normal.json"), [{"task_normal": normal}])
+
+ def task_normal(self) -> bool:
+ """The stored ``task_normal`` flag."""
+ rows = load_jsonl(os.path.join(self.config, "task_normal.json"))
+ return bool(rows[0]["task_normal"])
+
+
+@dataclass(frozen=True)
+class CacheSweepPlan:
+ """Grid of one attention-cost sweep with validated cache-length bounds."""
+
+ kv_start: int
+ kv_step: int # timings below this cache length are warm-up and dropped
+ kv_stop: int
+ interval_step: int
+ num_layers: int
+
+ @classmethod
+ def from_params(cls, params: MeasureParams) -> "CacheSweepPlan":
+ """The sweep plan of the measurement settings (context step and stop are validated)."""
+ step, stop = params.context_step, params.context_stop
+ if step not in (64, 128, 256, 512, 1024):
+ raise ValueError(f"context_step must be 64, 128, 256, 512 or 1024, got {step}.")
+ if not 2048 <= stop <= 128 * 1024:
+ raise ValueError(f"context_stop must be in [2048, 131072], got {stop}.")
+ if stop % step != 0 or not 16 <= stop // step <= 128:
+ raise ValueError(f"context_stop must be 16..128 multiples of context_step, got {stop} / {step}.")
+ num_layers = params.repeat_cnt
+ interval_step = step // 32
+ if params.enable_fast_measurement:
+ interval_step = step // 16
+ if stop // step >= 32 and stop >= 32 * 1024:
+ num_layers = max(num_layers // 4, 1)
+ elif (stop // step >= 32 and stop >= 8 * 1024) or stop >= 16 * 1024:
+ num_layers = max(num_layers // 2, 1)
+ return cls(step // 2, step, stop, interval_step, num_layers)
+
+ def cache_lengths(self) -> range:
+ """The cache lengths the sweep measures."""
+ return range(self.kv_start, self.kv_stop + 1, self.interval_step)
+
+
+def query_lens(category: str, batch_size: int, intensity: ComputeIntensity, max_query_length: int) -> List[int]:
+ """Query lengths a fit reads: draft widths for the draft, verify buckets for the target."""
+ if category.endswith(DRAFT):
+ return [q for q in draft_query_lens(batch_size, intensity) if q <= max_query_length]
+ if category.endswith(TARGET):
+ return sorted(q for q in verify_buckets(batch_size, intensity) if q <= max_query_length)
+ return list(range(1, max_query_length + 1))
+
+
+# ------------------------------------------------------------------- fitting
+def remove_outliers(
+ data: Sequence[float],
+ initial_threshold: float = 6.00,
+ threshold_decrement: float = 0.20,
+ min_threshold: float = 1.00,
+ convergence_threshold: float = 0.20,
+ max_iterations: int = 50,
+ sample_rate: float = 0.75,
+) -> Tuple[float, List[float], bool]:
+ """Iterative z-score filter. Returns (mean, kept values, stable)."""
+ if len(data) == 0:
+ raise ValueError("Input data is empty.")
+ kept = list(data)
+ threshold = initial_threshold
+ range_rate = 1.00
+ mean = np.mean(kept)
+ for _ in range(max_iterations):
+ values = np.asarray(kept, dtype=np.float64)
+ with np.errstate(divide="ignore", invalid="ignore"):
+ z = np.abs((values - values.mean()) / values.std())
+ kept = [x for i, x in enumerate(kept) if z[i] < threshold]
+ if kept:
+ mean = np.mean(kept)
+ if len(kept) < sample_rate * len(data):
+ break
+ range_rate = (np.max(kept) - np.min(kept)) / mean
+ if mean != 0 and range_rate <= convergence_threshold:
+ break
+ threshold = max(threshold - threshold_decrement, min_threshold)
+ stable = (range_rate <= convergence_threshold) and (len(kept) >= sample_rate * len(data))
+ return mean, kept, stable
+
+
+def _interval_ids(path: str, prefix: str) -> int:
+ max_id = -1
+ for name in os.listdir(path):
+ if name.startswith(prefix) and name.endswith(".json"):
+ try:
+ max_id = max(max_id, int(name.split("_")[-1].split(".")[0]))
+ except ValueError as e:
+ raise RuntimeError(f"Unexpected file name format: {name}") from e
+ if max_id == -1:
+ raise FileNotFoundError(f"No valid '{prefix}*.json' files found in {path}")
+ return max_id
+
+
+def fit_cache_costs(
+ category: str,
+ source: str,
+ target: str,
+ *,
+ max_query_length: int,
+ cache_length_start: int,
+ cache_length_step: int,
+ cache_length_stop: int,
+ batch_size: int,
+ intensity: ComputeIntensity,
+ fast: bool = False,
+ paths: Optional[CalibrationPaths] = None,
+) -> float:
+ """Per-interval attention cost per layer, per query length. Returns the
+ instability rate; above the limit, ``paths`` gets ``task_normal=false``."""
+ interval_data: Dict[int, Dict[int, List[float]]] = defaultdict(lambda: defaultdict(list))
+ for qo_len in query_lens(category, batch_size, intensity, max_query_length):
+ file_path = os.path.join(source, f"cache_qo_len_{qo_len}.jsonl")
+ if not os.path.exists(file_path):
+ raise FileNotFoundError(f"Source file not found: {file_path}")
+ for record in load_jsonl(file_path):
+ kv_len = record["cache_length"]
+ if not cache_length_start <= kv_len < cache_length_stop:
+ continue
+ interval_id = (kv_len - cache_length_start) // cache_length_step
+ interval_data[interval_id][qo_len].append(record["time_intervals"] / record["measure_count"])
+
+ means: Dict[int, list] = defaultdict(lambda: [0.0] * max_query_length)
+ total = unstable = 0
+ for interval_id, by_q in interval_data.items():
+ for qo_len, times in by_q.items():
+ total += 1
+ mean, _, stable = remove_outliers(times, convergence_threshold=0.25 if fast else 0.35)
+ unstable += not stable
+ means[interval_id][qo_len - 1] = mean
+ instability = unstable / total if total > 0 else 0.0
+ if instability >= (0.20 if fast else 0.25):
+ logger.warning("High cache-cost instability: %.2f%%", instability * 100)
+ if paths is not None:
+ paths.set_task_normal(False)
+
+ for interval_id in range((cache_length_stop - cache_length_start) // cache_length_step):
+ sequence = means.get(interval_id, [0.0] * max_query_length)
+ ratio = [round(v / sequence[0], 4) for v in sequence] if sequence and sequence[0] > 0 else []
+ _write_json(
+ os.path.join(target, f"cache_interval_{interval_id}.json"),
+ {
+ "value": [round(v, 4) for v in sequence],
+ "index": list(range(len(sequence))),
+ "ratio": [round(v, 4) for v in ratio],
+ "array": [round(v, 4) for v in sequence],
+ "batch_size": batch_size,
+ "max_query_length": max_query_length,
+ "cache_length_start": cache_length_start,
+ "cache_length_step": cache_length_step,
+ "cache_length_stop": cache_length_stop,
+ "instability_rate": round(instability, 2),
+ },
+ )
+ return instability
+
+
+def _load_cache_arrays(path: str) -> Dict[int, list]:
+ arrays = {}
+ for i in range(_interval_ids(path, "cache_interval_") + 1):
+ file_path = os.path.join(path, f"cache_interval_{i}.json")
+ if not os.path.exists(file_path):
+ raise FileNotFoundError(f"Expected cache interval file not found: {file_path}")
+ with open(file_path, encoding="utf-8") as f:
+ arrays[i] = json.load(f).get("array", [])
+ return arrays
+
+
+def fit_query_costs(
+ category: str,
+ model_source: str,
+ cache_source: str,
+ target: str,
+ *,
+ max_query_length: int,
+ cache_length_start: int,
+ cache_length_step: int,
+ cache_layers: int,
+ batch_size: int,
+ intensity: ComputeIntensity,
+ average: bool = False,
+ sliding_window_layers: int = 0,
+ sliding_window: int = 0,
+ paths: Optional[CalibrationPaths] = None,
+) -> float:
+ """Non-attention cost per query length: measured step minus fitted attention."""
+ cache_costs = _load_cache_arrays(cache_source)
+ lens = query_lens(category, batch_size, intensity, max_query_length)
+ query_costs: Dict[int, List[float]] = defaultdict(list)
+ for qo_len in lens:
+ file_path = os.path.join(model_source, f"model_qo_len_{qo_len}.jsonl")
+ if not os.path.exists(file_path):
+ raise FileNotFoundError(f"Source file not found: {file_path}")
+ for record in load_jsonl(file_path):
+ kv_len = record["cache_length"]
+ if kv_len < cache_length_start:
+ continue
+ interval_id = (kv_len - cache_length_start) // cache_length_step
+ if interval_id not in cache_costs or len(cache_costs[interval_id]) < qo_len:
+ continue
+ cost_cache = cache_costs[interval_id][qo_len - 1]
+ cost = record["time_intervals"] / record["measure_count"] - cost_cache * cache_layers
+ if sliding_window_layers > 0 and kv_len > sliding_window:
+ swa_id = max((sliding_window - cache_length_start) // cache_length_step, 0)
+ cost += sliding_window_layers * (cost_cache - cache_costs[swa_id][qo_len - 1])
+ query_costs[qo_len].append(cost)
+
+ total = unstable = 0
+ for qo_len in lens:
+ costs = query_costs.get(qo_len, [])
+ if not costs:
+ raise RuntimeError(f"No query cost data available for query length {qo_len}.")
+ total += 1
+ mean, _, stable = remove_outliers(costs, convergence_threshold=0.50 if average else 0.30)
+ unstable += not stable
+ _write_json(
+ os.path.join(target, f"query_{qo_len}.json"),
+ {"mean": round(mean, 4), "array": [round(v, 4) for v in costs], "batch_size": batch_size},
+ )
+ instability = unstable / total if total > 0 else 0.0
+ if instability >= 0.30:
+ logger.warning("High query-cost instability: %.2f%%", instability * 100)
+ if paths is not None:
+ paths.set_task_normal(False)
+ for qo_len in lens:
+ file_path = os.path.join(target, f"query_{qo_len}.json")
+ with open(file_path, "r+", encoding="utf-8") as f:
+ data = json.load(f)
+ data["instability_rate"] = round(instability, 4)
+ f.seek(0)
+ f.truncate()
+ json.dump(data, f, indent=4)
+ return instability
+
+
+def fit_model_costs(
+ category: str,
+ query_source: str,
+ cache_source: str,
+ target: str,
+ *,
+ max_query_length_query: int,
+ max_query_length_cache: int,
+ cache_length_start: int,
+ cache_length_step: int,
+ cache_layers: int,
+ batch_size: int,
+ intensity: ComputeIntensity,
+ sliding_window_layers: int = 0,
+ sliding_window: int = 0,
+) -> None:
+ """Model cost per interval and query length = query cost + attention cost.
+
+ Writes the ``model_interval_<i>.json`` files :mod:`cost_table` reads.
+ """
+ lens = query_lens(category, batch_size, intensity, max_query_length_query)
+ query_costs = [0.0] * len(lens)
+ for i, qo_len in enumerate(lens):
+ file_path = os.path.join(query_source, f"query_{qo_len}.json")
+ if not os.path.exists(file_path):
+ raise FileNotFoundError(f"Expected query cost file not found: {file_path}")
+ with open(file_path, encoding="utf-8") as f:
+ query_costs[i] = json.load(f).get("mean", 0.0)
+
+ max_id = _interval_ids(cache_source, "cache_interval_")
+ swa_index = max(sliding_window // cache_length_step - 1, 0)
+ sequences: List[list] = []
+ for interval_id in range(max_id + 1):
+ with open(os.path.join(cache_source, f"cache_interval_{interval_id}.json"), encoding="utf-8") as f:
+ cache_data = json.load(f)
+ sequence = cache_data.get("array", [])
+ sequences.append(sequence)
+ if not sequence or len(sequence) != max_query_length_cache:
+ raise RuntimeError(f"Cache cost data for interval {interval_id} is invalid.")
+ costs = [0] * len(lens)
+ for i, n in enumerate(lens):
+ if swa_index == 0 or interval_id <= swa_index:
+ costs[i] = query_costs[i] + sequence[n - 1] * cache_layers
+ else:
+ full = sequence[n - 1] * (cache_layers - sliding_window_layers)
+ windowed = sequences[swa_index][n - 1] * sliding_window_layers
+ costs[i] = query_costs[i] + full + windowed
+ ratio = [round(v / costs[0], 4) for v in costs] if costs and costs[0] > 0 else []
+ _write_json(
+ os.path.join(target, f"model_interval_{interval_id}.json"),
+ {
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [round(v, 4) for v in costs],
+ "index": [q - 1 for q in lens],
+ "ratio": ratio,
+ "array_model": [round(v, 4) for v in costs],
+ "array_query": [round(v, 4) for v in query_costs],
+ "array_cache": [round(v * cache_layers, 4) for v in sequence],
+ "batch_size": batch_size,
+ "max_query_length_query": max_query_length_query,
+ "max_query_length_cache": max_query_length_cache,
+ "cache_length_start": cache_length_start,
+ "cache_length_step": cache_length_step,
+ "cache_layers_num": cache_layers,
+ "instability_rate": cache_data.get("instability_rate", -1.0),
+ },
+ )
+
+
+# ---------------------------------------------------------------- one batch
+@dataclass(frozen=True)
+class AttentionShape:
+ """What the fits need of a model: attention layers and sliding-window layers."""
+
+ attention_layers: int
+ sliding_window_layers: int = 0
+ sliding_window: int = 0
+
+
+def save_model_timings(paths: CalibrationPaths, params: MeasureParams, records: Sequence[MeasureRecord]) -> None:
+ """Group step timings by model and query length into ``model_qo_len_<q>.jsonl``."""
+ groups: Dict[Tuple[str, int], List[MeasureRecord]] = defaultdict(list)
+ for record in records:
+ model = record.task_category.split("_")[-1]
+ groups[(model, record.query_length)].append(record)
+ for (model, qo_len), group in sorted(groups.items()):
+ save_jsonl(os.path.join(paths.raw(params.batch_size, "model", model), f"model_qo_len_{qo_len}.jsonl"), group)
+
+
+def fit_batch(
+ paths: CalibrationPaths,
+ params: MeasureParams,
+ intensity: ComputeIntensity,
+ draft: AttentionShape,
+ target: AttentionShape,
+ *,
+ tp_size: int = 1,
+) -> None:
+ """Fit one batch size from raw timings, processing the draft before the target."""
+ bs = params.batch_size
+ start, step, stop = params.context_step, params.context_step, params.context_stop
+ for model, max_q in ((DRAFT, params.node_top_k), (TARGET, params.verify_num)):
+ fit_cache_costs(
+ f"cache_all_{model}",
+ paths.raw(bs, "cache", model),
+ paths.fitted(bs, "cache", model),
+ max_query_length=max_q,
+ cache_length_start=start,
+ cache_length_step=step,
+ cache_length_stop=stop,
+ batch_size=bs,
+ intensity=intensity,
+ fast=params.enable_fast_measurement,
+ paths=paths,
+ )
+ for model, shape, max_q, average in (
+ (DRAFT, draft, params.node_top_k, (not params.enable_fast_measurement) or tp_size > 1),
+ (TARGET, target, params.loop_top_m, False),
+ ):
+ fit_query_costs(
+ f"query_{model}",
+ paths.raw(bs, "model", model),
+ paths.fitted(bs, "cache", model),
+ paths.fitted(bs, "query", model),
+ max_query_length=max_q,
+ cache_length_start=start,
+ cache_length_step=step,
+ cache_layers=shape.attention_layers,
+ batch_size=bs,
+ intensity=intensity,
+ average=average,
+ sliding_window_layers=shape.sliding_window_layers,
+ sliding_window=shape.sliding_window,
+ paths=paths,
+ )
+ for model, shape, max_q, max_cache in (
+ (DRAFT, draft, params.node_top_k, params.node_top_k),
+ (TARGET, target, params.loop_top_m, params.verify_num),
+ ):
+ fit_model_costs(
+ f"model_{model}",
+ paths.fitted(bs, "query", model),
+ paths.fitted(bs, "cache", model),
+ paths.fitted(bs, "model", model),
+ max_query_length_query=max_q,
+ max_query_length_cache=max_cache,
+ cache_length_start=start,
+ cache_length_step=step,
+ cache_layers=shape.attention_layers,
+ batch_size=bs,
+ intensity=intensity,
+ sliding_window_layers=shape.sliding_window_layers,
+ sliding_window=shape.sliding_window,
+ )
+
+
+# ------------------------------------------------- engines that time whole steps only
+@dataclass(frozen=True)
+class StepTiming:
+ """One timed forward of a step: ``query_length`` tokens per request at ``cache_length``, ``time_us`` microseconds."""
+
+ query_length: int
+ cache_length: int
+ time_us: float
+
+
+def attention_growth_records(
+ timings: Sequence[StepTiming], attention_layers: int, category: str, batch_size: int = 1
+) -> List[MeasureRecord]:
+ """Attention cost per layer from step timings alone: how much the step grows over the shortest cache length, per layer.
+
+ An engine without an attention-only timing (vLLM) still has what the fits need: the model cost is the query cost plus
+ ``layers * cache cost``, and the cache cost is exactly what a step gains from a longer cache.
+ """
+ records = []
+ for q in sorted({t.query_length for t in timings}):
+ by_length = {t.cache_length: t.time_us for t in timings if t.query_length == q}
+ base = min(by_length.values())
+ records += [
+ MeasureRecord(
+ time_us=max(int(1000 * (time - base) / attention_layers), 1),
+ measure_count=1000,
+ query_length=q,
+ cache_length=length,
+ task_category=category,
+ batch_size=batch_size,
+ )
+ for length, time in by_length.items()
+ ]
+ return records
+
+
+def fit_step_timings(
+ paths: CalibrationPaths,
+ params: MeasureParams,
+ intensity: ComputeIntensity,
+ draft: Tuple[AttentionShape, Sequence[StepTiming]],
+ target: Tuple[AttentionShape, Sequence[StepTiming]],
+ *,
+ tp_size: int = 1,
+) -> None:
+ """Store the raw timings of one batch size and run all fits, from whole-step timings of the draft and the target."""
+ paths.write_measure_params(params)
+ paths.set_task_normal(True)
+ bs = params.batch_size
+ for model, (shape, timings) in ((DRAFT, draft), (TARGET, target)):
+ save_model_timings(
+ paths,
+ params,
+ [
+ MeasureRecord(
+ time_us=int(1000 * t.time_us),
+ measure_count=1000,
+ query_length=t.query_length,
+ cache_length=t.cache_length,
+ task_category=f"model_{model}",
+ batch_size=bs,
+ )
+ for t in timings
+ ],
+ )
+ by_query: Dict[int, List[MeasureRecord]] = defaultdict(list)
+ for record in attention_growth_records(timings, shape.attention_layers, f"cache_{model}", bs):
+ by_query[record.query_length].append(record)
+ for q, group in by_query.items():
+ save_jsonl(os.path.join(paths.raw(bs, "cache", model), f"cache_qo_len_{q}.jsonl"), group)
+ fit_batch(paths, params, intensity, draft[0], target[0], tp_size=tp_size)
diff --git a/eagle_harness/core/candidate_calibration.py b/eagle_harness/core/candidate_calibration.py
new file mode 100644
index 0000000..5945d91
--- /dev/null
+++ b/eagle_harness/core/candidate_calibration.py
@@ -0,0 +1,28 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Load an offline-measured candidate selection crossover, never time at startup."""
+
+import json
+from pathlib import Path
+
+
+def load_candidate_crossover(data_path, identity):
+ """Return a measured score-count limit for an exact environment, or None.
+
+ Calibration identity includes device, torch/Triton versions, dtype, vocabulary
+ shard and candidate count. A missing or different profile retains the normal
+ dispatcher; malformed matching data fails rather than selecting arbitrary code.
+ """
+ if data_path is None:
+ return None
+ path = Path(data_path) / "candidate_topk.json"
+ if not path.is_file():
+ return None
+ profile = json.loads(path.read_text())
+ if profile.get("identity") != identity:
+ return None
+ limit = profile["max_triton_elements"]
+ if type(limit) is not int or limit < 0:
+ raise ValueError(f"invalid candidate top-k crossover in {path}: {limit!r}")
+ return limit
diff --git a/eagle_harness/core/chain_width.py b/eagle_harness/core/chain_width.py
new file mode 100644
index 0000000..a7ff31d
--- /dev/null
+++ b/eagle_harness/core/chain_width.py
@@ -0,0 +1,345 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Chain verify width per batch size, from the cost tables and a measured acceptance profile.
+
+A chain round of width ``w`` drafts ``w - 1`` tokens and verifies them with the root. Under greedy acceptance a
+request gains ``1 + a_1 + ... + a_{w-1}`` tokens per round, where ``a_d`` is the share of rounds whose first ``d``
+drafted tokens are all accepted: a property of the draft, the target and the workload, not of the batch size. The
+round takes ``V(B, w) + (w - 1) * D(B)`` at batch size ``B``: the target's verify forward of ``w`` tokens per request
+and ``w - 1`` draft steps of one token per request, both from the cost tables. The width with the most tokens per
+unit of time serves batch size ``B``; width 1 verifies only the root and may still extend draft KV.
+
+Small batches are bound by weight reads, so ``V`` barely grows with ``w`` and the widest chain wins; large batches are
+bound by compute, ``V`` grows with the tokens it verifies, and the optimum narrows down to plain decoding. The width
+is fixed per batch size, so a round reads nothing back from the GPU to choose it.
+
+The acceptance profile is ``<data_path>/accept/chain.json``::
+
+ {"drafts": <rounds counted>, "accepted_per_position": [<rounds whose drafted token d + 1 was accepted>, ...]}
+
+the counters vLLM keeps as ``spec_decode_num_drafts`` and ``spec_decode_num_accepted_tokens_per_pos``, measured at the
+widest chain on the workload to be served. Positions past the profile have no measured acceptance, so wider chains
+are not considered.
+
+``V + (w - 1) D`` from the cost tables prices a round by its forwards alone. A served round also pays the scheduler,
+the draft extend and the launches, and at large batch sizes those dominate: timings of isolated forwards priced the
+vLLM chain round at batch size 64 about 3x too cheap. Served round times replace the price when they were measured:
+``<data_path>/rounds/chain.json``::
+
+ {"rounds": [{"batch_size": 64, "width": 4, "round_us": 21500.0, "count": 180}, ...]}
+
+the median period between consecutive decode rounds of a serving engine at that batch size with every round of that
+width. Width 1 is root-only verification. Width 0 means native decode in the same engine, with no draft
+forward or draft KV update, and is considered only when the adapter supports that action. It never means
+starting a separate engine. The width of batch size ``B`` is then
+``argmax_w (1 + a_1 + ... + a_{w-1}) / R(B, w)``.
+"""
+
+from __future__ import annotations
+
+import json
+import os
+import statistics
+from dataclasses import dataclass
+from typing import Dict, List, Mapping, Optional, Sequence, Tuple
+
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, load_cost_tables
+from eagle_harness.core.limits import nearest_cost_batch_size
+
+PROFILE_FILE = os.path.join("accept", "chain.json")
+ROUNDS_FILE = os.path.join("rounds", "chain.json")
+TREE_ROUNDS_FILE = os.path.join("rounds", "tree.json")
+
+
+@dataclass(frozen=True)
+class AcceptProfile:
+ """Acceptance of a chain by draft position: ``rates[d]`` is the share of rounds that accept drafted token ``d + 1``
+ (and so every token before it)."""
+
+ rates: Tuple[float, ...]
+
+ @classmethod
+ def from_counts(cls, drafts: int, accepted_per_position: Sequence[int]) -> "AcceptProfile":
+ """A profile from round counts (vLLM's spec-decode counters)."""
+ if drafts <= 0:
+ raise ValueError(f"an acceptance profile needs at least one round, got drafts={drafts}.")
+ counts = list(accepted_per_position)
+ if any(b > a for a, b in zip(counts, counts[1:])) or any(c < 0 or c > drafts for c in counts):
+ raise ValueError(f"accepted_per_position must be non-increasing counts in [0, drafts]: {counts}")
+ return cls(tuple(c / drafts for c in counts))
+
+ def expected_tokens(self, width: int) -> float:
+ """Tokens a request gains per round at verify width ``width`` (``width - 1`` drafts plus the bonus token)."""
+ if not 1 <= width <= len(self.rates) + 1:
+ raise ValueError(f"the profile covers widths 1..{len(self.rates) + 1}, got {width}.")
+ return 1.0 + sum(self.rates[: width - 1])
+
+
+def load_accept_profile(data_path: str) -> Optional[AcceptProfile]:
+ """The chain acceptance profile under ``data_path``, None if it was not measured."""
+ path = os.path.join(data_path, PROFILE_FILE)
+ try:
+ with open(path, encoding="utf-8") as f:
+ data = json.load(f)
+ except FileNotFoundError:
+ return None
+ return AcceptProfile.from_counts(data["drafts"], data["accepted_per_position"])
+
+
+def save_accept_profile(data_path: str, drafts: int, accepted_per_position: Sequence[int]) -> str:
+ """Write the counts as ``<data_path>/accept/chain.json`` (validated first); returns the path."""
+ AcceptProfile.from_counts(drafts, accepted_per_position)
+ path = os.path.join(data_path, PROFILE_FILE)
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ with open(path, "w", encoding="utf-8") as f:
+ json.dump({"drafts": drafts, "accepted_per_position": list(accepted_per_position)}, f)
+ return path
+
+
+def median_cost(curves: Sequence[CostCurve], query_length: int) -> Optional[float]:
+ """Median cost over the context intervals at ``query_length`` tokens per request; None if any interval lacks it."""
+ if not curves or any(query_length - 1 not in curve.index for curve in curves):
+ return None
+ return statistics.median(curve.value[curve.index.index(query_length - 1)] for curve in curves)
+
+
+def chain_width(table: BatchCostTable, profile: AcceptProfile, max_width: int) -> Optional[int]:
+ """The verify width with the most tokens per unit of time at the table's batch size (1: root-only verification).
+
+ Candidates are the widths up to ``max_width`` the table timed and the profile covers. None when the table did not
+ time root-only verification or a draft step.
+ """
+ targets = [interval.target for interval in table.intervals]
+ plain = median_cost(targets, 1)
+ step = median_cost([interval.draft for interval in table.intervals], 1)
+ if plain is None or step is None or plain <= 0 or step <= 0:
+ return None
+ best, best_rate = 1, 1.0 / plain
+ for width in range(2, min(max_width, len(profile.rates) + 1) + 1):
+ verify = median_cost(targets, width)
+ if verify is None:
+ continue
+ rate = profile.expected_tokens(width) / (verify + (width - 1) * step)
+ if rate > best_rate:
+ best, best_rate = width, rate
+ return best
+
+
+def chain_width_schedule(
+ tables: Mapping[int, BatchCostTable], profile: AcceptProfile, max_width: int, max_batch_size: int
+) -> Optional[List[Tuple[int, int, int]]]:
+ """``(first batch size, last batch size, width)`` ranges for batch sizes ``1..max_batch_size``.
+
+ A batch size between calibrated ones takes the width of the nearest calibrated batch size (ties go to the larger),
+ as the cost model reads its tables. None if any calibrated batch size cannot price a chain.
+ """
+ if not tables:
+ return None
+ widths: Dict[int, int] = {}
+ for bs, table in tables.items():
+ width = chain_width(table, profile, max_width)
+ if width is None:
+ return None
+ widths[bs] = width
+ return _ranges(widths, max_batch_size)
+
+
+def served_chain_width(
+ round_us: Mapping[int, float], profile: AcceptProfile, max_width: int, *, allow_no_spec: bool = False
+) -> Optional[int]:
+ """The verify width with the most tokens per unit of time from served round times at one batch size.
+
+ ``round_us[w]`` is the measured period (``1``: root-only verify, ``0``: native decode). Candidates are the
+ widths up to ``max_width`` that were timed and that the profile covers; None when root-only verification was not timed.
+ """
+ plain = round_us.get(1)
+ if plain is None or plain <= 0:
+ return None
+ best, best_rate = 1, 1.0 / plain
+ no_spec = round_us.get(0) if allow_no_spec else None
+ if no_spec is not None and 0 < no_spec <= plain:
+ best, best_rate = 0, 1.0 / no_spec
+ for width, us in sorted(round_us.items()):
+ if not 2 <= width <= min(max_width, len(profile.rates) + 1) or us <= 0:
+ continue
+ rate = profile.expected_tokens(width) / us
+ if rate > best_rate:
+ best, best_rate = width, rate
+ return best
+
+
+def served_width_schedule(
+ rounds: Mapping[int, Mapping[int, float]],
+ profile: AcceptProfile,
+ max_width: int,
+ max_batch_size: int,
+ *,
+ allow_no_spec: bool = False,
+) -> Optional[List[Tuple[int, int, int]]]:
+ """:func:`chain_width_schedule` from served round times (``rounds[batch size][width]``, microseconds)."""
+ if not rounds:
+ return None
+ widths: Dict[int, int] = {}
+ for bs, round_us in rounds.items():
+ width = served_chain_width(round_us, profile, max_width, allow_no_spec=allow_no_spec)
+ if width is None:
+ return None
+ widths[bs] = width
+ return _ranges(widths, max_batch_size)
+
+
+def load_round_times(data_path: str) -> Optional[Dict[int, Dict[int, float]]]:
+ """The served round times under ``data_path`` as ``{batch size: {width: microseconds}}``, None if not measured."""
+ try:
+ with open(os.path.join(data_path, ROUNDS_FILE), encoding="utf-8") as f:
+ rows = json.load(f)["rounds"]
+ except FileNotFoundError:
+ return None
+ rounds: Dict[int, Dict[int, float]] = {}
+ for row in rows:
+ rounds.setdefault(int(row["batch_size"]), {})[int(row["width"])] = float(row["round_us"])
+ return rounds
+
+
+def save_round_times(data_path: str, rows: Sequence[Mapping[str, float]]) -> str:
+ """Write ``rows`` (``batch_size``, ``width``, ``round_us`` and the ``count`` of rounds behind it) as
+ ``<data_path>/rounds/chain.json``; returns the path."""
+ for row in rows:
+ if row["batch_size"] < 1 or row["width"] < 0 or row["round_us"] <= 0:
+ raise ValueError(f"a served round time needs batch_size >= 1, width >= 0 and round_us > 0: {dict(row)}")
+ path = os.path.join(data_path, ROUNDS_FILE)
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ with open(path, "w", encoding="utf-8") as f:
+ json.dump({"rounds": [dict(row) for row in rows]}, f, indent=1)
+ return path
+
+
+def chain_widths(
+ data_path: str, max_width: int, max_batch_size: int, *, allow_no_spec: bool = False
+) -> Optional[List[Tuple[int, int, int]]]:
+ """The chain widths per batch size range under ``data_path``: from the served round times when measured, else
+ from the cost tables; both need the acceptance profile. None when either part is missing."""
+ profile = load_accept_profile(data_path)
+ if profile is None:
+ return None
+ rounds = load_round_times(data_path)
+ if rounds is not None:
+ return served_width_schedule(rounds, profile, max_width, max_batch_size, allow_no_spec=allow_no_spec)
+ tables = load_cost_tables(os.path.join(data_path, "cost"))
+ return chain_width_schedule(tables, profile, max_width, max_batch_size) if tables else None
+
+
+def width_at(schedule: Sequence[Tuple[int, int, int]], batch_size: int) -> int:
+ """The width a schedule of ``(first, last, width)`` ranges gives ``batch_size``."""
+ for first, last, width in schedule:
+ if first <= batch_size <= last:
+ return width
+ raise ValueError(f"batch size {batch_size} is outside the chain width schedule {list(schedule)}")
+
+
+def _ranges(widths: Mapping[int, int], max_batch_size: int) -> List[Tuple[int, int, int]]:
+ """Per-batch-size widths of the calibrated batch sizes as ranges over ``1..max_batch_size``."""
+ ranges: List[Tuple[int, int, int]] = []
+ for bs in range(1, max_batch_size + 1):
+ width = widths[nearest_cost_batch_size(bs, widths)]
+ if ranges and ranges[-1][2] == width:
+ ranges[-1] = (ranges[-1][0], bs, width)
+ else:
+ ranges.append((bs, bs, width))
+ return ranges
+
+
+# ---------------------------------------------------------------- the tree's verify width under load
+# A tree speculator on an engine whose scheduler fixes the verify width per batch size (vLLM) verifies the best
+# ``width`` nodes of its draft tree. Wide trees win where batches are bound by weight reads and lose where the verify
+# forward is bound by compute. ``<data_path>/rounds/tree.json`` holds what the serving engine measured::
+#
+# {"rounds": [{"batch_size": 64, "width": 16, "round_us": 47900.0, "accept": 3.96, "count": 200}, ...]}
+#
+# per batch size and verify width: the median period between consecutive decode rounds and the mean tokens a request
+# committed per round (``accept``: 1 + accepted drafts). Width 1 verifies only the root (no drafts). Unlike the chain's
+# acceptance profile, the tree's acceptance is measured per width, since the best ``width`` nodes of a tree are not a
+# prefix of a chain.
+
+
+def _check_tree_row(row: Mapping[str, float]) -> None:
+ if row["batch_size"] < 1 or row["width"] < 1 or row["round_us"] <= 0 or row["accept"] < 1 or row["count"] < 1:
+ raise ValueError(
+ "a served tree round needs batch_size >= 1, width >= 1, round_us > 0, accept >= 1 and count >= 1: "
+ f"{dict(row)}"
+ )
+
+
+def load_tree_rounds(data_path: str) -> Optional[Dict[int, Dict[int, Tuple[float, float]]]]:
+ """``{batch size: {width: (round us, accept)}}`` from ``<data_path>/rounds/tree.json``, None if not measured."""
+ try:
+ with open(os.path.join(data_path, TREE_ROUNDS_FILE), encoding="utf-8") as f:
+ rows = json.load(f)["rounds"]
+ except FileNotFoundError:
+ return None
+ rounds: Dict[int, Dict[int, Tuple[float, float]]] = {}
+ for row in rows:
+ _check_tree_row(row)
+ cell = (float(row["round_us"]), float(row["accept"]))
+ rounds.setdefault(int(row["batch_size"]), {})[int(row["width"])] = cell
+ return rounds
+
+
+def merge_tree_rounds(data_path: str, rows: Sequence[Mapping[str, float]]) -> str:
+ """Write ``rows`` into ``<data_path>/rounds/tree.json``, replacing the (batch size, width) cells they measured and
+ keeping the others (each calibration server times its own widths); returns the path."""
+ for row in rows:
+ _check_tree_row(row)
+ path = os.path.join(data_path, TREE_ROUNDS_FILE)
+ cells: Dict[Tuple[int, int], dict] = {}
+ try:
+ with open(path, encoding="utf-8") as f:
+ for row in json.load(f)["rounds"]:
+ cells[(int(row["batch_size"]), int(row["width"]))] = dict(row)
+ except FileNotFoundError:
+ pass
+ for row in rows:
+ cells[(int(row["batch_size"]), int(row["width"]))] = dict(row)
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ tmp = path + ".tmp"
+ with open(tmp, "w", encoding="utf-8") as f:
+ json.dump({"rounds": [cells[key] for key in sorted(cells)]}, f, indent=1)
+ os.replace(tmp, path)
+ return path
+
+
+def served_tree_schedule(
+ rounds: Mapping[int, Mapping[int, Tuple[float, float]]], width: int, max_batch_size: int
+) -> Optional[List[Tuple[int, int, int]]]:
+ """``(first, last, verify width)`` ranges over ``1..max_batch_size`` for a tree configured ``width`` wide.
+
+ At each measured batch size that timed ``width``, the measured width up to ``width`` with the most tokens per unit
+ of time (``accept / round_us``; ties keep the wider). Every batch size below the first measured one where another
+ width wins keeps ``width``, so the low-batch behavior never changes; from there each batch size takes the choice of
+ the nearest measured one (ties go to the larger). None when no measured batch size beats ``width``: the tree then
+ keeps one width, as without measurements.
+ """
+ choices: Dict[int, int] = {}
+ for bs, cells in rounds.items():
+ if width not in cells:
+ continue
+ best, best_rate = width, cells[width][1] / cells[width][0]
+ for w, (us, accept) in sorted(cells.items(), reverse=True):
+ if w <= width and accept / us > best_rate:
+ best, best_rate = w, accept / us
+ choices[bs] = best
+ losing = [bs for bs, best in choices.items() if best != width]
+ if not losing:
+ return None
+ switch = min(losing)
+ ranges = _ranges({bs: w for bs, w in choices.items() if bs >= switch}, max_batch_size)
+ kept = [(1, switch - 1, width)] if switch > 1 else []
+ clipped = [(max(first, switch), last, w) for first, last, w in ranges if last >= switch]
+ merged: List[Tuple[int, int, int]] = []
+ for first, last, w in kept + clipped:
+ if merged and merged[-1][2] == w:
+ merged[-1] = (merged[-1][0], last, w)
+ else:
+ merged.append((first, last, w))
+ return merged
diff --git a/eagle_harness/core/config.py b/eagle_harness/core/config.py
new file mode 100644
index 0000000..f8fcc99
--- /dev/null
+++ b/eagle_harness/core/config.py
@@ -0,0 +1,304 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""HarnessConfig: every EAGLE-Harness option in one typed object.
+
+sglang passes the raw ``--speculative-algorithm-config`` string through unparsed.
+:func:`parse_harness_config` accepts inline JSON or a path to a JSON file.
+Configuration does not read environment variables.
+
+Example::
+
+ --speculative-algorithm EAGLE_HARNESS \\
+ --speculative-algorithm-config '{"data_path": "/data/cost/qwen38-tp4", "intensity": "high_intensity"}'
+
+Unknown keys are rejected so a typo cannot silently fall back to a default.
+The migration tables live in ``docs/migration.md``.
+"""
+
+from __future__ import annotations
+
+import dataclasses
+import enum
+import json
+import os
+import typing
+from dataclasses import dataclass, field
+from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Tuple
+
+from eagle_harness.core.cost_model import ChainCoef, CostModel, CostModelParams, depth_loss_ratio
+from eagle_harness.core.cost_table import BatchCostTable, cost_model_problem, load_cost_tables
+from eagle_harness.core.limits import ComputeIntensity
+
+if TYPE_CHECKING:
+ from eagle_harness.core.live_costs import CostKey
+
+
+class Mode(str, enum.Enum):
+ """Execution modes: static, serve, eval and calibrate."""
+
+ STATIC = "static" # the fixed --speculative-num-steps / -eagle-topk / -num-draft-tokens tree, no cost model
+ SERVE = "serve"
+ EVAL = "eval"
+ CALIBRATE = "calibrate"
+
+ @property
+ def uses_cost_model(self) -> bool:
+ """Whether rounds are sized by the cost model (every mode but ``static``)."""
+ return self is not Mode.STATIC
+
+
+class DraftFamily(str, enum.Enum):
+ """The draft model family; it sets the cost model's depth loss."""
+
+ EAGLE4 = "eagle4"
+ EAGLE3 = "eagle3"
+ EAGLE = "eagle"
+
+
+@dataclass(frozen=True)
+class DraftModelOptions:
+ """EAGLE-4 draft model switches (legacy environment variables: ``SGLANG_EAGLE4_*``, ``SGLANG_EAGLE_DRAFT_EMBED_*``)."""
+
+ moe_gate_acc: str = "fp32" # router GEMM accumulate: fp32 or bf16
+ cuda_candidate_kernels: bool = True
+ embed_full: bool = True # full draft embedding table on every TP rank
+ embed_triton: bool = True # draft embedding lookups on sglang's Triton kernel (a full table on the rank)
+
+
+@dataclass(frozen=True)
+class L2Warm:
+ """Weight prefetches into L2 during the target-verify graphs' idle HBM windows
+ (:mod:`eagle_harness.sglang.l2_warm`). Each is ``(share of the weight's bytes, CTAs)``, None: off."""
+
+ gate_up_gdn: Optional[Tuple[float, int]] = (0.42, 16) # MLP gate_up weight, after a GDN layer's input projection
+ gate_up_attention: Optional[Tuple[float, int]] = (0.3, 74) # ... after an attention layer's QKV projection
+ down_proj: Optional[Tuple[float, int]] = None # MLP down weight, after the mixer's output projection
+ next_input: Optional[Tuple[float, int]] = None # next layer's input projection, after the MLP's down projection
+
+
+@dataclass(frozen=True)
+class RaggedVerify:
+ """Per-request (ragged) verify budgets; used with eval mode and chain intensity."""
+
+ enabled: bool = True
+ force_uniform: bool = False # test aid: every request verifies the whole chain
+
+
+@dataclass(frozen=True)
+class CostModelConfig:
+ """Cost-model constants, configurable through JSON fields."""
+
+ threshold: float = 2.5
+ async_layer_ratio: float = 0.9
+ # None: derived from the draft family and target (see cost_model.depth_loss_ratio).
+ depth_loss_ratio: Optional[float] = None
+ chain_tiny: Tuple[float, float, float] = (2.60, 0.24, 0.00)
+ chain_small: Tuple[float, float, float] = (2.85, 0.24, 0.00)
+ chain_medium: Tuple[float, float, float] = (2.54, 0.24, 0.70)
+ chain_large: Tuple[float, float, float] = (1.55, 0.24, 0.00)
+ chain_scale_tiny: float = 1.25
+ chain_tiny_max_bs: int = 2
+ chain_scale_small: float = 1.45
+ chain_scale_medium: float = 2.00
+ ragged_draft_relax: Tuple[float, float, float] = (0.75, 0.75, 0.75)
+ ragged_verify_threshold: Tuple[float, float, float] = (1.35, 1.60, 1.40)
+
+ def params(self, depth_loss_ratio: float) -> CostModelParams:
+ """The constants as the cost model's parameters, with the given depth loss ratio."""
+ return CostModelParams(
+ threshold=self.threshold,
+ async_layer_ratio=self.async_layer_ratio,
+ depth_loss_ratio=self.depth_loss_ratio if self.depth_loss_ratio is not None else depth_loss_ratio,
+ chain_coef=tuple(
+ ChainCoef(*c) for c in (self.chain_tiny, self.chain_small, self.chain_medium, self.chain_large)
+ ),
+ chain_scale_tiny=self.chain_scale_tiny,
+ chain_tiny_max_bs=self.chain_tiny_max_bs,
+ chain_scale_small=self.chain_scale_small,
+ chain_scale_medium=self.chain_scale_medium,
+ ragged_draft_relax=self.ragged_draft_relax,
+ ragged_verify_threshold=self.ragged_verify_threshold,
+ )
+
+
+@dataclass(frozen=True)
+class HarnessConfig:
+ """The harness's whole configuration (``--speculative-algorithm-config``)."""
+
+ data_path: Optional[str] = None # offline calibration root (cost/, key.json); None: costs measured on served rounds
+ cost_cache: Optional[str] = None # directory of the live-cost cache files; None: ~/.cache/eagle-harness/costs
+ mode: Mode = Mode.SERVE
+ intensity: ComputeIntensity = ComputeIntensity.HIGH
+ draft_family: DraftFamily = DraftFamily.EAGLE4
+ cost_model: CostModelConfig = field(default_factory=CostModelConfig)
+ ragged: RaggedVerify = field(default_factory=RaggedVerify)
+ draft_model: DraftModelOptions = field(default_factory=DraftModelOptions)
+ l2_warm: L2Warm = field(default_factory=L2Warm)
+
+ def validate(self) -> "HarnessConfig":
+ """Check the config; return it."""
+ if self.mode is Mode.CALIBRATE and not self.data_path:
+ raise ValueError("calibrate mode needs data_path for its output")
+ if self.draft_model.moe_gate_acc not in ("fp32", "bf16"):
+ raise ValueError(f"draft_model.moe_gate_acc must be fp32 or bf16, got {self.draft_model.moe_gate_acc!r}.")
+ return self
+
+ @property
+ def cost_dir(self) -> str:
+ """Directory of the fitted offline cost tables under ``data_path``."""
+ assert self.data_path is not None
+ return os.path.join(self.data_path, "cost")
+
+ @property
+ def cost_cache_dir(self) -> str:
+ """Directory of the live-cost cache files."""
+ return self.cost_cache or os.path.join(os.path.expanduser("~"), ".cache", "eagle-harness", "costs")
+
+
+def build_cost_model(
+ config: HarnessConfig,
+ *,
+ node_top_k: int,
+ tree_depth: int,
+ verify_num: int,
+ target_is_moe: bool,
+ ragged_attention_supported: bool = False,
+ eval_batch_size: Optional[int] = None,
+ tables: Optional[Dict[int, BatchCostTable]] = None,
+ key: Optional["CostKey"] = None,
+) -> CostModel:
+ """The worker's cost model: with ``tables``, else the offline tables under ``config.data_path`` (checked
+ against ``key``, the serving setup)."""
+ loss = depth_loss_ratio(config.draft_family.value, target_is_moe=target_is_moe, intensity=config.intensity)
+ if tables is None:
+ tables = load_cost_tables(config.cost_dir, key)
+ for bs, table in sorted(tables.items()):
+ problem = cost_model_problem(table, target_is_moe=target_is_moe)
+ if problem is not None:
+ raise ValueError(f"Cost tables under {config.cost_dir}/bs_{bs} cannot drive the cost model: {problem}.")
+ return CostModel(
+ tables=tables,
+ params=config.cost_model.params(loss),
+ intensity=config.intensity,
+ node_top_k=node_top_k,
+ tree_depth=tree_depth,
+ verify_num=verify_num,
+ target_is_moe=target_is_moe,
+ ragged=(
+ config.ragged.enabled
+ and config.mode is Mode.EVAL
+ and config.intensity is ComputeIntensity.CHAIN
+ and ragged_attention_supported
+ ),
+ eval_batch_size=eval_batch_size if config.mode is Mode.EVAL else None,
+ )
+
+
+def _convert(tp: Any, value: Any, where: str) -> Any:
+ origin = typing.get_origin(tp)
+ if dataclasses.is_dataclass(tp):
+ if not isinstance(value, Mapping):
+ raise ValueError(f"{where}: expected an object, got {type(value).__name__}.")
+ return _from_dict(tp, value, where)
+ if isinstance(tp, type) and issubclass(tp, enum.Enum):
+ try:
+ return tp(value)
+ except ValueError as e:
+ choices = ", ".join(m.value for m in tp)
+ raise ValueError(f"{where}: {value!r} is not one of {choices}.") from e
+ if origin is typing.Union:
+ args = [a for a in typing.get_args(tp) if a is not type(None)]
+ if value is None:
+ return None
+ return _convert(args[0], value, where)
+ if origin is tuple:
+ args = typing.get_args(tp)
+ if not isinstance(value, (list, tuple)) or len(value) != len(args):
+ raise ValueError(f"{where}: expected a list of {len(args)} values.")
+ return tuple(_convert(a, v, f"{where}[{i}]") for i, (a, v) in enumerate(zip(args, value)))
+ if tp is bool:
+ if not isinstance(value, bool):
+ raise ValueError(f"{where}: expected true/false, got {value!r}.")
+ return value
+ if tp is int:
+ if isinstance(value, bool) or not isinstance(value, int):
+ raise ValueError(f"{where}: expected an integer, got {value!r}.")
+ return value
+ if tp is float:
+ if isinstance(value, bool) or not isinstance(value, (int, float)):
+ raise ValueError(f"{where}: expected a number, got {value!r}.")
+ return float(value)
+ if tp is str:
+ if not isinstance(value, str):
+ raise ValueError(f"{where}: expected a string, got {value!r}.")
+ return value
+ raise TypeError(f"{where}: unsupported field type {tp!r}.")
+
+
+def _from_dict(cls: type, data: Mapping[str, Any], where: str) -> Any:
+ hints = typing.get_type_hints(cls)
+ names = {f.name for f in dataclasses.fields(cls)}
+ unknown = sorted(set(data) - names)
+ if unknown:
+ raise ValueError(f"{where or 'config'}: unknown keys {unknown}; valid keys are {sorted(names)}.")
+ kwargs = {k: _convert(hints[k], v, f"{where}.{k}" if where else k) for k, v in data.items()}
+ return cls(**kwargs)
+
+
+def harness_config_from_dict(data: Mapping[str, Any]) -> HarnessConfig:
+ """A validated :class:`HarnessConfig` from a (possibly partial) dict."""
+ return _from_dict(HarnessConfig, data, "").validate()
+
+
+def parse_harness_config(value: Optional[str], *, default_data_path: Optional[str] = None) -> HarnessConfig:
+ """Parse JSON or a JSON file, filling an absent data_path from a device-selected profile."""
+ if value is None or not value.strip():
+ if default_data_path is not None:
+ return harness_config_from_dict({"data_path": default_data_path})
+ raise ValueError(
+ "EAGLE_HARNESS needs --speculative-algorithm-config (JSON or a path to JSON), "
+ 'e.g. {"data_path": "<calibration dir>"} or {"mode": "static"}.'
+ )
+ text = value.strip()
+ if not text.startswith(("{", "[")):
+ with open(os.path.expanduser(text), encoding="utf-8") as f:
+ text = f.read()
+ try:
+ data = json.loads(text)
+ except json.JSONDecodeError as e:
+ raise ValueError(f"--speculative-algorithm-config is not valid JSON: {e}") from e
+ if not isinstance(data, dict):
+ raise ValueError("--speculative-algorithm-config must be a JSON object.")
+ if (
+ default_data_path is not None
+ and data.get("data_path") is None
+ and data.get("mode", Mode.SERVE.value) in (Mode.SERVE.value, Mode.EVAL.value)
+ ):
+ data["data_path"] = default_data_path
+ return harness_config_from_dict(data)
+
+
+def config_to_dict(config: HarnessConfig) -> Dict[str, Any]:
+ """The config as plain JSON-able values (enums by value, tuples as lists)."""
+
+ def plain(v: Any) -> Any:
+ """One value as plain JSON data."""
+ if isinstance(v, enum.Enum):
+ return v.value
+ if isinstance(v, tuple):
+ return [plain(x) for x in v]
+ return v
+
+ def walk(obj: Any) -> Any:
+ """A dataclass tree as nested dicts."""
+ return {
+ f.name: (
+ walk(getattr(obj, f.name))
+ if dataclasses.is_dataclass(getattr(obj, f.name))
+ else plain(getattr(obj, f.name))
+ )
+ for f in dataclasses.fields(obj)
+ }
+
+ return walk(config)
diff --git a/eagle_harness/core/cost_model.py b/eagle_harness/core/cost_model.py
new file mode 100644
index 0000000..5673fec
--- /dev/null
+++ b/eagle_harness/core/cost_model.py
@@ -0,0 +1,888 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Online cost model: decides draft tree width / chain depth and the verify budget.
+
+Decisions are checked against golden fixtures on fixed inputs
+(``tests/test_cost_golden.py``).
+
+Everything here is host-side Python over lists. The GPU parts (launching the
+score-delta kernel, event spins, pinned copies, verify-count tensors) belong
+to the caller, which hands in the host lists.
+
+Calibration mode never consults this class: forced shapes come from the
+calibration plan.
+"""
+
+from __future__ import annotations
+
+import enum
+import math
+from collections import Counter
+from collections.abc import Sequence
+from dataclasses import dataclass, field, replace
+
+from eagle_harness.core.cost_table import BatchCostTable
+from eagle_harness.core.limits import (
+ MAX_BATCH_SIZE_CHAIN,
+ MAX_BATCH_SIZE_TREE,
+ MAX_CHAIN_DEPTH,
+ MAX_CHAIN_VERIFY_NUM,
+ MAX_NODE_TOP_K,
+ MAX_VERIFY_NUM,
+ RAGGED_PAGED_MAX_BS,
+ ComputeIntensity,
+ check_shape,
+ max_batch_size,
+ nearest_cost_batch_size,
+)
+
+
+class SizeClass(enum.IntEnum):
+ """Batch cost class from the measured verify cost at 8 tokens."""
+
+ SMALL = 0
+ MEDIUM = 1
+ LARGE = 2
+ HUGE = 3
+
+
+class ChainTier(enum.IntEnum):
+ """Size class of a chain verify, by the target's cost curve."""
+
+ TINY = 0
+ SMALL = 1
+ MEDIUM = 2
+ LARGE = 3
+
+
+@dataclass(frozen=True)
+class ChainCoef:
+ """Threshold, depth loss and cost power of one chain tier."""
+
+ threshold: float
+ depth_loss: float
+ cost_power: float
+
+
+@dataclass(frozen=True)
+class CostModelParams:
+ """Tuned constants for draft and verify cost estimates."""
+
+ threshold: float = 2.5
+ async_layer_ratio: float = 0.9
+ depth_loss_ratio: float = 0.04
+ chain_coef: tuple[ChainCoef, ChainCoef, ChainCoef, ChainCoef] = (
+ ChainCoef(2.60, 0.24, 0.00),
+ ChainCoef(2.85, 0.24, 0.00),
+ ChainCoef(2.54, 0.24, 0.70),
+ ChainCoef(1.55, 0.24, 0.00),
+ )
+ chain_ref_cost: float = 2.43
+ chain_cliff_min_cost: float = 0.15
+ chain_cliff_ratio: float = 1.5
+ chain_scale_tiny: float = 1.25
+ chain_tiny_max_bs: int = 2
+ chain_scale_small: float = 1.45
+ chain_scale_medium: float = 2.00
+ # Per chain tier SMALL / MEDIUM / LARGE.
+ ragged_draft_relax: tuple[float, float, float] = (0.75, 0.75, 0.75)
+ ragged_verify_threshold: tuple[float, float, float] = (1.35, 1.60, 1.40)
+
+
+def depth_loss_ratio(draft_family: str, *, target_is_moe: bool, intensity: ComputeIntensity) -> float:
+ """Per-depth acceptance loss used by the tree-width criterion."""
+ ratio = {"eagle4": 0.04, "eagle3": 0.08, "eagle": 0.64}.get(draft_family, 0.16)
+ if target_is_moe or intensity is ComputeIntensity.CHAIN:
+ ratio *= 2.0
+ if intensity is ComputeIntensity.CHAIN:
+ ratio *= 0.5
+ return ratio
+
+
+@dataclass(frozen=True)
+class DraftCostRow:
+ """Draft-side cost inputs of one round."""
+
+ cost_values: tuple[float, ...]
+ cost_index: tuple[int, ...]
+ cost_state: float
+ adjust_cost_ratio: float
+ model_cost_ratio: float
+ batch_size_ratio: float
+
+
+@dataclass(frozen=True)
+class VerifyCost:
+ """Target verify cost curve and the gain threshold of the current class."""
+
+ value: tuple[float, ...]
+ index: tuple[int, ...]
+ threshold: float
+
+
+@dataclass(frozen=True)
+class ChainStopTerms:
+ """Costs and gain divisors for one chain stopping decision.
+
+ Evaluate gain as ``raw_gain * 2.0 / gain_scale``. When ``cliff_cost > 0``,
+ lookahead adds ``raw_gain * 2.0 / cliff_gain_scale`` to that gain.
+ Keeping the divisors and the two gains separate preserves host rounding.
+ All fields are zero at depths without a decision; disabled cliffs have
+ zero ``cliff_gain_scale`` and ``cliff_cost``.
+ """
+
+ gain_scale: float
+ cost: float
+ threshold: float
+ cliff_gain_scale: float
+ cliff_cost: float
+
+
+@dataclass(frozen=True)
+class ChainPolicyBatch:
+ """Costs selected for a live batch; each context interval is indexed by depth."""
+
+ cache_length_step: int
+ intervals: tuple[tuple[ChainStopTerms, ...], ...]
+
+
+@dataclass(frozen=True)
+class ChainPolicyCosts:
+ """Immutable chain costs for live batches 1..512, indexed by batch size minus one."""
+
+ batches: tuple[ChainPolicyBatch, ...]
+
+
+@dataclass(frozen=True)
+class TreePolicyInterval:
+ """Core costs for one context interval; tier rows are SMALL..HUGE, then tiny.
+
+ Verify widths are query lengths minus one, as in ``CostCurve.index``.
+ Delta entry [i][j] is the usable cost increase from width i to width j.
+ Verify thresholds are ordered for the <= and > majority-history cases.
+ """
+
+ verify_widths: tuple[int, ...]
+ verify_cost_deltas: tuple[tuple[float, ...], ...]
+ draft_cost: float
+ model_cost_ratio: float
+ depth_thresholds: tuple[tuple[float, ...], ...]
+ verify_tier: int
+ verify_thresholds: tuple[float, float]
+
+
+@dataclass(frozen=True)
+class TreePolicyBatch:
+ """Measured costs selected for a live batch size."""
+
+ cost_batch_size: int
+ cache_length_step: int
+ intervals: tuple[TreePolicyInterval, ...]
+
+
+@dataclass(frozen=True)
+class TreePolicyCosts:
+ """Immutable host data for all supported tree batch sizes, without engine dependencies."""
+
+ batches: tuple[TreePolicyBatch, ...]
+ history_floors: tuple[int, ...]
+ initial_widths: tuple[int, ...]
+ async_layer_ratio: float
+
+
+@dataclass(frozen=True)
+class WidthDecision:
+ """One draft step's decision: next width, verify budget, and whether the tree stops."""
+
+ width: int
+ verify_num: int
+ stop: bool
+
+
+class WidthStep(enum.Enum):
+ """What ``tree_width`` needs at a depth."""
+
+ KEEP = "keep" # tiny batch, depth < 2: keep the top-k width
+ LAST = "last" # last depth: stop
+ LAUNCH = "launch" # even depth: launch the score-delta copy, keep width
+ DECIDE = "decide" # odd depth: decide from the host deltas
+
+
+def find_majority(nums: Sequence[int]) -> int:
+ """Strict-majority element, scanning in order; -1 when there is none."""
+ counts: Counter = Counter()
+ limit = len(nums) // 2
+ for x in nums:
+ counts[x] += 1
+ if counts[x] > limit:
+ return x
+ return -1
+
+
+def verify_cost_delta(previous: float, current: float) -> float:
+ """Cost increase used by verify pruning; negligible increases are ignored."""
+ delta = current - previous
+ return delta if delta > 0.04 else 0.0
+
+
+def stable_verify_thresholds(threshold: float) -> tuple[float, float]:
+ """Verify thresholds for a majority budget <= or > the candidate budget."""
+ return threshold * 0.95, threshold * 1.05
+
+
+def ragged_verify_budget(
+ gains: Sequence[float],
+ draft_count: int,
+ time_value: Sequence[float],
+ time_index: Sequence[int],
+ threshold: float,
+ recent_verify_nums: Sequence[int],
+) -> int:
+ """Per-request verify budget for the ragged plan (pairwise gain / cost pruning)."""
+ cand: list[tuple[int, float, float]] = []
+ for pos, index in enumerate(time_index):
+ nodes = index + 1
+ if nodes > draft_count:
+ break
+ if nodes == 1:
+ cand.append((index, time_value[pos], 1.001))
+ elif nodes % 2 == 0 and gains[nodes // 2 - 1] > 0.0:
+ cand.append((index, time_value[pos], gains[nodes // 2 - 1]))
+ if len(cand) < 2:
+ return 2
+ last_verify_num = find_majority(recent_verify_nums)
+ mask = [c[0] for c in cand]
+ reset = mask[1]
+ thresholds = stable_verify_thresholds(threshold)
+ for i in range(len(cand) - 1):
+ for j in range(i + 1, len(cand)):
+ stable_threshold = thresholds[0 if last_verify_num <= cand[j][0] + 1 else 1]
+ cost_delta = verify_cost_delta(cand[i][1], cand[j][1])
+ if cost_delta > 0.0 and (cand[j][2] - cand[i][2]) / cost_delta < stable_threshold:
+ mask[j] = reset
+ verify_num = max(mask) + 1
+ if verify_num == 1 or verify_num > draft_count:
+ verify_num = min(c[0] for c in cand[1:]) + 1
+ return verify_num
+
+
+def _adjust_cost_ratio(model_cost_ratio: float) -> float:
+ if model_cost_ratio < 5:
+ raise ValueError(
+ f"Invalid model_cost_ratio: {model_cost_ratio:.2f}. The ratio is too low "
+ "(below 5), which is not suitable for speculative sampling."
+ )
+ if model_cost_ratio > 100:
+ raise ValueError(
+ f"Invalid model_cost_ratio: {model_cost_ratio:.2f}. The ratio is too high "
+ "(above 100), which may indicate poor draft model performance."
+ )
+ for bound, ratio in ((8, 1.30), (12, 1.10), (17, 1.30), (23, 1.50), (32, 1.80), (64, 2.20)):
+ if model_cost_ratio < bound:
+ return ratio
+ return 2.70
+
+
+_VERIFY_THRESHOLDS = { # size class -> (high_intensity, other intensities)
+ SizeClass.SMALL: (2.40, 2.00),
+ SizeClass.MEDIUM: (2.10, 1.80),
+ SizeClass.LARGE: (1.80, 1.60),
+ SizeClass.HUGE: (1.50, 1.40),
+}
+_BATCH_SIZE_RATIO = {SizeClass.SMALL: 1.25, SizeClass.MEDIUM: 1.50, SizeClass.LARGE: 1.75, SizeClass.HUGE: 2.00}
+_MIN_HISTORY_VERIFY = {SizeClass.SMALL: 16, SizeClass.MEDIUM: 8, SizeClass.LARGE: 4, SizeClass.HUGE: 2}
+_CHAIN_HISTORY_SLACK = {SizeClass.SMALL: 4, SizeClass.MEDIUM: 2, SizeClass.LARGE: 2, SizeClass.HUGE: 0}
+_CHAIN_COST_INDEX = (0, 1, 3, 5, 7, 9, 11, 13, 15)
+
+
+@dataclass
+class _TierState:
+ # tiny: batch size 1 (set by the width decision); size: set by verify_cost.
+ tiny: bool = False
+ size: SizeClass = SizeClass.SMALL
+
+
+@dataclass
+class CostModel:
+ """Stateful per-worker cost model. Not thread safe; one per EAGLE-Harness worker."""
+
+ tables: dict[int, BatchCostTable]
+ params: CostModelParams
+ intensity: ComputeIntensity
+ node_top_k: int
+ tree_depth: int
+ verify_num: int
+ target_is_moe: bool = False
+ ragged: bool = False
+ # Evaluation runs: the benchmark's batch size. A round
+ # much smaller than it (a tail) stops drafting early.
+ eval_batch_size: int | None = None
+
+ tier: _TierState = field(default_factory=_TierState)
+ interval_index: int = 0
+ # Majority vote window of the paged verify budget.
+ recent_verify_nums: list[int] = field(default_factory=lambda: [-5, -4, -3, -2, -1])
+
+ def __post_init__(self) -> None:
+ self.max_batch_size = max_batch_size(self.intensity)
+ self.set_tables(self.tables)
+ # Per-batch-size history of chosen verify numbers.
+ self._history = [[self.verify_num] * 16 for _ in range(self.max_batch_size)]
+
+ # ------------------------------------------------------------------ tables
+ def set_tables(self, tables: dict[int, BatchCostTable]) -> None:
+ """Replace the cost tables (live costs refresh them between rounds); history and state are kept."""
+ self.tables = tables
+ measured = sorted(tables)
+ self._bs_lut = (
+ [0] + [nearest_cost_batch_size(bs, measured) for bs in range(1, self.max_batch_size + 1)]
+ if measured
+ else []
+ )
+
+ def table(self, batch_size: int) -> BatchCostTable | None:
+ """Cost table of the nearest measured batch size; None without cost data."""
+ if not self._bs_lut:
+ return None
+ if not 1 <= batch_size <= self.max_batch_size:
+ raise ValueError(f"batch_size={batch_size} is outside 1..{self.max_batch_size}.")
+ return self.tables[self._bs_lut[batch_size]]
+
+ def _require_table(self, batch_size: int) -> BatchCostTable:
+ table = self.table(batch_size)
+ if table is None:
+ raise ValueError(f"No cost data found for batch_size={batch_size}.")
+ return table
+
+ def update_interval(self, batch_size: int, average_cache_len: int) -> BatchCostTable:
+ """Select the cost interval of the average cache length; return the batch size's table."""
+ table = self._require_table(batch_size)
+ self.interval_index = table.interval_index(average_cache_len)
+ return table
+
+ def draft_cost_row(self, batch_size: int, average_cache_len: int) -> DraftCostRow:
+ """Draft cost inputs of a round; also selects the context interval."""
+ table = self.update_interval(batch_size, average_cache_len)
+ model_cost_ratio = table.model_ratio[self.interval_index]
+ adjust = _adjust_cost_ratio(model_cost_ratio)
+ draft = table.intervals[self.interval_index].draft
+ if self.tier.tiny:
+ bs_ratio = 1.00
+ else:
+ bs_ratio = _BATCH_SIZE_RATIO[self.tier.size]
+ bs_ratio = max(1.0, bs_ratio / ((20 / model_cost_ratio + 1) / 2))
+ return DraftCostRow(
+ cost_values=draft.ratio,
+ cost_index=draft.index,
+ cost_state=draft.ratio[-1],
+ adjust_cost_ratio=adjust,
+ model_cost_ratio=model_cost_ratio,
+ batch_size_ratio=bs_ratio,
+ )
+
+ def verify_cost(self, batch_size: int, average_cache_len: int) -> VerifyCost | None:
+ """Target verify cost curve; classifies the batch (small .. huge) as a side effect."""
+ table = self.table(batch_size)
+ if table is None:
+ return None
+ target = table.intervals[table.interval_index(average_cache_len)].target
+ value, index = target.ratio, target.index
+ cost_state = value[-1]
+ for i, idx in enumerate(index):
+ if idx >= 7:
+ cost_state = value[i]
+ break
+ if cost_state <= 1.25 or batch_size == 1:
+ size = SizeClass.SMALL
+ if cost_state < 0.85 and (cost_state < 0.70 or not self.target_is_moe):
+ raise ValueError(f"EAGLE-Harness: cost_state={cost_state} is too low, which is not expected.")
+ elif cost_state < 1.60:
+ size = SizeClass.MEDIUM
+ elif cost_state < 2.20:
+ size = SizeClass.LARGE
+ else:
+ size = SizeClass.HUGE
+ if cost_state > 4.0:
+ raise ValueError(f"EAGLE-Harness: cost_state={cost_state} is too high, which is not expected.")
+ self.tier.size = size
+ high, other = _VERIFY_THRESHOLDS[size]
+ threshold = high if self.intensity is ComputeIntensity.HIGH else other
+ return VerifyCost(value=value, index=index, threshold=threshold)
+
+ def tree_policy_costs(self) -> TreePolicyCosts:
+ """Export core policy inputs without changing this worker's online state.
+
+ Each live batch uses :meth:`table`'s nearest measured batch mapping.
+ Depth thresholds cover all depths and all five possible draft tiers.
+ History floors use a fresh history with verify_num=1. Invalid or missing
+ tables, nonfinite costs and unsupported shapes are rejected.
+ """
+ self._validate_tree_policy_inputs()
+ model = replace(
+ self,
+ tier=_TierState(),
+ interval_index=0,
+ recent_verify_nums=list(self.recent_verify_nums),
+ )
+ batches = []
+ for batch_size in range(1, MAX_BATCH_SIZE_TREE + 1):
+ table = model._require_table(batch_size)
+ intervals = []
+ for interval_id in range(len(table.intervals)):
+ context = (interval_id + 1) * table.cache_length_step
+ verify = model._require_verify_cost(batch_size, context)
+ verify_tier = int(model.tier.size)
+ thresholds = []
+ for variant in range(5):
+ model.tier = _TierState(tiny=variant == 4, size=SizeClass(variant % 4))
+ row = model.draft_cost_row(batch_size, context)
+ thresholds.append(tuple(model.tree_depth_threshold(d, row) for d in range(self.tree_depth)))
+ if not all(math.isfinite(value) for tier in thresholds for value in tier):
+ raise ValueError(f"Nonfinite depth thresholds for batch_size={batch_size}, interval={interval_id}.")
+ intervals.append(
+ TreePolicyInterval(
+ verify_widths=tuple(verify.index),
+ verify_cost_deltas=tuple(
+ tuple(verify_cost_delta(a, b) for b in verify.value) for a in verify.value
+ ),
+ draft_cost=row.cost_values[-1],
+ model_cost_ratio=row.model_cost_ratio,
+ depth_thresholds=tuple(thresholds),
+ verify_tier=verify_tier,
+ verify_thresholds=stable_verify_thresholds(verify.threshold),
+ )
+ )
+ batches.append(TreePolicyBatch(table.batch_size, table.cache_length_step, tuple(intervals)))
+
+ floors = []
+ widths = []
+ model = replace(model, verify_num=1)
+ for variant in range(5):
+ model.tier = _TierState(tiny=variant == 4, size=SizeClass(variant % 4))
+ floors.append(model.history_verify_num(1))
+ if variant < 4:
+ row = model.draft_cost_row(1, 0)
+ widths.append(model.tree_width(0, 1, 1, row).width)
+ return TreePolicyCosts(tuple(batches), tuple(floors), tuple(widths), self.params.async_layer_ratio)
+
+ def _validate_tree_policy_inputs(self) -> None:
+ for name, lower in (("tree_depth", 2), ("node_top_k", 1), ("verify_num", 2)):
+ value = getattr(self, name)
+ if type(value) is not int or value < lower:
+ raise ValueError(f"{name}={value!r} must be an integer >= {lower} for tree policy export.")
+ check_shape(self.intensity, self.node_top_k, self.tree_depth, self.verify_num, MAX_BATCH_SIZE_TREE)
+ for name in ("threshold", "async_layer_ratio", "depth_loss_ratio"):
+ value = getattr(self.params, name)
+ if not math.isfinite(value) or value < 0 or (name != "depth_loss_ratio" and value == 0):
+ raise ValueError(f"Invalid tree policy parameter {name}={value!r}.")
+ self._validate_policy_tables(chain=False)
+
+ def _validate_policy_tables(self, *, chain: bool) -> None:
+ if not self.tables:
+ raise ValueError(f"No cost data found for {'chain' if chain else 'tree'} policy export.")
+ for batch_size, table in self.tables.items():
+ if (
+ type(batch_size) is not int
+ or batch_size < 1
+ or (chain and batch_size > MAX_BATCH_SIZE_CHAIN)
+ or type(table.batch_size) is not int
+ or table.batch_size != batch_size
+ ):
+ raise ValueError(f"Invalid measured batch_size={batch_size!r}; table reports {table.batch_size!r}.")
+ if type(table.cache_length_step) is not int or table.cache_length_step <= 0:
+ raise ValueError(f"Invalid cache_length_step={table.cache_length_step!r} for batch_size={batch_size}.")
+ if not table.intervals or len(table.intervals) != len(table.model_ratio):
+ raise ValueError(f"Missing cost intervals or model ratios for batch_size={batch_size}.")
+ for interval_id, (interval, ratio) in enumerate(zip(table.intervals, table.model_ratio)):
+ location = f"batch_size={batch_size}, interval={interval_id}"
+ if not math.isfinite(ratio) or ratio <= 0:
+ raise ValueError(f"Model cost ratio must be finite and positive for {location}.")
+ if not chain:
+ _adjust_cost_ratio(ratio)
+ for name, curve, bound in (
+ ("target", interval.target, MAX_VERIFY_NUM),
+ ("draft", interval.draft, MAX_NODE_TOP_K),
+ ):
+ count = len(curve.index)
+ if count == 0 or (name == "target" and not 2 <= count <= 32):
+ raise ValueError(f"Invalid {name} width count {count} for {location}.")
+ if len(curve.value) != count or len(curve.ratio) != count:
+ raise ValueError(f"Mismatched {name} cost lengths for {location}.")
+ if (
+ curve.index[0] != 0
+ or any(type(index) is not int or not 0 <= index < bound for index in curve.index)
+ or any(a >= b for a, b in zip(curve.index, curve.index[1:]))
+ ):
+ raise ValueError(f"Invalid {name} cost indices {curve.index!r} for {location}.")
+ if chain and name == "target" and tuple(curve.index) != _CHAIN_COST_INDEX:
+ raise ValueError(f"Invalid chain cost indices {curve.index!r} for {location}.")
+ if any(not math.isfinite(value) or value <= 0 for value in (*curve.value, *curve.ratio)):
+ raise ValueError(f"{name} costs must be finite and positive for {location}.")
+
+ # ----------------------------------------------------------------- history
+ def _floored_history(self, batch_size: int) -> int:
+ recent = max(self._history[batch_size - 1])
+ return max(recent, 32 if self.tier.tiny else _MIN_HISTORY_VERIFY[self.tier.size])
+
+ def history_verify_num(self, batch_size: int) -> int:
+ """Verify-number cap a new round starts from."""
+ if self.intensity is ComputeIntensity.CHAIN:
+ slack = 4 if self.tier.tiny else _CHAIN_HISTORY_SLACK[self.tier.size]
+ return min(max(self._history[batch_size - 1]) + slack, self.verify_num)
+ return self._floored_history(batch_size)
+
+ @property
+ def max_history_verify_num(self) -> int:
+ """Upper bound of :meth:`history_verify_num`: the verify budgets the work deltas need.
+
+ History entries never exceed ``verify_num`` (a round verifies at most
+ that many tokens), but the tree-mode floor (32 at batch size 1) can.
+ """
+ if self.intensity is ComputeIntensity.CHAIN:
+ return self.verify_num
+ return max(self.verify_num, 32, *_MIN_HISTORY_VERIFY.values())
+
+ @property
+ def launch_depths(self) -> tuple[int, ...]:
+ """Depths at which :meth:`width_step` can return ``LAUNCH`` (the depths whose work deltas are read)."""
+ return tuple(d for d in range(0, self.tree_depth - 1, 2))
+
+ def record_verify_num(self, batch_size: int, verify_num: int) -> None:
+ """Push this round's verify budget into the batch size's history."""
+ history = self._history[batch_size - 1]
+ history.append(verify_num)
+ history.pop(0)
+
+ def verify_count(self, batch_size: int, draft_count: int) -> int:
+ """How many top-scored draft nodes the verify considers (a chain verifies all)."""
+ if self.intensity is ComputeIntensity.CHAIN:
+ return draft_count
+ return min(self.verify_num, draft_count, max(self._floored_history(batch_size) * 2, 16))
+
+ # ------------------------------------------------------------ tree width
+ def _width_cap(self) -> int:
+ if self.tier.size in (SizeClass.SMALL, SizeClass.MEDIUM):
+ return min(self.node_top_k, 8)
+ return min(self.node_top_k, 4)
+
+ def width_step(self, depth: int) -> WidthStep:
+ """How the frontier width changes after depth ``depth``."""
+ if self.tier.tiny and depth < 2:
+ return WidthStep.KEEP
+ if depth == self.tree_depth - 1:
+ return WidthStep.LAST
+ if depth % 2 == 0:
+ return WidthStep.LAUNCH
+ return WidthStep.DECIDE
+
+ def tree_depth_threshold(self, depth: int, row: DraftCostRow) -> float:
+ """Minimum gain per cost at this depth, shared by host and device policies."""
+ bs_ratio = row.batch_size_ratio
+ if depth <= 1:
+ bs_ratio = (bs_ratio + 1.00) / 2
+ elif depth > 5 and bs_ratio > 1.3:
+ bs_ratio = bs_ratio * 1.1
+ p = self.params
+ return p.threshold * (depth * p.depth_loss_ratio + 1.0) * row.adjust_cost_ratio * bs_ratio
+
+ def tree_width(
+ self,
+ depth: int,
+ batch_size: int,
+ past_verify_num: int,
+ row: DraftCostRow,
+ deltas: Sequence[float] | None = None,
+ ) -> WidthDecision:
+ """Width of the next draft level, or stop.
+
+ ``deltas`` are the host copy of the top work-score deltas launched at
+ the previous (even) depth; only the ``DECIDE`` step reads them.
+ """
+ step = self.width_step(depth)
+ if step is WidthStep.KEEP:
+ return WidthDecision(self.node_top_k, past_verify_num, False)
+ if step is WidthStep.LAST:
+ return WidthDecision(-1, -1, True)
+ if step is WidthStep.LAUNCH:
+ return WidthDecision(self._width_cap(), past_verify_num, False)
+ if deltas is None:
+ raise ValueError(f"tree_width at depth {depth} needs the host score deltas.")
+ if self._is_eval_tail(batch_size):
+ return WidthDecision(1, past_verify_num, True)
+ base = deltas[0]
+ gains = [x - base for x in deltas[1:]]
+ self.tier.tiny = batch_size == 1
+ width = self._width_cap()
+ p = self.params
+ gain_per_cost = gains[width - 1] / row.cost_values[-1] * row.model_cost_ratio * p.async_layer_ratio
+ bar = self.tree_depth_threshold(depth, row)
+ if gain_per_cost < bar:
+ return WidthDecision(width, past_verify_num, True)
+ if self.tier.size in (SizeClass.MEDIUM, SizeClass.LARGE):
+ width = 1 << (width - 1).bit_length()
+ return WidthDecision(width, past_verify_num, False)
+
+ def _is_eval_tail(self, batch_size: int) -> bool:
+ ebs = self.eval_batch_size
+ return ebs is not None and batch_size != 1 and ebs > 4 * batch_size and ebs > batch_size + 4
+
+ # ----------------------------------------------------------- chain depth
+ def classify_chain(self, batch_size: int, cost_ratio: Sequence[float] | None = None) -> tuple[ChainTier, float]:
+ """The chain tier and its coefficients for a batch size (from the target's cost ratio)."""
+ if cost_ratio is None:
+ table = self._require_table(batch_size)
+ cost_ratio = table.intervals[self.interval_index].target.ratio
+ scale_index = (cost_ratio[1] + cost_ratio[3] + cost_ratio[7]) / (3.0 * cost_ratio[0])
+ p = self.params
+ if scale_index <= p.chain_scale_tiny or batch_size <= p.chain_tiny_max_bs:
+ return ChainTier.TINY, scale_index
+ if scale_index < p.chain_scale_small:
+ return ChainTier.SMALL, scale_index
+ if scale_index < p.chain_scale_medium:
+ return ChainTier.MEDIUM, scale_index
+ return ChainTier.LARGE, scale_index
+
+ def chain_stop(self, depth: int, batch_size: int, deltas: Sequence[float] | None = None) -> bool:
+ """Whether a chain draft stops after ``depth`` (odd depths launch deltas)."""
+ if depth == 0 or depth == self.tree_depth - 1 or depth % 2 == 1:
+ return False
+ if deltas is None:
+ raise ValueError(f"chain_stop at depth {depth} needs the host score deltas.")
+ terms = self.chain_stop_terms(depth, batch_size)
+ raw_gain = deltas[1] - deltas[0]
+ curr_gain = raw_gain * 2.0 / terms.gain_scale
+ stop = curr_gain / terms.cost < terms.threshold
+ if stop and terms.cliff_cost > 0.0:
+ gain_two = curr_gain + raw_gain * 2.0 / terms.cliff_gain_scale
+ stop = gain_two / terms.cliff_cost < terms.threshold
+ return stop
+
+ def chain_stop_terms(self, depth: int, batch_size: int) -> ChainStopTerms:
+ """Core chain formulas at the selected interval, using the live batch tier.
+
+ Depths without a decision return all zeros and do not need cost data.
+ See :class:`ChainStopTerms` for the rounding-preserving evaluation order.
+ """
+ if depth == 0 or depth == self.tree_depth - 1 or depth % 2 == 1:
+ return ChainStopTerms(0.0, 0.0, 0.0, 0.0, 0.0)
+ table = self._require_table(batch_size)
+ target = table.intervals[self.interval_index].target
+ cost_ratio = target.ratio
+ cost_llm = cost_ratio[1:]
+ if tuple(target.index) != _CHAIN_COST_INDEX or any(type(index) is not int for index in target.index):
+ raise ValueError(f"Invalid chain cost index: {list(target.index)}")
+ tier, _ = self.classify_chain(batch_size, cost_ratio)
+ p = self.params
+ coef = p.chain_coef[tier]
+ threshold = coef.threshold
+ if self.ragged and tier > ChainTier.TINY:
+ threshold *= p.ragged_draft_relax[tier - 1]
+ curr_step = depth // 2
+ next_step = min(curr_step + 1, len(cost_llm) - 1)
+ draft_step_cost = 1.0 / table.model_ratio[self.interval_index]
+ curr_cost = draft_step_cost * 2 + max(0, cost_llm[next_step] - cost_llm[curr_step])
+ gain_scale = 1.0 + depth * coef.depth_loss
+ ref_iter_cost = sum(c + draft_step_cost * (2 * i + 1) for i, c in enumerate(cost_llm)) / len(cost_llm)
+ curr_threshold = threshold * (p.chain_ref_cost / ref_iter_cost) ** coef.cost_power
+ cliff_gain_scale = 0.0
+ cliff_cost = 0.0
+ if next_step + 1 < len(cost_llm):
+ step_next = cost_llm[next_step] - cost_llm[curr_step]
+ step_after = cost_llm[next_step + 1] - cost_llm[next_step]
+ if step_next > p.chain_cliff_min_cost and step_next > p.chain_cliff_ratio * max(step_after, 0.0):
+ cliff_gain_scale = 1.0 + (depth + 2) * coef.depth_loss
+ cliff_cost = draft_step_cost * 4 + max(0, cost_llm[next_step + 1] - cost_llm[curr_step])
+ return ChainStopTerms(gain_scale, curr_cost, curr_threshold, cliff_gain_scale, cliff_cost)
+
+ def chain_policy_costs(self) -> ChainPolicyCosts:
+ """Export each live batch's nearest measured costs without changing state.
+
+ Each interval contains ``tree_depth`` entries. Validation is specific to
+ chains: target ratios above the tree verifier's limit remain valid.
+ """
+ self._validate_chain_policy_inputs()
+ model = replace(self)
+ batches = []
+ for batch_size in range(1, MAX_BATCH_SIZE_CHAIN + 1):
+ table = model._require_table(batch_size)
+ intervals = []
+ for interval_id in range(len(table.intervals)):
+ model.interval_index = interval_id
+ try:
+ terms = tuple(model.chain_stop_terms(d, batch_size) for d in range(self.tree_depth))
+ except (OverflowError, ZeroDivisionError) as exc:
+ raise ValueError(
+ f"Invalid chain stop terms for batch_size={batch_size}, interval={interval_id}."
+ ) from exc
+ for depth, term in enumerate(terms):
+ values = (term.gain_scale, term.cost, term.threshold, term.cliff_gain_scale, term.cliff_cost)
+ decides = depth != 0 and depth != self.tree_depth - 1 and depth % 2 == 0
+ if (
+ any(not math.isfinite(value) or value < 0 for value in values)
+ or (decides and min(term.gain_scale, term.cost, term.threshold) <= 0)
+ or ((term.cliff_gain_scale > 0) != (term.cliff_cost > 0))
+ ):
+ raise ValueError(
+ f"Invalid chain stop terms for batch_size={batch_size}, "
+ f"interval={interval_id}, depth={depth}."
+ )
+ intervals.append(terms)
+ batches.append(ChainPolicyBatch(table.cache_length_step, tuple(intervals)))
+ return ChainPolicyCosts(tuple(batches))
+
+ def _validate_chain_policy_inputs(self) -> None:
+ if self.intensity is not ComputeIntensity.CHAIN:
+ raise ValueError("Chain policy export requires chain intensity.")
+ for name, lower, upper in (
+ ("node_top_k", 1, 1),
+ ("tree_depth", 2, MAX_CHAIN_DEPTH),
+ ("verify_num", 2, MAX_CHAIN_VERIFY_NUM),
+ ):
+ value = getattr(self, name)
+ if type(value) is not int or not lower <= value <= upper:
+ raise ValueError(f"{name}={value!r} must be an integer in {lower}..{upper} for chain policy export.")
+ p = self.params
+ if len(p.chain_coef) != len(ChainTier):
+ raise ValueError("Chain policy requires four chain_coef entries.")
+ for coef in p.chain_coef:
+ if (
+ not isinstance(coef, ChainCoef)
+ or not math.isfinite(coef.threshold)
+ or coef.threshold <= 0
+ or not math.isfinite(coef.depth_loss)
+ or coef.depth_loss < 0
+ or not math.isfinite(coef.cost_power)
+ or coef.cost_power < 0
+ ):
+ raise ValueError(f"Invalid chain coefficient {coef!r}.")
+ for name in (
+ "chain_ref_cost",
+ "chain_cliff_min_cost",
+ "chain_cliff_ratio",
+ "chain_scale_tiny",
+ "chain_scale_small",
+ "chain_scale_medium",
+ ):
+ value = getattr(p, name)
+ if not math.isfinite(value) or value < 0 or (name != "chain_cliff_min_cost" and value == 0):
+ raise ValueError(f"Invalid chain policy parameter {name}={value!r}.")
+ if not p.chain_scale_tiny < p.chain_scale_small < p.chain_scale_medium:
+ raise ValueError("Chain tier scale thresholds must be strictly increasing.")
+ if type(p.chain_tiny_max_bs) is not int or not 0 <= p.chain_tiny_max_bs <= MAX_BATCH_SIZE_CHAIN:
+ raise ValueError(f"Invalid chain_tiny_max_bs={p.chain_tiny_max_bs!r}.")
+ if len(p.ragged_draft_relax) != 3 or any(
+ not math.isfinite(value) or value <= 0 for value in p.ragged_draft_relax
+ ):
+ raise ValueError(f"Invalid ragged_draft_relax={p.ragged_draft_relax!r}.")
+ self._validate_policy_tables(chain=True)
+
+ # ---------------------------------------------------------- verify budget
+ def verify_num_paged(
+ self,
+ scores: Sequence[float],
+ requested: int,
+ batch_size: int,
+ average_cache_len: int,
+ *,
+ lagged: bool,
+ ) -> tuple[int, bool]:
+ """Verify tokens per request from cumulative node scores.
+
+ ``scores`` are the cumulative top-k scores: of the previous round when
+ ``lagged`` (no sync this round), else of this round. Returns
+ ``(verify_num, stop)``; ``stop`` is only set on evaluation tails.
+ """
+ last_verify_num = find_majority(self.recent_verify_nums)
+ cap = len(scores) if lagged else requested
+ self.recent_verify_nums = self.recent_verify_nums[1:] + [requested]
+ cost = self._require_verify_cost(batch_size, average_cache_len)
+ if self._is_eval_tail(batch_size):
+ return cost.index[1] + 1, True
+ index = [i for i in cost.index if i < min(cap, requested)]
+ if max(index) == 0:
+ # Early stopping left fewer candidates than the smallest tree bucket:
+ # verify the root alone, a measured and valid target step.
+ self.recent_verify_nums[-1] = 1
+ return 1, False
+ values = cost.value[: len(index)]
+ gains = [scores[i] for i in index]
+ mask = list(index)
+ reset = mask[1]
+ thresholds = stable_verify_thresholds(cost.threshold)
+ for i in range(len(index) - 1):
+ for j in range(i + 1, len(index)):
+ stable_threshold = thresholds[0 if last_verify_num <= mask[j] + 1 else 1]
+ delta = verify_cost_delta(values[i], values[j])
+ if delta > 0.0 and (gains[j] - gains[i]) / delta < stable_threshold:
+ mask[j] = reset
+ verify_num = max(mask) + 1
+ self.recent_verify_nums[-1] = verify_num
+ if verify_num == 1 or requested < verify_num:
+ verify_num = min(index[1:]) + 1
+ return verify_num, False
+
+ def ragged_active(self, batch_size: int) -> bool:
+ """Whether per-request (ragged) verify budgets apply at this batch size."""
+ if not self.ragged:
+ return False
+ if batch_size > RAGGED_PAGED_MAX_BS:
+ return True
+ return self.classify_chain(batch_size)[0] > ChainTier.TINY
+
+ def _require_verify_cost(self, batch_size: int, average_cache_len: int) -> VerifyCost:
+ cost = self.verify_cost(batch_size, average_cache_len)
+ if cost is None:
+ raise ValueError(f"Cost data for batch size {batch_size} not found.")
+ return cost
+
+
+@dataclass
+class FixedShapePolicy:
+ """The drafter's policy without cost tables: the full ``tree_depth`` every round, ``verify_num`` tokens verified.
+
+ Same calls as :class:`CostModel` (the drafter sees one interface), no host decisions: ``width_step`` keeps
+ every depth but the last. ``force_width`` narrows one round's verify (the live-cost seed sweep times each
+ captured width through the served round).
+ """
+
+ intensity: ComputeIntensity
+ node_top_k: int
+ tree_depth: int
+ verify_num: int
+ force_width: int | None = None
+
+ launch_depths: tuple[int, ...] = ()
+
+ @property
+ def max_history_verify_num(self) -> int:
+ """The widest verify budget this policy asks the tree for."""
+ return self.verify_num
+
+ def width_step(self, depth: int) -> WidthStep:
+ """Keep drafting through the last depth; never ask for host deltas."""
+ return WidthStep.LAST if depth >= self.tree_depth - 1 else WidthStep.KEEP
+
+ def draft_cost_row(self, batch_size: int, average_cache_len: int) -> None:
+ """No cost inputs: the width never depends on them."""
+ return None
+
+ def history_verify_num(self, batch_size: int) -> int:
+ """The verify budget of every round."""
+ return self.verify_num
+
+ def verify_count(self, batch_size: int, draft_count: int) -> int:
+ """All drafted nodes up to the verify budget."""
+ return min(self.verify_num, draft_count)
+
+ def tree_width(self, depth: int, batch_size: int, past_verify_num: int, row, deltas=None) -> WidthDecision:
+ """Stop only at the last depth."""
+ return WidthDecision(-1, -1, True) if depth >= self.tree_depth - 1 else WidthDecision(self.node_top_k, past_verify_num, False)
+
+ def verify_num_paged(self, scores, requested: int, batch_size: int, average_cache_len: int, *, lagged: bool):
+ """The forced width when set, else the full budget."""
+ width = self.verify_num if self.force_width is None else self.force_width
+ return min(width, requested), False
+
+ def record_verify_num(self, batch_size: int, verify_num: int) -> None:
+ """No history."""
diff --git a/eagle_harness/core/cost_profiles.py b/eagle_harness/core/cost_profiles.py
new file mode 100644
index 0000000..2c94850
--- /dev/null
+++ b/eagle_harness/core/cost_profiles.py
@@ -0,0 +1,45 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+"""Packaged serving costs for measured device and checkpoint configurations."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+from typing import Optional
+
+MI355X_PROFILE = Path(__file__).parent / "profiles" / "mi355x-qwen3.8-27b-tp1"
+
+
+def packaged_cost_profile(
+ *,
+ device_name: str,
+ model_path: str,
+ draft_model_path: str,
+ tp_size: int,
+ dtype: str,
+ quantization: Optional[str],
+) -> Optional[str]:
+ """Select the MI355X BF16 TP1 profile only for its measured checkpoint configs.
+
+ Model directory names do not participate in identity. Unknown devices,
+ unresolved Hub paths, different configs, TP sizes or dtypes keep the caller's
+ ordinary calibration path; a profile for one model must not price another.
+ """
+ if device_name not in ("AMD Instinct MI355X", "AMD Instinct MI355X VF"):
+ return None
+ if tp_size != 1 or dtype not in ("auto", "bfloat16", "torch.bfloat16") or quantization is not None:
+ return None
+ for model, name in ((model_path, "target"), (draft_model_path, "draft")):
+ if not model:
+ return None
+ config_path = Path(model) / "config.json"
+ if not config_path.is_file():
+ return None
+ with config_path.open(encoding="utf-8") as file:
+ config = json.load(file)
+ with (MI355X_PROFILE / f"{name}_config.json").open(encoding="utf-8") as file:
+ measured = json.load(file)
+ if config != measured:
+ return None
+ return str(MI355X_PROFILE)
diff --git a/eagle_harness/core/cost_table.py b/eagle_harness/core/cost_table.py
new file mode 100644
index 0000000..4f36b66
--- /dev/null
+++ b/eagle_harness/core/cost_table.py
@@ -0,0 +1,226 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Reader for the calibrated target and draft cost tables.
+
+On-disk layout::
+
+ <data_path>/cost/bs_<N>/model_llm/model_interval_<i>.json (target verify)
+ <data_path>/cost/bs_<N>/model_slm/model_interval_<i>.json (draft step)
+
+Each interval file holds ``value`` / ``ratio`` / ``index`` / ``array_query`` /
+``array_cache`` lists plus the grid fields written by
+:func:`eagle_harness.core.calibration.fit_model_costs`.
+"""
+
+from __future__ import annotations
+
+import json
+import logging
+import math
+import os
+from dataclasses import dataclass, field
+from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
+
+if TYPE_CHECKING:
+ from eagle_harness.core.live_costs import CostKey
+
+logger = logging.getLogger(__name__)
+
+# What the cost model's decisions need of a table (its own checks raise mid-serving otherwise): the target / draft
+# cost ratio it prices a draft step by, and the verify cost at 8 tokens relative to 1 token (its batch size class).
+MODEL_RATIO_RANGE = (5.0, 100.0)
+VERIFY8_RATIO_RANGE = (0.70, 4.0) # 0.85 for dense targets; the cost model applies the exact bound
+
+
+@dataclass(frozen=True)
+class CostCurve:
+ """Cost of one model at one context interval, per measured query length.
+
+ ``index[i]`` is the query length minus one that ``value[i]`` (microseconds)
+ and ``ratio[i]`` (``value[i] / value[0]``) were measured at.
+ """
+
+ value: Tuple[float, ...]
+ ratio: Tuple[float, ...]
+ index: Tuple[int, ...]
+ array_query: Tuple[float, ...]
+ array_cache: Tuple[float, ...]
+
+ @classmethod
+ def from_json(cls, data: dict) -> "CostCurve":
+ """A curve from an on-disk JSON object."""
+ return cls(
+ value=tuple(data["value"]),
+ ratio=tuple(data["ratio"]),
+ index=tuple(data["index"]),
+ array_query=tuple(data["array_query"]),
+ array_cache=tuple(data["array_cache"]),
+ )
+
+
+@dataclass(frozen=True)
+class IntervalCost:
+ """Target and draft cost curves of one cache-length interval."""
+
+ target: CostCurve # "llm" in the cost-table files
+ draft: CostCurve # "slm" in the cost-table files
+
+
+@dataclass(frozen=True)
+class BatchCostTable:
+ """The cost curves of one batch size over the cache-length intervals."""
+
+ batch_size: int
+ cache_length_start: int
+ cache_length_step: int
+ target_max_qo_len_query: int
+ target_max_qo_len_cache: int
+ draft_max_qo_len: int
+ intervals: Tuple[IntervalCost, ...]
+ # target.value[0] / draft.value[0] per interval; -1.0 when the draft cost is 0.
+ model_ratio: Tuple[float, ...]
+ _warned_context_clamp: bool = field(default=False, init=False, repr=False, compare=False)
+
+ @property
+ def max_interval_id(self) -> int:
+ """Index of the last cache-length interval."""
+ return len(self.intervals) - 1
+
+ def interval_index(self, average_cache_len: int) -> int:
+ """Context interval for an average cached length, clamped to the table."""
+ step = self.cache_length_step
+ index = (average_cache_len - step) // step
+ if index > self.max_interval_id and not self._warned_context_clamp:
+ logger.warning(
+ "Cost table for batch size %d clamps context %d at calibration context_stop=%d; "
+ "recalibrate for the served max_model_len.",
+ self.batch_size,
+ average_cache_len,
+ (len(self.intervals) + 1) * step,
+ )
+ object.__setattr__(self, "_warned_context_clamp", True)
+ return min(max(index, 0), self.max_interval_id)
+
+
+def _read_intervals(path: str) -> Dict[int, dict]:
+ intervals: Dict[int, dict] = {}
+ try:
+ names = os.listdir(path)
+ except FileNotFoundError:
+ return intervals
+ for name in names:
+ if not (name.startswith("model_interval_") and name.endswith(".json")):
+ continue
+ try:
+ interval_id = int(name.split("_")[-1].split(".")[0])
+ with open(os.path.join(path, name), encoding="utf-8") as f:
+ intervals[interval_id] = json.load(f)
+ except (ValueError, IndexError, json.JSONDecodeError):
+ logger.warning("Could not parse cost interval file %s", name)
+ return intervals
+
+
+def _load_batch(batch_dir: str, batch_size: int) -> BatchCostTable:
+ target = _read_intervals(os.path.join(batch_dir, "model_llm"))
+ draft = _read_intervals(os.path.join(batch_dir, "model_slm"))
+ if not target and not draft:
+ raise RuntimeError(f"No cost intervals for batch size {batch_size} in {batch_dir}.")
+ max_interval_id = max(max(target, default=-1), max(draft, default=-1))
+ intervals: List[IntervalCost] = []
+ ratios: List[float] = []
+ for i in range(max_interval_id + 1):
+ llm, slm = target.get(i), draft.get(i)
+ if not llm or not slm:
+ raise RuntimeError(
+ f"Missing interval {i} for batch size {batch_size}: target={llm is not None}, draft={slm is not None}."
+ )
+ intervals.append(IntervalCost(CostCurve.from_json(llm), CostCurve.from_json(slm)))
+ llm_v0 = llm["value"][0] if llm["value"] else 0
+ slm_v0 = slm["value"][0] if slm["value"] else 0
+ ratios.append(round(llm_v0 / slm_v0, 4) if slm_v0 > 0 else -1.0)
+ first_llm = next(iter(target.values()))
+ first_slm = next(iter(draft.values()))
+ return BatchCostTable(
+ batch_size=batch_size,
+ cache_length_start=first_llm["cache_length_start"],
+ cache_length_step=first_llm["cache_length_step"],
+ target_max_qo_len_query=first_llm["max_query_length_query"],
+ target_max_qo_len_cache=first_llm["max_query_length_cache"],
+ draft_max_qo_len=first_slm["max_query_length_query"],
+ intervals=tuple(intervals),
+ model_ratio=tuple(ratios),
+ )
+
+
+def table_problem(table: BatchCostTable) -> Optional[str]:
+ """Why ``table`` is not a cost table, None when it is: every curve finite and positive with a strictly
+ increasing query index from 0 (what every consumer, the depth stop included, reads)."""
+ for i, interval in enumerate(table.intervals):
+ for name, curve in (("target", interval.target), ("draft", interval.draft)):
+ if not curve.value or len(curve.value) != len(curve.index) or len(curve.ratio) != len(curve.index):
+ return f"interval {i}: {name} curve has mismatched lengths"
+ if any(not math.isfinite(v) or v <= 0 for v in curve.value):
+ return f"interval {i}: {name} cost is not finite and positive: {curve.value}"
+ if curve.index[0] != 0 or any(b <= a for a, b in zip(curve.index, curve.index[1:])):
+ return f"interval {i}: {name} query index must increase from 0: {curve.index}"
+ return None
+
+
+def cost_model_problem(table: BatchCostTable, *, target_is_moe: bool = False) -> Optional[str]:
+ """Why the cost model could not decide from ``table``, None when it can: the target / draft cost ratio in
+ :data:`MODEL_RATIO_RANGE` and the target's cost at 8 tokens relative to 1 token in :data:`VERIFY8_RATIO_RANGE`
+ (the model's own checks raise in a decode round otherwise)."""
+ problem = table_problem(table)
+ if problem is not None:
+ return problem
+ for i, interval in enumerate(table.intervals):
+ ratio = table.model_ratio[i]
+ if not MODEL_RATIO_RANGE[0] <= ratio <= MODEL_RATIO_RANGE[1]:
+ return f"interval {i}: target / draft cost ratio {ratio} outside {MODEL_RATIO_RANGE}"
+ target = interval.target
+ at8 = next((target.ratio[j] for j, idx in enumerate(target.index) if idx >= 7), target.ratio[-1])
+ bounds = (VERIFY8_RATIO_RANGE[0] if target_is_moe else 0.85, VERIFY8_RATIO_RANGE[1])
+ if not bounds[0] <= at8 <= bounds[1]:
+ return f"interval {i}: target cost at 8 tokens / at 1 token = {at8} outside {bounds}"
+ return None
+
+
+def load_cost_tables(cost_dir: str, key: Optional["CostKey"] = None) -> Dict[int, BatchCostTable]:
+ """Load every ``bs_<N>`` table under ``cost_dir``; empty if it does not exist.
+
+ A batch directory missing ``model_llm`` or ``model_slm`` is skipped with a
+ warning; an incomplete interval set, or a table the cost model could
+ not decide from (:func:`table_problem`), is an error. With ``key``, the tables' ``key.json`` (in the parent
+ of ``cost_dir``) must name the same setup (:func:`eagle_harness.core.live_costs.check_key`).
+ """
+ try:
+ entries = os.listdir(cost_dir)
+ except FileNotFoundError:
+ logger.error("Cost data path not found: %s", cost_dir)
+ return {}
+ if key is not None:
+ from eagle_harness.core.live_costs import check_key
+
+ check_key(os.path.dirname(os.path.normpath(cost_dir)), key)
+ tables: Dict[int, BatchCostTable] = {}
+ for entry in entries:
+ batch_dir = os.path.join(cost_dir, entry)
+ if not (entry.startswith("bs_") and os.path.isdir(batch_dir)):
+ continue
+ try:
+ batch_size = int(entry.split("_")[1])
+ except (IndexError, ValueError) as e:
+ raise RuntimeError(f"Unexpected batch directory name: {entry}") from e
+ if not (
+ os.path.isdir(os.path.join(batch_dir, "model_llm")) and os.path.isdir(os.path.join(batch_dir, "model_slm"))
+ ):
+ logger.warning("Missing model cost directory for batch size %d; skipped.", batch_size)
+ continue
+ table = _load_batch(batch_dir, batch_size)
+ problem = table_problem(table)
+ if problem is not None:
+ raise RuntimeError(f"Cost tables under {batch_dir} cannot drive the cost model: {problem}.")
+ tables[batch_size] = table
+ logger.debug("Loaded cost data for batch size %d", batch_size)
+ return tables
diff --git a/eagle_harness/core/draft_tree.py b/eagle_harness/core/draft_tree.py
new file mode 100644
index 0000000..28b98d1
--- /dev/null
+++ b/eagle_harness/core/draft_tree.py
@@ -0,0 +1,364 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Draft tree of one decode round: node scores, frontier, verify selection.
+
+Pure torch on fixed-shape tensors, so every per-depth update can be captured
+in a CUDA graph. Tree layers, cumulative draft state and work deltas use a fixed
+expansion width ``K``, which is the width the cost model always chooses at batch size 1:
+
+- The root (the last accepted token) has score ``ROOT_SCORE``; its ``K``
+ children come from the draft extend's top-k and form depth 1.
+- A draft step expands the ``K`` frontier nodes of depth ``d``: each yields its
+ top-``K`` children, scored ``parent score * child probability``. All ``K*K``
+ children join the tree; the best ``K`` of them are the frontier of depth
+ ``d + 1``.
+- The best-score set (undecayed, root included) and the newest layer's top
+ ``K`` give the work deltas the cost model's stop rule reads, for every
+ verify budget at once.
+- The verify set is the best nodes by depth-decayed score (``DEPTH_DECAY**d``
+ for ``d >= 2``), which also orders a parent before an equally scored child.
+
+Node numbering is sglang's EAGLE tree layout (``organize_draft_results``,
+``build_tree_kernel_efficient``): depth 1 at ``[0, K)``, the children of depth
+``d`` at ``K + (d - 1) * K * K``, parents as ``arange(-1, K)`` followed by the
+global index of each later frontier.
+"""
+
+from __future__ import annotations
+
+from dataclasses import dataclass
+from typing import Iterable, NamedTuple, Optional, Tuple
+
+import torch
+
+ROOT_SCORE = 1.001
+DEPTH_DECAY = 0.9999
+
+
+def _next_power_of_2(n: int) -> int:
+ return 1 << max(n - 1, 0).bit_length()
+
+
+@dataclass(frozen=True)
+class TreeShape:
+ """Static tree dimensions.
+
+ ``top_k``: children per expanded node and expanded nodes per depth.
+ ``max_depth``: deepest node depth (``--speculative-num-steps``); a round
+ runs at most ``max_depth - 1`` draft steps.
+ ``work_cap``: width of the best-score set (>= any verify budget the cost
+ model asks the deltas for).
+ """
+
+ top_k: int
+ max_depth: int
+ work_cap: int = 64
+
+ def __post_init__(self) -> None:
+ if self.top_k < 1 or self.max_depth < 2:
+ raise ValueError(f"tree needs top_k >= 1 and max_depth >= 2, got {self}")
+
+ def layer_start(self, depth: int) -> int:
+ """First node index of ``depth`` (1-based)."""
+ if depth == 1:
+ return 0
+ return self.top_k + (depth - 2) * self.top_k * self.top_k
+
+ def num_nodes(self, depth: int) -> int:
+ """Nodes of depths ``1..depth``."""
+ return self.layer_start(depth + 1)
+
+ def num_parents(self, depth: int) -> int:
+ """Length of sglang's ``parent_list`` for a tree of ``depth`` levels."""
+ return 0 if depth < 2 else (self.top_k + 1) + (depth - 2) * self.top_k
+
+ def count_before_step(self, step: int) -> int:
+ """Tree size (root included) before step ``step`` adds its layer."""
+ return 1 + self.top_k + (step - 1) * self.top_k * self.top_k
+
+ @property
+ def capacity(self) -> int:
+ """Node slots of the deepest tree."""
+ return self.num_nodes(self.max_depth)
+
+ @property
+ def parent_capacity(self) -> int:
+ """Parent slots of the deepest tree."""
+ return (self.top_k + 1) + (self.max_depth - 1) * self.top_k
+
+ def decay(self, device: torch.device) -> torch.Tensor:
+ """Per-node depth decay, ``[capacity]`` fp32."""
+ out = torch.ones(self.capacity, dtype=torch.float32)
+ for depth in range(2, self.max_depth + 1):
+ out[self.layer_start(depth) : self.layer_start(depth + 1)] = DEPTH_DECAY**depth
+ return out.to(device)
+
+
+class VerifySelection(NamedTuple):
+ """sglang ``build_tree_kernel_efficient`` inputs for ``u - 1`` verified nodes."""
+
+ parent_list: torch.Tensor # [bs, num_parents(depth)] int64
+ top_scores_index: torch.Tensor # [bs, u - 1] int64, ascending
+ draft_tokens: torch.Tensor # [bs, u - 1] int64
+
+
+class DraftTree:
+ """Per-round tree state for up to ``max_bs`` requests (all buffers static).
+
+ ``root_probs`` / ``root_tokens`` / ``root_hidden`` hold the round's input
+ (the draft extend's top-``K`` and hidden state); :meth:`begin` seeds
+ depth 1 from them. After :meth:`begin` (slot 0) and after step ``d``
+ (slot ``d``), for every slot in ``delta_slots`` (default: all),
+ ``deltas[slot]`` holds the work deltas for every verify budget
+ ``1..max_verify`` (row ``v - 1``), so the cost model's input is computed
+ inside the step's graph. ``max_verify`` must cover every budget the cost
+ model asks for (:attr:`CostModel.max_history_verify_num`), which can
+ exceed the verify width.
+ """
+
+ def __init__(
+ self,
+ shape: TreeShape,
+ max_bs: int,
+ hidden_size: int,
+ dtype: torch.dtype,
+ device: torch.device,
+ *,
+ max_verify: int,
+ delta_slots: Optional[Iterable[int]] = None,
+ ):
+ k = shape.top_k
+ if not 1 <= max_verify <= shape.work_cap:
+ raise ValueError(f"max_verify={max_verify} must be in 1..work_cap={shape.work_cap}")
+ slots = frozenset(range(shape.max_depth) if delta_slots is None else delta_slots)
+ if not slots <= set(range(shape.max_depth)):
+ raise ValueError(f"delta_slots {sorted(slots)} outside 0..{shape.max_depth - 1}")
+ self.delta_slots = slots
+ self.shape = shape
+ self.max_bs = max_bs
+ self.max_verify = max_verify
+ f32, i64 = torch.float32, torch.int64
+ self.root_probs = torch.zeros(max_bs, k, dtype=f32, device=device)
+ self.root_tokens = torch.zeros(max_bs, k, dtype=i64, device=device)
+ self.root_hidden = torch.zeros(max_bs, hidden_size, dtype=dtype, device=device)
+ self.scores = torch.zeros(max_bs, shape.capacity, dtype=f32, device=device)
+ self.tokens = torch.zeros(max_bs, shape.capacity, dtype=i64, device=device)
+ self.parents = torch.zeros(max_bs, shape.parent_capacity, dtype=i64, device=device)
+ self.parents[:, : k + 1] = torch.arange(-1, k, dtype=i64, device=device)
+ self.front_scores = torch.zeros(max_bs, k, dtype=f32, device=device)
+ self.front_tokens = torch.zeros(max_bs * k, dtype=i64, device=device)
+ self.front_hidden = torch.zeros(max_bs * k, hidden_size, dtype=dtype, device=device)
+ # Draft KV slot of each frontier node's ancestors (depth d at column d - 1).
+ self.ancestors = torch.zeros(max_bs, k, shape.max_depth, dtype=torch.int32, device=device)
+ self.best = torch.zeros(max_bs, shape.work_cap, dtype=f32, device=device)
+ self.best_prev = torch.zeros_like(self.best)
+ self.layer_top = torch.zeros(max_bs, k, dtype=f32, device=device)
+ self.decay = shape.decay(device)
+ self.deltas = torch.zeros(shape.max_depth, max_verify, k + 1, dtype=f32, device=device)
+ self.delta_rows = torch.zeros(max_bs, max_verify, k + 1, dtype=f32, device=device) # per-row deltas (kernel)
+ self._extra_mask = self._delta_mask(device)
+ # verify_rows: the select kernel's per-node row scratch, and the torch path's layer tables
+ self._row_of = torch.empty(max_bs * _next_power_of_2(shape.capacity), dtype=torch.int32, device=device)
+ depths = range(1, shape.max_depth + 1)
+ self._layer_bounds = torch.tensor([shape.layer_start(d + 1) for d in depths], dtype=i64, device=device)
+ self._layer_starts = torch.tensor([shape.layer_start(d) for d in depths], dtype=i64, device=device)
+ # column of depth d's frontier list in ``parents`` (entry 0 is the root)
+ self._frontier_base = torch.tensor(
+ [shape.num_parents(d) if d > 1 else 1 for d in depths], dtype=i64, device=device
+ )
+
+ # ------------------------------------------------------------------ round
+ def stage_root(self, bs: int, probs: torch.Tensor, tokens: torch.Tensor, hidden: torch.Tensor) -> None:
+ """Copy the round's input into the root buffers unless it already lives there."""
+ for dst, src in ((self.root_probs, probs), (self.root_tokens, tokens), (self.root_hidden, hidden)):
+ if src.data_ptr() != dst.data_ptr():
+ dst[:bs].copy_(src)
+
+ def begin(self, bs: int) -> None:
+ """Seed depth 1 from the root buffers (``[bs, K]`` probabilities / ids, ``[bs, H]`` hidden)
+ (one Triton launch on CUDA, :meth:`begin_reference` elsewhere)."""
+ if self.root_probs.is_cuda:
+ from eagle_harness.kernels.tree_step import tree_begin
+
+ tree_begin(self, bs, ROOT_SCORE)
+ else:
+ self.begin_reference(bs)
+ if 0 in self.delta_slots:
+ self._store_deltas(bs, 0)
+
+ def begin_reference(self, bs: int) -> None:
+ """:meth:`begin` without the work deltas, in torch (CPU, and the reference of the CUDA kernel)."""
+ k = self.shape.top_k
+ probs, order = torch.sort(self.root_probs[:bs], dim=-1, descending=True, stable=True) # ties: lower node
+ tokens = torch.gather(self.root_tokens[:bs], 1, order)
+ self.scores[:bs, :k] = probs
+ self.tokens[:bs, :k] = tokens
+ self.front_scores[:bs] = probs
+ self.front_tokens[: bs * k] = tokens.reshape(-1)
+ self.front_hidden[: bs * k] = self.root_hidden[:bs].repeat_interleave(k, dim=0)
+ self.best_prev[:bs].zero_()
+ self.best_prev[:bs, 0] = ROOT_SCORE
+ self.best[:bs].zero_()
+ self.best[:bs, 0] = ROOT_SCORE
+ self.best[:bs, 1 : 1 + k] = probs
+ self.layer_top[:bs] = probs
+
+ def set_step_slots(self, bs: int, step: int, slots: torch.Tensor) -> None:
+ """Record the draft KV slots ``[bs, K]`` the depth-``step`` frontier writes."""
+ self.ancestors[:bs, :, step - 1] = slots.to(torch.int32)
+
+ def step(self, bs: int, step: int, probs: torch.Tensor, tokens: torch.Tensor, hidden: torch.Tensor) -> None:
+ """Add the children of the depth-``step`` frontier (``1 <= step < max_depth``).
+
+ ``probs`` / ``tokens``: ``[bs * K, K]`` top-k of each frontier row;
+ ``hidden``: ``[bs * K, H]`` the rows' draft hidden states.
+ """
+ if not 1 <= step < self.shape.max_depth:
+ raise ValueError(f"step {step} outside 1..{self.shape.max_depth - 1}")
+ if probs.is_cuda:
+ from eagle_harness.kernels.tree_step import tree_step
+
+ tree_step(self, bs, step, probs, tokens, hidden, deltas=step in self.delta_slots)
+ else:
+ self.step_reference(bs, step, probs, tokens, hidden)
+ if step in self.delta_slots:
+ self._store_deltas(bs, step)
+
+ def step_reference(
+ self, bs: int, step: int, probs: torch.Tensor, tokens: torch.Tensor, hidden: torch.Tensor
+ ) -> None:
+ """:meth:`step` without the work deltas, in torch (CPU, and the reference of the CUDA kernel)."""
+ shape = self.shape
+ k = shape.top_k
+ layer = (self.front_scores[:bs].unsqueeze(-1) * probs.float().view(bs, k, k)).view(bs, k * k)
+ start = shape.layer_start(step + 1)
+ self.scores[:bs, start : start + k * k] = layer
+ layer_tokens = tokens.long().view(bs, k * k)
+ self.tokens[:bs, start : start + k * k] = layer_tokens
+ top, pick = torch.topk(layer, k, dim=-1)
+ pstart = shape.num_parents(step + 1)
+ self.parents[:bs, pstart : pstart + k] = pick + start
+ lane = torch.div(pick, k, rounding_mode="floor")
+ rows = (lane + torch.arange(bs, device=lane.device).unsqueeze(-1) * k).view(-1)
+ self.front_scores[:bs] = top
+ self.front_tokens[: bs * k] = torch.gather(layer_tokens, 1, pick).view(-1)
+ self.front_hidden[: bs * k] = hidden.view(bs * k, -1).index_select(0, rows)
+ self.ancestors[:bs] = self.ancestors[:bs].view(bs * k, -1).index_select(0, rows).view(bs, k, -1)
+ self.best_prev[:bs] = self.best[:bs]
+ merged = torch.cat([self.best[:bs], layer], dim=-1)
+ self.best[:bs] = torch.topk(merged, shape.work_cap, dim=-1).values
+ self.layer_top[:bs] = top
+
+ # ----------------------------------------------------------- cost model
+ def _delta_mask(self, device: torch.device) -> torch.Tensor:
+ """``[K + 1, K]``: row ``j`` keeps the layer's best ``j`` scores."""
+ k = self.shape.top_k
+ return (torch.arange(k).view(1, -1) < torch.arange(k + 1).view(-1, 1)).float().to(device)
+
+ def _store_deltas(self, bs: int, slot: int) -> None:
+ """Compute work deltas on the newest layer, for every verify budget ``v`` (one Triton
+ launch on CUDA, :meth:`_store_deltas_reference` elsewhere)."""
+ if self.deltas.is_cuda:
+ from eagle_harness.kernels.tree_step import work_deltas
+
+ work_deltas(self, bs, slot)
+ else:
+ self._store_deltas_reference(bs, slot)
+
+ def _store_deltas_reference(self, bs: int, slot: int) -> None:
+ """The torch version of :meth:`_store_deltas`.
+
+ Sum the top ``min(n0 + j, v)`` of the merge of the best set
+ before the layer (``n0 = min(v, count)`` nodes, ``count``: tree size
+ before it) and the layer's best ``j``. The best set is sorted, so for
+ ``v <= count`` that is the top ``v`` of the merge with the whole best
+ set, and for ``v > count`` the entries past ``count`` are zeros (scores
+ are non-negative). Either way ``deltas[slot, v - 1, j]`` is the batch
+ mean of the ``v``-th prefix sum of ``sort(best_prev ++ layer_top[:j])``,
+ one sort for every budget.
+ """
+ k = self.shape.top_k
+ extra = self.layer_top[:bs, None, :] * self._extra_mask.view(1, k + 1, k) # [bs, K + 1, K]
+ best = self.best_prev[:bs, None, :].expand(bs, k + 1, self.shape.work_cap)
+ merged = torch.sort(torch.cat([best, extra], dim=-1), dim=-1, descending=True).values
+ sums = merged[..., : self.max_verify].cumsum(dim=-1) # [bs, K + 1, V]
+ self.deltas[slot] = sums.mean(dim=0).transpose(0, 1)
+
+ # --------------------------------------------------------------- verify
+ def rank(self, bs: int, depth: int, count: int) -> Tuple[torch.Tensor, torch.Tensor]:
+ """The best ``count`` nodes of a ``depth``-level tree by decayed score, best first (ties: the lower
+ node), ``[bs, count]``, and the cumulative verify scores of their prefixes, root first,
+ ``[bs, count + 1]`` (the cost model's lagged input). One Triton launch on CUDA,
+ :meth:`rank_reference` elsewhere."""
+ count = min(count, self.shape.num_nodes(depth))
+ if self.scores.is_cuda:
+ from eagle_harness.kernels.tree_step import tree_rank
+
+ return tree_rank(self, bs, depth, count, ROOT_SCORE)
+ return self.rank_reference(bs, depth, count)
+
+ def rank_reference(self, bs: int, depth: int, count: int) -> Tuple[torch.Tensor, torch.Tensor]:
+ """:meth:`rank` in torch (CPU, and the reference of the CUDA kernel)."""
+ n = self.shape.num_nodes(depth)
+ decayed = self.scores[:bs, :n] * self.decay[:n]
+ top, ranked = torch.sort(decayed, dim=-1, descending=True, stable=True)
+ root = top.new_full((bs, 1), ROOT_SCORE)
+ return ranked[:, :count], torch.cumsum(torch.cat([root, top[:, :count]], dim=-1), dim=-1)
+
+ def select(self, bs: int, depth: int, ranked: torch.Tensor, verify_tokens: int) -> VerifySelection:
+ """The best ``verify_tokens - 1`` nodes (plus the root) in sglang's layout (the node sort and token
+ gather in one Triton launch on CUDA)."""
+ chosen = ranked[:, : verify_tokens - 1]
+ if chosen.is_cuda:
+ from eagle_harness.kernels.tree_step import tree_select
+
+ index, tokens = tree_select(chosen, self.tokens)
+ else:
+ index = torch.sort(chosen, dim=-1).values
+ tokens = torch.gather(self.tokens[:bs], 1, index)
+ return VerifySelection(
+ # sglang's tree kernel reads a dense [bs, parents] array; the column slice of a batch is strided
+ parent_list=self.parents[:bs, : self.shape.num_parents(depth)].contiguous(),
+ top_scores_index=index,
+ draft_tokens=tokens,
+ )
+
+ def verify_rows(self, bs: int, depth: int, count: int) -> Tuple[torch.Tensor, torch.Tensor]:
+ """The best ``count`` nodes of a ``depth``-level tree as verify rows: ``(tokens [bs, count] int64,
+ parent_rows [bs, count + 1] int32)``.
+
+ Rows follow the node numbering, which puts a parent before its children, so any prefix of the rows is a tree.
+ Row 0 of ``parent_rows`` is the root (-1); the node of row ``r`` has the parent row ``parent_rows[:, r]`` (0: the
+ root). Ties at the last row go to the lowest node, as in :meth:`rank`. One launch on CUDA
+ (:func:`~eagle_harness.kernels.tree_step.select_rows`), :meth:`verify_rows_reference` elsewhere.
+ """
+ n = self.shape.num_nodes(depth)
+ if self.scores.is_cuda:
+ from eagle_harness.kernels.tree_step import select_rows
+
+ n_block = _next_power_of_2(n)
+ return select_rows(
+ self.scores[:bs, :n],
+ self.decay[:n],
+ self.tokens[:bs, :n],
+ self.parents[:bs],
+ count,
+ self.shape.top_k,
+ self._row_of[: bs * n_block].view(bs, n_block),
+ )
+ return self.verify_rows_reference(bs, depth, count)
+
+ def verify_rows_reference(self, bs: int, depth: int, count: int) -> Tuple[torch.Tensor, torch.Tensor]:
+ """:meth:`verify_rows` in torch (CPU, and the reference of the kernel)."""
+ ranked, _ = self.rank_reference(bs, depth, count)
+ index = torch.sort(ranked, dim=-1).values
+ tokens = torch.gather(self.tokens[:bs], 1, index)
+ layer = torch.bucketize(index, self._layer_bounds, right=True) # 0-based: depth 1 is 0
+ local = index - self._layer_starts[layer]
+ column = self._frontier_base[(layer - 1).clamp(min=0)] + local // self.shape.top_k
+ parent_node = torch.where(layer == 0, -1, self.parents[:bs].gather(1, column))
+ is_parent = index[:, None, :] == parent_node[:, :, None] # [bs, child, parent]
+ parent_row = torch.where(is_parent.any(-1), is_parent.int().argmax(-1) + 1, 0)
+ root = parent_row.new_full((bs, 1), -1)
+ return tokens, torch.cat([root, parent_row], dim=1).int()
diff --git a/eagle_harness/core/gemm_solutions.py b/eagle_harness/core/gemm_solutions.py
new file mode 100644
index 0000000..3a33e7c
--- /dev/null
+++ b/eagle_harness/core/gemm_solutions.py
@@ -0,0 +1,89 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Per-GPU GEMM solutions: a PyTorch TunableOp results file under ``data_path``, loaded before graph capture.
+
+The BLAS library's default heuristic can pick a poor kernel for the skinny GEMMs of a speculative round: on
+MI355X hipBLASLt streams the target's MLP gate_up weight (5120 x 34816) at 4.4 TB/s for 32 verify rows while
+another of its own solutions reaches 5.8 TB/s (81 -> 62 us), and the draft, output and down projections lose
+10-30% the same way. ``torch.cuda.tunable`` (TunableOp) is PyTorch's autotuner for exactly this: it times every
+available solution of a GEMM signature once, offline, and serves the saved pick. The harness keeps the saved
+picks with the GPU's other calibration data as ``<data_path>/gemm_solutions.csv``
+(``tools/tune_gemm_solutions.py`` writes it) and loads them with tuning disabled, so nothing is timed at server
+startup and every process and rank runs the same kernels. TunableOp validates the file against the PyTorch,
+ROCm/CUDA and BLAS library versions and the GPU architecture that tuned it; a file from another stack is
+ignored with a warning and GEMMs without a saved pick keep the default solution.
+
+On ROCm the harness also keeps sglang's aiter GEMM dispatch on that torch path for every bf16 GEMM
+(:func:`serve_bf16_gemms_through_torch`): aiter's own split-K picks are not repeatable run to run.
+"""
+
+from __future__ import annotations
+
+import logging
+import os
+from typing import Optional
+
+import torch
+
+logger = logging.getLogger(__name__)
+
+GEMM_SOLUTIONS_FILE = "gemm_solutions.csv"
+# aiter's bf16 GEMM dispatch (sglang with SGLANG_USE_AITER=1 routes every bf16 linear through it) reads its tuned table
+# from this variable, before the first GEMM of the process.
+AITER_GEMM_TABLE_ENV = "AITER_CONFIG_GEMM_BF16"
+# The harness's table: empty, so aiter keeps every bf16 GEMM on its torch (hipBLASLt) path, where the saved solutions
+# above apply, instead of its own picks.
+AITER_GEMM_TABLE = os.path.join(os.path.dirname(__file__), "aiter_gemm_bf16.csv")
+
+
+def serve_bf16_gemms_through_torch() -> bool:
+ """On ROCm, point aiter's bf16 GEMM dispatch at the harness's empty table (``AITER_CONFIG_GEMM_BF16``), unless
+ the caller set the variable itself; returns whether it was set.
+
+ aiter's shipped tables pick split-K kernels (asm, FlyDSL) for some shapes: on MI355X the EAGLE-4 draft's
+ 5120 x 5120 projections at <= 32 rows. Those reduce the K splits in a varying order and round them to bf16
+ (twice the error of one rounding), so the same draft step gives different hidden states from one run to the
+ next, the draft tree changes, and greedy outputs flip at bf16 near ties. Every bf16 GEMM then runs torch's
+ ``F.linear`` (hipBLASLt; TunableOp serves the saved solutions), which is bitwise repeatable.
+
+ Call in the process that launches the server before any model code imports aiter: the dispatch reads the
+ table once, at import, and the scheduler processes inherit the environment.
+ """
+ if torch.version.hip is None or os.environ.get(AITER_GEMM_TABLE_ENV):
+ return False
+ os.environ[AITER_GEMM_TABLE_ENV] = AITER_GEMM_TABLE
+ return True
+
+
+def gemm_solutions_path(data_path: Optional[str]) -> Optional[str]:
+ """``<data_path>/gemm_solutions.csv`` when it exists, else None."""
+ if data_path is None:
+ return None
+ path = os.path.join(data_path, GEMM_SOLUTIONS_FILE)
+ return path if os.path.isfile(path) else None
+
+
+def load_gemm_solutions(data_path: Optional[str]) -> int:
+ """Serve the GEMM solutions saved under ``data_path`` (tuning off); returns how many were loaded.
+
+ Call before the first forward, so captured graphs record the tuned kernels. Without the file nothing
+ changes; a file this stack cannot validate leaves TunableOp disabled and logs how to re-tune it.
+ """
+ path = gemm_solutions_path(data_path)
+ if path is None:
+ return 0
+ tunable = torch.cuda.tunable
+ tunable.enable(True)
+ tunable.tuning_enable(False)
+ loaded = len(tunable.get_results()) if tunable.read_file(path) else 0
+ if loaded == 0:
+ tunable.enable(False)
+ logger.warning(
+ "EAGLE-Harness: no GEMM solutions usable from %s (tuned on another PyTorch/ROCm/BLAS/GPU stack?); "
+ "re-tune with tools/tune_gemm_solutions.py or remove the file. Default GEMM kernels stay in use.",
+ path,
+ )
+ return 0
+ logger.info("EAGLE-Harness: %d saved GEMM solutions from %s", loaded, path)
+ return loaded
diff --git a/eagle_harness/core/limits.py b/eagle_harness/core/limits.py
new file mode 100644
index 0000000..10e308a
--- /dev/null
+++ b/eagle_harness/core/limits.py
@@ -0,0 +1,149 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Shape limits and measured buckets shared by the cost model and calibration."""
+
+from __future__ import annotations
+
+import enum
+from typing import Iterable, List, Tuple
+
+
+class ComputeIntensity(str, enum.Enum):
+ """Draft shape family, serialized as a compute-intensity string."""
+
+ HIGH = "high_intensity"
+ LOW = "low_intensity"
+ CHAIN = "chain_intensity"
+
+
+MAX_BATCH_SIZE_CHAIN = 512
+# Tree kernels index requests independently; their buffers are sized from the configured batch limit.
+MAX_BATCH_SIZE_TREE = MAX_BATCH_SIZE_CHAIN
+MAX_VERIFY_TOKENS = 4096
+MAX_TREE_DEPTH = 31
+MAX_CHAIN_DEPTH = 15
+MAX_NODE_TOP_K = 8
+TAIL_MASK_BITS = 64 # One uint64 ancestry word per verify row.
+MAX_VERIFY_NUM = 64
+assert MAX_VERIFY_NUM <= TAIL_MASK_BITS
+MAX_CHAIN_VERIFY_NUM = 16
+# Above this batch size the ragged verify plan is used whenever it is enabled.
+RAGGED_PAGED_MAX_BS = 8
+
+COST_BATCH_SIZES: Tuple[int, ...] = (
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 12,
+ 16,
+ 24,
+ 32,
+ 48,
+ 64,
+ 96,
+ 128,
+ 192,
+ 256,
+ 384,
+ 512,
+)
+
+_CHAIN_VERIFY_BUCKETS = (16, 14, 12, 10, 8, 6, 4, 2, 1)
+
+
+def max_batch_size(intensity: ComputeIntensity) -> int:
+ """The largest batch size served at this compute intensity."""
+ if intensity is ComputeIntensity.CHAIN:
+ return MAX_BATCH_SIZE_CHAIN
+ return MAX_BATCH_SIZE_TREE
+
+
+def cost_batch_sizes(max_bs: int, start_bs: int = 1) -> List[int]:
+ """Batch sizes calibration measures, within ``[start_bs, max_bs]``."""
+ return [bs for bs in COST_BATCH_SIZES if start_bs <= bs <= max_bs]
+
+
+def nearest_cost_batch_size(batch_size: int, measured: Iterable[int]) -> int:
+ """The measured batch size closest to ``batch_size``; ties go to the larger."""
+ candidates = sorted(measured)
+ if not candidates:
+ raise ValueError("No measured batch sizes in the cost data.")
+ return min(candidates, key=lambda bs: (abs(bs - batch_size), -bs))
+
+
+def verify_buckets(batch_size: int, intensity: ComputeIntensity) -> List[int]:
+ """Verify widths that get a target-verify CUDA graph and a cost curve.
+
+ Returns widths in descending order.
+ """
+ if batch_size <= 0:
+ raise ValueError(f"batch_size must be positive, got {batch_size}.")
+ if batch_size > MAX_BATCH_SIZE_CHAIN:
+ raise NotImplementedError(f"batch_size={batch_size} exceeds the chain batch limit {MAX_BATCH_SIZE_CHAIN}.")
+ if intensity is ComputeIntensity.CHAIN:
+ return list(_CHAIN_VERIFY_BUCKETS)
+ if batch_size > MAX_BATCH_SIZE_TREE:
+ raise NotImplementedError(f"the tree draft batch limit is {MAX_BATCH_SIZE_TREE}, got batch_size={batch_size}.")
+ if batch_size <= 2:
+ return [64, 32, 16, 8, 1]
+ if batch_size <= 8:
+ if intensity is ComputeIntensity.HIGH:
+ return [64, 32, 16, 8, 1]
+ return [32, 16, 8, 4, 1]
+ if intensity is ComputeIntensity.HIGH:
+ return [32, 16, 8, 4, 1]
+ return [16, 8, 4, 2, 1]
+
+
+def draft_query_lens(batch_size: int, intensity: ComputeIntensity) -> List[int]:
+ """Draft-step query lengths (tree widths) calibration measures."""
+ if intensity is ComputeIntensity.CHAIN:
+ return [1]
+ if batch_size <= 32:
+ return [1, 2, 4, 8]
+ if batch_size <= 64:
+ return [1, 2, 4]
+ return [1, 2]
+
+
+def req_to_token_span(node_top_k: int, tree_depth: int, verify_num: int, page_size: int) -> int:
+ """Widest block-table span past ``seq_len`` one step writes.
+
+ Draft (``node_top_k * tree_depth`` slots), verify (``verify_num``; a chain
+ verifies at most its drafted nodes plus the root) and, for a chain at
+ ``page_size > 1``, the shared draft / verify allocation all start at
+ ``seq_len``; the span is their maximum.
+ """
+ draft = node_top_k * tree_depth
+ verify = verify_num if node_top_k > 1 else min(verify_num, tree_depth + 1)
+ shared = tree_depth + 1 if node_top_k == 1 and page_size > 1 else 0
+ return max(draft, verify, shared)
+
+
+def check_shape(
+ intensity: ComputeIntensity, node_top_k: int, tree_depth: int, verify_num: int, max_running_requests: int
+) -> None:
+ """Reject draft shapes the kernels do not support."""
+ chain = intensity is ComputeIntensity.CHAIN
+ cap = max_batch_size(intensity)
+ if max_running_requests > cap:
+ raise ValueError(
+ f"max_running_requests={max_running_requests} exceeds the {'chain' if chain else 'tree'} "
+ f"draft batch limit {cap}."
+ )
+ if tree_depth > (MAX_CHAIN_DEPTH if chain else MAX_TREE_DEPTH):
+ raise NotImplementedError(f"tree_depth={tree_depth} is not supported for {intensity.value}.")
+ if node_top_k > MAX_NODE_TOP_K:
+ raise NotImplementedError(f"--speculative-eagle-topk > {MAX_NODE_TOP_K} is not supported.")
+ if chain and node_top_k > 1:
+ raise NotImplementedError("--speculative-eagle-topk > 1 is not supported for chain_intensity.")
+ if verify_num > (MAX_CHAIN_VERIFY_NUM if chain else MAX_VERIFY_NUM):
+ raise NotImplementedError(f"verify_num={verify_num} is not supported for {intensity.value}.")
+ if verify_num <= 1:
+ raise ValueError("verify_num <= 1 is invalid.")
diff --git a/eagle_harness/core/live_costs.py b/eagle_harness/core/live_costs.py
new file mode 100644
index 0000000..698a971
--- /dev/null
+++ b/eagle_harness/core/live_costs.py
@@ -0,0 +1,267 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Live costs: the cost model's tables measured from the served rounds, keyed to the serving setup.
+
+Offline calibration prices the draft step and the target verify on dummy batches, ahead of time, for one GPU, TP
+size, model pair, engine build and dtype. :class:`LiveCosts` prices them on the engine's own served rounds
+instead: a seed sweep forces each captured verify width for a few rounds per batch bucket (the exact kernels
+served, at the real context), then every served round refines its cell (an EMA per batch bucket, verify width
+and context interval). The cells become the same :class:`~eagle_harness.core.cost_table.BatchCostTable` objects
+the :class:`~eagle_harness.core.cost_model.CostModel` reads, so the decision code has one input.
+
+A :class:`CostKey` names the setup the costs belong to. Offline tables carry it in ``key.json`` under their
+``data_path``; live costs carry it in their cache file. Costs whose key differs from the server's are refused
+(offline) or measured again (live); an unkeyed offline directory is accepted with a warning.
+"""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import logging
+import math
+import os
+from dataclasses import asdict, dataclass, field
+from typing import Callable, Dict, List, Optional, Sequence, Tuple
+
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, IntervalCost
+
+logger = logging.getLogger(__name__)
+
+KEY_FILE = "key.json"
+
+
+@dataclass(frozen=True)
+class CostKey:
+ """What a set of costs was measured on: the costs are valid for exactly this setup."""
+
+ gpu: str # device name, e.g. "NVIDIA B300"
+ gpu_count: int # TP size: the per-rank shapes depend on it
+ model: str # target config digest (see config_digest)
+ draft: str # draft config digest
+ engine: str # engine name and version, e.g. "sglang 0.5.23"
+ dtype: str # target dtype, e.g. "torch.bfloat16"
+
+ def to_dict(self) -> dict:
+ """The key as JSON data."""
+ return asdict(self)
+
+ @classmethod
+ def from_dict(cls, data: dict) -> "CostKey":
+ """A key from JSON data."""
+ return cls(**{f: data[f] for f in cls.__dataclass_fields__})
+
+ @property
+ def digest(self) -> str:
+ """A short file-name-safe hash of the key."""
+ return hashlib.sha256(json.dumps(self.to_dict(), sort_keys=True).encode()).hexdigest()[:16]
+
+
+def config_digest(model_path: str) -> str:
+ """Identify a model: the digest of its ``config.json`` and its path's last component (a Hub id or a local dir)."""
+ name = os.path.basename(os.path.normpath(model_path))
+ config = os.path.join(model_path, "config.json")
+ h = hashlib.sha256(name.encode())
+ if os.path.isfile(config):
+ with open(config, "rb") as f:
+ h.update(f.read())
+ else:
+ h.update(model_path.encode())
+ return f"{name}:{h.hexdigest()[:12]}"
+
+
+def write_key(data_path: str, key: CostKey) -> None:
+ """Record the setup a calibration directory was measured on."""
+ os.makedirs(data_path, exist_ok=True)
+ with open(os.path.join(data_path, KEY_FILE), "w", encoding="utf-8") as f:
+ json.dump(key.to_dict(), f, indent=2)
+
+
+def read_key(data_path: str) -> Optional[CostKey]:
+ """The key a calibration directory carries, None when it has none (tables measured before keys existed)."""
+ try:
+ with open(os.path.join(data_path, KEY_FILE), encoding="utf-8") as f:
+ return CostKey.from_dict(json.load(f))
+ except FileNotFoundError:
+ return None
+
+
+def check_key(data_path: str, key: CostKey) -> None:
+ """Refuse offline tables measured on another setup; warn on unkeyed ones."""
+ stored = read_key(data_path)
+ if stored is None:
+ logger.warning(
+ "Cost tables under %s carry no %s: they are assumed to be for %s. Calibrate again to key them.",
+ data_path,
+ KEY_FILE,
+ key,
+ )
+ return
+ if stored != key:
+ differing = {f: (getattr(stored, f), getattr(key, f)) for f in key.__dataclass_fields__ if getattr(stored, f) != getattr(key, f)}
+ raise ValueError(
+ f"Cost tables under {data_path} were measured on another setup (stored vs this server): {differing}. "
+ "Calibrate for this setup, or drop data_path to measure costs on the served rounds."
+ )
+
+
+# ------------------------------------------------------------------ live cells
+@dataclass
+class Cell:
+ """One timed shape: microseconds (min of the seed samples, then an EMA) and the sample count."""
+
+ us: float = 0.0
+ samples: int = 0
+
+
+DRAFT_WIDTH = 0 # cell width of the draft step (one tree level, top-k rows per request)
+
+
+@dataclass
+class LiveCosts:
+ """Round timings per (batch bucket, verify width, context interval), and the tables built from them.
+
+ ``widths(bucket)`` lists the verify widths with a graph at the bucket (what the seed sweep must time).
+ A bucket is *ready* once every width and the draft step have ``seed_samples``; until then
+ :meth:`seed_width` names the width the next round must force.
+ """
+
+ widths: Callable[[int], Sequence[int]]
+ key: Optional[CostKey] = None
+ draft_shape: Tuple[int, int] = (1, 1) # top-k and depth: the timed step's rows and tree-attention work
+ context_step: int = 1024
+ context_intervals: int = 16
+ seed_samples: int = 3
+ alpha: float = 0.05
+ cells: Dict[Tuple[int, int, int], Cell] = field(default_factory=dict) # (bucket, width, interval)
+
+ def interval(self, context: int) -> int:
+ """Context interval of an average committed length (the tables' ``interval_index``)."""
+ return min(max((context - self.context_step) // self.context_step, 0), self.context_intervals - 1)
+
+ def _samples(self, bucket: int, width: int) -> int:
+ return sum(c.samples for (b, w, _), c in self.cells.items() if b == bucket and w == width)
+
+ def seed_width(self, bucket: int) -> Optional[int]:
+ """The verify width the next round at ``bucket`` must force, None once the bucket is seeded.
+
+ Width 1 first (the trivial verify prices the target's floor), then the others widest first. The draft
+ step is timed in every seed round, so it is seeded with them.
+ """
+ for width in sorted(self.widths(bucket), key=lambda w: (w != 1, -w)):
+ if self._samples(bucket, width) < self.seed_samples:
+ return width
+ return None
+
+ def ready(self, bucket: int) -> bool:
+ """Whether the bucket's cells price every captured width and the draft step."""
+ return self.seed_width(bucket) is None and self._samples(bucket, DRAFT_WIDTH) >= self.seed_samples
+
+ def record(self, bucket: int, width: int, context: int, us: float) -> None:
+ """Add one served timing (``width`` 0: one draft step)."""
+ if not math.isfinite(us) or us <= 0:
+ return
+ cell = self.cells.setdefault((bucket, width, self.interval(context)), Cell())
+ if cell.samples < self.seed_samples:
+ cell.us = us if cell.samples == 0 else min(cell.us, us)
+ else:
+ cell.us += self.alpha * (us - cell.us)
+ cell.samples += 1
+
+ # ---------------------------------------------------------------- tables
+ def _value(self, bucket: int, width: int, interval: int) -> Optional[float]:
+ """The cell's cost, from the nearest measured interval when this one has no sample."""
+ for d in range(self.context_intervals):
+ for i in (interval - d, interval + d):
+ cell = self.cells.get((bucket, width, i))
+ if cell is not None and cell.samples:
+ return cell.us
+ return None
+
+ def tables(self) -> Dict[int, BatchCostTable]:
+ """One table per ready bucket (the cost model's input), from the current cells."""
+ tables: Dict[int, BatchCostTable] = {}
+ for bucket in sorted({b for b, _, _ in self.cells}):
+ if not self.ready(bucket):
+ continue
+ widths = sorted(self.widths(bucket))
+ intervals: List[IntervalCost] = []
+ ratios: List[float] = []
+ for i in range(self.context_intervals):
+ target = [self._value(bucket, w, i) or 0.0 for w in widths]
+ draft = self._value(bucket, DRAFT_WIDTH, i) or 0.0
+ intervals.append(IntervalCost(_curve(target, [w - 1 for w in widths]), _curve([draft], [0])))
+ ratios.append(round(target[0] / draft, 4))
+ tables[bucket] = BatchCostTable(
+ batch_size=bucket,
+ cache_length_start=self.context_step,
+ cache_length_step=self.context_step,
+ target_max_qo_len_query=widths[-1],
+ target_max_qo_len_cache=widths[-1],
+ draft_max_qo_len=1,
+ intervals=tuple(intervals),
+ model_ratio=tuple(ratios),
+ )
+ return tables
+
+ # ----------------------------------------------------------------- cache
+ def to_dict(self) -> dict:
+ """The cells and key as JSON data."""
+ return {
+ "key": None if self.key is None else self.key.to_dict(),
+ "draft_shape": list(self.draft_shape),
+ "context_step": self.context_step,
+ "context_intervals": self.context_intervals,
+ "cells": [[b, w, i, c.us, c.samples] for (b, w, i), c in sorted(self.cells.items())],
+ }
+
+ def save(self, path: str) -> None:
+ """Write the cells to ``path`` (atomically)."""
+ os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
+ tmp = f"{path}.tmp"
+ with open(tmp, "w", encoding="utf-8") as f:
+ json.dump(self.to_dict(), f)
+ os.replace(tmp, path)
+
+ def load(self, path: str) -> bool:
+ """Take the cells of a cache file whose key and grid match; False (nothing taken) otherwise."""
+ try:
+ with open(path, encoding="utf-8") as f:
+ data = json.load(f)
+ if not isinstance(data, dict):
+ raise ValueError("expected an object")
+ key = None if data.get("key") is None else CostKey.from_dict(data["key"])
+ if (
+ key != self.key or data.get("draft_shape") != list(self.draft_shape)
+ or (data["context_step"], data["context_intervals"]) != (self.context_step, self.context_intervals)
+ ):
+ logger.info("Live cost cache %s is for another setup; measuring again.", path)
+ return False
+ cells = {}
+ for b, w, i, us, n in data["cells"]:
+ if (
+ any(type(v) is not int for v in (b, w, i, n))
+ or b <= 0 or n <= 0 or not 0 <= i < self.context_intervals
+ or w not in (DRAFT_WIDTH, *self.widths(b))
+ or isinstance(us, bool) or not math.isfinite(us) or us <= 0
+ or (b, w, i) in cells
+ ):
+ raise ValueError("invalid or duplicate timing cell")
+ cells[b, w, i] = Cell(us, n)
+ except (OSError, ValueError, TypeError, KeyError) as e:
+ logger.info("Live cost cache %s is unavailable or invalid (%s); measuring again.", path, e)
+ return False
+ self.cells = cells
+ return True
+
+
+def _curve(values: Sequence[float], index: Sequence[int]) -> CostCurve:
+ base = values[0]
+ return CostCurve(
+ value=tuple(values),
+ ratio=tuple(round(v / base, 4) for v in values),
+ index=tuple(index),
+ array_query=(),
+ array_cache=(),
+ )
diff --git a/eagle_harness/core/models.py b/eagle_harness/core/models.py
new file mode 100644
index 0000000..39d3808
--- /dev/null
+++ b/eagle_harness/core/models.py
@@ -0,0 +1,10 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Target model properties shared by engine cost policies."""
+
+
+def target_is_moe(hf_config: object) -> bool:
+ """Detect routed experts from the text model's config, without architecture-name heuristics."""
+ config = getattr(hf_config, "text_config", None) or hf_config
+ return any((getattr(config, name, 0) or 0) > 0 for name in ("num_experts", "num_local_experts", "n_routed_experts"))
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/README.md b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/README.md
new file mode 100644
index 0000000..915eebc
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/README.md
@@ -0,0 +1,25 @@
+# MI355X Qwen3.8-27B TP1 serving costs
+
+SGLang selects this packaged profile when `data_path` is omitted, on an
+AMD Instinct MI355X (including VF), BF16, TP1, with the measured target and
+draft checkpoint configurations. Selection compares parsed local `config.json`
+content with `target_config.json` and `draft_config.json`; directory names do not
+matter. Other devices, unresolved Hub paths, different model configurations,
+quantization and other TP sizes do not select these costs. An explicit
+`data_path` always takes precedence. No environment variable selects the profile.
+
+The batch-1 curves, GEMM solutions and candidate-top-k choices are unchanged
+from the measured single-request configuration. Batch 8 and 32 add served-round
+measurements at verify widths 1, 8, 16 and 32. Outer verify timing includes
+host-induced gaps; draft timing includes the graph-replayed tree step. Those
+batch-specific costs prevent high-batch rounds from being priced as batch one.
+
+The high-batch tables contain one measured context interval. Longer contexts
+use the cost loader's existing clamping behavior; this is not calibration of
+every context or batch size. Unmeasured batch sizes use its existing nearest
+batch selection. Recalibrate when the model, device or execution costs change.
+
+Measurements used rounded BF16 recurrence and disabled HIP prelaunch on MI355X,
+with SGLang's ROCm tree-verification backend. The runtime and cost model are not
+replaced by this profile. Model configuration files describe the measured
+checkpoint pair; this directory contains no model weights.
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/candidate_topk.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/candidate_topk.json
new file mode 100644
index 0000000..a29af85
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/candidate_topk.json
@@ -0,0 +1,269 @@
+{
+ "identity": {
+ "device": "AMD Instinct MI355X VF",
+ "torch": "2.9.1+rocm7.2.0.git7e1940d4",
+ "triton": "3.7.0",
+ "dtype": "torch.bfloat16",
+ "vocab_size": 248320,
+ "num_candidates": 128
+ },
+ "max_triton_elements": 63569920,
+ "measurements": [
+ {
+ "rows": 1,
+ "elements": 248320,
+ "torch_us": 79.20100167393684,
+ "triton_us": 33.460499718785286,
+ "samples_us": {
+ "torch": [
+ 80.40100336074829,
+ 79.28100228309631,
+ 80.64199984073639,
+ 78.92099767923355,
+ 79.52100038528442,
+ 77.04100012779236,
+ 78.44199985265732,
+ 79.56100255250931,
+ 78.44100147485733,
+ 79.12100106477737
+ ],
+ "triton": [
+ 34.52000021934509,
+ 33.799998462200165,
+ 31.640999019145966,
+ 33.76099839806557,
+ 31.560000032186508,
+ 34.07999873161316,
+ 31.76100179553032,
+ 33.96100178360939,
+ 31.679999083280563,
+ 33.160001039505005
+ ]
+ }
+ },
+ {
+ "rows": 4,
+ "elements": 993280,
+ "torch_us": 73.52099940180779,
+ "triton_us": 33.53999927639961,
+ "samples_us": {
+ "torch": [
+ 74.2809996008873,
+ 74.0009993314743,
+ 74.2809996008873,
+ 73.08100163936615,
+ 73.32099974155426,
+ 73.92100244760513,
+ 73.64100217819214,
+ 73.40099662542343,
+ 73.24200123548508,
+ 73.16099852323532
+ ],
+ "triton": [
+ 33.560000360012054,
+ 33.319998532533646,
+ 34.32000055909157,
+ 33.681001514196396,
+ 35.40100157260895,
+ 33.72099995613098,
+ 31.3199982047081,
+ 33.51999819278717,
+ 30.561000108718872,
+ 30.719999223947525
+ ]
+ }
+ },
+ {
+ "rows": 8,
+ "elements": 1986560,
+ "torch_us": 91.42199903726578,
+ "triton_us": 33.14049914479256,
+ "samples_us": {
+ "torch": [
+ 90.84100276231766,
+ 91.5210023522377,
+ 92.36100316047668,
+ 91.44199639558792,
+ 92.12200343608856,
+ 91.68200194835663,
+ 91.40200167894363,
+ 90.72200208902359,
+ 90.6819999217987,
+ 91.04199707508087
+ ],
+ "triton": [
+ 34.040000289678574,
+ 33.19999948143959,
+ 33.52100029587746,
+ 32.76100009679794,
+ 34.320998936891556,
+ 33.20100158452988,
+ 31.68100118637085,
+ 33.08099880814552,
+ 31.801000237464905,
+ 31.84099867939949
+ ]
+ }
+ },
+ {
+ "rows": 16,
+ "elements": 3973120,
+ "torch_us": 97.80149906873703,
+ "triton_us": 40.96050001680851,
+ "samples_us": {
+ "torch": [
+ 97.96100109815598,
+ 97.88099676370621,
+ 98.60099852085114,
+ 98.04199635982513,
+ 97.52199798822403,
+ 97.72200137376785,
+ 97.96100109815598,
+ 97.6409986615181,
+ 97.36199676990509,
+ 96.76200151443481
+ ],
+ "triton": [
+ 41.76099970936775,
+ 41.04100167751312,
+ 40.8799983561039,
+ 41.200000792741776,
+ 40.76100140810013,
+ 40.081001818180084,
+ 41.200000792741776,
+ 40.800001472234726,
+ 40.36099836230278,
+ 41.96099936962128
+ ]
+ }
+ },
+ {
+ "rows": 32,
+ "elements": 7946240,
+ "torch_us": 103.76150161027908,
+ "triton_us": 54.80100028216839,
+ "samples_us": {
+ "torch": [
+ 104.68199849128723,
+ 102.84200310707092,
+ 103.80200296640396,
+ 103.12200337648392,
+ 104.68199849128723,
+ 105.12199997901917,
+ 104.2810007929802,
+ 103.44099998474121,
+ 103.7210002541542,
+ 102.72099822759628
+ ],
+ "triton": [
+ 55.76099827885628,
+ 59.04100090265274,
+ 54.56100031733513,
+ 54.96099963784218,
+ 54.6410009264946,
+ 54.281000047922134,
+ 54.4000007212162,
+ 58.56100097298622,
+ 53.640998899936676,
+ 55.4409995675087
+ ]
+ }
+ },
+ {
+ "rows": 64,
+ "elements": 15892480,
+ "torch_us": 143.32249760627747,
+ "triton_us": 79.92099970579147,
+ "samples_us": {
+ "torch": [
+ 143.2819962501526,
+ 143.68200302124023,
+ 145.04200220108032,
+ 144.2819982767105,
+ 142.643004655838,
+ 144.12200450897217,
+ 143.12200248241425,
+ 143.36299896240234,
+ 141.96200668811798,
+ 142.24199950695038
+ ],
+ "triton": [
+ 80.72199672460556,
+ 81.48100227117538,
+ 80.00099658966064,
+ 80.68100363016129,
+ 79.8410028219223,
+ 80.68100363016129,
+ 78.64099740982056,
+ 79.20099794864655,
+ 78.60100269317627,
+ 78.2409980893135
+ ]
+ }
+ },
+ {
+ "rows": 128,
+ "elements": 31784960,
+ "torch_us": 225.98300129175186,
+ "triton_us": 131.64199888706207,
+ "samples_us": {
+ "torch": [
+ 227.44299471378326,
+ 226.282998919487,
+ 227.0829975605011,
+ 225.04399716854095,
+ 227.16400027275085,
+ 226.36400163173676,
+ 225.68300366401672,
+ 223.68299961090088,
+ 224.1629958152771,
+ 223.68299961090088
+ ],
+ "triton": [
+ 131.88199698925018,
+ 132.68199563026428,
+ 132.9219937324524,
+ 133.84200632572174,
+ 135.0419968366623,
+ 131.40200078487396,
+ 130.0020068883896,
+ 129.76199388504028,
+ 129.52199578285217,
+ 130.60200214385986
+ ]
+ }
+ },
+ {
+ "rows": 256,
+ "elements": 63569920,
+ "torch_us": 397.0860093832016,
+ "triton_us": 227.4240031838417,
+ "samples_us": {
+ "torch": [
+ 402.24599838256836,
+ 398.00599217414856,
+ 398.4059989452362,
+ 396.6059982776642,
+ 398.3660042285919,
+ 396.72601222991943,
+ 397.44600653648376,
+ 396.3260054588318,
+ 392.3659920692444,
+ 395.5259919166565
+ ],
+ "triton": [
+ 232.80300199985504,
+ 232.683002948761,
+ 231.44300282001495,
+ 229.9630045890808,
+ 227.2839993238449,
+ 227.5640070438385,
+ 226.0430008172989,
+ 224.6430069208145,
+ 223.00399839878082,
+ 223.1229990720749
+ ]
+ }
+ }
+ ]
+}
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_0.json
new file mode 100644
index 0000000..d7545ed
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_0.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 0.381,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.2235,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.8385,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 19.22
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 24.2087,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 25.8228,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 50.4462
+ ],
+ "array": [
+ 0.381,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.2235,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.8385,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 19.22
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_1.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_1.json
new file mode 100644
index 0000000..d4a5eeb
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_1.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 3.0015,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 55.855,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 48.5265,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 48.896
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 18.609,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 16.1674,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 16.2905
+ ],
+ "array": [
+ 3.0015,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 55.855,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 48.5265,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 48.896
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_2.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_2.json
new file mode 100644
index 0000000..bd19262
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_2.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 5.948,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 84.349,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 85.8305,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 83.339
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.1811,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.4301,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.0113
+ ],
+ "array": [
+ 5.948,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 84.349,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 85.8305,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 83.339
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_3.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_3.json
new file mode 100644
index 0000000..ca5a13f
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_3.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 8.7435,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 121.943,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 123.064,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 123.631
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 13.9467,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.0749,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.1398
+ ],
+ "array": [
+ 8.7435,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 121.943,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 123.064,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 123.631
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_4.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_4.json
new file mode 100644
index 0000000..88af7cd
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_4.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 11.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 159.7215,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 160.552,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 159.516
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.5201,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.5956,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.5015
+ ],
+ "array": [
+ 11.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 159.7215,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 160.552,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 159.516
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_5.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_5.json
new file mode 100644
index 0000000..95e6e49
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_5.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 13.3965,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 197.224,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 198.907,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 204.393
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.7221,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.8477,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 15.2572
+ ],
+ "array": [
+ 13.3965,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 197.224,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 198.907,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 204.393
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_6.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_6.json
new file mode 100644
index 0000000..c7d3b8c
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_llm/cache_interval_6.json
@@ -0,0 +1,144 @@
+{
+ "value": [
+ 16.341,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 234.381,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 235.9505,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 235.376
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.3431,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.4392,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 14.404
+ ],
+ "array": [
+ 16.341,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 234.381,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 235.9505,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 235.376
+ ],
+ "batch_size": 1,
+ "max_query_length": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_0.json
new file mode 100644
index 0000000..4847b4e
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_0.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 1.12,
+ 0.2005,
+ 0.0,
+ 0.485,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.001
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.179,
+ 0.0,
+ 0.433,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0009
+ ],
+ "array": [
+ 1.12,
+ 0.2005,
+ 0.0,
+ 0.485,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.001
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_1.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_1.json
new file mode 100644
index 0000000..911708f
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_1.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 4.879,
+ 1.09,
+ 0.0,
+ 1.5395,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.679
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.2234,
+ 0.0,
+ 0.3155,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.3441
+ ],
+ "array": [
+ 4.879,
+ 1.09,
+ 0.0,
+ 1.5395,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.679
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_2.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_2.json
new file mode 100644
index 0000000..5eaa94f
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_2.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 8.7995,
+ 2.36,
+ 0.0,
+ 3.244,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3.549
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.2682,
+ 0.0,
+ 0.3687,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.4033
+ ],
+ "array": [
+ 8.7995,
+ 2.36,
+ 0.0,
+ 3.244,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3.549
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_3.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_3.json
new file mode 100644
index 0000000..8a8d7c0
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_3.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 14.809,
+ 5.67,
+ 0.0,
+ 5.829,
+ 0.0,
+ 0.0,
+ 0.0,
+ 5.609
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.3829,
+ 0.0,
+ 0.3936,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.3788
+ ],
+ "array": [
+ 14.809,
+ 5.67,
+ 0.0,
+ 5.829,
+ 0.0,
+ 0.0,
+ 0.0,
+ 5.609
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_4.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_4.json
new file mode 100644
index 0000000..d2948c5
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_4.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 20.159,
+ 7.4295,
+ 0.0,
+ 6.955,
+ 0.0,
+ 0.0,
+ 0.0,
+ 6.9995
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.3685,
+ 0.0,
+ 0.345,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.3472
+ ],
+ "array": [
+ 20.159,
+ 7.4295,
+ 0.0,
+ 6.955,
+ 0.0,
+ 0.0,
+ 0.0,
+ 6.9995
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_5.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_5.json
new file mode 100644
index 0000000..80b651a
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_5.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 25.159,
+ 9.78,
+ 0.0,
+ 8.4895,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.069
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.3887,
+ 0.0,
+ 0.3374,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.3605
+ ],
+ "array": [
+ 25.159,
+ 9.78,
+ 0.0,
+ 8.4895,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.069
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_6.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_6.json
new file mode 100644
index 0000000..7bd1060
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/cache_slm/cache_interval_6.json
@@ -0,0 +1,48 @@
+{
+ "value": [
+ 31.4595,
+ 10.57,
+ 0.0,
+ 9.805,
+ 0.0,
+ 0.0,
+ 0.0,
+ 10.6795
+ ],
+ "index": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.336,
+ 0.0,
+ 0.3117,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.3395
+ ],
+ "array": [
+ 31.4595,
+ 10.57,
+ 0.0,
+ 9.805,
+ 0.0,
+ 0.0,
+ 0.0,
+ 10.6795
+ ],
+ "batch_size": 1,
+ "max_query_length": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_length_stop": 4096,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_0.json
new file mode 100644
index 0000000..2d11546
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_0.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 11988.5583,
+ 14332.9524,
+ 15497.9119,
+ 17023.4294
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.1956,
+ 1.2927,
+ 1.42
+ ],
+ "array_model": [
+ 11988.5583,
+ 14332.9524,
+ 15497.9119,
+ 17023.4294
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 6.096,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 147.576,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 157.416,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 307.52
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_1.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_1.json
new file mode 100644
index 0000000..bfb8a40
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_1.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 12030.4863,
+ 15079.0564,
+ 16116.9199,
+ 17498.2454
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.2534,
+ 1.3397,
+ 1.4545
+ ],
+ "array_model": [
+ 12030.4863,
+ 15079.0564,
+ 16116.9199,
+ 17498.2454
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 48.024,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 893.68,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 776.424,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 782.336
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_2.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_2.json
new file mode 100644
index 0000000..439fe63
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_2.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 12077.6303,
+ 15534.9604,
+ 16713.7839,
+ 18049.3334
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.2863,
+ 1.3839,
+ 1.4944
+ ],
+ "array_model": [
+ 12077.6303,
+ 15534.9604,
+ 16713.7839,
+ 18049.3334
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 95.168,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1349.584,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1373.288,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1333.424
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_3.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_3.json
new file mode 100644
index 0000000..6e57811
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_3.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 12122.3583,
+ 16136.4644,
+ 17309.5199,
+ 18694.0054
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.3311,
+ 1.4279,
+ 1.5421
+ ],
+ "array_model": [
+ 12122.3583,
+ 16136.4644,
+ 17309.5199,
+ 18694.0054
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 139.896,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1951.088,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1969.024,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1978.096
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_4.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_4.json
new file mode 100644
index 0000000..e7e7d1c
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_4.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 12158.4623,
+ 16740.9204,
+ 17909.3279,
+ 19268.1654
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.3769,
+ 1.473,
+ 1.5848
+ ],
+ "array_model": [
+ 12158.4623,
+ 16740.9204,
+ 17909.3279,
+ 19268.1654
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 176.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 2555.544,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 2568.832,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 2552.256
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_5.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_5.json
new file mode 100644
index 0000000..47a0855
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_5.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 12196.8063,
+ 17340.9604,
+ 18523.0079,
+ 19986.1974
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.4218,
+ 1.5187,
+ 1.6386
+ ],
+ "array_model": [
+ 12196.8063,
+ 17340.9604,
+ 18523.0079,
+ 19986.1974
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 214.344,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3155.584,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3182.512,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3270.288
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_6.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_6.json
new file mode 100644
index 0000000..5cfdd8e
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_llm/model_interval_6.json
@@ -0,0 +1,74 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 12243.9183,
+ 17935.4724,
+ 19115.7039,
+ 20481.9254
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "ratio": [
+ 1.0,
+ 1.4648,
+ 1.5612,
+ 1.6728
+ ],
+ "array_model": [
+ 12243.9183,
+ 17935.4724,
+ 19115.7039,
+ 20481.9254
+ ],
+ "array_query": [
+ 11982.4623,
+ 14185.3764,
+ 15340.4959,
+ 16715.9094
+ ],
+ "array_cache": [
+ 261.456,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3750.096,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3775.208,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3766.016
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 16,
+ "instability_rate": 0.18
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_0.json
new file mode 100644
index 0000000..ae02613
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_0.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 347.5724,
+ 348.9681,
+ 320.0985,
+ 346.0923
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 1.004,
+ 0.921,
+ 0.9957
+ ],
+ "array_model": [
+ 347.5724,
+ 348.9681,
+ 320.0985,
+ 346.0923
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 1.12,
+ 0.2005,
+ 0.0,
+ 0.485,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.001
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_1.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_1.json
new file mode 100644
index 0000000..d95e4ef
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_1.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 351.3314,
+ 349.8576,
+ 321.153,
+ 347.7703
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.9958,
+ 0.9141,
+ 0.9899
+ ],
+ "array_model": [
+ 351.3314,
+ 349.8576,
+ 321.153,
+ 347.7703
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 4.879,
+ 1.09,
+ 0.0,
+ 1.5395,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.679
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_2.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_2.json
new file mode 100644
index 0000000..5663ca7
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_2.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 355.2519,
+ 351.1276,
+ 322.8575,
+ 349.6403
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.9884,
+ 0.9088,
+ 0.9842
+ ],
+ "array_model": [
+ 355.2519,
+ 351.1276,
+ 322.8575,
+ 349.6403
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 8.7995,
+ 2.36,
+ 0.0,
+ 3.244,
+ 0.0,
+ 0.0,
+ 0.0,
+ 3.549
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_3.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_3.json
new file mode 100644
index 0000000..c93fd3f
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_3.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 361.2614,
+ 354.4376,
+ 325.4425,
+ 351.7003
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.9811,
+ 0.9009,
+ 0.9735
+ ],
+ "array_model": [
+ 361.2614,
+ 354.4376,
+ 325.4425,
+ 351.7003
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 14.809,
+ 5.67,
+ 0.0,
+ 5.829,
+ 0.0,
+ 0.0,
+ 0.0,
+ 5.609
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_4.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_4.json
new file mode 100644
index 0000000..f7e1a05
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_4.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 366.6114,
+ 356.1971,
+ 326.5685,
+ 353.0908
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.9716,
+ 0.8908,
+ 0.9631
+ ],
+ "array_model": [
+ 366.6114,
+ 356.1971,
+ 326.5685,
+ 353.0908
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 20.159,
+ 7.4295,
+ 0.0,
+ 6.955,
+ 0.0,
+ 0.0,
+ 0.0,
+ 6.9995
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_5.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_5.json
new file mode 100644
index 0000000..109a3ac
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_5.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 371.6114,
+ 358.5476,
+ 328.103,
+ 355.1603
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.9648,
+ 0.8829,
+ 0.9557
+ ],
+ "array_model": [
+ 371.6114,
+ 358.5476,
+ 328.103,
+ 355.1603
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 25.159,
+ 9.78,
+ 0.0,
+ 8.4895,
+ 0.0,
+ 0.0,
+ 0.0,
+ 9.069
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_6.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_6.json
new file mode 100644
index 0000000..8b6bc20
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/model_slm/model_interval_6.json
@@ -0,0 +1,50 @@
+{
+ "notes": "Estimated model_cost = query_cost + cache_cost",
+ "value": [
+ 377.9119,
+ 359.3376,
+ 329.4185,
+ 356.7708
+ ],
+ "index": [
+ 0,
+ 1,
+ 3,
+ 7
+ ],
+ "ratio": [
+ 1.0,
+ 0.9509,
+ 0.8717,
+ 0.9441
+ ],
+ "array_model": [
+ 377.9119,
+ 359.3376,
+ 329.4185,
+ 356.7708
+ ],
+ "array_query": [
+ 346.4524,
+ 348.7676,
+ 319.6135,
+ 346.0913
+ ],
+ "array_cache": [
+ 31.4595,
+ 10.57,
+ 0.0,
+ 9.805,
+ 0.0,
+ 0.0,
+ 0.0,
+ 10.6795
+ ],
+ "batch_size": 1,
+ "max_query_length_query": 8,
+ "max_query_length_cache": 8,
+ "cache_length_start": 512,
+ "cache_length_step": 512,
+ "cache_layers_num": 1,
+ "instability_rate": 0.25
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_1.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_1.json
new file mode 100644
index 0000000..aa85f20
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_1.json
@@ -0,0 +1,21 @@
+{
+ "mean": 11982.4623,
+ "array": [
+ 11976.36,
+ 11988.54,
+ 11977.653,
+ 11987.272,
+ 11977.429,
+ 11987.506,
+ 11978.701,
+ 11986.239,
+ 11978.377,
+ 11986.539,
+ 11976.435,
+ 11988.495,
+ 11977.023,
+ 11987.903
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_16.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_16.json
new file mode 100644
index 0000000..ce58faf
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_16.json
@@ -0,0 +1,21 @@
+{
+ "mean": 15340.4959,
+ "array": [
+ 15183.074,
+ 15497.899,
+ 15209.713,
+ 15471.295,
+ 15208.955,
+ 15472.039,
+ 15216.448,
+ 15464.55,
+ 15207.724,
+ 15473.267,
+ 15199.292,
+ 15481.695,
+ 15203.845,
+ 15477.147
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_32.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_32.json
new file mode 100644
index 0000000..c66069a
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_32.json
@@ -0,0 +1,21 @@
+{
+ "mean": 16715.9094,
+ "array": [
+ 16430.348,
+ 16737.872,
+ 16621.421,
+ 16854.323,
+ 16614.459,
+ 16861.303,
+ 16615.315,
+ 16860.44,
+ 16591.244,
+ 16884.506,
+ 16527.279,
+ 16948.464,
+ 16598.739,
+ 16877.018
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_8.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_8.json
new file mode 100644
index 0000000..5fe8fab
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_llm/query_8.json
@@ -0,0 +1,21 @@
+{
+ "mean": 14185.3764,
+ "array": [
+ 14058.884,
+ 14354.028,
+ 13911.226,
+ 14206.47,
+ 14055.87,
+ 14357.054,
+ 14058.175,
+ 14354.756,
+ 14051.323,
+ 14361.608,
+ 14062.229,
+ 14350.714,
+ 14058.705,
+ 14354.228
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_1.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_1.json
new file mode 100644
index 0000000..97e5748
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_1.json
@@ -0,0 +1,21 @@
+{
+ "mean": 346.4524,
+ "array": [
+ 345.523,
+ 347.763,
+ 343.963,
+ 346.644,
+ 346.5635,
+ 346.7245,
+ 345.314,
+ 347.974,
+ 344.504,
+ 348.784,
+ 345.424,
+ 347.864,
+ 344.8635,
+ 348.4245
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_2.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_2.json
new file mode 100644
index 0000000..e70d692
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_2.json
@@ -0,0 +1,21 @@
+{
+ "mean": 348.7676,
+ "array": [
+ 348.4025,
+ 348.8035,
+ 348.493,
+ 348.713,
+ 348.603,
+ 350.904,
+ 347.973,
+ 349.234,
+ 348.1345,
+ 349.0735,
+ 348.684,
+ 348.523,
+ 348.273,
+ 348.933
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_4.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_4.json
new file mode 100644
index 0000000..ff9b9f3
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_4.json
@@ -0,0 +1,21 @@
+{
+ "mean": 319.6135,
+ "array": [
+ 320.098,
+ 319.128,
+ 319.7845,
+ 319.4435,
+ 319.739,
+ 319.489,
+ 319.034,
+ 320.194,
+ 319.188,
+ 320.038,
+ 319.1135,
+ 320.1135,
+ 319.468,
+ 319.758
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_8.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_8.json
new file mode 100644
index 0000000..0468691
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_1/query_slm/query_8.json
@@ -0,0 +1,21 @@
+{
+ "mean": 346.0913,
+ "array": [
+ 347.483,
+ 345.983,
+ 345.184,
+ 346.784,
+ 345.634,
+ 346.335,
+ 346.334,
+ 345.635,
+ 346.6445,
+ 345.3235,
+ 345.915,
+ 346.054,
+ 345.5645,
+ 346.4045
+ ],
+ "batch_size": 1,
+ "instability_rate": 0.0
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_32/model_llm/model_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_32/model_llm/model_interval_0.json
new file mode 100644
index 0000000..98ae8c8
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_32/model_llm/model_interval_0.json
@@ -0,0 +1,26 @@
+{
+ "value": [
+ 15520.217895507812,
+ 29090.22331237793,
+ 45592.04864501953,
+ 76129.57763671875
+ ],
+ "ratio": [
+ 1.0,
+ 1.8743437436402122,
+ 2.937590757550881,
+ 4.905187423866889
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "array_query": [],
+ "array_cache": [],
+ "cache_length_start": 1024,
+ "cache_length_step": 1024,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_32/model_slm/model_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_32/model_slm/model_interval_0.json
new file mode 100644
index 0000000..468c04e
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_32/model_slm/model_interval_0.json
@@ -0,0 +1,17 @@
+{
+ "value": [
+ 1171.4680194854736
+ ],
+ "ratio": [
+ 1.0
+ ],
+ "index": [
+ 0
+ ],
+ "array_query": [],
+ "array_cache": [],
+ "cache_length_start": 1024,
+ "cache_length_step": 1024,
+ "max_query_length_query": 1,
+ "max_query_length_cache": 1
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_8/model_llm/model_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_8/model_llm/model_interval_0.json
new file mode 100644
index 0000000..c8d46bb
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_8/model_llm/model_interval_0.json
@@ -0,0 +1,26 @@
+{
+ "value": [
+ 12670.48454284668,
+ 15917.144775390625,
+ 20503.217697143555,
+ 28648.232460021973
+ ],
+ "ratio": [
+ 1.0,
+ 1.2562380484791245,
+ 1.618187341439832,
+ 2.2610210653858362
+ ],
+ "index": [
+ 0,
+ 7,
+ 15,
+ 31
+ ],
+ "array_query": [],
+ "array_cache": [],
+ "cache_length_start": 1024,
+ "cache_length_step": 1024,
+ "max_query_length_query": 32,
+ "max_query_length_cache": 32
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_8/model_slm/model_interval_0.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_8/model_slm/model_interval_0.json
new file mode 100644
index 0000000..5517254
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/cost/bs_8/model_slm/model_interval_0.json
@@ -0,0 +1,17 @@
+{
+ "value": [
+ 476.5229970216751
+ ],
+ "ratio": [
+ 1.0
+ ],
+ "index": [
+ 0
+ ],
+ "array_query": [],
+ "array_cache": [],
+ "cache_length_start": 1024,
+ "cache_length_step": 1024,
+ "max_query_length_query": 1,
+ "max_query_length_cache": 1
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/draft_config.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/draft_config.json
new file mode 100644
index 0000000..29dab0b
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/draft_config.json
@@ -0,0 +1,57 @@
+{
+ "_torchspec_version": "0.1.0",
+ "architectures": [
+ "LlamaForCausalLMEagle4"
+ ],
+ "attention_bias": false,
+ "attention_dropout": 0.0,
+ "bos_token_id": 248044,
+ "draft_vocab_size": 248320,
+ "dtype": "bfloat16",
+ "eagle_config": {
+ "eagle_aux_hidden_state_layer_ids": [
+ 3,
+ 31,
+ 59
+ ],
+ "use_aux_hidden_state": true
+ },
+ "efficient_lm_head_config": {
+ "num_candidates": 128,
+ "rank": 128,
+ "type": "low_rank"
+ },
+ "eos_token_id": 248044,
+ "fc_norm": true,
+ "head_dim": 128,
+ "hidden_act": "silu",
+ "hidden_size": 5120,
+ "initializer_range": 0.02,
+ "intermediate_size": 16384,
+ "layer_types": [
+ "sliding_attention"
+ ],
+ "max_position_embeddings": 262144,
+ "mlp_bias": false,
+ "model_type": "llama",
+ "norm_output": true,
+ "num_attention_heads": 40,
+ "num_aux_hidden_states": 3,
+ "num_hidden_layers": 1,
+ "num_key_value_heads": 40,
+ "pad_token_id": 248044,
+ "pretraining_tp": 1,
+ "rms_norm_eps": 1e-06,
+ "rope_parameters": {
+ "rope_theta": 10000000.0,
+ "rope_type": "default"
+ },
+ "sliding_window": 4096,
+ "target_hidden_size": 5120,
+ "tie_word_embeddings": false,
+ "transformers_version": "5.8.1",
+ "use_cache": true,
+ "use_sliding_window": true,
+ "vocab_size": 248320,
+ "torch_dtype": "bfloat16"
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/gemm_solutions.csv b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/gemm_solutions.csv
new file mode 100644
index 0000000..a54ffdf
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/gemm_solutions.csv
@@ -0,0 +1,62 @@
+Validator,PT_VERSION,2.9.1
+Validator,HIP_VERSION,702
+Validator,HIPBLASLT_VERSION,100201-5b515cf1bc
+Validator,GCN_ARCH_NAME,gfx950:sramecc+:xnack-
+Validator,ROCBLAS_VERSION,5.2.0.5b515cf1bc
+GemmTunableOp_BFloat16_TN,tn_5120_58_16384_ld_16384_16384_5120,Gemm_Hipblaslt_438793,0.0374471
+GemmTunableOp_BFloat16_TN,tn_15360_58_10240_ld_10240_10240_15360,Gemm_Hipblaslt_439637,0.0572219
+GemmTunableOp_BFloat16_TN,tn_14336_58_5120_ld_5120_5120_14336,Gemm_Rocblas_439668,0.0331843
+GemmTunableOp_BFloat16_TN,tn_5120_58_17408_ld_17408_17408_5120,Gemm_Hipblaslt_438692,0.0397017
+GemmTunableOp_BFloat16_TN,tn_34816_58_5120_ld_5120_5120_34816,Gemm_Hipblaslt_439632,0.0638219
+GemmTunableOp_BFloat16_TN,tn_5120_58_6144_ld_6144_6144_5120,Gemm_Hipblaslt_438413,0.0219295
+GemmTunableOp_BFloat16_TN,tn_16480_58_5120_ld_5120_5120_16480,Gemm_Rocblas_438693,0.0378177
+GemmTunableOp_BFloat16_TN,tn_5120_58_15360_ld_15360_15360_5120,Gemm_Hipblaslt_438692,0.036319
+GemmTunableOp_BFloat16_TN,tn_5120_1_16384_ld_16384_16384_5120,Gemm_Hipblaslt_439084,0.0326337
+GemmTunableOp_BFloat16_TN,tn_15360_8_10240_ld_10240_10240_15360,Gemm_Hipblaslt_438653,0.0532618
+GemmTunableOp_BFloat16_TN,tn_5120_8_15360_ld_15360_15360_5120,Gemm_Hipblaslt_439068,0.0324057
+GemmTunableOp_BFloat16_TN,tn_32768_16_5120_ld_5120_5120_32768,Gemm_Rocblas_439676,0.0529858
+GemmTunableOp_BFloat16_TN,tn_5120_1_15360_ld_15360_15360_5120,Gemm_Hipblaslt_439084,0.031399
+GemmTunableOp_BFloat16_TN,tn_15360_16_10240_ld_10240_10240_15360,Gemm_Hipblaslt_438653,0.0532711
+GemmTunableOp_BFloat16_TN,tn_32768_58_5120_ld_5120_5120_32768,Gemm_Rocblas_439638,0.0563792
+GemmTunableOp_BFloat16_TN,tn_5120_16_16384_ld_16384_16384_5120,Gemm_Hipblaslt_438689,0.0339457
+GemmTunableOp_BFloat16_TN,tn_5120_16_15360_ld_15360_15360_5120,Gemm_Hipblaslt_439068,0.0326443
+GemmTunableOp_BFloat16_TN,tn_128_1_5120_ld_5120_5120_128,Gemm_Hipblaslt_440214,0.0107161
+GemmTunableOp_BFloat16_TN,tn_5120_32_16384_ld_16384_16384_5120,Gemm_Hipblaslt_438689,0.034915
+GemmTunableOp_BFloat16_TN,tn_15360_32_10240_ld_10240_10240_15360,Gemm_Hipblaslt_439637,0.0550512
+GemmTunableOp_BFloat16_TN,tn_5120_32_15360_ld_15360_15360_5120,Gemm_Hipblaslt_439638,0.033559
+GemmTunableOp_BFloat16_TN,tn_34816_16_5120_ld_5120_5120_34816,Gemm_Hipblaslt_439633,0.0586059
+GemmTunableOp_BFloat16_TN,tn_5120_1_6144_ld_6144_6144_5120,Gemm_Hipblaslt_438958,0.0172148
+GemmTunableOp_BFloat16_TN,tn_14336_16_5120_ld_5120_5120_14336,Gemm_Hipblaslt_439068,0.0279336
+GemmTunableOp_BFloat16_TN,tn_5120_16_17408_ld_17408_17408_5120,Gemm_Hipblaslt_439638,0.0351644
+GemmTunableOp_BFloat16_TN,tn_248320_1_128_ld_128_128_248320,Default,0.0154961
+GemmTunableOp_BFloat16_TN,tn_5120_32_6144_ld_6144_6144_5120,Gemm_Hipblaslt_439077,0.0190695
+GemmTunableOp_BFloat16_TN,tn_5120_16_6144_ld_6144_6144_5120,Gemm_Hipblaslt_438689,0.0186988
+GemmTunableOp_BFloat16_TN,tn_16480_32_5120_ld_5120_5120_16480,Gemm_Rocblas_438693,0.0361496
+GemmTunableOp_BFloat16_TN,tn_128_4_5120_ld_5120_5120_128,Gemm_Hipblaslt_440197,0.0109774
+GemmTunableOp_BFloat16_TN,tn_5120_32_17408_ld_17408_17408_5120,Gemm_Hipblaslt_439638,0.0357924
+GemmTunableOp_BFloat16_TN,tn_32768_1_5120_ld_5120_5120_32768,Gemm_Rocblas_438482,0.0527245
+GemmTunableOp_BFloat16_TN,tn_248320_16_5120_ld_5120_5120_248320,Gemm_Hipblaslt_438454,0.374977
+GemmTunableOp_BFloat16_TN,tn_16480_8_5120_ld_5120_5120_16480,Gemm_Hipblaslt_439085,0.033951
+GemmTunableOp_BFloat16_TN,tn_15360_1_10240_ld_10240_10240_15360,Gemm_Hipblaslt_439674,0.0528591
+GemmTunableOp_BFloat16_TN,tn_248320_32_5120_ld_5120_5120_248320,Gemm_Rocblas_439338,0.374036
+GemmTunableOp_BFloat16_TN,tn_5120_8_6144_ld_6144_6144_5120,Gemm_Hipblaslt_439084,0.0174148
+GemmTunableOp_BFloat16_TN,tn_248320_1_5120_ld_5120_5120_248320,Gemm_Rocblas_438958,0.354948
+GemmTunableOp_BFloat16_TN,tn_5120_4_16384_ld_16384_16384_5120,Gemm_Hipblaslt_439084,0.0325749
+GemmTunableOp_BFloat16_TN,tn_5120_8_17408_ld_17408_17408_5120,Gemm_Hipblaslt_439638,0.0351816
+GemmTunableOp_BFloat16_TN,tn_14336_32_5120_ld_5120_5120_14336,Gemm_Rocblas_438415,0.0296109
+GemmTunableOp_BFloat16_TN,tn_34816_32_5120_ld_5120_5120_34816,Gemm_Hipblaslt_439633,0.0597791
+GemmTunableOp_BFloat16_TN,tn_34816_8_5120_ld_5120_5120_34816,Gemm_Rocblas_439634,0.0578045
+GemmTunableOp_BFloat16_TN,tn_34816_1_5120_ld_5120_5120_34816,Gemm_Rocblas_439634,0.0577338
+GemmTunableOp_BFloat16_TN,tn_14336_1_5120_ld_5120_5120_14336,Gemm_Hipblaslt_439405,0.0274096
+GemmTunableOp_BFloat16_TN,tn_16480_16_5120_ld_5120_5120_16480,Gemm_Rocblas_439086,0.0348723
+GemmTunableOp_BFloat16_TN,tn_248320_4_128_ld_128_128_248320,Gemm_Hipblaslt_439615,0.0158188
+GemmTunableOp_BFloat16_TN,tn_5120_8_16384_ld_16384_16384_5120,Gemm_Hipblaslt_438689,0.0333283
+GemmTunableOp_BFloat16_TN,tn_14336_8_5120_ld_5120_5120_14336,Gemm_Rocblas_439069,0.0278989
+GemmTunableOp_BFloat16_TN,tn_32768_32_5120_ld_5120_5120_32768,Gemm_Rocblas_439639,0.0538232
+GemmTunableOp_BFloat16_TN,tn_248320_8_5120_ld_5120_5120_248320,Gemm_Rocblas_439685,0.368335
+GemmTunableOp_BFloat16_TN,tn_16480_1_5120_ld_5120_5120_16480,Gemm_Hipblaslt_438958,0.0327736
+GemmTunableOp_BFloat16_TN,tn_32768_8_5120_ld_5120_5120_32768,Gemm_Rocblas_439676,0.0528311
+GemmTunableOp_BFloat16_TN,tn_5120_1_17408_ld_17408_17408_5120,Gemm_Hipblaslt_439084,0.033903
+GemmTunableOp_BFloat16_TN,tn_15360_4_10240_ld_10240_10240_15360,Gemm_Hipblaslt_439674,0.0529565
+GemmTunableOp_BFloat16_TN,tn_32768_4_5120_ld_5120_5120_32768,Gemm_Rocblas_438482,0.0526045
+GemmTunableOp_Half_NN,nn_16_16_16_ld_16_16_16,Default,0.00739073
diff --git a/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/target_config.json b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/target_config.json
new file mode 100644
index 0000000..706cebd
--- /dev/null
+++ b/eagle_harness/core/profiles/mi355x-qwen3.8-27b-tp1/target_config.json
@@ -0,0 +1,140 @@
+{
+ "architectures": [
+ "Qwen3_5ForConditionalGeneration"
+ ],
+ "image_token_id": 248056,
+ "language_model_only": false,
+ "model_type": "qwen3_5",
+ "text_config": {
+ "attention_bias": false,
+ "attention_dropout": 0.0,
+ "attn_output_gate": true,
+ "bos_token_id": 248044,
+ "dtype": "bfloat16",
+ "eos_token_id": 248044,
+ "full_attention_interval": 4,
+ "head_dim": 256,
+ "hidden_act": "silu",
+ "hidden_size": 5120,
+ "initializer_range": 0.02,
+ "intermediate_size": 17408,
+ "layer_types": [
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention",
+ "linear_attention",
+ "linear_attention",
+ "linear_attention",
+ "full_attention"
+ ],
+ "linear_conv_kernel_dim": 4,
+ "linear_key_head_dim": 128,
+ "linear_num_key_heads": 16,
+ "linear_num_value_heads": 48,
+ "linear_value_head_dim": 128,
+ "mamba_ssm_dtype": "float32",
+ "max_position_embeddings": 262144,
+ "model_type": "qwen3_5_text",
+ "mtp_num_hidden_layers": 1,
+ "mtp_use_dedicated_embeddings": false,
+ "num_attention_heads": 24,
+ "num_hidden_layers": 64,
+ "num_key_value_heads": 4,
+ "output_gate_type": "swish",
+ "pad_token_id": null,
+ "partial_rotary_factor": 0.25,
+ "rms_norm_eps": 1e-06,
+ "rope_parameters": {
+ "mrope_interleaved": true,
+ "mrope_section": [
+ 11,
+ 11,
+ 10
+ ],
+ "partial_rotary_factor": 0.25,
+ "rope_theta": 10000000,
+ "rope_type": "default"
+ },
+ "tie_word_embeddings": false,
+ "use_cache": true,
+ "vocab_size": 248320
+ },
+ "tie_word_embeddings": false,
+ "transformers_version": "5.8.0.dev0",
+ "video_token_id": 248057,
+ "vision_config": {
+ "deepstack_visual_indexes": [],
+ "depth": 27,
+ "hidden_act": "gelu_pytorch_tanh",
+ "hidden_size": 1152,
+ "in_channels": 3,
+ "initializer_range": 0.02,
+ "intermediate_size": 4304,
+ "model_type": "qwen3_5",
+ "num_heads": 16,
+ "num_position_embeddings": 2304,
+ "out_hidden_size": 5120,
+ "patch_size": 16,
+ "spatial_merge_size": 2,
+ "temporal_patch_size": 2
+ },
+ "vision_end_token_id": 248054,
+ "vision_start_token_id": 248053
+}
\ No newline at end of file
diff --git a/eagle_harness/core/profiles/vllm-qwen38-tp4/README.md b/eagle_harness/core/profiles/vllm-qwen38-tp4/README.md
new file mode 100644
index 0000000..145c539
--- /dev/null
+++ b/eagle_harness/core/profiles/vllm-qwen38-tp4/README.md
@@ -0,0 +1,16 @@
+# Measured vLLM tree rounds for Qwen3.8-27B on B300 TP4
+
+Use this profile only with Qwen3.8-27B, its EAGLE-4 v3 draft, four B300 GPUs, and the vLLM tree configuration `mode: static`, `node_top_k: 4`, `tree_depth: 14`, `max_verify_width: 16`.
+
+The rounds file is included in the `eagle-harness` package. Copy it into the matching calibrated cost directory, preserving that directory's `cost/` tables for the derived depth stop:
+
+```bash
+: "${COST_ROOT:?Set COST_ROOT to the matching calibrated TP4 cost directory}"
+TREE_ROUNDS=$(python -c 'from importlib.resources import files; print(files("eagle_harness.core").joinpath("profiles/vllm-qwen38-tp4/rounds/tree.json"))')
+mkdir -p "$COST_ROOT/rounds"
+cp "$TREE_ROUNDS" "$COST_ROOT/rounds/tree.json"
+```
+
+Set `method_config.data_path` in the vLLM speculative configuration to `$COST_ROOT`. The measured schedule keeps verify width 16 below batch size 20 and uses width 4 from batch size 20. It does not enable native-OFF. Without `rounds/tree.json`, the configured tree width is unchanged. The packaged rounds alone are not a substitute for the calibrated target and draft costs used by the measured depth-stop policy.
+
+These measurements do not select a policy for TP1, TP8, another model pair, or another GPU. To measure a different configuration, set `record_rounds: true` with a separate writable `data_path`, not this packaged directory.
diff --git a/eagle_harness/core/profiles/vllm-qwen38-tp4/rounds/tree.json b/eagle_harness/core/profiles/vllm-qwen38-tp4/rounds/tree.json
new file mode 100644
index 0000000..390fa6a
--- /dev/null
+++ b/eagle_harness/core/profiles/vllm-qwen38-tp4/rounds/tree.json
@@ -0,0 +1,165 @@
+{
+ "rounds": [
+ {
+ "batch_size": 1,
+ "width": 4,
+ "round_us": 5120.3,
+ "accept": 3.3947,
+ "count": 76
+ },
+ {
+ "batch_size": 1,
+ "width": 16,
+ "round_us": 5809.0,
+ "accept": 8.6774,
+ "count": 31
+ },
+ {
+ "batch_size": 11,
+ "width": 4,
+ "round_us": 7421.9,
+ "accept": 2.4949,
+ "count": 9
+ },
+ {
+ "batch_size": 12,
+ "width": 16,
+ "round_us": 12275.6,
+ "accept": 3.0926,
+ "count": 18
+ },
+ {
+ "batch_size": 13,
+ "width": 4,
+ "round_us": 7930.6,
+ "accept": 2.4038,
+ "count": 16
+ },
+ {
+ "batch_size": 15,
+ "width": 4,
+ "round_us": 7935.9,
+ "accept": 2.45,
+ "count": 8
+ },
+ {
+ "batch_size": 16,
+ "width": 4,
+ "round_us": 8105.2,
+ "accept": 2.4922,
+ "count": 8
+ },
+ {
+ "batch_size": 17,
+ "width": 16,
+ "round_us": 14305.6,
+ "accept": 3.0462,
+ "count": 14
+ },
+ {
+ "batch_size": 20,
+ "width": 4,
+ "round_us": 8547.9,
+ "accept": 2.5269,
+ "count": 39
+ },
+ {
+ "batch_size": 20,
+ "width": 16,
+ "round_us": 16699.9,
+ "accept": 3.475,
+ "count": 10
+ },
+ {
+ "batch_size": 21,
+ "width": 4,
+ "round_us": 8746.3,
+ "accept": 2.5801,
+ "count": 11
+ },
+ {
+ "batch_size": 21,
+ "width": 16,
+ "round_us": 18104.6,
+ "accept": 3.9194,
+ "count": 13
+ },
+ {
+ "batch_size": 22,
+ "width": 4,
+ "round_us": 8854.0,
+ "accept": 2.5511,
+ "count": 8
+ },
+ {
+ "batch_size": 23,
+ "width": 4,
+ "round_us": 8904.4,
+ "accept": 2.5942,
+ "count": 9
+ },
+ {
+ "batch_size": 25,
+ "width": 4,
+ "round_us": 9631.1,
+ "accept": 2.5867,
+ "count": 9
+ },
+ {
+ "batch_size": 31,
+ "width": 4,
+ "round_us": 10255.2,
+ "accept": 2.6452,
+ "count": 8
+ },
+ {
+ "batch_size": 32,
+ "width": 4,
+ "round_us": 10252.4,
+ "accept": 2.7585,
+ "count": 11
+ },
+ {
+ "batch_size": 36,
+ "width": 4,
+ "round_us": 11012.5,
+ "accept": 2.5625,
+ "count": 8
+ },
+ {
+ "batch_size": 43,
+ "width": 4,
+ "round_us": 12079.5,
+ "accept": 2.7419,
+ "count": 10
+ },
+ {
+ "batch_size": 51,
+ "width": 4,
+ "round_us": 13998.0,
+ "accept": 2.7603,
+ "count": 9
+ },
+ {
+ "batch_size": 54,
+ "width": 4,
+ "round_us": 14536.4,
+ "accept": 2.8045,
+ "count": 9
+ },
+ {
+ "batch_size": 64,
+ "width": 4,
+ "round_us": 13935.5,
+ "accept": 2.8166,
+ "count": 392
+ },
+ {
+ "batch_size": 64,
+ "width": 16,
+ "round_us": 36474.5,
+ "accept": 4.9238,
+ "count": 119
+ }
+ ]
+}
\ No newline at end of file
diff --git a/eagle_harness/kernels/__init__.py b/eagle_harness/kernels/__init__.py
new file mode 100644
index 0000000..901a717
--- /dev/null
+++ b/eagle_harness/kernels/__init__.py
@@ -0,0 +1,22 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Kernels of the EAGLE-4 decode path. Raw tensors in, raw tensors out; no engine imports.
+
+================== =====================================================================================
+module what
+================== =====================================================================================
+``arch`` which GPU can run what (one place for every capability check); ``python -m ... arch``
+``candidate_ops`` candidate head: shard top-k, exact re-scoring, candidate tail (``candidate_topk``)
+``candidate`` ctypes launchers of the native CUDA kernels of ``csrc/candidate.cu`` (``native``, ``build``)
+``candidate_triton`` the same kernels in Triton: every supported GPU, bit-identical
+``gather_dot`` exact LM-head row scoring (+ the packed TP gather layout)
+``tree_step`` one Triton launch for a draft-tree step
+``online_softmax`` the online-softmax step of the engines' row attention kernels
+``gdn_tree`` GDN tree-verify tree tables (``gdn_tree_conv``: conv; ``gdn_tree_recurrence``: recurrence;
+ ``gdn_tree_gluon``: the recurrence's Gluon twin on B300)
+================== =====================================================================================
+
+Nothing is compiled at import: Triton kernels compile on first launch, the native library is loaded (or built with
+nvcc) on first use, and every launcher falls back to a Triton or torch path where the hardware or shape needs it.
+"""
diff --git a/eagle_harness/kernels/accept_tail.py b/eagle_harness/kernels/accept_tail.py
new file mode 100644
index 0000000..1a34bc0
--- /dev/null
+++ b/eagle_harness/kernels/accept_tail.py
@@ -0,0 +1,206 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The greedy tree acceptance and everything that follows it, for one request, in two launches.
+
+After a tree verify sglang runs about thirty tiny kernels (tree walk, accept
+lengths, bonus token, KV slot lists, compaction of the accepted path to the
+front of the block), launch-bound at a few microseconds each. :func:`accept_tail`
+is the walk and all of the index and token bookkeeping in one program;
+:func:`compact_rows` moves the accepted rows of a node-indexed tensor (the
+verify's hidden states) to the front. Both reproduce sglang's results exactly
+(``verify_tree_greedy``, ``fill_bonus_tokens``, ``assign_extend_cache_locs``,
+``fill_accept_out_cache_loc`` and ``_compact_accept_to_front``).
+"""
+
+from __future__ import annotations
+
+from typing import NamedTuple, Optional
+
+import torch
+import triton
+import triton.language as tl
+
+
+class Accepted(NamedTuple):
+ """What a greedy tree verify of one request accepted."""
+
+ predict: torch.Tensor # int32 [width]: target token of each accepted node, the accepted path moved to the front
+ accept_index: torch.Tensor # int32 [1, depth]: node of each accepted token, -1 padded
+ accept_lens: torch.Tensor # int32 [1]: accepted drafts + the bonus token
+ new_seq_lens: torch.Tensor # [1], seq_lens + accept_lens
+ bonus_tokens: torch.Tensor # int32 [1]: the last accepted token
+ committed_slots: torch.Tensor # int64 [depth]: KV slots the accepted tokens move to (0 past accept_lens)
+ accepted_slots: torch.Tensor # int64 [depth]: KV slots they were written to by the verify (0 past accept_lens)
+
+
+def _accept_tail_kernel(
+ target_ptr,
+ candidates_ptr,
+ retrieve_index_ptr,
+ retrieve_next_token_ptr,
+ retrieve_next_sibling_ptr,
+ seq_lens_ptr,
+ out_cache_loc_ptr,
+ req_to_token_ptr,
+ req_stride,
+ req_pool_idx_ptr,
+ predict_ptr,
+ accept_index_ptr,
+ accept_lens_ptr,
+ new_seq_lens_ptr,
+ bonus_ptr,
+ committed_slots_ptr,
+ accepted_slots_ptr,
+ WIDTH: tl.constexpr,
+ DEPTH: tl.constexpr,
+ WIDTH_P2: tl.constexpr,
+ DEPTH_P2: tl.constexpr,
+):
+ ds = tl.arange(0, DEPTH_P2)
+ tl.store(accept_index_ptr + ds, -1, mask=ds < DEPTH)
+ tl.debug_barrier()
+
+ # The tree walk: at each level take the first child of the last accepted node whose token is the
+ # target's prediction at that node (children are siblings of the first child).
+ last = tl.load(retrieve_index_ptr)
+ tl.store(accept_index_ptr, last.to(tl.int32))
+ cur = last * 0
+ num = last * 0
+ active = last * 0 + 1
+ for level in range(1, DEPTH):
+ if active != 0:
+ cur = tl.load(retrieve_next_token_ptr + cur)
+ target_token = tl.load(target_ptr + last)
+ found = last * 0
+ for sibling in range(WIDTH):
+ if found == 0:
+ valid = cur != -1
+ safe = tl.where(valid, cur, 0)
+ node = tl.load(retrieve_index_ptr + safe)
+ match = valid & (tl.load(candidates_ptr + safe) == target_token)
+ tl.store(accept_index_ptr + num + 1, node.to(tl.int32), mask=match)
+ num = num + match.to(tl.int64)
+ last = tl.where(match, node, last)
+ cur = tl.where(valid & ~match, tl.load(retrieve_next_sibling_ptr + safe), cur)
+ found = tl.where(match, 1, tl.where(valid, 0, -1)).to(tl.int64)
+ active = (found == 1).to(tl.int64)
+ tl.debug_barrier()
+
+ # Accept lengths, the bonus token, the new length.
+ seq_len = tl.load(seq_lens_ptr)
+ tl.store(accept_lens_ptr, (num + 1).to(tl.int32))
+ tl.store(new_seq_lens_ptr, (seq_len + num + 1).to(new_seq_lens_ptr.dtype.element_ty))
+ tl.store(bonus_ptr, tl.load(target_ptr + last).to(tl.int32))
+
+ # The predictions, the accepted path moved to the front (padding: node 0, which is always accepted).
+ nodes = tl.arange(0, WIDTH_P2)
+ head = nodes < DEPTH
+ path = tl.load(accept_index_ptr + nodes, mask=head, other=-1).to(tl.int64)
+ head_value = tl.load(target_ptr + tl.maximum(path, 0), mask=head, other=0)
+ accepted = tl.load(accept_index_ptr + ds, mask=(ds <= num) & (ds < DEPTH), other=-1).to(tl.int64)
+ on_path = tl.sum((nodes[:, None] == accepted[None, :]).to(tl.int32), axis=1) > 0
+ tail_value = tl.where(on_path, tl.load(target_ptr + nodes, mask=nodes < WIDTH, other=0), 0)
+ tl.store(predict_ptr + nodes, tl.where(head, head_value, tail_value).to(tl.int32), mask=nodes < WIDTH)
+
+ # The KV slots to move: the request's next free slots, and where the verify wrote the accepted tokens.
+ row = tl.load(req_pool_idx_ptr).to(tl.int64)
+ keep = (ds <= num) & (ds < DEPTH)
+ path = tl.load(accept_index_ptr + ds, mask=ds < DEPTH, other=-1).to(tl.int64)
+ committed = tl.load(req_to_token_ptr + row * req_stride + seq_len + ds, mask=keep, other=0)
+ tl.store(committed_slots_ptr + ds, committed.to(tl.int64), mask=ds < DEPTH)
+ accepted_slot = tl.load(out_cache_loc_ptr + path, mask=keep, other=0)
+ tl.store(accepted_slots_ptr + ds, accepted_slot.to(tl.int64), mask=ds < DEPTH)
+
+
+def accept_tail(
+ target_predict: torch.Tensor,
+ candidates: torch.Tensor,
+ retrieve_index: torch.Tensor,
+ retrieve_next_token: torch.Tensor,
+ retrieve_next_sibling: torch.Tensor,
+ seq_lens: torch.Tensor,
+ out_cache_loc: torch.Tensor,
+ req_to_token: torch.Tensor,
+ req_pool_indices: torch.Tensor,
+ depth: int,
+) -> Accepted:
+ """Greedy-accept one request's verify tree against ``target_predict`` (the target's argmax per node).
+
+ ``depth`` is the width of ``accept_index`` (the verify input's ``max_tree_depth``). Tables are the
+ verify input's; ``seq_lens``, ``out_cache_loc`` and ``req_pool_indices`` the batch's.
+ """
+ width = target_predict.numel()
+ device = target_predict.device
+ out = Accepted(
+ torch.empty(width, dtype=torch.int32, device=device),
+ torch.empty((1, depth), dtype=torch.int32, device=device),
+ torch.empty(1, dtype=torch.int32, device=device),
+ torch.empty(1, dtype=seq_lens.dtype, device=device),
+ torch.empty(1, dtype=torch.int32, device=device),
+ torch.empty(depth, dtype=torch.int64, device=device),
+ torch.empty(depth, dtype=torch.int64, device=device),
+ )
+ _accept_tail_kernel[(1,)](
+ target_predict,
+ candidates,
+ retrieve_index,
+ retrieve_next_token,
+ retrieve_next_sibling,
+ seq_lens,
+ out_cache_loc,
+ req_to_token,
+ req_to_token.stride(0),
+ req_pool_indices,
+ out.predict,
+ out.accept_index,
+ out.accept_lens,
+ out.new_seq_lens,
+ out.bonus_tokens,
+ out.committed_slots,
+ out.accepted_slots,
+ WIDTH=width,
+ DEPTH=depth,
+ WIDTH_P2=triton.next_power_of_2(width),
+ DEPTH_P2=triton.next_power_of_2(depth),
+ num_warps=1,
+ )
+ return out
+
+
+def _compact_rows_kernel(
+ src_ptr,
+ dst_ptr,
+ accept_index_ptr,
+ src_stride,
+ dst_stride,
+ cols,
+ DEPTH: tl.constexpr,
+ BLOCK: tl.constexpr,
+):
+ row = tl.program_id(0)
+ offsets = tl.program_id(1) * BLOCK + tl.arange(0, BLOCK)
+ path = tl.load(accept_index_ptr + tl.minimum(row, DEPTH - 1)).to(tl.int64)
+ source = tl.where(row < DEPTH, tl.maximum(path, 0), row)
+ values = tl.load(src_ptr + source * src_stride + offsets, mask=offsets < cols)
+ tl.store(dst_ptr + row.to(tl.int64) * dst_stride + offsets, values, mask=offsets < cols)
+
+
+def compact_rows(
+ rows: torch.Tensor, accept_index: torch.Tensor, block: int = 2048, out: Optional[torch.Tensor] = None
+) -> torch.Tensor:
+ """A copy of the node-indexed ``rows`` [width, cols] whose first ``accept_index.shape[1]`` rows are the
+ accepted path (padding: row 0), the other rows unchanged; into ``out`` (same shape, not ``rows``) if given."""
+ width, cols = rows.shape
+ if rows.stride(1) != 1:
+ raise ValueError("compact_rows needs rows with a unit column stride")
+ if out is None:
+ out = torch.empty_like(rows, memory_format=torch.contiguous_format)
+ elif out.shape != rows.shape or out.stride(1) != 1 or out.data_ptr() == rows.data_ptr():
+ raise ValueError("compact_rows needs an out of the rows' shape, unit column stride, not the rows")
+ _compact_rows_kernel[(width, triton.cdiv(cols, block))](
+ rows, out, accept_index, rows.stride(0), out.stride(0), cols, DEPTH=accept_index.shape[1], BLOCK=block
+ )
+ return out
diff --git a/eagle_harness/kernels/arch.py b/eagle_harness/kernels/arch.py
new file mode 100644
index 0000000..331c5d7
--- /dev/null
+++ b/eagle_harness/kernels/arch.py
@@ -0,0 +1,184 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Which GPU can run which kernel: the single place that reads a device's architecture.
+
+Launchers ask this module (``clusters``, ``pdl``, ``gluon_gdn``, ...); nothing else compares compute capabilities or
+device names. Importing it needs only torch, never initializes CUDA and never raises: on hardware the kernels do not
+cover, :func:`unsupported_reason` says why and :func:`require_supported` raises :class:`UnsupportedHardware` with that
+message, so callers can switch the package off cleanly.
+
+====================== =========================================================================================
+tier hardware
+====================== =========================================================================================
+Triton (every kernel) NVIDIA sm_80+ (A100, H100/H200, B200/B300, consumer Blackwell sm_120), AMD CDNA2-4
+Native CUDA (extras) NVIDIA only: candidate tail from sm_80, cluster shard top-k from sm_90 (else Triton)
+PDL, Gluon GDN NVIDIA sm_90+ / the validated Gluon architectures (see :data:`GLUON_GDN_SM`)
+====================== =========================================================================================
+
+``python -m eagle_harness.kernels.arch`` prints the report for every visible device.
+"""
+
+from __future__ import annotations
+
+import functools
+from dataclasses import dataclass
+from typing import Optional, Union
+
+import torch
+
+MIN_NVIDIA_SM = 80
+# AMD architectures the Triton kernels are compile-checked for (CDNA2, CDNA3, CDNA4).
+AMD_ARCHS = ("gfx90a", "gfx942", "gfx950")
+# Architectures the Gluon GDN tree kernel was measured faster on (every TP shape of Qwen3.8-27B); B300 only so far.
+# Bit-identity is not assumed from the Triton version: gdn_tree_gluon.gluon_dispatch checks every launch signature
+# bitwise against the Triton walk first.
+GLUON_GDN_SM = frozenset({103})
+
+DeviceLike = Union[None, int, str, torch.device]
+
+
+class UnsupportedHardware(RuntimeError):
+ """The visible GPU (or the software stack) is outside what the kernels cover."""
+
+
+@dataclass(frozen=True)
+class Gpu:
+ """One visible GPU: index, name, vendor and architecture."""
+
+ index: int
+ name: str
+ vendor: str # "nvidia" | "amd"
+ arch: str # "sm_103" | "gfx942"
+ sm: int # CUDA compute capability as major * 10 + minor; 0 on AMD
+
+ @property
+ def nvidia(self) -> bool:
+ """Whether the GPU is an NVIDIA one."""
+ return self.vendor == "nvidia"
+
+
+def _index(device: DeviceLike) -> Optional[int]:
+ """The CUDA/HIP device index behind ``device``, None for a CPU device."""
+ if isinstance(device, int):
+ return device
+ dev = torch.device("cuda" if device is None else device)
+ if dev.type != "cuda":
+ return None
+ return torch.cuda.current_device() if dev.index is None else dev.index
+
+
[email protected]_cache(maxsize=None)
+def _probe(index: int) -> Gpu:
+ props = torch.cuda.get_device_properties(index)
+ if torch.version.hip:
+ return Gpu(index, props.name, "amd", props.gcnArchName.split(":")[0], 0)
+ return Gpu(index, props.name, "nvidia", f"sm_{props.major}{props.minor}", props.major * 10 + props.minor)
+
+
+def gpu(device: DeviceLike = None) -> Optional[Gpu]:
+ """The GPU behind ``device`` (default: the current one), None without one."""
+ if not torch.cuda.is_available():
+ return None
+ index = _index(device)
+ return _probe(index) if index is not None else None
+
+
[email protected]_cache(maxsize=None)
+def _triton_error() -> Optional[str]:
+ try:
+ import triton # noqa: F401
+ except ImportError as e:
+ return f"Triton is not importable ({e})"
+ return None
+
+
+def unsupported_reason(device: DeviceLike = None) -> Optional[str]:
+ """None when the kernels run on ``device``, else a one-line reason."""
+ g = gpu(device)
+ if g is None:
+ return "no CUDA or ROCm device is visible to torch"
+ if (error := _triton_error()) is not None:
+ return error
+ if g.nvidia and g.sm < MIN_NVIDIA_SM:
+ return f"{g.name} ({g.arch}) is older than NVIDIA sm_{MIN_NVIDIA_SM} (A100)"
+ if not g.nvidia and g.arch not in AMD_ARCHS:
+ return f"{g.name} ({g.arch}) is not one of the supported AMD architectures {', '.join(AMD_ARCHS)}"
+ return None
+
+
+def require_supported(device: DeviceLike = None) -> Gpu:
+ """The GPU behind ``device``; raises :class:`UnsupportedHardware` with the reason where the kernels do not run."""
+ if (reason := unsupported_reason(device)) is not None:
+ raise UnsupportedHardware(f"eagle-harness kernels are off: {reason}.")
+ return gpu(device) # type: ignore[return-value]
+
+
+# ---------------------------------------------------------------------------------------------------------------------
+# Feature predicates (False on unsupported hardware; one definition each)
+# ---------------------------------------------------------------------------------------------------------------------
+
+
+def _nvidia_sm(device: DeviceLike, minimum: int) -> bool:
+ g = gpu(device)
+ return g is not None and g.nvidia and g.sm >= minimum and unsupported_reason(device) is None
+
+
+def native_candidate_tail(device: DeviceLike = None) -> bool:
+ """The CUDA candidate-tail kernel (warp intrinsics, sm_80+)."""
+ return _nvidia_sm(device, 80)
+
+
+def clusters(device: DeviceLike = None) -> bool:
+ """Thread-block clusters and distributed shared memory (the CUDA shard top-k kernel), sm_90+."""
+ return _nvidia_sm(device, 90)
+
+
+def pdl(device: DeviceLike = None) -> bool:
+ """Programmatic dependent launch (``griddepcontrol``), sm_90+ on NVIDIA."""
+ return _nvidia_sm(device, 90)
+
+
+def gluon_gdn(device: DeviceLike = None) -> bool:
+ """The Gluon GDN tree-verify kernel may serve this device (its run-time bitwise self-check still gates it)."""
+ g = gpu(device)
+ return g is not None and g.nvidia and g.sm in GLUON_GDN_SM and unsupported_reason(device) is None
+
+
+def _amd(device: DeviceLike) -> bool:
+ g = gpu(device)
+ return g is not None and not g.nvidia and unsupported_reason(device) is None
+
+
+def gdn_records_replay(device: DeviceLike = None) -> bool:
+ """The GDN target verify keeps per-node replay records (delta, key, decay) and replays the accepted path into
+ the state pool, instead of per-node state snapshots (:mod:`eagle_harness.kernels.gdn_tree_records`). AMD CDNA:
+ the snapshot kernels were measured slower there; NVIDIA keeps its snapshot walk (not measured with records)."""
+ return _amd(device)
+
+
+def side_stream_prelaunch(device: DeviceLike = None) -> bool:
+ """The next round's draft extend and first draft steps are queued on a side stream at the end of a round
+ (:meth:`eagle_harness.sglang.drafter.DynamicDrafter.prelaunch`). Measured off on AMD: MI355X TP1 bs1 rounds
+ were slower with it (see the prelaunch rows in the ROCm checkpoint), so the draft stays on the caller stream."""
+ g = gpu(device)
+ return g is not None and g.nvidia
+
+
+def report() -> str:
+ """One block per visible device: the tier and every feature predicate."""
+ if not torch.cuda.is_available():
+ return f"no GPU visible: {unsupported_reason()}"
+ lines = []
+ for i in range(torch.cuda.device_count()):
+ g = _probe(i)
+ reason = unsupported_reason(i)
+ lines.append(f"cuda:{i} {g.name} ({g.arch}): " + (f"OFF, {reason}" if reason else "supported"))
+ if reason is None:
+ features = (native_candidate_tail, clusters, pdl, gluon_gdn, gdn_records_replay, side_stream_prelaunch)
+ lines.append(" " + ", ".join(f"{f.__name__}={'yes' if f(i) else 'no'}" for f in features))
+ return "\n".join(lines)
+
+
+if __name__ == "__main__":
+ print(report())
diff --git a/eagle_harness/kernels/build.py b/eagle_harness/kernels/build.py
new file mode 100644
index 0000000..6b7da1e
--- /dev/null
+++ b/eagle_harness/kernels/build.py
@@ -0,0 +1,135 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""nvcc build of the native CUDA kernels (``csrc/candidate.cu``): prebuilt binaries, the JIT fallback, a per-arch check.
+
+The library has a plain C ABI over raw pointers (no torch, no Python headers), so one binary per CUDA major (12, 13)
+serves every torch and Python version; the CUDA runtime is linked statically. Each binary holds SASS for every supported
+architecture and the PTX of sm_90 (newer GPUs JIT it), so it needs no rebuild per GPU.
+
+ python -m eagle_harness.kernels.build prebuild [--cuda-home /usr/local/cuda-13.0] # into the package, for a wheel
+ python -m eagle_harness.kernels.build check [--cuda-home ...] # one compile per architecture
+
+``prebuild`` writes ``_native/cu<major>/<LIBRARY>``; :mod:`eagle_harness.kernels.native` loads it, or JIT-builds the
+library for the visible GPU with :func:`compile_library` when there is none for this CUDA major.
+"""
+
+from __future__ import annotations
+
+import argparse
+import logging
+import os
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+from concurrent.futures import ThreadPoolExecutor
+from pathlib import Path
+from typing import Iterable, Optional, Sequence, Tuple
+
+logger = logging.getLogger(__name__)
+
+PACKAGE = Path(__file__).resolve().parent
+SOURCE = PACKAGE / "csrc" / "candidate.cu"
+LIBRARY = "libeagle_harness_candidate.so"
+PREBUILT = PACKAGE / "_native"
+
+# SASS architectures (CUDA 12.8 has no sm_103: that GPU runs the sm_90 PTX there) and the PTX architecture.
+SASS_ARCHS = (80, 90, 100, 103, 120)
+PTX_ARCH = 90
+# -diag-suppress 177: the helpers of the sm_90-only kernel are unreferenced in the host pass and below sm_90.
+NVCC_FLAGS = ("-O3", "-std=c++17", "-shared", "-Xcompiler", "-fPIC", "-cudart", "static", "-diag-suppress", "177")
+
+
+def find_nvcc(cuda_home: Optional[str] = None) -> Optional[str]:
+ """The nvcc of ``cuda_home``, ``$CUDA_HOME``, ``/usr/local/cuda`` or ``PATH``; None if there is none."""
+ homes = [cuda_home, os.environ.get("CUDA_HOME"), "/usr/local/cuda"]
+ candidates = [os.path.join(h, "bin", "nvcc") for h in homes if h]
+ return next((c for c in candidates if os.access(c, os.X_OK)), None) or shutil.which("nvcc")
+
+
+def toolkit_version(nvcc: str) -> Tuple[int, int]:
+ """``(major, minor)`` of the CUDA toolkit behind ``nvcc``."""
+ out = subprocess.run([nvcc, "--version"], capture_output=True, text=True, check=True).stdout
+ match = re.search(r"release (\d+)\.(\d+)", out)
+ if match is None:
+ raise RuntimeError(f"cannot read the CUDA version from `{nvcc} --version`")
+ return int(match.group(1)), int(match.group(2))
+
+
+def supported_sass(version: Tuple[int, int]) -> Tuple[int, ...]:
+ """The SASS architectures this toolkit can build (sm_103 from CUDA 12.9)."""
+ return tuple(a for a in SASS_ARCHS if a != 103 or version >= (12, 9))
+
+
+def _gencode(sass: Iterable[int], ptx: Optional[int]) -> Sequence[str]:
+ flags = [f"-gencode=arch=compute_{a},code=sm_{a}" for a in sass]
+ if ptx is not None:
+ flags.append(f"-gencode=arch=compute_{ptx},code=compute_{ptx}")
+ return flags
+
+
+def compile_library(out: Path, sass: Iterable[int], ptx: Optional[int] = PTX_ARCH, nvcc: Optional[str] = None) -> Path:
+ """Build the shared library at ``out`` for the given architectures; raises RuntimeError with nvcc's output."""
+ nvcc = nvcc or find_nvcc()
+ if nvcc is None:
+ raise RuntimeError("nvcc not found (set CUDA_HOME)")
+ out.parent.mkdir(parents=True, exist_ok=True)
+ # Compile to a private file first: a concurrent process must never load a half-written library.
+ with tempfile.NamedTemporaryFile(dir=out.parent, suffix=".so", delete=False) as tmp:
+ partial = Path(tmp.name)
+ cmd = [nvcc, *NVCC_FLAGS, *_gencode(sass, ptx), str(SOURCE), "-o", str(partial)]
+ proc = subprocess.run(cmd, capture_output=True, text=True)
+ if proc.returncode != 0:
+ partial.unlink(missing_ok=True)
+ raise RuntimeError(f"nvcc failed ({' '.join(cmd)}):\n{proc.stderr[-4000:]}")
+ partial.chmod(0o755)
+ os.replace(partial, out)
+ return out
+
+
+def _toolkit(cuda_home: Optional[str]) -> Tuple[str, Tuple[int, int]]:
+ nvcc = find_nvcc(cuda_home)
+ if nvcc is None:
+ raise RuntimeError("nvcc not found (pass --cuda-home)")
+ return nvcc, toolkit_version(nvcc)
+
+
+def prebuild(cuda_home: Optional[str] = None) -> Path:
+ """The binary of this toolkit's CUDA major, into ``_native/cu<major>/`` (what a wheel ships)."""
+ nvcc, version = _toolkit(cuda_home)
+ return compile_library(PREBUILT / f"cu{version[0]}" / LIBRARY, supported_sass(version), PTX_ARCH, nvcc)
+
+
+def check(cuda_home: Optional[str] = None) -> None:
+ """Compile for every architecture on its own, so an error names the architecture; nothing is kept."""
+ nvcc, version = _toolkit(cuda_home)
+ with tempfile.TemporaryDirectory() as tmp, ThreadPoolExecutor(max_workers=len(SASS_ARCHS)) as pool:
+ jobs = {
+ arch: pool.submit(
+ compile_library, Path(tmp) / f"sm{arch}.so", [arch], PTX_ARCH if arch == PTX_ARCH else None, nvcc
+ )
+ for arch in supported_sass(version)
+ }
+ for arch, job in jobs.items():
+ job.result() # raises the nvcc error of the first failing architecture
+ logger.info("CUDA %d.%d: sm_%d ok", *version, arch)
+
+
+def main(argv: Optional[Sequence[str]] = None) -> int:
+ """Command line: ``prebuild`` the native library or ``check`` that nvcc builds it for every target."""
+ ap = argparse.ArgumentParser(description="Build or check the native EAGLE-Harness CUDA library.")
+ ap.add_argument("command", choices=("prebuild", "check"))
+ ap.add_argument("--cuda-home", help="CUDA toolkit root (default: $CUDA_HOME, /usr/local/cuda, PATH)")
+ args = ap.parse_args(argv)
+ logging.basicConfig(level=logging.INFO, format="%(message)s")
+ if args.command == "prebuild":
+ logger.info("built %s", prebuild(args.cuda_home))
+ else:
+ check(args.cuda_home)
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/eagle_harness/kernels/candidate.py b/eagle_harness/kernels/candidate.py
new file mode 100644
index 0000000..e887bf6
--- /dev/null
+++ b/eagle_harness/kernels/candidate.py
@@ -0,0 +1,122 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Launchers of the native CUDA candidate kernels (cluster shard top-k, candidate tail).
+
+Bit-identical to the Triton kernels of :mod:`eagle_harness.kernels.candidate_triton`. Each call returns False when it
+launched nothing (hardware without the feature, library unavailable, shape not covered) and the caller runs the Triton
+path; ``enabled`` is ``HarnessConfig.draft_model.cuda_candidate_kernels``. A CUDA error raises.
+"""
+
+from __future__ import annotations
+
+from typing import Optional
+
+import torch
+
+from eagle_harness.kernels import arch, native
+
+_NOT_COVERED = -1
+_DTYPE = {torch.bfloat16: 0, torch.float16: 1, torch.float32: 2}
+
+
+def _launch(result: int, what: str) -> bool:
+ if result == _NOT_COVERED:
+ return False
+ if result != 0:
+ raise RuntimeError(f"eagle-harness native {what} failed with CUDA error {result}")
+ return True
+
+
+def _stream(device: torch.device) -> int:
+ return torch.cuda.current_stream(device).cuda_stream
+
+
+def shard_topk(
+ scores: torch.Tensor,
+ k: int,
+ vocab_start: int,
+ local_ids: torch.Tensor,
+ global_ids: torch.Tensor,
+ *,
+ enabled: bool = True,
+) -> bool:
+ """Fill ``local_ids`` / ``global_ids`` ([M, k] int64, unit column stride) like torch.topk(sorted=False)."""
+ if not (enabled and arch.clusters(scores.device) and scores.dtype in (torch.bfloat16, torch.float16)):
+ return False
+ lib = native.library()
+ if lib is None:
+ return False
+ rows, n = scores.shape
+ return _launch(
+ lib.eagle4_shard_topk(
+ scores.device.index,
+ _DTYPE[scores.dtype],
+ scores.data_ptr(),
+ scores.stride(0),
+ rows,
+ n,
+ k,
+ local_ids.data_ptr(),
+ local_ids.stride(0),
+ global_ids.data_ptr(),
+ global_ids.stride(0),
+ vocab_start,
+ _stream(scores.device),
+ ),
+ "shard top-k",
+ )
+
+
+def candidate_tail(
+ cand_logits: torch.Tensor,
+ cand_tokens: torch.Tensor,
+ num_candidates: int,
+ top_k: int,
+ logits_out: torch.Tensor,
+ tokens_out: torch.Tensor,
+ topk_probs: Optional[torch.Tensor],
+ topk_tokens: Optional[torch.Tensor],
+ *,
+ enabled: bool = True,
+) -> bool:
+ """Candidate selection + softmax + top-k on [R, M, NCL] views (int64 tokens, or int32 with fp32 logits).
+
+ False where not covered (R * NCL > 1024, NC not in 32/64/128/256, top_k > 32).
+ """
+ if not (enabled and arch.native_candidate_tail(cand_logits.device) and cand_logits.dtype in _DTYPE):
+ return False
+ lib = native.library()
+ if lib is None:
+ return False
+ if topk_probs is None: # top_k == 0: the kernel does not touch them
+ topk_probs, topk_tokens = logits_out, tokens_out
+ ranks, rows, ncl = cand_logits.shape
+ return _launch(
+ lib.eagle4_candidate_tail(
+ cand_logits.device.index,
+ _DTYPE[cand_logits.dtype],
+ cand_tokens.element_size(),
+ cand_logits.data_ptr(),
+ cand_logits.stride(0),
+ cand_logits.stride(1),
+ cand_tokens.data_ptr(),
+ cand_tokens.stride(0),
+ cand_tokens.stride(1),
+ logits_out.data_ptr(),
+ logits_out.stride(0),
+ tokens_out.data_ptr(),
+ tokens_out.stride(0),
+ topk_probs.data_ptr(),
+ topk_probs.stride(0),
+ topk_tokens.data_ptr(),
+ topk_tokens.stride(0),
+ ranks,
+ rows,
+ ncl,
+ num_candidates,
+ top_k,
+ _stream(cand_logits.device),
+ ),
+ "candidate tail",
+ )
diff --git a/eagle_harness/kernels/candidate_ops.py b/eagle_harness/kernels/candidate_ops.py
new file mode 100644
index 0000000..c231295
--- /dev/null
+++ b/eagle_harness/kernels/candidate_ops.py
@@ -0,0 +1,246 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Launchers of the EAGLE-4 candidate top-k kernels (shard top-k, candidate tail) and the fused candidate head.
+
+Each runs the native CUDA kernel of
+:mod:`eagle_harness.kernels.candidate` where the GPU and the shape allow it (shard top-k: sm_90+, tail: sm_80+),
+else the Triton kernels of :mod:`eagle_harness.kernels.candidate_triton` (any supported GPU); both are
+bit-identical to the NVIDIA torch reference in their docstrings, equal values included. On ROCm the
+selection is mathematically equivalent, but torch's unsorted/tied order and fp32 softmax rounding can differ.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Callable
+
+import torch
+import triton
+
+from eagle_harness.kernels import candidate
+from eagle_harness.kernels.candidate_triton import (
+ eagle4_candidate_tail_kernel,
+ eagle4_shard_topk_chunk_kernel,
+ eagle4_shard_topk_merge_kernel,
+)
+from eagle_harness.kernels.gather_dot import gather_dot, gather_dot_packed
+
+# Past ~8M scores the Triton kernels (ALU bound) lose to torch's radix select.
+_SHARD_TOPK_MAX_ELEMS = 8_000_000
+_16BIT_FLOATS = (torch.float16, torch.bfloat16)
+
+
+def shard_topk(
+ scores: torch.Tensor,
+ k: int,
+ vocab_start: int,
+ *,
+ cuda_kernels: bool = True,
+ max_triton_elements: int | None = None,
+) -> tuple[torch.Tensor, torch.Tensor]:
+ """Indices of the ``k`` largest scores per row (NVIDIA: torch's unsorted order).
+
+ Returns ``(local_ids, global_ids)``, int64 ``[M, k]``; ``global_ids`` is
+ ``local_ids + vocab_start``.
+ """
+ rows, n = scores.shape
+ if scores.stride(-1) != 1 or not 0 < k <= n:
+ raise ValueError(f"shard_topk needs unit column stride and 0 < k <= {n}, got k={k}")
+ limit = _SHARD_TOPK_MAX_ELEMS if max_triton_elements is None else max_triton_elements
+ if rows * n > limit or triton.cdiv(n, 8192) * k >= 32768:
+ local_ids = torch.topk(scores, k, dim=-1, sorted=False).indices
+ return local_ids, local_ids + vocab_start
+ local_ids = torch.empty((rows, k), dtype=torch.int64, device=scores.device)
+ global_ids = torch.empty_like(local_ids)
+ if rows == 0:
+ return local_ids, global_ids
+ if candidate.shard_topk(scores, k, vocab_start, local_ids, global_ids, enabled=cuda_kernels):
+ return local_ids, global_ids
+ chunk = 2048 if n <= 32768 else (4096 if n <= 131072 else 8192)
+ num_chunks = triton.cdiv(n, chunk)
+ cand_keys = torch.empty((rows, num_chunks, k), dtype=torch.int32, device=scores.device)
+ cand_idx = torch.empty_like(cand_keys)
+ eagle4_shard_topk_chunk_kernel[(rows, num_chunks)](
+ scores, scores.stride(0), n, cand_keys, cand_idx, K=k, CH=chunk, KEY_BITS=16, num_warps=8
+ )
+ num_cand = num_chunks * k
+ eagle4_shard_topk_merge_kernel[(rows,)](
+ cand_keys,
+ cand_idx,
+ num_cand,
+ local_ids,
+ local_ids.stride(0),
+ global_ids,
+ global_ids.stride(0),
+ vocab_start,
+ K=k,
+ NBK_P=triton.next_power_of_2(num_cand),
+ KEY_BITS=16,
+ num_warps=8,
+ )
+ return local_ids, global_ids
+
+
+def _tail_num_warps(width: int) -> int:
+ if width <= 256:
+ return 1
+ if width <= 512:
+ return 2
+ return 4 if width <= 1024 else 8
+
+
+def candidate_tail(
+ cand_logits: torch.Tensor,
+ cand_tokens: torch.Tensor,
+ num_rows: int,
+ top_k: int,
+ *,
+ cuda_kernels: bool = True,
+) -> tuple[torch.Tensor, torch.Tensor, tuple[torch.Tensor, torch.Tensor] | None]:
+ """Everything after the candidate all-gather, in one launch.
+
+ ``cand_logits`` / ``cand_tokens``: ``[R * M, NC]`` rank-major (an all-gather
+ along dim 0), or ``[R, M, NC]`` views of any row and rank strides; tokens
+ int64, or int32 with fp32 logits (the packed gather of :func:`candidate_topk`).
+ Equivalent (bit for bit on NVIDIA) to::
+
+ logits, pos = torch.topk(gathered_logits, NC, sorted=False) # R > 1 only
+ tokens = torch.gather(gathered_tokens, -1, pos)
+ logits = logits.float()
+ probs, pick = torch.topk(torch.softmax(logits, -1), top_k)
+ topk_tokens = torch.gather(tokens, -1, pick)
+
+ on the ``[M, R * NC]`` rank-concatenated view. Returns ``(logits [M, NC]
+ fp32, tokens [M, NC] int64, (probs, topk_tokens) or None when top_k == 0)``.
+ """
+ if cand_tokens.shape != cand_logits.shape:
+ raise ValueError(f"candidate_tail: logits {tuple(cand_logits.shape)} vs tokens {tuple(cand_tokens.shape)}")
+ if cand_logits.dim() == 3:
+ num_ranks, rows, nc = cand_logits.shape
+ stride_cl_r, stride_cl_m = cand_logits.stride(0), cand_logits.stride(1)
+ stride_ct_r, stride_ct_m = cand_tokens.stride(0), cand_tokens.stride(1)
+ else:
+ rows, nc = num_rows, cand_logits.shape[1]
+ num_ranks = cand_logits.shape[0] // max(rows, 1)
+ stride_cl_r, stride_cl_m = rows * cand_logits.stride(0), cand_logits.stride(0)
+ stride_ct_r, stride_ct_m = rows * cand_tokens.stride(0), cand_tokens.stride(0)
+ if rows != num_rows or num_ranks * rows != cand_logits.shape[:-1].numel():
+ raise ValueError(
+ f"candidate_tail: {tuple(cand_logits.shape)} is not [R * {num_rows}, NC] or [R, {num_rows}, NC]"
+ )
+ if (
+ cand_tokens.dtype not in (torch.int64, torch.int32)
+ or cand_logits.stride(-1) != 1
+ or cand_tokens.stride(-1) != 1
+ ):
+ raise ValueError("candidate_tail needs int64 or int32 tokens and unit column strides")
+ device = cand_logits.device
+ logits_out = torch.empty((rows, nc), dtype=torch.float32, device=device)
+ tokens_out = (
+ torch.empty((rows, nc), dtype=torch.int64, device=device)
+ if num_ranks > 1
+ else cand_tokens.as_strided((rows, nc), (stride_ct_m, 1))
+ )
+ topk = None
+ if top_k > 0:
+ topk = (
+ torch.empty((rows, top_k), dtype=torch.float32, device=device),
+ torch.empty((rows, top_k), dtype=torch.int64, device=device),
+ )
+ if rows == 0:
+ return logits_out, tokens_out, topk
+ topk_probs, topk_tokens = topk if topk is not None else (logits_out, tokens_out)
+ views = (
+ cand_logits.as_strided((num_ranks, rows, nc), (stride_cl_r, stride_cl_m, 1)),
+ cand_tokens.as_strided((num_ranks, rows, nc), (stride_ct_r, stride_ct_m, 1)),
+ )
+ if candidate.candidate_tail(
+ views[0], views[1], nc, top_k, logits_out, tokens_out, topk_probs, topk_tokens, enabled=cuda_kernels
+ ):
+ return logits_out, tokens_out, topk
+ width = num_ranks * nc
+ eagle4_candidate_tail_kernel[(rows,)](
+ cand_logits,
+ stride_cl_r,
+ stride_cl_m,
+ cand_tokens,
+ stride_ct_r,
+ stride_ct_m,
+ logits_out,
+ logits_out.stride(0),
+ tokens_out,
+ tokens_out.stride(0),
+ topk_probs,
+ topk_probs.stride(0),
+ topk_tokens,
+ topk_tokens.stride(0),
+ R=num_ranks,
+ NCL=nc,
+ NC=nc,
+ CP=triton.next_power_of_2(width),
+ P=triton.next_power_of_2(nc),
+ KEY_BITS=16 if cand_logits.dtype in _16BIT_FLOATS else 32,
+ TOPK=top_k,
+ num_warps=_tail_num_warps(width),
+ )
+ return logits_out, tokens_out, topk
+
+
+def candidate_head(
+ scores: torch.Tensor,
+ lm_head: torch.Tensor,
+ hidden: torch.Tensor,
+ *,
+ num_candidates: int,
+ vocab_start: int,
+ top_k: int,
+ all_gather: Callable[[torch.Tensor], torch.Tensor] | None = None,
+ cuda_kernels: bool = True,
+ max_triton_elements: int | None = None,
+) -> tuple[torch.Tensor, torch.Tensor, tuple[torch.Tensor, torch.Tensor]]:
+ """Candidate logits, ids and top-k probabilities for each row.
+
+ ``scores`` [rows, shard vocab] are this rank's low-rank scores (padding columns already masked), ``lm_head``
+ [shard vocab, H] its exact weights. Shard top-k, exact re-scoring (:func:`gather_dot`), the candidate tail; under TP
+ ``all_gather`` merges the ranks' packed candidates (``[M, n] -> [R, M, n]`` in rank order, any strides, so a gather
+ along either dim is a view), the logits and ids written by one launch (:func:`gather_dot_packed`) and read in place
+ by the tail.
+ """
+ rows = hidden.shape[0]
+ local_ids, global_ids = shard_topk(
+ scores,
+ num_candidates,
+ vocab_start,
+ cuda_kernels=cuda_kernels,
+ max_triton_elements=max_triton_elements,
+ )
+ if all_gather is None:
+ logits, tokens = gather_dot(lm_head, local_ids, hidden), global_ids
+ else:
+ ranks = all_gather(gather_dot_packed(lm_head, local_ids, hidden, vocab_start))
+ logits, tokens = ranks[..., :num_candidates].view(torch.float32), ranks[..., num_candidates:]
+ logits, tokens, ranked = candidate_tail(logits, tokens, rows, top_k, cuda_kernels=cuda_kernels)
+ if ranked is None:
+ raise ValueError("candidate_head requires top_k > 0")
+ return logits, tokens, ranked
+
+
+def candidate_topk(
+ scores: torch.Tensor,
+ lm_head: torch.Tensor,
+ hidden: torch.Tensor,
+ *,
+ num_candidates: int,
+ vocab_start: int,
+ top_k: int,
+ all_gather: Callable[[torch.Tensor], torch.Tensor] | None = None,
+ cuda_kernels: bool = True,
+ max_triton_elements: int | None = None,
+) -> tuple[torch.Tensor, torch.Tensor]:
+ """Top-k probabilities and ids; use candidate_head to retain proposal logits."""
+ return candidate_head(
+ scores, lm_head, hidden, num_candidates=num_candidates,
+ vocab_start=vocab_start, top_k=top_k, all_gather=all_gather,
+ cuda_kernels=cuda_kernels,
+ max_triton_elements=max_triton_elements,
+ )[2]
diff --git a/eagle_harness/kernels/candidate_triton.py b/eagle_harness/kernels/candidate_triton.py
new file mode 100644
index 0000000..3039608
--- /dev/null
+++ b/eagle_harness/kernels/candidate_triton.py
@@ -0,0 +1,346 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Triton kernels of the EAGLE-4 candidate head: shard top-k (chunk + merge) and the candidate tail.
+
+Portable fallback of the native CUDA kernels (``csrc/candidate.cu``) and the only implementation on AMD GPUs and
+NVIDIA before sm_90. Bit-identical to the torch ops named below on NVIDIA; no engine imports.
+"""
+
+from __future__ import annotations
+
+import triton
+import triton.language as tl
+from triton.language.extra import libdevice
+
+# ---------------------------------------------------------------------------
+# EAGLE4 efficient lm_head candidate path (draft step tail).
+#
+# These kernels replace, bit for bit, the torch ops the draft step used to run
+# after the low-rank scores (launchers: candidate_ops.shard_topk / candidate_tail):
+# torch.topk(scores, K, sorted=False) -> shard top-K
+# torch.topk(gathered, K, sorted=False) + gather + .float() -> candidate select
+# torch.softmax(fp32, -1) -> torch.topk(k) / torch.max -> gather -> top-k tail
+# "Bit for bit" includes torch's ordering: torch.topk(sorted=False) emits the
+# elements whose radix key is strictly above the K-th largest key in ascending
+# position order, then the K-th-key ties in ascending position order until K
+# are taken; torch.softmax over a <= 1024-wide fp32 row is the warp-persistent
+# softmax (lane l sums elements l, l+32, ... in order, then an xor butterfly);
+# torch.topk(sorted=True) with k <= 32 runs the gathered k through a 32-wide
+# bitonic network (SmallBitonicSort) that is not stable on exact ties.
+# ---------------------------------------------------------------------------
+
+
+def _eagle4_radix_key(x, KEY_BITS: tl.constexpr):
+ # torch.topk's order-preserving unsigned key (TopKTypeConfig::convert); NaN
+ # maps to the maximum. int32 for 16-bit floats, int64 for fp32, so that -1
+ # is free as the empty-slot sentinel.
+ if KEY_BITS == 16:
+ b = x.to(tl.int16, bitcast=True).to(tl.int32) & 0xFFFF
+ key = tl.where((b & 0x8000) != 0, b ^ 0xFFFF, b ^ 0x8000)
+ key = tl.where(x != x, 0xFFFF, key)
+ else:
+ b = x.to(tl.uint32, bitcast=True)
+ key = tl.where((b >> 31) != 0, ~b, b | 0x80000000)
+ key = tl.where(x != x, 0xFFFFFFFF, key)
+ key = key.to(tl.int64)
+ return key
+
+
+def _eagle4_radix_key_to_fp32(key):
+ # Inverse of _eagle4_radix_key for KEY_BITS == 32.
+ kb = key.to(tl.uint32)
+ b = tl.where((kb >> 31) != 0, kb ^ 0x80000000, ~kb)
+ return b.to(tl.float32, bitcast=True)
+
+
+def _eagle4_kth_key(key, K, KEY_BITS: tl.constexpr):
+ # The K-th largest key (largest t with count(key >= t) >= K), two bits per
+ # step: a step's three candidate counts (and, in the first step, the valid
+ # count) share one reduction as 16-bit fields of an int64. Rows must hold
+ # < 32768 keys. -1 when fewer than K keys are valid (>= 0).
+ kth = tl.max(key, axis=0) * 0
+ n_valid = kth.to(tl.int64)
+ for i in tl.static_range(KEY_BITS // 2):
+ c1 = kth | (tl.full([], 1, key.dtype) << (KEY_BITS - 2 - 2 * i))
+ c2 = kth | (tl.full([], 2, key.dtype) << (KEY_BITS - 2 - 2 * i))
+ c3 = kth | (tl.full([], 3, key.dtype) << (KEY_BITS - 2 - 2 * i))
+ packed = (
+ (key >= c1).to(tl.int64)
+ + ((key >= c2).to(tl.int64) << 16)
+ + ((key >= c3).to(tl.int64) << 32)
+ )
+ if i == 0:
+ packed += (key >= 0).to(tl.int64) << 48
+ counts = tl.sum(packed, axis=0)
+ if i == 0:
+ n_valid = counts >> 48
+ kth = tl.where(
+ ((counts >> 32) & 0xFFFF) >= K,
+ c3,
+ tl.where(((counts >> 16) & 0xFFFF) >= K, c2, tl.where((counts & 0xFFFF) >= K, c1, kth)),
+ )
+ return tl.where(n_valid >= K, kth, -1)
+
+
+def _eagle4_split_at_kth(key, kth, valid):
+ # Keys above the K-th key and K-th-key ties, with their exclusive ranks in
+ # position order from one packed cumsum (16-bit fields; < 32768 keys).
+ gt = (key > kth) & valid
+ eq = (key == kth) & valid
+ flags = gt.to(tl.int32) + (eq.to(tl.int32) << 16)
+ before = tl.cumsum(flags, axis=0) - flags
+ total = tl.sum(flags, axis=0)
+ return gt, eq, before & 0xFFFF, before >> 16, total & 0xFFFF, total >> 16
+
+
+def _eagle4_topk_slots(key, K, KEY_BITS: tl.constexpr):
+ # torch.topk(sorted=False) placement: returns (selected, dest) where the
+ # selected keys are the K largest (ties at the K-th key resolved to the
+ # smallest positions) and dest is the output slot: keys above the K-th key
+ # first, in position order, then the K-th-key ties in position order.
+ # `key` carries -1 in empty positions and must hold >= K valid keys.
+ kth = _eagle4_kth_key(key, K, KEY_BITS)
+ gt, eq, gt_rank, eq_rank, n_gt, n_eq = _eagle4_split_at_kth(key, kth, key >= 0)
+ selected = gt | (eq & (eq_rank < K - n_gt))
+ dest = tl.where(gt, gt_rank, n_gt + eq_rank)
+ return selected, dest
+
+
+def eagle4_shard_topk_chunk_kernel(
+ scores_ptr, # [M, N] low-rank scores of this vocab shard (16-bit float)
+ stride_sm,
+ N,
+ cand_keys_ptr, # [M, NB, K] int32 radix keys, -1 = empty
+ cand_idx_ptr, # [M, NB, K] int32 shard-local positions
+ K: tl.constexpr,
+ CH: tl.constexpr,
+ KEY_BITS: tl.constexpr,
+):
+ """Stage 1 of the shard top-k: the top K radix keys of each vocab chunk."""
+ # Stage 1 of the shard top-K: every CH-wide chunk keeps its own top-K under
+ # the row order (key desc, position asc), compacted in position order. That
+ # set contains every chunk element of the row's top-K, so stage 2 only
+ # re-selects among NB*K candidates that are already in position order.
+ m = tl.program_id(0)
+ c = tl.program_id(1)
+ nb = tl.num_programs(1)
+ offs = c * CH + tl.arange(0, CH)
+ valid = offs < N
+ x = tl.load(scores_ptr + m.to(tl.int64) * stride_sm + offs, mask=valid, other=0.0)
+ key = tl.where(valid, _eagle4_radix_key(x, KEY_BITS), -1)
+ kth = _eagle4_kth_key(key, K, KEY_BITS)
+ gt, eq, gt_rank, eq_rank, n_gt, n_eq = _eagle4_split_at_kth(key, kth, valid)
+ need = K - n_gt
+ selected = gt | (eq & (eq_rank < need))
+ pos = gt_rank + tl.minimum(eq_rank, need)
+ base = (m * nb + c).to(tl.int64) * K
+ tl.store(cand_keys_ptr + base + pos, key, mask=selected)
+ tl.store(cand_idx_ptr + base + pos, offs, mask=selected)
+ slots = tl.arange(0, K)
+ tl.store(
+ cand_keys_ptr + base + slots,
+ tl.full([K], -1, tl.int32),
+ mask=slots >= n_gt + tl.minimum(n_eq, need),
+ )
+
+
+def eagle4_shard_topk_merge_kernel(
+ cand_keys_ptr, # [M, NBK] int32 (stage-1 output, position ordered)
+ cand_idx_ptr, # [M, NBK] int32
+ NBK,
+ local_idx_ptr, # [M, K] int64 shard-local ids (fused_gather_dot input)
+ stride_lm,
+ global_idx_ptr, # [M, K] int64 global token ids (local + vocab_start)
+ stride_gm,
+ vocab_start,
+ K: tl.constexpr,
+ NBK_P: tl.constexpr,
+ KEY_BITS: tl.constexpr,
+):
+ """Stage 2 of the shard top-k: merge the chunks' keys into the shard's top K ids."""
+ # Stage 2: the row's top-K among the stage-1 candidates, placed exactly
+ # where torch.topk(sorted=False) places them.
+ m = tl.program_id(0).to(tl.int64)
+ offs = tl.arange(0, NBK_P)
+ valid = offs < NBK
+ key = tl.load(cand_keys_ptr + m * NBK + offs, mask=valid, other=-1)
+ idx = tl.load(cand_idx_ptr + m * NBK + offs, mask=valid, other=0).to(tl.int64)
+ selected, dest = _eagle4_topk_slots(key, K, KEY_BITS)
+ tl.store(local_idx_ptr + m * stride_lm + dest, idx, mask=selected)
+ tl.store(global_idx_ptr + m * stride_gm + dest, idx + vocab_start, mask=selected)
+
+
+def _eagle4_softmax_fp32(v, P: tl.constexpr):
+ # torch.softmax(fp32 row, -1) for a row of <= 1024 elements, bit exact:
+ # softmax_warp_forward keeps elements l, l+32, l+64, ... in lane l, sums
+ # them in that order from 0, reduces lanes with an xor butterfly
+ # (16, 8, 4, 2, 1) and divides with IEEE division. `v` is the row padded to
+ # P (power of two >= 32) with -inf.
+ ITER: tl.constexpr = P // 32
+ e = libdevice.exp(v - tl.max(v, axis=0))
+ e2 = tl.reshape(e, [ITER, 32])
+ it = tl.arange(0, ITER)[:, None]
+ lane_sum = tl.zeros([32], tl.float32)
+ for i in tl.static_range(ITER):
+ lane_sum = lane_sum + tl.sum(tl.where(it == i, e2, 0.0), axis=0)
+ s16 = tl.sum(tl.reshape(lane_sum, [2, 16]), axis=0)
+ s8 = tl.sum(tl.reshape(s16, [2, 8]), axis=0)
+ s4 = tl.sum(tl.reshape(s8, [2, 4]), axis=0)
+ s2 = tl.sum(tl.reshape(s4, [2, 2]), axis=0)
+ total = tl.sum(s2, axis=0)
+ return tl.math.div_rn(e, tl.broadcast_to(total, e.shape))
+
+
+def _eagle4_bitonic_round(g, STRIDE: tl.constexpr, HALF: tl.constexpr):
+ # One bitonicSwap round of torch's SmallBitonicSort (32 slots, descending
+ # GTOp) on packed entries (key << 11 | slot << 1 | valid): thread tx pairs
+ # pos = 2*tx - (tx & (STRIDE-1)) with pos + STRIDE and swaps when
+ # ((kA > kB && validA) || !validB) == ((tx & HALF) != 0); HALF == 0 is the
+ # final merge (flag always false).
+ NO: tl.constexpr = 32 // (2 * STRIDE)
+ side = tl.arange(0, 2)[None, :, None]
+ g3 = tl.reshape(g, [NO, 2, STRIDE])
+ a = tl.sum(tl.where(side == 0, g3, 0), axis=1)
+ b = tl.sum(tl.where(side == 1, g3, 0), axis=1)
+ tx = tl.arange(0, NO)[:, None] * STRIDE + tl.arange(0, STRIDE)[None, :]
+ flag = (tx & HALF) != 0
+ swap = (((a >> 11) > (b >> 11)) & ((a & 1) != 0)) | ((b & 1) == 0)
+ do = swap == flag
+ return tl.reshape(
+ tl.where(side == 0, tl.where(do, b, a)[:, None, :], tl.where(do, a, b)[:, None, :]),
+ [32],
+ )
+
+
+def _eagle4_small_bitonic_desc(g):
+ # torch SmallBitonicSort<32> descending: sizes 2..16, then the final merge.
+ g = _eagle4_bitonic_round(g, 1, 1)
+ g = _eagle4_bitonic_round(g, 2, 2)
+ g = _eagle4_bitonic_round(g, 1, 2)
+ g = _eagle4_bitonic_round(g, 4, 4)
+ g = _eagle4_bitonic_round(g, 2, 4)
+ g = _eagle4_bitonic_round(g, 1, 4)
+ g = _eagle4_bitonic_round(g, 8, 8)
+ g = _eagle4_bitonic_round(g, 4, 8)
+ g = _eagle4_bitonic_round(g, 2, 8)
+ g = _eagle4_bitonic_round(g, 1, 8)
+ g = _eagle4_bitonic_round(g, 16, 0)
+ g = _eagle4_bitonic_round(g, 8, 0)
+ g = _eagle4_bitonic_round(g, 4, 0)
+ g = _eagle4_bitonic_round(g, 2, 0)
+ g = _eagle4_bitonic_round(g, 1, 0)
+ return g
+
+
+def _eagle4_probs_topk(probs, slot, n, TOPK: tl.constexpr, P: tl.constexpr):
+ # fast_topk(probs, TOPK) for one row (slots < n valid, P <= 1024): returns
+ # (probs, slots) of the winners on a 32-wide vector, the first TOPK entries
+ # meaningful. TOPK == 1 is torch.max(dim) (first maximal index); TOPK > 1 is
+ # torch.topk(sorted=True): gather in topk(sorted=False) order, then the
+ # SmallBitonicSort network, ties included.
+ valid = slot < n
+ pkey = _eagle4_radix_key(probs, 32)
+ # (key desc, slot asc) as one int64, so every max is unique
+ ranked = tl.where(valid, (pkey << 10) | (P - 1 - slot), -1)
+ d = tl.arange(0, 32)
+ if TOPK == 1:
+ best = tl.max(ranked, axis=0)
+ out_key = tl.where(d == 0, best >> 10, 0)
+ out_slot = tl.where(d == 0, (P - 1 - (best & 1023)).to(tl.int32), 0)
+ else:
+ for i in tl.static_range(TOPK):
+ best = tl.max(ranked, axis=0)
+ ranked = tl.where(ranked == best, -1, ranked)
+ kth = best >> 10
+ gt, eq, gt_rank, eq_rank, n_gt, n_eq = _eagle4_split_at_kth(pkey, kth, valid)
+ selected = gt | (eq & (eq_rank < TOPK - n_gt))
+ dest = tl.where(gt, gt_rank, n_gt + eq_rank)
+ match = (dest[None, :] == d[:, None]) & selected[None, :]
+ packed = (pkey << 11) | (slot.to(tl.int64) << 1) | 1
+ g = _eagle4_small_bitonic_desc(tl.sum(tl.where(match, packed[None, :], 0), axis=1))
+ out_key = g >> 11
+ out_slot = ((g >> 1) & 1023).to(tl.int32)
+ return _eagle4_radix_key_to_fp32(out_key), out_slot
+
+
+def eagle4_candidate_tail_kernel(
+ cand_logits_ptr, # [R, M, NCL] candidate logits (16-bit or fp32, col stride 1)
+ stride_cl_r,
+ stride_cl_m,
+ cand_tokens_ptr, # [R, M, NCL] int64 or int32 global token ids
+ stride_ct_r,
+ stride_ct_m,
+ logits_out_ptr, # [M, NC] fp32 next_token_logits
+ stride_lo_m,
+ tokens_out_ptr, # [M, NC] int64 candidate ids (R > 1 only)
+ stride_to_m,
+ topk_probs_ptr, # [M, TOPK] fp32
+ stride_tp_m,
+ topk_tokens_ptr, # [M, TOPK] int64
+ stride_tt_m,
+ R: tl.constexpr,
+ NCL: tl.constexpr,
+ NC: tl.constexpr,
+ CP: tl.constexpr,
+ P: tl.constexpr,
+ KEY_BITS: tl.constexpr,
+ TOPK: tl.constexpr,
+):
+ """Candidate tail kernel: merge of the ranks' candidates, softmax and top-k of a row."""
+ # One row per program. R > 1: keep the NC best of the R*NCL gathered
+ # candidates in torch.topk(sorted=False) order and write them as fp32
+ # logits + ids; R == 1: just widen the NC logits to fp32. Then, for
+ # TOPK > 0, the draft tail softmax + top-k + id gather on those NC logits.
+ m = tl.program_id(0).to(tl.int64)
+ slot = tl.arange(0, P)
+ in_row = slot < NC
+ if R > 1:
+ offs = tl.arange(0, CP)
+ valid = offs < R * NCL
+ r = offs // NCL
+ j = offs % NCL
+ x = tl.load(
+ cand_logits_ptr + r * stride_cl_r + m * stride_cl_m + j, mask=valid, other=0.0
+ )
+ key = tl.where(valid, _eagle4_radix_key(x, KEY_BITS), -1)
+ selected, dest = _eagle4_topk_slots(key, NC, KEY_BITS)
+ tokens = tl.load(
+ cand_tokens_ptr + r * stride_ct_r + m * stride_ct_m + j, mask=selected, other=0
+ )
+ tl.store(logits_out_ptr + m * stride_lo_m + dest, x.to(tl.float32), mask=selected)
+ tl.store(tokens_out_ptr + m * stride_to_m + dest, tokens.to(tl.int64), mask=selected)
+ row_tokens_ptr = tokens_out_ptr + m * stride_to_m
+ # The compaction went through global memory: make it visible to the
+ # whole CTA and read it back in slot order (from L2, bypassing L1).
+ tl.debug_barrier()
+ v = tl.load(
+ logits_out_ptr + m * stride_lo_m + slot,
+ mask=in_row, other=float("-inf"), cache_modifier=".cg",
+ )
+ else:
+ v = tl.load(
+ cand_logits_ptr + m * stride_cl_m + slot, mask=in_row, other=float("-inf")
+ ).to(tl.float32)
+ tl.store(logits_out_ptr + m * stride_lo_m + slot, v, mask=in_row)
+ row_tokens_ptr = cand_tokens_ptr + m * stride_ct_m
+ if TOPK > 0:
+ probs = _eagle4_softmax_fp32(v, P)
+ top_probs, top_slots = _eagle4_probs_topk(probs, slot, NC, TOPK, P)
+ d = tl.arange(0, 32)
+ out = d < TOPK
+ top_tokens = tl.load(row_tokens_ptr + top_slots, mask=out, other=0, cache_modifier=".cg").to(tl.int64)
+ tl.store(topk_probs_ptr + m * stride_tp_m + d, top_probs, mask=out)
+ tl.store(topk_tokens_ptr + m * stride_tt_m + d, top_tokens, mask=out)
diff --git a/eagle_harness/kernels/csrc/candidate.cu b/eagle_harness/kernels/csrc/candidate.cu
new file mode 100644
index 0000000..c180267
--- /dev/null
+++ b/eagle_harness/kernels/csrc/candidate.cu
@@ -0,0 +1,681 @@
+// Copyright 2026 Eagle AI Corp.
+// SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+// EAGLE-4 candidate head: CUDA versions of the Triton kernels in candidate_triton.py (shard top-k
+// chunk + merge, candidate tail) with the same results bit for bit. Torch-free: a C ABI over raw
+// pointers and a stream (one binary per CUDA major serves every torch and Python), called through
+// ctypes by candidate.py; the shard top-k needs sm_90+ clusters, the tail runs from sm_80.
+//
+// Selection semantics (torch.topk(sorted=False), as the Triton kernels): keys are torch's
+// order-preserving radix keys (NaN largest); the K-th largest key `kth` is found exactly, then
+// the output holds the keys above kth in ascending position order followed by the kth ties in
+// ascending position order until K are taken.
+//
+// Shard top-k (one launch instead of chunk + merge): one cluster of 8 CTAs per row, each CTA a
+// contiguous 1/8 of the row, each thread E contiguous positions held as keys in registers.
+// Two 8-bit histogram passes (high byte, then the low byte of the keys in the K-th key's bin)
+// find kth; every CTA pushes its 256-bin histogram into every CTA's shared memory and one
+// cluster barrier per pass publishes them, so each CTA also knows how many selected keys the
+// earlier CTAs hold and writes its own selected positions straight to their output slots.
+// After the second barrier no CTA touches another's shared memory, so none waits at exit.
+//
+// Candidate tail: one CTA per row, one gathered candidate (rank r, column j: candidate order
+// r * NCL + j) per thread. The NC-th largest key by a bitwise radix select (one
+// __syncthreads_count per key bit), output slots by warp ballots; then warp 0 runs torch's
+// softmax_warp_forward arithmetic (lane l holds slots l, l + 32, ...; ternary max and
+// xor-butterfly reductions; expf; IEEE division) and fast_topk: the top_k largest
+// probabilities by repeated warp argmax (largest key, then lowest slot: torch.max for k = 1, and
+// torch.topk's selection), output in descending order when their keys are distinct; with ties
+// among them, torch.topk(sorted=True)'s order comes from replaying its gatherTopK placement and
+// the 32-wide SmallBitonicSort network on the selected entries.
+
+#include <cooperative_groups.h>
+#include <cuda_bf16.h>
+#include <cuda_fp16.h>
+#include <cuda_runtime.h>
+
+#include <cmath>
+#include <cstdint>
+
+namespace cg = cooperative_groups;
+
+namespace {
+
+constexpr int kCluster = 8;
+constexpr uint32_t kNegInf = 0xff800000u, kQuietNaN = 0x7fc00000u; // fp32 bit patterns
+
+template <typename T>
+__device__ __forceinline__ float to_float(T v);
+template <>
+__device__ __forceinline__ float to_float<__nv_bfloat16>(__nv_bfloat16 v) {
+ return __bfloat162float(v);
+}
+template <>
+__device__ __forceinline__ float to_float<__half>(__half v) {
+ return __half2float(v);
+}
+template <>
+__device__ __forceinline__ float to_float<float>(float v) {
+ return v;
+}
+
+// torch.topk's order-preserving key (TopKTypeConfig::convert); NaN maps to the maximum.
+template <typename T>
+__device__ __forceinline__ uint32_t radix_key(T v);
+template <>
+__device__ __forceinline__ uint32_t radix_key<__nv_bfloat16>(__nv_bfloat16 v) {
+ const uint32_t b = __bfloat16_as_ushort(v);
+ const uint32_t key = (b & 0x8000u) ? (b ^ 0xFFFFu) : (b ^ 0x8000u);
+ const float f = __bfloat162float(v);
+ return (f != f) ? 0xFFFFu : key;
+}
+template <>
+__device__ __forceinline__ uint32_t radix_key<__half>(__half v) {
+ const uint32_t b = __half_as_ushort(v);
+ const uint32_t key = (b & 0x8000u) ? (b ^ 0xFFFFu) : (b ^ 0x8000u);
+ const float f = __half2float(v);
+ return (f != f) ? 0xFFFFu : key;
+}
+template <>
+__device__ __forceinline__ uint32_t radix_key<float>(float v) {
+ const uint32_t b = __float_as_uint(v);
+ const uint32_t key = (b >> 31) ? ~b : (b | 0x80000000u);
+ return (v != v) ? 0xFFFFFFFFu : key;
+}
+
+__device__ __forceinline__ float radix_key_to_float(uint32_t key) {
+ const uint32_t b = (key >> 31) ? (key ^ 0x80000000u) : ~key;
+ return __uint_as_float(b);
+}
+
+template <typename T>
+__device__ __forceinline__ T zero_value();
+template <>
+__device__ __forceinline__ __nv_bfloat16 zero_value<__nv_bfloat16>() {
+ return __ushort_as_bfloat16(0);
+}
+template <>
+__device__ __forceinline__ __half zero_value<__half>() {
+ return __ushort_as_half(0);
+}
+template <>
+__device__ __forceinline__ float zero_value<float>() {
+ return 0.0f;
+}
+
+template <typename T>
+struct KeyBits {
+ static constexpr int value = 16;
+};
+template <>
+struct KeyBits<float> {
+ static constexpr int value = 32;
+};
+
+// ------------------------------------------------------------------------------------------
+// Shard top-k: one cluster of kCluster CTAs per row.
+
+// Exclusive prefix sum over the threads of the block (thread order), unsigned (two packed
+// 16-bit fields). All threads call it, once (s_warp is not reusable afterwards).
+template <int THREADS>
+__device__ __forceinline__ uint32_t block_exclusive_scan_once(uint32_t v, uint32_t* s_warp) {
+ constexpr int WARPS = THREADS / 32;
+ const int lane = threadIdx.x & 31, warp = threadIdx.x >> 5;
+ uint32_t incl = v;
+#pragma unroll
+ for (int off = 1; off < 32; off <<= 1) {
+ const uint32_t u = __shfl_up_sync(0xffffffffu, incl, off);
+ if (lane >= off) incl += u;
+ }
+ if (lane == 31) s_warp[warp] = incl;
+ __syncthreads();
+ uint32_t before = 0;
+#pragma unroll
+ for (int w = 0; w < WARPS; ++w) before += (w < warp) ? s_warp[w] : 0u;
+ return before + incl - v;
+}
+
+// One warp, after the cluster barrier: hist[c][bin] holds CTA c's histogram. Finds the bin b of
+// the cluster histogram g = sum_c hist[c] (keys in bin b are larger than those in b - 1) holding
+// the target-th largest key, S(b) >= target > S(b + 1) with S(b) = sum_{b' >= b} g[b'], and
+// writes b, S(b + 1), the same suffix sum over the CTAs before `rank` and their count in bin b.
+__device__ __forceinline__ void find_bin_warp(const int (*hist)[256], int rank, int target, int* out) {
+ const int lane = threadIdx.x & 31;
+ int gv[8], pv[8];
+#pragma unroll
+ for (int i = 0; i < 8; ++i) gv[i] = pv[i] = 0;
+#pragma unroll
+ for (int c = 0; c < kCluster; ++c) {
+ const int4 lo = reinterpret_cast<const int4*>(&hist[c][lane * 8])[0];
+ const int4 hi = reinterpret_cast<const int4*>(&hist[c][lane * 8])[1];
+ const int v[8] = {lo.x, lo.y, lo.z, lo.w, hi.x, hi.y, hi.z, hi.w};
+#pragma unroll
+ for (int i = 0; i < 8; ++i) {
+ gv[i] += v[i];
+ pv[i] += c < rank ? v[i] : 0;
+ }
+ }
+ int tg = 0, tp = 0;
+#pragma unroll
+ for (int i = 0; i < 8; ++i) {
+ tg += gv[i];
+ tp += pv[i];
+ }
+ // sums over the bins of the higher lanes
+ int sg = tg, sp = tp;
+#pragma unroll
+ for (int off = 1; off < 32; off <<= 1) {
+ const int ug = __shfl_down_sync(0xffffffffu, sg, off);
+ const int up = __shfl_down_sync(0xffffffffu, sp, off);
+ if (lane + off < 32) {
+ sg += ug;
+ sp += up;
+ }
+ }
+ int above_g = sg - tg, above_p = sp - tp; // bins > lane * 8 + 7
+#pragma unroll
+ for (int i = 7; i >= 0; --i) {
+ if (above_g < target && above_g + gv[i] >= target) {
+ out[0] = lane * 8 + i;
+ out[1] = above_g;
+ out[2] = above_p;
+ out[3] = pv[i];
+ }
+ above_g += gv[i];
+ above_p += pv[i];
+ }
+}
+
+template <typename T, int THREADS, int E>
+__global__ void __launch_bounds__(THREADS) eagle4_shard_topk_cluster_kernel(
+ const T* __restrict__ scores,
+ int64_t stride_sm,
+ int N,
+ int K,
+ int64_t* __restrict__ local_ids,
+ int64_t stride_lm,
+ int64_t* __restrict__ global_ids,
+ int64_t stride_gm,
+ int64_t vocab_start) {
+#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 900
+ __trap(); // clusters need sm_90; arch.clusters() keeps the launcher away from older GPUs
+#else
+ constexpr int WARPS = THREADS / 32;
+ constexpr int HISTS = WARPS < 16 ? WARPS : 16;
+ static_assert(THREADS >= 256 && THREADS % 32 == 0, "needs >= 256 threads");
+ __shared__ int s_wh[HISTS][256]; // per-warp(-pair) histograms
+ __shared__ __align__(16) int s_hist[2][kCluster][256]; // [pass][CTA]: pushed by every CTA
+ __shared__ uint32_t s_warp[WARPS];
+ __shared__ int s_val[8];
+
+ cg::cluster_group cluster = cg::this_cluster();
+ const int rank = static_cast<int>(cluster.block_rank());
+ const int m = blockIdx.y;
+ const int t = threadIdx.x, warp = t >> 5;
+ const T* row = scores + static_cast<int64_t>(m) * stride_sm;
+ const int pos0 = (rank * THREADS + t) * E;
+ // Distributed shared memory may only be written once its CTA runs: arrive now, wait before
+ // the first push (the other CTAs started long before then; the wait is short).
+ asm volatile("barrier.cluster.arrive.relaxed.aligned;\n" ::: "memory");
+
+ int keys[E]; // radix keys, -1 = no element
+#pragma unroll
+ for (int i = 0; i < E; ++i) keys[i] = -1;
+ const bool full = pos0 + E <= N;
+ if constexpr (sizeof(T) == 2 && E % 8 == 0) {
+ if (full && (reinterpret_cast<uintptr_t>(row + pos0) & 15u) == 0) {
+#pragma unroll
+ for (int v = 0; v < E / 8; ++v) {
+ const uint4 q = *reinterpret_cast<const uint4*>(row + pos0 + v * 8);
+ const T* h = reinterpret_cast<const T*>(&q);
+#pragma unroll
+ for (int i = 0; i < 8; ++i) keys[v * 8 + i] = static_cast<int>(radix_key<T>(h[i]));
+ }
+ } else {
+#pragma unroll
+ for (int i = 0; i < E; ++i)
+ if (pos0 + i < N) keys[i] = static_cast<int>(radix_key<T>(row[pos0 + i]));
+ }
+ } else {
+#pragma unroll
+ for (int i = 0; i < E; ++i)
+ if (pos0 + i < N) keys[i] = static_cast<int>(radix_key<T>(row[pos0 + i]));
+ }
+ for (int i = t; i < HISTS * 256; i += THREADS) (&s_wh[0][0])[i] = 0;
+ __syncthreads();
+
+ // Pass 1: histogram of the high byte, pushed into every CTA of the cluster.
+#pragma unroll
+ for (int i = 0; i < E; ++i)
+ if (keys[i] >= 0) atomicAdd(&s_wh[warp % HISTS][keys[i] >> 8], 1);
+ __syncthreads();
+ asm volatile("barrier.cluster.wait.aligned;\n" ::: "memory");
+ if (t < 256) {
+ int h = 0;
+#pragma unroll
+ for (int w = 0; w < HISTS; ++w) {
+ h += s_wh[w][t];
+ s_wh[w][t] = 0;
+ }
+#pragma unroll
+ for (int c = 0; c < kCluster; ++c) cluster.map_shared_rank(&s_hist[0][rank][t], c)[0] = h;
+ }
+ cluster.sync();
+ if (warp == 0) find_bin_warp(s_hist[0], rank, K, s_val);
+ __syncthreads();
+ const int b1 = s_val[0]; // high byte of the K-th largest key
+ const int above1 = s_val[1]; // keys with a larger high byte
+ const int pre_above = s_val[2]; // ... of them in the earlier CTAs
+
+ // Pass 2: histogram of the low byte of the keys in bin b1.
+#pragma unroll
+ for (int i = 0; i < E; ++i)
+ if (keys[i] >= 0 && (keys[i] >> 8) == b1) atomicAdd(&s_wh[warp % HISTS][keys[i] & 255], 1);
+ __syncthreads();
+ if (t < 256) {
+ int h = 0;
+#pragma unroll
+ for (int w = 0; w < HISTS; ++w) h += s_wh[w][t];
+#pragma unroll
+ for (int c = 0; c < kCluster; ++c) cluster.map_shared_rank(&s_hist[1][rank][t], c)[0] = h;
+ }
+ // After this barrier no CTA touches another's shared memory, so none has to wait at exit.
+ cluster.sync();
+ if (warp == 0) find_bin_warp(s_hist[1], rank, K - above1, s_val + 4);
+ __syncthreads();
+ const int kth = (b1 << 8) | s_val[4];
+ const int n_gt = above1 + s_val[5]; // keys above kth
+ const int base_gt = pre_above + s_val[6]; // ... of them in the earlier CTAs
+ const int base_eq = s_val[7]; // kth ties in the earlier CTAs
+ const int remaining = K - n_gt; // kth ties to take, in position order
+
+ // Pass 3: place this chunk's selected positions.
+ int n_gt_t = 0, n_eq_t = 0;
+#pragma unroll
+ for (int i = 0; i < E; ++i) {
+ n_gt_t += keys[i] > kth;
+ n_eq_t += keys[i] == kth;
+ }
+ const uint32_t packed = block_exclusive_scan_once<THREADS>(
+ static_cast<uint32_t>(n_gt_t) | (static_cast<uint32_t>(n_eq_t) << 16), s_warp);
+ int slot_gt = base_gt + static_cast<int>(packed & 0xFFFFu);
+ int rank_eq = base_eq + static_cast<int>(packed >> 16);
+ int64_t* lrow = local_ids + static_cast<int64_t>(m) * stride_lm;
+ int64_t* grow = global_ids + static_cast<int64_t>(m) * stride_gm;
+ if (n_gt_t + n_eq_t > 0) {
+#pragma unroll
+ for (int i = 0; i < E; ++i) {
+ int slot = -1;
+ if (keys[i] > kth) {
+ slot = slot_gt++;
+ } else if (keys[i] == kth) {
+ if (rank_eq < remaining) slot = n_gt + rank_eq;
+ ++rank_eq;
+ }
+ if (slot >= 0) {
+ const int64_t pos = pos0 + i;
+ lrow[slot] = pos;
+ grow[slot] = pos + vocab_start;
+ }
+ }
+ }
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+// Candidate tail: one CTA per row.
+
+// One bitonicSwap round of torch's SmallBitonicSort<32> (descending, invalid entries last) on
+// packed entries (rank code << 6 | selection index << 1 | valid), lane = position; the codes
+// order the keys like the keys themselves (equal codes for equal keys).
+__device__ __forceinline__ uint32_t bitonic_round(uint32_t g, int lane, int stride, int log2_stride, int half) {
+ const uint32_t other = __shfl_xor_sync(0xffffffffu, g, stride);
+ const bool is_a = (lane & stride) == 0;
+ const uint32_t a = is_a ? g : other;
+ const uint32_t b = is_a ? other : g;
+ const int pos = is_a ? lane : (lane ^ stride);
+ const int tx = ((pos >> (log2_stride + 1)) << log2_stride) | (pos & (stride - 1));
+ const bool flag = half != 0 && (tx & half) != 0;
+ const bool swap = (((a >> 6) > (b >> 6)) && (a & 1u)) || !(b & 1u);
+ const bool exchange = swap == flag;
+ return is_a ? (exchange ? b : a) : (exchange ? a : b);
+}
+
+template <typename LT, typename TT, int ITER>
+__global__ void __launch_bounds__(1024) eagle4_candidate_tail_cuda_kernel(
+ const LT* __restrict__ cand_logits,
+ int64_t stride_cl_r,
+ int64_t stride_cl_m,
+ const TT* __restrict__ cand_tokens,
+ int64_t stride_ct_r,
+ int64_t stride_ct_m,
+ float* __restrict__ logits_out,
+ int64_t stride_lo_m,
+ int64_t* __restrict__ tokens_out,
+ int64_t stride_to_m,
+ float* __restrict__ topk_probs,
+ int64_t stride_tp_m,
+ int64_t* __restrict__ topk_tokens,
+ int64_t stride_tt_m,
+ int R,
+ int NCL,
+ int NC,
+ int topk) {
+ constexpr int KEY_BITS = KeyBits<LT>::value;
+ constexpr int P = ITER * 32; // next power of two >= NC (NC is a power of two >= 32)
+ __shared__ float s_logit[P];
+ __shared__ int64_t s_tok[P];
+ __shared__ uint16_t s_code[P];
+ __shared__ int s_wg[32];
+ __shared__ int s_we[32];
+ __shared__ uint32_t s_pack[32];
+
+ const int64_t m = blockIdx.x;
+ const int t = threadIdx.x, lane = t & 31, warp = t >> 5;
+ if (R > 1) {
+ const int W = R * NCL;
+ const bool valid = t < W;
+ const int r = valid ? t / NCL : 0;
+ const int j = valid ? t - r * NCL : 0;
+ LT x = zero_value<LT>();
+ int64_t tok = 0;
+ if (valid) {
+ x = cand_logits[r * stride_cl_r + m * stride_cl_m + j];
+ tok = cand_tokens[r * stride_ct_r + m * stride_ct_m + j];
+ }
+ const uint32_t key = valid ? radix_key<LT>(x) : 0u;
+ // The NC-th largest key, bit by bit from the top (as torch's radix select, one bit per
+ // block-wide count).
+ uint32_t prefix = 0u;
+ int remaining = NC;
+#pragma unroll
+ for (int bit = KEY_BITS - 1; bit >= 0; --bit) {
+ const uint32_t cand = prefix | (1u << bit);
+ const uint32_t hi = ~((1u << bit) - 1u);
+ const int c = __syncthreads_count(valid && (key & hi) == cand);
+ if (c >= remaining) {
+ prefix = cand;
+ } else {
+ remaining -= c;
+ }
+ }
+ const uint32_t kth = prefix;
+ const int n_gt = NC - remaining;
+ const bool gt = valid && key > kth;
+ const bool eq = valid && key == kth;
+ const unsigned bg = __ballot_sync(0xffffffffu, gt);
+ const unsigned be = __ballot_sync(0xffffffffu, eq);
+ if (lane == 0) {
+ s_wg[warp] = __popc(bg);
+ s_we[warp] = __popc(be);
+ }
+ __syncthreads();
+ int pg = 0, pe = 0;
+ for (int w = 0; w < warp; ++w) {
+ pg += s_wg[w];
+ pe += s_we[w];
+ }
+ const unsigned lt_mask = (1u << lane) - 1u;
+ const int rg = pg + __popc(bg & lt_mask);
+ const int re = pe + __popc(be & lt_mask);
+ if (gt || (eq && re < remaining)) {
+ const int dest = gt ? rg : n_gt + re;
+ const float f = to_float<LT>(x);
+ logits_out[m * stride_lo_m + dest] = f;
+ tokens_out[m * stride_to_m + dest] = tok;
+ s_logit[dest] = f;
+ s_tok[dest] = tok;
+ }
+ } else {
+ for (int i = t; i < NC; i += blockDim.x) {
+ const float f = to_float<LT>(cand_logits[m * stride_cl_m + i]);
+ logits_out[m * stride_lo_m + i] = f;
+ s_logit[i] = f;
+ if (topk > 0) s_tok[i] = cand_tokens[m * stride_ct_m + i];
+ }
+ }
+ if (topk == 0) return;
+ __syncthreads();
+ if (warp != 0) return;
+
+ // torch softmax_warp_forward (fp32, WARP_SIZE 32, WARP_ITERATIONS = P / 32), one row.
+ float e[ITER];
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) {
+ const int idx = lane + it * 32;
+ e[it] = idx < NC ? s_logit[idx] : __uint_as_float(kNegInf);
+ }
+ float mx = e[0];
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) mx = mx > e[it] ? mx : e[it];
+#pragma unroll
+ for (int off = 16; off > 0; off >>= 1) {
+ const float b = __shfl_xor_sync(0xffffffffu, mx, off);
+ mx = mx < b ? b : mx;
+ }
+ float sum = 0.0f;
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) {
+ e[it] = expf(e[it] - mx);
+ sum += e[it];
+ }
+#pragma unroll
+ for (int off = 16; off > 0; off >>= 1) sum = sum + __shfl_xor_sync(0xffffffffu, sum, off);
+ uint32_t pk[ITER];
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) {
+ const float p = (sum == 0.0f) ? __uint_as_float(kQuietNaN) : e[it] / sum;
+ pk[it] = radix_key<float>(p);
+ }
+
+ // fast_topk(probs, topk) over the slots lane + 32 * it (valid below NC): the topk largest
+ // (key, then lowest slot) by repeated warp argmax; lane i keeps the i-th.
+ unsigned live = 0;
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) live |= (lane + it * 32 < NC) ? (1u << it) : 0u;
+ uint32_t sel_key = 0, prev = 0;
+ int sel_slot = 0;
+ bool distinct = true;
+ for (int i = 0; i < topk; ++i) {
+ uint32_t lk = 0; // valid keys are >= radix_key(+0.0f) = 0x80000000
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) lk = ((live >> it) & 1u) && pk[it] > lk ? pk[it] : lk;
+ const uint32_t gk = __reduce_max_sync(0xffffffffu, lk);
+ uint32_t ls = 0;
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) {
+ const uint32_t c = static_cast<uint32_t>(P - (lane + it * 32));
+ ls = ((live >> it) & 1u) && pk[it] == gk && c > ls ? c : ls;
+ }
+ const int slot = P - static_cast<int>(__reduce_max_sync(0xffffffffu, ls));
+ if ((slot & 31) == lane) live &= ~(1u << (slot >> 5));
+ if (lane == i) {
+ sel_key = gk;
+ sel_slot = slot;
+ }
+ distinct = distinct && (i == 0 || gk != prev);
+ prev = gk;
+ }
+ if (distinct) { // torch.max (k = 1) / any sort of distinct keys: descending key order
+ if (lane < topk) {
+ topk_probs[m * stride_tp_m + lane] = radix_key_to_float(sel_key);
+ topk_tokens[m * stride_tt_m + lane] = s_tok[sel_slot];
+ }
+ return;
+ }
+ // Ties among the selected keys: torch.topk(sorted=True)'s order, i.e. the gatherTopK
+ // placement (keys above the k-th largest in slot order, then its ties in slot order) ...
+ const uint32_t kth = prev;
+ const unsigned lt_mask = (1u << lane) - 1u;
+ const int n_gt = __popc(__ballot_sync(0xffffffffu, lane < topk && sel_key > kth));
+ {
+ // code: 32 - (index of the key among the distinct selected keys, largest first)
+ const uint32_t up = __shfl_up_sync(0xffffffffu, sel_key, 1);
+ const unsigned starts = __ballot_sync(0xffffffffu, lane < topk && (lane == 0 || sel_key != up));
+ const int distinct_index = __popc(starts & ((2u << lane) - 1u)) - 1;
+ if (lane < topk) s_code[sel_slot] = static_cast<uint16_t>(((32 - distinct_index) << 5) | lane);
+ }
+ s_pack[lane] = 0;
+ __syncwarp();
+ int seen_gt = 0, seen_eq = 0;
+#pragma unroll
+ for (int it = 0; it < ITER; ++it) {
+ const int slot = lane + it * 32;
+ const bool valid = slot < NC;
+ const bool gt = valid && pk[it] > kth;
+ const bool eq = valid && pk[it] == kth;
+ const unsigned bg = __ballot_sync(0xffffffffu, gt);
+ const unsigned be = __ballot_sync(0xffffffffu, eq);
+ const int rg = seen_gt + __popc(bg & lt_mask);
+ const int re = seen_eq + __popc(be & lt_mask);
+ if (gt || (eq && re < topk - n_gt)) {
+ const int dest = gt ? rg : n_gt + re;
+ s_pack[dest] = (static_cast<uint32_t>(s_code[slot]) << 1) | 1u;
+ }
+ seen_gt += __popc(bg);
+ seen_eq += __popc(be);
+ }
+ __syncwarp();
+ // ... then the SmallBitonicSort<32> network (sizes 2..16, then the final merge).
+ uint32_t g = s_pack[lane];
+ g = bitonic_round(g, lane, 1, 0, 1);
+ g = bitonic_round(g, lane, 2, 1, 2);
+ g = bitonic_round(g, lane, 1, 0, 2);
+ g = bitonic_round(g, lane, 4, 2, 4);
+ g = bitonic_round(g, lane, 2, 1, 4);
+ g = bitonic_round(g, lane, 1, 0, 4);
+ g = bitonic_round(g, lane, 8, 3, 8);
+ g = bitonic_round(g, lane, 4, 2, 8);
+ g = bitonic_round(g, lane, 2, 1, 8);
+ g = bitonic_round(g, lane, 1, 0, 8);
+ g = bitonic_round(g, lane, 16, 4, 0);
+ g = bitonic_round(g, lane, 8, 3, 0);
+ g = bitonic_round(g, lane, 4, 2, 0);
+ g = bitonic_round(g, lane, 2, 1, 0);
+ g = bitonic_round(g, lane, 1, 0, 0);
+ const int idx = static_cast<int>((g >> 1) & 31u); // the entry's selection index
+ const uint32_t out_key = __shfl_sync(0xffffffffu, sel_key, idx);
+ const int out_slot = __shfl_sync(0xffffffffu, sel_slot, idx);
+ if (lane < topk) {
+ topk_probs[m * stride_tp_m + lane] = radix_key_to_float(out_key);
+ topk_tokens[m * stride_tt_m + lane] = s_tok[out_slot];
+ }
+}
+
+// ------------------------------------------------------------------------------------------
+// C ABI. Every entry returns 0 (launched), kNotCovered (nothing launched: the caller runs its
+// fallback) or a CUDA error code. dtype: 0 bfloat16, 1 float16, 2 float32.
+
+constexpr int kNotCovered = -1;
+
+template <typename T, int THREADS, int E>
+int launch_shard_topk(const void* scores, int64_t stride_sm, int M, int N, int K, int64_t* local_ids,
+ int64_t stride_lm, int64_t* global_ids, int64_t stride_gm, int64_t vocab_start,
+ cudaStream_t stream) {
+ cudaLaunchAttribute attr;
+ attr.id = cudaLaunchAttributeClusterDimension;
+ attr.val.clusterDim = {kCluster, 1, 1};
+ cudaLaunchConfig_t config = {};
+ config.gridDim = dim3(kCluster, M);
+ config.blockDim = dim3(THREADS);
+ config.stream = stream;
+ config.attrs = &attr;
+ config.numAttrs = 1;
+ return cudaLaunchKernelEx(&config, eagle4_shard_topk_cluster_kernel<T, THREADS, E>, static_cast<const T*>(scores),
+ stride_sm, N, K, local_ids, stride_lm, global_ids, stride_gm, vocab_start);
+}
+
+template <typename T>
+int dispatch_shard_topk(const void* scores, int64_t stride_sm, int M, int N, int K, int64_t* local_ids,
+ int64_t stride_lm, int64_t* global_ids, int64_t stride_gm, int64_t vocab_start,
+ cudaStream_t stream) {
+#define EAGLE4_TOPK_CASE(THREADS, E) \
+ return launch_shard_topk<T, THREADS, E>(scores, stride_sm, M, N, K, local_ids, stride_lm, global_ids, \
+ stride_gm, vocab_start, stream)
+ if (N <= kCluster * 512 * 8) EAGLE4_TOPK_CASE(512, 8); // TP8 shards of 248320
+ if (N <= kCluster * 1024 * 8) EAGLE4_TOPK_CASE(1024, 8); // TP4
+ if (N <= kCluster * 1024 * 16) EAGLE4_TOPK_CASE(1024, 16); // TP2
+ if (N <= kCluster * 1024 * 32) EAGLE4_TOPK_CASE(1024, 32); // TP1
+#undef EAGLE4_TOPK_CASE
+ return kNotCovered;
+}
+
+template <typename LT, typename TT, int ITER>
+int launch_tail(const void* cl, int64_t cl_r, int64_t cl_m, const void* ct, int64_t ct_r, int64_t ct_m,
+ float* logits_out, int64_t lo_m, int64_t* tokens_out, int64_t to_m, float* topk_probs,
+ int64_t tp_m, int64_t* topk_tokens, int64_t tt_m, int R, int M, int NCL, int NC, int topk,
+ cudaStream_t stream) {
+ const int threads = R > 1 ? ((R * NCL + 31) / 32) * 32 : (NC < 1024 ? NC : 1024);
+ eagle4_candidate_tail_cuda_kernel<LT, TT, ITER><<<static_cast<unsigned>(M), threads, 0, stream>>>(
+ static_cast<const LT*>(cl), cl_r, cl_m, static_cast<const TT*>(ct), ct_r, ct_m, logits_out, lo_m, tokens_out,
+ to_m, topk_probs, tp_m, topk_tokens, tt_m, R, NCL, NC, topk);
+ return cudaGetLastError();
+}
+
+template <typename LT, typename TT>
+int dispatch_tail(const void* cl, int64_t cl_r, int64_t cl_m, const void* ct, int64_t ct_r, int64_t ct_m,
+ float* logits_out, int64_t lo_m, int64_t* tokens_out, int64_t to_m, float* topk_probs,
+ int64_t tp_m, int64_t* topk_tokens, int64_t tt_m, int R, int M, int NCL, int NC, int topk,
+ cudaStream_t stream) {
+ switch (NC) {
+#define EAGLE4_TAIL_CASE(NCV, ITERV) \
+ case NCV: \
+ return launch_tail<LT, TT, ITERV>(cl, cl_r, cl_m, ct, ct_r, ct_m, logits_out, lo_m, tokens_out, to_m, \
+ topk_probs, tp_m, topk_tokens, tt_m, R, M, NCL, NC, topk, stream);
+ EAGLE4_TAIL_CASE(32, 1)
+ EAGLE4_TAIL_CASE(64, 2)
+ EAGLE4_TAIL_CASE(128, 4)
+ EAGLE4_TAIL_CASE(256, 8)
+#undef EAGLE4_TAIL_CASE
+ default:
+ return kNotCovered;
+ }
+}
+
+} // namespace
+
+extern "C" {
+
+// scores [M, N] (unit column stride) -> local_ids / global_ids [M, K] int64, torch.topk(sorted=False) order.
+int eagle4_shard_topk(int device, int dtype, const void* scores, int64_t stride_sm, int M, int N, int K,
+ int64_t* local_ids, int64_t stride_lm, int64_t* global_ids, int64_t stride_gm,
+ int64_t vocab_start, cudaStream_t stream) {
+ if (M == 0) return 0;
+ if (K < 1 || K > N || K > 32767 || M > 65535) return kNotCovered;
+ if (cudaError_t e = cudaSetDevice(device)) return e;
+ if (dtype == 0)
+ return dispatch_shard_topk<__nv_bfloat16>(scores, stride_sm, M, N, K, local_ids, stride_lm, global_ids,
+ stride_gm, vocab_start, stream);
+ if (dtype == 1)
+ return dispatch_shard_topk<__half>(scores, stride_sm, M, N, K, local_ids, stride_lm, global_ids, stride_gm,
+ vocab_start, stream);
+ return kNotCovered;
+}
+
+// cand_logits / cand_tokens: [R, M, NCL] views (any rank / row strides, unit column stride); tokens are int64,
+// or int32 with fp32 logits (the packed TP gather). tokens_out is unused for R == 1; topk_probs / topk_tokens
+// for topk == 0.
+int eagle4_candidate_tail(int device, int dtype, int token_bytes, const void* cand_logits, int64_t cl_r,
+ int64_t cl_m, const void* cand_tokens, int64_t ct_r, int64_t ct_m, float* logits_out,
+ int64_t lo_m, int64_t* tokens_out, int64_t to_m, float* topk_probs, int64_t tp_m,
+ int64_t* topk_tokens, int64_t tt_m, int R, int M, int NCL, int NC, int topk,
+ cudaStream_t stream) {
+ if (M == 0) return 0;
+ if (NCL != NC || R < 1 || R * NCL > 1024 || topk < 0 || topk > 32) return kNotCovered;
+ if (cudaError_t e = cudaSetDevice(device)) return e;
+#define EAGLE4_TAIL_CALL(LT, TT) \
+ return dispatch_tail<LT, TT>(cand_logits, cl_r, cl_m, cand_tokens, ct_r, ct_m, logits_out, lo_m, \
+ tokens_out, to_m, topk_probs, tp_m, topk_tokens, tt_m, R, M, NCL, NC, \
+ topk, stream)
+ if (token_bytes == 8) {
+ if (dtype == 0) EAGLE4_TAIL_CALL(__nv_bfloat16, int64_t);
+ if (dtype == 1) EAGLE4_TAIL_CALL(__half, int64_t);
+ if (dtype == 2) EAGLE4_TAIL_CALL(float, int64_t);
+ } else if (token_bytes == 4 && dtype == 2) {
+ EAGLE4_TAIL_CALL(float, int32_t);
+ }
+#undef EAGLE4_TAIL_CALL
+ return kNotCovered;
+}
+
+} // extern "C"
diff --git a/eagle_harness/kernels/gather_dot.py b/eagle_harness/kernels/gather_dot.py
new file mode 100644
index 0000000..c361c21
--- /dev/null
+++ b/eagle_harness/kernels/gather_dot.py
@@ -0,0 +1,170 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Score gathered LM-head rows: ``out[b, k] = weight[indices[b, k]] . hidden[b]``, products and sum in fp32.
+
+Products and tile sums are fp32: bf16 ones give a logit error of 2.7% on average (20x a bf16 GEMM's), fp32 products are
+exact. The per-row-count tile table is tuned on B300 (static, so CUDA-graph safe). :func:`gather_dot` stores the hidden
+dtype. :func:`gather_dot_packed` is the TP variant that fuses the candidate packing of the all-gather into the same
+launch: ``[rows, 2K]`` int32 holding the logits (rounded to the hidden dtype, as fp32 bits) and then
+``indices + vocab_start``, the layout :func:`~eagle_harness.kernels.candidate_ops.candidate_topk` all-gathers and the
+candidate tail reads, in place of four elementwise launches.
+"""
+
+from __future__ import annotations
+
+from typing import NamedTuple, Optional
+
+import torch
+import triton
+import triton.language as tl
+
+
+class _Tiles(NamedTuple):
+ block_k: int
+ block_h: int
+ num_warps: int
+ num_stages: int
+
+
+def _tiles(rows: int) -> _Tiles:
+ # One candidate per program and two warps up to 16 rows (the draft step's 4 to 16), two candidates per program
+ # beyond: the fp32 products are register-heavy, so wide-warp tiles lost. Swept on B300 (62080 x 5120 bf16,
+ # block_k 1-16, block_h 256-2048, warps 2-8, stages 2-4); static, so CUDA-graph safe.
+ if rows <= 16:
+ return _Tiles(1, 2048, 2, 3)
+ if rows <= 32:
+ return _Tiles(2, 2048, 2, 3)
+ return _Tiles(2, 1024, 2, 3)
+
+
+def _gather_dot_kernel(
+ weight_ptr, # [V, H] lm_head weight
+ indices_ptr, # [B, K] candidate vocab ids
+ hidden_ptr, # [B, H]
+ output_ptr, # [B, K] hidden dtype, or [B, 2K] int32 when PACKED
+ stride_w_v,
+ stride_w_h,
+ stride_i_b,
+ stride_i_k,
+ stride_h_b,
+ stride_h_h,
+ stride_o_b,
+ stride_o_k,
+ vocab_start,
+ K,
+ H: tl.constexpr,
+ BLOCK_K: tl.constexpr,
+ BLOCK_H: tl.constexpr,
+ PACKED: tl.constexpr,
+):
+ # Each program handles BLOCK_K candidates of one row, so hidden[b, :] is loaded once per tile instead of once per
+ # candidate (the K-per-program variant spent half its bandwidth re-reading hidden).
+ pid_b = tl.program_id(0)
+ pid_k = tl.program_id(1)
+
+ k_offs = pid_k * BLOCK_K + tl.arange(0, BLOCK_K)
+ k_mask = k_offs < K
+ # int64: vocab_id * stride_w_v can exceed int32 for large vocab * hidden.
+ vocab_ids = tl.load(indices_ptr + pid_b * stride_i_b + k_offs * stride_i_k, mask=k_mask, other=0).to(tl.int64)
+
+ acc = tl.zeros((BLOCK_K,), dtype=tl.float32)
+ EVEN_H: tl.constexpr = H % BLOCK_H == 0
+ for off_h in range(0, H, BLOCK_H):
+ cols = off_h + tl.arange(0, BLOCK_H)
+ if EVEN_H:
+ h_val = tl.load(hidden_ptr + pid_b * stride_h_b + cols * stride_h_h)
+ w_val = tl.load(
+ weight_ptr + vocab_ids[:, None] * stride_w_v + cols[None, :] * stride_w_h,
+ mask=k_mask[:, None],
+ other=0.0,
+ )
+ else:
+ h_mask = cols < H
+ h_val = tl.load(hidden_ptr + pid_b * stride_h_b + cols * stride_h_h, mask=h_mask, other=0.0)
+ w_val = tl.load(
+ weight_ptr + vocab_ids[:, None] * stride_w_v + cols[None, :] * stride_w_h,
+ mask=k_mask[:, None] & h_mask[None, :],
+ other=0.0,
+ )
+ acc += tl.sum(w_val.to(tl.float32) * h_val.to(tl.float32)[None, :], axis=1)
+
+ out_row = output_ptr + pid_b * stride_o_b
+ if PACKED:
+ logits = acc.to(hidden_ptr.dtype.element_ty).to(tl.float32)
+ tl.store(out_row + k_offs * stride_o_k, logits.to(tl.int32, bitcast=True), mask=k_mask)
+ tl.store(out_row + (K + k_offs) * stride_o_k, (vocab_ids + vocab_start).to(tl.int32), mask=k_mask)
+ else:
+ tl.store(out_row + k_offs * stride_o_k, acc.to(output_ptr.dtype.element_ty), mask=k_mask)
+
+
+def gather_dot_reference(weight: torch.Tensor, indices: torch.Tensor, hidden: torch.Tensor) -> torch.Tensor:
+ """The same product in torch (fp32 accumulate); for CPU and tests."""
+ rows = weight[indices.long()].float() # [B, K, H]
+ return torch.einsum("bkh,bh->bk", rows, hidden.float()).to(hidden.dtype)
+
+
+def pack_reference(logits: torch.Tensor, token_ids: torch.Tensor) -> torch.Tensor:
+ """``[rows, 2K]`` int32: the fp32 logit bits, then the token ids (vocab ids fit in int32)."""
+ return torch.cat([logits.float().view(torch.int32), token_ids.to(torch.int32)], dim=-1)
+
+
+def _launch(
+ weight: torch.Tensor,
+ indices: torch.Tensor,
+ hidden: torch.Tensor,
+ output: torch.Tensor,
+ vocab_start: int,
+ packed: bool,
+) -> None:
+ rows, k = indices.shape
+ h = weight.shape[1]
+ tiles = _tiles(rows)
+ _gather_dot_kernel[(rows, triton.cdiv(k, tiles.block_k))](
+ weight, indices, hidden, output,
+ weight.stride(0), weight.stride(1), indices.stride(0), indices.stride(1),
+ hidden.stride(0), hidden.stride(1), output.stride(0), output.stride(1),
+ vocab_start, k,
+ H=h, BLOCK_K=tiles.block_k, BLOCK_H=min(tiles.block_h, triton.next_power_of_2(h)), PACKED=packed,
+ num_warps=tiles.num_warps, num_stages=tiles.num_stages,
+ ) # fmt: skip
+
+
+def _check(weight: torch.Tensor, indices: torch.Tensor, hidden: torch.Tensor) -> None:
+ if hidden.shape != (indices.shape[0], weight.shape[1]):
+ raise ValueError(f"hidden {tuple(hidden.shape)} != ({indices.shape[0]}, {weight.shape[1]})")
+
+
+def gather_dot(
+ weight: torch.Tensor, indices: torch.Tensor, hidden: torch.Tensor, out: Optional[torch.Tensor] = None
+) -> torch.Tensor:
+ """``weight`` [V, H], ``indices`` [B, K] (row ids into ``weight``), ``hidden`` [B, H] -> [B, K]."""
+ _check(weight, indices, hidden)
+ rows, k = indices.shape
+ if not weight.is_cuda:
+ result = gather_dot_reference(weight, indices, hidden)
+ if out is None:
+ return result
+ out.copy_(result)
+ return out
+ output = torch.empty((rows, k), device=indices.device, dtype=hidden.dtype) if out is None else out
+ if output.shape != (rows, k) or output.dtype != hidden.dtype:
+ raise ValueError(f"out {tuple(output.shape)} {output.dtype} != ({rows}, {k}) {hidden.dtype}")
+ if rows and k:
+ _launch(weight, indices, hidden, output, 0, packed=False)
+ return output
+
+
+def gather_dot_packed(
+ weight: torch.Tensor, indices: torch.Tensor, hidden: torch.Tensor, vocab_start: int
+) -> torch.Tensor:
+ """:func:`gather_dot` fused with :func:`pack_reference` of ``(result, indices + vocab_start)``: [B, 2K] int32."""
+ _check(weight, indices, hidden)
+ rows, k = indices.shape
+ if not weight.is_cuda:
+ return pack_reference(gather_dot_reference(weight, indices, hidden), indices + vocab_start)
+ output = torch.empty((rows, 2 * k), device=indices.device, dtype=torch.int32)
+ if rows and k:
+ _launch(weight, indices, hidden, output, vocab_start, packed=True)
+ return output
diff --git a/eagle_harness/kernels/gdn_tree.py b/eagle_harness/kernels/gdn_tree.py
new file mode 100644
index 0000000..e862a8e
--- /dev/null
+++ b/eagle_harness/kernels/gdn_tree.py
@@ -0,0 +1,242 @@
+# SPDX-FileCopyrightText: Copyright 2023-2024 SGLang Team
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+# SPDX-FileCopyrightText: Copyright (c) 2024, Tri Dao
+# Derived from sglang (Apache-2.0): the tree conv from python/sglang/kernels/ops/mamba/causal_conv1d_triton.py (itself
+# adapted from vLLM and causal-conv1d, BSD-3-Clause) and the recurrence from
+# python/sglang/kernels/ops/attention/fla/fused_sigmoid_gating_recurrent.py (sglang's fla kernels adapt
+# flash-linear-attention, MIT). Modified by Eagle AI Corp: ancestor tables, slot tables for both engines, path replay.
+# Notices and license texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""GDN tree verify kernels.
+
+A tree verify of a gated delta net layer runs, per node, the width-4 causal conv1d and the gated delta rule
+recurrence, each node continuing from its parent. The kernels are drop-in equivalents of the tree paths of
+``causal_conv1d_update`` and ``fused_sigmoid_gating_delta_rule_update`` (tree links, per-node conv windows and SSM
+snapshots, no state write-back), in three modules:
+
+- this module derives the tree once per forward from the first-child / next-sibling links
+ (:func:`gdn_tree_ancestors`): the parent table the recurrence reads, the three window ancestors of every node for the
+ conv and, for the path replay, the first-child chains;
+- ``gdn_tree_conv``: the conv gathers each node's window through the ancestor table instead of chasing the links in
+ every layer and channel block;
+- ``gdn_tree_recurrence``: the recurrence walks the nodes in order with the next step's parent index and inputs
+ prefetched, or replays each chain's root path from the request state (few rows, fp32 state); its Gluon twin
+ (``gdn_tree_gluon``) runs the walk bitwise faster on B300.
+
+Conv output (16-bit inputs), conv windows, conv state and the parent table are bit-identical to the upstream kernels.
+The recurrence computes the upstream kernel's math; its snapshots can differ from the upstream kernel's in the last
+bit: the walk compiles without FMA contraction and writes its multiply-adds as FMAs. States are addressed through slot
+tables, so the kernels serve sglang's layout (a scratch row of snapshots per request) and vLLM's (one state slot per
+verify row) alike.
+"""
+
+from __future__ import annotations
+
+from typing import Optional
+
+import torch
+import triton
+import triton.language as tl
+
+PAD_SLOT_ID = -1 # a padded request row of a batch (sglang's causal_conv1d PAD_SLOT_ID)
+
+
+def _gdn_tree_paths(
+ parents_in, # (NP2_SEQLEN,) parent links of one request
+ idx_tokens,
+ num_tokens, # verify tokens of the request, <= seqlen
+ paths_ptr, # this request's (seqlen, 2 + seqlen) rows
+ stride_paths_path,
+ seqlen: tl.constexpr,
+):
+ # Row p is [length, write_from, root path...] of the request's p-th leaf in node order; the path's nodes at depth
+ # >= write_from are the leaf's chain (its run of first children). Every node is on exactly one chain; rows past
+ # the leaf count have length 0. Links must be ancestor-first (parent < node), as the recurrence walk requires;
+ # other parents are replaced by node - 1 so the table stays in bounds.
+ valid = idx_tokens < num_tokens
+ parents = tl.where(
+ (idx_tokens > 0) & (parents_in >= 0) & (parents_in < idx_tokens),
+ parents_in,
+ tl.maximum(idx_tokens - 1, 0),
+ )
+ # one pass in node order; per node, packed: depth | chain-start depth << 8 | has-a-child << 16
+ packed = tl.zeros(idx_tokens.shape, dtype=tl.int32)
+ for idx_token in range(1, seqlen):
+ parent = tl.sum(tl.where(idx_tokens == idx_token, parents, 0))
+ packed_parent = tl.sum(tl.where(idx_tokens == parent, packed, 0))
+ depth = (packed_parent & 255) + 1
+ # a first child continues its parent's chain, a later sibling starts one
+ chain_depth = tl.where(packed_parent >= 65536, depth, (packed_parent >> 8) & 255)
+ is_node = idx_token < num_tokens
+ packed = tl.where((idx_tokens == idx_token) & is_node, depth + (chain_depth << 8), packed)
+ packed = tl.where((idx_tokens == parent) & is_node, packed | 65536, packed)
+ depths = packed & 255
+ is_leaf = valid & (packed < 65536)
+ leaf_rank = tl.cumsum(is_leaf.to(tl.int32), 0) - 1
+ num_leaves = tl.sum(is_leaf.to(tl.int32))
+ row = paths_ptr + leaf_rank * stride_paths_path
+ tl.store(row, depths + 1, mask=is_leaf)
+ tl.store(row + 1, (packed >> 8) & 255, mask=is_leaf)
+ tl.store(
+ paths_ptr + idx_tokens * stride_paths_path,
+ tl.zeros(idx_tokens.shape, dtype=tl.int32),
+ mask=(idx_tokens >= num_leaves) & (idx_tokens < seqlen),
+ )
+ # root paths, written leaf first
+ node = idx_tokens
+ for step in range(0, tl.max(tl.where(is_leaf, depths, 0)) + 1):
+ tl.store(row + 2 + depths - step, node, mask=is_leaf & (step <= depths))
+ node = tl.sum(tl.where(idx_tokens[None, :] == node[:, None], parents[None, :], 0), 1)
+
+
+def _gdn_tree_ancestors_kernel(
+ retrieve_next_token_ptr,
+ retrieve_next_sibling_ptr,
+ retrieve_parent_token_ptr,
+ conv_state_indices_ptr,
+ ancestors_ptr, # (batch, 3, seqlen) int32
+ query_start_loc_ptr,
+ paths_ptr, # (batch, seqlen, 2 + seqlen) int32
+ stride_next_seq,
+ stride_next_token,
+ stride_sibling_seq,
+ stride_sibling_token,
+ stride_parent_seq,
+ stride_parent_token,
+ stride_state_indices,
+ stride_paths_seq,
+ stride_paths_path,
+ pad_slot_id: tl.constexpr,
+ seqlen: tl.constexpr,
+ NP2_SEQLEN: tl.constexpr,
+ BUILD_PATHS: tl.constexpr,
+):
+ # Replays the parent derivation of the upstream tree conv in its link order, so the parent table is identical,
+ # and records the three window ancestors that conv visits for each node: code v >= 0 is node v, codes -1/-2/-3
+ # are conv_state columns 2/1/0.
+ idx_seq = tl.program_id(0)
+ idx_tokens = tl.arange(0, NP2_SEQLEN)
+ mask_retrieve = idx_tokens < seqlen
+ conv_state_batch_coord = tl.load(conv_state_indices_ptr + idx_seq * stride_state_indices)
+ if BUILD_PATHS:
+ num_tokens = tl.minimum(
+ tl.maximum(tl.load(query_start_loc_ptr + idx_seq + 1) - tl.load(query_start_loc_ptr + idx_seq), 0),
+ seqlen,
+ )
+ if conv_state_batch_coord == pad_slot_id:
+ # padded rows keep their parent links; their paths follow them
+ if BUILD_PATHS:
+ parents = tl.load(
+ retrieve_parent_token_ptr + idx_seq * stride_parent_seq + idx_tokens * stride_parent_token,
+ mask=mask_retrieve,
+ other=0,
+ ).to(tl.int32)
+ _gdn_tree_paths(
+ parents, idx_tokens, num_tokens, paths_ptr + idx_seq * stride_paths_seq, stride_paths_path, seqlen
+ )
+ return
+
+ retrieve_next_tokens = tl.load(
+ retrieve_next_token_ptr + idx_seq * stride_next_seq + idx_tokens * stride_next_token,
+ mask=mask_retrieve,
+ other=-1,
+ )
+ retrieve_next_siblings = tl.load(
+ retrieve_next_sibling_ptr + idx_seq * stride_sibling_seq + idx_tokens * stride_sibling_token,
+ mask=mask_retrieve,
+ other=-1,
+ )
+ parent_idx_tokens = tl.zeros((NP2_SEQLEN,), dtype=tl.int32)
+ # node 0 reads conv_state columns 2, 1, 0
+ anc1 = tl.full((NP2_SEQLEN,), -1, dtype=tl.int32)
+ anc2 = tl.full((NP2_SEQLEN,), -2, dtype=tl.int32)
+ anc3 = tl.full((NP2_SEQLEN,), -3, dtype=tl.int32)
+ for idx_token in range(seqlen):
+ next_idx = tl.sum(tl.where(idx_tokens == idx_token, retrieve_next_tokens, 0))
+ parent_idx_tokens = tl.where((idx_tokens == next_idx) & (next_idx != -1), idx_token, parent_idx_tokens)
+ sibling_idx = tl.sum(tl.where(idx_tokens == idx_token, retrieve_next_siblings, 0))
+ # the sibling update below cannot change this node's own parent
+ parent_idx_token = tl.sum(tl.where(idx_tokens == idx_token, parent_idx_tokens, 0))
+ parent_idx_tokens = tl.where(
+ (idx_tokens == sibling_idx) & (sibling_idx != -1), parent_idx_token, parent_idx_tokens
+ )
+ # ancestors under the links derived so far, chased as the upstream conv does
+ grand_idx_token = tl.sum(tl.where(idx_tokens == parent_idx_token, parent_idx_tokens, 0))
+ grand_idx_token = tl.where(parent_idx_token > 0, grand_idx_token, parent_idx_token - 1)
+ great_idx_token = tl.sum(tl.where(idx_tokens == grand_idx_token, parent_idx_tokens, 0))
+ great_idx_token = tl.where(grand_idx_token > 0, great_idx_token, grand_idx_token - 1)
+ is_token = (idx_tokens == idx_token) & (idx_token > 0)
+ anc1 = tl.where(is_token, parent_idx_token, anc1)
+ anc2 = tl.where(is_token, grand_idx_token, anc2)
+ anc3 = tl.where(is_token, great_idx_token, anc3)
+
+ tl.store(
+ retrieve_parent_token_ptr + idx_seq * stride_parent_seq + idx_tokens * stride_parent_token,
+ parent_idx_tokens,
+ mask=mask_retrieve,
+ )
+ anc_base = ancestors_ptr + idx_seq * 3 * seqlen + idx_tokens
+ tl.store(anc_base, anc1, mask=mask_retrieve)
+ tl.store(anc_base + seqlen, anc2, mask=mask_retrieve)
+ tl.store(anc_base + 2 * seqlen, anc3, mask=mask_retrieve)
+ if BUILD_PATHS:
+ _gdn_tree_paths(
+ parent_idx_tokens, idx_tokens, num_tokens, paths_ptr + idx_seq * stride_paths_seq, stride_paths_path, seqlen
+ )
+
+
+def gdn_tree_ancestors(
+ retrieve_next_token: torch.Tensor,
+ retrieve_next_sibling: torch.Tensor,
+ retrieve_parent_token: torch.Tensor,
+ conv_state_indices: torch.Tensor,
+ width: int,
+ ancestors: torch.Tensor,
+ query_start_loc: Optional[torch.Tensor] = None,
+ paths: Optional[torch.Tensor] = None,
+ pad_slot_id: int = PAD_SLOT_ID,
+) -> None:
+ """Derive the tree of every request from the first ``width`` columns of the links.
+
+ Writes ``retrieve_parent_token[:, :width]`` and ``ancestors`` (batch, 3, width), and with ``paths`` (batch, width,
+ 2 + width) the path table of the path replay (each request's node count from ``query_start_loc``). Rows whose
+ ``conv_state_indices`` entry is ``pad_slot_id`` keep their parents and ancestors; their paths follow their current
+ parents.
+ """
+ batch = ancestors.shape[0]
+ assert tuple(ancestors.shape) == (batch, 3, width) and ancestors.dtype == torch.int32
+ assert ancestors.is_contiguous()
+ build_paths = paths is not None
+ if build_paths:
+ assert query_start_loc is not None and width < 256
+ assert tuple(paths.shape) == (batch, width, 2 + width) and paths.dtype == torch.int32
+ assert paths.stride(2) == 1
+ _gdn_tree_ancestors_kernel[(batch,)](
+ retrieve_next_token,
+ retrieve_next_sibling,
+ retrieve_parent_token,
+ conv_state_indices,
+ ancestors,
+ query_start_loc if build_paths else ancestors,
+ paths if build_paths else ancestors,
+ retrieve_next_token.stride(0),
+ retrieve_next_token.stride(1),
+ retrieve_next_sibling.stride(0),
+ retrieve_next_sibling.stride(1),
+ retrieve_parent_token.stride(0),
+ retrieve_parent_token.stride(1),
+ conv_state_indices.stride(0),
+ paths.stride(0) if build_paths else 0,
+ paths.stride(1) if build_paths else 0,
+ pad_slot_id=pad_slot_id,
+ seqlen=width,
+ NP2_SEQLEN=triton.next_power_of_2(width),
+ BUILD_PATHS=build_paths,
+ num_warps=1,
+ )
+
+
+def gdn_tree_paths_buffer(batch: int, width: int, device) -> torch.Tensor:
+ """A path table for ``gdn_tree_ancestors(paths=...)``."""
+ return torch.zeros((batch, width, 2 + width), dtype=torch.int32, device=device)
diff --git a/eagle_harness/kernels/gdn_tree_chunk_flydsl.py b/eagle_harness/kernels/gdn_tree_chunk_flydsl.py
new file mode 100644
index 0000000..e5a65de
--- /dev/null
+++ b/eagle_harness/kernels/gdn_tree_chunk_flydsl.py
@@ -0,0 +1,465 @@
+# Modified by Eagle AI Corp.
+# Copyright (c) 2026 Advanced Micro Devices, Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+"""The GDN tree chunk (gdn_tree_verify._gdn_tree_chunk_kernel) as one FlyDSL kernel (gfx950): from the raw q / k /
+v / gates to o and the replay records, one wave per (request, v-head, V slice), trees of <= 16 nodes.
+
+Per wave, on the 16 x 16 MFMA accumulator layout (a lane holds rows 4g..4g+3 of column n16):
+ - per token: q / k L2 norms (q * scale), exp(g) and beta from A_log / a / dt_bias / b (the per-token pre-pass);
+ - the strict-ancestor masks by pointer jumping on the parent links (4 rounds in LDS, any node order), the root-path
+ log-decays logG, the decay ratios G_t / G_j;
+ - K K^T and Q K^T on the 16x16x32 bf16 MFMA with hi + lo bf16 operands (~fp32);
+ - Tinv = (I + L)^-1, L = diag(beta) (R o G_t/G_j o K K^T), by doubling on the 16x16x4 fp32 MFMA, and
+ W = (R + I) o G_t/G_j o Q K^T;
+ - per 16-column V tile: K S0 (hi + lo K) and Q S0 on the bf16 MFMA, S0 streamed once from the bf16 pool, then
+ rhs = beta (V - G K S0), D = Tinv rhs, O = G Q S0 + W D
+ in fp32 (the other rows of a column come from three xor shuffles, Tinv / W read at the matching permuted
+ columns); O stored bf16, D into the records with the keys and decays.
+K S0 feeds the committed state: K enters the MFMA as three bf16 terms (hi + lo + lo2: the deltas then match an fp64
+reference to ~5e-7 relative, like the Triton chunk's fp32 dots; hi + lo alone left ~2e-6, and K rounded to bf16 alone
+drifted the states enough to fail SPEED-Bench's lossless check); K K^T / Q K^T use all four hi / lo products; Q S0
+only feeds the step's bf16 output, Q's hi alone. Tinv / W are read from LDS in the tile loop (128 more live
+registers per lane cost ~30% at batch 16-32).
+
+MI355X per layer, 16-node trees, vs the Triton pre-pass + chunk it replaces: TP1 1 / 4 / 16 / 32 requests 13.1 ->
+10.5 / 17.4 -> 11.9 / 34.2 -> 23.8 / 58.9 -> 34.7 us, TP4 32 requests 24.0 -> 15.8 us (the earlier Triton prep +
+FlyDSL apply: 30.3 / 45.9 / 21.2 us at TP1 16 / 32, TP4 32). The keys are stored early: keeping the fp32 k alive
+to the end also cost ~30% (registers).
+"""
+
+import functools
+
+import flydsl.compiler as flyc
+import flydsl.expr as fx
+import torch
+from flydsl.expr import arith, range_constexpr, rocdl
+from flydsl.expr import math as fmath
+from flydsl.expr.typing import T
+
+NP = 16 # tree nodes per request (one MFMA row tile)
+WAVE = 64
+_FX = {torch.bfloat16: fx.BFloat16, torch.float32: fx.Float32, torch.int32: fx.Int32, torch.int64: fx.Int64}
+
+
+def _mfma_f32(a, b, c):
+ # 16x16x4 fp32 MFMA (FlyDSL 0.2.4 exposes only the raw ROCDL op for it)
+ ops = rocdl._split_mfma_operands([a, b, c])
+ return rocdl.mfma_f32_16x16x4f32(T.vec(4, T.f32), *ops).result
+
+
[email protected]_cache(maxsize=None)
+def build(H, HV, K, V, REC, vsplit, scale, dtypes):
+ assert K % 32 == 0 and V % (16 * vsplit) == 0
+ n_kb = K // 32
+ tiles = V // 16 // vsplit
+ gqa = HV // H
+ dt = dict(dtypes)
+ a_bf16, b_bf16, alog_bf16, dtb_bf16 = (dt[n] == torch.bfloat16 for n in ("a", "b", "A_log", "dt_bias"))
+
+ @fx.struct
+ class Shared:
+ jump: fx.Array[fx.Int32, 16, 16]
+ anc: fx.Array[fx.Int32, 16, 16]
+ lg: fx.Array[fx.Float32, 16, 16] # log exp(g) per node
+ lgsum: fx.Array[fx.Float32, 16, 16] # logG per node
+ beta: fx.Array[fx.Float32, 16, 16]
+ x: fx.Array[fx.Float32, 256, 16] # fp32 MFMA operand staging
+ y: fx.Array[fx.Float32, 256, 16]
+ tinv: fx.Array[fx.Float32, 256, 16]
+ w: fx.Array[fx.Float32, 256, 16]
+
+ def f32(val, is_bf16): # outside the kernel body: the Python branch stays a Python branch
+ return fx.BFloat16(val).to(fx.Float32) if is_bf16 else fx.Float32(val)
+
+ def round_beta(beta):
+ # the serial walk rounds beta to b's dtype
+ return beta.to(fx.BFloat16).to(fx.Float32) if b_bf16 else beta
+
+ @flyc.kernel(name=f"gdn_tree_chunk_h{H}_hv{HV}_vs{vsplit}", known_block_size=[WAVE, 1, 1])
+ def kernel(
+ q: fx.Pointer, # bf16 (1, tokens, H, K), token stride stride_q
+ k: fx.Pointer,
+ v: fx.Pointer, # bf16 (1, tokens, HV, V), token stride stride_v
+ a: fx.Pointer, # (tokens, HV), token stride stride_a
+ b: fx.Pointer,
+ A_log: fx.Pointer, # (HV,)
+ dt_bias: fx.Pointer,
+ o: fx.Pointer, # bf16 [tokens, HV, V]
+ pool: fx.Pointer, # bf16 [slots, HV, V, K]
+ h0_indices: fx.Pointer,
+ cu_seqlens: fx.Pointer,
+ parent: fx.Pointer, # (batch, width) parent node of every node, node 0 the root
+ records: fx.Pointer, # f32 (rows, steps, HV, REC): delta [0, V), key [V, V + K), decay at V + K
+ record_indices: fx.Pointer,
+ stride_q: fx.Int32,
+ stride_k: fx.Int32,
+ stride_v: fx.Int32,
+ stride_a: fx.Int32,
+ stride_b: fx.Int32,
+ stride_parent: fx.Int32,
+ width_parent: fx.Int32,
+ stride_pool: fx.Int32,
+ stride_records_row: fx.Int32,
+ ):
+ lane = fx.thread_idx.x
+ n16, g = lane % 16, lane // 16
+ i_n, i_hv, i_vs = fx.block_idx.x, fx.block_idx.y, fx.block_idx.z
+ i_h = i_hv // gqa
+ bos = fx.Int32(fx.ptr_load(cu_seqlens + i_n))
+ T_ = fx.Int32(fx.ptr_load(cu_seqlens + i_n + 1)) - bos
+ idx = fx.Int32(fx.ptr_load(h0_indices + i_n))
+ row = fx.Int32(fx.ptr_load(record_indices + i_n))
+ sh = fx.SharedAllocator().allocate(Shared).peek()
+ s_jump, s_anc, s_lg, s_lgsum, s_beta = sh.jump.ptr, sh.anc.ptr, sh.lg.ptr, sh.lgsum.ptr, sh.beta.ptr
+ s_x, s_y, s_t, s_w = sh.x.ptr, sh.y.ptr, sh.tinv.ptr, sh.w.ptr
+ # column node n16 (rows past T are zeroed)
+ tok_ok = n16 < T_
+ tok = bos + arith.select(tok_ok, n16, fx.Int32(0))
+
+ def load_unit(src, stride, mul):
+ # token n16's head i_h, dims kb * 32 + g * 8 .. + 8 (the MFMA A fragment), L2-normalized over the 128 dims
+ # of four lanes, times mul
+ xs = []
+ ss = fx.Float32(0.0)
+ for kb in range_constexpr(n_kb):
+ x = fx.Vector(fx.ptr_load(src + tok * stride + i_h * K + kb * 32 + g * 8, result_type=T.vec(8, T.bf16)))
+ vals = [
+ fx.Float32(arith.select(tok_ok, fx.BFloat16(x[i]).to(fx.Float32), fx.Float32(0.0)))
+ for i in range_constexpr(8)
+ ]
+ for vv in vals:
+ ss = ss + vv * vv
+ xs.append(vals)
+ ss = ss + ss.shuffle_xor(16, WAVE)
+ ss = ss + ss.shuffle_xor(32, WAVE)
+ d = fx.Float32(fmath.sqrt(ss + 1e-6))
+ return [[xi / d * mul for xi in xb] for xb in xs]
+
+ def split(xs, with_lo):
+ hi, lo = [], []
+ for xb in xs:
+ h = [xi.to(fx.BFloat16) for xi in xb]
+ hi.append(fx.Vector.from_elements(h, fx.BFloat16))
+ if with_lo:
+ lo.append(
+ fx.Vector.from_elements(
+ [(xb[i] - h[i].to(fx.Float32)).to(fx.BFloat16) for i in range_constexpr(8)], fx.BFloat16
+ )
+ )
+ return hi, lo
+
+ def split3(xs):
+ # the third bf16 term of x = hi + lo + lo2
+ out = []
+ for xb in xs:
+ r = []
+ for i in range_constexpr(8):
+ h = xb[i].to(fx.BFloat16).to(fx.Float32)
+ l = (xb[i] - h).to(fx.BFloat16).to(fx.Float32) # noqa: E741 - preserve AMD arithmetic notation
+ r.append((xb[i] - h - l).to(fx.BFloat16))
+ out.append(fx.Vector.from_elements(r, fx.BFloat16))
+ return out
+
+ kf = load_unit(k, stride_k, 1.0)
+ qf = load_unit(q, stride_q, scale)
+ k_hi, k_lo = split(kf, True)
+ k_lo2 = split3(kf)
+ q_hi, q_lo = split(qf, True)
+
+ # gates of the column token: exp(g) and beta (the serial walk's expressions; softplus beta 1, threshold 20)
+ a_t = f32(fx.ptr_load(a + tok * stride_a + i_hv), a_bf16)
+ b_t = f32(fx.ptr_load(b + tok * stride_b + i_hv), b_bf16)
+ one, zero = fx.Float32(1.0), fx.Float32(0.0)
+ xg = a_t + f32(fx.ptr_load(dt_bias + i_hv), dtb_bf16)
+ sp = fx.Float32(arith.select(xg <= 20.0, fx.Float32(fmath.log(one + fx.Float32(fmath.exp(xg)))), xg))
+ neg_a = zero - fx.Float32(fmath.exp(f32(fx.ptr_load(A_log + i_hv), alog_bf16)))
+ eg = fx.Float32(fmath.exp(neg_a * sp))
+ eg = fx.Float32(arith.select(tok_ok, eg, fx.Float32(1.0)))
+ beta_t = round_beta(one / (one + fx.Float32(fmath.exp(zero - b_t))))
+ beta_t = fx.Float32(arith.select(tok_ok, beta_t, fx.Float32(0.0)))
+ lg = fx.Float32(fmath.log(fx.Float32(arith.select(eg > 1e-30, eg, fx.Float32(1e-30)))))
+ # the records' keys (normalized k) and decays, once per (request, v-head); early, so kf's registers free up
+ if tok_ok & (row >= 0) & (i_vs == 0):
+ rec = records + row * stride_records_row + (n16 * HV + i_hv) * REC
+ for kb in range_constexpr(n_kb):
+ fx.ptr_store(fx.Vector.from_elements(kf[kb], fx.Float32), rec + V + kb * 32 + g * 8)
+ if g == 0:
+ fx.ptr_store(eg, rec + V + K)
+
+ # strict-ancestor bit masks by pointer jumping: node n16 holds (jump, anc); 4 rounds cover depth 15
+ has_par = tok_ok & (n16 > 0)
+ par = fx.Int32(fx.ptr_load(parent + i_n * stride_parent + arith.select(has_par, n16, fx.Int32(0))))
+ has_par = has_par & (par >= 0) & (par < width_parent)
+ jmp = arith.select(has_par, par, n16)
+ anc = arith.select(has_par, fx.Int32(1) << arith.select(has_par, par, fx.Int32(0)), fx.Int32(0))
+ if g == 0:
+ fx.ptr_store(jmp, s_jump + n16)
+ fx.ptr_store(anc, s_anc + n16)
+ fx.ptr_store(lg, s_lg + n16)
+ fx.ptr_store(beta_t, s_beta + n16)
+ fx.barrier()
+ for _ in range_constexpr(4):
+ a2 = fx.Int32(fx.ptr_load(s_anc + jmp))
+ j2 = fx.Int32(fx.ptr_load(s_jump + jmp))
+ fx.barrier()
+ anc = anc | a2
+ jmp = j2
+ if g == 0:
+ fx.ptr_store(jmp, s_jump + n16)
+ fx.ptr_store(anc, s_anc + n16)
+ fx.barrier()
+ # logG of node n16: its own log-decay and its ancestors'
+ lgs = lg
+ for j in range_constexpr(NP):
+ lgs = lgs + fx.Float32(
+ arith.select(((anc >> j) & 1) == 1, fx.Float32(fx.ptr_load(s_lg + j)), fx.Float32(0.0))
+ )
+ if g == 0:
+ fx.ptr_store(lgs, s_lgsum + n16)
+ fx.barrier()
+
+ # this lane's rows t = 4g + e
+ rows_t = [g * 4 + e for e in range_constexpr(4)]
+ row_ok = [rows_t[e] < T_ for e in range_constexpr(4)]
+ lgs_r = [fx.Float32(fx.ptr_load(s_lgsum + rows_t[e])) for e in range_constexpr(4)]
+ G = [fx.Float32(fmath.exp(lgs_r[e])) for e in range_constexpr(4)]
+ beta = [fx.Float32(fx.ptr_load(s_beta + rows_t[e])) for e in range_constexpr(4)]
+ R = []
+ ratio = []
+ for e in range_constexpr(4):
+ anc_r = fx.Int32(fx.ptr_load(s_anc + rows_t[e]))
+ strict = ((anc_r >> n16) & 1) == 1
+ in_m = strict | (rows_t[e] == n16)
+ R.append(fx.Float32(arith.select(strict, fx.Float32(1.0), fx.Float32(0.0))))
+ ratio.append(fx.Float32(arith.select(in_m, fx.Float32(fmath.exp(lgs_r[e] - lgs)), fx.Float32(0.0))))
+
+ def mfma(a_, b_, c):
+ return fx.Vector(rocdl.mfma_f32_16x16x32_bf16(T.vec(4, T.f32), [a_, b_, c]))
+
+ # K K^T and Q K^T: the B fragment of K^T is K's own A fragment; all four hi / lo products (~fp32, as the
+ # Triton chunk's fp32 dots: K K^T feeds Tinv and so the committed deltas)
+ kk = fx.Vector.filled(4, 0.0, fx.Float32)
+ qk = fx.Vector.filled(4, 0.0, fx.Float32)
+ for kb in range_constexpr(n_kb):
+ kk = mfma(k_lo[kb], k_lo[kb], kk)
+ kk = mfma(k_hi[kb], k_lo[kb], kk)
+ kk = mfma(k_lo[kb], k_hi[kb], kk)
+ kk = mfma(k_hi[kb], k_hi[kb], kk)
+ qk = mfma(q_lo[kb], k_lo[kb], qk)
+ qk = mfma(q_hi[kb], k_lo[kb], qk)
+ qk = mfma(q_lo[kb], k_hi[kb], qk)
+ qk = mfma(q_hi[kb], k_hi[kb], qk)
+
+ def mm(xm, ym):
+ # 16 x 16 fp32 product on the 16x16x4 fp32 MFMA; inputs and output in the accumulator layout, the
+ # operands re-read through LDS
+ for e in range_constexpr(4):
+ fx.ptr_store(xm[e], s_x + rows_t[e] * NP + n16)
+ fx.ptr_store(ym[e], s_y + rows_t[e] * NP + n16)
+ fx.barrier()
+ acc = fx.Vector.filled(4, 0.0, fx.Float32)
+ for kb in range_constexpr(4):
+ av = fx.Float32(fx.ptr_load(s_x + n16 * NP + kb * 4 + g))
+ bv = fx.Float32(fx.ptr_load(s_y + (kb * 4 + g) * NP + n16))
+ acc = fx.Vector(_mfma_f32(av, bv, acc))
+ fx.barrier()
+ return [fx.Float32(acc[e]) for e in range_constexpr(4)]
+
+ eye = [fx.Float32(arith.select(rows_t[e] == n16, fx.Float32(1.0), fx.Float32(0.0))) for e in range_constexpr(4)]
+ lmat = [beta[e] * R[e] * ratio[e] * fx.Float32(kk[e]) for e in range_constexpr(4)]
+ # (I + L)^-1 = (I - L)(I + L^2)(I + L^4)(I + L^8): L is nilpotent (strict ancestors only)
+ tinv_m = [eye[e] - lmat[e] for e in range_constexpr(4)]
+ p_m = mm(lmat, lmat)
+ tinv_m = mm(tinv_m, [eye[e] + p_m[e] for e in range_constexpr(4)])
+ p_m = mm(p_m, p_m)
+ tinv_m = mm(tinv_m, [eye[e] + p_m[e] for e in range_constexpr(4)])
+ p_m = mm(p_m, p_m)
+ tinv_m = mm(tinv_m, [eye[e] + p_m[e] for e in range_constexpr(4)])
+ for e in range_constexpr(4):
+ fx.ptr_store(tinv_m[e], s_t + rows_t[e] * NP + n16)
+ fx.ptr_store(ratio[e] * fx.Float32(qk[e]), s_w + rows_t[e] * NP + n16)
+ fx.barrier()
+
+ def xor_g(x):
+ # g ^ x for g, x in 0..3 without a runtime xor: bit 0 / bit 1 flipped where x has them
+ r = g
+ if x & 1:
+ r = r + 1 - 2 * (r % 2)
+ if x & 2:
+ r = r + 2 - 4 * ((r // 2) % 2)
+ return r
+
+ # Tinv / W at the columns 4 (g ^ x) + e' that the xor-x shuffle brings in
+ # read from LDS inside the tile loop (keeping all 128 values in registers costs occupancy)
+ t_off = [[rows_t[e] * NP + xor_g(x) * 4 for x in range_constexpr(4)] for e in range_constexpr(4)]
+ has_state = idx >= 0
+ s0_base = pool + arith.select(has_state, idx, fx.Int32(0)) * stride_pool + i_hv * V * K
+
+ def gather(vals):
+ # vals_x[e'] = the value of row 4 (g ^ x) + e' of this column
+ out = [vals]
+ for x in range_constexpr(1, 4):
+ out.append([fx.Float32(vals[e2]).shuffle_xor(16 * x, 64) for e2 in range_constexpr(4)])
+ return out
+
+ for vt in range_constexpr(tiles):
+ col = (i_vs * tiles + vt) * 16 + n16
+ ks = fx.Vector.filled(4, 0.0, fx.Float32)
+ qs = fx.Vector.filled(4, 0.0, fx.Float32)
+ for kb in range_constexpr(n_kb):
+ s0 = fx.Vector(fx.ptr_load(s0_base + col * K + kb * 32 + g * 8, result_type=T.vec(8, T.bf16)))
+ s0 = fx.Vector.from_elements(
+ [fx.BFloat16(arith.select(has_state, s0[i], fx.BFloat16(0.0))) for i in range_constexpr(8)],
+ fx.BFloat16,
+ )
+ ks = mfma(k_hi[kb], s0, ks)
+ ks = mfma(k_lo2[kb], s0, ks)
+ ks = mfma(k_lo[kb], s0, ks)
+ qs = mfma(q_hi[kb], s0, qs)
+ rhs = []
+ for e in range_constexpr(4):
+ t = arith.select(row_ok[e], rows_t[e], fx.Int32(0))
+ vv = fx.BFloat16(fx.ptr_load(v + (bos + t) * stride_v + i_hv * V + col)).to(fx.Float32)
+ vv = fx.Float32(arith.select(row_ok[e], vv, fx.Float32(0.0)))
+ rhs.append(beta[e] * (vv - G[e] * fx.Float32(ks[e])))
+ rg = gather(rhs)
+ d = []
+ for e in range_constexpr(4):
+ acc = fx.Float32(0.0)
+ for x in range_constexpr(4):
+ for e2 in range_constexpr(4):
+ acc = acc + fx.Float32(fx.ptr_load(s_t + t_off[e][x] + e2)) * rg[x][e2]
+ d.append(acc)
+ dg = gather(d)
+ for e in range_constexpr(4):
+ acc = G[e] * fx.Float32(qs[e])
+ for x in range_constexpr(4):
+ for e2 in range_constexpr(4):
+ acc = acc + fx.Float32(fx.ptr_load(s_w + t_off[e][x] + e2)) * dg[x][e2]
+ if row_ok[e]:
+ fx.ptr_store(acc.to(fx.BFloat16), o + ((bos + rows_t[e]) * HV + i_hv) * V + col)
+ if row >= 0:
+ fx.ptr_store(d[e], records + row * stride_records_row + (rows_t[e] * HV + i_hv) * REC + col)
+
+ @flyc.jit
+ def launch(
+ q: fx.Pointer,
+ k: fx.Pointer,
+ v: fx.Pointer,
+ a: fx.Pointer,
+ b: fx.Pointer,
+ A_log: fx.Pointer,
+ dt_bias: fx.Pointer,
+ o: fx.Pointer,
+ pool: fx.Pointer,
+ h0_indices: fx.Pointer,
+ cu_seqlens: fx.Pointer,
+ parent: fx.Pointer,
+ records: fx.Pointer,
+ record_indices: fx.Pointer,
+ stride_q: fx.Int32,
+ stride_k: fx.Int32,
+ stride_v: fx.Int32,
+ stride_a: fx.Int32,
+ stride_b: fx.Int32,
+ stride_parent: fx.Int32,
+ width_parent: fx.Int32,
+ stride_pool: fx.Int32,
+ stride_records_row: fx.Int32,
+ n_req: fx.Int32,
+ stream: fx.Stream,
+ ):
+ kernel(
+ q,
+ k,
+ v,
+ a,
+ b,
+ A_log,
+ dt_bias,
+ o,
+ pool,
+ h0_indices,
+ cu_seqlens,
+ parent,
+ records,
+ record_indices,
+ stride_q,
+ stride_k,
+ stride_v,
+ stride_a,
+ stride_b,
+ stride_parent,
+ width_parent,
+ stride_pool,
+ stride_records_row,
+ ).launch(grid=(n_req, HV, vsplit), block=(WAVE, 1, 1), stream=stream)
+
+ return launch
+
+
+def _ptr(t):
+ return flyc.from_c_void_p(_FX[t.dtype], t.data_ptr(), assumed_align=16 if t.data_ptr() % 16 == 0 else 2)
+
+
+def supported(q, k, v, pool, records, softplus_beta, softplus_threshold) -> bool:
+ return (
+ k.shape[-1] == 128
+ and v.shape[-1] % 64 == 0
+ and pool.dtype == torch.bfloat16
+ and q.dtype == torch.bfloat16
+ and k.dtype == torch.bfloat16
+ and v.dtype == torch.bfloat16
+ and q.stride(-1) == 1
+ and k.stride(-1) == 1
+ and q.stride(2) == q.shape[-1]
+ and k.stride(2) == k.shape[-1]
+ and v.stride(-1) == 1
+ and v.stride(2) == v.shape[-1]
+ and records.dtype == torch.float32
+ and softplus_beta == 1.0
+ and softplus_threshold == 20.0
+ )
+
+
+def gdn_tree_chunk_flydsl(
+ q, k, v, a, b, A_log, dt_bias, o, pool, h0_indices, cu_seqlens, parent, records, record_indices, scale, vsplit=None
+):
+ """The tree verify of every request (<= 16 nodes each) in one launch: writes o and the replay records."""
+ n = cu_seqlens.shape[0] - 1
+ _, _, H, K = k.shape
+ HV, V = v.shape[2], v.shape[3]
+ if vsplit is None:
+ # few (request, v-head) waves: split V wider
+ vsplit = 4 if n * HV <= 192 else (2 if n * HV <= 768 else 1)
+ dtypes = (("a", a.dtype), ("b", b.dtype), ("A_log", A_log.dtype), ("dt_bias", dt_bias.dtype))
+ launch = build(H, HV, K, V, records.shape[3], vsplit, float(scale), tuple(sorted(dtypes)))
+ launch(
+ _ptr(q),
+ _ptr(k),
+ _ptr(v),
+ _ptr(a),
+ _ptr(b),
+ _ptr(A_log),
+ _ptr(dt_bias),
+ _ptr(o),
+ _ptr(pool),
+ _ptr(h0_indices),
+ _ptr(cu_seqlens),
+ _ptr(parent),
+ _ptr(records),
+ _ptr(record_indices),
+ q.stride(1),
+ k.stride(1),
+ v.stride(1),
+ a.stride(-2),
+ b.stride(-2),
+ parent.stride(0),
+ parent.shape[1],
+ pool.stride(0),
+ records.stride(0),
+ n,
+ fx.Stream(torch.cuda.current_stream().cuda_stream),
+ )
+ return o
diff --git a/eagle_harness/kernels/gdn_tree_conv.py b/eagle_harness/kernels/gdn_tree_conv.py
new file mode 100644
index 0000000..d61112b
--- /dev/null
+++ b/eagle_harness/kernels/gdn_tree_conv.py
@@ -0,0 +1,497 @@
+# SPDX-FileCopyrightText: Copyright 2023-2024 SGLang Team
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+# SPDX-FileCopyrightText: Copyright (c) 2024, Tri Dao
+# Derived from sglang (Apache-2.0): the tree conv from python/sglang/kernels/ops/mamba/causal_conv1d_triton.py (itself
+# adapted from vLLM and causal-conv1d, BSD-3-Clause) and the recurrence from
+# python/sglang/kernels/ops/attention/fla/fused_sigmoid_gating_recurrent.py (sglang's fla kernels adapt
+# flash-linear-attention, MIT). Modified by Eagle AI Corp: ancestor tables, slot tables for both engines, path replay.
+# Notices and license texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""GDN tree verify: the width-4 causal conv1d of every tree node through the ancestor table.
+
+Each node's window is its three nearest ancestors' inputs (or the request's history columns above the root), read
+through the table ``gdn_tree.gdn_tree_ancestors`` builds once per forward instead of chasing the tree links in every
+layer and channel block. Output, windows and state are bit-identical to the tree path of sglang's
+``causal_conv1d_update``. Two kernels compute the same values: the gather kernel takes all nodes of a request as one
+tile, the serial kernel walks the nodes over a wide channel block, which wins only for many short trees.
+"""
+
+from __future__ import annotations
+
+from typing import Optional, Union
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels import arch
+from eagle_harness.kernels.gdn_tree import PAD_SLOT_ID
+
+
+def _conv_request(
+ conv_state_ptr,
+ conv_state_indices_ptr,
+ stride_state_indices,
+ num_accepted_ptr,
+ query_start_loc_ptr,
+ stride_conv_state_seq,
+ pad_slot_id: tl.constexpr,
+ seqlen: tl.constexpr,
+ HAS_NUM_ACCEPTED: tl.constexpr,
+ HAS_QUERY_START_LOC: tl.constexpr,
+):
+ # request idx_seq: its conv state row, first token, node count and history column; live: not padding, has nodes
+ idx_seq = tl.program_id(0)
+ slot = tl.load(conv_state_indices_ptr + idx_seq * stride_state_indices).to(tl.int64)
+ zero = slot * 0
+ bos = zero
+ num_tokens = zero + seqlen
+ history = zero
+ if HAS_QUERY_START_LOC:
+ bos = tl.load(query_start_loc_ptr + idx_seq).to(tl.int64)
+ num_tokens = tl.load(query_start_loc_ptr + idx_seq + 1).to(tl.int64) - bos
+ if HAS_NUM_ACCEPTED:
+ history = tl.load(num_accepted_ptr + idx_seq).to(tl.int64) - 1
+ live = (slot > pad_slot_id) & (num_tokens > 0)
+ return bos, num_tokens, conv_state_ptr + slot * stride_conv_state_seq, history, live
+
+
+def _conv_weights(w_ptr, idx_feats, mask_w, stride_w_dim, stride_w_width):
+ # the 4 weight columns of this channel block
+ w_base = w_ptr + idx_feats * stride_w_dim
+ w_col0 = tl.load(w_base + 0 * stride_w_width, mask_w, other=0.0)
+ w_col1 = tl.load(w_base + 1 * stride_w_width, mask_w, other=0.0)
+ w_col2 = tl.load(w_base + 2 * stride_w_width, mask_w, other=0.0)
+ w_col3 = tl.load(w_base + 3 * stride_w_width, mask_w, other=0.0)
+ return w_col0, w_col1, w_col2, w_col3
+
+
+def _conv_history(conv_states_base, history, mask_w, stride_conv_state_tok):
+ # the request's 3 history columns (from column `history`)
+ col0 = tl.load(conv_states_base + history * stride_conv_state_tok, mask_w, 0.0)
+ col1 = tl.load(conv_states_base + (history + 1) * stride_conv_state_tok, mask_w, 0.0)
+ col2 = tl.load(conv_states_base + (history + 2) * stride_conv_state_tok, mask_w, 0.0)
+ return col0, col1, col2
+
+
+def _conv_pdl_wait(USE_GDC: tl.constexpr):
+ # Under PDL the launch starts while the input projection's GEMM runs: everything above this point reads only
+ # tables, weights and metadata written before that GEMM. Padded programs wait too, so the grid never completes
+ # early. The dependent launch is released at the end (_conv_pdl_release): released here, the recurrence's
+ # programs sit on the SMs through the conv and the chain measured ~1.3 us per layer slower than this.
+ if USE_GDC:
+ tl.extra.cuda.gdc_wait()
+
+
+def _conv_pdl_release(USE_GDC: tl.constexpr):
+ if USE_GDC:
+ tl.extra.cuda.gdc_launch_dependents()
+
+
+def _window_value(anc, x_anc, col0, col1, col2):
+ # an ancestor code's input: node anc (x_anc) for anc >= 0, else history column 2 / 1 / 0 for -1 / -2 / -3
+ return tl.where(anc >= 0, x_anc, tl.where(anc == -1, col2, tl.where(anc == -2, col1, col0)))
+
+
+def _conv_roll(
+ conv_states_base,
+ x_base,
+ col0,
+ col1,
+ col2,
+ num_tokens,
+ mask_w,
+ stride_conv_state_tok: tl.constexpr,
+ stride_x_token,
+ STATE_LEN: tl.constexpr,
+):
+ # The state row keeps the newest min(STATE_LEN, nodes + 2) entries of (history ++ inputs): the entries a later
+ # window may still need. With 3 columns (sglang) that is upstream's in-place shift (the last 3 inputs); with room
+ # for every input (vLLM) it is the chain kernel's roll [history[1:], x_0, .., x_{n-1}], which the commit compacts.
+ # Runs after every history read.
+ tl.debug_barrier()
+ kept = tl.minimum(num_tokens + 2, STATE_LEN)
+ for j in tl.static_range(STATE_LEN):
+ entry = num_tokens + 3 - kept + j # index into (col0, col1, col2, x_0, ..)
+ if j < kept:
+ state_dtype = conv_states_base.dtype.element_ty
+ if entry < 3:
+ new_col = tl.where(entry == 0, col0, tl.where(entry == 1, col1, col2)).to(state_dtype)
+ else:
+ new_col = tl.load(x_base + (entry - 3) * stride_x_token, mask=mask_w, other=0.0).to(state_dtype)
+ tl.store(conv_states_base + j * stride_conv_state_tok, new_col, mask=mask_w)
+
+
+def _conv_gather_kernel(
+ x_ptr, # (batch, dim, seqlen), or (1, dim, tokens) with query_start_loc
+ w_ptr, # (dim, 4)
+ bias_ptr,
+ conv_state_ptr,
+ conv_state_indices_ptr,
+ num_accepted_ptr,
+ query_start_loc_ptr,
+ intermediate_conv_window_ptr,
+ intermediate_state_indices_ptr,
+ ancestors_ptr, # (batch, 3, seqlen) int32
+ o_ptr, # like x
+ dim,
+ stride_x_seq,
+ stride_x_dim: tl.constexpr,
+ stride_x_token,
+ stride_w_dim,
+ stride_w_width: tl.constexpr,
+ stride_conv_state_seq,
+ stride_conv_state_dim: tl.constexpr,
+ stride_conv_state_tok: tl.constexpr,
+ stride_state_indices,
+ stride_inter_seq,
+ stride_inter_step,
+ stride_inter_dim: tl.constexpr,
+ stride_inter_win: tl.constexpr,
+ stride_intermediate_state_indices,
+ stride_o_seq,
+ stride_o_dim: tl.constexpr,
+ stride_o_token,
+ pad_slot_id: tl.constexpr,
+ HAS_BIAS: tl.constexpr,
+ SILU_ACTIVATION: tl.constexpr,
+ HAS_NUM_ACCEPTED: tl.constexpr,
+ HAS_QUERY_START_LOC: tl.constexpr,
+ HAS_WINDOWS: tl.constexpr,
+ STATE_LEN: tl.constexpr,
+ seqlen: tl.constexpr,
+ NP2_SEQLEN: tl.constexpr,
+ BLOCK_N: tl.constexpr,
+ USE_GDC: tl.constexpr,
+):
+ # all nodes of a request at once: a [NP2_SEQLEN, BLOCK_N] tile whose ancestor rows are gathered through the table
+ idx_seq = tl.program_id(0)
+ bos, num_tokens, conv_states_base, history, live = _conv_request(
+ conv_state_ptr,
+ conv_state_indices_ptr,
+ stride_state_indices,
+ num_accepted_ptr,
+ query_start_loc_ptr,
+ stride_conv_state_seq,
+ pad_slot_id,
+ seqlen,
+ HAS_NUM_ACCEPTED,
+ HAS_QUERY_START_LOC,
+ )
+ idx_feats = tl.program_id(1) * BLOCK_N + tl.arange(0, BLOCK_N)
+ idx_tokens = tl.arange(0, NP2_SEQLEN)
+ mask_w = idx_feats < dim
+ mask_t = idx_tokens < num_tokens
+ mask_2d = mask_t[:, None] & mask_w[None, :]
+ w_col0, w_col1, w_col2, w_col3 = _conv_weights(w_ptr, idx_feats, mask_w, stride_w_dim, stride_w_width)
+ anc_base = ancestors_ptr + idx_seq * 3 * seqlen + idx_tokens
+ anc1 = tl.load(anc_base, mask=mask_t, other=0)[:, None]
+ anc2 = tl.load(anc_base + seqlen, mask=mask_t, other=0)[:, None]
+ anc3 = tl.load(anc_base + 2 * seqlen, mask=mask_t, other=0)[:, None]
+ if HAS_BIAS:
+ acc = tl.broadcast_to(
+ tl.load(bias_ptr + idx_feats, mask=mask_w, other=0.0).to(tl.float32)[None, :],
+ (NP2_SEQLEN, BLOCK_N),
+ )
+ else:
+ acc = tl.zeros((NP2_SEQLEN, BLOCK_N), dtype=tl.float32)
+ _conv_pdl_wait(USE_GDC)
+ if live == 0:
+ return
+
+ conv_states_base += idx_feats * stride_conv_state_dim
+ col0, col1, col2 = _conv_history(conv_states_base, history, mask_w, stride_conv_state_tok)
+
+ x_feats = x_ptr + idx_seq * stride_x_seq + bos * stride_x_token + idx_feats * stride_x_dim
+ x_base = x_feats[None, :]
+ x_self = tl.load(x_base + (idx_tokens * stride_x_token)[:, None], mask=mask_2d, other=0.0)
+ x_anc1 = tl.load(x_base + anc1 * stride_x_token, mask=mask_2d & (anc1 >= 0), other=0.0)
+ x_anc2 = tl.load(x_base + anc2 * stride_x_token, mask=mask_2d & (anc2 >= 0), other=0.0)
+ x_anc3 = tl.load(x_base + anc3 * stride_x_token, mask=mask_2d & (anc3 >= 0), other=0.0)
+ h0 = col0[None, :]
+ h1 = col1[None, :]
+ h2 = col2[None, :]
+ v_anc1 = _window_value(anc1, x_anc1, h0, h1, h2)
+ v_anc2 = _window_value(anc2, x_anc2, h0, h1, h2)
+ v_anc3 = _window_value(anc3, x_anc3, h0, h1, h2)
+
+ # the upstream products and order: self * w3, parent * w2, grandparent * w1, great-grandparent * w0
+ acc += x_self * w_col3[None, :]
+ acc += v_anc1 * w_col2[None, :]
+ acc += v_anc2 * w_col1[None, :]
+ acc += v_anc3 * w_col0[None, :]
+ if SILU_ACTIVATION:
+ acc = acc / (1 + tl.exp(-acc))
+ tl.store(
+ o_ptr
+ + idx_seq * stride_o_seq
+ + ((bos + idx_tokens) * stride_o_token)[:, None]
+ + (idx_feats * stride_o_dim)[None, :],
+ acc,
+ mask=mask_2d,
+ )
+
+ if HAS_WINDOWS:
+ # windows as one [NP2_SEQLEN, BLOCK_N, 4] tile: slot 2 self, slot 1 parent, slot 0 grandparent, slot 3 masked
+ intermediate_state_batch_coord = tl.load(
+ intermediate_state_indices_ptr + idx_seq * stride_intermediate_state_indices
+ ).to(tl.int64)
+ win_dtype = intermediate_conv_window_ptr.dtype.element_ty
+ win_self = x_self.to(win_dtype)
+ win_anc1 = v_anc1.to(win_dtype)
+ win_anc2 = v_anc2.to(win_dtype)
+ # join(join(a, b), join(c, d)) reshaped to 4 orders the slots (a, c, b, d)
+ windows = tl.reshape(
+ tl.join(tl.join(win_anc2, win_self), tl.join(win_anc1, win_self)),
+ (NP2_SEQLEN, BLOCK_N, 4),
+ )
+ idx_win = tl.arange(0, 4)
+ tl.store(
+ intermediate_conv_window_ptr
+ + intermediate_state_batch_coord * stride_inter_seq
+ + (idx_tokens * stride_inter_step)[:, None, None]
+ + (idx_feats * stride_inter_dim)[None, :, None]
+ + (idx_win * stride_inter_win)[None, None, :],
+ windows,
+ mask=mask_2d[:, :, None] & (idx_win < 3)[None, None, :],
+ )
+
+ # the roll of _conv_roll, with the inputs stored from the tile: entry e goes to column e + shift
+ tl.debug_barrier()
+ shift = tl.minimum(num_tokens + 2, STATE_LEN) - num_tokens - 3
+ state_dtype = conv_states_base.dtype.element_ty
+ tl.store(conv_states_base + shift * stride_conv_state_tok, col0, mask=mask_w & (shift >= 0))
+ tl.store(conv_states_base + (shift + 1) * stride_conv_state_tok, col1, mask=mask_w & (shift + 1 >= 0))
+ tl.store(conv_states_base + (shift + 2) * stride_conv_state_tok, col2, mask=mask_w & (shift + 2 >= 0))
+ dest = idx_tokens + 3 + shift
+ tl.store(
+ conv_states_base[None, :] + (dest * stride_conv_state_tok)[:, None],
+ x_self.to(state_dtype),
+ mask=mask_2d & (dest >= 0)[:, None],
+ )
+ _conv_pdl_release(USE_GDC)
+
+
+def _conv_serial_kernel(
+ x_ptr, # (batch, dim, seqlen), or (1, dim, tokens) with query_start_loc
+ w_ptr, # (dim, 4)
+ bias_ptr,
+ conv_state_ptr,
+ conv_state_indices_ptr,
+ num_accepted_ptr,
+ query_start_loc_ptr,
+ intermediate_conv_window_ptr,
+ intermediate_state_indices_ptr,
+ ancestors_ptr, # (batch, 3, seqlen) int32
+ o_ptr, # like x
+ dim,
+ stride_x_seq,
+ stride_x_dim: tl.constexpr,
+ stride_x_token,
+ stride_w_dim,
+ stride_w_width: tl.constexpr,
+ stride_conv_state_seq,
+ stride_conv_state_dim: tl.constexpr,
+ stride_conv_state_tok: tl.constexpr,
+ stride_state_indices,
+ stride_inter_seq,
+ stride_inter_step,
+ stride_inter_dim: tl.constexpr,
+ stride_inter_win: tl.constexpr,
+ stride_intermediate_state_indices,
+ stride_o_seq,
+ stride_o_dim: tl.constexpr,
+ stride_o_token,
+ pad_slot_id: tl.constexpr,
+ HAS_BIAS: tl.constexpr,
+ SILU_ACTIVATION: tl.constexpr,
+ HAS_NUM_ACCEPTED: tl.constexpr,
+ HAS_QUERY_START_LOC: tl.constexpr,
+ HAS_WINDOWS: tl.constexpr,
+ STATE_LEN: tl.constexpr,
+ seqlen: tl.constexpr,
+ BLOCK_N: tl.constexpr,
+ USE_GDC: tl.constexpr,
+):
+ # one node at a time over a wide channel block (many requests)
+ idx_seq = tl.program_id(0)
+ bos, num_tokens, conv_states_base, history, live = _conv_request(
+ conv_state_ptr,
+ conv_state_indices_ptr,
+ stride_state_indices,
+ num_accepted_ptr,
+ query_start_loc_ptr,
+ stride_conv_state_seq,
+ pad_slot_id,
+ seqlen,
+ HAS_NUM_ACCEPTED,
+ HAS_QUERY_START_LOC,
+ )
+ idx_feats = tl.program_id(1) * BLOCK_N + tl.arange(0, BLOCK_N)
+ mask_w = idx_feats < dim
+ w_col0, w_col1, w_col2, w_col3 = _conv_weights(w_ptr, idx_feats, mask_w, stride_w_dim, stride_w_width)
+ if HAS_BIAS:
+ acc_preload = tl.load(bias_ptr + idx_feats, mask=mask_w, other=0.0).to(tl.float32)
+ else:
+ acc_preload = tl.zeros((BLOCK_N,), dtype=tl.float32)
+ _conv_pdl_wait(USE_GDC)
+ if live == 0:
+ return
+
+ conv_states_base += idx_feats * stride_conv_state_dim
+ col0, col1, col2 = _conv_history(conv_states_base, history, mask_w, stride_conv_state_tok)
+
+ x_base = x_ptr + idx_seq * stride_x_seq + bos * stride_x_token + idx_feats * stride_x_dim
+ o_base = o_ptr + idx_seq * stride_o_seq + bos * stride_o_token + idx_feats * stride_o_dim
+ anc_base = ancestors_ptr + idx_seq * 3 * seqlen
+ if HAS_WINDOWS:
+ intermediate_state_batch_coord = tl.load(
+ intermediate_state_indices_ptr + idx_seq * stride_intermediate_state_indices
+ ).to(tl.int64)
+ win_base = (
+ intermediate_conv_window_ptr
+ + intermediate_state_batch_coord * stride_inter_seq
+ + idx_feats * stride_inter_dim
+ )
+ for idx_token in range(num_tokens):
+ anc1 = tl.load(anc_base + idx_token)
+ anc2 = tl.load(anc_base + seqlen + idx_token)
+ anc3 = tl.load(anc_base + 2 * seqlen + idx_token)
+ x_self = tl.load(x_base + idx_token * stride_x_token, mask=mask_w, other=0.0)
+ x_anc1 = tl.load(x_base + anc1 * stride_x_token, mask=mask_w & (anc1 >= 0), other=0.0)
+ x_anc2 = tl.load(x_base + anc2 * stride_x_token, mask=mask_w & (anc2 >= 0), other=0.0)
+ x_anc3 = tl.load(x_base + anc3 * stride_x_token, mask=mask_w & (anc3 >= 0), other=0.0)
+ v_anc1 = _window_value(anc1, x_anc1, col0, col1, col2)
+ v_anc2 = _window_value(anc2, x_anc2, col0, col1, col2)
+ v_anc3 = _window_value(anc3, x_anc3, col0, col1, col2)
+
+ acc = acc_preload
+ acc += x_self * w_col3
+ acc += v_anc1 * w_col2
+ acc += v_anc2 * w_col1
+ acc += v_anc3 * w_col0
+ if SILU_ACTIVATION:
+ acc = acc / (1 + tl.exp(-acc))
+ tl.store(o_base + idx_token * stride_o_token, acc, mask=mask_w)
+
+ if HAS_WINDOWS:
+ win_ptr = win_base + idx_token * stride_inter_step
+ tl.store(win_ptr + 2 * stride_inter_win, x_self, mask=mask_w)
+ tl.store(win_ptr + 1 * stride_inter_win, v_anc1, mask=mask_w)
+ tl.store(win_ptr + 0 * stride_inter_win, v_anc2, mask=mask_w)
+
+ _conv_roll(
+ conv_states_base, x_base, col0, col1, col2, num_tokens, mask_w, stride_conv_state_tok, stride_x_token, STATE_LEN
+ )
+ _conv_pdl_release(USE_GDC)
+
+
+# The serial kernel wins only for many short trees.
+CONV_SERIAL_MIN_BATCH_DIM = 81920
+CONV_SERIAL_MAX_WIDTH = 16
+
+
+def gdn_tree_conv1d_update(
+ x: torch.Tensor,
+ conv_state: torch.Tensor,
+ weight: torch.Tensor,
+ bias: Optional[torch.Tensor],
+ activation: Union[bool, str, None],
+ conv_state_indices: torch.Tensor,
+ intermediate_conv_window: Optional[torch.Tensor],
+ intermediate_state_indices: Optional[torch.Tensor],
+ tree_ancestors: torch.Tensor,
+ pad_slot_id: int = PAD_SLOT_ID,
+ out: Optional[torch.Tensor] = None,
+ *,
+ num_accepted_tokens: Optional[torch.Tensor] = None,
+ query_start_loc: Optional[torch.Tensor] = None,
+) -> torch.Tensor:
+ """``causal_conv1d_update`` of a tree verify (width-4 kernel, no accept offsets) whose ancestor table came from
+ ``gdn_tree_ancestors`` (or a table with its codes). x: (batch, dim, seqlen) with any strides (e.g. a token-strided
+ view of the in_proj output); weight: (dim, 4). out (same shape, any strides) defaults to ``torch.empty_like(x)``.
+
+ Request n's history is the 3 columns of ``conv_state[conv_state_indices[n]]`` from column 0, or from column
+ ``num_accepted_tokens[n] - 1`` (vLLM's chain-kernel convention); a row whose index is <= ``pad_slot_id`` is
+ padding. With ``query_start_loc`` x is (1, dim, tokens) and request n's nodes are tokens
+ ``query_start_loc[n]:query_start_loc[n + 1]`` (at most ``tree_ancestors.shape[2]``). Each node's window goes to
+ ``intermediate_conv_window[intermediate_state_indices[n], node]`` if given; the state row then keeps the newest
+ ``min(conv_state.shape[-1], nodes + 2)`` entries of (history ++ inputs).
+
+ 16-bit inputs only: their products are rounded before the fp32 accumulation, so the sums match the upstream
+ kernel whichever multiply-adds the compiler fuses; with fp32 inputs the upstream fusion varies with seqlen.
+ """
+ if isinstance(activation, bool):
+ activation = "silu" if activation is True else None
+ batch, dim, seqlen = x.shape
+ width = tree_ancestors.shape[2]
+ if query_start_loc is not None:
+ assert batch == 1
+ batch, seqlen = query_start_loc.shape[0] - 1, width
+ assert x.element_size() == 2 and weight.element_size() == 2 and conv_state.element_size() == 2
+ assert weight.shape[1] == 4 and tree_ancestors.shape[0] >= batch and tree_ancestors.shape[1:] == (3, seqlen)
+ assert tree_ancestors.is_contiguous() and conv_state.shape[-1] >= 3
+ has_windows = intermediate_conv_window is not None
+ if out is None:
+ out = torch.empty_like(x)
+ assert out.shape == x.shape and out.dtype == x.dtype
+ args = (
+ x,
+ weight,
+ bias,
+ conv_state,
+ conv_state_indices,
+ num_accepted_tokens,
+ query_start_loc,
+ intermediate_conv_window,
+ intermediate_state_indices,
+ tree_ancestors,
+ out,
+ dim,
+ 0 if query_start_loc is not None else x.stride(0),
+ *x.stride()[1:],
+ *weight.stride(),
+ *conv_state.stride(),
+ conv_state_indices.stride(0),
+ *(intermediate_conv_window.stride() if has_windows else (0, 0, 0, 0)),
+ intermediate_state_indices.stride(0) if has_windows else 0,
+ 0 if query_start_loc is not None else out.stride(0),
+ *out.stride()[1:],
+ )
+ meta = dict(
+ pad_slot_id=pad_slot_id,
+ HAS_BIAS=bias is not None,
+ SILU_ACTIVATION=activation in ["silu", "swish"],
+ HAS_NUM_ACCEPTED=num_accepted_tokens is not None,
+ HAS_QUERY_START_LOC=query_start_loc is not None,
+ HAS_WINDOWS=has_windows,
+ STATE_LEN=conv_state.shape[-1],
+ seqlen=seqlen,
+ )
+ # PDL: the launch overlaps the input projection's GEMM (weights and tables are read ahead of the wait, see
+ # _conv_pdl_wait); the recurrence behind it is released as the programs finish.
+ pdl = arch.pdl(x.device)
+ meta["USE_GDC"] = pdl
+ launch = {"launch_pdl": True} if pdl else {}
+ if batch * dim >= CONV_SERIAL_MIN_BATCH_DIM and seqlen <= CONV_SERIAL_MAX_WIDTH:
+ block_n = 128
+ _conv_serial_kernel[(batch, triton.cdiv(dim, block_n))](*args, BLOCK_N=block_n, num_warps=4, **meta, **launch)
+ else:
+ block_n = 16 if batch == 1 and seqlen >= 16 else 32
+ _conv_gather_kernel[(batch, triton.cdiv(dim, block_n))](
+ *args,
+ NP2_SEQLEN=triton.next_power_of_2(seqlen),
+ BLOCK_N=block_n,
+ num_warps=block_n // 8,
+ **meta,
+ **launch,
+ )
+ return out
diff --git a/eagle_harness/kernels/gdn_tree_gluon.py b/eagle_harness/kernels/gdn_tree_gluon.py
new file mode 100644
index 0000000..632272f
--- /dev/null
+++ b/eagle_harness/kernels/gdn_tree_gluon.py
@@ -0,0 +1,737 @@
+# SPDX-FileCopyrightText: Copyright 2023-2024 SGLang Team
+# Derived from the recurrence of gdn_tree_recurrence.py (sglang, Apache-2.0, after flash-linear-attention, MIT), rewritten in
+# Gluon by Eagle AI Corp. Notices and license texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""GDN tree verify recurrence in Gluon (explicit-layout Triton).
+
+Bitwise the serial walk of ``gdn_tree_recurrence`` (``_walk_kernel`` over 4-wide V tiles) on sm_103, in both slot
+layouts (sglang: a snapshot scratch row per request; vLLM: one bf16 or fp32 state slot per verify row). Both engines'
+tree verify asks for it through ``gdn_tree_recurrent_update(..., gluon=True)`` -> :func:`gluon_dispatch`, which runs it
+for the launches it was validated for and returns None for every other launch, which keeps the Triton walk.
+
+Why it is faster: the Triton walk runs one-warp programs over four-column V tiles (per-rank v-heads x 32: 1536 at
+TP1, 384 at TP4), and every program redoes the per-token work (q/k L2 norm, gate, beta, 1-D -> tile layout shuffles)
+inside its serial loop over the tree nodes. Here a program of 4 warps covers 16 V columns of one head (384 programs at
+TP1, 96 at TP4; the same warps) and computes the per-token work, and every node's v tile, once for all T tokens into
+shared memory (warps split the tokens), so the serial loop keeps only the state math. The cold initial-state load is
+issued first, before griddepcontrol.wait under PDL, and the dependent launch is released right after the wait (as the
+Triton walk's PDL path does). Inside the loop:
+ * node s - 1's output reduction (h.q, off the state chain) runs in iteration s next to node s's h.k reduction, so
+ the two 16-lane shuffle chains overlap; at TP4 every SM sub-partition runs a single warp, which otherwise waits out
+ both;
+ * node s + 1's parent reload is issued at the end of iteration s, after node s's snapshot store it may read back,
+ behind one uniform branch instead of a masked load and a select of the whole state.
+
+Why it is bit-identical (tested bitwise in ``tests/test_gdn_tree_gluon_gpu.py``):
+ * the state tile keeps the Triton walk's per-warp layout, which Triton derives from the state's 16-byte vectors
+ along K: BlockedLayout([8,1],[16,2]) for a bf16 state, ([4,1],[32,1]) for fp32 (per V column: the same K elements
+ per thread on the same lanes), so h.k and h.q reduce in the same in-thread order and xor butterfly;
+ * the per-token q/k norms reduce rows of a [TP, K] tile in BlockedLayout([1,4],[1,32]): per token the same
+ 4-per-thread + xor-16..1 order as the walk's 1-D [4]/[32] layout, with the same div.full, sqrt.approx, ex2.approx
+ and log sequences; gate and beta are elementwise, and beta is rounded to bf16 as there;
+ * both kernels compile without FMA contraction and write the same FMAs (the state update h + k v^T, and the h.k
+ reduction with adjacent K rows paired, ``_dot_k``), so no compiler choice of where to fuse can split them;
+ * every step starts from the snapshot of its parent (the same reload; with an fp32 state a chain child keeps the
+ registers, which equal the exact fp32 reload) and stores the same snapshot and bf16 output.
+A change of either kernel's expressions or layouts needs the same change in the other and a re-run of the bitwise
+tests. At run time, the first launch of every signature is checked bitwise against the Triton walk
+(:func:`gluon_dispatch`); a mismatch or a compile / launch error switches the process back to the Triton walk.
+"""
+
+import logging
+import random
+from typing import Callable, Optional
+
+import torch
+import triton
+from triton.experimental import gluon
+from triton.experimental.gluon import language as gl
+
+from eagle_harness.kernels import arch
+from eagle_harness.kernels.gdn_tree import PAD_SLOT_ID
+from eagle_harness.kernels.gdn_tree_recurrence import gdn_tree_state_args
+
+logger = logging.getLogger(__name__)
+
+NUM_WARPS = 4 # 4 x 4 V columns per program (1/2/8 warps slower; 8 columns per warp not exact)
+# Widths 1-2: the Triton walk is as fast or faster. Width 32 (vLLM's widest verify) needs ~38 KB of shared memory per
+# program for the precompute.
+MIN_WIDTH, MAX_WIDTH = 3, 32
+# Head shapes (H, HV, K, V) per rank the kernel takes: 128-wide keys and values (the register layouts are written
+# for them) and whole GQA groups (HV a multiple of H). Measured faster than the Triton walk at every TP shape of
+# Qwen3.8-27B, TP1 (16, 48) to TP8 (2, 6): e.g. 12.0 / 8.9 / 6.5 / 6.2 us vs 16.2 / 13.0 / 10.8 / 10.7 us at width
+# 16 on B300 (tools/bench_kernels.py). The GPUs are arch.GLUON_GDN_SM (arch.gluon_gdn). Bit-identity rests on
+# matching layouts and on the private Gluon API _reinterpret, so it is not assumed from a version or a shape:
+# gluon_dispatch checks each launch signature bitwise against the Triton walk before serving it.
+HEAD_DIM = 128
+
+
+def admits_shape(h: int, hv: int, k: int, v: int) -> bool:
+ """Whether the kernel's layouts cover the per-rank head shape."""
+ return k == HEAD_DIM and v == HEAD_DIM and h > 0 and hv % h == 0
+
+
+def _dot_k(h, k, layout: gl.constexpr):
+ """The Triton walk's _dot_k (sum over K of h * k, adjacent K rows folded into one FMA), in `layout`."""
+ kk = gl.broadcast(gl.expand_dims(k, 1), h)[0]
+ h_even, h_odd = gl.split(gl.permute(gl.reshape(h, [h.shape[0] // 2, 2, h.shape[1]]), (0, 2, 1)))
+ k_even, k_odd = gl.split(gl.permute(gl.reshape(kk, [h.shape[0] // 2, 2, h.shape[1]]), (0, 2, 1)))
+ return gl.convert_layout(gl.sum(gl.fma(h_even, k_even, h_odd * k_odd), axis=0), layout, assert_trivial=True)
+
+
+def _recurrence_kernel(
+ A_log,
+ a,
+ dt_bias,
+ q,
+ k,
+ v,
+ b,
+ o,
+ h0_source,
+ h0_indices,
+ stride_h0_source,
+ stride_h0_indices_seq,
+ stride_h0_indices_col,
+ num_accepted,
+ cu_seqlens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ stride_snap_indices_seq,
+ stride_snap_indices_row,
+ stride_snap_slot,
+ stride_snap_row,
+ retrieve_parent_token_ptr,
+ stride_rpt_seq,
+ stride_rpt_tok,
+ publish,
+ stride_publish,
+ num_slot_cols,
+ softplus_beta,
+ softplus_threshold,
+ scale,
+ stride_a,
+ stride_q,
+ stride_k,
+ stride_v,
+ stride_b,
+ stride_o,
+ H: gl.constexpr,
+ HV: gl.constexpr,
+ K: gl.constexpr,
+ V: gl.constexpr,
+ NW: gl.constexpr,
+ TP: gl.constexpr,
+ SP: gl.constexpr,
+ ROW_SLOTS: gl.constexpr,
+ HAS_NUM_ACCEPTED: gl.constexpr,
+ PUBLISH: gl.constexpr,
+ PAD_SLOT_ID: gl.constexpr,
+ USE_PDL: gl.constexpr,
+ SKIP_CHAIN_RELOAD: gl.constexpr,
+ STATE_VEC: gl.constexpr,
+):
+ """The tree recurrence of one (request, v-head) over BVC V columns. Slots as the Triton walk addresses them
+ (ROW_SLOTS: one snapshot slot per row, else one per request)."""
+ BVC: gl.constexpr = 4 * NW
+ # the walk's state tile: STATE_VEC (16 bytes of state) consecutive K per thread, the warp's lanes over the rest of K
+ LH: gl.constexpr = gl.BlockedLayout([STATE_VEC, 1], [K // STATE_VEC, 32 * STATE_VEC // K], [1, NW], [0, 1])
+ LKV: gl.constexpr = gl.SliceLayout(1, LH)
+ LVV: gl.constexpr = gl.SliceLayout(0, LH)
+ LQK: gl.constexpr = gl.BlockedLayout([1, 4], [1, 32], [NW, 1], [1, 0])
+ LQT: gl.constexpr = gl.SliceLayout(1, LQK)
+ LQC: gl.constexpr = gl.SliceLayout(0, LQK)
+ LG: gl.constexpr = gl.BlockedLayout([1, 1], [32 // BVC, BVC], [NW, 1], [1, 0])
+ LGT: gl.constexpr = gl.SliceLayout(1, LG)
+ LGC: gl.constexpr = gl.SliceLayout(0, LG)
+ SMEM: gl.constexpr = gl.SwizzledSharedLayout(1, 1, 1, [1, 0])
+ SMEM1: gl.constexpr = gl.SwizzledSharedLayout(1, 1, 1, [0])
+
+ i_vc = gl.program_id(0)
+ i_nh = gl.program_id(1)
+ i_n = i_nh // HV
+ i_hv = i_nh % HV
+ i_h = i_hv // (HV // H)
+
+ bos = gl.load(cu_seqlens + i_n).to(gl.int64)
+ eos = gl.load(cu_seqlens + i_n + 1).to(gl.int64)
+ T = eos - bos
+
+ # cold initial state first (its DRAM latency overlaps the precompute, and with PDL the tail of the producer kernel)
+ kv = gl.arange(0, K, layout=LKV)
+ vv = i_vc * BVC + gl.arange(0, BVC, layout=LVV)
+ o_state = i_hv * K * V + gl.expand_dims(vv, 0) * K + gl.expand_dims(kv, 1)
+ p_idx = h0_indices + i_n * stride_h0_indices_seq
+ if HAS_NUM_ACCEPTED:
+ p_idx += (gl.load(num_accepted + i_n).to(gl.int64) - 1) * stride_h0_indices_col
+ idx = gl.load(p_idx).to(gl.int64)
+ h0_raw = gl.load(
+ h0_source + idx * stride_h0_source + o_state,
+ mask=(gl.expand_dims(vv, 0) < V) & (idx > PAD_SLOT_ID),
+ other=0,
+ )
+ if USE_PDL:
+ # PDL invariant: the reads above (cu_seqlens, the state slot, num_accepted and the pool state) may run while
+ # the preceding kernels are still running, so no kernel of the verify forward may write them. The metadata
+ # copies before a graph replay write cu_seqlens and the slot, and the state commit after the previous verify
+ # writes the pool. The direct predecessor here is the PDL tree conv (which waits for its own predecessor,
+ # the input projection, before it releases this launch), or a non-PDL kernel; neither writes them. q/k/v/a/b,
+ # the parents and every other input are read below the wait only.
+ gl.inline_asm_elementwise("griddepcontrol.wait; // dummy $0", "=r", [], dtype=gl.int32, is_pure=False, pack=1)
+ # Release the dependent launch at once, as the Triton walk's PDL path does: the gated RMSNorm after it waits
+ # for this grid's completion (its own griddepcontrol.wait) before reading o.
+ gl.inline_asm_elementwise(
+ "griddepcontrol.launch_dependents; // dummy $0",
+ "=r",
+ [],
+ dtype=gl.int32,
+ is_pure=False,
+ pack=1,
+ )
+
+ p_slots = intermediate_state_indices + i_n * stride_snap_indices_seq
+ if PUBLISH:
+ if (i_vc == 0) & (i_hv == 0):
+ LS: gl.constexpr = gl.BlockedLayout([1], [32], [NW], [0])
+ o_s = gl.arange(0, SP, layout=LS)
+ m_s = o_s < num_slot_cols
+ gl.store(
+ publish + i_n * stride_publish + o_s,
+ gl.load(p_slots + o_s * stride_snap_indices_row, mask=m_s),
+ mask=m_s,
+ )
+
+ # per-token precompute, once per program (warps split the tokens)
+ tq = gl.arange(0, TP, layout=LQT)
+ kq = gl.arange(0, K, layout=LQC)
+ row_ok = gl.expand_dims(tq < T, 1)
+ row_off = gl.expand_dims(bos + tq, 1)
+ b_qr = gl.load(q + row_off * stride_q + i_h * K + gl.expand_dims(kq, 0), mask=row_ok, other=0).to(gl.float32)
+ b_kr = gl.load(k + row_off * stride_k + i_h * K + gl.expand_dims(kq, 0), mask=row_ok, other=0).to(gl.float32)
+ b_qn = b_qr / gl.expand_dims(gl.sqrt(gl.sum(b_qr * b_qr, axis=1) + 1e-6), 1)
+ b_kn = b_kr / gl.expand_dims(gl.sqrt(gl.sum(b_kr * b_kr, axis=1) + 1e-6), 1)
+ b_qn = b_qn * scale
+ s_q = gl.allocate_shared_memory(gl.float32, [TP, K], SMEM)
+ s_k = gl.allocate_shared_memory(gl.float32, [TP, K], SMEM)
+ s_q.store(b_qn)
+ s_k.store(b_kn)
+
+ tg = gl.arange(0, TP, layout=LGT)
+ cg = gl.arange(0, BVC, layout=LGC)
+ g_ok = gl.expand_dims(tg < T, 1) & gl.expand_dims(cg < BVC, 0)
+ g_row = gl.expand_dims(bos + tg, 1) + gl.expand_dims(cg * 0, 0)
+ b_a = gl.load(a + g_row * stride_a + i_hv, mask=g_ok, other=0).to(gl.float32)
+ b_b = gl.load(b + g_row * stride_b + i_hv, mask=g_ok, other=0).to(gl.float32)
+ b_A_log = gl.load(A_log + i_hv).to(gl.float32)
+ b_dt_bias = gl.load(dt_bias + i_hv).to(gl.float32)
+ x = b_a + b_dt_bias
+ beta_x = softplus_beta * x
+ softplus_x = gl.where(
+ beta_x <= softplus_threshold,
+ (1.0 / softplus_beta) * gl.log(1.0 + gl.exp(beta_x)),
+ x,
+ )
+ b_g = -gl.exp(b_A_log) * softplus_x
+ b_eg = gl.exp(b_g)
+ b_beta = 1.0 / (1.0 + gl.exp(-b_b))
+ b_beta = b_beta.to(b.dtype.element_ty).to(gl.float32)
+ s_eg = gl.allocate_shared_memory(gl.float32, [TP, BVC], SMEM)
+ s_beta = gl.allocate_shared_memory(gl.float32, [TP, BVC], SMEM)
+ s_eg.store(b_eg)
+ s_beta.store(b_beta)
+ p_vt = v + g_row * stride_v + i_hv * V + i_vc * BVC + gl.expand_dims(cg, 0)
+ b_vt = gl.load(p_vt, mask=g_ok, other=0).to(gl.float32)
+ s_v = gl.allocate_shared_memory(gl.float32, [TP, BVC], SMEM)
+ s_v.store(b_vt)
+ gl.barrier()
+ # same bytes viewed as [TP] rows (the leading dim becomes indexable)
+ r_q = s_q._reinterpret(gl.float32, [TP, K], SMEM1)
+ r_k = s_k._reinterpret(gl.float32, [TP, K], SMEM1)
+ r_eg = s_eg._reinterpret(gl.float32, [TP, BVC], SMEM1)
+ r_beta = s_beta._reinterpret(gl.float32, [TP, BVC], SMEM1)
+ r_v = s_v._reinterpret(gl.float32, [TP, BVC], SMEM1)
+
+ # state: zeros + h0 (as the Triton walk)
+ b_h = gl.zeros([K, BVC], gl.float32, LH)
+ if idx > PAD_SLOT_ID:
+ b_h += h0_raw.to(gl.float32)
+
+ # the request's snapshot slot (ROW_SLOTS: row 0's); snapshot of row r in slot s at p_snap + s * stride_snap_slot +
+ # r * stride_snap_row
+ cache_idx = gl.load(p_slots).to(gl.int64)
+ p_snap = intermediate_states_buffer + o_state
+ p_par = retrieve_parent_token_ptr + i_n * stride_rpt_seq
+ p_o = o + bos * stride_o + i_hv * V + vv
+ col_ok = gl.expand_dims(vv, 0) < V
+
+ # The parent reload is unmasked: the grid tiles V in whole BVC-column tiles, so col_ok holds everywhere. Without a
+ # snapshot slot nothing is reloaded and the state carries in registers. T <= TP: the launcher only runs requests
+ # of at most `width` tokens.
+ b_hp = gl.zeros([K, BVC], gl.float32, LH)
+ b_qp = gl.zeros([K], gl.float32, LKV)
+ for s in range(0, T):
+ n_parent = gl.load(p_par + (s + 1) * stride_rpt_tok, mask=s + 1 < T, other=0)
+ slot = cache_idx
+ if ROW_SLOTS:
+ slot = gl.load(p_slots + s * stride_snap_indices_row).to(gl.int64)
+ s32 = s.to(gl.int32)
+ b_q = r_q.index(s32).load(LKV)
+ b_k = r_k.index(s32).load(LKV)
+ b_egs = r_eg.index(s32).load(LVV)
+ b_bts = r_beta.index(s32).load(LVV)
+ b_v = r_v.index(s32).load(LVV)
+
+ # node s - 1's output, next to node s's h.k reduction
+ b_op = gl.sum(b_hp * gl.expand_dims(b_qp, 1), axis=0)
+ gl.store(p_o + (s - 1) * stride_o, b_op.to(o.dtype.element_ty), mask=(vv < V) & (s > 0))
+ b_h *= gl.expand_dims(b_egs, 0)
+ b_v -= _dot_k(b_h, b_k, LVV)
+ n_parent_slot = cache_idx
+ if ROW_SLOTS:
+ # issued here, where n_parent has landed
+ n_parent_slot = gl.load(p_slots + n_parent * stride_snap_indices_row, mask=s + 1 < T, other=PAD_SLOT_ID).to(
+ gl.int64
+ )
+ b_v *= b_bts
+ b_h = gl.fma(gl.expand_dims(b_k, 1), gl.expand_dims(b_v, 0), b_h)
+ gl.store(
+ p_snap + slot * stride_snap_slot + s * stride_snap_row,
+ b_h.to(intermediate_states_buffer.dtype.element_ty),
+ mask=col_ok & (slot > PAD_SLOT_ID),
+ )
+ b_hp = b_h
+ b_qp = b_q
+ # node s + 1's parent, after node s's snapshot store it may read back (same thread, program order); an fp32
+ # snapshot reloads exactly what the registers hold, so a chain child keeps them (as the walk does)
+ if (s + 1 < T) & (n_parent_slot > PAD_SLOT_ID) & ((not SKIP_CHAIN_RELOAD) | (n_parent != s)):
+ b_h = gl.load(p_snap + n_parent_slot * stride_snap_slot + n_parent * stride_snap_row).to(gl.float32)
+ b_op = gl.sum(b_hp * gl.expand_dims(b_qp, 1), axis=0)
+ gl.store(p_o + (T - 1) * stride_o, b_op.to(o.dtype.element_ty), mask=(vv < V) & (T > 0))
+
+
+def gluon_recurrent_update(
+ A_log,
+ dt_bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ *,
+ initial_state_source,
+ initial_state_indices,
+ cu_seqlens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ retrieve_parent_token,
+ num_accepted_tokens=None,
+ pad_slot_id: int = PAD_SLOT_ID,
+ out=None,
+ publish=None,
+ scale=None,
+ softplus_beta: float = 1.0,
+ softplus_threshold: float = 20.0,
+ use_pdl: bool = False,
+) -> torch.Tensor:
+ """Launch the kernel. Same contract as the Triton walk of ``gdn_tree_recurrent_update``. Every request must have
+ at most retrieve_parent_token.shape[1] tokens (the precompute holds max(8, next_pow2(width)) of them);
+ :func:`gluon_admits` checks the launch."""
+ _, _, H, K = k.shape
+ HV, V = v.shape[2], v.shape[3]
+ N = cu_seqlens.numel() - 1
+ BVC = 4 * NUM_WARPS
+ # the precompute layouts cover 8 token rows
+ TP = max(8, triton.next_power_of_2(retrieve_parent_token.shape[1]))
+ if scale is None:
+ scale = K**-0.5
+ if out is None:
+ out = q.new_empty(v.shape)
+ extra = {"launch_pdl": True} if use_pdl else {}
+ _recurrence_kernel[(V // BVC, N * HV)](
+ A_log=A_log,
+ a=a,
+ dt_bias=dt_bias,
+ q=q,
+ k=k,
+ v=v,
+ b=b,
+ o=out,
+ h0_source=initial_state_source,
+ h0_indices=initial_state_indices,
+ cu_seqlens=cu_seqlens,
+ intermediate_states_buffer=intermediate_states_buffer,
+ intermediate_state_indices=intermediate_state_indices,
+ **gdn_tree_state_args(
+ initial_state_source,
+ initial_state_indices,
+ num_accepted_tokens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ publish,
+ ),
+ retrieve_parent_token_ptr=retrieve_parent_token,
+ stride_rpt_seq=retrieve_parent_token.stride(0),
+ stride_rpt_tok=retrieve_parent_token.stride(1),
+ softplus_beta=softplus_beta,
+ softplus_threshold=softplus_threshold,
+ scale=scale,
+ stride_a=a.stride()[-2],
+ stride_q=q.stride()[1],
+ stride_k=k.stride()[1],
+ stride_v=v.stride()[1],
+ stride_b=b.stride()[-2],
+ stride_o=out.stride(1),
+ H=H,
+ HV=HV,
+ K=K,
+ V=V,
+ NW=NUM_WARPS,
+ TP=TP,
+ PAD_SLOT_ID=pad_slot_id,
+ USE_PDL=use_pdl,
+ SKIP_CHAIN_RELOAD=intermediate_states_buffer.dtype == torch.float32,
+ STATE_VEC=16 // intermediate_states_buffer.element_size(),
+ num_warps=NUM_WARPS,
+ enable_fp_fusion=False, # only the written FMAs, as in the Triton walk's launch
+ **extra,
+ )
+ return out
+
+
+def gluon_admits(
+ *,
+ A_log,
+ a,
+ dt_bias,
+ q,
+ k,
+ v,
+ b,
+ initial_state_source,
+ initial_state_indices,
+ cu_seqlens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ retrieve_parent_token,
+ num_accepted_tokens=None,
+ out=None,
+ publish=None,
+) -> bool:
+ """Whether a tree verify launch is one the kernel was validated for: requests of width 3..32 (at most `width`
+ tokens each: the caller's contract, checked for one request), the validated head shapes, bf16 activations with
+ fp32 A_log, a pool and snapshot buffer of one dtype (bf16 or fp32) in either slot layout, int32 tables, the serving layouts, a
+ and b with a unit column stride, 16-byte aligned pointers for every other tensor (the self-check reproduces the
+ live strides and the alignment of a and b, so its inputs specialise the same way), and q / k / v token strides
+ divisible by 16, on a validated GPU."""
+ i32 = torch.int32
+ # common rejections first: an eager tree verify passes int64 tree links
+ if not (
+ retrieve_parent_token.dtype == i32
+ and retrieve_parent_token.ndim == 2
+ and cu_seqlens.dtype == i32
+ and cu_seqlens.ndim == 1
+ and MIN_WIDTH <= retrieve_parent_token.shape[1] <= MAX_WIDTH
+ ):
+ return False
+ if q.ndim != 4 or k.ndim != 4 or v.ndim != 4 or a.ndim != 2 or b.ndim != 2:
+ return False
+ if initial_state_source is None or initial_state_source.ndim != 4:
+ return False
+ row_slots = intermediate_state_indices.ndim == 2
+ if intermediate_states_buffer.ndim != (4 if row_slots else 5):
+ return False
+ if initial_state_indices.ndim != (1 if num_accepted_tokens is None else 2):
+ return False
+ _, T, H, K = k.shape
+ HV, V = v.shape[2], v.shape[3]
+ N = cu_seqlens.numel() - 1
+ width = retrieve_parent_token.shape[1]
+ bf16 = torch.bfloat16
+ state_dtypes = (bf16, torch.float32)
+ if row_slots:
+ # one slot per row (vLLM): a [slots, HV, V, K] buffer with any slot stride
+ snapshots_ok = (
+ intermediate_states_buffer.shape[1:] == (HV, V, K)
+ and intermediate_states_buffer.stride()[1:] == (V * K, K, 1)
+ and intermediate_state_indices.shape[1] >= width
+ )
+ else:
+ # one scratch row of `steps` snapshots per request (sglang)
+ snapshots_ok = (
+ intermediate_states_buffer.shape[2:] == (HV, V, K)
+ and intermediate_states_buffer.is_contiguous()
+ and width <= intermediate_states_buffer.shape[1]
+ )
+ optional = [t for t in (num_accepted_tokens, out, publish) if t is not None]
+ # a and b are read with scalar per-head loads through stride_a / stride_b, so they only need a unit column stride
+ # (a tree verify may pass them as column slices of the in_proj_ba output [b | a], a at a 24-byte offset at TP4);
+ # every other tensor stays 16-byte aligned.
+ tensors = [
+ A_log,
+ dt_bias,
+ q,
+ k,
+ v,
+ initial_state_source,
+ initial_state_indices,
+ cu_seqlens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ retrieve_parent_token,
+ *optional,
+ ]
+ return (
+ admits_shape(H, HV, K, V)
+ and snapshots_ok
+ and q.shape == k.shape
+ and q.shape[0] == 1
+ and v.shape[:2] == q.shape[:2]
+ and q.stride(3) == 1
+ and q.stride(2) == K
+ and k.stride(3) == 1
+ and k.stride(2) == K
+ and v.stride(3) == 1
+ and v.stride(2) == V
+ # Triton vectorizes the walk's q / k rows (4 consecutive K per lane, the Gluon layout's reduction order) only
+ # where it knows the rows are aligned; other strides reduce the norms in another order.
+ and q.stride(1) % 16 == 0
+ and k.stride(1) % 16 == 0
+ and v.stride(1) % 16 == 0
+ and a.shape == (T, HV)
+ and b.shape == (T, HV)
+ and a.stride(-1) == 1
+ and b.stride(-1) == 1
+ and q.dtype == bf16
+ and k.dtype == bf16
+ and v.dtype == bf16
+ and a.dtype == bf16
+ and b.dtype == bf16
+ and dt_bias.dtype == bf16
+ and A_log.dtype == torch.float32
+ and initial_state_source.dtype in state_dtypes
+ and initial_state_source.dtype == intermediate_states_buffer.dtype
+ and initial_state_source.shape[1:] == (HV, V, K)
+ and initial_state_source.stride()[1:] == (V * K, K, 1)
+ and intermediate_states_buffer.dtype in state_dtypes
+ and initial_state_indices.dtype == i32
+ and intermediate_state_indices.dtype == i32
+ and (num_accepted_tokens is None or num_accepted_tokens.dtype == i32)
+ and (out is None or (out.dtype == bf16 and out.shape == v.shape and out.stride()[2:] == (V, 1)))
+ and (publish is None or (publish.dtype == i32 and publish.ndim == 2 and publish.stride(1) == 1))
+ and T <= N * width
+ and all(t.data_ptr() % 16 == 0 for t in tensors)
+ and q.is_cuda
+ and arch.gluon_gdn(q.device)
+ )
+
+
+class _GluonState:
+ """Process-wide dispatch state: signatures that passed the self-check, and a permanent switch back to the Triton
+ walk after any failure."""
+
+ def __init__(self):
+ self.disabled = False
+ self.checked = set()
+
+
+_STATE = _GluonState()
+
+
+def reset_gdn_tree_gluon_state() -> None:
+ """Forget the self-check results and re-enable the kernel (tests)."""
+ global _STATE
+ _STATE = _GluonState()
+
+
+def gdn_tree_gluon_disabled() -> bool:
+ """Whether a failed check switched the Gluon kernel off for this process."""
+ return _STATE.disabled
+
+
+def _disable(reason: str) -> None:
+ if not _STATE.disabled:
+ logger.warning("GDN tree verify: %s; using the Triton walk for the rest of this process.", reason)
+ _STATE.disabled = True
+
+
+def _signature(live: dict, use_pdl: bool) -> tuple:
+ # everything that can change the compiled variants of either kernel for a launch gluon_admits admits:
+ # dtypes, strides, which optional tensors are given, the slot layout, the width (TP), and the 16-byte alignment of
+ # every pointer (Triton specialises a pointer on it); table and pool sizes along the slot axis do not matter
+ def desc(name):
+ t = live[name]
+ if t is None:
+ return None
+ sizes = tuple(t.shape) if name in ("q", "k", "v", "a", "b", "out", "retrieve_parent_token") else t.shape[1:]
+ return t.dtype, tuple(sizes), t.stride(), t.data_ptr() % 16
+
+ return (live["q"].device.index, use_pdl, live["pad_slot_id"], *(desc(name) for name in sorted(_TENSORS)))
+
+
+def _bitwise_equal(x: torch.Tensor, y: torch.Tensor) -> bool:
+ if x.shape != y.shape or x.dtype != y.dtype:
+ return False
+ int_dtype = {1: torch.int8, 2: torch.int16, 4: torch.int32, 8: torch.int64}
+ view = int_dtype[x.element_size()]
+ return torch.equal(x.contiguous().view(view), y.contiguous().view(view))
+
+
+_TENSORS = (
+ "A_log",
+ "a",
+ "dt_bias",
+ "q",
+ "k",
+ "v",
+ "b",
+ "initial_state_source",
+ "initial_state_indices",
+ "num_accepted_tokens",
+ "cu_seqlens",
+ "intermediate_states_buffer",
+ "intermediate_state_indices",
+ "retrieve_parent_token",
+ "out",
+ "publish",
+)
+
+
+def _self_check(reference: Callable[..., torch.Tensor], live: dict, use_pdl: bool) -> bool:
+ """Run one random tree of the live launch's width (one request) through the Triton walk (reference) and this
+ kernel, on fresh tensors with the live
+ dtypes, strides, slot layout and offsets from a 16-byte boundary (so both kernels compile the variants serving
+ uses), and compare o and every state, slot and publish buffer bitwise. Uses its own generators (no global RNG
+ draw)."""
+ q = live["q"]
+ dev = q.device
+ parents_live = live["retrieve_parent_token"]
+ width = parents_live.shape[1]
+ T = min(q.shape[1], width)
+ H = q.shape[2]
+ HV, V, K = live["initial_state_source"].shape[1:]
+ gen = torch.Generator(device=dev)
+ gen.manual_seed(20260930 + width)
+ rng = random.Random(20260930 + width)
+
+ def like(t, values):
+ # values in a tensor with t's strides, dtype and offset from a 16-byte boundary (a / b may be unaligned
+ # column slices)
+ pad = t.data_ptr() % 16 // t.element_size()
+ shape = values.shape
+ size = pad + (1 + sum((n - 1) * s for n, s in zip(shape, t.stride())) if values.numel() else 0)
+ out = torch.empty(size, dtype=t.dtype, device=dev).as_strided(shape, t.stride(), pad)
+ out.copy_(values)
+ return out
+
+ def randn(shape, scale=1.0):
+ return torch.randn(shape, device=dev, generator=gen) * scale
+
+ def i32(values):
+ return torch.tensor(values, dtype=torch.int32, device=dev)
+
+ act = torch.nn.functional.silu
+ args = dict(
+ A_log=like(live["A_log"], torch.log(torch.rand(live["A_log"].shape, device=dev, generator=gen) * 15 + 1)),
+ a=like(live["a"], randn((T, HV))),
+ dt_bias=like(live["dt_bias"], randn(live["dt_bias"].shape, 0.5)),
+ softplus_beta=live["softplus_beta"],
+ softplus_threshold=live["softplus_threshold"],
+ q=like(q, act(randn((1, T, H, K)))),
+ k=like(live["k"], act(randn((1, T, H, K)))),
+ v=like(live["v"], act(randn((1, T, HV, V)))),
+ b=like(live["b"], randn((T, HV))),
+ scale=live["scale"],
+ cu_seqlens=like(live["cu_seqlens"], i32([0, T])),
+ retrieve_parent_token=like(parents_live, i32([[0] + [rng.randrange(i) for i in range(1, width)]])),
+ pad_slot_id=live["pad_slot_id"],
+ )
+ # slot tables (a 2-D table addresses slots 1..S of a pool of S + 1; vLLM passes one table for both uses) and the
+ # state buffers, random so a stray or missing store shows up
+ pool_live, scratch_live = live["initial_state_source"], live["intermediate_states_buffer"]
+ snap_live, init_live = live["intermediate_state_indices"], live["initial_state_indices"]
+ if snap_live.ndim == 2:
+ slots = snap_live.shape[1]
+ snap_idx = like(snap_live, torch.arange(1, slots + 1, dtype=torch.int32, device=dev)[None])
+ scratch = like(scratch_live, randn((slots + 1, HV, V, K), 0.05))
+ else:
+ snap_idx = like(snap_live, i32([0]))
+ scratch = like(scratch_live, randn((1, scratch_live.shape[1], HV, V, K)))
+ if init_live is snap_live:
+ init_idx = snap_idx
+ elif init_live.ndim == 2:
+ init_idx = like(init_live, torch.arange(1, init_live.shape[1] + 1, dtype=torch.int32, device=dev)[None])
+ else:
+ init_idx = like(init_live, i32([0]))
+ states = dict(
+ initial_state_source=scratch
+ if pool_live is scratch_live
+ else like(pool_live, randn((max(2, init_idx.shape[-1] + 1), HV, V, K), 0.05)),
+ intermediate_states_buffer=scratch,
+ )
+ if live["out"] is not None:
+ states["out"] = like(live["out"], torch.zeros(1, T, HV, V))
+ if live["publish"] is not None:
+ states["publish"] = like(live["publish"], torch.full((1, live["publish"].shape[1]), -7))
+ args.update(initial_state_indices=init_idx, intermediate_state_indices=snap_idx)
+ if live["num_accepted_tokens"] is not None:
+ args["num_accepted_tokens"] = like(live["num_accepted_tokens"], i32([min(2, init_idx.shape[-1])]))
+
+ def fresh_states():
+ copies = {name: like(t, t) for name, t in states.items() if name != "initial_state_source"}
+ pool = states["initial_state_source"]
+ copies["initial_state_source"] = copies["intermediate_states_buffer"] if pool is scratch else like(pool, pool)
+ return copies
+
+ ref_states, gl_states = fresh_states(), fresh_states()
+ o_ref = reference(**args, **ref_states)
+ # The Triton walk is this launch's predecessor; it writes none of the pre-wait inputs (pool, slots,
+ # num_accepted, cu_seqlens) the Gluon kernel reads before its griddepcontrol.wait.
+ o_gl = gluon_recurrent_update(**args, **gl_states, use_pdl=use_pdl)
+ return _bitwise_equal(o_ref, o_gl) and all(_bitwise_equal(ref_states[n], gl_states[n]) for n in ref_states)
+
+
+def gluon_dispatch(reference: Callable[..., torch.Tensor], *, use_pdl: bool, **launch) -> Optional[torch.Tensor]:
+ """Run the Gluon kernel for a validated launch and return o, or return None so the caller runs the Triton walk.
+ ``launch`` holds gdn_tree_recurrent_update's arguments; reference is that launcher restricted to the Triton walk
+ (the self-check's reference).
+
+ The first launch of each signature runs _self_check first. It needs synchronisation and JIT compilation, so it
+ never runs inside CUDA-graph capture: an unchecked signature met during capture is served by the Triton walk
+ (serving warms every verify graph eagerly first, so its signatures are checked before capture). Any failure
+ disables the kernel for the process. Under torch.compile tracing the Triton walk serves as well."""
+ if _STATE.disabled or torch.compiler.is_compiling():
+ return None
+ live = {name: launch.get(name) for name in _TENSORS}
+ if not gluon_admits(**live):
+ return None
+ live.update(
+ pad_slot_id=launch["pad_slot_id"],
+ softplus_beta=launch["softplus_beta"],
+ softplus_threshold=launch["softplus_threshold"],
+ scale=launch["scale"],
+ )
+ key = _signature(live, use_pdl)
+ if key not in _STATE.checked:
+ if torch.cuda.is_current_stream_capturing():
+ return None
+ try:
+ ok = _self_check(reference, live, use_pdl)
+ except Exception as e: # compile / launch error
+ _disable(f"Gluon kernel self-check raised {type(e).__name__}: {e}")
+ return None
+ if not ok:
+ _disable("Gluon kernel is not bitwise equal to the Triton walk (self-check)")
+ return None
+ _STATE.checked.add(key)
+ logger.info(
+ "GDN tree verify: Gluon kernel self-check passed (width %d, pdl %s, %s slots).",
+ launch["retrieve_parent_token"].shape[1],
+ use_pdl,
+ "per-row" if launch["intermediate_state_indices"].ndim == 2 else "per-request",
+ )
+ try:
+ return gluon_recurrent_update(**launch, use_pdl=use_pdl)
+ except Exception as e: # launch error after a passing self-check
+ _disable(f"Gluon kernel launch raised {type(e).__name__}: {e}")
+ return None
diff --git a/eagle_harness/kernels/gdn_tree_records.py b/eagle_harness/kernels/gdn_tree_records.py
new file mode 100644
index 0000000..f4c2a18
--- /dev/null
+++ b/eagle_harness/kernels/gdn_tree_records.py
@@ -0,0 +1,576 @@
+# Copyright (c) 2026 Advanced Micro Devices, Inc.
+# SPDX-License-Identifier: Apache-2.0
+# Modified by Eagle AI Corp.
+"""AMD tree recurrence records and accepted-path replay for ROCm."""
+
+import functools
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels.gdn_tree_recurrence import _path_token as _gdn_tree_path_token
+
+
+def _gdn_tree_records_kernel(
+ q_pre, # (tokens, H, K) fp32: normalized q * scale (_gdn_tree_pre_kernel)
+ k_pre, # (tokens, H, K) fp32: normalized k
+ gb_pre, # (tokens, HV, 2) fp32: exp(g), beta
+ v,
+ o,
+ h0_source,
+ h0_indices,
+ stride_h0_source,
+ cu_seqlens,
+ records, # (rows, steps, HV, REC) fp32: delta [0, V), key [V, V + K), decay at V + K
+ record_indices,
+ stride_records_row,
+ tree_paths, # (batch, P, 2 + DMAX) int32: length, write_from, root path
+ stride_paths_seq,
+ stride_paths_path,
+ stride_v,
+ H: tl.constexpr,
+ HV: tl.constexpr,
+ K: tl.constexpr,
+ V: tl.constexpr,
+ BK: tl.constexpr,
+ BV: tl.constexpr,
+ REC: tl.constexpr,
+ DMAX: tl.constexpr,
+ DMAX_P2: tl.constexpr,
+ ROUND_STATE: tl.constexpr,
+):
+ # The path replay with replay records instead of snapshots. ROUND_STATE (a bf16 scratch): every node but the
+ # first starts from its parent's state rounded to bf16, the state the serial walk reloads from the parent's bf16
+ # snapshot. Each owned node writes its record: delta (its V block), and from V block 0 the key and the decay.
+ # The per-token math (normalized q and k, decay, beta) comes from the pre kernel: computed once per token and
+ # head instead of in every V block's serial loop.
+ i_v, i_nh, i_p = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ i_n, i_hv = i_nh // HV, i_nh % HV
+ i_h = i_hv // (HV // H)
+
+ bos = tl.load(cu_seqlens + i_n).to(tl.int64)
+ eos = tl.load(cu_seqlens + i_n + 1).to(tl.int64)
+ rec_idx = tl.load(record_indices + i_n).to(tl.int64)
+ p_path = tree_paths + i_n * stride_paths_seq + i_p * stride_paths_path
+ # a row without records never reloads a parent in the serial walk: one chain (path 0), no rounding
+ linear = rec_idx < 0
+ L = tl.where(linear, tl.where(i_p == 0, (eos - bos).to(tl.int32), 0), tl.load(p_path))
+ wfrom = tl.where(linear, 0, tl.load(p_path + 1))
+ if L > 0:
+ offs_d = tl.arange(0, DMAX_P2)
+ toks = tl.load(p_path + 2 + offs_d, mask=(offs_d < DMAX) & (offs_d < L) & (rec_idx >= 0)).to(tl.int64)
+ o_k = tl.arange(0, BK)
+ o_v = i_v * BV + tl.arange(0, BV)
+ mask_k = o_k < K
+ mask_v = o_v < V
+ mask_h = mask_k[:, None] & mask_v[None, :]
+ o_state = i_hv * K * V + o_v[None, :] * K + o_k[:, None]
+ p_v = v + i_hv * V + o_v
+ p_rec = records + rec_idx * stride_records_row + i_hv * REC
+
+ b_h = tl.zeros([BK, BV], dtype=tl.float32)
+ idx = tl.load(h0_indices + i_n).to(tl.int64)
+ if idx >= 0:
+ b_h += tl.load(h0_source + idx * stride_h0_source + o_state, mask=mask_h, other=0).to(tl.float32)
+
+ for d in range(0, L):
+ u_t = bos + _gdn_tree_path_token(toks, offs_d, d, linear)
+ u_q = tl.load(q_pre + (u_t * H + i_h) * K + o_k, mask=mask_k, other=0)
+ u_k = tl.load(k_pre + (u_t * H + i_h) * K + o_k, mask=mask_k, other=0)
+ u_eg = tl.load(gb_pre + (u_t * HV + i_hv) * 2)
+ u_beta = tl.load(gb_pre + (u_t * HV + i_hv) * 2 + 1)
+ r_v = tl.load(p_v + u_t * stride_v, mask=mask_v, other=0).to(tl.float32)
+ # the serial kernel's per-node math, in its order
+ if ROUND_STATE:
+ if (d > 0) & (rec_idx >= 0):
+ b_h = b_h.to(h0_source.dtype.element_ty).to(tl.float32)
+ b_h *= u_eg
+ b_v = r_v - tl.sum(b_h * u_k[:, None], 0)
+ b_v *= u_beta
+ b_h += u_k[:, None] * b_v[None, :]
+ if d >= wfrom:
+ b_o = tl.sum(b_h * u_q[:, None], 0)
+ tl.store(o + (u_t * HV + i_hv) * V + o_v, b_o.to(o.dtype.element_ty), mask=mask_v)
+ if rec_idx >= 0:
+ p_node = p_rec + (u_t - bos) * HV * REC
+ tl.store(p_node + o_v, b_v, mask=mask_v)
+ if i_v == 0:
+ tl.store(p_node + V + o_k, u_k, mask=mask_k)
+ tl.store(p_node + V + K, u_eg)
+
+
+def _gdn_tree_pre_kernel(
+ A_log,
+ a,
+ dt_bias,
+ softplus_beta,
+ softplus_threshold,
+ q,
+ k,
+ b,
+ q_pre, # (tokens, H, K) fp32: normalized q * scale
+ k_pre, # (tokens, H, K) fp32: normalized k
+ gb_pre, # (tokens, HV, 2) fp32: exp(g), beta
+ scale,
+ stride_a,
+ stride_q,
+ stride_k,
+ stride_b,
+ H: tl.constexpr,
+ HV: tl.constexpr,
+ K: tl.constexpr,
+ BK: tl.constexpr,
+):
+ # The serial walk's per-token math, once per (token, v-head) instead of in every V block's serial loop:
+ # the same expressions, so the walk that reads them computes the same values.
+ i_t, i_hv = tl.program_id(0), tl.program_id(1)
+ i_h = i_hv // (HV // H)
+ b_A_log = tl.load(A_log + i_hv).to(tl.float32)
+ b_dt_bias = tl.load(dt_bias + i_hv).to(tl.float32)
+ b_a = tl.load(a + i_t * stride_a + i_hv).to(tl.float32)
+ b_b = tl.load(b + i_t * stride_b + i_hv).to(tl.float32)
+ x = b_a + b_dt_bias
+ beta_x = softplus_beta * x
+ softplus_x = tl.where(
+ beta_x <= softplus_threshold,
+ (1.0 / softplus_beta) * tl.log(1.0 + tl.exp(beta_x)),
+ x,
+ )
+ b_g = -tl.exp(b_A_log) * softplus_x
+ b_beta = 1.0 / (1.0 + tl.exp(-b_b))
+ b_beta = b_beta.to(b.dtype.element_ty).to(tl.float32)
+ tl.store(gb_pre + (i_t * HV + i_hv) * 2, tl.exp(b_g))
+ tl.store(gb_pre + (i_t * HV + i_hv) * 2 + 1, b_beta)
+ if i_hv % (HV // H) == 0:
+ o_k = tl.arange(0, BK)
+ mask_k = o_k < K
+ b_q = tl.load(q + i_t * stride_q + i_h * K + o_k, mask=mask_k, other=0).to(tl.float32)
+ b_k = tl.load(k + i_t * stride_k + i_h * K + o_k, mask=mask_k, other=0).to(tl.float32)
+ b_q = b_q / (tl.sqrt(tl.sum(b_q * b_q) + 1e-6))
+ b_k = b_k / (tl.sqrt(tl.sum(b_k * b_k) + 1e-6))
+ b_q = b_q * scale
+ tl.store(q_pre + (i_t * H + i_h) * K + o_k, b_q, mask=mask_k)
+ tl.store(k_pre + (i_t * H + i_h) * K + o_k, b_k, mask=mask_k)
+
+
+def _gdn_tree_records_commit_kernel(
+ state, # (L, slots, HV, V, K) pool
+ stride_state_layer,
+ stride_state_slot,
+ records, # (L, rows, steps, HV, REC) fp32
+ stride_records_layer,
+ stride_records_row,
+ state_indices,
+ record_indices,
+ commit_steps,
+ parent, # (batch, width) int32: parent node of every node, node 0 the root
+ stride_parent_seq,
+ stride_parent_token,
+ HV: tl.constexpr,
+ K: tl.constexpr,
+ V: tl.constexpr,
+ BK: tl.constexpr,
+ BV: tl.constexpr,
+ REC: tl.constexpr,
+ DMAX: tl.constexpr,
+ DMAX_P2: tl.constexpr,
+ ROUND_STATE: tl.constexpr,
+):
+ # One program per (V block, request * v-head, layer): the accepted node's state, replayed over its root path from
+ # the request's pool state (the same fold, roundings included, as the verify), written back to the pool.
+ i_v, i_nh, i_l = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ i_n, i_hv = i_nh // HV, i_nh % HV
+ step = tl.load(commit_steps + i_n).to(tl.int32)
+ slot = tl.load(state_indices + i_n).to(tl.int64)
+ row = tl.load(record_indices + i_n).to(tl.int64)
+ if (step >= 0) & (slot >= 0) & (row >= 0):
+ # root path, accepted node first: path[j] = parent^j(step) while >= 0
+ offs_d = tl.arange(0, DMAX_P2)
+ path = tl.full([DMAX_P2], -1, dtype=tl.int32)
+ node = step
+ p_par = parent + i_n * stride_parent_seq
+ for j in range(DMAX):
+ path = tl.where(offs_d == j, node, path)
+ # int32 whatever the parent table's dtype: sglang's eager verify builds it int64, its graphs int32.
+ nxt = tl.load(p_par + node * stride_parent_token, mask=node > 0, other=-1).to(tl.int32)
+ node = tl.where(node > 0, nxt, -1)
+ L = tl.sum((path >= 0).to(tl.int32))
+
+ o_k = tl.arange(0, BK)
+ o_v = i_v * BV + tl.arange(0, BV)
+ mask_k = o_k < K
+ mask_v = o_v < V
+ mask_h = mask_k[:, None] & mask_v[None, :]
+ p_state = state + i_l * stride_state_layer + slot * stride_state_slot + i_hv * K * V
+ o_state = o_v[None, :] * K + o_k[:, None]
+ b_h = tl.load(p_state + o_state, mask=mask_h, other=0).to(tl.float32)
+ p_rec = records + i_l * stride_records_layer + row * stride_records_row + i_hv * REC
+ for d in range(0, L):
+ n = tl.sum(tl.where(offs_d == L - 1 - d, path, 0))
+ p_node = p_rec + n.to(tl.int64) * HV * REC
+ u_eg = tl.load(p_node + V + K)
+ u_k = tl.load(p_node + V + o_k, mask=mask_k, other=0)
+ u_d = tl.load(p_node + o_v, mask=mask_v, other=0)
+ if ROUND_STATE:
+ if d > 0:
+ b_h = b_h.to(state.dtype.element_ty).to(tl.float32)
+ b_h *= u_eg
+ b_h += u_k[:, None] * u_d[None, :]
+ tl.store(p_state + o_state, b_h.to(state.dtype.element_ty), mask=mask_h)
+
+
+def gdn_tree_records_commit(
+ state: torch.Tensor,
+ records: torch.Tensor,
+ state_indices: torch.Tensor,
+ record_indices: torch.Tensor,
+ commit_steps: torch.Tensor,
+ parent: torch.Tensor,
+ round_state: bool,
+) -> None:
+ """Commit the accepted node of every request into ``state`` (all layers, one launch) by replaying its root path's
+ records. state: (L, slots, HV, V, K); records: (L, rows, steps, HV, REC); parent: (batch, width), node 0 the root;
+ a negative step, slot or row skips the request."""
+ L_layers, _, HV, V, K = state.shape
+ n = commit_steps.shape[0]
+ if n == 0:
+ return
+ assert records.shape[0] == L_layers and records.shape[3] == HV and state.stride(-1) == 1
+ assert state.stride(3) == K and state.stride(2) == V * K, "contiguous (V, K) state per head"
+ dmax = parent.shape[1]
+ BV = min(triton.next_power_of_2(V), 32)
+ _gdn_tree_records_commit_kernel[(triton.cdiv(V, BV), n * HV, L_layers)](
+ state,
+ state.stride(0),
+ state.stride(1),
+ records,
+ records.stride(0),
+ records.stride(1),
+ state_indices,
+ record_indices,
+ commit_steps,
+ parent,
+ parent.stride(0),
+ parent.stride(1),
+ HV=HV,
+ K=K,
+ V=V,
+ BK=triton.next_power_of_2(K),
+ BV=BV,
+ REC=records.shape[4],
+ DMAX=dmax,
+ DMAX_P2=triton.next_power_of_2(dmax),
+ ROUND_STATE=round_state,
+ num_warps=4,
+ )
+
+
+def _gdn_tree_chunk_kernel(
+ q_pre, # (tokens, H, K) fp32: normalized q * scale (_gdn_tree_pre_kernel)
+ k_pre, # (tokens, H, K) fp32: normalized k
+ gb_pre, # (tokens, HV, 2) fp32: exp(g), beta
+ v,
+ o,
+ h0_source,
+ h0_indices,
+ stride_h0_source,
+ cu_seqlens,
+ parent, # (batch, >= tokens per request) parent node of every node, node 0 the root
+ stride_parent,
+ records, # (rows, steps, HV, REC) fp32: delta [0, V), key [V, V + K), decay at V + K
+ record_indices,
+ stride_records_row,
+ stride_v,
+ H: tl.constexpr,
+ HV: tl.constexpr,
+ K: tl.constexpr,
+ V: tl.constexpr,
+ BV: tl.constexpr,
+ NP: tl.constexpr,
+ REC: tl.constexpr,
+ LOG2N: tl.constexpr,
+ VSPLIT: tl.constexpr = 1,
+):
+ # The tree as one chunk of the gated delta rule with the ancestor mask in place of the causal one, per
+ # (request, v-head); no per-node state exists (the commit replays the records, without per-node rounding):
+ # R = strict-ancestor closure of the parent links, G_t = prod of exp(g) along the root path of t,
+ # D = (I + diag(beta) (R o G_t/G_j o K K^T))^-1 diag(beta) (V - diag(G) K S0) (inverse by doubling),
+ # O = diag(G) Q S0 + ((R + I) o G_t/G_j o Q K^T) D.
+ # VSPLIT programs per (request, v-head) share the V columns (few requests: more programs in flight).
+ i_n, i_hv, i_vs = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ i_h = i_hv // (HV // H)
+ bos = tl.load(cu_seqlens + i_n).to(tl.int64)
+ T = (tl.load(cu_seqlens + i_n + 1).to(tl.int64) - bos).to(tl.int32)
+ rn = tl.arange(0, NP)
+ cn = tl.arange(0, NP)
+ o_k = tl.arange(0, K)
+ m_n = rn < T
+ tok = bos + rn
+ Kt = tl.load(k_pre + (tok[:, None] * H + i_h) * K + o_k[None, :], mask=m_n[:, None], other=0.0)
+ Qt = tl.load(q_pre + (tok[:, None] * H + i_h) * K + o_k[None, :], mask=m_n[:, None], other=0.0)
+ eg = tl.load(gb_pre + (tok * HV + i_hv) * 2, mask=m_n, other=1.0)
+ beta = tl.load(gb_pre + (tok * HV + i_hv) * 2 + 1, mask=m_n, other=0.0)
+ par = tl.load(parent + i_n * stride_parent + rn, mask=m_n & (rn > 0), other=-1)
+ R = (cn[None, :] == par[:, None]).to(tl.float32)
+ for _ in tl.static_range(LOG2N):
+ R = tl.minimum(R + tl.dot(R, R, input_precision="ieee"), 1.0)
+ eye = (rn[:, None] == cn[None, :]).to(tl.float32)
+ M = R + eye
+ logG = tl.sum(M * tl.log(tl.maximum(eg, 1e-30))[None, :], 1)
+ G = tl.exp(logG)
+ # G_t / G_j where j is an ancestor-or-self of t (elsewhere it can overflow)
+ ratio = tl.where(M > 0, tl.exp(logG[:, None] - logG[None, :]), 0.0)
+ KK = tl.dot(Kt, tl.trans(Kt), input_precision="ieee")
+ QK = tl.dot(Qt, tl.trans(Kt), input_precision="ieee")
+ L = beta[:, None] * (R * ratio * KK)
+ # (I + L)^-1 = (I - L)(I + L^2)(I + L^4)... (L is nilpotent: strict ancestors only)
+ Tinv = eye - L
+ P = tl.dot(L, L, input_precision="ieee")
+ for _ in tl.static_range(LOG2N - 1):
+ Tinv = tl.dot(Tinv, eye + P, input_precision="ieee")
+ P = tl.dot(P, P, input_precision="ieee")
+ W = ratio * QK
+ idx = tl.load(h0_indices + i_n).to(tl.int64)
+ row = tl.load(record_indices + i_n).to(tl.int64)
+ p_rec = records + row * stride_records_row + (rn[:, None] * HV + i_hv) * REC
+ for vb in tl.static_range(V // BV // VSPLIT):
+ o_v = (i_vs * (V // BV // VSPLIT) + vb) * BV + tl.arange(0, BV)
+ S0 = tl.load(
+ h0_source + idx * stride_h0_source + i_hv * K * V + o_v[None, :] * K + o_k[:, None],
+ mask=(idx >= 0),
+ other=0.0,
+ ).to(tl.float32)
+ KS = tl.dot(Kt, S0, input_precision="ieee")
+ QS = tl.dot(Qt, S0, input_precision="ieee")
+ Vt = tl.load(v + tok[:, None] * stride_v + i_hv * V + o_v[None, :], mask=m_n[:, None], other=0.0)
+ rhs = beta[:, None] * (Vt.to(tl.float32) - G[:, None] * KS)
+ D = tl.dot(Tinv, rhs, input_precision="ieee")
+ O = G[:, None] * QS + tl.dot(W, D, input_precision="ieee") # noqa: E741 - preserve AMD arithmetic notation
+ tl.store(o + (tok[:, None] * HV + i_hv) * V + o_v[None, :], O.to(o.dtype.element_ty), mask=m_n[:, None])
+ tl.store(p_rec + o_v[None, :], D, mask=m_n[:, None] & (row >= 0))
+ if i_vs == 0:
+ tl.store(p_rec + V + o_k[None, :], Kt, mask=m_n[:, None] & (row >= 0))
+ tl.store(records + row * stride_records_row + (rn * HV + i_hv) * REC + V + K, eg, mask=m_n & (row >= 0))
+
+
+def gdn_tree_records_update(
+ A_log,
+ dt_bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ *,
+ state,
+ state_indices,
+ query_start_loc,
+ parent,
+ tree_paths,
+ records,
+ record_indices,
+ width,
+):
+ """Verify with compact replay records, preserving the pool's state precision.
+
+ BF16/FP16 pools require ``tree_paths`` to round each parent before its descendants read it.
+ FP32 pools may use the parallel chunk recurrence and commit without intermediate rounding.
+ """
+ if tree_paths is None:
+ if state.dtype != torch.float32:
+ raise ValueError("tree_paths are required for low-precision recurrent state")
+ return gdn_tree_chunk_update(
+ A_log,
+ dt_bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ state=state,
+ state_indices=state_indices,
+ query_start_loc=query_start_loc,
+ parent=parent,
+ records=records,
+ record_indices=record_indices,
+ width=width,
+ )
+ _, _, heads, key_dim = k.shape
+ value_heads, value_dim = v.shape[2:]
+ batch = query_start_loc.numel() - 1
+ out = torch.empty_like(v)
+ # One wave per program; the pre kernel runs one wave too so its reductions order like the walk's did.
+ q_pre, k_pre, gb_pre = _gdn_tree_pre(A_log, dt_bias, q, k, a, b, key_dim**-0.5, num_warps=1)
+ paths = tree_paths.shape[1]
+ value_tile = _records_value_tile(batch * value_heads * paths, value_dim, q.device)
+ _gdn_tree_records_kernel[(triton.cdiv(value_dim, value_tile), batch * value_heads, paths)](
+ q_pre,
+ k_pre,
+ gb_pre,
+ v,
+ out,
+ state,
+ state_indices,
+ state.stride(0),
+ query_start_loc,
+ records,
+ record_indices,
+ records.stride(0),
+ tree_paths,
+ tree_paths.stride(0),
+ tree_paths.stride(1),
+ v.stride(1),
+ H=heads,
+ HV=value_heads,
+ K=key_dim,
+ V=value_dim,
+ BK=triton.next_power_of_2(key_dim),
+ BV=value_tile,
+ REC=records.shape[-1],
+ DMAX=width,
+ DMAX_P2=triton.next_power_of_2(width),
+ ROUND_STATE=True,
+ num_warps=1,
+ num_stages=1,
+ )
+ return out
+
+
+def _wave_slots(device: torch.device) -> int:
+ """Waves the device holds at once: its compute units times the waves one unit schedules (4 SIMDs x 8 on CDNA)."""
+ return torch.cuda.get_device_properties(device).multi_processor_count * 32
+
+
+def _records_value_tile(paths: int, value_dim: int, device: torch.device) -> int:
+ """V block of the path replay: 8 columns (one wave, the latency-bound batch-1 case), doubled up to 32 while
+ the programs would need more than two rounds of the device's wave slots (the throughput-bound batched case:
+ a wider block replays each path in fewer waves). Every width gives the same results: one wave per program."""
+ tile = min(triton.next_power_of_2(value_dim), 8)
+ while tile < 32 and paths * triton.cdiv(value_dim, tile) > 2 * _wave_slots(device):
+ tile *= 2
+ return tile
+
+
+def _gdn_tree_pre(A_log, dt_bias, q, k, a, b, scale, *, num_warps):
+ """The per-token values of the gated delta rule (normalized q * scale, normalized k, exp(g), beta), fp32."""
+ _, tokens, heads, key_dim = k.shape
+ value_heads = a.shape[-1]
+ q_pre = torch.empty((tokens, heads, key_dim), dtype=torch.float32, device=q.device)
+ k_pre = torch.empty_like(q_pre)
+ gb_pre = torch.empty((tokens, value_heads, 2), dtype=torch.float32, device=q.device)
+ _gdn_tree_pre_kernel[(tokens, value_heads)](
+ A_log,
+ a,
+ dt_bias,
+ 1.0,
+ 20.0,
+ q,
+ k,
+ b,
+ q_pre,
+ k_pre,
+ gb_pre,
+ scale,
+ a.stride(-2),
+ q.stride(1),
+ k.stride(1),
+ b.stride(-2),
+ H=heads,
+ HV=value_heads,
+ K=key_dim,
+ BK=key_dim,
+ num_warps=num_warps,
+ )
+ return q_pre, k_pre, gb_pre
+
+
+def gdn_tree_chunk_update(
+ A_log,
+ dt_bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ *,
+ state,
+ state_indices,
+ query_start_loc,
+ parent,
+ records,
+ record_indices,
+ width,
+ use_flydsl=True,
+):
+ """Write outputs and delta/key/decay records without per-node state snapshots.
+
+ State remains in fp32 inside the chunk, including with a bf16 persistent
+ pool. Accepted-path commit must therefore use round_state=False.
+ """
+ _, tokens, heads, key_dim = k.shape
+ value_heads, value_dim = v.shape[2:]
+ batch = query_start_loc.numel() - 1
+ scale = key_dim**-0.5
+ out = torch.empty_like(v)
+ if use_flydsl and width <= 16:
+ try:
+ from eagle_harness.kernels import gdn_tree_chunk_flydsl as fly
+ except ImportError:
+ fly = None
+ if fly is not None and fly.supported(q, k, v, state, records, 1.0, 20.0):
+ return fly.gdn_tree_chunk_flydsl(
+ q,
+ k,
+ v,
+ a,
+ b,
+ A_log,
+ dt_bias,
+ out,
+ state,
+ state_indices,
+ query_start_loc,
+ parent,
+ records,
+ record_indices,
+ scale,
+ )
+ q_pre, k_pre, gb_pre = _gdn_tree_pre(A_log, dt_bias, q, k, a, b, scale, num_warps=4)
+ padded_width = max(16, triton.next_power_of_2(width))
+ # Match AMD's chunk layout; split value columns at small batch sizes.
+ value_split = 4 if batch * value_heads <= 192 else (2 if batch * value_heads <= 768 else 1)
+ value_block = min(32, value_dim // value_split)
+ _gdn_tree_chunk_kernel[(batch, value_heads, value_split)](
+ q_pre,
+ k_pre,
+ gb_pre,
+ v,
+ out,
+ state,
+ state_indices,
+ state.stride(0),
+ query_start_loc,
+ parent,
+ parent.stride(0),
+ records,
+ record_indices,
+ records.stride(0),
+ v.stride(1),
+ H=heads,
+ HV=value_heads,
+ K=key_dim,
+ V=value_dim,
+ BV=value_block,
+ NP=padded_width,
+ REC=records.shape[-1],
+ LOG2N=padded_width.bit_length() - 1,
+ VSPLIT=value_split,
+ num_warps=4,
+ )
+ return out
diff --git a/eagle_harness/kernels/gdn_tree_recurrence.py b/eagle_harness/kernels/gdn_tree_recurrence.py
new file mode 100644
index 0000000..a914c11
--- /dev/null
+++ b/eagle_harness/kernels/gdn_tree_recurrence.py
@@ -0,0 +1,810 @@
+# SPDX-FileCopyrightText: Copyright 2023-2024 SGLang Team
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+# SPDX-FileCopyrightText: Copyright (c) 2024, Tri Dao
+# Derived from sglang (Apache-2.0): the tree conv from python/sglang/kernels/ops/mamba/causal_conv1d_triton.py (itself
+# adapted from vLLM and causal-conv1d, BSD-3-Clause) and the recurrence from
+# python/sglang/kernels/ops/attention/fla/fused_sigmoid_gating_recurrent.py (sglang's fla kernels adapt
+# flash-linear-attention, MIT). Modified by Eagle AI Corp: ancestor tables, slot tables for both engines, path replay.
+# Notices and license texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""Gated delta rule recurrence over a draft tree: the SSM half of a GDN layer's tree verify.
+
+The math
+--------
+A gated delta net layer keeps one state matrix ``h`` of shape [K, V] per value head. Each token updates it and reads
+it out (the math of sglang's ``fused_sigmoid_gating_delta_rule_update``)::
+
+ g = -exp(A_log) * softplus(a + dt_bias) # log decay, per value head
+ beta = sigmoid(b) # write strength, rounded to b's dtype
+ q, k = q / |q|, k / |k|; q *= scale # L2 norms over K
+ h = h * exp(g)
+ v' = (v - h^T k) * beta
+ h = h + k v'^T
+ o = h^T q
+
+A chain (plain decode) applies this left to right. In a tree verify every node continues from its *parent's* state,
+so a node's state is the fold of the update over its root path. Every node's output ``o`` and state (its
+*snapshot*) are written, because the accepted path is only known after verification; the request's own state is
+never written back here (the engines copy the accepted node's snapshot afterwards).
+
+Data layout
+-----------
+- ``q``, ``k``: (1, tokens, H, K); ``v``: (1, tokens, HV, V); ``a``, ``b``: (tokens, HV). Strided along tokens only:
+ serving passes views into one packed projection. ``HV`` is a multiple of ``H`` (grouped value heads).
+- A request's nodes are rows ``cu_seqlens[n]:cu_seqlens[n + 1]`` in node order, parents first. Row 0 is the root.
+- States and snapshots are stored per value head as [V, K] with K contiguous: ``[..., HV, V, K]``. Kernels hold the
+ state transposed, as a [K, V-tile] register tile.
+- Snapshots are addressed through slot tables, which lets one kernel serve both engines:
+
+ ============ ======================================= ==========================================
+ engine snapshot buffer slot table
+ ============ ======================================= ==========================================
+ sglang [slots, steps, HV, V, K] scratch [N]: one scratch row per request
+ vLLM [slots, HV, V, K] (the state pool) [N, S]: one pool slot per verify row
+ ============ ======================================= ==========================================
+
+ A slot ``<= pad_slot_id`` is padding (sglang -1, vLLM's null block 0): nothing is stored there, and an initial
+ state read from it is zero.
+
+The kernels
+-----------
+- ``_walk_kernel`` visits a request's nodes in order. A node starts from its parent's snapshot, reloaded from memory;
+ a chain child (parent = previous node) with an fp32 state keeps the registers instead, which is bitwise the same
+ value. One program owns a 4-column V tile, so each step of the serial loop is short and many programs run in
+ parallel. It is compiled without FMA contraction and writes its multiply-adds as explicit FMAs, so its Gluon twin
+ (``gdn_tree_gluon``), which writes the same FMAs, reproduces it bitwise.
+- ``_path_replay_kernel`` gives each first-child chain one program that replays the chain's whole root path from the
+ request state in registers, with no snapshot reads. It wins when the batch has few (request, value head) rows
+ (``sglang.gdn_tree_verify`` decides) and needs an fp32 state, so that skipping the reloads changes nothing. It is
+ compiled with default FMA contraction, so it is not bitwise equal to the walk; the tests compare the two within
+ tolerance.
+
+:func:`gdn_tree_recurrent_update` validates a launch and picks the kernel: the path replay when given path tables and
+an fp32 state, else the Gluon twin where its dispatcher admits the launch, else the walk.
+"""
+
+from __future__ import annotations
+
+import functools
+import importlib
+import logging
+from typing import Optional
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels import arch
+from eagle_harness.kernels.gdn_tree import PAD_SLOT_ID
+
+logger = logging.getLogger(__name__)
+
+# V columns per program. The walk is latency-bound on its serial loop over the nodes: a narrow tile keeps each step
+# of that loop short and gives eight times the programs of the upstream kernel's 32-wide tile. The replay carries two
+# steps of inputs in flight per program and uses a wider tile.
+_WALK_BLOCK_V = 4
+_REPLAY_BLOCK_V = 8
+# Added to |q|^2 and |k|^2 before the square root, as the upstream kernel's L2 norm does.
+_L2_NORM_EPS = tl.constexpr(1e-6)
+
+
+def _load_node_inputs(ptrs, strides, row, mask_k, mask_v, valid):
+ """Loads the raw inputs of the node ``row`` rows past ``ptrs``, zero where ``valid`` is false.
+
+ Args:
+ ptrs: (q, k, v, a, b) pointers of one row: K-vectors of q and k (one key head), a V tile of v, and the a and b
+ scalars of one value head.
+ strides: their token strides.
+ row: rows to advance, a scalar.
+ mask_k, mask_v: in-bounds masks of the K and V offsets.
+ valid: scalar; false for a node past the end of the request.
+
+ Returns:
+ (q, k, v, a, b) in the input dtypes.
+ """
+ p_q, p_k, p_v, p_a, p_b = ptrs
+ stride_q, stride_k, stride_v, stride_a, stride_b = strides
+ q = tl.load(p_q + row * stride_q, mask=mask_k & valid, other=0)
+ k = tl.load(p_k + row * stride_k, mask=mask_k & valid, other=0)
+ v = tl.load(p_v + row * stride_v, mask=mask_v & valid, other=0)
+ b = tl.load(p_b + row * stride_b, mask=valid, other=0)
+ a = tl.load(p_a + row * stride_a, mask=valid, other=0)
+ return q, k, v, a, b
+
+
+def _log_decay(a, A_log, dt_bias, softplus_beta, softplus_threshold):
+ """Returns a node's log decay ``g = -exp(A_log) * softplus(a + dt_bias)``, fp32.
+
+ ``a`` is the node's raw gate input; ``A_log`` and ``dt_bias`` are fp32. ``softplus`` is linear above
+ ``softplus_threshold`` (in units of ``softplus_beta * x``), like ``torch.nn.functional.softplus``.
+ """
+ x = a.to(tl.float32) + dt_bias
+ beta_x = softplus_beta * x
+ softplus_x = tl.where(
+ beta_x <= softplus_threshold,
+ (1.0 / softplus_beta) * tl.log(1.0 + tl.exp(beta_x)),
+ x,
+ )
+ return -tl.exp(A_log) * softplus_x
+
+
+def _write_strength(b, input_dtype: tl.constexpr):
+ """Returns a node's ``beta = sigmoid(b)``, fp32, rounded through ``input_dtype`` (the dtype of the ``b`` input).
+
+ The GDN prefill and decode kernels round beta to the input dtype; the verify must too, or its states drift from
+ the ones decode would compute for the same tokens.
+ """
+ beta = 1.0 / (1.0 + tl.exp(-b.to(tl.float32)))
+ return beta.to(input_dtype).to(tl.float32)
+
+
+def _normalized_query_key(q, k, scale):
+ """Returns ``q / |q| * scale`` and ``k / |k|`` as fp32 [K] vectors (raw q and k in)."""
+ q = q.to(tl.float32)
+ k = k.to(tl.float32)
+ q = q / (tl.sqrt(tl.sum(q * q) + _L2_NORM_EPS))
+ k = k / (tl.sqrt(tl.sum(k * k) + _L2_NORM_EPS))
+ q = q * scale
+ return q, k
+
+
+def _dot_k(h, k):
+ """Returns ``h^T k`` (sum over K of ``h[K, V] * k[K]``) as a [V] vector, with an FMA per pair of K rows.
+
+ Adjacent K rows sit in one thread's registers; folding each pair into one written FMA fixes the rounding, so the
+ Gluon twin's ``_dot_k``, which pairs the same rows, gives the same bits. K must be even.
+ """
+ kk = tl.broadcast_to(k[:, None], h.shape)
+ h_even, h_odd = tl.split(tl.permute(tl.reshape(h, [h.shape[0] // 2, 2, h.shape[1]]), (0, 2, 1)))
+ k_even, k_odd = tl.split(tl.permute(tl.reshape(kk, [h.shape[0] // 2, 2, h.shape[1]]), (0, 2, 1)))
+ return tl.sum(tl.fma(h_even, k_even, h_odd * k_odd), 0)
+
+
+def _delta_rule_step(h, q, k, v, g, beta):
+ """Applies one node's gated delta rule update to the state tile and reads it out (the walk's rounding).
+
+ Args:
+ h: [K, BV] fp32 state tile of the node's parent.
+ q, k: [K] fp32, normalized (:func:`_normalized_query_key`).
+ v: [BV] fp32 values of the tile.
+ g, beta: fp32 scalars from :func:`_log_decay` and :func:`_write_strength`.
+
+ Returns:
+ (h, o): the node's [K, BV] state and its [BV] fp32 output ``h^T q``.
+ """
+ h *= tl.exp(g)
+ v -= _dot_k(h, k)
+ v *= beta
+ h = tl.fma(k[:, None], v[None, :], h)
+ o = tl.sum(h * q[:, None], 0)
+ return h, o
+
+
+def _publish_slot_table(
+ publish, stride_publish, p_slots, stride_snap_indices_row, i_n, num_slot_cols, SP: tl.constexpr
+):
+ """Copies request ``i_n``'s row of the per-row slot table to ``publish``.
+
+ vLLM reads the table after the verify to find the accepted row's slot; writing it here saves a launch. Called by
+ one program per request.
+ """
+ o_s = tl.arange(0, SP)
+ m_s = o_s < num_slot_cols
+ row = tl.load(p_slots + o_s * stride_snap_indices_row, mask=m_s)
+ tl.store(publish + i_n * stride_publish + o_s, row, mask=m_s)
+
+
+def _walk_kernel(
+ inputs, # (q, k, v, a, b): see gdn_tree_recurrent_update
+ input_strides, # token strides of (q, k, v, a, b)
+ gate_params, # (A_log [HV], dt_bias [HV], softplus_beta, softplus_threshold)
+ output, # (o like v, its token stride)
+ parents, # (parent table [N, >= T] int32: the parent row of each row, its request stride, its row stride)
+ # State addressing: named as in the Gluon twin's kernel, which takes the same gdn_tree_state_args.
+ h0_source,
+ h0_indices,
+ stride_h0_source,
+ stride_h0_indices_seq,
+ stride_h0_indices_col,
+ num_accepted,
+ cu_seqlens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ stride_snap_indices_seq,
+ stride_snap_indices_row,
+ stride_snap_slot,
+ stride_snap_row,
+ publish,
+ stride_publish,
+ num_slot_cols,
+ scale,
+ H: tl.constexpr,
+ HV: tl.constexpr,
+ K: tl.constexpr,
+ V: tl.constexpr,
+ BK: tl.constexpr,
+ BV: tl.constexpr,
+ SP: tl.constexpr,
+ SKIP_CHAIN_RELOAD: tl.constexpr,
+ ROW_SLOTS: tl.constexpr,
+ HAS_NUM_ACCEPTED: tl.constexpr,
+ PUBLISH: tl.constexpr,
+ PAD_SLOT_ID: tl.constexpr,
+ USE_GDC: tl.constexpr = False,
+):
+ """Runs the recurrence over every node of one request, for one value head and one BV-wide V tile.
+
+ Grid: (ceil(V / BV), requests, HV). Each node starts from its parent's snapshot (row 0 from the initial state; rows of
+ a request without snapshot slots run as one chain) and writes its output and snapshot. The next node's parent and
+ inputs are loaded one step ahead to hide their latency behind the current node's math.
+
+ Snapshot addressing: with ``ROW_SLOTS`` row ``r`` of request ``n`` lives at slot ``intermediate_state_indices[n,
+ r]``; otherwise every row of request ``n`` lives in scratch row ``intermediate_state_indices[n]``, at step ``r``.
+ ``SKIP_CHAIN_RELOAD`` keeps a chain child's state in registers; the launcher sets it only for an fp32 state, where
+ the registers equal the reload bitwise.
+ """
+ i_v, i_n, i_hv = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ if USE_GDC:
+ tl.extra.cuda.gdc_wait()
+ tl.extra.cuda.gdc_launch_dependents()
+ q, k, v, a, b = inputs
+ stride_q, stride_k, stride_v, stride_a, stride_b = input_strides
+ A_log, dt_bias, softplus_beta, softplus_threshold = gate_params
+ o, stride_o = output
+ parent_table, stride_parent_seq, stride_parent_row = parents
+ i_h = i_hv // (HV // H)
+ p_slots = intermediate_state_indices + i_n * stride_snap_indices_seq
+ if PUBLISH:
+ if (i_v == 0) & (i_hv == 0):
+ _publish_slot_table(publish, stride_publish, p_slots, stride_snap_indices_row, i_n, num_slot_cols, SP)
+
+ bos = tl.load(cu_seqlens + i_n).to(tl.int64)
+ eos = tl.load(cu_seqlens + i_n + 1).to(tl.int64)
+ T = eos - bos
+
+ o_k = tl.arange(0, BK)
+ o_v = i_v * BV + tl.arange(0, BV)
+ p_q = q + bos * stride_q + i_h * K + o_k
+ p_k = k + bos * stride_k + i_h * K + o_k
+ p_v = v + bos * stride_v + i_hv * V + o_v
+ p_b = b + bos * stride_b + i_hv
+ p_a = a + bos * stride_a + i_hv
+ p_o = o + bos * stride_o + i_hv * V + o_v
+ mask_k = o_k < K
+ mask_v = o_v < V
+ mask_h = mask_k[:, None] & mask_v[None, :]
+
+ # the initial state; with HAS_NUM_ACCEPTED (vLLM's chain-kernel convention) its slot is in the column of the last
+ # token the previous round accepted
+ b_h = tl.zeros([BK, BV], dtype=tl.float32)
+ p_idx = h0_indices + i_n * stride_h0_indices_seq
+ if HAS_NUM_ACCEPTED:
+ p_idx += (tl.load(num_accepted + i_n).to(tl.int64) - 1) * stride_h0_indices_col
+ idx = tl.load(p_idx).to(tl.int64)
+ if idx > PAD_SLOT_ID:
+ b_h += tl.load(
+ h0_source + idx * stride_h0_source + i_hv * K * V + o_v[None, :] * K + o_k[:, None],
+ mask=mask_h,
+ other=0,
+ ).to(tl.float32)
+
+ cache_idx = tl.load(p_slots).to(tl.int64) # the request's scratch row (ROW_SLOTS: row 0's slot)
+ o_cache = i_hv * K * V + o_v[None, :] * K + o_k[:, None]
+ p_parent = parent_table + i_n * stride_parent_seq
+ n_parent = tl.load(p_parent, mask=T > 0, other=0)
+ b_A_log = tl.load(A_log + i_hv).to(tl.float32)
+ b_dt_bias = tl.load(dt_bias + i_hv).to(tl.float32)
+ n_q, n_k, n_v, n_a, n_b = _load_node_inputs((p_q, p_k, p_v, p_a, p_b), input_strides, 0, mask_k, mask_v, T > 0)
+
+ step_idx = 0
+ for _ in range(0, T):
+ parent_step_idx = n_parent
+ n_parent = tl.load(p_parent + (step_idx + 1) * stride_parent_row, mask=step_idx + 1 < T, other=0)
+ slot = cache_idx
+ parent_slot = cache_idx
+ if ROW_SLOTS:
+ slot = tl.load(p_slots + step_idx * stride_snap_indices_row).to(tl.int64)
+ # the root's parent is no row (-1 in vLLM's tables): read nothing for it
+ parent_slot = tl.load(
+ p_slots + parent_step_idx * stride_snap_indices_row, mask=step_idx != 0, other=PAD_SLOT_ID
+ ).to(tl.int64)
+ reload_parent = step_idx != 0 and parent_slot > PAD_SLOT_ID
+ if SKIP_CHAIN_RELOAD:
+ reload_parent = reload_parent and parent_step_idx != step_idx - 1
+ if reload_parent:
+ b_h = tl.load(
+ intermediate_states_buffer
+ + parent_slot * stride_snap_slot
+ + parent_step_idx * stride_snap_row
+ + o_cache,
+ mask=mask_h,
+ other=0,
+ ).to(tl.float32)
+
+ has_next = step_idx + 1 < T
+ b_q = n_q.to(tl.float32)
+ b_k = n_k.to(tl.float32)
+ b_v = n_v.to(tl.float32)
+ b_b = n_b.to(tl.float32)
+ b_a = n_a.to(tl.float32)
+ n_q, n_k, n_v, n_a, n_b = _load_node_inputs(
+ (p_q, p_k, p_v, p_a, p_b), input_strides, 1, mask_k, mask_v, has_next
+ )
+
+ b_g = _log_decay(b_a, b_A_log, b_dt_bias, softplus_beta, softplus_threshold)
+ b_beta = _write_strength(b_b, b.dtype.element_ty)
+ b_q, b_k = _normalized_query_key(b_q, b_k, scale)
+ b_h, b_o = _delta_rule_step(b_h, b_q, b_k, b_v, b_g, b_beta)
+ tl.store(p_o, b_o.to(p_o.dtype.element_ty), mask=mask_v)
+ if slot > PAD_SLOT_ID:
+ tl.store(
+ intermediate_states_buffer + slot * stride_snap_slot + step_idx * stride_snap_row + o_cache,
+ b_h.to(intermediate_states_buffer.dtype.element_ty),
+ mask=mask_h,
+ )
+
+ step_idx += 1
+ p_q += stride_q
+ p_k += stride_k
+ p_v += stride_v
+ p_b += stride_b
+ p_o += stride_o
+ p_a += stride_a
+
+
+def _path_token(toks, offs_d, d, linear):
+ """Returns the row offset of the node at depth ``d`` of a root path: ``toks[d]``, or ``d`` for a ``linear`` request
+ (one without snapshot slots, which runs its rows in order as one chain, as the walk does)."""
+ return tl.where(linear, d, tl.sum(tl.where(offs_d == d, toks, 0)))
+
+
+def _path_replay_kernel(
+ inputs, # (q, k, v, a, b): see gdn_tree_recurrent_update
+ input_strides, # token strides of (q, k, v, a, b)
+ gate_params, # (A_log [HV], dt_bias [HV], softplus_beta, softplus_threshold)
+ output, # (o like v, its token stride)
+ initial_state, # (state pool [slots, HV, V, K], slot per request [N] int32, pool slot stride)
+ snapshots, # (scratch [slots, steps, HV, V, K], scratch row per request [N] int32, allocated steps per row)
+ paths, # (path table [N, P, 2 + DMAX] int32, its request stride, its path stride)
+ cu_seqlens,
+ scale,
+ H: tl.constexpr,
+ HV: tl.constexpr,
+ K: tl.constexpr,
+ V: tl.constexpr,
+ BK: tl.constexpr,
+ BV: tl.constexpr,
+ DMAX: tl.constexpr,
+ DMAX_P2: tl.constexpr,
+ USE_GDC: tl.constexpr = False,
+):
+ """Replays one first-child chain's whole root path from the request state, for one value head and V tile.
+
+ Grid: (ceil(V / BV), requests * HV, P). Path row ``p`` of request ``n`` is ``[length, write_from, root path...]``
+ (:func:`~eagle_harness.kernels.gdn_tree.gdn_tree_ancestors` builds it). The program folds the update over the
+ path in registers and writes outputs and snapshots only for depths ``>= write_from``: the chain the row owns, so
+ every node is written by exactly one program.
+
+ The loop is software-pipelined to shorten the serial chain per step to the state update: raw inputs are loaded
+ two steps ahead, and the state-independent terms (norms, gate, beta) are formed one step ahead.
+ """
+ i_v, i_nh, i_p = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ if USE_GDC:
+ tl.extra.cuda.gdc_wait()
+ tl.extra.cuda.gdc_launch_dependents()
+ q, k, v, a, b = inputs
+ stride_q, stride_k, stride_v, stride_a, stride_b = input_strides
+ A_log, dt_bias, softplus_beta, softplus_threshold = gate_params
+ o, stride_o = output
+ h0_source, h0_indices, stride_h0_source = initial_state
+ intermediate_states_buffer, intermediate_state_indices, cache_steps = snapshots
+ tree_paths, stride_paths_seq, stride_paths_path = paths
+ i_n, i_hv = i_nh // HV, i_nh % HV
+ i_h = i_hv // (HV // H)
+
+ bos = tl.load(cu_seqlens + i_n).to(tl.int64)
+ eos = tl.load(cu_seqlens + i_n + 1).to(tl.int64)
+ cache_idx = tl.load(intermediate_state_indices + i_n).to(tl.int64)
+ p_path = tree_paths + i_n * stride_paths_seq + i_p * stride_paths_path
+ # a request without snapshots never reloads a parent: the walk runs its rows as one chain, here path 0
+ linear = cache_idx < 0
+ L = tl.where(linear, tl.where(i_p == 0, (eos - bos).to(tl.int32), 0), tl.load(p_path))
+ wfrom = tl.where(linear, 0, tl.load(p_path + 1))
+ if L > 0:
+ offs_d = tl.arange(0, DMAX_P2)
+ toks = tl.load(p_path + 2 + offs_d, mask=(offs_d < DMAX) & (offs_d < L) & (cache_idx >= 0)).to(tl.int64)
+ o_k = tl.arange(0, BK)
+ o_v = i_v * BV + tl.arange(0, BV)
+ mask_k = o_k < K
+ mask_v = o_v < V
+ mask_h = mask_k[:, None] & mask_v[None, :]
+ o_cache = i_hv * K * V + o_v[None, :] * K + o_k[:, None]
+ p_q = q + i_h * K + o_k
+ p_k = k + i_h * K + o_k
+ p_v = v + i_hv * V + o_v
+ p_b = b + i_hv
+ p_a = a + i_hv
+ b_A_log = tl.load(A_log + i_hv).to(tl.float32)
+ b_dt_bias = tl.load(dt_bias + i_hv).to(tl.float32)
+
+ ptrs = (p_q, p_k, p_v, p_a, p_b)
+ # raw inputs of step 0 (formed below) and step 1 (pending)
+ t0 = bos + _path_token(toks, offs_d, 0, linear)
+ # step 0 always exists here (L > 0), so its loads need no validity mask
+ r_q = tl.load(p_q + t0 * stride_q, mask=mask_k, other=0)
+ r_k = tl.load(p_k + t0 * stride_k, mask=mask_k, other=0)
+ r_v = tl.load(p_v + t0 * stride_v, mask=mask_v, other=0)
+ r_b = tl.load(p_b + t0 * stride_b)
+ r_a = tl.load(p_a + t0 * stride_a)
+ has1 = L > 1
+ n_t = bos + _path_token(toks, offs_d, 1, linear)
+ n_q, n_k, n_v, n_a, n_b = _load_node_inputs(ptrs, input_strides, n_t, mask_k, mask_v, has1)
+
+ # step 0's state-independent terms
+ c_eg = tl.exp(_log_decay(r_a, b_A_log, b_dt_bias, softplus_beta, softplus_threshold))
+ c_beta = _write_strength(r_b, b.dtype.element_ty)
+ c_q, c_k = _normalized_query_key(r_q, r_k, scale)
+ c_v = r_v.to(tl.float32)
+ c_t = t0
+
+ b_h = tl.zeros([BK, BV], dtype=tl.float32)
+ idx = tl.load(h0_indices + i_n).to(tl.int64)
+ if idx >= 0:
+ b_h += tl.load(h0_source + idx * stride_h0_source + o_cache, mask=mask_h, other=0).to(tl.float32)
+ p_cache = intermediate_states_buffer + cache_idx * cache_steps * HV * K * V
+
+ for d in range(0, L):
+ u_eg = c_eg
+ u_beta = c_beta
+ u_q = c_q
+ u_k = c_k
+ u_v = c_v
+ u_t = c_t
+ # step d + 1: state-independent terms from the pending raw inputs
+ c_eg = tl.exp(_log_decay(n_a, b_A_log, b_dt_bias, softplus_beta, softplus_threshold))
+ c_beta = _write_strength(n_b, b.dtype.element_ty)
+ c_q, c_k = _normalized_query_key(n_q, n_k, scale)
+ c_v = n_v.to(tl.float32)
+ c_t = n_t
+ # step d + 2: raw loads
+ has2 = d + 2 < L
+ n_t = bos + _path_token(toks, offs_d, d + 2, linear)
+ n_q, n_k, n_v, n_a, n_b = _load_node_inputs(ptrs, input_strides, n_t, mask_k, mask_v, has2)
+ # step d: the update (contracted by the compiler, unlike the walk's written FMAs)
+ b_h *= u_eg
+ b_v = u_v - tl.sum(b_h * u_k[:, None], 0)
+ b_v *= u_beta
+ b_h += u_k[:, None] * b_v[None, :]
+ if d >= wfrom:
+ b_o = tl.sum(b_h * u_q[:, None], 0)
+ tl.store(o + u_t * stride_o + i_hv * V + o_v, b_o.to(o.dtype.element_ty), mask=mask_v)
+ if cache_idx >= 0:
+ tl.store(
+ p_cache + (u_t - bos) * HV * K * V + o_cache,
+ b_h.to(intermediate_states_buffer.dtype.element_ty),
+ mask=mask_h,
+ )
+
+
+# The Gluon twin of the walk is imported on first use, so callers that never ask for it never import Gluon. An import
+# error (a Triton build without Gluon) keeps the Triton walk for the rest of the process.
+_gluon_module_cache = None
+
+
+def _gluon_module():
+ """Returns the ``gdn_tree_gluon`` module, or False when it cannot be imported (logged once)."""
+ global _gluon_module_cache
+ if _gluon_module_cache is None:
+ try:
+ _gluon_module_cache = importlib.import_module("eagle_harness.kernels.gdn_tree_gluon")
+ except Exception as e:
+ logger.warning(
+ "GDN tree verify: Gluon kernel unavailable (%s: %s); using the Triton walk.", type(e).__name__, e
+ )
+ _gluon_module_cache = False
+ return _gluon_module_cache
+
+
+def gdn_tree_state_args(
+ initial_state_source: torch.Tensor,
+ initial_state_indices: torch.Tensor,
+ num_accepted_tokens: Optional[torch.Tensor],
+ intermediate_states_buffer: torch.Tensor,
+ intermediate_state_indices: torch.Tensor,
+ publish: Optional[torch.Tensor],
+) -> dict:
+ """Returns the state-addressing kernel arguments of the walk and its Gluon twin, after checking the layout.
+
+ Arguments are as in :func:`gdn_tree_recurrent_update`. A tensor argument a launch does not use (``num_accepted``
+ without ``num_accepted_tokens``, ``publish`` when no table is published) is filled with another valid pointer so
+ the signature stays fixed; its constexpr flag keeps the kernel from reading it.
+
+ Raises:
+ AssertionError: the slot table's rank does not match the buffer's (a [N] table needs a 5-D scratch buffer, a
+ [N, S] table a 4-D pool), ``num_accepted_tokens`` is given without a 2-D initial-state table or the
+ reverse, or ``publish`` is given with a per-request table.
+ """
+ row_slots = intermediate_state_indices.ndim == 2
+ if row_slots:
+ assert intermediate_states_buffer.ndim == 4, "one slot per row addresses a [slots, HV, V, K] buffer"
+ else:
+ assert intermediate_states_buffer.ndim == 5, "one slot per request addresses a [slots, steps, HV, V, K] buffer"
+ assert (initial_state_indices.ndim == 2) == (num_accepted_tokens is not None)
+ assert publish is None or row_slots, "publish copies a table of per-row slots"
+ return dict(
+ stride_h0_source=initial_state_source.stride(0),
+ stride_h0_indices_seq=initial_state_indices.stride(0),
+ stride_h0_indices_col=initial_state_indices.stride(1) if initial_state_indices.ndim == 2 else 0,
+ num_accepted=initial_state_indices if num_accepted_tokens is None else num_accepted_tokens,
+ stride_snap_indices_seq=intermediate_state_indices.stride(0),
+ stride_snap_indices_row=intermediate_state_indices.stride(1) if row_slots else 0,
+ stride_snap_slot=intermediate_states_buffer.stride(0),
+ stride_snap_row=0 if row_slots else intermediate_states_buffer.stride(1),
+ publish=intermediate_state_indices if publish is None else publish,
+ stride_publish=0 if publish is None else publish.stride(0),
+ num_slot_cols=intermediate_state_indices.shape[-1],
+ SP=triton.next_power_of_2(intermediate_state_indices.shape[-1]),
+ ROW_SLOTS=row_slots,
+ HAS_NUM_ACCEPTED=num_accepted_tokens is not None,
+ PUBLISH=publish is not None,
+ )
+
+
+def gdn_tree_recurrent_update(
+ A_log: torch.Tensor,
+ dt_bias: torch.Tensor,
+ q: torch.Tensor,
+ k: torch.Tensor,
+ v: torch.Tensor,
+ a: torch.Tensor,
+ b: torch.Tensor,
+ *,
+ initial_state_source: torch.Tensor,
+ initial_state_indices: torch.Tensor,
+ cu_seqlens: torch.Tensor,
+ intermediate_states_buffer: torch.Tensor,
+ intermediate_state_indices: torch.Tensor,
+ retrieve_parent_token: torch.Tensor,
+ num_accepted_tokens: Optional[torch.Tensor] = None,
+ pad_slot_id: int = PAD_SLOT_ID,
+ out: Optional[torch.Tensor] = None,
+ publish: Optional[torch.Tensor] = None,
+ tree_paths: Optional[torch.Tensor] = None,
+ scale: Optional[float] = None,
+ softplus_beta: float = 1.0,
+ softplus_threshold: float = 20.0,
+ gluon: bool = False,
+) -> torch.Tensor:
+ """Runs the gated delta rule over every node of a verify tree and stores each node's state as a snapshot.
+
+ The tree counterpart of ``fused_sigmoid_gating_delta_rule_update`` (q/k L2 norm in the kernel, per-node
+ snapshots, no write-back of the request state). Row ``r`` of request ``n`` continues from the snapshot of its
+ parent row ``retrieve_parent_token[n, r]``; row 0 continues from the request's initial state. The module
+ docstring describes the math and the layouts.
+
+ Args:
+ A_log, dt_bias: [HV] gate parameters of the layer.
+ q, k: (1, tokens, H, K); K a power of two.
+ v: (1, tokens, HV, V).
+ a, b: (tokens, HV) gate inputs; ``beta`` is rounded to ``b``'s dtype.
+ initial_state_source: the state pool, [slots, HV, V, K].
+ initial_state_indices: [N] int32 pool slot of each request's state, or with ``num_accepted_tokens`` [N, C]
+ (vLLM), where the state is at column ``num_accepted_tokens[n] - 1``.
+ cu_seqlens: [N + 1] int32 row offsets of the requests; rows are in node order, parents first.
+ intermediate_states_buffer: snapshot buffer, [slots, steps, HV, V, K] (sglang scratch) or [slots, HV, V, K]
+ (vLLM; may be ``initial_state_source`` itself).
+ intermediate_state_indices: [N] int32 scratch row per request (5-D buffer) or [N, S] slot per row (4-D).
+ retrieve_parent_token: [N, >= rows] int32 parent row of each row, within the request; entry 0 is ignored.
+ num_accepted_tokens: [N] int32, see ``initial_state_indices``.
+ pad_slot_id: slots ``<= pad_slot_id`` are padding (sglang -1, vLLM 0): never written, read as zero.
+ out: optional (1, tokens, HV, V) output, token-strided, contiguous over (HV, V).
+ publish: optional [N, >= S] int32; receives the [N, S] slot table (per-row slots only).
+ tree_paths: optional [N, P, 2 + DMAX] int32 path table (``gdn_tree_ancestors(paths=...)``); with an fp32 pool
+ and scratch it selects the path replay. sglang's per-request tables and ``pad_slot_id`` -1 only.
+ scale: q scale, default ``K ** -0.5``.
+ softplus_beta, softplus_threshold: parameters of the gate's softplus.
+ gluon: let the Gluon twin of the walk serve the launches
+ :func:`~eagle_harness.kernels.gdn_tree_gluon.gluon_dispatch` admits (bitwise equal output).
+
+ Returns:
+ ``out`` when given, otherwise a tensor shaped like ``v`` with ``q``'s dtype and device.
+
+ Raises:
+ AssertionError: on a layout the kernels do not address (see :func:`gdn_tree_state_args`), a K that is not a
+ power of two, or an ``out`` that is not contiguous over (HV, V).
+ """
+ _, _, H, K = k.shape
+ V = v.shape[-1]
+ HV = v.shape[2]
+ N = cu_seqlens.shape[0] - 1
+ BK = triton.next_power_of_2(K)
+ assert BK == K, "K must be a power of two"
+ if scale is None:
+ scale = K**-0.5
+ # Registers kept across a chain step, or a replayed path, equal the reloaded snapshot only while both stay fp32: a
+ # bf16 scratch rounds the reload, and a bf16 pool adds a second load layout (another K summation order).
+ fp32_state = intermediate_states_buffer.dtype == torch.float32 and initial_state_source.dtype == torch.float32
+ if out is None:
+ out = q.new_empty(v.shape)
+ assert out.shape == v.shape and out.stride(3) == 1 and out.stride(2) == V
+ use_paths = tree_paths is not None and fp32_state
+ if gluon and not use_paths and arch.gluon_gdn(q.device):
+ o = _gluon_or_none(
+ A_log,
+ dt_bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ initial_state_source=initial_state_source,
+ initial_state_indices=initial_state_indices,
+ num_accepted_tokens=num_accepted_tokens,
+ scale=scale,
+ cu_seqlens=cu_seqlens,
+ intermediate_states_buffer=intermediate_states_buffer,
+ intermediate_state_indices=intermediate_state_indices,
+ retrieve_parent_token=retrieve_parent_token,
+ pad_slot_id=pad_slot_id,
+ out=out,
+ publish=publish,
+ softplus_beta=softplus_beta,
+ softplus_threshold=softplus_threshold,
+ )
+ if o is not None:
+ return o
+ # PDL: the kernel waits for its predecessor in-kernel (gdc_wait), so its launch overlaps the predecessor's tail.
+ pdl = {"USE_GDC": True, "launch_pdl": True} if arch.pdl(q.device) else {}
+ common = dict(
+ inputs=(q, k, v, a, b),
+ input_strides=(q.stride()[1], k.stride()[1], v.stride()[1], a.stride()[-2], b.stride()[-2]),
+ gate_params=(A_log, dt_bias, softplus_beta, softplus_threshold),
+ output=(out, out.stride(1)),
+ cu_seqlens=cu_seqlens,
+ scale=scale,
+ H=H,
+ HV=HV,
+ K=K,
+ V=V,
+ BK=BK,
+ **pdl,
+ )
+ if use_paths:
+ assert tree_paths.shape[0] >= N and tree_paths.dtype == torch.int32
+ assert initial_state_indices.ndim == 1 and intermediate_state_indices.ndim == 1 and publish is None
+ assert pad_slot_id == PAD_SLOT_ID, "the path replay takes sglang's per-request tables"
+ _launch_path_replay(
+ common,
+ initial_state_source=initial_state_source,
+ initial_state_indices=initial_state_indices,
+ intermediate_states_buffer=intermediate_states_buffer,
+ intermediate_state_indices=intermediate_state_indices,
+ tree_paths=tree_paths,
+ )
+ else:
+ _launch_walk(
+ common,
+ initial_state_source=initial_state_source,
+ initial_state_indices=initial_state_indices,
+ num_accepted_tokens=num_accepted_tokens,
+ intermediate_states_buffer=intermediate_states_buffer,
+ intermediate_state_indices=intermediate_state_indices,
+ retrieve_parent_token=retrieve_parent_token,
+ publish=publish,
+ pad_slot_id=pad_slot_id,
+ skip_chain_reload=fp32_state,
+ )
+ return out
+
+
+def _gluon_or_none(A_log, dt_bias, q, k, v, a, b, *, retrieve_parent_token, **launch) -> Optional[torch.Tensor]:
+ """Runs the Gluon twin of the walk if its dispatcher admits the launch; returns o, or None for the Triton walk.
+
+ ``launch`` holds :func:`gdn_tree_recurrent_update`'s keyword arguments with ``scale`` resolved and ``out`` set.
+ """
+ gluon_kernel = _gluon_module()
+ if not gluon_kernel:
+ return None
+ return gluon_kernel.gluon_dispatch(
+ # the dispatcher's self-check reference: this launcher restricted to the Triton walk
+ functools.partial(gdn_tree_recurrent_update, gluon=False),
+ A_log=A_log,
+ a=a,
+ dt_bias=dt_bias,
+ q=q,
+ k=k,
+ v=v,
+ b=b,
+ # a verify graph's parent buffer is as wide as its widest verify; the Gluon kernel sizes its precompute by it
+ retrieve_parent_token=retrieve_parent_token[:, : q.shape[1]],
+ use_pdl=arch.pdl(q.device),
+ **launch,
+ )
+
+
+def _launch_walk(
+ common: dict,
+ *,
+ initial_state_source: torch.Tensor,
+ initial_state_indices: torch.Tensor,
+ num_accepted_tokens: Optional[torch.Tensor],
+ intermediate_states_buffer: torch.Tensor,
+ intermediate_state_indices: torch.Tensor,
+ retrieve_parent_token: torch.Tensor,
+ publish: Optional[torch.Tensor],
+ pad_slot_id: int,
+ skip_chain_reload: bool,
+) -> None:
+ """Launches :func:`_walk_kernel`, one program per (V tile, request, value head).
+
+ ``common`` holds the arguments both kernels take; the others are :func:`gdn_tree_recurrent_update`'s.
+ """
+ V, HV = common["V"], common["HV"]
+ BV = min(triton.next_power_of_2(V), _WALK_BLOCK_V)
+ _walk_kernel[(triton.cdiv(V, BV), common["cu_seqlens"].shape[0] - 1, HV)](
+ **common,
+ parents=(retrieve_parent_token, retrieve_parent_token.stride(0), retrieve_parent_token.stride(1)),
+ h0_source=initial_state_source,
+ h0_indices=initial_state_indices,
+ intermediate_states_buffer=intermediate_states_buffer,
+ intermediate_state_indices=intermediate_state_indices,
+ **gdn_tree_state_args(
+ initial_state_source,
+ initial_state_indices,
+ num_accepted_tokens,
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ publish,
+ ),
+ BV=BV,
+ SKIP_CHAIN_RELOAD=skip_chain_reload,
+ PAD_SLOT_ID=pad_slot_id,
+ # One warp per program: the loop over the nodes is serial, so a 4-column tile has too little work for more.
+ num_warps=1,
+ num_stages=3,
+ # Only the written FMAs fuse, so the Gluon twin, which writes the same ones, rounds alike on any Triton.
+ enable_fp_fusion=False,
+ )
+
+
+def _launch_path_replay(
+ common: dict,
+ *,
+ initial_state_source: torch.Tensor,
+ initial_state_indices: torch.Tensor,
+ intermediate_states_buffer: torch.Tensor,
+ intermediate_state_indices: torch.Tensor,
+ tree_paths: torch.Tensor,
+) -> None:
+ """Launches :func:`_path_replay_kernel`, one program per (V tile, request x value head, path row).
+
+ ``common`` holds the arguments both kernels take; the others are :func:`gdn_tree_recurrent_update`'s.
+ """
+ V, HV, K = common["V"], common["HV"], common["K"]
+ dmax = tree_paths.shape[2] - 2
+ BV = min(triton.next_power_of_2(V), _REPLAY_BLOCK_V)
+ _path_replay_kernel[(triton.cdiv(V, BV), (common["cu_seqlens"].shape[0] - 1) * HV, tree_paths.shape[1])](
+ **common,
+ initial_state=(initial_state_source, initial_state_indices, initial_state_source.stride(0)),
+ # snapshot rows are strided by the buffer's allocated step count, which can exceed this forward's width
+ snapshots=(
+ intermediate_states_buffer,
+ intermediate_state_indices,
+ intermediate_states_buffer.stride(0) // (HV * K * V),
+ ),
+ paths=(tree_paths, tree_paths.stride(0), tree_paths.stride(1)),
+ BV=BV,
+ DMAX=dmax,
+ DMAX_P2=triton.next_power_of_2(dmax),
+ num_warps=1,
+ num_stages=1,
+ )
diff --git a/eagle_harness/kernels/l2_prefetch.py b/eagle_harness/kernels/l2_prefetch.py
new file mode 100644
index 0000000..aa62738
--- /dev/null
+++ b/eagle_harness/kernels/l2_prefetch.py
@@ -0,0 +1,63 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""L2 prefetch of a byte range.
+
+Warms the L2 cache with data a later kernel reads (a GEMM's weights) while the
+GPU's HBM would otherwise idle: a few CTAs issue ``prefetch.global.L2`` for
+every 128-byte line of the range, on a forked side stream. The kernel has no
+stores, so it never changes a result.
+"""
+
+from __future__ import annotations
+
+import torch
+import triton
+import triton.language as tl
+
+LINE_BYTES = 128 # the kernel's line stride is the literal 128 (a global would have to be a constexpr)
+BLOCK_LINES = 128 # one line per thread of a 4-warp CTA per step
+
+
+def _prefetch_lines_l2(ptrs, mask):
+ tl.inline_asm_elementwise(
+ """
+ {
+ .reg .pred %p0;
+ setp.ne.s32 %p0, $2, 0;
+ @%p0 prefetch.global.L2 [$1];
+ mov.u32 $0, 0;
+ }
+ """,
+ "=r,l,r",
+ args=[ptrs, mask.to(tl.int32)],
+ dtype=tl.int32,
+ is_pure=False,
+ pack=1,
+ )
+
+
+def _l2_prefetch_kernel(base_ptr, num_lines, BLOCK: tl.constexpr):
+ # CTA p prefetches the BLOCK-line blocks p, p + grid, p + 2 * grid, ...
+ pid = tl.program_id(0)
+ step = tl.num_programs(0) * BLOCK
+ offsets = tl.arange(0, BLOCK)
+ for start in range(pid * BLOCK, num_lines, step):
+ lines = start + offsets
+ _prefetch_lines_l2(base_ptr + lines.to(tl.int64) * 128, lines < num_lines)
+
+
+def l2_prefetch(tensor: torch.Tensor, start: int, nbytes: int, num_ctas: int) -> None:
+ """Prefetch bytes ``[start, start + nbytes)`` of the contiguous CUDA ``tensor`` into L2
+ (the 128-byte lines they touch) from ``num_ctas`` CTAs on the current stream."""
+ if not (tensor.is_contiguous() and tensor.is_cuda):
+ raise ValueError("l2_prefetch needs a contiguous CUDA tensor")
+ total = tensor.numel() * tensor.element_size()
+ start = max(0, min(start, total))
+ nbytes = max(0, min(nbytes, total - start))
+ if nbytes == 0 or num_ctas <= 0:
+ return
+ window = tensor.view(-1).view(torch.uint8)[start : start + nbytes]
+ _l2_prefetch_kernel[(num_ctas,)](window, triton.cdiv(nbytes, LINE_BYTES), BLOCK=BLOCK_LINES, num_warps=4)
diff --git a/eagle_harness/kernels/mamba2_tree.py b/eagle_harness/kernels/mamba2_tree.py
new file mode 100644
index 0000000..1c6ad58
--- /dev/null
+++ b/eagle_harness/kernels/mamba2_tree.py
@@ -0,0 +1,240 @@
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+# SPDX-FileCopyrightText: Copyright 2023-2024 SGLang Team
+# SPDX-FileCopyrightText: Copyright (c) 2024, Tri Dao, Albert Gu
+# Derived from vLLM (Apache-2.0): the per-token update of _selective_scan_update_kernel in
+# vllm/model_executor/layers/mamba/ops/mamba_ssm.py (itself adapted from mamba_ssm, Apache-2.0), with the parent-state
+# reload of sglang's tree-mode selective_state_update (python/sglang/kernels/ops/mamba/triton_ops/mamba_ssm.py).
+# Modified by Eagle AI Corp: row slots and parent tables for tree verify, per-head parameters, launch rule.
+# Notices and license texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""Mamba2 tree verify: the selective state update of every tree node, each continuing from its parent.
+
+A request's verify rows are tree nodes ordered parent first; row ``t`` of request ``b`` updates the SSM state of its
+parent row (row 0: the request's state) with its own token and stores the result in its own state slot, the layout
+vLLM's chain verify uses. One program walks a request's rows for one head and a block of head dims; a row whose parent
+is the previous row continues from the state in registers, any other row reloads its parent's state from the parent's
+slot. On a chain the kernel is therefore vLLM's chain kernel step for step (same operations in the same order).
+"""
+
+from __future__ import annotations
+
+from typing import Optional
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels.gdn_tree import PAD_SLOT_ID
+
+
+def _exp(x):
+ # exp through the hardware exp2, as vLLM's chain kernel computes it
+ LOG2E = tl.constexpr(1.4426950408889634)
+ return tl.math.exp2(LOG2E * x)
+
+
+def _softplus(dt):
+ return tl.where(dt <= 20.0, tl.math.log(tl.math.exp(dt) + 1), dt)
+
+
+def _tree_ssu_kernel(
+ state_ptr,
+ x_ptr,
+ dt_ptr,
+ A_ptr,
+ B_ptr,
+ C_ptr,
+ D_ptr,
+ dt_bias_ptr,
+ out_ptr,
+ slots_ptr, # [batch, >= W] int32: the state slot of each row
+ parents_ptr, # [>= batch, W] int32: each row's parent row (row 0: -1)
+ num_accepted_ptr, # [batch]: request b starts from slots[b, num_accepted - 1]
+ query_start_loc_ptr, # [batch + 1]
+ head_dim,
+ dstate,
+ heads_per_group,
+ stride_state_slot,
+ stride_state_head,
+ stride_state_dim,
+ stride_x_tok,
+ stride_x_head,
+ stride_dt_tok,
+ stride_dt_head,
+ stride_B_tok,
+ stride_B_group,
+ stride_C_tok,
+ stride_C_group,
+ stride_out_tok,
+ stride_out_head,
+ stride_slots,
+ stride_parents,
+ PAD_SLOT_ID: tl.constexpr,
+ HAS_D: tl.constexpr,
+ HAS_DT_BIAS: tl.constexpr,
+ HAS_NUM_ACCEPTED: tl.constexpr,
+ DT_SOFTPLUS: tl.constexpr,
+ BLOCK_M: tl.constexpr,
+ BLOCK_N: tl.constexpr,
+):
+ pid_m, b, h = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ bos = tl.load(query_start_loc_ptr + b).to(tl.int64)
+ seq_len = tl.load(query_start_loc_ptr + b + 1).to(tl.int64) - bos
+ if seq_len == 0:
+ return
+ offs_m = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)
+ offs_n = tl.arange(0, BLOCK_N)
+ mask_m = offs_m < head_dim
+ mask_n = offs_n < dstate
+ mask = mask_m[:, None] & mask_n[None, :]
+ tile = offs_m[:, None] * stride_state_dim + offs_n[None, :]
+ head_state = state_ptr + h * stride_state_head
+ slots = slots_ptr + b * stride_slots
+ parents = parents_ptr + b * stride_parents
+
+ init_row = 0
+ if HAS_NUM_ACCEPTED:
+ init_row = tl.maximum(tl.load(num_accepted_ptr + b) - 1, 0)
+ slot = tl.load(slots + init_row).to(tl.int64)
+ state = tl.load(head_state + slot * stride_state_slot + tile, mask=mask & (slot != PAD_SLOT_ID), other=0.0)
+ state = state.to(tl.float32)
+
+ A = tl.load(A_ptr + h).to(tl.float32)
+ if HAS_D:
+ D = tl.load(D_ptr + h).to(tl.float32)
+ if HAS_DT_BIAS:
+ dt_bias = tl.load(dt_bias_ptr + h).to(tl.float32)
+ x_ptr += bos * stride_x_tok + h * stride_x_head
+ dt_ptr += bos * stride_dt_tok + h * stride_dt_head
+ B_ptr += bos * stride_B_tok + (h // heads_per_group) * stride_B_group
+ C_ptr += bos * stride_C_tok + (h // heads_per_group) * stride_C_group
+ out_ptr += bos * stride_out_tok + h * stride_out_head
+
+ for t in range(seq_len):
+ parent = tl.load(parents + t)
+ if (t > 0) & (parent != t - 1):
+ # A branch: continue from the parent row's stored state (this program stored it; the barrier orders the
+ # other threads' stores of the tile before the reload).
+ tl.debug_barrier()
+ parent_slot = tl.load(slots + parent).to(tl.int64)
+ state = tl.load(
+ head_state + parent_slot * stride_state_slot + tile,
+ mask=mask & (parent_slot != PAD_SLOT_ID),
+ other=0.0,
+ ).to(tl.float32)
+ x = tl.load(x_ptr + t * stride_x_tok + offs_m, mask=mask_m, other=0.0).to(tl.float32)
+ dt = tl.load(dt_ptr + t * stride_dt_tok).to(tl.float32)
+ if HAS_DT_BIAS:
+ dt += dt_bias
+ if DT_SOFTPLUS:
+ dt = _softplus(dt)
+ dA = _exp(A * dt)
+ B = tl.load(B_ptr + t * stride_B_tok + offs_n, mask=mask_n, other=0.0).to(tl.float32)
+ C = tl.load(C_ptr + t * stride_C_tok + offs_n, mask=mask_n, other=0.0).to(tl.float32)
+ dB = B * dt
+ state = state * dA + dB * x[:, None]
+ row_slot = tl.load(slots + t).to(tl.int64)
+ if row_slot != PAD_SLOT_ID:
+ tl.store(head_state + row_slot * stride_state_slot + tile, state.to(state_ptr.dtype.element_ty), mask=mask)
+ out = tl.sum(state * C[None, :], axis=1)
+ if HAS_D:
+ out += x * D
+ tl.store(out_ptr + t * stride_out_tok + offs_m, out, mask=mask_m)
+
+
+def _launch_shape(head_dim: int, dstate: int, programs_per_block: int, device: torch.device) -> tuple[int, int]:
+ """(BLOCK_M, num_warps): one warp per program holding ~32 state elements per thread, and half that while the grid
+ has fewer than 16 programs per SM. The walk is latency-bound, so many small programs win: on a B300 with NemotronH
+ Nano's layer (64 heads x 64 x 128, fp32 state) this was 1.3-1.9x faster than 4-8 warp programs over 16-64 head
+ dims at batch 1-64, and 1.4-1.9x faster than vLLM's chain kernel at batch 1-16."""
+ sm_count = torch.cuda.get_device_properties(device).multi_processor_count if device.type == "cuda" else 1
+ block_n = triton.next_power_of_2(dstate)
+ block_m = max(1, min(triton.next_power_of_2(head_dim), 1024 // block_n))
+ if block_m > max(1, 512 // block_n) and triton.cdiv(head_dim, block_m) * programs_per_block < 16 * sm_count:
+ block_m //= 2
+ return block_m, 1
+
+
+def mamba2_tree_state_update(
+ state: torch.Tensor,
+ x: torch.Tensor,
+ dt: torch.Tensor,
+ A: torch.Tensor,
+ B: torch.Tensor,
+ C: torch.Tensor,
+ D: Optional[torch.Tensor],
+ dt_bias: Optional[torch.Tensor],
+ out: torch.Tensor,
+ *,
+ state_indices: torch.Tensor,
+ parents: torch.Tensor,
+ query_start_loc: torch.Tensor,
+ num_accepted_tokens: Optional[torch.Tensor] = None,
+ dt_softplus: bool = True,
+ pad_slot_id: int = PAD_SLOT_ID,
+) -> torch.Tensor:
+ """Mamba2's selective state update of a tree verify, in place.
+
+ Shapes (per tensor-parallel rank): ``state`` (slots, heads, head_dim, dstate) with a contiguous last dim; ``x``
+ and ``out`` (tokens, heads, head_dim) and ``dt`` (tokens, heads), any token and head strides with contiguous head
+ dims; ``B`` / ``C`` (tokens, groups, dstate), contiguous last dim; ``A`` (float32, ``-exp(A_log)``), ``D`` and
+ ``dt_bias`` (heads,). Request ``b``'s rows are tokens ``query_start_loc[b]:query_start_loc[b + 1]``; row ``t``
+ continues from row ``parents[b, t]`` (``-1`` for row 0: the state at ``state_indices[b, num_accepted_tokens[b] -
+ 1]``, or column 0 without accepted counts) and stores its state at ``state_indices[b, t]``; a slot equal to
+ ``pad_slot_id`` is neither read (zeros) nor written. ``out[t] = C_t . state_t + D * x_t`` with
+ ``state_t = exp(A dt_t) state_parent + dt_t B_t x_t`` and ``dt_t = softplus(dt + dt_bias)`` (``dt_softplus``).
+ """
+ tokens, heads, head_dim = x.shape
+ groups, dstate = B.shape[1], B.shape[2]
+ batch = query_start_loc.shape[0] - 1
+ assert state.shape[1:] == (heads, head_dim, dstate) and state.stride(-1) == 1
+ assert dt.shape == (tokens, heads) and out.shape == x.shape and C.shape == B.shape == (tokens, groups, dstate)
+ assert x.stride(-1) == 1 and out.stride(-1) == 1 and B.stride(-1) == 1 and C.stride(-1) == 1
+ assert A.shape == (heads,) and A.dtype == torch.float32 and heads % groups == 0
+ assert state_indices.shape[0] >= batch and parents.shape[0] >= batch
+ assert parents.stride(-1) == 1 and state_indices.stride(-1) == 1
+ block_m, num_warps = _launch_shape(head_dim, dstate, batch * heads, x.device)
+ _tree_ssu_kernel[(triton.cdiv(head_dim, block_m), batch, heads)](
+ state,
+ x,
+ dt,
+ A,
+ B,
+ C,
+ D,
+ dt_bias,
+ out,
+ state_indices,
+ parents,
+ num_accepted_tokens,
+ query_start_loc,
+ head_dim,
+ dstate,
+ heads // groups,
+ state.stride(0),
+ state.stride(1),
+ state.stride(2),
+ x.stride(0),
+ x.stride(1),
+ dt.stride(0),
+ dt.stride(1),
+ B.stride(0),
+ B.stride(1),
+ C.stride(0),
+ C.stride(1),
+ out.stride(0),
+ out.stride(1),
+ state_indices.stride(0),
+ parents.stride(0),
+ PAD_SLOT_ID=pad_slot_id,
+ HAS_D=D is not None,
+ HAS_DT_BIAS=dt_bias is not None,
+ HAS_NUM_ACCEPTED=num_accepted_tokens is not None,
+ DT_SOFTPLUS=dt_softplus,
+ BLOCK_M=block_m,
+ BLOCK_N=triton.next_power_of_2(dstate),
+ num_warps=num_warps,
+ )
+ return out
diff --git a/eagle_harness/kernels/native.py b/eagle_harness/kernels/native.py
new file mode 100644
index 0000000..afa6b1a
--- /dev/null
+++ b/eagle_harness/kernels/native.py
@@ -0,0 +1,88 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Load the native CUDA library: ``$EAGLE_HARNESS_NATIVE_LIB`` if set, else the prebuilt binary of this CUDA major,
+else an nvcc build cached on disk.
+
+:func:`library` returns the bound :class:`ctypes.CDLL`, or None (logged once) where there is no nvcc, no prebuilt binary
+and no JIT build for this machine; callers then run the Triton kernels, which give the same bits.
+"""
+
+from __future__ import annotations
+
+import ctypes
+import functools
+import hashlib
+import logging
+import os
+import subprocess
+from pathlib import Path
+from typing import Optional
+
+import torch
+
+from eagle_harness.kernels import arch, build
+
+logger = logging.getLogger(__name__)
+
+# C parameter types of the library's entries: i = int, q = int64_t, P = pointer (see csrc/candidate.cu).
+SIGNATURES = {
+ "eagle4_shard_topk": "iiPqiiiPqPqqP",
+ "eagle4_candidate_tail": "iiiPqqPqqPqPqPqPqiiiiiP",
+}
+_CTYPES = {"i": ctypes.c_int, "q": ctypes.c_int64, "P": ctypes.c_void_p}
+
+
+def _bind(lib: ctypes.CDLL) -> ctypes.CDLL:
+ for name, signature in SIGNATURES.items():
+ function = getattr(lib, name)
+ function.argtypes = [_CTYPES[c] for c in signature]
+ function.restype = ctypes.c_int
+ return lib
+
+
+def _cache_dir() -> Path:
+ return Path(os.environ.get("EAGLE_HARNESS_CACHE") or Path.home() / ".cache" / "eagle_harness")
+
+
+def _jit() -> ctypes.CDLL:
+ """Build for the visible GPUs only (fast), keyed by source, toolkit and architectures."""
+ nvcc = build.find_nvcc()
+ if nvcc is None:
+ raise RuntimeError("no nvcc (set CUDA_HOME)")
+ sass = sorted({g.sm for i in range(torch.cuda.device_count()) if (g := arch.gpu(i)) and g.nvidia})
+ version = build.toolkit_version(nvcc)
+ key = hashlib.sha256(f"{build.SOURCE.read_bytes().hex()}{version}{sass}".encode()).hexdigest()[:16]
+ path = _cache_dir() / key / build.LIBRARY
+ if not path.exists():
+ logger.info("eagle-harness: building the native kernels for sm_%s with %s", sass, nvcc)
+ build.compile_library(path, sass, max(sass) if sass else None, nvcc)
+ return ctypes.CDLL(str(path))
+
+
+def _explicit() -> ctypes.CDLL:
+ return ctypes.CDLL(os.environ["EAGLE_HARNESS_NATIVE_LIB"])
+
+
+def _prebuilt() -> ctypes.CDLL:
+ path = build.PREBUILT / f"cu{torch.version.cuda.split('.')[0]}" / build.LIBRARY # type: ignore[union-attr]
+ if not path.exists():
+ raise RuntimeError(f"no prebuilt binary {path}")
+ return ctypes.CDLL(str(path))
+
+
[email protected]_cache(maxsize=None)
+def library() -> Optional[ctypes.CDLL]:
+ """The bound native library, or None where the Triton kernels run instead."""
+ if not torch.version.cuda: # ROCm or a CPU build of torch
+ return None
+ reasons = []
+ for load in (*([_explicit] if "EAGLE_HARNESS_NATIVE_LIB" in os.environ else []), _prebuilt, _jit):
+ try:
+ lib = _bind(load())
+ logger.info("eagle-harness: native CUDA kernels loaded from %s", lib._name)
+ return lib
+ except (OSError, RuntimeError, subprocess.SubprocessError) as e:
+ reasons.append(f"{load.__name__[1:]}: {str(e).splitlines()[0]}")
+ logger.warning("eagle-harness: native CUDA kernels unavailable (%s); using Triton", "; ".join(reasons))
+ return None
diff --git a/eagle_harness/kernels/online_softmax.py b/eagle_harness/kernels/online_softmax.py
new file mode 100644
index 0000000..0b86556
--- /dev/null
+++ b/eagle_harness/kernels/online_softmax.py
@@ -0,0 +1,24 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The online-softmax step the engines' row attention kernels share (``@triton.jit``, inlined into each kernel)."""
+
+import triton
+import triton.language as tl
+
+
+def online_block(qv, k, v, ok, peak, denom, acc, scale_log2):
+ """Online softmax of every row over one block of keys (``ok`` ``[rows, keys]`` masks the keys a row does not see).
+
+ ``peak``, ``denom`` and ``acc`` are the running row maximum (log2 domain), normaliser and weighted value sum;
+ returns them updated. A row that has seen no key yet keeps ``peak = -inf`` and adds nothing."""
+ s = tl.dot(qv, tl.trans(k)) * scale_log2
+ s = tl.where(ok, s, float("-inf"))
+ new_peak = tl.maximum(peak, tl.max(s, 1))
+ safe = tl.where(new_peak == float("-inf"), 0.0, new_peak)
+ alpha = tl.exp2(peak - safe)
+ p = tl.exp2(s - safe[:, None])
+ denom = denom * alpha + tl.sum(p, 1)
+ acc = acc * alpha[:, None] + tl.dot(p.to(v.dtype), v)
+ return new_peak, denom, acc
diff --git a/eagle_harness/kernels/row_attention.py b/eagle_harness/kernels/row_attention.py
new file mode 100644
index 0000000..5594dc3
--- /dev/null
+++ b/eagle_harness/kernels/row_attention.py
@@ -0,0 +1,287 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Attention of decode-time draft rows whose keys are mostly shared (both engines' draft steps, sglang's draft extend).
+
+A request's rows see one range of its committed keys, read through its page table, and the rows of a draft step
+also see their own tree ancestors:
+
+- draft step ``step`` (``rows`` frontier rows per request, all at position ``seq_len + step - 1``): the committed keys
+ inside the draft's sliding window, the same for every row, plus the row's ``step`` ancestors (itself last);
+- draft extend (``step == 0``; row ``j`` at ``seq_len + j``): the keys ``[pos - window + 1, pos]`` of its own position.
+
+One program per (request, head, key split) loads each key and value of the request's range once for all its rows
+(a ``tl.dot`` over the rows) and masks the keys outside a row's own range; a draft step's ancestors are one more
+split. A second kernel merges the splits by their log-sum-exp. Lengths are read on the device: no host planning,
+CUDA-graph safe.
+
+The engines differ only in how a key position becomes a KV address, which the launcher takes as arguments: the page
+of position ``p`` is ``table[row, p // table_page]`` (``row``: ``table_rows[b]``, or ``b`` without ``table_rows``),
+its slot ``page * table_page + p % table_page``, and a slot ``s`` sits at ``(s // cache_page, s % cache_page, head)``
+of the KV cache.
+"""
+
+from __future__ import annotations
+
+import functools
+import math
+from dataclasses import dataclass
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels.online_softmax import online_block
+
+
+@dataclass(frozen=True)
+class RowsLaunch:
+ """Launch config of :func:`rows_attention`: key splits of a request's shared range (a draft step's tree
+ ancestors are one more), keys per iteration, Triton warps and pipeline stages."""
+
+ splits: int
+ block_n: int
+ num_warps: int = 4
+ num_stages: int = 3
+
+
+def rows_padded(rows_per_request: int) -> int:
+ """Rows of a request's ``tl.dot`` tile: a power of two, at least 16 (``tl.dot``'s smallest tile)."""
+ return max(16, triton.next_power_of_2(rows_per_request))
+
+
+def program_splits(programs: int, device: torch.device) -> int:
+ """Key splits per (request, head) program: the power of two that gives every SM at least one program."""
+ if device.type != "cuda":
+ return 4
+ sms = torch.cuda.get_device_properties(device).multi_processor_count
+ return triton.next_power_of_2(triton.cdiv(sms, programs))
+
+
+def window_start(pos, window):
+ """First key position a query at ``pos`` sees (``window <= 0``: the whole context)."""
+ start = pos * 0
+ if window > 0:
+ start = tl.maximum(pos - window + 1, 0)
+ return start
+
+
+def _kv_rows(kv, slot, h, d, mask, kv_strides, cache_page):
+ """Keys and values ``[len(slot), HEAD_DIM]`` of head ``h`` at the KV cache slots ``slot`` (int64)."""
+ k_cache, v_cache = kv
+ key_strides, value_strides = kv_strides
+ stride_page, stride_slot, stride_head = key_strides
+ at = (slot // cache_page) * stride_page + (slot % cache_page) * stride_slot + h * stride_head
+ k = tl.load(k_cache + at[:, None] + d[None, :], mask=mask[:, None], other=0.0)
+ if v_cache is None: # packed [K, V] in the last dimension
+ v = tl.load(k_cache + at[:, None] + d.shape[0] + d[None, :], mask=mask[:, None], other=0.0)
+ else:
+ v_page, v_slot, v_head = value_strides
+ v_at = (slot // cache_page) * v_page + (slot % cache_page) * v_slot + h * v_head
+ v = tl.load(v_cache + v_at[:, None] + d[None, :], mask=mask[:, None], other=0.0)
+ return k, v
+
+
+def _rows_attention_kernel(
+ q, # [bs * ROWS, heads, HEAD_DIM]
+ kv, # (keys, values): KV cache views, a slot at (slot // cache_page, slot % cache_page, head)
+ parts, # (out [bs, heads, NUM_SPLITS + 1, ROWS_P, HEAD_DIM] fp32, log-sum-exp [..., ROWS_P] fp32, log2 domain)
+ table, # page table of the key positions, a row per request
+ table_rows, # [bs] the requests' rows of ``table``, or None: row b
+ seq_lens, # [bs] committed length
+ ancestors, # [bs, ROWS, MAX_DEPTH] int32 KV slots of each row's tree ancestors (a draft step)
+ q_strides, # (row, head)
+ kv_strides, # (page, slot in a page, head) for keys and for values
+ paging, # (table row stride, table page, cache page)
+ step,
+ window,
+ scale_log2,
+ num_heads,
+ QUERY_GROUP_SIZE: tl.constexpr,
+ ROWS: tl.constexpr,
+ ROWS_P: tl.constexpr,
+ HEAD_DIM: tl.constexpr,
+ EXTEND: tl.constexpr,
+ MAX_DEPTH: tl.constexpr,
+ ANC_P: tl.constexpr,
+ NUM_SPLITS: tl.constexpr,
+ BLOCK_N: tl.constexpr,
+):
+ b = tl.program_id(0)
+ h = tl.program_id(1)
+ kv_head = h // QUERY_GROUP_SIZE
+ split = tl.program_id(2)
+ stride_table, table_page, cache_page = paging
+ stride_q_row, stride_q_head = q_strides
+ r = tl.arange(0, ROWS_P)
+ d = tl.arange(0, HEAD_DIM)
+ row_ok = r < ROWS
+ seq_len = tl.load(seq_lens + b).to(tl.int32)
+ if EXTEND: # row j at seq_len + j sees its window up to itself
+ pos = seq_len + r
+ lo = window_start(pos, window)
+ hi = pos
+ qv = tl.load(
+ q + (b * ROWS + r)[:, None] * stride_q_row + h * stride_q_head + d[None, :], mask=row_ok[:, None], other=0.0
+ )
+ m = tl.full((ROWS_P,), float("-inf"), tl.float32)
+ denom = tl.zeros((ROWS_P,), tl.float32)
+ acc = tl.zeros((ROWS_P, HEAD_DIM), tl.float32)
+ if split < NUM_SPLITS:
+ if EXTEND:
+ first = tl.min(tl.where(row_ok, lo, 2147483647), 0)
+ last = tl.max(tl.where(row_ok, hi, -1), 0)
+ else: # every row sees the committed keys of the window at seq_len + step - 1
+ first = tl.minimum(window_start(seq_len + step - 1, window), seq_len)
+ last = seq_len - 1
+ if table_rows is None:
+ row_pages = table + b * stride_table
+ else:
+ row_pages = table + tl.load(table_rows + b).to(tl.int64) * stride_table
+ per_split = tl.cdiv(tl.cdiv(last + 1 - first, NUM_SPLITS), BLOCK_N) * BLOCK_N
+ start = first + split * per_split
+ end = tl.minimum(start + per_split, last + 1)
+ for block in range(start, end, BLOCK_N):
+ p = block + tl.arange(0, BLOCK_N)
+ in_range = p < end
+ page = tl.load(row_pages + p // table_page, mask=in_range, other=0).to(tl.int64)
+ k, v = _kv_rows(kv, page * table_page + p % table_page, kv_head, d, in_range, kv_strides, cache_page)
+ ok = row_ok[:, None] & in_range[None, :]
+ if EXTEND:
+ ok = ok & (p[None, :] >= lo[:, None]) & (p[None, :] <= hi[:, None])
+ m, denom, acc = online_block(qv, k, v, ok, m, denom, acc, scale_log2)
+ else: # a draft step's tree ancestors: column c is ancestor c % MAX_DEPTH of row c // MAX_DEPTH
+ c = tl.arange(0, ANC_P)
+ owner = c // MAX_DEPTH
+ valid = (owner < ROWS) & (c % MAX_DEPTH < step)
+ slot = tl.load(ancestors + (b * ROWS + owner) * MAX_DEPTH + c % MAX_DEPTH, mask=valid, other=0).to(tl.int64)
+ k, v = _kv_rows(kv, slot, kv_head, d, valid, kv_strides, cache_page)
+ ok = valid[None, :] & (owner[None, :] == r[:, None])
+ m, denom, acc = online_block(qv, k, v, ok, m, denom, acc, scale_log2)
+ part_out, part_lse = parts
+ part = ((b * num_heads + h) * (NUM_SPLITS + 1) + split) * ROWS_P + r
+ denom_safe = tl.maximum(denom, 1e-30)
+ tl.store(part_lse + part, tl.where(denom > 0, m + tl.log2(denom_safe), float("-inf")))
+ tl.store(part_out + part[:, None] * HEAD_DIM + d[None, :], acc / denom_safe[:, None])
+
+
+def _merge_splits_kernel(
+ parts, # (out, log-sum-exp) of _rows_attention_kernel
+ out, # [bs * ROWS, heads, HEAD_DIM]
+ out_strides, # (row, head)
+ num_heads,
+ ROWS: tl.constexpr,
+ ROWS_P: tl.constexpr,
+ HEAD_DIM: tl.constexpr,
+ SPLITS: tl.constexpr,
+ SPLITS_P: tl.constexpr,
+ NUM_SPLITS: tl.constexpr,
+):
+ row = tl.program_id(0)
+ h = tl.program_id(1)
+ part_out, part_lse = parts
+ stride_o_row, stride_o_head = out_strides
+ s = tl.arange(0, SPLITS_P)
+ d = tl.arange(0, HEAD_DIM)
+ used = s < SPLITS
+ part = (((row // ROWS) * num_heads + h) * (NUM_SPLITS + 1) + s) * ROWS_P + row % ROWS
+ lse = tl.load(part_lse + part, mask=used, other=float("-inf"))
+ top = tl.max(lse, 0)
+ weight = tl.where(lse == float("-inf"), 0.0, tl.exp2(lse - top))
+ parts_d = tl.load(part_out + part[:, None] * HEAD_DIM + d[None, :], mask=used[:, None], other=0.0)
+ merged = tl.sum(weight[:, None] * parts_d, 0) / tl.sum(weight, 0)
+ tl.store(out + row * stride_o_row + h * stride_o_head + d, merged.to(out.dtype.element_ty))
+
+
+def _kv_strides(cache: torch.Tensor) -> tuple:
+ """(page, slot, head) strides of a ``[slots, heads, D]`` (page 1) or ``[pages, page, heads, D]`` cache view."""
+ if cache.dim() == 3:
+ return cache.stride(0), 0, cache.stride(1)
+ return cache.stride(0), cache.stride(1), cache.stride(2)
+
+
+def rows_attention(
+ q: torch.Tensor,
+ keys: torch.Tensor,
+ values: torch.Tensor | None,
+ out: torch.Tensor,
+ part_out: torch.Tensor,
+ part_lse: torch.Tensor,
+ table: torch.Tensor,
+ seq_lens: torch.Tensor,
+ ancestors: torch.Tensor | None,
+ *,
+ rows_per_request: int,
+ step: int,
+ window: int,
+ scale: float,
+ launch: RowsLaunch,
+ table_rows: torch.Tensor | None = None,
+ table_page: int = 1,
+) -> None:
+ """Attention of ``q`` ``[bs * rows_per_request, heads, D]`` into ``out`` (same shape).
+
+ ``step == 0``: extend rows (row ``j`` of request ``b`` at ``seq_lens[b] + j``, causal); else the rows of draft
+ step ``step`` over the committed window plus ``ancestors[b, row, :step]`` (KV slots). ``keys`` / ``values``:
+ the layer's KV cache as ``[slots, kv_heads, D]`` or ``[pages, page, kv_heads, D]`` views.
+ Consecutive groups of ``heads // kv_heads`` query heads share one KV head.
+ For a packed cache, pass ``keys`` with last dimension ``2 * D`` and ``values=None``.
+ The key at
+ position ``p`` of request ``b`` is slot ``table[table_rows[b], p // table_page] * table_page + p % table_page``
+ (row ``b`` without ``table_rows``). ``part_out`` / ``part_lse``: scratch of at least
+ ``bs * heads * (launch.splits + 1) * rows_padded(rows_per_request)`` rows.
+ """
+ rows, heads, head_dim = q.shape
+ kv_heads = keys.shape[-2]
+ if kv_heads <= 0 or heads % kv_heads:
+ raise ValueError(f"query heads ({heads}) must be divisible by KV heads ({kv_heads})")
+ kv_strides = (_kv_strides(keys), None if values is None else _kv_strides(values))
+ extend = step == 0
+ max_depth = 1 if extend else ancestors.shape[-1]
+ rows_p = rows_padded(rows_per_request)
+ splits = launch.splits + (0 if extend else 1)
+ parts = (part_out, part_lse)
+ _rows_attention_kernel[(rows // rows_per_request, heads, splits)](
+ q,
+ (keys, values),
+ parts,
+ table,
+ table_rows,
+ seq_lens,
+ table if extend else ancestors, # unread by an extend
+ (q.stride(0), q.stride(1)),
+ kv_strides,
+ (table.stride(0), table_page, 1 if keys.dim() == 3 else keys.shape[1]),
+ step,
+ window,
+ scale * math.log2(math.e),
+ heads,
+ QUERY_GROUP_SIZE=heads // kv_heads,
+ ROWS=rows_per_request,
+ ROWS_P=rows_p,
+ HEAD_DIM=head_dim,
+ EXTEND=extend,
+ MAX_DEPTH=max_depth,
+ ANC_P=rows_padded(rows_per_request * max_depth),
+ NUM_SPLITS=launch.splits,
+ BLOCK_N=launch.block_n,
+ num_warps=launch.num_warps,
+ num_stages=launch.num_stages,
+ )
+ _merge_splits_kernel[(rows, heads)](
+ parts,
+ out,
+ (out.stride(0), out.stride(1)),
+ heads,
+ ROWS=rows_per_request,
+ ROWS_P=rows_p,
+ HEAD_DIM=head_dim,
+ SPLITS=splits,
+ SPLITS_P=triton.next_power_of_2(splits),
+ NUM_SPLITS=launch.splits,
+ )
diff --git a/eagle_harness/kernels/tree_step.py b/eagle_harness/kernels/tree_step.py
new file mode 100644
index 0000000..bf3f06c
--- /dev/null
+++ b/eagle_harness/kernels/tree_step.py
@@ -0,0 +1,485 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Triton launches for the bookkeeping of a draft tree: its steps (:meth:`DraftTree.step`, work deltas
+included) and the ranking and selection of its verify set.
+
+:func:`tree_step`, per batch row (one program): the layer scores ``front_score * prob``, the
+layer's tokens, its top-``K`` (the next frontier, ties to the lower node),
+the frontier's parents, tokens, hidden rows and ancestor slots, and the new
+best-score set (top ``work_cap`` of the old set and the layer). At the tree's
+delta slots the same program also writes the cost model's work deltas (the
+prefix sums of the best set merged with the layer's best ``j`` scores, for every
+verify budget and ``j``), which the torch version spends about ten launches on.
+The torch version in :class:`~eagle_harness.core.draft_tree.DraftTree` is the
+reference (``tests/test_tree_step_gpu.py``). :func:`tree_begin` seeds depth 1
+from the root; :func:`work_deltas` computes the begin slot's deltas. :func:`tree_rank` and
+:func:`tree_select` replace the ten or so small torch launches of :meth:`DraftTree.rank_reference` and
+the node sort and token gather of :meth:`DraftTree.select`; :func:`select_rows` turns the grown tree into verify rows
+with the row of each row's parent (:meth:`DraftTree.verify_rows`; was ~30 torch kernels, ~90 us per round).
+"""
+
+from __future__ import annotations
+
+from typing import Tuple
+
+import torch
+import triton
+import triton.language as tl
+
+
+def _tree_step_kernel(
+ front_scores_ptr, # [bs, K] fp32, read then overwritten
+ layer, # the step's draft outputs: probs [bs * K, K] (top-k probabilities of each frontier row), tokens
+ # [bs * K, K] int64 (their token ids), hidden [bs * K, H] (the rows' draft hidden states)
+ tree, # the tree's buffers, see the unpacking below
+ layer_strides, # row strides of probs, tokens, hidden
+ tree_strides, # row strides of scores, node_tokens, parents, front_hidden, best, deltas
+ H,
+ start,
+ pstart,
+ K: tl.constexpr,
+ K_P: tl.constexpr,
+ KK_P: tl.constexpr,
+ D: tl.constexpr,
+ D_P: tl.constexpr,
+ CAP: tl.constexpr,
+ MERGE_P: tl.constexpr,
+ BLOCK_H: tl.constexpr,
+ DELTAS: tl.constexpr,
+ V: tl.constexpr,
+ J_P: tl.constexpr,
+ DELTA_P: tl.constexpr,
+):
+ probs_ptr, tokens_ptr, hidden_ptr = layer
+ (
+ scores_ptr, # [bs, capacity] fp32 node scores
+ node_tokens_ptr, # [bs, capacity] int64 node tokens
+ parents_ptr, # [bs, parent_capacity] int64
+ front_tokens_ptr, # [bs * K] int64
+ front_hidden_ptr, # [bs * K, H]
+ ancestors_ptr, # [bs, K, D] int32, permuted in place
+ best_ptr, # [bs, CAP] fp32, read then overwritten
+ best_prev_ptr, # [bs, CAP] fp32
+ layer_top_ptr, # [bs, K] fp32
+ deltas_ptr, # [bs or 1, V, K + 1] fp32 work deltas of this row (DELTAS only)
+ ) = tree
+ probs_stride, tokens_stride, hidden_stride = layer_strides
+ scores_stride, node_tokens_stride, parents_stride, front_hidden_stride, best_stride, deltas_stride = tree_strides
+ b = tl.program_id(0).to(tl.int64)
+ # ---- every read of in-place buffers first
+ n = tl.arange(0, KK_P)
+ valid = n < K * K
+ row = b * K + n // K
+ fs = tl.load(front_scores_ptr + b * K + n // K, mask=valid, other=0.0)
+ p = tl.load(probs_ptr + row * probs_stride + n % K, mask=valid, other=0.0).to(tl.float32)
+ layer = fs * p
+ tok = tl.load(tokens_ptr + row * tokens_stride + n % K, mask=valid, other=0)
+ m = tl.arange(0, MERGE_P)
+ in_best = m < CAP
+ in_layer = (m >= CAP) & (m < CAP + K * K)
+ old_best = tl.load(best_ptr + b * best_stride + m, mask=in_best, other=0.0)
+ ml = tl.where(in_layer, m - CAP, 0)
+ fs_m = tl.load(front_scores_ptr + b * K + ml // K, mask=in_layer, other=0.0)
+ p_m = tl.load(probs_ptr + (b * K + ml // K) * probs_stride + ml % K, mask=in_layer, other=0.0).to(tl.float32)
+ merged = tl.where(in_best, old_best, tl.where(in_layer, fs_m * p_m, float("-inf")))
+ # Top K of the layer: non-negative fp32 bits order like the values; the low word breaks
+ # ties toward the lower node.
+ key = (layer.to(tl.int32, bitcast=True).to(tl.int64) << 32) | (KK_P - 1 - n).to(tl.int64)
+ key = tl.where(valid, key, -1)
+ top_key = tl.topk(key, K_P)
+ r = tl.arange(0, K_P)
+ r_ok = r < K
+ pick = KK_P - 1 - (top_key & 0xFFFFFFFF)
+ top = (top_key >> 32).to(tl.int32).to(tl.float32, bitcast=True)
+ lane = pick // K
+ d = tl.arange(0, D_P)
+ anc_mask = r_ok[:, None] & (d[None, :] < D)
+ anc = tl.load(ancestors_ptr + (b * K + lane)[:, None] * D + d[None, :], mask=anc_mask, other=0)
+ front_tok = tl.load(tokens_ptr + (b * K + lane) * tokens_stride + pick % K, mask=r_ok, other=0)
+ new_best = tl.sort(merged, descending=True)
+ tl.debug_barrier()
+ # ---- writes
+ tl.store(scores_ptr + b * scores_stride + start + n, layer, mask=valid)
+ tl.store(node_tokens_ptr + b * node_tokens_stride + start + n, tok, mask=valid)
+ tl.store(parents_ptr + b * parents_stride + pstart + r, pick + start, mask=r_ok)
+ tl.store(front_scores_ptr + b * K + r, top, mask=r_ok)
+ tl.store(layer_top_ptr + b * K + r, top, mask=r_ok)
+ tl.store(front_tokens_ptr + b * K + r, front_tok, mask=r_ok)
+ tl.store(ancestors_ptr + (b * K + r)[:, None] * D + d[None, :], anc, mask=anc_mask)
+ tl.store(best_prev_ptr + b * best_stride + m, old_best, mask=in_best)
+ tl.store(best_ptr + b * best_stride + m, new_best, mask=in_best)
+ for h0 in range(0, H, BLOCK_H):
+ h = h0 + tl.arange(0, BLOCK_H)
+ hm = r_ok[:, None] & (h[None, :] < H)
+ rows = tl.load(hidden_ptr + (b * K + lane)[:, None] * hidden_stride + h[None, :], mask=hm)
+ tl.store(front_hidden_ptr + (b * K + r)[:, None] * front_hidden_stride + h[None, :], rows, mask=hm)
+ if DELTAS:
+ # deltas[v, j] = sum of the top v of (old best set, layer top j): row j of the tile merges the old set with
+ # the layer's best j scores (the other extras are zero, scores are non-negative), sorted, then prefix-summed.
+ tl.debug_barrier() # the old set and the layer top were just stored by this program
+ j = tl.arange(0, J_P)[:, None]
+ c = tl.arange(0, DELTA_P)[None, :]
+ e = c - CAP
+ old = tl.load(best_prev_ptr + b * best_stride + c, mask=c < CAP, other=0.0, cache_modifier=".cg")
+ extra = tl.load(layer_top_ptr + b * K + e, mask=(e >= 0) & (e < j), other=0.0, cache_modifier=".cg")
+ sums = tl.cumsum(tl.sort(old + extra, dim=1, descending=True), axis=1)
+ tl.store(deltas_ptr + b * deltas_stride + c * (K + 1) + j, sums, mask=(j <= K) & (c < V))
+
+
+def tree_step(
+ tree, bs: int, step: int, probs: torch.Tensor, tokens: torch.Tensor, hidden: torch.Tensor, deltas: bool = False
+) -> None:
+ """:meth:`DraftTree.step` in one launch; ``deltas``: also store ``tree.deltas[step]`` (the step's work deltas)."""
+ shape = tree.shape
+ k = shape.top_k
+ hidden = hidden.view(bs * k, -1)
+ if probs.stride(-1) != 1 or tokens.stride(-1) != 1 or hidden.stride(-1) != 1:
+ raise ValueError("tree_step needs unit column strides")
+ if tokens.dtype != torch.int64:
+ tokens = tokens.long()
+ depth = tree.ancestors.shape[-1]
+ # One row writes its deltas straight into the slot; several rows write theirs side by side, then their mean.
+ rows_out = tree.deltas[step] if bs == 1 else tree.delta_rows
+ _tree_step_kernel[(bs,)](
+ tree.front_scores,
+ (probs, tokens, hidden),
+ (
+ tree.scores,
+ tree.tokens,
+ tree.parents,
+ tree.front_tokens,
+ tree.front_hidden,
+ tree.ancestors,
+ tree.best,
+ tree.best_prev,
+ tree.layer_top,
+ rows_out,
+ ),
+ (probs.stride(0), tokens.stride(0), hidden.stride(0)),
+ (
+ tree.scores.stride(0),
+ tree.tokens.stride(0),
+ tree.parents.stride(0),
+ tree.front_hidden.stride(0),
+ tree.best.stride(0),
+ 0 if bs == 1 else rows_out.stride(0),
+ ),
+ hidden.shape[1],
+ shape.layer_start(step + 1),
+ shape.num_parents(step + 1),
+ K=k,
+ K_P=max(triton.next_power_of_2(k), 2), # tl.topk needs k >= 2; the lanes past K are masked
+ KK_P=max(triton.next_power_of_2(k * k), 2),
+ D=depth,
+ D_P=triton.next_power_of_2(depth),
+ CAP=shape.work_cap,
+ MERGE_P=triton.next_power_of_2(shape.work_cap + k * k),
+ BLOCK_H=1024,
+ DELTAS=deltas,
+ V=tree.max_verify,
+ J_P=triton.next_power_of_2(k + 1),
+ DELTA_P=triton.next_power_of_2(shape.work_cap + k),
+ num_warps=4,
+ )
+ if deltas and bs > 1:
+ torch.mean(tree.delta_rows[:bs], dim=0, out=tree.deltas[step])
+
+
+def _work_deltas_kernel(
+ best_prev_ptr, # [bs, CAP] fp32 best scores before the layer, sorted
+ layer_top_ptr, # [bs, K] fp32 the layer's best scores, sorted
+ deltas_ptr, # [V, K + 1] fp32 out
+ bs,
+ best_stride,
+ V,
+ K: tl.constexpr,
+ CAP: tl.constexpr,
+ MERGE_P: tl.constexpr,
+):
+ # Program j: the layer's best j scores join the old best set; the batch mean of the prefix sums of
+ # the merged set's sorted scores is the delta of every budget (row v - 1: the top v).
+ j = tl.program_id(0)
+ m = tl.arange(0, MERGE_P)
+ extra = m - CAP
+ in_best = m < CAP
+ in_extra = (extra >= 0) & (extra < j)
+ total = tl.zeros([MERGE_P], dtype=tl.float32)
+ for b in range(0, bs):
+ old = tl.load(best_prev_ptr + b * best_stride + m, mask=in_best, other=0.0)
+ new = tl.load(layer_top_ptr + b * K + extra, mask=in_extra, other=0.0)
+ total += tl.cumsum(tl.sort(old + new, descending=True), axis=0)
+ tl.store(deltas_ptr + m * (K + 1) + j, total / bs, mask=m < V)
+
+
+def work_deltas(tree, bs: int, slot: int) -> None:
+ """:meth:`DraftTree._store_deltas` in one launch: ``tree.deltas[slot]`` from ``best_prev`` and ``layer_top``."""
+ k = tree.shape.top_k
+ cap = tree.shape.work_cap
+ _work_deltas_kernel[(k + 1,)](
+ tree.best_prev,
+ tree.layer_top,
+ tree.deltas[slot],
+ bs,
+ tree.best_prev.stride(0),
+ tree.max_verify,
+ K=k,
+ CAP=cap,
+ MERGE_P=triton.next_power_of_2(cap + k),
+ num_warps=1,
+ )
+
+
+def _tree_begin_kernel(
+ root, # the draft extend's outputs: probs [bs, K] fp32 (top-K probabilities), tokens [bs, K] int64, hidden [bs, H]
+ tree, # scores, node_tokens, front_scores, front_tokens, front_hidden, best, best_prev, layer_top
+ root_hidden_stride,
+ tree_strides, # row strides of scores, node_tokens, front_hidden, best
+ H,
+ root_score,
+ K: tl.constexpr,
+ K_P: tl.constexpr,
+ CAP: tl.constexpr,
+ CAP_P: tl.constexpr,
+ BLOCK_H: tl.constexpr,
+):
+ root_probs_ptr, root_tokens_ptr, root_hidden_ptr = root
+ (
+ scores_ptr,
+ node_tokens_ptr,
+ front_scores_ptr,
+ front_tokens_ptr,
+ front_hidden_ptr,
+ best_ptr,
+ best_prev_ptr,
+ layer_top_ptr,
+ ) = tree
+ scores_stride, node_tokens_stride, front_hidden_stride, best_stride = tree_strides
+ b = tl.program_id(0).to(tl.int64)
+ n = tl.arange(0, K_P)
+ valid = n < K
+ p = tl.load(root_probs_ptr + b * K + n, mask=valid, other=0.0)
+ key = (p.to(tl.int32, bitcast=True).to(tl.int64) << 32) | (K_P - 1 - n).to(tl.int64)
+ top_key = tl.topk(tl.where(valid, key, -1), K_P) # descending, ties to the lower index
+ pick = K_P - 1 - (top_key & 0xFFFFFFFF)
+ top = (top_key >> 32).to(tl.int32).to(tl.float32, bitcast=True)
+ tok = tl.load(root_tokens_ptr + b * K + pick, mask=valid, other=0)
+ tl.store(scores_ptr + b * scores_stride + n, top, mask=valid)
+ tl.store(node_tokens_ptr + b * node_tokens_stride + n, tok, mask=valid)
+ tl.store(front_scores_ptr + b * K + n, top, mask=valid)
+ tl.store(layer_top_ptr + b * K + n, top, mask=valid)
+ tl.store(front_tokens_ptr + b * K + n, tok, mask=valid)
+ tl.debug_barrier()
+ m = tl.arange(0, CAP_P)
+ in_cap = m < CAP
+ first = tl.load(front_scores_ptr + b * K + (m - 1), mask=(m >= 1) & (m <= K), other=0.0)
+ tl.store(best_prev_ptr + b * best_stride + m, tl.where(m == 0, root_score, 0.0), mask=in_cap)
+ tl.store(best_ptr + b * best_stride + m, tl.where(m == 0, root_score, first), mask=in_cap)
+ for h0 in range(0, H, BLOCK_H):
+ h = h0 + tl.arange(0, BLOCK_H)
+ hm = valid[:, None] & (h[None, :] < H)
+ row = tl.load(root_hidden_ptr + b * root_hidden_stride + h, mask=h < H)
+ tl.store(front_hidden_ptr + (b * K + n)[:, None] * front_hidden_stride + h[None, :], row[None, :], mask=hm)
+
+
+def tree_begin(tree, bs: int, root_score: float) -> None:
+ """:meth:`DraftTree.begin` (without the work deltas) in one launch."""
+ shape = tree.shape
+ k = shape.top_k
+ hidden = tree.root_hidden
+ _tree_begin_kernel[(bs,)](
+ (tree.root_probs, tree.root_tokens, hidden),
+ (
+ tree.scores,
+ tree.tokens,
+ tree.front_scores,
+ tree.front_tokens,
+ tree.front_hidden,
+ tree.best,
+ tree.best_prev,
+ tree.layer_top,
+ ),
+ hidden.stride(0),
+ (tree.scores.stride(0), tree.tokens.stride(0), tree.front_hidden.stride(0), tree.best.stride(0)),
+ hidden.shape[1],
+ root_score,
+ K=k,
+ K_P=triton.next_power_of_2(k),
+ CAP=shape.work_cap,
+ CAP_P=triton.next_power_of_2(shape.work_cap),
+ BLOCK_H=1024,
+ num_warps=4,
+ )
+
+
+def _tree_rank_kernel(
+ scores_ptr, # [bs, capacity] fp32 node scores
+ decay_ptr, # [capacity] fp32 depth decay
+ ranked_ptr, # [bs, COUNT] int64 out, best first
+ cum_ptr, # [bs, COUNT + 1] fp32 out, cumulative verify scores (root first)
+ scores_stride,
+ root_score,
+ N: tl.constexpr,
+ N_P: tl.constexpr,
+ COUNT: tl.constexpr,
+ COUNT_P: tl.constexpr,
+):
+ b = tl.program_id(0).to(tl.int64)
+ n = tl.arange(0, N_P)
+ valid = n < N
+ decayed = tl.load(scores_ptr + b * scores_stride + n, mask=valid, other=0.0) * tl.load(
+ decay_ptr + n, mask=valid, other=0.0
+ )
+ # Non-negative fp32 bits order like the values; the low word breaks ties toward the lower node.
+ key = (decayed.to(tl.int32, bitcast=True).to(tl.int64) << 32) | (N_P - 1 - n).to(tl.int64)
+ top_key = tl.topk(tl.where(valid, key, -1), COUNT_P) # descending
+ r = tl.arange(0, COUNT_P)
+ used = r < COUNT
+ top = tl.where(used, (top_key >> 32).to(tl.int32).to(tl.float32, bitcast=True), 0.0)
+ tl.store(ranked_ptr + b * COUNT + r, N_P - 1 - (top_key & 0xFFFFFFFF), mask=used)
+ tl.store(cum_ptr + b * (COUNT + 1), root_score)
+ tl.store(cum_ptr + b * (COUNT + 1) + 1 + r, root_score + tl.cumsum(top, axis=0), mask=used)
+
+
+def tree_rank(tree, bs: int, depth: int, count: int, root_score: float) -> Tuple[torch.Tensor, torch.Tensor]:
+ """:meth:`DraftTree.rank` in one launch (``count`` at most the tree's node count)."""
+ n = tree.shape.num_nodes(depth)
+ ranked = torch.empty(bs, count, dtype=torch.int64, device=tree.scores.device)
+ cum = torch.empty(bs, count + 1, dtype=torch.float32, device=tree.scores.device)
+ _tree_rank_kernel[(bs,)](
+ tree.scores,
+ tree.decay,
+ ranked,
+ cum,
+ tree.scores.stride(0),
+ root_score,
+ N=n,
+ N_P=triton.next_power_of_2(n),
+ COUNT=count,
+ COUNT_P=max(triton.next_power_of_2(count), 2),
+ num_warps=4,
+ )
+ return ranked, cum
+
+
+def _tree_select_kernel(
+ chosen_ptr, # [bs, M] int64 node indices
+ tokens_ptr, # [bs, capacity] int64 node tokens
+ index_ptr, # [bs, M] int64 out, the nodes ascending
+ draft_ptr, # [bs, M] int64 out, their tokens
+ chosen_stride,
+ tokens_stride,
+ M: tl.constexpr,
+ M_P: tl.constexpr,
+):
+ b = tl.program_id(0).to(tl.int64)
+ i = tl.arange(0, M_P)
+ used = i < M
+ node = tl.sort(tl.load(chosen_ptr + b * chosen_stride + i, mask=used, other=2147483647)) # padding sorts last
+ tl.store(index_ptr + b * M + i, node, mask=used)
+ tl.store(draft_ptr + b * M + i, tl.load(tokens_ptr + b * tokens_stride + node, mask=used, other=0), mask=used)
+
+
+def tree_select(chosen: torch.Tensor, tokens: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
+ """The nodes ``chosen`` ``[bs, M]`` sorted ascending and their tokens, in one launch."""
+ bs, m = chosen.shape
+ index = torch.empty(bs, m, dtype=torch.int64, device=chosen.device)
+ draft = torch.empty_like(index)
+ if m:
+ _tree_select_kernel[(bs,)](
+ chosen,
+ tokens,
+ index,
+ draft,
+ chosen.stride(0),
+ tokens.stride(0),
+ M=m,
+ M_P=max(triton.next_power_of_2(m), 2),
+ num_warps=1,
+ )
+ return index, draft
+
+
+def _select_rows_kernel(
+ scores,
+ decay,
+ tokens,
+ parents,
+ out_tokens,
+ out_parent_rows,
+ row_of,
+ stride_scores,
+ stride_tokens,
+ stride_parents,
+ count,
+ NODES: tl.constexpr,
+ N_BLOCK: tl.constexpr,
+ K: tl.constexpr,
+):
+ b = tl.program_id(0)
+ node = tl.arange(0, N_BLOCK)
+ valid = node < NODES
+ s = tl.load(scores + b * stride_scores + node, mask=valid, other=0.0) * tl.load(decay + node, mask=valid, other=0.0)
+ s = tl.where(valid, s, -1.0)
+ threshold = tl.sum(tl.where(node == count - 1, tl.sort(s, descending=True), 0.0))
+ greater = s > threshold
+ tied = s == threshold # the lowest-numbered tied nodes fill the set, as torch.topk does
+ need = count - tl.sum(greater.to(tl.int32))
+ chosen = greater | (tied & (tl.cumsum(tied.to(tl.int32), 0) <= need))
+ row = tl.cumsum(chosen.to(tl.int32), 0) - 1 # rows in node order: a parent before its children
+ tl.store(out_tokens + b * count + row, tl.load(tokens + b * stride_tokens + node, mask=chosen), mask=chosen)
+ tl.store(row_of + b * N_BLOCK + node, tl.where(chosen, row, -1))
+ tl.debug_barrier()
+ # parent node: depth 1 hangs from the root; a node of layer L >= 1 from frontier entry ``local // K`` of layer L - 1
+ rel = node - K
+ layer = 1 + rel // (K * K)
+ base = tl.where(layer == 1, 1, K + 1 + (layer - 2) * K)
+ column = base + (rel % (K * K)) // K
+ inner = chosen & (node >= K)
+ parent = tl.load(parents + b * stride_parents + column, mask=inner, other=-1)
+ parent_row = tl.load(row_of + b * N_BLOCK + parent, mask=inner & (parent >= 0), other=-1)
+ tl.store(out_parent_rows + b * (count + 1) + 1 + row, tl.where(parent_row >= 0, parent_row + 1, 0), mask=chosen)
+ tl.store(out_parent_rows + b * (count + 1), -1)
+
+
+def select_rows(
+ scores: torch.Tensor,
+ decay: torch.Tensor,
+ tokens: torch.Tensor,
+ parents: torch.Tensor,
+ count: int,
+ top_k: int,
+ row_of: torch.Tensor,
+) -> tuple[torch.Tensor, torch.Tensor]:
+ """The ``count`` best nodes by decayed score as verify rows, in node order: ``(tokens [bs, count] int64,
+ parent_rows [bs, count + 1] int32)`` with row 0 the root (-1) and 0 for a node whose parent is the root or not
+ chosen. ``scores`` / ``tokens`` ``[bs, nodes]``, ``parents`` the tree's frontier list, ``row_of`` int32 scratch
+ ``[>= bs, next_power_of_2(nodes)]``. Ties at the last row go to the lowest node number."""
+ bs, nodes = scores.shape
+ out_tokens = torch.empty(bs, count, dtype=torch.int64, device=scores.device)
+ out_parent_rows = torch.empty(bs, count + 1, dtype=torch.int32, device=scores.device)
+ n_block = triton.next_power_of_2(nodes)
+ assert row_of.shape[1] == n_block and row_of.is_contiguous()
+ _select_rows_kernel[(bs,)](
+ scores,
+ decay,
+ tokens,
+ parents,
+ out_tokens,
+ out_parent_rows,
+ row_of,
+ scores.stride(0),
+ tokens.stride(0),
+ parents.stride(0),
+ count,
+ NODES=nodes,
+ N_BLOCK=n_block,
+ K=top_k,
+ )
+ return out_tokens, out_parent_rows
diff --git a/eagle_harness/kernels/verify_prep.py b/eagle_harness/kernels/verify_prep.py
new file mode 100644
index 0000000..33daa27
--- /dev/null
+++ b/eagle_harness/kernels/verify_prep.py
@@ -0,0 +1,45 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""One launch that writes a tree verify's tail-mask words (batch size 1).
+
+The tail mask is the part of a tree verify's mask that is not "everything
+before the tree is visible": one 64-bit word per query row, bit ``j`` set when
+the row sees tree key ``j``. The words come from the verify input's flattened
+``[width, kv_len]`` bool mask. The committed length is read on the device, so
+the launch can sit inside the CUDA graph that builds the verify input.
+"""
+
+from __future__ import annotations
+
+import torch
+import triton
+import triton.language as tl
+
+MAX_TAIL_WIDTH = 64 # one uint64 per row
+
+
+def _tail_words_kernel(mask_ptr, committed_len_ptr, tail_bits_ptr, width, WIDTH_P2: tl.constexpr):
+ kv_len = tl.load(committed_len_ptr).to(tl.int64) + width
+ rows = tl.arange(0, WIDTH_P2)
+ cols = tl.arange(0, WIDTH_P2)
+ visible = tl.load(
+ mask_ptr + rows[:, None] * kv_len + (kv_len - width) + cols[None, :],
+ mask=(rows[:, None] < width) & (cols[None, :] < width),
+ other=0,
+ )
+ bits = tl.sum(visible.to(tl.int64) << cols[None, :].to(tl.int64), axis=1)
+ tl.store(tail_bits_ptr + rows, bits, mask=rows < width)
+
+
+def tree_tail_words(mask: torch.Tensor, committed_len: torch.Tensor, tail_bits: torch.Tensor, width: int) -> None:
+ """Write ``tail_bits[:width]`` (int64), the tail-mask words of one request's verify of ``width`` tokens
+ after ``committed_len`` KV slots, read from ``mask`` (its flattened ``[width, kv_len]`` mask, bool or
+ uint8). ``committed_len`` is a one-element device tensor, so the launch can be captured in a CUDA graph;
+ ``width`` is a host value."""
+ if not 0 < width <= MAX_TAIL_WIDTH:
+ raise ValueError(f"verify width {width} outside 1..{MAX_TAIL_WIDTH}")
+ _tail_words_kernel[(1,)](
+ mask.view(torch.uint8), committed_len, tail_bits, width, WIDTH_P2=triton.next_power_of_2(width)
+ )
diff --git a/eagle_harness/models/__init__.py b/eagle_harness/models/__init__.py
new file mode 100644
index 0000000..ba8471a
--- /dev/null
+++ b/eagle_harness/models/__init__.py
@@ -0,0 +1,7 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 draft model pieces that do not depend on an engine (config checks, the low-rank head).
+
+The engine draft models live in ``eagle_harness.sglang.models`` and ``eagle_harness.vllm.models``.
+"""
diff --git a/eagle_harness/models/eagle4_config.py b/eagle_harness/models/eagle4_config.py
new file mode 100644
index 0000000..fcfa632
--- /dev/null
+++ b/eagle_harness/models/eagle4_config.py
@@ -0,0 +1,284 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 draft config validation and sliding-window resolution.
+
+Checks supported keys and structural constraints in a transformers config.
+Pure Python: no engine, no GPU.
+
+Sliding-window semantics, as trained: at draft depth d a query attends to at
+most W context keys ending at it plus the d draft tokens of its own chain.
+Activation: an explicit ``layer_types`` wins, then ``use_sliding_window``, and
+a positive ``sliding_window`` alone enables the window. Single-layer drafts only.
+"""
+
+from __future__ import annotations
+
+from numbers import Integral
+from typing import Mapping, Optional
+
+from eagle_harness.models.eagle4_structure import LATENT_MOE_ARCHITECTURE, draft_moe_architecture, draft_uses_rope
+
+EAGLE4_ARCH = "LlamaForCausalLMEagle4"
+LAYER_TYPES = ("full_attention", "sliding_attention")
+
+
+def resolve_draft_sliding_window(config) -> Optional[int]:
+ """Return the sliding window of an EAGLE4 draft config, or None.
+
+ Non-EAGLE4 configs always return None. Invalid window settings raise.
+ """
+ architectures = getattr(config, "architectures", None) or ()
+ if EAGLE4_ARCH not in architectures:
+ return None
+
+ window = getattr(config, "sliding_window", None)
+ if window is not None:
+ if isinstance(window, bool) or not isinstance(window, Integral) or window < 1:
+ raise ValueError(f"EAGLE4 draft sliding_window must be a positive integer, got {window!r}.")
+ window = int(window)
+
+ enabled = getattr(config, "use_sliding_window", None)
+ if enabled is not None and not isinstance(enabled, bool):
+ raise ValueError(f"EAGLE4 draft use_sliding_window must be a boolean, got {enabled!r}.")
+
+ num_layers = getattr(config, "num_hidden_layers", None)
+ layer_types = getattr(config, "layer_types", None)
+ if layer_types is not None:
+ if not isinstance(layer_types, (list, tuple)) or len(layer_types) != num_layers:
+ raise ValueError(
+ "EAGLE4 draft layer_types must list one entry per draft layer, got "
+ f"{layer_types!r} for num_hidden_layers={num_layers}."
+ )
+ unknown = [kind for kind in layer_types if kind not in LAYER_TYPES]
+ if unknown:
+ raise ValueError(f"EAGLE4 draft layer_types supports only {list(LAYER_TYPES)}, got {unknown!r}.")
+ if "sliding_attention" in layer_types and window is None:
+ raise ValueError("EAGLE4 draft layer_types has sliding_attention but no positive sliding_window.")
+ enabled = layer_types[0] == "sliding_attention"
+ elif enabled is None:
+ enabled = window is not None
+ if enabled and window is None:
+ raise ValueError("EAGLE4 draft use_sliding_window requires a positive sliding_window.")
+ if not enabled:
+ return None
+ if num_layers != 1:
+ raise ValueError(f"EAGLE4 sliding-window drafts must have num_hidden_layers=1, got {num_layers}.")
+ return window
+
+
+# Config keys an EAGLE4 draft may carry on top of the standard LlamaConfig
+# attributes. Every key that selects draft structure is read by this file (or
+# by the EAGLE workers); anything outside both sets fails construction, so a
+# new draft structure cannot be dropped silently.
+_STRUCTURAL_KEYS = frozenset(
+ {
+ # aux-hidden-state input
+ "draft_vocab_size",
+ "target_hidden_size",
+ "num_aux_hidden_states",
+ "eagle_config",
+ "share_draft_embedding_from_target",
+ "fc_norm",
+ "enable_fc_norm",
+ "bias",
+ # layer-0 input fusion
+ "input_fuse_type",
+ "attn_norm",
+ # attention
+ "use_rope",
+ "position_embedding_type",
+ "partial_rotary_factor",
+ "rope_is_neox_style",
+ "sliding_window",
+ "use_sliding_window",
+ "layer_types",
+ # output norms
+ "norm_output",
+ "enable_post_mlp_norm",
+ # MoE
+ "enable_moe",
+ "moe_architecture",
+ "n_routed_experts",
+ "num_experts_per_tok",
+ "moe_intermediate_size",
+ "n_shared_experts",
+ "moe_shared_expert_intermediate_size",
+ "moe_latent_size",
+ "n_group",
+ "topk_group",
+ "norm_topk_prob",
+ "routed_scaling_factor",
+ "scoring_func",
+ "topk_method",
+ "expert_bias_update_rate",
+ "moe_router_bias_update_rate",
+ # candidate lm_head
+ "efficient_lm_head_config",
+ # retired structures, accepted only when off
+ "enable_2hs",
+ "enable_defa",
+ }
+)
+# Hyperparameters and provenance keys: no effect on the served structure.
+# rope_interleave / max_window_layers / moe_router_dtype are copied from the
+# target config and do not change the draft structure.
+_NON_STRUCTURAL_KEYS = frozenset(
+ {
+ "_torchspec_version",
+ "load_balance_loss_alpha",
+ "seq_aux_loss_alpha",
+ "aux_loss_alpha",
+ "moe_seq_aux_loss_coeff",
+ "expert_parallel_size",
+ "moe_expert_parallel_size",
+ "moe_initialization",
+ "moe_mtp_layer_index",
+ "moe_mtp_source_revision",
+ "moe_router_dtype",
+ "rope_interleave",
+ "max_window_layers",
+ "quantization_config",
+ }
+)
+# Attributes sglang's ModelConfig sets on every hf_config.
+_RUNTIME_KEYS = frozenset({"context_len", "encoder_only", "language_only", "language_model_only"})
+# ModelConfig also fills these in from head_dim. The draft attention uses
+# head_dim for q, k and v, so a config may carry them only at that value.
+_DERIVED_HEAD_DIM_KEYS = frozenset({"v_head_dim", "swa_head_dim", "swa_v_head_dim"})
+_DENSE_MOE_ARCHITECTURES = ("sparse_swiglu",)
+_EFFICIENT_LM_HEAD_KEYS = frozenset({"type", "rank", "num_candidates", "smooth_factor"})
+
+
+def _expect(config, name: str, allowed: tuple) -> None:
+ """If the config sets ``name``, its value must be one of ``allowed``."""
+ if not hasattr(config, name):
+ return
+ value = getattr(config, name)
+ # `is` for booleans: 1 == True must not pass as a boolean flag.
+ if isinstance(value, bool) or any(isinstance(a, bool) for a in allowed):
+ ok = any(value is a for a in allowed)
+ else:
+ ok = value in allowed
+ if not ok:
+ raise ValueError(f"EAGLE4 draft config {name}={value!r} is not supported (expected one of {list(allowed)}).")
+
+
+def validate_eagle4_draft_config(config) -> None:
+ """Refuse EAGLE4 draft configs whose structure this model does not build."""
+ standard = set(type(config)().to_dict())
+ keys = set(config.to_dict()) - standard - _RUNTIME_KEYS - _DERIVED_HEAD_DIM_KEYS
+ unknown = sorted(keys - _STRUCTURAL_KEYS - _NON_STRUCTURAL_KEYS)
+ if unknown:
+ raise ValueError(
+ f"EAGLE4 draft config has keys this model does not implement: {unknown}. "
+ "A key that changes the draft structure needs support in "
+ "models/llama_eagle4.py; a non-structural key goes into its "
+ "_NON_STRUCTURAL_KEYS."
+ )
+ head_dim = getattr(config, "head_dim", None) or (config.hidden_size // config.num_attention_heads)
+ for name in sorted(_DERIVED_HEAD_DIM_KEYS):
+ value = getattr(config, name, None)
+ if value and value != head_dim:
+ raise ValueError(
+ f"EAGLE4 draft config {name}={value} differs from head_dim={head_dim}; "
+ "the draft attention uses one head dim for q, k and v."
+ )
+
+ for name in (
+ "fc_norm",
+ "enable_fc_norm",
+ "attn_norm",
+ "use_rope",
+ "norm_output",
+ "enable_post_mlp_norm",
+ "enable_moe",
+ "share_draft_embedding_from_target",
+ "norm_topk_prob",
+ ):
+ _expect(config, name, (True, False))
+ for name in ("bias", "attention_bias", "mlp_bias", "enable_2hs", "enable_defa"):
+ _expect(config, name, (False,))
+ _expect(config, "rope_is_neox_style", (True,))
+ _expect(config, "partial_rotary_factor", (None, 0, 1))
+ _expect(config, "input_fuse_type", ("concat",))
+ _expect(config, "num_aux_hidden_states", (3,))
+ _expect(config, "moe_architecture", _DENSE_MOE_ARCHITECTURES + (LATENT_MOE_ARCHITECTURE,))
+
+ eagle_config = getattr(config, "eagle_config", None) or {}
+ extra = set(eagle_config) - {"use_aux_hidden_state", "eagle_aux_hidden_state_layer_ids"}
+ layer_ids = eagle_config.get("eagle_aux_hidden_state_layer_ids")
+ if extra or (layer_ids is not None and len(layer_ids) != 3):
+ raise ValueError(
+ f"EAGLE4 draft eagle_config={eagle_config!r} is not supported: the fc "
+ "input takes exactly three aux hidden states."
+ )
+
+ head = getattr(config, "efficient_lm_head_config", None)
+ if head is not None and (
+ not isinstance(head, dict)
+ or head.get("type") not in ("low_rank", "weighted_low_rank")
+ or set(head) - _EFFICIENT_LM_HEAD_KEYS
+ ):
+ raise ValueError(f"EAGLE4 draft efficient_lm_head_config={head!r} is not supported.")
+
+ moe_architecture = draft_moe_architecture(config)
+ latent_moe = moe_architecture == LATENT_MOE_ARCHITECTURE
+ _expect(config, "hidden_act", ("relu2",) if latent_moe else ("silu",))
+ if moe_architecture is not None:
+ # The served routers are sigmoid over bias-corrected scores.
+ _expect(config, "scoring_func", ("sigmoid",))
+ _expect(config, "topk_method", ("noaux_tc",))
+ if latent_moe:
+ # The engine block reads its expert count, top-k and widths from the checkpoint (no harness knob).
+ required = ["n_routed_experts", "num_experts_per_tok", "moe_intermediate_size", "moe_latent_size"]
+ if getattr(config, "n_shared_experts", 0):
+ required.append("moe_shared_expert_intermediate_size")
+ missing = [name for name in required if not getattr(config, name, None)]
+ if missing:
+ raise ValueError(f"EAGLE4 latent MoE draft config is missing {missing}.")
+
+ single_layer_only = {
+ "sliding window": resolve_draft_sliding_window(config) is not None,
+ "attn_norm": getattr(config, "attn_norm", False),
+ "NoPE": not draft_uses_rope(config),
+ "latent MoE": latent_moe,
+ }
+ used = [name for name, on in single_layer_only.items() if on]
+ if used and config.num_hidden_layers != 1:
+ raise ValueError(
+ f"EAGLE4 draft structures {used} are implemented for single-layer "
+ f"drafts, got num_hidden_layers={config.num_hidden_layers}."
+ )
+
+
+# Structures the config validator accepts that an adapter does not build unless it passes its own set
+# (sglang builds attn_norm, NoPE and the latent MoE; vLLM builds dense one-layer drafts with rotary positions).
+# All ports are one-layer drafts with the low-rank candidate head.
+UNPORTED = {
+ "enable_moe": True,
+ "attn_norm": True,
+ "enable_post_mlp_norm": True,
+ "use_rope": False,
+ "position_embedding_type": "none",
+ "partial_rotary_factor": 0,
+}
+
+
+def check_ported(config, unported: Mapping[str, object] = UNPORTED) -> None:
+ """Validate the config and refuse draft structures the adapters do not build.
+
+ ``unported`` maps a config key to the value that is not built.
+ """
+ validate_eagle4_draft_config(config)
+ used = [f"{key}={value!r}" for key, value in unported.items() if getattr(config, key, None) == value]
+ if used:
+ raise NotImplementedError(
+ f"EAGLE-4 drafts with {used} are not ported to eagle-harness yet (dense drafts only)."
+ )
+ if config.num_hidden_layers != 1:
+ raise NotImplementedError(f"EAGLE-4 drafts with {config.num_hidden_layers} layers are not ported (1 only).")
+ if getattr(config, "efficient_lm_head_config", None) is None:
+ raise NotImplementedError("EAGLE-4 drafts without efficient_lm_head_config are not ported.")
+ if (getattr(config, "draft_vocab_size", None) or config.vocab_size) != config.vocab_size:
+ raise NotImplementedError("EAGLE-4 drafts with a reduced vocab (d2t) are not ported.")
diff --git a/eagle_harness/models/eagle4_structure.py b/eagle_harness/models/eagle4_structure.py
new file mode 100644
index 0000000..92d4ff3
--- /dev/null
+++ b/eagle_harness/models/eagle4_structure.py
@@ -0,0 +1,58 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 structure decisions and config preparation, independent of engines and torch."""
+
+from __future__ import annotations
+
+import copy
+from typing import Any
+
+LATENT_MOE_ARCHITECTURE = "nemotron_latent_relu2"
+
+
+def draft_moe_architecture(config: Any) -> str | None:
+ """Return the enabled draft MoE architecture, or None for a dense draft."""
+ if not getattr(config, "enable_moe", False):
+ return None
+ return getattr(config, "moe_architecture", "sparse_swiglu")
+
+
+def draft_uses_rope(config: Any) -> bool:
+ """RoPE is off if any of the checkpoint's three position settings disables it."""
+ return not (
+ getattr(config, "use_rope", True) is False
+ or getattr(config, "position_embedding_type", None) == "none"
+ or getattr(config, "partial_rotary_factor", None) == 0
+ )
+
+
+def base_layer_overrides(config: Any) -> dict[str, Any]:
+ """Temporary settings for a Llama base layer whose MLP or RoPE will be replaced.
+
+ Apply to a copy, or restore after construction. NoPE needs only a one-position
+ placeholder because engines retain rotary tables in process-wide caches.
+ """
+ overrides = {}
+ if draft_moe_architecture(config) == LATENT_MOE_ARCHITECTURE:
+ overrides["hidden_act"] = "silu"
+ if not draft_uses_rope(config):
+ overrides["max_position_embeddings"] = 1
+ return overrides
+
+
+def latent_moe_config(config: Any) -> Any:
+ """Shallow-copy a validated latent-MoE draft config with the engine block's defaults.
+
+ Preserve the config type and checkpoint fields; module construction and
+ parallelism checks belong to the engine adapter.
+ """
+ moe = copy.copy(config)
+ moe.mlp_hidden_act = config.hidden_act
+ moe.mlp_bias = False
+ moe.n_shared_experts = int(getattr(config, "n_shared_experts", 0) or 0)
+ moe.n_group = int(getattr(config, "n_group", 1) or 1)
+ moe.topk_group = int(getattr(config, "topk_group", moe.n_group) or moe.n_group)
+ moe.norm_topk_prob = bool(getattr(config, "norm_topk_prob", True))
+ moe.routed_scaling_factor = float(getattr(config, "routed_scaling_factor", 1.0))
+ return moe
diff --git a/eagle_harness/models/low_rank_head.py b/eagle_harness/models/low_rank_head.py
new file mode 100644
index 0000000..361e666
--- /dev/null
+++ b/eagle_harness/models/low_rank_head.py
@@ -0,0 +1,98 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 efficient (low-rank) LM head: factors from the full LM head by SVD.
+
+The draft scores the vocab with ``scores @ down_proj`` (rank r), takes the
+top candidates and re-scores only those with the full head.
+"""
+
+from __future__ import annotations
+
+import logging
+import os
+from dataclasses import dataclass
+from typing import Optional
+
+import numpy as np
+import torch
+
+logger = logging.getLogger(__name__)
+
+
+@dataclass(frozen=True)
+class LowRankFactors:
+ """Factors of a low-rank LM head: ``scores @ down_proj(hidden)`` approximates the full logits."""
+
+ down_proj: torch.Tensor # [rank, hidden]: weight of nn.Linear(hidden, rank)
+ scores: torch.Tensor # [vocab (shard), rank]
+ energy_retention: float
+
+
+def low_rank_scores(
+ hidden: torch.Tensor, down_proj: torch.Tensor, score_head: torch.Tensor, vocab_rows: int
+) -> torch.Tensor:
+ """``[rows, shard vocab]`` rank-r scores of one vocab shard (``down_proj`` [rank, H], ``score_head`` [shard vocab,
+ rank]), ``-inf`` past the shard's ``vocab_rows`` real rows."""
+ low_rank = hidden @ down_proj.t()
+ scores = low_rank.to(score_head.dtype) @ score_head.t()
+ if scores.shape[-1] > vocab_rows:
+ scores[:, vocab_rows:] = float("-inf")
+ return scores
+
+
+def load_token_frequency(model_dir: str, vocab_size: int) -> torch.Tensor:
+ """Per-token counts (``token_frequency.npy`` or raw int64 ``.bin``) as float32 [vocab]."""
+ npy_path = os.path.join(model_dir, "token_frequency.npy")
+ bin_path = os.path.join(model_dir, "token_frequency.bin")
+ if os.path.exists(npy_path):
+ freq, src = np.load(npy_path), npy_path
+ elif os.path.exists(bin_path):
+ freq, src = np.fromfile(bin_path, dtype=np.int64), bin_path
+ else:
+ raise FileNotFoundError(
+ f"weighted_low_rank lm_head needs {npy_path} or {bin_path}: int64 per-token counts of a reference corpus."
+ )
+ freq = torch.from_numpy(np.ascontiguousarray(freq)).flatten()
+ if freq.shape[0] != vocab_size:
+ raise ValueError(f"token_frequency length {freq.shape[0]} != vocab_size {vocab_size} ({src}).")
+ logger.info("Loaded token frequency from %s", src)
+ return freq.to(dtype=torch.float32)
+
+
+def low_rank_factors(
+ weight: torch.Tensor,
+ rank: int,
+ *,
+ token_frequency: Optional[torch.Tensor] = None,
+ smooth_factor: float = 10,
+ shard: Optional[tuple] = None,
+) -> LowRankFactors:
+ """SVD factors of an LM head (or its TP vocab shard).
+
+ With ``token_frequency`` (full vocab) the SVD is frequency weighted:
+ ``D^(1/2) W`` with ``D = freq / mean(freq) + smooth_factor``, so frequent
+ tokens keep more energy; the row weighting is undone in ``scores`` so
+ ``scores @ down_proj`` still approximates ``W``. ``shard`` is the
+ ``(org_vocab_start, org_vocab_end)`` of a TP vocab shard; its padding rows
+ get the smoothing floor.
+ """
+ w = weight.to(dtype=torch.float32, copy=True)
+ sqrt_freq = None
+ if token_frequency is not None:
+ freq = token_frequency.to(device=w.device, dtype=torch.float32)
+ freq = freq / freq.mean() + smooth_factor
+ if freq.shape[0] != w.shape[0]:
+ start, end = shard if shard is not None else (0, w.shape[0])
+ rows = freq[start:end]
+ freq = torch.full((w.shape[0],), float(smooth_factor), device=w.device, dtype=torch.float32)
+ freq[: rows.shape[0]] = rows
+ sqrt_freq = torch.sqrt(freq).unsqueeze(1)
+ w = w * sqrt_freq
+ u, s, vh = torch.linalg.svd(w, full_matrices=False)
+ scores = u[:, :rank] * s[:rank]
+ if sqrt_freq is not None:
+ scores = scores / sqrt_freq
+ energy = float((s[:rank] ** 2).sum() / (s**2).sum())
+ logger.info("Low-rank LM head: rank=%d, energy retention=%.4f", rank, energy)
+ return LowRankFactors(down_proj=vh[:rank, :], scores=scores, energy_retention=energy)
diff --git a/eagle_harness/sglang/__init__.py b/eagle_harness/sglang/__init__.py
new file mode 100644
index 0000000..dcb08f5
--- /dev/null
+++ b/eagle_harness/sglang/__init__.py
@@ -0,0 +1,7 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""sglang integration: algorithm registration, workers, draft steps.
+
+Importing this package imports sglang. Entry point: ``plugin.register``.
+"""
diff --git a/eagle_harness/sglang/algorithm.py b/eagle_harness/sglang/algorithm.py
new file mode 100644
index 0000000..2e468bd
--- /dev/null
+++ b/eagle_harness/sglang/algorithm.py
@@ -0,0 +1,246 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The EAGLE_HARNESS speculative algorithm as sglang sees it.
+
+Registered by :func:`eagle_harness.sglang.plugin.register` through
+``SpeculativeAlgorithm.register`` with ``supports_overlap=True``. Both overlap
+and synchronous scheduling use sglang's V2 speculative schema.
+
+It reports ``is_eagle()``, the documented way for a plugin to join sglang's
+EAGLE-family branches (the draft gets its own KV pool and the target
+embedding, the relay carries the draft top-k), and ``uses_aux_hidden_states()``,
+so the target captures the draft's aux hidden states without the other
+EAGLE-3 branches. Hooks of branch ``eagle-hooks`` it implements:
+
+- H2 ``supports_mm_inputs``: text only (sglang's ``validate_request`` refuses multimodal requests).
+- H7 ``create_decode_graph_variants``: one target-verify graph per verify
+ width (at batch size 1 also the greedy graphs, whose
+ forward returns the rows' tokens: ``SpecInput.greedy_tokens_only``), with the
+ tree-tail mask attention at batch size 1 (``SpecInput.flashinfer_verify_variant``).
+ The algorithm keeps the provider (:attr:`EagleHarnessSpecAlgo.target_verify_graphs`)
+ for the drafter, which writes the tail masks.
+- H10 ``create_linear_attn_verify_extension``: GDN / Mamba2 tree verify kernels on the target.
+- H5 ``req_to_token_extra_len``: block-table headroom for draft / verify slots.
+- H11 ``speculative_algorithm_config``: parsed into :class:`HarnessConfig`.
+
+Decode preparation (KV slots for the rounds' draft / verify tokens) is sglang's
+EAGLE preparation, which allocates them in chunks.
+"""
+
+from __future__ import annotations
+
+import json
+import logging
+import os
+from functools import cached_property
+from typing import TYPE_CHECKING, Optional
+
+from sglang.srt.runtime_context import get_spec
+from sglang.srt.speculative.spec_registry import CustomSpecAlgo
+
+from eagle_harness.core.config import HarnessConfig, Mode, config_to_dict, parse_harness_config
+from eagle_harness.core.cost_profiles import packaged_cost_profile
+from eagle_harness.core.gemm_solutions import AITER_GEMM_TABLE, AITER_GEMM_TABLE_ENV, serve_bf16_gemms_through_torch
+from eagle_harness.core.limits import ComputeIntensity, check_shape, req_to_token_span
+from eagle_harness.kernels import arch
+
+if TYPE_CHECKING:
+ from sglang.srt.layers.attention.linear.verify_extension import LinearAttnVerifyExtension
+ from sglang.srt.model_executor.runner.decode_graph_variants import DecodeGraphRunnerInfo
+ from sglang.srt.server_args import ServerArgs
+
+ from eagle_harness.sglang.verify_graphs import VerifyWidthGraphs
+
+logger = logging.getLogger(__name__)
+
+ALGORITHM_NAME = "EAGLE_HARNESS"
+# The draft attention backends the harness plans tree attention for.
+DRAFT_ATTENTION_BACKENDS = ("flashinfer", "fa3", "fa4")
+# sglang's ROCm switches the measured AMD recipe depends on (read by sglang at import, never set here; the harness sets
+# only aiter's GEMM table, eagle_harness.core.gemm_solutions.serve_bf16_gemms_through_torch).
+ROCM_ENVIRONMENT = {
+ "SGLANG_USE_AITER": ("0", "aiter kernels for the GEMMs, norms, RoPE and the aiter attention backend"),
+ "SGLANG_SPLITKV_VERIFY_FLYDSL": ("1", "FlyDSL prefix stage of the split-KV tree verify (faster from batch 4)"),
+ "SGLANG_SPLITKV_VERIFY_FLYDSL_COMBINE": ("1", "FlyDSL combine stage of the split-KV tree verify (<= 16 tokens)"),
+}
+
+
+def _check_rocm_environment(server_args: "ServerArgs") -> None:
+ """On AMD, log the effective sglang ROCm switches the AMD recipe depends on and warn about the ones that make
+ the measured configuration: an aiter target backend without SGLANG_USE_AITER runs torch GEMMs and norms."""
+ g = arch.gpu()
+ if g is None or g.nvidia:
+ return
+ effective = {name: os.environ.get(name, default) for name, (default, _) in ROCM_ENVIRONMENT.items()}
+ logger.info(
+ "EAGLE_HARNESS on %s: %s",
+ g.name,
+ ", ".join(f"{name}={value} ({ROCM_ENVIRONMENT[name][1]})" for name, value in effective.items()),
+ )
+ if server_args.attention_backend == "aiter" and effective["SGLANG_USE_AITER"] != "1":
+ logger.warning(
+ "EAGLE_HARNESS: --attention-backend aiter without SGLANG_USE_AITER=1; the measured MI355X recipe sets it "
+ "(sglang then also routes GEMMs, norms and RoPE through aiter)."
+ )
+
+
+def harness_config() -> HarnessConfig:
+ """The harness config of this process (``--speculative-algorithm-config``)."""
+ return parse_harness_config(get_spec().speculative_algorithm_config)
+
+
+def harness_mode() -> Mode:
+ """The harness mode of this process."""
+ return harness_config().mode
+
+
+class EagleHarnessSpecAlgo(CustomSpecAlgo):
+ """Algorithm-level hooks. One instance per process (the registry's)."""
+
+ # The target's per-width verify graphs (H7), once sglang asked for them; None without target CUDA graphs.
+ target_verify_graphs: Optional["VerifyWidthGraphs"] = None
+
+ @cached_property
+ def config(self) -> HarnessConfig:
+ """This process's harness config (``--speculative-algorithm-config``)."""
+ return parse_harness_config(get_spec().speculative_algorithm_config)
+
+ # ---- EAGLE-family membership (draft KV pool, top-k relay) and aux hidden capture
+ def is_eagle(self) -> bool:
+ """Member of the EAGLE family (draft KV pool, target embedding, top-k relay)."""
+ return True
+
+ def is_eagle3(self) -> bool:
+ """Use native learned-head initialization and checkpoint token maps."""
+ return True
+
+ def uses_aux_hidden_states(self) -> bool:
+ """The target captures the aux hidden states the EAGLE-4 draft reads (its ``eagle_config`` layers)."""
+ return True
+
+ # ---- H2: request admission
+ def supports_mm_inputs(self) -> bool:
+ """The draft embeds text tokens only."""
+ # The draft embeds text tokens only.
+ return False
+
+ # ---- H7: per-width target-verify graphs
+ def create_decode_graph_variants(self, info: "DecodeGraphRunnerInfo") -> Optional["VerifyWidthGraphs"]:
+ """H7: one target-verify graph per verify width (and per tree width the greedy graph of a
+ batch-size-1 round) on the target runner, kept as :attr:`target_verify_graphs`."""
+ if info.is_draft_worker:
+ return None
+ from eagle_harness.sglang.verify_graphs import VerifyWidthGraphs
+ from eagle_harness.sglang.verify_plan import TreeTailMask
+
+ max_width = get_spec().speculative_num_draft_tokens
+ from eagle_harness.core.chain_width import load_round_times
+
+ rounds = (
+ load_round_times(self.config.data_path)
+ if self.config.mode is Mode.SERVE and self.config.data_path else None
+ )
+ plain = get_spec().speculative_eagle_topk == 1 and (
+ self.config.mode is Mode.CALIBRATE or any(0 in row for row in (rounds or {}).values())
+ )
+ self.target_verify_graphs = VerifyWidthGraphs(
+ self.config.intensity, max_width, TreeTailMask(info.device), plain_decode=plain
+ )
+ return self.target_verify_graphs
+
+ # ---- H10: GDN / Mamba2 tree verify on hybrid targets
+ def create_linear_attn_verify_extension(self, state) -> Optional[LinearAttnVerifyExtension]:
+ """H10: the tree verify of a hybrid target's GDN or Mamba2 layers."""
+ # An sglang whose layout has no ``kind`` asks GDN backends only.
+ if getattr(state, "kind", "gdn") == "mamba2":
+ from eagle_harness.sglang.mamba2_tree_verify import Mamba2TreeVerify
+
+ return Mamba2TreeVerify.create(state)
+ from eagle_harness.sglang.gdn_tree_verify import GDNTreeVerify
+
+ return GDNTreeVerify.create(state)
+
+ # ---- H5: block-table headroom
+ def req_to_token_extra_len(self, page_size: int) -> int:
+ """H5: block-table headroom for the largest tree."""
+ spec = get_spec()
+ return req_to_token_span(
+ spec.speculative_eagle_topk or 1,
+ spec.speculative_num_steps or 1,
+ spec.speculative_num_draft_tokens or 1,
+ page_size,
+ )
+
+ # ---- H11 + server-argument resolution
+ def handle_server_args(self, server_args: "ServerArgs") -> None:
+ """Parse the harness config and apply what the harness needs from sglang.
+
+ Runs during argument resolution, on a stand-in whose writes sglang
+ records as this algorithm's resolutions.
+ """
+ gpu = arch.gpu()
+ if gpu is not None: # a launcher without a GPU resolves the config too
+ arch.require_supported() # the kernels cover NVIDIA sm_80+ and AMD CDNA2-4: refuse with the reason
+ default_data_path = None
+ if gpu is not None and not gpu.nvidia:
+ default_data_path = packaged_cost_profile(
+ device_name=gpu.name,
+ model_path=server_args.model_path,
+ draft_model_path=server_args.speculative_draft_model_path,
+ tp_size=server_args.tp_size,
+ dtype=server_args.dtype,
+ quantization=server_args.quantization,
+ )
+ config = parse_harness_config(server_args.speculative_algorithm_config, default_data_path=default_data_path)
+ if default_data_path is not None and config.data_path == default_data_path:
+ # Every spawned worker must see the same resolved path, without an environment overlay.
+ server_args.speculative_algorithm_config = json.dumps(config_to_dict(config))
+ logger.info("EAGLE_HARNESS: selected packaged MI355X cost profile %s", default_data_path)
+ if server_args.speculative_num_steps is None or server_args.speculative_eagle_topk is None:
+ raise ValueError(
+ "EAGLE_HARNESS needs --speculative-num-steps, --speculative-eagle-topk and "
+ "--speculative-num-draft-tokens (the maximum tree shape)."
+ )
+ if server_args.speculative_num_draft_tokens is None:
+ raise ValueError("EAGLE_HARNESS needs --speculative-num-draft-tokens (the maximum verify width).")
+ if server_args.pp_size > 1:
+ raise NotImplementedError("pp_size > 1 is not supported for EAGLE_HARNESS.")
+ if server_args.speculative_token_map is not None:
+ raise NotImplementedError(
+ "--speculative-token-map does not apply: EAGLE-4 drafts score the full vocabulary."
+ )
+ if server_args.speculative_adaptive:
+ raise NotImplementedError("--speculative-adaptive does not apply: the cost model picks every round's tree.")
+ if server_args.scheduler_recv_interval <= 1:
+ server_args.scheduler_recv_interval = 4
+ if server_args.enable_mixed_chunk:
+ server_args.enable_mixed_chunk = False
+ logger.warning("Mixed chunked prefill is disabled: EAGLE_HARNESS does not take mixed steps.")
+ if server_args.max_running_requests is None:
+ # Keep the memory-conservative default separate from the supported batch limit.
+ server_args.max_running_requests = 48 if config.intensity is ComputeIntensity.CHAIN else 32
+ topk = server_args.speculative_eagle_topk
+ check_shape(
+ config.intensity,
+ topk,
+ server_args.speculative_num_steps,
+ server_args.speculative_num_draft_tokens,
+ server_args.max_running_requests,
+ )
+ draft_backend = server_args.speculative_draft_attention_backend or server_args.attention_backend
+ if (
+ server_args.page_size is not None
+ and server_args.page_size > 1
+ and draft_backend not in DRAFT_ATTENTION_BACKENDS
+ ):
+ raise NotImplementedError(
+ "page_size > 1 needs --speculative-draft-attention-backend flashinfer, fa3 or fa4 for EAGLE_HARNESS."
+ )
+ if server_args.attention_backend == "trtllm_mha" and topk > 1:
+ raise NotImplementedError("A trtllm_mha target verifies causally only; use a chain (topk 1).")
+ if serve_bf16_gemms_through_torch():
+ logger.info(
+ "EAGLE_HARNESS: %s=%s (every bf16 GEMM on torch, repeatable)", AITER_GEMM_TABLE_ENV, AITER_GEMM_TABLE
+ )
+ _check_rocm_environment(server_args)
diff --git a/eagle_harness/sglang/calibrate.py b/eagle_harness/sglang/calibrate.py
new file mode 100644
index 0000000..a246d3f
--- /dev/null
+++ b/eagle_harness/sglang/calibrate.py
@@ -0,0 +1,134 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Chain calibration on sglang from served rounds: forced widths while real requests run, then the widths per batch size.
+
+usage: python -m eagle_harness.sglang.calibrate measure --port P --data question_multiturn.jsonl --tokenizer MODEL
+ [--concurrency 1,8,64,256] [--max-new-tokens 512]
+ python -m eagle_harness.sglang.calibrate report <data_path> [--max-width 8] [--max-batch-size 256]
+
+``measure`` drives a running server started in the calibration mode::
+
+ python -m sglang.launch_server ... --speculative-algorithm EAGLE_HARNESS --speculative-eagle-topk 1 \\
+ --speculative-num-steps 7 --speculative-num-draft-tokens 8 --max-running-requests 256 \\
+ --speculative-algorithm-config '{"mode": "calibrate", "intensity": "chain_intensity", "data_path": "<dir>"}'
+
+The server forces every chain width up to ``--speculative-num-draft-tokens`` in turn, then native decode (width 0),
+and records the
+period of each decode round per batch size and width, plus the accept lengths of the widest rounds
+(:mod:`eagle_harness.sglang.chain_rounds`). ``measure`` sends, per concurrency level, one batch of that many greedy
+requests (SPEED-Bench first turns, ``ignore_eos`` so the batch stays full) and then one single-token request, whose
+prefill makes the server write what it recorded: the raw rounds, ``<data_path>/rounds/chain.json`` and
+``accept/chain.json``. A serve-mode chain server with
+that ``data_path`` reads them. ``report`` prints the round times per batch size and width, the acceptance profile and
+the widths per batch size that server will use (:func:`eagle_harness.core.chain_width.chain_widths`).
+
+After native decode begins, requests stay OFF until completion because their draft KV is stale. A prefill resets
+the calibration sequence for fresh requests. The runtime requires DP1 and disabled Mamba prefix-cache tracking.
+
+These are served-path timings on purpose: the period of a served round holds the scheduler, the draft extend and the
+launches, which isolated forward timings miss.
+"""
+
+from __future__ import annotations
+
+import argparse
+import concurrent.futures
+import json
+import os
+import sys
+import time
+from collections import defaultdict
+from collections.abc import Sequence
+
+from eagle_harness.core.chain_width import chain_widths, load_accept_profile
+from eagle_harness.sglang.chain_rounds import MIN_ROUNDS, RAW_FILE, round_cells
+
+
+def first_turns(path: str) -> list[str]:
+ """The first user turns of a SPEED-Bench file, round robin over its categories."""
+ by_category: dict[str, list[str]] = defaultdict(list)
+ with open(path, encoding="utf-8") as f:
+ for line in f:
+ row = json.loads(line)
+ by_category[row["category"]].append(row["turns"][0])
+ turns: list[str] = []
+ for i in range(max(len(v) for v in by_category.values())):
+ turns += [by_category[c][i] for c in sorted(by_category) if i < len(by_category[c])]
+ return turns
+
+
+def measure(port: int, data: str, tokenizer_path: str, levels: Sequence[int], max_new_tokens: int) -> None:
+ """One batch of ``c`` concurrent greedy requests per level, each followed by a flushing prefill."""
+ import requests
+ from transformers import AutoTokenizer
+
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
+ turns = first_turns(data)
+ base = f"http://127.0.0.1:{port}"
+
+ def prompt(i: int) -> list[int]:
+ messages = [{"role": "user", "content": turns[i % len(turns)]}]
+ text = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
+ return tokenizer.encode(text, add_special_tokens=False)
+
+ def generate(input_ids: list[int], new_tokens: int) -> int:
+ params = {"temperature": 0, "max_new_tokens": new_tokens, "ignore_eos": True}
+ reply = requests.post(
+ f"{base}/generate", json={"input_ids": input_ids, "sampling_params": params}, timeout=7200
+ )
+ reply.raise_for_status()
+ return len(reply.json()["output_ids"])
+
+ for c in levels:
+ inputs = [prompt(i) for i in range(c)]
+ start = time.time()
+ with concurrent.futures.ThreadPoolExecutor(c) as pool:
+ tokens = sum(pool.map(lambda ids: generate(ids, max_new_tokens), inputs))
+ wall = time.time() - start
+ generate(prompt(0), 1) # its prefill writes the rounds recorded so far
+ print(f"C{c}: {tokens} tokens in {wall:.1f} s ({tokens / wall:.0f} tok/s, widths mixed)", flush=True)
+
+
+def report(data_path: str, max_width: int, max_batch_size: int) -> None:
+ """Print the round times, the acceptance profile and the widths per batch size a serve-mode server will use."""
+ with open(os.path.join(data_path, RAW_FILE), encoding="utf-8") as f:
+ raw = json.load(f)
+ cells = round_cells(raw["rounds"], raw["widths"])
+ profile = load_accept_profile(data_path)
+ if not cells or profile is None:
+ raise SystemExit(f"no batch size timed every width {raw['widths']} at least {MIN_ROUNDS} times, or no profile")
+ print(f"acceptance at width {raw['max_width']}: " + " ".join(f"{r:.3f}" for r in profile.rates))
+ print("batch size: width median round ms (rounds) tokens per request per s")
+ for bs, row in cells.items():
+ parts = [
+ f"w{w} {us / 1000:.2f} ({n}) {profile.expected_tokens(max(1, w)) / us * 1e6:.0f}"
+ for w, (us, n) in row.items()
+ ]
+ print(f" bs {bs}: " + ", ".join(parts))
+ print(f"chain widths per batch size: {chain_widths(data_path, max_width, max_batch_size, allow_no_spec=True)}")
+
+
+def main(argv: list[str]) -> None:
+ parser = argparse.ArgumentParser(description="Chain calibration on sglang from served rounds.")
+ sub = parser.add_subparsers(dest="command", required=True)
+ m = sub.add_parser("measure")
+ m.add_argument("--port", type=int, required=True)
+ m.add_argument("--data", required=True, help="SPEED-Bench question_multiturn.jsonl")
+ m.add_argument("--tokenizer", required=True)
+ m.add_argument("--concurrency", default="1,8,64,256", help="comma-separated concurrency levels")
+ m.add_argument("--max-new-tokens", type=int, default=512)
+ r = sub.add_parser("report")
+ r.add_argument("data_path")
+ r.add_argument("--max-width", type=int, default=8, help="the server's --speculative-num-draft-tokens")
+ r.add_argument("--max-batch-size", type=int, default=256, help="the server's --max-running-requests")
+ args = parser.parse_args(argv)
+ if args.command == "measure":
+ levels = [int(x) for x in args.concurrency.split(",")]
+ measure(args.port, args.data, args.tokenizer, levels, args.max_new_tokens)
+ else:
+ report(args.data_path, args.max_width, args.max_batch_size)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/eagle_harness/sglang/candidate_logits.py b/eagle_harness/sglang/candidate_logits.py
new file mode 100644
index 0000000..18c0671
--- /dev/null
+++ b/eagle_harness/sglang/candidate_logits.py
@@ -0,0 +1,98 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 candidate LM head (low-rank scores, exact re-scoring of the top candidates).
+
+Per TP vocab shard:
+
+1. ``scores = (hidden @ down_proj.T) @ score_head_shard.T`` (rank-r estimate)
+2. ``local = topk(scores, C, sorted=False)`` (this shard's candidates)
+3. ``logits = lm_head_shard[local] . hidden`` (exact, fp32 accumulate)
+4. all-gather the ``C`` logits and global ids of every rank, keep the top ``C``.
+
+sglang's EAGLE workers sample and take the top-k over a full-vocab logits row,
+so :class:`CandidateLogitsProcessor` returns ``[rows, vocab]`` fp32 logits that
+are ``-inf`` outside the candidates; a softmax over that row equals the softmax
+over the ``C`` candidates.
+"""
+
+from __future__ import annotations
+
+from typing import Callable, NamedTuple, Optional
+
+import torch
+
+from eagle_harness.kernels.gather_dot import gather_dot
+from eagle_harness.models.low_rank_head import low_rank_scores
+
+AllGather = Callable[[torch.Tensor], torch.Tensor] # [rows, n] -> [rows, tp * n], rank-major
+
+
+class Candidates(NamedTuple):
+ """Per-row candidate logits and their global vocab ids."""
+
+ logits: torch.Tensor # [rows, C] fp32
+ token_ids: torch.Tensor # [rows, C] int64, global vocab ids
+
+
+def shard_candidates(
+ hidden: torch.Tensor,
+ down_proj: torch.Tensor,
+ score_head: torch.Tensor,
+ lm_head: torch.Tensor,
+ *,
+ num_candidates: int,
+ vocab_start: int,
+ vocab_rows: int,
+) -> Candidates:
+ """Steps 1-3 on one vocab shard. ``vocab_rows``: real (unpadded) rows of the shard."""
+ scores = low_rank_scores(hidden, down_proj, score_head, vocab_rows)
+ _, local_ids = torch.topk(scores, num_candidates, dim=-1, sorted=False)
+ logits = gather_dot(lm_head, local_ids, hidden)
+ return Candidates(logits=logits, token_ids=local_ids + vocab_start)
+
+
+def merge_candidates(shard: Candidates, num_candidates: int, all_gather: Optional[AllGather]) -> Candidates:
+ """Step 4: the top ``num_candidates`` over every rank's candidates (fp32 out)."""
+ if all_gather is None:
+ return Candidates(shard.logits.float(), shard.token_ids)
+ logits = all_gather(shard.logits)
+ token_ids = all_gather(shard.token_ids)
+ logits, pick = torch.topk(logits, num_candidates, dim=-1, sorted=False)
+ return Candidates(logits.float(), torch.gather(token_ids, -1, pick))
+
+
+def scatter_to_vocab(candidates: Candidates, vocab_size: int) -> torch.Tensor:
+ """``[rows, vocab_size]`` fp32 logits, ``-inf`` outside the candidates."""
+ rows = candidates.logits.shape[0]
+ full = candidates.logits.new_full((rows, vocab_size), float("-inf"))
+ full.scatter_(1, candidates.token_ids, candidates.logits)
+ return full
+
+
+def build_candidate_logits_processor(config, candidate_fn: Callable[[torch.Tensor], Candidates]):
+ """An sglang ``LogitsProcessor`` whose LM head is the candidate head.
+
+ ``candidate_fn(hidden) -> Candidates`` runs steps 1-4 (it owns the weights).
+ Built lazily so this module imports without sglang.
+ """
+ from sglang.srt.layers.logits_processor import LogitsProcessor
+
+ class CandidateLogitsProcessor(LogitsProcessor):
+ """``LogitsProcessor`` that scatters the candidate head's logits into a full-vocab row."""
+
+ def __init__(self) -> None:
+ super().__init__(config)
+ if self.do_tensor_parallel_all_gather_dp_attn or self.use_attn_tp_group:
+ raise NotImplementedError("The EAGLE-4 candidate head supports plain TP only (no DP attention).")
+ if self.logit_scale is not None or self.final_logit_softcapping:
+ raise NotImplementedError("The EAGLE-4 candidate head has no logit scale or softcapping.")
+ self._candidate_fn = candidate_fn
+
+ def _get_logits(self, hidden_states, lm_head, logits_metadata, embedding_bias=None, use_logits_buffer=True):
+ if embedding_bias is not None:
+ raise NotImplementedError("The EAGLE-4 candidate head takes no embedding bias.")
+ logits = scatter_to_vocab(self._candidate_fn(hidden_states), self.vocab_size)
+ return self._copy_logits_to_buffer(logits, logits_metadata, use_buffer=use_logits_buffer)
+
+ return CandidateLogitsProcessor()
diff --git a/eagle_harness/sglang/chain_rounds.py b/eagle_harness/sglang/chain_rounds.py
new file mode 100644
index 0000000..662aa4b
--- /dev/null
+++ b/eagle_harness/sglang/chain_rounds.py
@@ -0,0 +1,195 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Fixed-width chain rounds: the served width per batch size, and the calibration that times it.
+
+A chain (``--speculative-eagle-topk 1``, ``chain_intensity``) with served round times and an acceptance profile
+under ``data_path`` verifies a fixed width per batch size (:func:`eagle_harness.core.chain_width.chain_widths`),
+width 0 (native decode without draft extend) where speculation loses. ``"mode": "calibrate"`` measures that choice
+while real requests are served: it forces every chain width the target has a verify graph for, in blocks of
+:data:`BLOCK_ROUNDS` rounds, and records
+
+- the period between consecutive decode rounds at the same batch size (wall clock, so the scheduler, the draft
+ extend and the launches are in it), per batch size and width;
+- the accept lengths of the widest rounds, per request (a histogram kept on the GPU, read when the file is written).
+
+A round is recorded only between two decode rounds of the same batch size and width, so the first and last round
+of a block (whose periods hold another width's prelaunched draft) and the rounds next to a prefill are not.
+
+Rank 0 writes what it has every :data:`FLUSH_ROUNDS` rounds and at the next prefill: the raw rounds
+(``<data_path>/raw/sglang_rounds.json``), the median period of every batch size that timed each width at least
+:data:`MIN_ROUNDS` times (``rounds/chain.json``) and the acceptance profile (``accept/chain.json``), the two files a
+serve-mode chain server with the same ``data_path`` reads.
+"""
+
+from __future__ import annotations
+
+import json
+import os
+import statistics
+import time
+from collections import defaultdict
+from collections.abc import Callable
+from typing import TYPE_CHECKING, Dict, List, Sequence, Tuple
+
+import torch
+
+from eagle_harness.core.chain_width import save_accept_profile, save_round_times, width_at
+
+if TYPE_CHECKING:
+ from sglang.srt.managers.schedule_batch import ScheduleBatch
+
+BLOCK_ROUNDS = 8
+FLUSH_ROUNDS = 256
+MIN_ROUNDS = 8
+RAW_FILE = os.path.join("raw", "sglang_rounds.json")
+
+
+def round_cells(
+ rounds: Sequence[Sequence[float]], widths: Sequence[int], min_rounds: int = MIN_ROUNDS
+) -> Dict[int, Dict[int, Tuple[float, int]]]:
+ """``{batch size: {width: (median period us, rounds)}}`` of the batch sizes that timed every one of ``widths`` at
+ least ``min_rounds`` times."""
+ periods: Dict[Tuple[int, int], List[float]] = defaultdict(list)
+ for bs, width, us, _context in rounds:
+ periods[(int(bs), int(width))].append(us)
+ cells: Dict[int, Dict[int, Tuple[float, int]]] = defaultdict(dict)
+ for (bs, width), values in periods.items():
+ if len(values) >= min_rounds:
+ cells[bs][width] = (statistics.median(values), len(values))
+ return {bs: dict(sorted(row.items())) for bs, row in sorted(cells.items()) if set(row) == set(widths)}
+
+
+def accept_counts(accept_lens: Sequence[int]) -> Tuple[int, List[int]]:
+ """Request-rounds and those accepting drafted token ``d`` (``d = 1 .. max``) from a histogram of accept lengths
+ (tokens committed per request and round: 1 + accepted drafts)."""
+ per_position = [sum(accept_lens[d + 1 :]) for d in range(1, len(accept_lens) - 1)]
+ return sum(accept_lens), per_position
+
+
+class ChainCalibration:
+ """The forced width of each round (``width``) and the recorder of the served rounds (``round_start``,
+ ``accepted``)."""
+
+ def __init__(
+ self, data_path: str, widths: Sequence[int], device: torch.device, *, writer: bool, native_decode: bool = False
+ ):
+ """``widths``: the chain widths to time (each has a target verify graph); ``writer``: this rank writes."""
+ self.widths = sorted(widths)
+ self.max_width = self.widths[-1]
+ self._native_decode = native_decode
+ self.last_width = self.widths[0]
+ if native_decode:
+ self.widths.append(0)
+ self._data_path = data_path
+ self._writer = writer
+ self._planned = 0 # rounds whose width was handed out
+ self._started = 0 # decode rounds started
+ # The last two decode rounds since the last other step: (bs, width, start ns, mean context).
+ self._recent: List[Tuple[int, int, int, int]] = []
+ self.rounds: List[Tuple[int, int, float, int]] = [] # (bs, width, period us, mean context)
+ self._flushed = 0 # rounds in the file
+ self._accept = torch.zeros(self.max_width + 1, dtype=torch.int64, device=device)
+
+ def width(self, bs: int) -> int:
+ """The width of the next round (one call per round, in round order)."""
+ if self._native_decode:
+ # Collect enough settled intervals in one pass, then stay OFF: its
+ # draft KV is no longer current and must not be consumed again.
+ index = min(self._planned // (BLOCK_ROUNDS + MIN_ROUNDS), len(self.widths) - 1)
+ else:
+ index = (self._planned // BLOCK_ROUNDS) % len(self.widths)
+ self.last_width = self.widths[index]
+ self._planned += 1
+ return self.last_width
+
+ def round_start(self, bs: int, width: int, context: int) -> None:
+ """A decode round of ``bs`` requests at ``width`` starts now; the previous round's period ends."""
+ now = time.perf_counter_ns()
+ recent = self._recent
+ if len(recent) == 2 and all(r[:2] == (bs, width) for r in recent):
+ self.rounds.append((bs, width, (now - recent[1][2]) / 1000.0, recent[1][3]))
+ self._recent = recent[-1:] + [(bs, width, now, context)]
+ self._started += 1
+ if self._started % FLUSH_ROUNDS == 0:
+ self.flush()
+ self._recent = [] # the write is in this round's period
+
+ def interrupt(self) -> None:
+ """A non-decode step runs: the period in progress is not a decode round's. Writes the rounds recorded since
+ the last write (a prefill after a batch, e.g. the calibration driver's next level, flushes it)."""
+ self._recent = []
+ if self._flushed != len(self.rounds):
+ self.flush()
+ if self._native_decode:
+ self._planned = 0
+ self.last_width = self.widths[0]
+
+ def accepted(self, width: int, accept_lens: torch.Tensor) -> None:
+ """Count the round's accept lengths (tokens committed per request, 1..width) when it is the widest."""
+ if width == self.max_width:
+ self._accept += torch.bincount(accept_lens.to(torch.int64), minlength=self.max_width + 1)
+
+ def flush(self) -> None:
+ """Write the raw rounds, the round times and the acceptance profile (rank 0); reads the accept histogram from
+ the GPU."""
+ self._flushed = len(self.rounds)
+ if not self._writer:
+ return
+ accept_lens = self._accept.tolist()
+ raw = {"max_width": self.max_width, "widths": self.widths, "accept_lens": accept_lens}
+ raw["rounds"] = [list(r) for r in self.rounds]
+ path = os.path.join(self._data_path, RAW_FILE)
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ with open(f"{path}.tmp", "w", encoding="utf-8") as f:
+ json.dump(raw, f)
+ os.replace(f"{path}.tmp", path)
+ cells = round_cells(self.rounds, self.widths)
+ if cells:
+ rows = [
+ {"batch_size": bs, "width": w, "round_us": us, "count": n}
+ for bs, row in cells.items()
+ for w, (us, n) in row.items()
+ ]
+ save_round_times(self._data_path, rows)
+ drafts, per_position = accept_counts(accept_lens)
+ if drafts:
+ save_accept_profile(self._data_path, drafts, per_position)
+
+
+class ChainRounds:
+ """The served/calibrated chain width and optional recording of completed rounds.
+
+ Drafting asks for ``draft_width`` once when it queues a round. Native decode
+ reads ``plain_width`` without advancing that plan, including a prelaunched
+ choice of OFF. Context is read only for calibration, without a device sync.
+ """
+
+ def __init__(
+ self,
+ schedule: Sequence[tuple[int, int, int]] | None,
+ calibration: ChainCalibration | None,
+ average_context: Callable[[ScheduleBatch], int],
+ ):
+ self._schedule = schedule
+ self._calibration = calibration
+ self._average_context = average_context
+
+ def draft_width(self, bs: int) -> int:
+ width = self._calibration.width(bs) if self._calibration is not None else width_at(self._schedule, bs)
+ return max(1, width)
+
+ def plain_width(self, bs: int) -> int:
+ return self._calibration.last_width if self._calibration is not None else width_at(self._schedule, bs)
+
+ def interrupt(self) -> None:
+ if self._calibration is not None:
+ self._calibration.interrupt()
+
+ def round_start(self, bs: int, width: int, batch: ScheduleBatch) -> None:
+ if self._calibration is not None:
+ self._calibration.round_start(bs, width, self._average_context(batch))
+
+ def accepted(self, width: int, accept_lens: torch.Tensor) -> None:
+ if self._calibration is not None:
+ self._calibration.accepted(width, accept_lens)
diff --git a/eagle_harness/sglang/draft_extend.py b/eagle_harness/sglang/draft_extend.py
new file mode 100644
index 0000000..0b26df5
--- /dev/null
+++ b/eagle_harness/sglang/draft_extend.py
@@ -0,0 +1,136 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The decode draft extend after verify, replayed as one CUDA graph per (batch size, verify width).
+
+Request ``b`` runs ``width`` (the round's verify width) causal rows at positions
+``seq_len[b] + j``: row ``j`` takes the target's accepted token ``j`` (the bonus
+token last) and the target's aux hidden state of verify row ``j``, writes the
+draft KV of its position and attends to the draft's sliding window
+(:class:`DraftRowAttention`). Rows past the round's accept length write draft
+KV beyond the committed length, which the next round overwrites. Row
+``accept_len[b] - 1`` yields the next round's depth-1 candidates (the EAGLE-4
+candidate head's top-``K``, no full-vocab softmax) and the root hidden state.
+The same graph then advances the batch staged on :class:`DraftSteps` to the
+next round (committed lengths ``seq_len + accept_len``) and seeds its tree
+(:meth:`DraftSteps.begin_body`), so the next round's draft steps follow it
+directly.
+
+The batch (``seq_lens``, ``req_pool_indices``) is the one :class:`DraftSteps`
+staged for the round's draft and verify input; the verify's results come from
+static buffers that :meth:`DraftExtend.stage` fills. The fused accept tail stages
+them inside its own graph (writing the compacted hidden states in place,
+:meth:`DraftExtend.hidden_rows`).
+
+This replaces sglang's decode draft extend (``_draft_extend_for_decode``),
+whose sliding-window FlashInfer planning syncs the host several times per
+round; the prefill draft extend stays sglang's.
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import Callable, Dict, Sequence, Tuple
+
+import torch
+
+from eagle_harness.sglang.draft_head import draft_topk
+
+from eagle_harness.sglang.draft_steps import DraftSteps, capture_graphs, forward_draft_rows
+from eagle_harness.sglang.row_attention import DraftRowAttention
+
+logger = logging.getLogger(__name__)
+
+
+class DraftExtend:
+ """Static buffers and graphs of the decode draft extend."""
+
+ def __init__(
+ self,
+ draft_runner,
+ attention: DraftRowAttention,
+ steps: DraftSteps,
+ *,
+ width: int,
+ input_hidden_size: int,
+ widths: Callable[[int], Sequence[int]],
+ ):
+ """``width``: the widest verify; ``widths(bs)``: the verify widths that get a graph at ``bs``. Outputs
+ go to the tree's root buffers and ``steps``' staged batch (this round's on entry), which the next round's
+ draft reads in place."""
+ self.model = draft_runner.model
+ self.attention = attention
+ self.steps = steps
+ self.tree = steps.tree
+ self.req_to_token = draft_runner.req_to_token_pool.req_to_token
+ self.width = width
+ self._widths = widths
+ max_bs = self.tree.max_bs
+ device = self.req_to_token.device
+ i64 = torch.int64
+ self.tokens = torch.zeros(max_bs * width, dtype=i64, device=device)
+ self.input_hidden = torch.zeros(max_bs * width, input_hidden_size, dtype=draft_runner.dtype, device=device)
+ self.accept_lens = torch.ones(max_bs, dtype=i64, device=device)
+ self.slots = torch.zeros(max_bs * width, dtype=i64, device=device)
+ self.positions = torch.zeros(max_bs * width, dtype=i64, device=device)
+ self.last = torch.zeros(max_bs, dtype=i64, device=device) # each request's row of its last accepted token
+ self._graphs: Dict[Tuple[int, int], torch.cuda.CUDAGraph] = {}
+
+ def hidden_rows(self, rows: int) -> torch.Tensor:
+ """The input hidden-state buffer of ``rows`` (= batch size x verify width) rows, to write in place."""
+ return self.input_hidden[:rows]
+
+ def stage(self, next_token_ids: torch.Tensor, input_hidden: torch.Tensor, accept_lens: torch.Tensor) -> None:
+ """Copy a round's verify results where the extend reads them (device copies, graph-capturable).
+
+ ``next_token_ids`` / ``input_hidden``: the verify's accept-compacted ``[bs * width, ...]`` outputs
+ (``input_hidden`` may already be :meth:`hidden_rows`); ``accept_lens``: ``[bs]``.
+ """
+ rows = next_token_ids.numel()
+ self.accept_lens[: accept_lens.shape[0]].copy_(accept_lens)
+ self.tokens[:rows].copy_(next_token_ids.reshape(rows))
+ hidden = input_hidden.reshape(rows, -1)
+ if hidden.data_ptr() != self.input_hidden.data_ptr():
+ self.input_hidden[:rows].copy_(hidden)
+
+ def run(self, bs: int, width: int) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
+ """Run the staged round's extend, stage the next round and seed its tree; returns views
+ ``(topk_p, topk_index, hidden)`` of ``[bs, ...]`` (valid until the next call)."""
+ graph = self._graphs.get((bs, width))
+ if graph is not None:
+ graph.replay()
+ else:
+ self._forward((bs, width))
+ tree = self.tree
+ return tree.root_probs[:bs], tree.root_tokens[:bs], tree.root_hidden[:bs]
+
+ def capture(self, batch_sizes: Sequence[int]) -> None:
+ """Capture one draft-extend graph per batch size and verify width."""
+ keys = [(bs, w) for bs in sorted(batch_sizes, reverse=True) for w in self._widths(bs) if w <= self.width]
+ self._graphs = capture_graphs(keys, self._forward)
+ logger.info("eagle-harness: captured %d draft-extend graphs", len(self._graphs))
+
+ def _forward(self, key: Tuple[int, int]) -> None:
+ bs, width = key
+ rows = bs * width
+ seq_lens = self.steps.seq_lens[:bs] # the round's committed lengths, the draft's staged batch
+ req = self.steps.req_pool_indices[:bs]
+ accept_lens = self.accept_lens[:bs]
+ slots, positions, last = self.slots[:rows], self.positions[:rows], self.last[:bs]
+ self.attention.build_extend_rows(seq_lens, req, accept_lens, slots, positions, last, bs=bs, width=width)
+ normed, hidden = forward_draft_rows(
+ self.model,
+ self.attention,
+ input_ids=self.tokens[:rows],
+ positions=positions,
+ out_cache_loc=slots,
+ hidden_states=self.input_hidden[:rows],
+ )
+ tree = self.tree
+ probs, tokens = draft_topk(self.model, normed.index_select(0, last), tree.shape.top_k)
+ tree.root_probs[:bs] = probs
+ tree.root_tokens[:bs] = tokens
+ torch.index_select(hidden, 0, last, out=tree.root_hidden[:bs])
+ # The next round: its committed lengths (same requests), then the tree's begin from the root just written.
+ seq_lens += accept_lens
+ self.steps.begin_body(bs)
diff --git a/eagle_harness/sglang/draft_head.py b/eagle_harness/sglang/draft_head.py
new file mode 100644
index 0000000..e0c05b5
--- /dev/null
+++ b/eagle_harness/sglang/draft_head.py
@@ -0,0 +1,19 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Candidate selection for native EAGLE3 and low-rank EAGLE4 heads."""
+
+import torch
+from sglang.srt.layers.logits_processor import LogitsMetadata
+from sglang.srt.model_executor.forward_batch_info import ForwardMode
+
+
+def draft_topk(model, hidden: torch.Tensor, k: int):
+ if hasattr(model, "candidate_topk"):
+ return model.candidate_topk(hidden, k)
+ output = model.logits_processor(None, hidden, model.lm_head, LogitsMetadata(forward_mode=ForwardMode.DECODE))
+ probs, tokens = torch.topk(torch.softmax(output.next_token_logits, dim=-1), k, dim=-1)
+ if model.hot_token_id is not None:
+ model.hot_token_id = model.hot_token_id.to(tokens.device)
+ tokens = model.hot_token_id[tokens]
+ return probs, tokens
diff --git a/eagle_harness/sglang/draft_steps.py b/eagle_harness/sglang/draft_steps.py
new file mode 100644
index 0000000..de386f7
--- /dev/null
+++ b/eagle_harness/sglang/draft_steps.py
@@ -0,0 +1,177 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Draft steps of a round, replayed as one CUDA graph per (batch size, step).
+
+Step 0 seeds the tree (:meth:`DraftTree.begin`). Step ``i`` runs the draft model on the depth-``i`` frontier (``K`` rows per
+request) with tree attention, takes each row's top-``K`` candidates from the
+EAGLE-4 candidate head (no full-vocab softmax), and adds the children to the
+:class:`DraftTree`. Every input lives in a static buffer (the tree's frontier,
+the batch's ``seq_lens`` / ``req_pool_indices``), so one captured graph per
+step serves every round; the host only decides whether to run the next one.
+The graphs of the cost model's launch depths also copy the step's work deltas
+to page-locked host memory, which the cost model reads one step later.
+"""
+
+from __future__ import annotations
+
+import logging
+from dataclasses import dataclass
+from typing import Callable, Dict, Sequence, Tuple, TypeVar
+
+import torch
+
+from eagle_harness.sglang.draft_head import draft_topk
+
+from sglang.srt.distributed.parallel_state import graph_capture
+from sglang.srt.model_executor.forward_batch_info import ForwardBatch, ForwardMode
+from sglang.srt.model_executor.forward_context import ForwardContext, forward_context
+
+from eagle_harness.core.draft_tree import DraftTree
+from eagle_harness.sglang.graph_pool import graph_memory_pool
+from eagle_harness.sglang.row_attention import DraftRowAttention
+
+logger = logging.getLogger(__name__)
+
+K = TypeVar("K")
+
+
+@dataclass
+class DraftRowsInput:
+ """The ``spec_info`` the EAGLE-4 draft model reads: the rows' input hidden states."""
+
+ hidden_states: torch.Tensor
+
+
+def forward_draft_rows(
+ model,
+ attention: DraftRowAttention,
+ *,
+ input_ids: torch.Tensor,
+ positions: torch.Tensor,
+ out_cache_loc: torch.Tensor,
+ hidden_states: torch.Tensor,
+) -> Tuple[torch.Tensor, torch.Tensor]:
+ """The EAGLE-4 draft layer on independent rows whose key lists ``attention`` holds.
+
+ Returns ``(normed, hidden)``: the final-norm output (candidate-head input)
+ and the hidden state the next draft forward takes as input.
+ """
+ rows = input_ids.shape[0]
+ unread = attention.unread_rows[:rows]
+ forward_batch = ForwardBatch(
+ forward_mode=ForwardMode.DECODE,
+ batch_size=rows,
+ input_ids=input_ids,
+ req_pool_indices=unread,
+ seq_lens=unread,
+ out_cache_loc=out_cache_loc.to(torch.int64),
+ seq_lens_sum=0,
+ positions=positions,
+ spec_info=DraftRowsInput(hidden_states=hidden_states),
+ )
+ with forward_context(ForwardContext(attn_backend=attention)):
+ normed, aux = model.model(input_ids, positions, forward_batch)
+ return normed, aux[0]
+
+
+def capture_graphs(keys: Sequence[K], body: Callable[[K], None]) -> Dict[K, torch.cuda.CUDAGraph]:
+ """One CUDA graph of ``body(key)`` per key, in order, in sglang's global graph memory pool."""
+ pool = graph_memory_pool()
+ graphs: Dict[K, torch.cuda.CUDAGraph] = {}
+ with graph_capture() as ctx:
+ stream = ctx.stream
+ for key in keys:
+ with torch.cuda.stream(stream):
+ for _ in range(2): # warm up (Triton compiles, allocator settles)
+ body(key)
+ stream.synchronize()
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph, pool=pool, stream=stream):
+ body(key)
+ graphs[key] = graph
+ torch.cuda.synchronize()
+ return graphs
+
+
+class DraftSteps:
+ """Owns the per-step graphs of the draft tree."""
+
+ def __init__(self, draft_runner, tree: DraftTree, attention: DraftRowAttention):
+ self.runner = draft_runner
+ self.model = draft_runner.model
+ self.tree = tree
+ self.attention = attention
+ self.req_to_token = draft_runner.req_to_token_pool.req_to_token
+ device = tree.scores.device
+ self.seq_lens = torch.zeros(tree.max_bs, dtype=torch.int64, device=device)
+ self.req_pool_indices = torch.zeros(tree.max_bs, dtype=torch.int64, device=device)
+ rows = tree.max_bs * tree.shape.top_k
+ self.slots = torch.zeros(rows, dtype=torch.int64, device=device) # the step's draft KV slots, one per row
+ self.positions = torch.zeros(rows, dtype=torch.int64, device=device)
+ # Host mirror of tree.deltas, written by the graphs of the tree's delta slots (0: begin, d: step d).
+ self.host_deltas = torch.zeros(tree.deltas.shape, dtype=torch.float32, pin_memory=True)
+ self._graphs: Dict[Tuple[int, int], torch.cuda.CUDAGraph] = {}
+
+ @property
+ def max_step(self) -> int:
+ """Deepest draft step of the tree."""
+ return self.tree.shape.max_depth - 1
+
+ def load_batch(self, bs: int, seq_lens: torch.Tensor, req_pool_indices: torch.Tensor) -> None:
+ """Stage the round's batch into the static buffers."""
+ self.seq_lens[:bs].copy_(seq_lens, non_blocking=True)
+ self.req_pool_indices[:bs].copy_(req_pool_indices, non_blocking=True)
+
+ def begin(self, bs: int, probs: torch.Tensor, tokens: torch.Tensor, hidden: torch.Tensor) -> None:
+ """Seed the round's tree from the draft extend's top-``K`` and hidden state."""
+ self.tree.stage_root(bs, probs, tokens, hidden)
+ self.run(bs, 0)
+
+ def begin_body(self, bs: int) -> None:
+ """:meth:`begin`'s device work on the root buffers (the tree's begin and its work deltas), for a
+ caller's own graph."""
+ self._body((bs, 0))
+
+ def run(self, bs: int, step: int) -> None:
+ """Replay draft step ``step`` (0: :meth:`DraftTree.begin`)."""
+ graph = self._graphs.get((bs, step))
+ if graph is not None:
+ graph.replay()
+ else:
+ self._body((bs, step))
+
+ def capture(self, batch_sizes: Sequence[int]) -> None:
+ """Capture begin and every step for each batch size (largest first)."""
+ keys = [(bs, step) for bs in sorted(batch_sizes, reverse=True) for step in range(self.max_step, -1, -1)]
+ self._graphs = capture_graphs(keys, self._body)
+ logger.info("eagle-harness: captured %d draft-step graphs (bs %s)", len(self._graphs), sorted(batch_sizes))
+
+ # ------------------------------------------------------------------ body
+ def _body(self, key: Tuple[int, int]) -> None:
+ bs, step = key
+ if step == 0:
+ self.tree.begin(bs)
+ else:
+ self._step(bs, step)
+ if step in self.tree.delta_slots:
+ self.host_deltas[step].copy_(self.tree.deltas[step], non_blocking=True)
+
+ def _step(self, bs: int, step: int) -> None:
+ tree = self.tree
+ k = tree.shape.top_k
+ rows = bs * k
+ seq_lens = self.seq_lens[:bs]
+ req = self.req_pool_indices[:bs]
+ slots, positions = self.slots[:rows], self.positions[:rows]
+ self.attention.build_tree_rows(tree.ancestors[:bs], seq_lens, req, slots, positions, bs=bs, step=step)
+ normed, hidden = forward_draft_rows(
+ self.model,
+ self.attention,
+ input_ids=tree.front_tokens[:rows],
+ positions=positions,
+ out_cache_loc=slots,
+ hidden_states=tree.front_hidden[:rows],
+ )
+ probs, tokens = draft_topk(self.model, normed, k)
+ tree.step(bs, step, probs, tokens, hidden)
diff --git a/eagle_harness/sglang/drafter.py b/eagle_harness/sglang/drafter.py
new file mode 100644
index 0000000..6362112
--- /dev/null
+++ b/eagle_harness/sglang/drafter.py
@@ -0,0 +1,598 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Cost-model-driven draft of one decode round in serve mode.
+
+``DynamicDrafter.draft(batch)`` grows the draft tree one graph-replayed step at
+a time, asks the cost model after each step whether another level pays for its
+draft cost, picks the verify width from the lagged verify scores, and returns
+sglang's ``EagleVerifyInput`` for the best ``width - 1`` nodes plus the root.
+
+Host syncs per round: the work deltas of every second depth (the lagged
+width decision: launched at an even depth, read one step later while the next
+step runs) and nothing else; the verify scores the width decision reads are
+the previous round's, copied asynchronously. With the width known before the
+ranking, one graph ranks the tree, copies the scores out and builds the verify
+input, including the verify tokens' KV slots and, at batch size 1, the verify
+attention's tail-mask words (:mod:`.verify_plan`). The draft steps before the first
+decision can be queued ahead, at the end of the previous round
+(:meth:`DynamicDrafter.prelaunch`).
+
+A chain with a width per batch size (``chain_width``: the served chain widths, or the calibration's forced
+widths) asks the cost model nothing: a round of width ``w`` drafts ``w - 1`` tokens (the draft extend's top token,
+then ``w - 2`` draft steps, all queued ahead by the prelaunch) and verifies them with the root; width 1 drafts nothing and verifies the root alone (plain
+decoding; the draft extend still runs, so the draft stays current).
+"""
+
+from __future__ import annotations
+
+import copy
+from dataclasses import dataclass
+import logging
+from types import SimpleNamespace
+from typing import TYPE_CHECKING, Callable, Iterable, List, NamedTuple, Optional, Sequence, Tuple
+
+import torch
+
+from sglang.srt.managers.utils import GenerationBatchResult
+from sglang.srt.model_executor.forward_batch_info import ForwardMode
+from sglang.srt.speculative.eagle_worker_common import build_eagle_verify_input
+
+from eagle_harness.core.cost_model import CostModel, DraftCostRow, FixedShapePolicy, WidthStep
+from eagle_harness.core.cost_table import cost_model_problem
+from eagle_harness.core.draft_tree import DraftTree, VerifySelection
+from eagle_harness.core.live_costs import DRAFT_WIDTH, LiveCosts
+from eagle_harness.kernels import arch
+from eagle_harness.sglang.draft_steps import DraftSteps
+from eagle_harness.sglang.verify_input import HarnessVerifyInput, build_attn_args
+from eagle_harness.sglang.verify_tail import VerifyTail
+from eagle_harness.sglang.verify_graphs import round_up_width
+
+if TYPE_CHECKING:
+ from sglang.srt.managers.schedule_batch import ScheduleBatch
+ from sglang.srt.speculative.eagle_info import EagleVerifyInput
+
+logger = logging.getLogger(__name__)
+
+# Served rounds between two refreshes of the live cost tables (and their TP broadcast); the cache file is
+# rewritten every 16th refresh and when a bucket's seed sweep completes.
+LIVE_REFRESH_ROUNDS = 64
+LIVE_SAVE_REFRESHES = 16
+
+
+def spin_wait(event: torch.cuda.Event) -> None:
+ """Wait for ``event`` by polling it. A blocking ``Event.synchronize()`` returns well after the event
+ completes on these hosts, and every round waits on the GPU a few times."""
+ while not event.query():
+ pass
+
+
+class RoundTimer:
+ """CUDA-event spans of served work (the draft steps of a round, its verify), fed to :class:`LiveCosts`.
+
+ A span is two timing events on one stream around the work; :meth:`drain` reads the completed ones. The
+ draft-step spans are taken only while a bucket seeds (its steps run back to back then, so the span is the
+ graphs' time); the verify span is taken every round.
+ """
+
+ def __init__(self, live: LiveCosts):
+ self.live = live
+ self._pending: List[Tuple[torch.cuda.Event, torch.cuda.Event, int, int, int, int]] = []
+
+ @staticmethod
+ def start() -> torch.cuda.Event:
+ """Record the span's start on the current stream."""
+ event = torch.cuda.Event(enable_timing=True)
+ event.record()
+ return event
+
+ def stop(self, start: torch.cuda.Event, bucket: int, width: int, context: int, count: int = 1) -> None:
+ """Record the span's end; ``count`` work units share the span (steps of a draft)."""
+ end = torch.cuda.Event(enable_timing=True)
+ end.record()
+ self._pending.append((start, end, bucket, width, context, count))
+
+ def drain(self, *, wait: bool) -> None:
+ """Feed the completed spans to the live costs; ``wait`` blocks for the rest (seed rounds, so every
+ TP rank records the same rounds and their cells agree)."""
+ left = []
+ for span in self._pending:
+ start, end, bucket, width, context, count = span
+ if wait:
+ end.synchronize()
+ elif not end.query():
+ left.append(span)
+ continue
+ self.live.record(bucket, width, context, 1000.0 * start.elapsed_time(end) / count)
+ self._pending = left
+
+
+class _HostCopy:
+ """A device vector copied to page-locked host memory behind one event."""
+
+ def __init__(self, numel: int):
+ self.host = torch.zeros(numel, dtype=torch.float32, pin_memory=True)
+ self._values = self.host.numpy()
+ self.event = torch.cuda.Event()
+ self.size = 0
+
+ def launch(self, values: torch.Tensor) -> None:
+ """Copy ``values`` to pinned host memory without waiting; record the event ``read`` waits on."""
+ self.copy(values)
+ self.queued(values.numel())
+
+ def copy(self, values: torch.Tensor) -> None:
+ """The device-to-host copy alone (graph-capturable)."""
+ self.host[: values.numel()].copy_(values, non_blocking=True)
+
+ def queued(self, size: int) -> None:
+ """A copy of ``size`` values was queued on the current stream; record the event ``read`` waits on."""
+ self.size = size
+ self.event.record()
+
+ def read(self) -> List[float]:
+ """Wait for the copy and return the values."""
+ spin_wait(self.event)
+ return self._values[: self.size].tolist()
+
+
+@dataclass(kw_only=True)
+class PrelaunchResult(GenerationBatchResult):
+ """Fence scheduler GPU mutations after copying this round's independent outputs.
+
+ The non-overlap scheduler copies sequence lengths and then calls ``copy_to_cpu``
+ before filtering roots or reusing request slots. Its host wait on ``copy_done``
+ must not include the next draft; its subsequent GPU work must include it.
+ """
+
+ prelaunch_done: torch.cuda.Event
+
+ def copy_to_cpu(self, return_logprob: bool, return_hidden_states: bool = True):
+ super().copy_to_cpu(return_logprob, return_hidden_states)
+ torch.cuda.current_stream().wait_event(self.prelaunch_done)
+
+
+class Prelaunch(NamedTuple):
+ """A next-round draft extend and draft queued by :meth:`DynamicDrafter.prelaunch`."""
+
+ key: Tuple[int, ...] # batch_key of the batch it was queued for
+ next_depth: int # the first depth the round still has to decide at (a fixed-width chain: its depth)
+ width: int # a fixed-width chain's verify width for the round, 0 otherwise
+ stream: torch.cuda.Stream # the stream it was queued on
+
+
+def batch_key(batch: "ScheduleBatch") -> Tuple[int, ...]:
+ """The requests' block-table rows, in batch order: equal keys draft the same requests."""
+ return tuple(req.kv.req_pool_idx for req in batch.reqs)
+
+
+def fit_width(width: int, widths: Sequence[int], available: int) -> int:
+ """The captured verify width for a requested ``width`` with ``available`` tree tokens (root included):
+ the smallest captured width ``>= width`` if the tree fills it, else the widest one it fills."""
+ up = round_up_width(width, widths)
+ if up <= available:
+ return up
+ return max(w for w in widths if w <= available)
+
+
+def _round_input(verify_input: "EagleVerifyInput", batch: "ScheduleBatch") -> "EagleVerifyInput":
+ """This round's copy of a graph's verify input: the graph's is reused every round, and sglang sets per-round
+ fields on the copy."""
+ verify_input = copy.copy(verify_input)
+ if verify_input.prepared_mrope_positions is not None and any(mm is not None for mm in batch.multimodal_inputs):
+ verify_input.prepared_mrope_positions = None # sglang adds the requests' mrope deltas
+ return verify_input
+
+
+class DynamicDrafter:
+ """Owns the round's tree, its step graphs and the round policy.
+
+ The policy of a round is the cost model with its tables (offline ``data_path`` tables, or the live tables
+ once the batch bucket is seeded), else the fixed shape (``mode: static``, and the live seed sweep, which
+ forces each captured verify width for a few rounds).
+ """
+
+ def __init__(
+ self,
+ steps: DraftSteps,
+ cost_model: Optional[CostModel],
+ *,
+ fixed: FixedShapePolicy,
+ build_trivial_input: Callable[["ScheduleBatch"], "EagleVerifyInput"],
+ target_worker,
+ algorithm,
+ widths: Callable[[int], Sequence[int]],
+ tree_mask_mode,
+ device: torch.device,
+ chain_width: Optional[Callable[[int], int]] = None,
+ live: Optional[LiveCosts] = None,
+ bucket: Callable[[int], int] = lambda bs: bs,
+ sync_cells: Optional[Callable[[dict], dict]] = None,
+ save_cells: Optional[Callable[[], None]] = None,
+ ):
+ """``chain_width(bs)``: the verify width of the next round of a chain at batch size ``bs`` (called once per
+ round, when its first step is queued); None: the cost model sizes every round."""
+ tree = steps.tree
+ policies = [p for p in (cost_model, fixed) if p is not None]
+ missing = set().union(*(set(p.launch_depths) for p in policies)) - tree.delta_slots
+ need = max(p.max_history_verify_num for p in policies)
+ if tree.max_verify < need or missing:
+ raise ValueError(
+ f"draft tree keeps work deltas for budgets 1..{tree.max_verify} at depths {sorted(tree.delta_slots)}; "
+ f"the cost model reads budgets up to {need} at depths "
+ f"{sorted(set().union(*(set(p.launch_depths) for p in policies)))}"
+ )
+ self.steps = steps
+ self.tree: DraftTree = tree
+ self.cost = cost_model
+ self.fixed = fixed
+ self.live = live
+ self.timer = None if live is None else RoundTimer(live)
+ self._bucket = bucket
+ self._sync_cells = sync_cells
+ self._save_cells = save_cells
+ self._rounds = 0
+ self._seeding: Optional[Tuple[int, int]] = None # (bucket, context) of a seed round's draft steps
+ self._unpriced: set = set() # buckets whose live costs the cost model rejects (it keeps the fixed shape)
+ self._trivial = build_trivial_input
+ self._target_worker = target_worker
+ # The process's EAGLE_HARNESS algorithm: its target verify graphs (H7) own the batch-size-1 tail mask.
+ self._algorithm = algorithm
+ self._widths = widths
+ self._tree_mask_mode = tree_mask_mode
+ self._device = device
+ self._chain_width = chain_width
+ self._deltas_ready = torch.cuda.Event()
+ self._deltas_slot = 0
+ self._verify_scores = _HostCopy(need + 1)
+ self._have_lagged = False
+ self._pending: Optional[Prelaunch] = None
+ self._bonus: Optional[torch.Tensor] = None
+ self._slot_offsets = torch.arange(max(widths(1)), dtype=torch.int64, device=device)
+ runner = target_worker.model_runner
+ # The verify-input graph also builds what sglang's verify prep derives from the input on the host: the
+ # target's mrope positions and, at batch size 1 over untranslated KV ids, the attention's CSR args.
+ self._mrope = runner.model_config.model_is_mrope
+ translator = runner.kv_index_translator
+ self._req_to_token = None if translator.reads_are_translated else translator.req_to_token
+ self._kv_indices = (
+ None
+ if self._req_to_token is None
+ else torch.empty(self._req_to_token.shape[1], dtype=torch.int32, device=device)
+ )
+ self.tail = VerifyTail(tree, self._build_verify_input)
+ self._prelaunch_stream: Optional[torch.cuda.Stream] = None
+ self.last_depth = 0
+ self.last_width = 0
+
+ # ----------------------------------------------------------------- policy
+ def bucket(self, bs: int) -> int:
+ """The cost bucket (captured batch size) a batch of ``bs`` requests runs at."""
+ return self._bucket(bs)
+
+ def policy(self, bs: int):
+ """This round's policy for ``bs`` requests: the cost model, or the fixed shape (static mode, or the live
+ seed sweep of an unseeded bucket, whose forced width it sets)."""
+ if self.cost is None:
+ return self.fixed
+ if self.live is None:
+ return self.cost
+ bucket = self._bucket(bs)
+ if self.live.ready(bucket) and bucket in self.cost.tables and bucket not in self._unpriced:
+ return self.cost
+ self.fixed.force_width = self.live.seed_width(bucket)
+ return self.fixed
+
+ def _begin_round(self, batch: "ScheduleBatch") -> None:
+ """Read the last rounds' timings; refresh (and share) the live tables on the refresh rounds."""
+ if self.live is None:
+ return
+ bs = len(batch.reqs)
+ bucket = self._bucket(bs)
+ seeding = not self.live.ready(bucket)
+ self.timer.drain(wait=seeding)
+ self._rounds += 1
+ ready = self.live.ready(bucket)
+ # Table refreshes happen on the same rounds on every TP rank (round count and seed state agree), from
+ # rank 0's cells, so the ranks' decisions agree.
+ if (ready and (seeding or self._rounds == 1)) or self._rounds % LIVE_REFRESH_ROUNDS == 0:
+ if self._sync_cells is not None:
+ self.live.cells = self._sync_cells(self.live.cells)
+ self.cost.set_tables(self.live.tables())
+ for measured_bucket in self.cost.tables:
+ self._check_priced(measured_bucket)
+ if self._save_cells is not None and (seeding or self._rounds % (LIVE_REFRESH_ROUNDS * LIVE_SAVE_REFRESHES) == 0):
+ self._save_cells()
+ if seeding:
+ logger.info("eagle-harness: live costs seeded for batch bucket %d: %s", bucket, self._table_summary(bucket))
+ self._seeding = None if ready else (bucket, self.average_context(batch))
+
+ def _check_priced(self, bucket: int) -> None:
+ """Keep the fixed shape at a bucket whose measured costs the cost model refuses (its ratio sanity checks)."""
+ table = self.cost.tables.get(bucket)
+ problem = "no table" if table is None else cost_model_problem(table, target_is_moe=self.cost.target_is_moe)
+ if problem is None:
+ self._unpriced.discard(bucket)
+ elif bucket not in self._unpriced:
+ self._unpriced.add(bucket)
+ logger.warning("eagle-harness: batch bucket %d keeps the fixed draft shape: %s", bucket, problem)
+
+ def _table_summary(self, bucket: int) -> str:
+ table = self.cost.tables.get(bucket)
+ if table is None:
+ return "no table"
+ target, draft = table.intervals[0].target, table.intervals[0].draft
+ return (
+ f"verify us at widths {[i + 1 for i in target.index]}: {[round(v) for v in target.value]}, "
+ f"draft step {round(draft.value[0])} us, ratio {table.model_ratio[0]}"
+ )
+
+ def _sample_steps(self) -> bool:
+ return self.live is not None and (self._seeding is not None or self._rounds % LIVE_REFRESH_ROUNDS == 0)
+
+ def _timed_steps(self, bs: int, run: Callable[[], int], context: int = 0) -> int:
+ """Time seed steps and one queued draft prefix per refresh period, on its executing stream."""
+ if not self._sample_steps():
+ return run()
+ start = self.timer.start()
+ steps = run()
+ if steps:
+ self.timer.stop(start, self._bucket(bs), DRAFT_WIDTH, context, steps)
+ return steps
+
+ # --------------------------------------------------------------- prelaunch
+ def prelaunch(
+ self,
+ batch: "ScheduleBatch",
+ *,
+ extend: Callable[[], None],
+ inputs: Iterable[torch.Tensor],
+ stream: Optional[torch.cuda.Stream] = None,
+ ) -> torch.cuda.Event:
+ """Queue the next draft and return the event fencing its published roots and slot reads.
+
+ ``extend`` writes the next round's roots and staged batch; ``inputs`` are its device inputs.
+ Return the fence through ``PrelaunchResult`` so the scheduler's result copies can overlap
+ this work, while its later root compaction and slot reuse remain ordered after all of it.
+ Waiting only in ``_take_pending`` would be too late for those scheduler mutations.
+ An overlap scheduler passes its forward stream (``stream``) so its draft-output relay, queued right after
+ this returns, is ordered after the extend; the synchronous scheduler leaves it None (a side stream).
+ """
+ if not arch.side_stream_prelaunch(self._device):
+ extend()
+ return torch.cuda.current_stream().record_event()
+ if stream is None:
+ if self._prelaunch_stream is None:
+ self._prelaunch_stream = torch.cuda.Stream()
+ stream = self._prelaunch_stream
+ caller_stream = torch.cuda.current_stream()
+ stream.wait_stream(caller_stream)
+ for tensor in (batch.req_pool_indices, *inputs):
+ tensor.record_stream(stream)
+ bs = len(batch.reqs)
+ width = 0 if self._chain_width is None else self._chain_width(bs)
+ with torch.cuda.stream(stream):
+ extend()
+ context = self.average_context(batch) if self._sample_steps() else 0
+ depth = (
+ self._queue_chain(bs, width) if width else self._queue_until_decision(bs, self.policy(bs), context)
+ )
+ self._pending = Prelaunch(batch_key(batch), depth, width, stream)
+ return stream.record_event()
+
+ def cancel_prelaunch(self) -> None:
+ """Drop a prelaunched draft (the next round drafts from scratch)."""
+ self._take_pending()
+
+ def _take_pending(self) -> Optional[Prelaunch]:
+ """The prelaunched draft, if any; the current stream then waits for its work."""
+ pending, self._pending = self._pending, None
+ if pending is not None:
+ torch.cuda.current_stream().wait_stream(pending.stream)
+ return pending
+
+ # ------------------------------------------------------------------ round
+ def draft(self, batch: "ScheduleBatch") -> "EagleVerifyInput":
+ """Grow this round's tree and return the verify input (a trivial one when no tree is drafted)."""
+ pending = self._take_pending()
+ if self._chain_width is not None:
+ return self._draft_chain(batch, pending)
+ draft_input = batch.spec_info
+ bs = len(batch.seq_lens)
+ tree = self.tree
+ self._begin_round(batch)
+ policy = self.policy(bs)
+ context = self.average_context(batch)
+ if pending is not None and pending.key == batch_key(batch):
+ depth = pending.next_depth
+ else:
+ self.steps.load_batch(bs, batch.seq_lens, batch.req_pool_indices)
+ self.steps.begin(bs, draft_input.topk_p, draft_input.topk_index, draft_input.hidden_states)
+ depth = self._queue_until_decision(bs, policy, context)
+ row = policy.draft_cost_row(bs, context)
+ past = policy.history_verify_num(bs)
+ depth = self._grow(bs, depth, row, past, policy)
+ nodes = tree.shape.num_nodes(depth)
+ widths = self._widths(bs)
+ verify_count = policy.verify_count(bs, nodes + 1)
+ count = min(nodes, max(widths) - 1)
+ if self._have_lagged:
+ # The width needs only the previous round's scores: rank, hand off and build in one graph.
+ width = fit_width(
+ self._verify_width(policy, self._verify_scores.read(), verify_count, bs, context), widths, nodes + 1
+ )
+ self.last_depth, self.last_width = depth, width
+ if width == 1:
+ self._verify_scores.launch(self.tail.rank(bs, depth, count).scores[:verify_count])
+ return self._trivial(batch)
+ self._stage_bonus(draft_input.bonus_tokens)
+ verify_input = self.tail.ranked_verify_input(
+ bs, depth, count, width, lambda ranking: self._verify_scores.copy(ranking.scores)
+ )
+ self._verify_scores.queued(min(verify_count, count + 1))
+ else:
+ ranking = self.tail.rank(bs, depth, count)
+ scores = ranking.scores[:verify_count]
+ self._verify_scores.launch(scores)
+ self._have_lagged = True
+ width = fit_width(
+ self._verify_width(policy, scores.tolist(), verify_count, bs, context, lagged=False), widths, nodes + 1
+ )
+ self.last_depth, self.last_width = depth, width
+ if width == 1:
+ return self._trivial(batch)
+ self._stage_bonus(draft_input.bonus_tokens)
+ verify_input = self.tail.verify_input(bs, depth, width, ranking)
+ return _round_input(verify_input, batch)
+
+ def _draft_chain(self, batch: "ScheduleBatch", pending: Optional[Prelaunch]) -> "EagleVerifyInput":
+ """A fixed-width chain round: ``width - 1`` drafted tokens (queued by the prelaunch when it drafted this
+ batch), verified with the root; width 1 verifies the root alone."""
+ bs = len(batch.seq_lens)
+ if pending is not None and pending.key == batch_key(batch):
+ width = pending.width
+ else:
+ width = self._chain_width(bs)
+ # Staged at every width: the draft extend after the verify reads the batch from the steps.
+ self.steps.load_batch(bs, batch.seq_lens, batch.req_pool_indices)
+ if width > 1:
+ draft_input = batch.spec_info
+ self.steps.begin(bs, draft_input.topk_p, draft_input.topk_index, draft_input.hidden_states)
+ self._queue_chain(bs, width)
+ self.last_depth, self.last_width = width - 1, width
+ if width == 1:
+ return self._trivial(batch)
+ self._stage_bonus(batch.spec_info.bonus_tokens)
+ steps = width - 1
+ return _round_input(self.tail.ranked_verify_input(bs, steps, steps, width, lambda ranking: None), batch)
+
+ def _queue_chain(self, bs: int, width: int) -> int:
+ """Queue the draft steps of a fixed-width chain after its begin; returns the chain's depth.
+
+ The begin drafts depth 1 and step ``d`` drafts depth ``d + 1``, so ``width - 1`` drafted tokens take steps
+ ``1 .. width - 2`` (the widest chain, ``--speculative-num-draft-tokens``, ends at the last step).
+ """
+ for step in range(1, width - 1):
+ self.steps.run(bs, step)
+ return width - 1
+
+ def _stage_bonus(self, bonus_tokens: torch.Tensor) -> None:
+ """Copy the round's bonus tokens where the verify-input graphs read them."""
+ if self._bonus is None:
+ self._bonus = torch.zeros(self.tree.max_bs, dtype=bonus_tokens.dtype, device=self._device)
+ self._bonus[: bonus_tokens.shape[0]].copy_(bonus_tokens)
+
+ def _build_verify_input(self, bs: int, selection: VerifySelection, steps: int, width: int) -> HarnessVerifyInput:
+ """The verify input of a selection, from the static ``seq_lens`` and bonus tokens (graph-captured):
+ sglang's, plus the verify tokens' KV slots and, when the target runs the batch-size-1 tail-mask
+ verify, its mask words."""
+ seq_lens, req_pool_indices = self.steps.seq_lens[:bs], self.steps.req_pool_indices[:bs]
+ verify_input = self._build_eagle_verify_input(bs, selection, steps, width)
+ slots = self.steps.req_to_token[req_pool_indices[:, None], seq_lens[:, None] + self._slot_offsets[:width]]
+ verify_input.prepared_out_cache_loc = slots.reshape(-1).to(torch.int64)
+ graphs = self._algorithm.target_verify_graphs
+ tail_mask = None if graphs is None else graphs.tail_mask
+ if tail_mask is not None and bs == 1:
+ tail_mask.write(verify_input.custom_mask, seq_lens[:1], width)
+ if self._mrope:
+ # sglang's text-only spec mrope positions (ForwardBatch.compute_spec_mrope_positions).
+ verify_input.prepared_mrope_positions = (
+ verify_input.positions.to(torch.int64).flatten().unsqueeze(0).repeat(3, 1)
+ )
+ harness_input = HarnessVerifyInput.from_eagle(verify_input)
+ if bs == 1 and self._kv_indices is not None:
+ harness_input.prepared_attn_args = build_attn_args(
+ self._req_to_token, req_pool_indices, seq_lens, width, self._kv_indices
+ )
+ return harness_input
+
+ def _build_eagle_verify_input(
+ self, bs: int, selection: VerifySelection, steps: int, width: int
+ ) -> "EagleVerifyInput":
+ """sglang's verify input of a selection."""
+ batch = SimpleNamespace(forward_mode=ForwardMode.DECODE, seq_lens=self.steps.seq_lens[:bs], seq_lens_sum=None)
+ draft_input = SimpleNamespace(bonus_tokens=self._bonus[:bs])
+ return build_eagle_verify_input(
+ batch,
+ draft_input,
+ selection.parent_list,
+ selection.top_scores_index,
+ selection.draft_tokens,
+ None,
+ target_worker=self._target_worker,
+ topk=self.tree.shape.top_k,
+ num_steps=steps,
+ num_draft_tokens=width,
+ tree_mask_mode=self._tree_mask_mode,
+ device=self._device,
+ )
+
+ # ------------------------------------------------------------------ depth
+ def _queue_until_decision(self, bs: int, policy, context: int = 0) -> int:
+ """Run the draft steps whose depths need no host decision; returns the first depth that does."""
+
+ def run() -> int:
+ depth = 0
+ while depth < self.steps.max_step:
+ kind = policy.width_step(depth)
+ if kind is WidthStep.LAUNCH:
+ self._launch_deltas(depth)
+ elif kind is not WidthStep.KEEP:
+ break
+ depth += 1
+ self.steps.run(bs, depth)
+ return depth
+
+ return self._timed_steps(bs, run, context)
+
+ def _grow(self, bs: int, depth: int, row: Optional[DraftCostRow], past: int, policy) -> int:
+ """Decide at ``depth`` (its step already queued), then step and decide until the policy
+ stops; returns the tree's depth levels."""
+ while not self._decide(depth, bs, row, past, policy):
+ if depth == self.steps.max_step:
+ return self.tree.shape.max_depth
+ depth += 1
+ self.steps.run(bs, depth)
+ return depth + 1
+
+ def _launch_deltas(self, depth: int) -> None:
+ """The work deltas of ``depth`` are on their way to the host (its graph copies them)."""
+ self._deltas_ready.record()
+ self._deltas_slot = depth
+
+ def _decide(self, depth: int, bs: int, row: Optional[DraftCostRow], past: int, policy) -> bool:
+ """Decide whether to stop growing after the layer of ``depth`` (stop = True).
+
+ The work deltas of a LAUNCH depth are already on their way to the host
+ (the step's graph copies them); the next depth reads them.
+ """
+ kind = policy.width_step(depth)
+ if kind is WidthStep.KEEP:
+ return False
+ if kind is WidthStep.LAST:
+ return True
+ if kind is WidthStep.LAUNCH:
+ self._launch_deltas(depth)
+ return False
+ spin_wait(self._deltas_ready)
+ # Row past - 1: deltas for verify budget ``past`` (sized by the cost model's bound, not the verify width).
+ deltas = self.steps.host_deltas.numpy()[self._deltas_slot, past - 1].tolist()
+ return policy.tree_width(depth, bs, past, row, deltas).stop
+
+ # ------------------------------------------------------------------ width
+ def _verify_width(
+ self, policy, scores: List[float], verify_count: int, bs: int, context: int, *, lagged: bool = True
+ ) -> int:
+ """The verify width from the policy, fed cumulative verify scores: the previous round's
+ (``lagged``), or this round's on the first round."""
+ width, _ = policy.verify_num_paged(scores, verify_count, bs, context, lagged=lagged)
+ policy.record_verify_num(bs, width)
+ return min(width, verify_count)
+
+ @staticmethod
+ def average_context(batch: "ScheduleBatch") -> int:
+ """Mean committed length of the batch (host side, no sync)."""
+ seq_lens_cpu: Optional[torch.Tensor] = getattr(batch, "seq_lens_cpu", None)
+ if seq_lens_cpu is not None:
+ return sum(seq_lens_cpu.tolist()) // len(seq_lens_cpu)
+ return int(batch.seq_lens_sum) // len(batch.seq_lens)
diff --git a/eagle_harness/sglang/gdn_tree_verify.py b/eagle_harness/sglang/gdn_tree_verify.py
new file mode 100644
index 0000000..1fc9d4a
--- /dev/null
+++ b/eagle_harness/sglang/gdn_tree_verify.py
@@ -0,0 +1,242 @@
+# Modified by Eagle AI Corp.
+# Copyright (c) 2026 Advanced Micro Devices, Inc.
+# SPDX-License-Identifier: Apache-2.0
+"""GDN tree verify on the target (hook H10): conv1d and recurrence through ancestor tables.
+
+sglang's verify kernels follow a tree's links in every layer and channel block.
+This extension derives the tree once per verify forward
+(:func:`gdn_tree_ancestors`: parent table, the three conv-window ancestors of
+each node, first-child chains for the path replay) and runs the tree kernels
+on it (``eagle_harness.kernels.gdn_tree_conv`` and ``gdn_tree_recurrence``,
+with the Gluon twin of the recurrence walk where it is validated). Output, conv windows and SSM
+snapshots have the backend kernels' layout, so the accept / commit path is
+sglang's. Both kernels take token-strided inputs, so the GDN layers hand them
+views of their input projections (``reads_strided_inputs``) instead of running
+the split kernels.
+
+A captured verify graph records the table build (static tables shared by every
+batch size and width); eager forwards build fresh tables.
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import Optional
+
+import torch
+
+from sglang.srt.layers.attention.linear.verify_extension import (
+ LinearAttnStateLayout,
+ LinearAttnVerifyExtension,
+ LinearAttnVerifyLayout,
+)
+
+from eagle_harness.kernels import arch
+from eagle_harness.kernels.gdn_tree import gdn_tree_ancestors, gdn_tree_paths_buffer
+from eagle_harness.kernels.gdn_tree_conv import gdn_tree_conv1d_update
+from eagle_harness.kernels.gdn_tree_recurrence import gdn_tree_recurrent_update
+
+logger = logging.getLogger(__name__)
+
+# The path replay runs while the batch has few (request, v-head) pairs and the tree is wide enough to branch.
+PATH_REPLAY_MAX_ROWS = 24
+PATH_REPLAY_MIN_WIDTH = 5
+
+
+# Copyright (c) 2026 Advanced Micro Devices, Inc.
+# SPDX-License-Identifier: Apache-2.0
+# Modified by Eagle AI Corp.
+class GDNTreeVerify(LinearAttnVerifyExtension):
+ """Tree verify tables of one GDN backend and the kernels they select."""
+
+ def __init__(self, device: torch.device, num_v_heads: int, fp32_state: bool):
+ self.device = device
+ self.num_v_heads = num_v_heads
+ self.fp32_state = fp32_state
+ self.records: torch.Tensor | None = None
+ self._graph_ancestors: Optional[torch.Tensor] = None
+ self._graph_paths: Optional[torch.Tensor] = None
+ # Tables of the forward being built or captured; None: not a tree verify.
+ self._ancestors: Optional[torch.Tensor] = None
+ self._paths: Optional[torch.Tensor] = None
+ self._parent_token: Optional[torch.Tensor] = None
+
+ @classmethod
+ def create(cls, state: LinearAttnStateLayout) -> Optional["GDNTreeVerify"]:
+ """The extension for a backend with ``state``, or None where the tree kernels do not apply
+ (no per-step SSM snapshots, a conv width other than 4, a 32-bit conv state)."""
+ if not state.has_state_snapshots or state.conv_state_len != 3 or state.conv_dtype.itemsize != 2:
+ logger.info("eagle-harness: GDN tree verify off (this target's state layout is not covered)")
+ return None
+ fp32 = state.ssm_dtype == torch.float32
+ result = cls(state.device, num_v_heads=state.num_v_heads, fp32_state=fp32)
+ shape = getattr(state, "snapshot_shape", ())
+ # Replay records need the engine's state-commit seam (no tracked/overlapped commits) and the snapshot layout.
+ if arch.gdn_records_replay(state.device) and getattr(state, "can_commit_state", False) and len(shape) == 6:
+ layers, rows, steps, heads, value_dim, key_dim = shape
+ if (
+ steps <= 64
+ and key_dim >= 16
+ and key_dim & (key_dim - 1) == 0
+ and value_dim >= 64
+ and value_dim % 64 == 0
+ ):
+ result.records = torch.zeros(
+ (layers, rows, steps, heads, value_dim + key_dim + 4),
+ dtype=torch.float32,
+ device=state.device,
+ )
+
+ logger.info(
+ "eagle-harness: GDN tree verify on, %s",
+ "replay records (accepted path replayed into the state pool)"
+ if result.records is not None
+ else "per-node state snapshots",
+ )
+ return result
+
+ def _uses_path_replay(self, bs: int, width: int) -> bool:
+ if self.records is not None:
+ return not self.fp32_state
+ return self.fp32_state and width >= PATH_REPLAY_MIN_WIDTH and bs * self.num_v_heads <= PATH_REPLAY_MAX_ROWS
+
+ def init_cuda_graph_state(self, max_bs: int, max_num_tokens: int) -> None:
+ """Allocate the static tree tables captured graphs write and read."""
+ max_width = max_num_tokens // max_bs
+ self._graph_ancestors = torch.zeros(max_bs * 3 * max_width, dtype=torch.int32, device=self.device)
+ path_bs = max((bs for bs in range(1, max_bs + 1) if self._uses_path_replay(bs, max_width)), default=0)
+ if path_bs:
+ self._graph_paths = torch.zeros(
+ path_bs * max_width * (2 + max_width), dtype=torch.int32, device=self.device
+ )
+
+ def begin_forward(self, layout: Optional[LinearAttnVerifyLayout], *, in_graph: bool) -> None:
+ """Build this forward's tree tables (a target verify with tree links); otherwise clear them."""
+ self._ancestors = self._paths = self._parent_token = None
+ if layout is None:
+ return
+ bs, width = layout.next_token.shape[0], layout.width
+ path_replay = self._uses_path_replay(bs, width)
+ if in_graph:
+ ancestors = self._graph_ancestors[: bs * 3 * width].view(bs, 3, width)
+ paths = self._graph_paths[: bs * width * (2 + width)].view(bs, width, 2 + width) if path_replay else None
+ else:
+ ancestors = torch.empty((bs, 3, width), dtype=torch.int32, device=self.device)
+ paths = gdn_tree_paths_buffer(bs, width, self.device) if path_replay else None
+ gdn_tree_ancestors(
+ layout.next_token,
+ layout.next_sibling,
+ layout.parent_token,
+ layout.cache_indices,
+ width,
+ ancestors,
+ query_start_loc=layout.query_start_loc,
+ paths=paths,
+ )
+ self._ancestors, self._paths, self._parent_token = ancestors, paths, layout.parent_token
+
+ def commit_state(self, state, state_indices, record_indices, commit_steps, parent) -> bool:
+ """Replay accepted paths using live metadata, including on graph replay."""
+ if self.records is None:
+ return False
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_records_commit
+
+ gdn_tree_records_commit(
+ state,
+ self.records,
+ state_indices,
+ record_indices,
+ commit_steps,
+ parent,
+ not self.fp32_state,
+ )
+ return True
+
+ def reads_strided_inputs(self) -> bool:
+ """H10: the tree kernels take token-strided inputs, so the GDN layers pass views of their projections
+ (no split kernels, and the conv does not wait for the b / a projection)."""
+ return self._ancestors is not None
+
+ def conv_update(
+ self,
+ layer,
+ mixed_qkv,
+ *,
+ conv_states,
+ cache_indices,
+ intermediate_conv_window,
+ intermediate_state_indices,
+ ) -> Optional[torch.Tensor]:
+ """The tree conv1d over the verify tokens (None: sglang's own kernel runs)."""
+ if self._ancestors is None:
+ return None
+ return gdn_tree_conv1d_update(
+ mixed_qkv,
+ conv_states,
+ layer.conv_weights,
+ layer.bias,
+ layer.activation,
+ conv_state_indices=cache_indices,
+ intermediate_conv_window=intermediate_conv_window,
+ intermediate_state_indices=intermediate_state_indices,
+ tree_ancestors=self._ancestors,
+ )
+
+ def recurrent_update(
+ self,
+ layer,
+ *,
+ query,
+ key,
+ value,
+ a,
+ b,
+ ssm_states,
+ cache_indices,
+ query_start_loc,
+ intermediate_states,
+ intermediate_state_indices,
+ ) -> Optional[torch.Tensor]:
+ """The tree recurrence over the verify tokens (None: sglang's own kernel runs)."""
+ if self._ancestors is None:
+ return None
+ if self.records is not None:
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_records_update
+
+ assert intermediate_states.is_contiguous()
+ layer_index, remainder = divmod(intermediate_states.storage_offset(), intermediate_states.numel())
+ assert remainder == 0, "state snapshot layers must be contiguous slices"
+ return gdn_tree_records_update(
+ layer.A_log,
+ layer.dt_bias,
+ query,
+ key,
+ value,
+ a,
+ b,
+ state=ssm_states,
+ state_indices=cache_indices,
+ query_start_loc=query_start_loc,
+ parent=self._parent_token,
+ tree_paths=self._paths,
+ records=self.records[layer_index],
+ record_indices=intermediate_state_indices,
+ width=self._ancestors.shape[-1],
+ )
+ return gdn_tree_recurrent_update(
+ layer.A_log,
+ layer.dt_bias,
+ query,
+ key,
+ value,
+ a,
+ b,
+ initial_state_source=ssm_states,
+ initial_state_indices=cache_indices,
+ cu_seqlens=query_start_loc,
+ intermediate_states_buffer=intermediate_states,
+ intermediate_state_indices=intermediate_state_indices,
+ retrieve_parent_token=self._parent_token,
+ tree_paths=self._paths,
+ gluon=True,
+ )
diff --git a/eagle_harness/sglang/graph_pool.py b/eagle_harness/sglang/graph_pool.py
new file mode 100644
index 0000000..36a2edd
--- /dev/null
+++ b/eagle_harness/sglang/graph_pool.py
@@ -0,0 +1,19 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The CUDA graph memory pool the harness's graphs share with sglang's."""
+
+from __future__ import annotations
+
+import torch
+
+from sglang.srt.model_executor.runner_utils.pool import get_global_graph_memory_pool, set_global_graph_memory_pool
+
+
+def graph_memory_pool():
+ """sglang's global graph memory pool, created on first use."""
+ pool = get_global_graph_memory_pool()
+ if pool is None:
+ pool = torch.cuda.graph_pool_handle()
+ set_global_graph_memory_pool(pool)
+ return pool
diff --git a/eagle_harness/sglang/hooks.py b/eagle_harness/sglang/hooks.py
new file mode 100644
index 0000000..80f04ba
--- /dev/null
+++ b/eagle_harness/sglang/hooks.py
@@ -0,0 +1,216 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The sglang API the plugin is written against, checked when it registers.
+
+Each :class:`Hook` names an sglang attribute and the parameters the plugin expects:
+
+- ``override``: the plugin overrides it, so the parameter names must match exactly (a parameter sglang adds would
+ never reach the override);
+- ``call``: the plugin calls it, so the expected names must be among sglang's (sglang may add optional ones);
+- ``field``: a field of an sglang argument group (``get_spec()`` and friends) or data class, or a class-level
+ default the plugin's subclass sets.
+
+:func:`hook_problems` lists the mismatches of the installed sglang; :func:`eagle_harness.sglang.plugin.register`
+refuses to register when there is one, so an sglang refactor fails at load time with the reason instead of in a
+GPU run. The CPU tests check that every override in the package has the signature listed here.
+"""
+
+from __future__ import annotations
+
+import importlib
+import inspect
+from typing import NamedTuple
+
+OVERRIDE, CALL, FIELD = "override", "call", "field"
+
+_ALGO = "sglang.srt.speculative.spec_registry:CustomSpecAlgo"
+_WORKER = "sglang.srt.speculative.eagle_worker_v2:EAGLEWorkerV2"
+_DRAFT = "sglang.srt.speculative.eagle_worker_v2:EagleDraftWorker"
+_HARNESS_ALGO = "eagle_harness.sglang.algorithm:EagleHarnessSpecAlgo"
+_HARNESS_WORKER = "eagle_harness.sglang.worker:EagleHarnessWorker"
+_HARNESS_DRAFT = "eagle_harness.sglang.worker:HarnessDraftWorker"
+_SPEC_INPUT = "sglang.srt.speculative.spec_info:SpecInput"
+_VERIFY_INPUT = "sglang.srt.speculative.eagle_info:EagleVerifyInput"
+_EXT = "sglang.srt.layers.attention.linear.verify_extension:LinearAttnVerifyExtension"
+_HARNESS_EXT = "eagle_harness.sglang.gdn_tree_verify:GDNTreeVerify"
+_HARNESS_MAMBA2_EXT = "eagle_harness.sglang.mamba2_tree_verify:Mamba2TreeVerify"
+_GRAPH_RUNNER_INFO = "sglang.srt.model_executor.runner.decode_graph_variants:DecodeGraphRunnerInfo"
+_EXT_CONV = (
+ "layer",
+ "mixed_qkv",
+ "conv_states",
+ "cache_indices",
+ "intermediate_conv_window",
+ "intermediate_state_indices",
+)
+_EXT_RECURRENT = (
+ "layer",
+ "query",
+ "key",
+ "value",
+ "a",
+ "b",
+ "ssm_states",
+ "cache_indices",
+ "query_start_loc",
+ "intermediate_states",
+ "intermediate_state_indices",
+)
+
+_RUN_VERIFY = (
+ "batch",
+ "target_worker",
+ "req_to_token_pool",
+ "token_to_kv_pool_allocator",
+ "plan_stream",
+ "plan_stream_ctx",
+ "topk",
+ "num_draft_tokens",
+ "device",
+ "metadata_ready_pre_pad",
+ "finalize_tree_path",
+ "grammar_barrier",
+ "accept_step",
+)
+_ACCEPT_INPUT = (
+ "verify_input",
+ "next_token_ids",
+ "next_token_logits",
+ "hidden_states",
+ "seq_lens",
+ "req_pool_indices",
+ "out_cache_loc",
+ "can_run_cuda_graph",
+)
+_ACCEPT_RESULT = ("next_token_ids", "accept_lens", "accept_index", "new_seq_lens", "bonus_tokens", "hidden_states")
+
+
+class Hook(NamedTuple):
+ path: str # "module:Class.attribute" in sglang
+ params: tuple[str, ...] # parameter names after self / cls
+ kind: str # OVERRIDE, CALL or FIELD
+ owner: str = "" # "module:Class" in this package that overrides it (OVERRIDE only)
+ optional: bool = False # an absent capability keeps the existing fallback
+
+
+HOOKS: tuple[Hook, ...] = (
+ # Registration and the algorithm's EAGLE-family membership.
+ Hook(
+ "sglang.srt.speculative.spec_info:SpeculativeAlgorithm.register",
+ ("name", "supports_overlap", "spec_class"),
+ CALL,
+ ),
+ Hook("sglang.srt.speculative.spec_info:SpeculativeAlgorithm.from_string", ("name",), CALL),
+ Hook(f"{_ALGO}.is_eagle", (), OVERRIDE, _HARNESS_ALGO),
+ Hook(f"{_ALGO}.uses_aux_hidden_states", (), OVERRIDE, _HARNESS_ALGO),
+ Hook(f"{_ALGO}.is_eagle3", (), OVERRIDE, _HARNESS_ALGO),
+ Hook(f"{_ALGO}.handle_server_args", ("server_args",), OVERRIDE, _HARNESS_ALGO),
+ # H2 request admission, H5 req_to_token headroom, H11 algorithm config.
+ Hook(f"{_ALGO}.supports_mm_inputs", (), OVERRIDE, _HARNESS_ALGO),
+ Hook(f"{_ALGO}.req_to_token_extra_len", ("page_size",), OVERRIDE, _HARNESS_ALGO),
+ Hook("sglang.srt.arg_groups.fields.spec:Spec.speculative_algorithm_config", (), FIELD),
+ # H7 per-width verify graphs, H10 GDN / Mamba2 verify extensions.
+ Hook(f"{_ALGO}.create_decode_graph_variants", ("info",), OVERRIDE, _HARNESS_ALGO),
+ Hook(f"{_GRAPH_RUNNER_INFO}.is_draft_worker", (), FIELD),
+ Hook(f"{_GRAPH_RUNNER_INFO}.device", (), FIELD),
+ Hook(f"{_ALGO}.create_linear_attn_verify_extension", ("state",), OVERRIDE, _HARNESS_ALGO),
+ Hook(f"{_EXT}.init_cuda_graph_state", ("max_bs", "max_num_tokens"), OVERRIDE, _HARNESS_EXT),
+ Hook(f"{_EXT}.begin_forward", ("layout", "in_graph"), OVERRIDE, _HARNESS_EXT),
+ Hook(f"{_EXT}.reads_strided_inputs", (), OVERRIDE, _HARNESS_EXT),
+ Hook(f"{_EXT}.conv_update", _EXT_CONV, OVERRIDE, _HARNESS_EXT),
+ Hook(f"{_EXT}.recurrent_update", _EXT_RECURRENT, OVERRIDE, _HARNESS_EXT),
+ Hook(
+ f"{_EXT}.commit_state",
+ ("state", "state_indices", "record_indices", "commit_steps", "parent"),
+ OVERRIDE,
+ _HARNESS_EXT,
+ optional=True,
+ ),
+ Hook(f"{_EXT}.init_cuda_graph_state", ("max_bs", "max_num_tokens"), OVERRIDE, _HARNESS_MAMBA2_EXT),
+ Hook(f"{_EXT}.begin_forward", ("layout", "in_graph"), OVERRIDE, _HARNESS_MAMBA2_EXT),
+ Hook(f"{_EXT}.conv_update", _EXT_CONV, OVERRIDE, _HARNESS_MAMBA2_EXT),
+ # Verify input: greedy tokens from a vocab-parallel argmax, the draft's KV slots, the tail-mask FlashInfer variant.
+ Hook(f"{_SPEC_INPUT}.greedy_tokens_only", (), FIELD),
+ Hook("sglang.srt.layers.logits_processor:LogitsProcessorOutput.next_token_ids", (), FIELD),
+ Hook(f"{_VERIFY_INPUT}.prepared_out_cache_loc", (), FIELD),
+ Hook(
+ f"{_SPEC_INPUT}.flashinfer_verify_variant",
+ ("bs", "num_tokens", "q_dtype", "kv_dtype", "head_dim"),
+ OVERRIDE,
+ "eagle_harness.sglang.verify_input:HarnessVerifyInput",
+ ),
+ # The verify (worker.py) and the fused accept step plugged into it (verify_step.py); sglang commits the states.
+ Hook(
+ "sglang.srt.speculative.eagle_worker_common:run_eagle_verify",
+ _RUN_VERIFY,
+ CALL,
+ ),
+ Hook("sglang.srt.speculative.eagle_worker_common:VerifyAcceptInput.__init__", _ACCEPT_INPUT, CALL),
+ Hook("sglang.srt.speculative.eagle_worker_common:VerifyAcceptResult.__init__", _ACCEPT_RESULT, CALL),
+ # The EAGLE V2 worker the cost-model worker extends (prefill, pools, backends stay sglang's).
+ Hook(f"{_WORKER}.__init__", ("server_args", "gpu_id", "nccl_port", "target_worker"), CALL),
+ Hook(
+ f"{_WORKER}.create_draft_worker",
+ ("server_args", "gpu_id", "nccl_port", "target_worker"),
+ OVERRIDE,
+ _HARNESS_WORKER,
+ ),
+ Hook(f"{_WORKER}.init_attention_backends", (), OVERRIDE, _HARNESS_WORKER),
+ Hook(f"{_WORKER}._build_trivial_verify_input", ("batch",), OVERRIDE, _HARNESS_WORKER),
+ Hook(
+ f"{_WORKER}.forward_batch_generation",
+ ("batch", "on_publish", "grammar_barrier", "pp_proxy_tensors"),
+ OVERRIDE,
+ _HARNESS_WORKER,
+ ),
+ Hook(f"{_DRAFT}.__init__", ("server_args", "gpu_id", "nccl_port", "target_worker"), CALL),
+ Hook(f"{_DRAFT}.init_attention_backend", (), OVERRIDE, _HARNESS_DRAFT),
+ Hook(f"{_DRAFT}._capture_cuda_graphs", (), OVERRIDE, _HARNESS_DRAFT),
+)
+
+
+def resolve(path: str):
+ """The object at ``"module:Class.attribute"``; raises ImportError / AttributeError."""
+ module_name, _, attr_path = path.partition(":")
+ obj = importlib.import_module(module_name)
+ for part in attr_path.split("."):
+ obj = getattr(obj, part)
+ return obj
+
+
+def parameter_names(func) -> tuple[str, ...]:
+ """Parameter names of ``func`` after ``self`` / ``cls`` (``*args`` / ``**kwargs`` excluded)."""
+ params = [
+ p
+ for p in inspect.signature(func).parameters.values()
+ if p.kind not in (inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD)
+ ]
+ if params and params[0].name in ("self", "cls"):
+ params = params[1:]
+ return tuple(p.name for p in params)
+
+
+def _problem(hook: Hook) -> str | None:
+ if hook.kind == FIELD:
+ cls_path, _, name = hook.path.rpartition(".")
+ try:
+ cls = resolve(cls_path)
+ fields = (*getattr(cls, "__struct_fields__", ()), *getattr(cls, "__dataclass_fields__", ()))
+ except (ImportError, AttributeError):
+ return f"{cls_path} is missing"
+ return None if name in fields or name in vars(cls) else f"{hook.path} is missing"
+ try:
+ found = parameter_names(resolve(hook.path))
+ except (ImportError, AttributeError):
+ return None if hook.optional else f"{hook.path} is missing"
+ if hook.kind == OVERRIDE and found != hook.params:
+ return f"{hook.path}{found} is not {hook.params}"
+ if hook.kind == CALL and not set(hook.params) <= set(found):
+ return f"{hook.path}{found} lacks {tuple(p for p in hook.params if p not in found)}"
+ return None
+
+
+def hook_problems() -> list[str]:
+ """What the installed sglang lacks or has changed among :data:`HOOKS` (empty: everything matches)."""
+ return [problem for problem in map(_problem, HOOKS) if problem is not None]
diff --git a/eagle_harness/sglang/l2_warm.py b/eagle_harness/sglang/l2_warm.py
new file mode 100644
index 0000000..71d1d4f
--- /dev/null
+++ b/eagle_harness/sglang/l2_warm.py
@@ -0,0 +1,158 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Weight L2 warm-ahead in the target-verify graphs.
+
+A verify at a few tokens streams every weight of the target from HBM once, but
+the layers leave HBM idle between their GEMMs: during the mixer (GDN tree conv
++ recurrence + gated norm, or qk-norm / rope / attention) and during the
+all-reduces. An L2 prefetch kernel forked onto a side stream in such a window
+warms the tail of a later GEMM's weight (the head is left to the GEMM's own
+k-tile prefetch); it only prefetches, so results are unchanged.
+
+Plain PyTorch module hooks do it, only while a verify of at most
+:data:`MAX_TOKENS` tokens is captured: a forward pre-hook on the mixer's core
+(its ``attn`` module: the GDN conv + recurrence, or the attention kernel) forks
+the prefetch of the layer's MLP ``gate_up`` weight (warm-ahead, tuned on B300 at 16 tokens:
+GDN layers pace it over the whole mixer from few CTAs, attention layers issue a short burst before the attention
+kernel launches, whose CTAs fill every SM); optional hooks after the mixer's
+output projection and after the MLP's ``down`` projection prefetch the ``down``
+weight and the next layer's input projection
+(:class:`~eagle_harness.core.config.L2Warm`). A forward hook on the last layer
+joins the side stream once. The graph records the stream launches and the join; replays
+cost nothing on the host. A weight larger than the L2 is skipped: its own head
+reads would evict the warmed part.
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import NamedTuple
+
+import torch
+from torch import nn
+
+from eagle_harness.core.config import L2Warm
+from eagle_harness.kernels.l2_prefetch import l2_prefetch
+
+logger = logging.getLogger(__name__)
+
+MAX_TOKENS = 16 # wider verifies keep the mixers busy enough, and their GEMMs are compute-bound
+PAGE = 4096 # prefetched ranges are page aligned
+
+
+class _Layer(NamedTuple):
+ module: nn.Module # the decoder layer
+ attention: bool # full attention (else a GDN layer)
+ in_proj: nn.Module # the mixer's input projection
+ core: nn.Module # the mixer's attention / recurrence module (``attn``), whose start opens the HBM-idle window
+ out_proj: nn.Module # the mixer's output projection
+ gate_up: nn.Module
+ down: nn.Module
+
+
+def _prefetchable(linear: nn.Module, l2_bytes: int) -> bool:
+ weight = getattr(linear, "weight", None)
+ return (
+ weight is not None
+ and weight.is_cuda
+ and weight.dtype == torch.bfloat16
+ and weight.is_contiguous()
+ and weight.numel() * weight.element_size() <= l2_bytes
+ )
+
+
+def _decoder_layers(model: nn.Module, l2_bytes: int) -> list[_Layer]:
+ """The decoder layers (in order) whose projections and MLP have plain bf16 weights that fit in L2."""
+ layers = []
+ for module in model.modules():
+ mlp = getattr(module, "mlp", None)
+ # A GDN layer keeps its projections in ``linear_attn``; a full-attention layer owns them.
+ for mixer, in_proj, out_proj, attention in (
+ ("linear_attn", "in_proj_qkvz", "out_proj", False),
+ (None, "qkv_proj", "o_proj", True),
+ ):
+ mixer_module = module if mixer is None else getattr(module, mixer, None)
+ parts = (
+ getattr(mixer_module, in_proj, None),
+ getattr(mixer_module, out_proj, None),
+ getattr(mlp, "gate_up_proj", None),
+ getattr(mlp, "down_proj", None),
+ )
+ core = getattr(mixer_module, "attn", None)
+ if core is None or any(part is None for part in parts):
+ continue
+ if all(_prefetchable(part, l2_bytes) for part in parts):
+ layers.append(_Layer(module, attention, parts[0], core, *parts[1:]))
+ break
+ return layers
+
+
+def _tokens(args: tuple, kwargs: dict) -> int | None:
+ """Rows of the first tensor a module is called with (a fused all-reduce hands down a tuple); None: no tensor."""
+ for arg in (*args, *kwargs.values()):
+ if isinstance(arg, tuple) and arg:
+ arg = arg[0]
+ if isinstance(arg, torch.Tensor):
+ return arg.shape[0]
+ return None
+
+
+class MlpL2WarmAhead:
+ """Forward hooks that fork and join the prefetches while a small target verify is captured."""
+
+ def __init__(self, layers: list[_Layer], plan: L2Warm, device: torch.device):
+ self._stream = torch.cuda.Stream(device)
+ self._forked = False
+ self._handles = []
+ for i, layer in enumerate(layers):
+ gate_up_plan = plan.gate_up_attention if layer.attention else plan.gate_up_gdn
+ # On the core, not after the input projection: a packed input projection does not call that module.
+ self._hook(layer.core, layer.gate_up.weight, gate_up_plan, before=True)
+ self._hook(layer.out_proj, layer.down.weight, plan.down_proj)
+ if i + 1 < len(layers):
+ self._hook(layer.down, layers[i + 1].in_proj.weight, plan.next_input)
+ self._handles.append(layers[-1].module.register_forward_hook(self._join))
+
+ @classmethod
+ def install(cls, model: nn.Module, plan: L2Warm, device: torch.device) -> "MlpL2WarmAhead | None":
+ """Hook ``model``'s decoder layers, or None when none has suitable weights (e.g. MoE)."""
+ layers = _decoder_layers(model, torch.cuda.get_device_properties(device).L2_cache_size)
+ if not layers:
+ return None
+ logger.info("L2 warm-ahead on %d decoder layers: %s", len(layers), plan)
+ return cls(layers, plan, device)
+
+ def remove(self) -> None:
+ """Remove the hooks."""
+ for handle in self._handles:
+ handle.remove()
+
+ def _hook(
+ self, trigger: nn.Module, weight: torch.Tensor, prefetch: tuple[float, int] | None, before: bool = False
+ ) -> None:
+ """Prefetch ``prefetch = (share of the weight's bytes, CTAs)`` of ``weight`` when ``trigger`` starts
+ (``before``) or after it runs."""
+ if prefetch is None:
+ return
+ share, num_ctas = prefetch
+ total = weight.numel() * weight.element_size()
+ nbytes = int(total * share) // PAGE * PAGE
+
+ def fork(_module: nn.Module, args: tuple, kwargs: dict, _output=None) -> None:
+ """Module hook: prefetch the weight's warm share on the side stream while the captured graph goes on."""
+ tokens = _tokens(args, kwargs)
+ if not torch.cuda.is_current_stream_capturing() or tokens is None or tokens > MAX_TOKENS:
+ return
+ self._stream.wait_stream(torch.cuda.current_stream())
+ with torch.cuda.stream(self._stream):
+ l2_prefetch(weight, total - nbytes, nbytes, num_ctas)
+ self._forked = True
+
+ register = trigger.register_forward_pre_hook if before else trigger.register_forward_hook
+ self._handles.append(register(fork, with_kwargs=True))
+
+ def _join(self, _module: nn.Module, _args: tuple, _output) -> None:
+ if self._forked:
+ torch.cuda.current_stream().wait_stream(self._stream)
+ self._forked = False
diff --git a/eagle_harness/sglang/mamba2_tree_verify.py b/eagle_harness/sglang/mamba2_tree_verify.py
new file mode 100644
index 0000000..bf15649
--- /dev/null
+++ b/eagle_harness/sglang/mamba2_tree_verify.py
@@ -0,0 +1,98 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Mamba2 tree verify on the target: the conv1d through ancestor tables.
+
+sglang's Mamba2 target verify follows a tree's links inside ``causal_conv1d_update_triton`` (which also writes the
+parent table) in every layer and channel block. This extension derives the tree once per verify forward
+(:func:`gdn_tree_ancestors`: the parent table and the three conv-window ancestors of each node) and runs the tree
+conv on it (``eagle_harness.kernels.gdn_tree_conv``; the window walk does not depend on the mixer). sglang's
+selective state update then runs on the parent table built here, and the accept / commit path stays sglang's: the conv
+windows have the backend kernel's layout.
+
+A captured verify graph records the table build (a static table shared by every batch size and width); eager forwards
+build a fresh one.
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import Optional
+
+import torch
+
+from sglang.srt.layers.attention.linear.verify_extension import (
+ LinearAttnStateLayout,
+ LinearAttnVerifyExtension,
+ LinearAttnVerifyLayout,
+)
+
+from eagle_harness.kernels.gdn_tree import gdn_tree_ancestors
+from eagle_harness.kernels.gdn_tree_conv import gdn_tree_conv1d_update
+
+logger = logging.getLogger(__name__)
+
+
+class Mamba2TreeVerify(LinearAttnVerifyExtension):
+ """Tree verify table of one Mamba2 backend and the tree conv that reads it."""
+
+ def __init__(self, device: torch.device):
+ self.device = device
+ self._graph_ancestors: Optional[torch.Tensor] = None
+ # Table of the forward being built or captured; None: not a tree verify.
+ self._ancestors: Optional[torch.Tensor] = None
+
+ @classmethod
+ def create(cls, state: LinearAttnStateLayout) -> Optional["Mamba2TreeVerify"]:
+ """The extension for a Mamba2 backend with ``state``, or None where the tree conv does not apply
+ (no per-step SSM snapshots, a conv width other than 4, a 32-bit conv state)."""
+ if not state.has_state_snapshots or state.conv_state_len != 3 or state.conv_dtype.itemsize != 2:
+ logger.info("eagle-harness: Mamba2 tree verify off (this target's state layout is not covered)")
+ return None
+ return cls(state.device)
+
+ def init_cuda_graph_state(self, max_bs: int, max_num_tokens: int) -> None:
+ """Allocate the static tree table captured graphs write and read."""
+ self._graph_ancestors = torch.zeros(3 * max_num_tokens, dtype=torch.int32, device=self.device)
+
+ def begin_forward(self, layout: Optional[LinearAttnVerifyLayout], *, in_graph: bool) -> None:
+ """Build this forward's tree table and parent links (a target verify with tree links); otherwise clear it."""
+ self._ancestors = None
+ if layout is None:
+ return
+ bs, width = layout.next_token.shape[0], layout.width
+ if in_graph:
+ ancestors = self._graph_ancestors[: bs * 3 * width].view(bs, 3, width)
+ else:
+ ancestors = torch.empty((bs, 3, width), dtype=torch.int32, device=self.device)
+ # Also writes layout.parent_token, which sglang's selective state update reads.
+ gdn_tree_ancestors(
+ layout.next_token, layout.next_sibling, layout.parent_token, layout.cache_indices, width, ancestors
+ )
+ self._ancestors = ancestors
+
+ def conv_update(
+ self,
+ layer,
+ mixed_qkv,
+ *,
+ conv_states,
+ cache_indices,
+ intermediate_conv_window,
+ intermediate_state_indices,
+ ) -> Optional[torch.Tensor]:
+ """The tree conv1d over the verify tokens' x / B / C projection (None: sglang's own kernel runs)."""
+ if self._ancestors is None:
+ return None
+ conv = layer.conv1d
+ return gdn_tree_conv1d_update(
+ mixed_qkv,
+ conv_states,
+ conv.weight.view(conv.weight.shape[0], conv.weight.shape[-1]),
+ conv.bias,
+ layer.activation,
+ conv_state_indices=cache_indices,
+ intermediate_conv_window=intermediate_conv_window,
+ intermediate_state_indices=intermediate_state_indices,
+ tree_ancestors=self._ancestors,
+ )
diff --git a/eagle_harness/sglang/models/__init__.py b/eagle_harness/sglang/models/__init__.py
new file mode 100644
index 0000000..bed1c8a
--- /dev/null
+++ b/eagle_harness/sglang/models/__init__.py
@@ -0,0 +1,4 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 draft model classes for sglang's ModelRegistry (registered by the plugin)."""
diff --git a/eagle_harness/sglang/models/llama_eagle3.py b/eagle_harness/sglang/models/llama_eagle3.py
new file mode 100644
index 0000000..8b8c211
--- /dev/null
+++ b/eagle_harness/sglang/models/llama_eagle3.py
@@ -0,0 +1,12 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Public vLLM-style architecture spelling for SGLang's native EAGLE3 loader."""
+from sglang.srt.models.llama_eagle3 import LlamaForCausalLMEagle3
+
+
+class Eagle3LlamaForCausalLM(LlamaForCausalLMEagle3):
+ pass
+
+
+EntryClass = [Eagle3LlamaForCausalLM]
diff --git a/eagle_harness/sglang/models/llama_eagle4.py b/eagle_harness/sglang/models/llama_eagle4.py
new file mode 100644
index 0000000..738fa12
--- /dev/null
+++ b/eagle_harness/sglang/models/llama_eagle4.py
@@ -0,0 +1,525 @@
+# SPDX-FileCopyrightText: Copyright 2023-2024 SGLang Team
+# SPDX-FileCopyrightText: Copyright 2025 SafeAI Lab (SAIL)
+# Derived from sglang (Apache-2.0) python/sglang/srt/models/llama_eagle3.py, itself adapted from SafeAILab EAGLE
+# (Apache-2.0) eagle/model/cnets.py. Modified by Eagle AI Corp: the EAGLE-4 draft (fc over three aux hidden states,
+# sliding window, low-rank candidate head). Notices and license texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""EAGLE-4 draft model on sglang layers (``LlamaForCausalLMEagle4``).
+
+Registered with sglang's ``ModelRegistry`` by the plugin entry point. Covers the
+dense single-layer EAGLE-4 drafts (the README Qwen3.8-27B draft):
+
+- fc input: three target aux hidden states, each RMS-normed (``fc_norm``), then
+ one row-parallel ``fc`` (3H -> H);
+- layer 0: ``concat(input_layernorm(embed), hidden_norm(fc_out)) -> qkv`` (2H in),
+ or with ``attn_norm`` through ``eh_proj`` (2H -> H, the attention residual) and
+ ``pre_attention_layernorm`` first; Llama attention with RoPE or none (NoPE) and an
+ optional sliding window; a Llama MLP or the latent ReLU^2 MoE of a
+ ``nemotron_latent_relu2`` draft (sglang's ``NemotronHMoE``, the Nemotron-H block);
+- output: ``norm(residual + mlp)`` feeds the LM head and, with ``norm_output``,
+ the next draft step (else the un-normed sum does);
+- LM head: the low-rank candidate head (:mod:`eagle_harness.sglang.candidate_logits`).
+
+SwiGLU-MoE and post-MLP-norm drafts are refused with a clear error rather than
+served partly.
+"""
+
+from __future__ import annotations
+
+import copy
+import logging
+import re
+from typing import Callable, Iterable, Optional, Tuple
+
+import torch
+from torch import nn
+from torch.nn import functional as F
+
+from sglang.kernels.ops.embeddings.vocab_parallel_embedding import vocab_parallel_embedding
+from sglang.srt.distributed.communication_op import (
+ tensor_model_parallel_all_gather,
+ tensor_model_parallel_all_reduce,
+)
+from sglang.srt.distributed.device_communicators.triton_symm_mem_ag import MultimemAllGatherer, recommended_max_tokens
+from sglang.srt.layers.layer_boundary import layer_stack
+from sglang.srt.layers.layernorm import RMSNorm
+from sglang.srt.layers.linear import QKVParallelLinear, ReplicatedLinear, RowParallelLinear
+from sglang.srt.layers.moe.utils import get_moe_a2a_backend
+from sglang.srt.layers.quantization.base_config import QuantizationConfig
+from sglang.srt.layers.vocab_parallel_embedding import ParallelLMHead, VocabParallelEmbedding
+from sglang.srt.model_executor.forward_batch_info import ForwardBatch, PPProxyTensors
+from sglang.srt.model_loader.weight_utils import default_weight_loader
+from sglang.srt.models.llama import LlamaDecoderLayer, LlamaForCausalLM
+from sglang.srt.runtime_context import get_parallel
+from sglang.srt.utils import add_prefix
+
+from eagle_harness.models.eagle4_config import check_ported, resolve_draft_sliding_window
+from eagle_harness.models.eagle4_structure import (
+ LATENT_MOE_ARCHITECTURE,
+ base_layer_overrides,
+ draft_moe_architecture,
+ draft_uses_rope,
+ latent_moe_config,
+)
+from eagle_harness.models.low_rank_head import low_rank_scores
+from eagle_harness.models.low_rank_head import low_rank_factors
+from eagle_harness.kernels.candidate_ops import candidate_topk
+from eagle_harness.sglang.algorithm import harness_config
+from eagle_harness.sglang.candidate_logits import (
+ Candidates,
+ build_candidate_logits_processor,
+ merge_candidates,
+ shard_candidates,
+)
+
+logger = logging.getLogger(__name__)
+
+NUM_AUX_HIDDEN_STATES = 3
+
+
+def replicate_embedding(
+ shard: torch.Tensor, vocab_size: int, all_gather: Callable[[torch.Tensor], torch.Tensor]
+) -> torch.Tensor:
+ """The full ``[vocab_size, H]`` embedding table from this rank's contiguous vocab shard.
+
+ ``all_gather`` stacks every rank's shard along dim 0 in rank order; rows past ``vocab_size`` are padding.
+ A draft step then looks its tokens up locally instead of all-reducing the shards' partial lookups.
+ """
+ return all_gather(shard)[:vocab_size].contiguous()
+
+
+# sglang's EAGLE draft worker always shares the target embedding.
+_UNSUPPORTED = {"enable_post_mlp_norm": True, "share_draft_embedding_from_target": False}
+
+
+def check_supported(config) -> None:
+ """Validate the config and refuse draft structures this adapter does not build."""
+ check_ported(config, _UNSUPPORTED)
+ moe = draft_moe_architecture(config)
+ if moe not in (None, LATENT_MOE_ARCHITECTURE):
+ raise NotImplementedError(f"EAGLE-4 drafts with the {moe!r} MoE are not ported to eagle-harness on sglang.")
+
+
+def served_sliding_window(config) -> Optional[int]:
+ """The draft's attention window as served, or None."""
+ return resolve_draft_sliding_window(config)
+
+
+class _NoRotary(nn.Module):
+ """RoPE of a draft trained without positions (NoPE): q and k pass unchanged."""
+
+ def forward(self, positions: torch.Tensor, query: torch.Tensor, key: torch.Tensor, *args, **kwargs):
+ return query, key
+
+
+def _base_layer_config(config):
+ """Config of the Llama base layer, whose SiLU MLP and RoPE table a draft may replace right after.
+
+ The base refuses any activation but SiLU, and a NoPE draft's full-length RoPE table would stay alive
+ in ``get_rope``'s process-wide cache.
+ """
+ base = copy.copy(config)
+ vars(base).update(base_layer_overrides(config))
+ return base
+
+
+def build_latent_moe(config, prefix: str) -> nn.Module:
+ """The latent ReLU^2 MoE of a ``nemotron_latent_relu2`` draft: sglang's ``NemotronHMoE``, the target's block.
+
+ Sigmoid router over bias-corrected scores, routed experts in the latent space between ``fc1_latent_proj``
+ and ``fc2_latent_proj``, ``routed_scaling_factor`` on the routed sum, plus a ReLU^2 shared expert. Experts and
+ the shared expert split over TP and the block returns this rank's partial sum, reduced by the layer.
+ """
+ parallel = get_parallel()
+ if parallel.moe_ep_size != 1 or parallel.moe_tp_size != parallel.tp_size or not get_moe_a2a_backend().is_none():
+ raise ValueError(
+ "The EAGLE-4 latent MoE draft keeps every expert on each rank and splits it over TP: serve it with "
+ f"moe EP 1 (got {parallel.moe_ep_size}), moe TP = TP (got {parallel.moe_tp_size} vs "
+ f"{parallel.tp_size}) and --speculative-moe-a2a-backend none (got {get_moe_a2a_backend()})."
+ )
+ # The block routes config.num_experts_per_tok experts with sglang's own router; the harness knob only
+ # changes the accumulation of a SwiGLU-MoE router.
+ if harness_config().draft_model.moe_gate_acc != "fp32":
+ logger.warning("draft_model.moe_gate_acc applies to SwiGLU-MoE drafts; the latent MoE ignores it.")
+ # Imported here: sglang's model registry turns an import error into a warning and would drop the draft.
+ from sglang.srt.models.nemotron_h import NemotronHMoE
+
+ return NemotronHMoE(latent_moe_config(config), layer_idx=0, quant_config=None, prefix=prefix)
+
+
+class Eagle4DecoderLayer(LlamaDecoderLayer):
+ """Llama layer whose qkv reads ``concat(normed embed, normed hidden)`` (through ``eh_proj`` with ``attn_norm``)."""
+
+ def __init__(self, config, quant_config: Optional[QuantizationConfig], prefix: str, window: Optional[int]):
+ super().__init__(
+ _base_layer_config(config), 0, quant_config=quant_config, prefix=prefix, stage_boundaries=False
+ )
+ attn = self.self_attn
+ self.attn_norm = bool(getattr(config, "attn_norm", False))
+ if self.attn_norm:
+ # MTP-style input fusion: eh_proj maps the concat back to H; that projection is the attention residual
+ # and its norm feeds q/k/v. Unquantized, like fc.
+ self.eh_proj = ReplicatedLinear(
+ 2 * config.hidden_size,
+ config.hidden_size,
+ bias=False,
+ quant_config=None,
+ prefix=add_prefix("eh_proj", prefix),
+ )
+ self.pre_attention_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
+ if not draft_uses_rope(config):
+ attn.rotary_emb = _NoRotary()
+ self.reduce_mlp = False
+ if draft_moe_architecture(config) == LATENT_MOE_ARCHITECTURE:
+ if quant_config is not None:
+ raise ValueError(
+ "The EAGLE-4 latent MoE draft is trained in BF16: serve it with "
+ "--speculative-draft-model-quantization unquant."
+ )
+ self.mlp = build_latent_moe(config, add_prefix("mlp", prefix))
+ self.reduce_mlp = get_parallel().tp_size > 1
+ self.self_attn.qkv_proj = QKVParallelLinear(
+ config.hidden_size if self.attn_norm else 2 * config.hidden_size,
+ attn.head_dim,
+ attn.total_num_heads,
+ attn.total_num_kv_heads,
+ bias=False,
+ quant_config=quant_config,
+ prefix=add_prefix("self_attn.qkv_proj", prefix),
+ )
+ self.hidden_norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
+ if window is not None:
+ # As trained: W keys ending at the query (FlashInfer window_left = W - 1).
+ attn.attn.sliding_window_size = window - 1
+
+ def forward(
+ self, positions: torch.Tensor, embeds: torch.Tensor, hidden_states: torch.Tensor, forward_batch: ForwardBatch
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
+ """The layer: norm the embeds and the hidden separately, attend over their concat, then the MLP."""
+ residual = hidden_states
+ x = torch.cat([self.input_layernorm(embeds), self.hidden_norm(hidden_states)], dim=-1)
+ if self.attn_norm:
+ residual, _ = self.eh_proj(x)
+ x = self.pre_attention_layernorm(residual)
+ x = self.self_attn(positions=positions, hidden_states=x, forward_batch=forward_batch)
+ x, residual = self.post_attention_layernorm(x, residual)
+ x = self.mlp(x)
+ if self.reduce_mlp:
+ x = tensor_model_parallel_all_reduce(x)
+ return x, residual
+
+
+class Eagle4Model(nn.Module):
+ """EAGLE-4 draft body: fc over three aux hidden states, one layer, final norm."""
+
+ def __init__(self, config, quant_config: Optional[QuantizationConfig], prefix: str, window: Optional[int]):
+ super().__init__()
+ self.config = config
+ self.hidden_size = config.hidden_size
+ self.norm_output = bool(getattr(config, "norm_output", False))
+ target_hidden = getattr(config, "target_hidden_size", config.hidden_size)
+ self.embed_tokens = VocabParallelEmbedding(
+ config.vocab_size, config.hidden_size, prefix=add_prefix("embed_tokens", prefix)
+ )
+ self.embed_full: Optional[torch.Tensor] = None # the replicated table (LlamaForCausalLMEagle4.set_embed)
+ self.triton_embed = harness_config().draft_model.embed_triton # CUDA lookups on sglang's Triton embedding
+ self.fc_norm = (
+ nn.ModuleList(RMSNorm(target_hidden, eps=config.rms_norm_eps) for _ in range(NUM_AUX_HIDDEN_STATES))
+ if getattr(config, "fc_norm", False) or getattr(config, "enable_fc_norm", False)
+ else None
+ )
+ self.fc = RowParallelLinear(
+ target_hidden * NUM_AUX_HIDDEN_STATES,
+ config.hidden_size,
+ bias=False,
+ quant_config=None,
+ input_is_parallel=False,
+ prefix=add_prefix("fc", prefix),
+ )
+ with layer_stack():
+ self.layers = nn.ModuleList(
+ [Eagle4DecoderLayer(config, quant_config, add_prefix("layers.0", prefix), window)]
+ )
+ self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
+
+ def _embed(self, input_ids: torch.Tensor) -> torch.Tensor:
+ """The rows' token embeddings. From a table of the whole vocab on this rank (the replicated table, or
+ the only shard at TP 1) a CUDA lookup is sglang's Triton embedding kernel (``draft_model.embed_triton``),
+ a plain row copy that is faster than ``F.embedding``'s index_select for a draft step's few rows."""
+ table = self.embed_full
+ if table is None and self.embed_tokens.tp_size == 1:
+ table = self.embed_tokens.weight
+ if table is None:
+ return self.embed_tokens(input_ids)
+ if not (self.triton_embed and input_ids.is_cuda):
+ return F.embedding(input_ids, table)
+ rows = table.shape[0]
+ return vocab_parallel_embedding(
+ input_ids.contiguous(),
+ table,
+ org_vocab_start_index=0,
+ org_vocab_end_index=rows,
+ num_org_vocab_padding=0,
+ added_vocab_start_index=rows, # no added vocab
+ added_vocab_end_index=rows,
+ )
+
+ def _project_target_features(self, hidden: torch.Tensor) -> torch.Tensor:
+ if self.fc_norm is not None:
+ chunks = hidden.chunk(NUM_AUX_HIDDEN_STATES, dim=-1)
+ hidden = torch.cat([norm(chunk) for norm, chunk in zip(self.fc_norm, chunks)], dim=-1)
+ out, _ = self.fc(hidden)
+ return out
+
+ def forward(
+ self,
+ input_ids: torch.Tensor,
+ positions: torch.Tensor,
+ forward_batch: ForwardBatch,
+ input_embeds: Optional[torch.Tensor] = None,
+ pp_proxy_tensors: Optional[PPProxyTensors] = None,
+ ):
+ """Embed ``input_ids``, run the layer on the draft's hidden states; returns the normed output and a list."""
+ embeds = input_embeds if input_embeds is not None else self._embed(input_ids)
+ hidden = forward_batch.spec_info.hidden_states
+ if hidden.shape[-1] != self.hidden_size:
+ hidden = self._project_target_features(hidden)
+ if hidden.shape[0] == 0:
+ return hidden, [hidden]
+ mlp_out, residual = self.layers[0](positions, embeds, hidden, forward_batch)
+ summed = residual + mlp_out
+ normed = self.norm(summed)
+ return normed, [normed if self.norm_output else summed]
+
+
+class LlamaForCausalLMEagle4(LlamaForCausalLM):
+ """EAGLE-4 draft (checkpoint class ``LlamaForCausalLMEagle4``) with the candidate LM head."""
+
+ def __init__(self, config, quant_config: Optional[QuantizationConfig] = None, prefix: str = "") -> None:
+ nn.Module.__init__(self)
+ check_supported(config)
+ self.config = config
+ self.quant_config = quant_config
+ self.pp_group = get_parallel().pp_group
+ self.window = served_sliding_window(config)
+ self.model = Eagle4Model(config, quant_config, add_prefix("model", prefix), self.window)
+
+ head = config.efficient_lm_head_config
+ self.num_candidates = int(head["num_candidates"])
+ self.low_rank_type = head["type"]
+ self.smooth_factor = head.get("smooth_factor", 10)
+ rank = int(head["rank"])
+ self.load_lm_head_from_target = False
+ self.lm_head = ParallelLMHead(config.vocab_size, config.hidden_size, prefix=add_prefix("lm_head", prefix))
+ self.efficient_lm_head = ParallelLMHead(config.vocab_size, rank, prefix=add_prefix("efficient_lm_head", prefix))
+ self.efficient_lm_head_down_proj = nn.Linear(config.hidden_size, rank, bias=False)
+ self.logits_processor = build_candidate_logits_processor(config, self._candidates)
+ self.capture_aux_hidden_states = True
+ self.hot_token_id = None
+ self._tp_size = get_parallel().tp_size
+ self._candidate_gatherer: Optional[MultimemAllGatherer] = None
+ self._cuda_candidate_kernels = harness_config().draft_model.cuda_candidate_kernels
+ # A measured top-k crossover for this exact GPU/toolchain/shape (tools/calibrate_candidate_topk.py), on
+ # every vendor; without one the dispatcher's built-in limit stands.
+ import triton
+
+ from eagle_harness.core.candidate_calibration import load_candidate_crossover
+
+ self._candidate_crossover = load_candidate_crossover(
+ harness_config().data_path,
+ {
+ "device": torch.cuda.get_device_name(),
+ "torch": torch.__version__,
+ "triton": triton.__version__,
+ "dtype": str(self.lm_head.weight.dtype),
+ "vocab_size": self.lm_head.weight.shape[0],
+ "num_candidates": self.num_candidates,
+ },
+ )
+ logger.info(
+ "eagle-harness: candidate top-k crossover %s",
+ "built-in" if self._candidate_crossover is None else f"measured ({self._candidate_crossover} scores)",
+ )
+
+ def set_embed(self, embed: torch.Tensor) -> None:
+ """Share the target's embedding shard, and with ``draft_model.embed_full`` replicate the table on every rank."""
+ super().set_embed(embed)
+ if self._tp_size > 1 and harness_config().draft_model.embed_full:
+ self.model.embed_full = replicate_embedding(
+ embed.data, self.config.vocab_size, lambda shard: tensor_model_parallel_all_gather(shard, dim=0)
+ )
+
+ def set_embed_and_head(self, embed: torch.Tensor, head: torch.Tensor) -> None:
+ """Share only the target's embedding: the draft keeps its own LM head (``load_lm_head_from_target`` is
+ False), which sglang's EAGLE draft setup would otherwise replace with the target's."""
+ self.set_embed(embed)
+
+ # ---- candidate head
+ def _candidates(self, hidden: torch.Tensor) -> Candidates:
+ shard = self.lm_head.shard_indices
+ local = shard_candidates(
+ hidden,
+ self.efficient_lm_head_down_proj.weight,
+ self.efficient_lm_head.weight,
+ self.lm_head.weight,
+ num_candidates=self.num_candidates,
+ vocab_start=shard.org_vocab_start_index,
+ vocab_rows=shard.org_vocab_end_index - shard.org_vocab_start_index,
+ )
+ gather = tensor_model_parallel_all_gather if self._tp_size > 1 else None
+ return merge_candidates(local, self.num_candidates, gather)
+
+ def candidate_topk(self, hidden: torch.Tensor, k: int) -> Tuple[torch.Tensor, torch.Tensor]:
+ """Top-``k`` next tokens of each row: ``([rows, k]`` fp32 probabilities, ``[rows, k]`` ids).
+
+ The softmax runs over the ``C`` candidates only, which equals the
+ full-vocab softmax of :class:`CandidateLogitsProcessor`'s rows.
+ """
+ if hidden.is_cuda:
+ return self._fused_candidate_topk(hidden, k)
+ candidates = self._candidates(hidden)
+ probs, pick = torch.topk(torch.softmax(candidates.logits, dim=-1), k, dim=-1)
+ return probs, torch.gather(candidates.token_ids, 1, pick)
+
+ def _fused_candidate_topk(self, hidden: torch.Tensor, k: int) -> Tuple[torch.Tensor, torch.Tensor]:
+ """:meth:`candidate_topk` on the candidate kernels (``candidate_ops.candidate_topk``), bit-identical to torch."""
+ shard = self.lm_head.shard_indices
+ scores = low_rank_scores(
+ hidden,
+ self.efficient_lm_head_down_proj.weight,
+ self.efficient_lm_head.weight,
+ shard.org_vocab_end_index - shard.org_vocab_start_index,
+ )
+ return candidate_topk(
+ scores,
+ self.lm_head.weight,
+ hidden,
+ num_candidates=self.num_candidates,
+ vocab_start=shard.org_vocab_start_index,
+ top_k=k,
+ all_gather=self._gather_packed_candidates if self._tp_size > 1 else None,
+ cuda_kernels=self._cuda_candidate_kernels,
+ max_triton_elements=self._candidate_crossover,
+ )
+
+ def _gather_packed_candidates(self, packed: torch.Tensor) -> torch.Tensor:
+ """``[rows, n]`` int32 -> ``[tp, rows, n]`` (a view of the last-dim gather), on sglang's multimem all-gather
+ (bf16 bit copies; NCCL along the last dim where it does not apply)."""
+ if self._candidate_gatherer is None:
+ # Without the entry barrier: consecutive candidate gathers are separated by this draft's own all-reduces
+ # (every draft forward reduces its o_proj and down_proj before the next candidate_topk), so no rank can
+ # write into another's symmetric buffer before that rank has consumed the previous gather. The same
+ # argument sglang's LogitsProcessor makes for its logits gatherer.
+ self._candidate_gatherer = MultimemAllGatherer(
+ max_tokens=recommended_max_tokens(include_prefill=False, floor=128), skip_entry_sync=True
+ )
+ gathered = self._candidate_gatherer(packed.view(torch.bfloat16)).view(torch.int32)
+ return gathered.view(packed.shape[0], self._tp_size, packed.shape[1]).transpose(0, 1)
+
+ def get_hot_token_id(self) -> None:
+ """No hot-token vocab subset."""
+ return None
+
+ def get_attention_sliding_window_size(self) -> Optional[int]:
+ """The draft's sliding window as sglang counts it (one less than the config's), or None."""
+ return None if self.window is None else self.window - 1
+
+ # ---- weights
+ def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]) -> None:
+ """Load the checkpoint, fusing q/k/v and gate/up and reading the low-rank head factors."""
+ params = dict(self.named_parameters())
+ stacked = [
+ (".qkv_proj", ".q_proj", "q"),
+ (".qkv_proj", ".k_proj", "k"),
+ (".qkv_proj", ".v_proj", "v"),
+ (".gate_up_proj", ".gate_proj", 0),
+ (".gate_up_proj", ".up_proj", 1),
+ ]
+ loaded = set()
+ latent_moe = draft_moe_architecture(self.config) == LATENT_MOE_ARCHITECTURE
+ expert_tensors = set()
+ for name, weight in weights:
+ name = _checkpoint_name(name)
+ if latent_moe and ".mlp." in name:
+ loaded.add(self._load_latent_moe_weight(params, name, weight))
+ if ".mlp.experts." in name:
+ expert_tensors.add(name)
+ continue
+ for param_suffix, ckpt_suffix, shard_id in stacked:
+ if ckpt_suffix in name:
+ target = name.replace(ckpt_suffix, param_suffix)
+ param = params[target]
+ param.weight_loader(param, weight, shard_id)
+ loaded.add(target)
+ break
+ else:
+ if name not in params:
+ raise KeyError(f"EAGLE-4 checkpoint tensor {name!r} has no parameter in the model.")
+ param = params[name]
+ getattr(param, "weight_loader", default_weight_loader)(param, weight)
+ loaded.add(name)
+ low_rank = {"efficient_lm_head.weight", "efficient_lm_head_down_proj.weight"}
+ missing = set(params) - loaded - low_rank - {"model.embed_tokens.weight"}
+ if latent_moe:
+ expected_experts = {
+ f"model.layers.0.mlp.experts.{expert}.{proj}_proj.weight"
+ for expert in range(int(self.config.n_routed_experts))
+ for proj in ("up", "down")
+ }
+ missing.update(expected_experts - expert_tensors)
+ if missing:
+ raise RuntimeError(f"EAGLE-4 checkpoint is missing {sorted(missing)}.")
+ if not low_rank <= loaded:
+ self._low_rank_head_from_svd()
+
+ @staticmethod
+ def _load_latent_moe_weight(params: dict, name: str, weight: torch.Tensor) -> str:
+ """Load one latent-MoE tensor; returns its parameter name. The checkpoint keeps one ``up_proj`` /
+ ``down_proj`` per routed expert, which go into the ungated experts' ``w13`` (``w1`` alone) and ``w2``."""
+ expert = re.fullmatch(r"(.*\.mlp\.experts)\.(\d+)\.(up_proj|down_proj)\.weight", name)
+ if expert is None:
+ if name not in params:
+ raise KeyError(f"EAGLE-4 checkpoint tensor {name!r} has no parameter in the model.")
+ param = params[name]
+ getattr(param, "weight_loader", default_weight_loader)(param, weight)
+ return name
+ prefix, expert_id, proj = expert.groups()
+ shard_id, param_name = ("w1", f"{prefix}.w13_weight") if proj == "up_proj" else ("w2", f"{prefix}.w2_weight")
+ param = params[param_name]
+ param.weight_loader(param, weight, param_name, shard_id=shard_id, expert_id=int(expert_id))
+ return param_name
+
+ def _low_rank_head_from_svd(self) -> None:
+ """Checkpoints without the low-rank factors: SVD of this rank's LM-head shard."""
+ frequency = None
+ if self.low_rank_type == "weighted_low_rank":
+ from eagle_harness.models.low_rank_head import load_token_frequency
+
+ frequency = load_token_frequency(self.config._name_or_path, self.config.vocab_size)
+ shard = self.lm_head.shard_indices
+ factors = low_rank_factors(
+ self.lm_head.weight,
+ self.efficient_lm_head_down_proj.out_features,
+ token_frequency=frequency,
+ smooth_factor=self.smooth_factor,
+ shard=(shard.org_vocab_start_index, shard.org_vocab_end_index),
+ )
+ with torch.no_grad():
+ self.efficient_lm_head_down_proj.weight.copy_(factors.down_proj)
+ self.efficient_lm_head.weight.copy_(factors.scores)
+ logger.info("EAGLE-4 low-rank head from SVD: energy retention %.4f", factors.energy_retention)
+
+
+_TOP_LEVEL = ("lm_head.", "efficient_lm_head.", "efficient_lm_head_down_proj.")
+
+
+def _checkpoint_name(name: str) -> str:
+ """Checkpoint tensor name -> parameter name (``layers.0.*`` -> ``model.layers.0.*``)."""
+ name = name.removeprefix("model.")
+ if name.startswith("midlayer."):
+ name = "layers.0." + name[len("midlayer.") :]
+ if name == "fc.linear.weight":
+ name = "fc.weight"
+ return name if name.startswith(_TOP_LEVEL) else "model." + name
+
+
+EntryClass = [LlamaForCausalLMEagle4]
diff --git a/eagle_harness/sglang/plain_decode.py b/eagle_harness/sglang/plain_decode.py
new file mode 100644
index 0000000..d0a1b34
--- /dev/null
+++ b/eagle_harness/sglang/plain_decode.py
@@ -0,0 +1,121 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Native decode handoff for a request that will not resume drafting."""
+
+import copy
+import weakref
+from collections.abc import Sequence
+from typing import TYPE_CHECKING
+
+import torch
+from sglang.srt.managers.overlap_utils import FutureMap
+from sglang.srt.model_executor.forward_batch_info import CaptureHiddenMode, ForwardMode
+from sglang.srt.speculative.spec_info import SpeculativeAlgorithm
+
+from eagle_harness.sglang.hooks import parameter_names
+
+if TYPE_CHECKING:
+ from sglang.srt.managers.schedule_batch import Req, ScheduleBatch
+ from sglang.srt.managers.tp_worker import TpModelWorker
+ from sglang.srt.managers.utils import GenerationBatchResult
+
+ from eagle_harness.sglang.chain_rounds import ChainRounds
+
+
+class NoSpecRequests:
+ """Keep a request off until it finishes; skipped draft KV is never reused."""
+
+ def __init__(self) -> None:
+ self._disabled: weakref.WeakSet[Req] = weakref.WeakSet()
+ # Newer hosts take the one-token commit's host lengths and skip the relay's device pull.
+ self.publishes_host_lengths = "new_seq_lens_cpu" in parameter_names(FutureMap.publish)
+
+ def select(self, requests: Sequence["Req"], width: int) -> bool:
+ disabled = width == 0 or any(req in self._disabled for req in requests)
+ if disabled:
+ self._disabled.update(requests)
+ return disabled
+
+ def publish(self, on_publish, result: "GenerationBatchResult") -> None:
+ """Relay a plain decode's lengths, on host too when the host relay reads them there."""
+ if self.publishes_host_lengths and result.new_seq_lens_cpu is not None:
+ on_publish(result.new_seq_lens, new_seq_lens_cpu=result.new_seq_lens_cpu)
+ else:
+ on_publish(result.new_seq_lens)
+
+
+class NativeDecode:
+ """Sticky native-decode routing and its grammar/calibration boundary.
+
+ The caller cancels pending draft work before ``run`` and fences/publishes the
+ returned result. Request lifetime tracking survives calibration interruptions.
+ """
+
+ def __init__(
+ self,
+ target_worker: "TpModelWorker",
+ req_to_token: torch.Tensor,
+ rounds: "ChainRounds",
+ *,
+ enabled: bool,
+ ):
+ self._target_worker = target_worker
+ self._req_to_token = req_to_token
+ self._rounds = rounds
+ self._requests = NoSpecRequests() if enabled else None
+
+ def select(self, batch: "ScheduleBatch") -> bool:
+ if self._requests is None or batch.forward_mode.is_idle():
+ return False
+ return self._requests.select(batch.reqs, self._rounds.plain_width(len(batch.reqs)))
+
+ def publish(self, on_publish, result: "GenerationBatchResult") -> None:
+ """Publish native lengths through the host-compatible relay."""
+ assert self._requests is not None
+ self._requests.publish(on_publish, result)
+
+ def run(self, batch: "ScheduleBatch", grammar_barrier=None) -> "GenerationBatchResult":
+ if grammar_barrier is not None:
+ grammar_barrier()
+ self._rounds.round_start(len(batch.reqs), 0, batch)
+ return plain_decode(batch, self._target_worker, self._req_to_token)
+
+
+def plain_decode(
+ batch: "ScheduleBatch", target_worker: "TpModelWorker", req_to_token: torch.Tensor
+) -> "GenerationBatchResult":
+ """Consume the bonus token in the already-reserved EAGLE KV slot.
+
+ The scheduler has already reserved KV, accumulated penalties, and advanced
+ request decode counters. Repeating its ordinary decode preparation would
+ allocate twice. The caller must never resume drafting from the carried state.
+ """
+ draft_input = batch.spec_info
+ algorithm = batch.spec_algorithm
+ batch.input_ids = draft_input.bonus_tokens.to(torch.int64)
+ batch.out_cache_loc = req_to_token[batch.req_pool_indices.long(), batch.seq_lens.long()]
+ batch.seq_lens = batch.seq_lens + 1
+ if batch.seq_lens_cpu is not None:
+ batch.seq_lens_cpu = batch.seq_lens_cpu + 1
+ batch.seq_lens_sum = None
+ batch.spec_info = None
+ batch.spec_algorithm = SpeculativeAlgorithm.NONE
+ batch.forward_mode = ForwardMode.DECODE
+ try:
+ result = target_worker.forward_batch_generation(batch, capture_hidden_mode=CaptureHiddenMode.FULL)
+ finally:
+ batch.spec_algorithm = algorithm
+ batch.spec_info = draft_input
+ if batch.return_logprob:
+ # The overlap result consumer expects a padded accepted-token dimension.
+ result.logits_output.next_token_logprobs = result.logits_output.next_token_logprobs[:, None]
+ result.new_seq_lens = batch.seq_lens
+ # Exactly one token per row: the next lengths are known on host, so the relay needs no device pull.
+ result.new_seq_lens_cpu = batch.seq_lens_cpu
+ result.speculative_num_draft_tokens = 1
+ result.accept_lens = torch.ones_like(batch.seq_lens, dtype=torch.int32)
+ result.accept_index = torch.arange(len(batch.seq_lens), dtype=torch.int32, device=batch.seq_lens.device)[:, None]
+ result.next_draft_input = copy.copy(draft_input)
+ result.next_draft_input.bonus_tokens = result.next_token_ids
+ return result
diff --git a/eagle_harness/sglang/plugin.py b/eagle_harness/sglang/plugin.py
new file mode 100644
index 0000000..92e98e3
--- /dev/null
+++ b/eagle_harness/sglang/plugin.py
@@ -0,0 +1,57 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""sglang plugin entry point (group ``sglang.srt.plugins``, see pyproject.toml).
+
+``sglang.srt.plugins.load_plugins()`` calls :func:`register` once per process,
+before server arguments are resolved. It registers the EAGLE_HARNESS algorithm
+and the EAGLE-4 draft model class; it patches nothing. On an sglang whose hooks
+differ from :data:`eagle_harness.sglang.hooks.HOOKS` it registers nothing and
+logs an error with the sglang version, the mismatches and the fix
+(:mod:`eagle_harness.compat`), so ``--speculative-algorithm EAGLE_HARNESS`` is
+then unknown; sglang itself keeps working.
+"""
+
+from __future__ import annotations
+
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+MODEL_PACKAGE = "eagle_harness.sglang.models"
+DRAFT_ARCHITECTURE = "LlamaForCausalLMEagle4"
+
+
+def register() -> bool:
+ """Register the EAGLE_HARNESS speculative algorithm and the draft models (idempotent).
+
+ Returns False, registering nothing, when the installed sglang lacks a hook the plugin needs.
+ """
+ from eagle_harness.compat import check_for_registration
+
+ if not check_for_registration("sglang"):
+ return False
+
+ from sglang.srt.models.registry import ModelRegistry
+ from sglang.srt.speculative.spec_info import SpeculativeAlgorithm
+
+ from eagle_harness.sglang.algorithm import ALGORITHM_NAME, EagleHarnessSpecAlgo
+
+ try:
+ SpeculativeAlgorithm.from_string(ALGORITHM_NAME)
+ return True # already registered in this process
+ except ValueError:
+ pass
+
+ if DRAFT_ARCHITECTURE not in ModelRegistry.get_supported_archs():
+ ModelRegistry.register(MODEL_PACKAGE, strict=True)
+
+ @SpeculativeAlgorithm.register(ALGORITHM_NAME, supports_overlap=True, spec_class=EagleHarnessSpecAlgo)
+ def _worker_class(server_args):
+ from eagle_harness.sglang.worker import EagleHarnessWorker
+
+ return EagleHarnessWorker
+
+ logger.info("eagle-harness: registered speculative algorithm %s and models from %s", ALGORITHM_NAME, MODEL_PACKAGE)
+ return True
diff --git a/eagle_harness/sglang/row_attention.py b/eagle_harness/sglang/row_attention.py
new file mode 100644
index 0000000..c7ef416
--- /dev/null
+++ b/eagle_harness/sglang/row_attention.py
@@ -0,0 +1,218 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""sglang attention backend of the decode-time draft forwards (draft steps and the draft extend after verify).
+
+The rows of a request share most of their keys; :mod:`eagle_harness.kernels.row_attention` attends them, reading
+the keys through sglang's ``req_to_token`` (one token per page, rows picked by ``req_pool_indices``):
+
+- draft step ``i`` (``K`` frontier rows per request at position ``seq_len[b] + i - 1``): the committed draft KV inside
+ the draft's sliding window plus the row's ``i`` tree ancestors, whose KV slots :attr:`DraftTree.ancestors` keeps
+ (:meth:`DraftRowAttention.build_tree_rows` also allocates the step's slots and records them as the new ancestors);
+- draft extend (``W`` causal rows per request at ``seq_len[b] + j``): the positions ``[pos - window + 1, pos]``.
+
+The prefill draft extend keeps sglang's attention backend.
+"""
+
+from __future__ import annotations
+
+from typing import Optional, Tuple
+
+import torch
+import triton
+import triton.language as tl
+from sglang.srt.layers.attention.base_attn_backend import AttentionBackend
+from sglang.srt.runtime_context import get_parallel
+
+from eagle_harness.kernels.row_attention import RowsLaunch, rows_attention, rows_padded
+
+# Per mode, the fastest of a sweep at the TP4 draft shapes on B300 (10 heads x 128, 148 SMs, window 4096, bs 1,
+# contexts 1k-4k; attention + merge in a CUDA graph with a cold L2); neighbouring split counts are within ~10%.
+# The sweep's winners put 4 waves of (head, split) programs on the SMs for a step (64 splits) and 1.5 for the extend
+# (24); other GPUs and TP sizes keep those waves (draft_launches). Fixed per server, not autotuned, so the merge
+# order of the splits, and so the outputs, stay the same run to run.
+STEP_WAVES, EXTEND_WAVES = 4.0, 1.5
+STEP_LAUNCH = RowsLaunch(splits=64, block_n=64) # a draft step's top-K rows, at the reference shape
+EXTEND_LAUNCH = RowsLaunch(splits=24, block_n=128) # the draft extend's causal rows, at the reference shape
+MAX_SPLITS = max(STEP_LAUNCH.splits, EXTEND_LAUNCH.splits)
+
+
+def draft_launches(heads: int, device: torch.device) -> Tuple[RowsLaunch, RowsLaunch]:
+ """The (step, extend) launches for ``heads`` draft heads per rank on ``device``: the key splits that keep the
+ reference sweep's program waves (a step's splits a power of two, the extend's a multiple of 8; at most 128)."""
+ if device.type != "cuda":
+ return STEP_LAUNCH, EXTEND_LAUNCH
+ sms = torch.cuda.get_device_properties(device).multi_processor_count
+ step = min(triton.next_power_of_2(triton.cdiv(int(STEP_WAVES * sms), heads)), 128)
+ extend = min(triton.cdiv(triton.cdiv(int(EXTEND_WAVES * sms), heads), 8) * 8, 128)
+ return RowsLaunch(splits=step, block_n=STEP_LAUNCH.block_n), RowsLaunch(splits=extend, block_n=EXTEND_LAUNCH.block_n)
+
+
+def _tree_rows_kernel(
+ req_to_token,
+ req_to_token_stride,
+ req_pool_indices,
+ seq_lens,
+ ancestors,
+ slots_out,
+ positions_out,
+ step,
+ max_depth: tl.constexpr,
+ top_k: tl.constexpr,
+):
+ row = tl.program_id(0)
+ b = row // top_k
+ lane = row % top_k
+ seq_len = tl.load(seq_lens + b).to(tl.int32)
+ req = tl.load(req_pool_indices + b).to(tl.int64)
+ # This step's draft KV slot of the row: the block table entry after the committed length and the
+ # earlier steps' slots (K per step), one per lane.
+ own = tl.load(req_to_token + req * req_to_token_stride + seq_len + (step - 1) * top_k + lane)
+ tl.store(ancestors + row * max_depth + step - 1, own)
+ tl.store(slots_out + row, own)
+ tl.store(positions_out + row, seq_len + step - 1)
+
+
+def _extend_rows_kernel(
+ req_to_token,
+ req_to_token_stride,
+ req_pool_indices,
+ seq_lens,
+ accept_lens,
+ slots_out,
+ positions_out,
+ last_out,
+ width: tl.constexpr,
+):
+ row = tl.program_id(0)
+ b = row // width
+ j = row % width
+ seq_len = tl.load(seq_lens + b).to(tl.int32)
+ req = tl.load(req_pool_indices + b).to(tl.int64)
+ tl.store(slots_out + row, tl.load(req_to_token + req * req_to_token_stride + seq_len + j))
+ tl.store(positions_out + row, seq_len + j)
+ if j == 0: # the row whose output seeds the next round: the last accepted token's
+ tl.store(last_out + b, b * width + tl.load(accept_lens + b) - 1)
+
+
+class DraftRowAttention(AttentionBackend):
+ """Attention backend of the draft steps and the decode draft extend (decode mode only)."""
+
+ needs_cpu_seq_lens = False
+
+ def __init__(self, draft_runner, *, max_bs: int, max_rows_per_request: int, window: Optional[int]):
+ """``max_rows_per_request``: the widest row group (the tree's top-``K`` or the extend's width)."""
+ super().__init__()
+ self.token_to_kv_pool = draft_runner.token_to_kv_pool
+ self.req_to_token = draft_runner.req_to_token_pool.req_to_token
+ self.window = int(window or 0)
+ device = self.req_to_token.device
+ config = draft_runner.model_config
+ self.num_heads = config.num_attention_heads // get_parallel().attn_tp_size
+ self.head_dim = config.head_dim
+ self.step_launch, self.extend_launch = draft_launches(self.num_heads, device)
+ splits = max(self.step_launch.splits, self.extend_launch.splits)
+ parts = max_bs * self.num_heads * (splits + 1) * rows_padded(max_rows_per_request)
+ self.part_out = torch.empty(parts, self.head_dim, dtype=torch.float32, device=device)
+ self.part_lse = torch.empty(parts, dtype=torch.float32, device=device)
+ # The row forward's ForwardBatch needs per-row request indices and lengths, which nothing reads
+ # (the rows' keys come from the group build_*_rows sets); one static buffer stands in for both.
+ self.unread_rows = torch.zeros(max_bs * max_rows_per_request, dtype=torch.int64, device=device)
+ # (rows per request, step (0: extend), seq_lens, req_pool_indices, ancestors) of the next forward.
+ self._group = None
+
+ def build_tree_rows(
+ self,
+ ancestors: torch.Tensor,
+ seq_lens: torch.Tensor,
+ req_pool_indices: torch.Tensor,
+ slots: torch.Tensor,
+ positions: torch.Tensor,
+ *,
+ bs: int,
+ step: int,
+ ) -> None:
+ """Rows of draft step ``step``, ``K`` per request (``ancestors``: ``[bs, K, max_depth]`` int32).
+
+ Allocates the step's KV slots (``slots`` and ``positions``: ``[bs * K]`` int64, written) and
+ records them as column ``step - 1`` of ``ancestors``.
+ """
+ _, top_k, max_depth = ancestors.shape
+ if not ancestors.is_contiguous():
+ raise ValueError("ancestors must be contiguous")
+ _tree_rows_kernel[(bs * top_k,)](
+ self.req_to_token,
+ self.req_to_token.stride(0),
+ req_pool_indices,
+ seq_lens,
+ ancestors,
+ slots,
+ positions,
+ step,
+ max_depth=max_depth,
+ top_k=top_k,
+ )
+ self._group = (top_k, step, seq_lens, req_pool_indices, ancestors)
+
+ def build_extend_rows(
+ self,
+ seq_lens: torch.Tensor,
+ req_pool_indices: torch.Tensor,
+ accept_lens: torch.Tensor,
+ slots: torch.Tensor,
+ positions: torch.Tensor,
+ last: torch.Tensor,
+ *,
+ bs: int,
+ width: int,
+ ) -> None:
+ """Rows of a causal extend, ``width`` per request, the first at position ``seq_lens``.
+
+ Writes the rows' KV slots and positions (``slots``, ``positions``: ``[bs * width]`` int64, the block
+ table entries from the committed length on) and ``last`` (``[bs]`` int64): each request's row of its
+ last accepted token, ``b * width + accept_lens[b] - 1``.
+ """
+ _extend_rows_kernel[(bs * width,)](
+ self.req_to_token,
+ self.req_to_token.stride(0),
+ req_pool_indices,
+ seq_lens,
+ accept_lens,
+ slots,
+ positions,
+ last,
+ width=width,
+ )
+ self._group = (width, 0, seq_lens, req_pool_indices, None)
+
+ def init_forward_metadata(self, forward_batch) -> None:
+ """Metadata comes from :meth:`build_tree_rows` / :meth:`build_extend_rows`."""
+
+ def forward_decode(self, q, k, v, layer, forward_batch, save_kv_cache=True, **kwargs) -> torch.Tensor:
+ """Attention of the rows over the committed window and, in a draft step, their tree ancestors."""
+ if save_kv_cache:
+ self.token_to_kv_pool.set_kv_buffer(layer, forward_batch.out_cache_loc, k, v)
+ rows = q.shape[0]
+ q = q.view(rows, self.num_heads, self.head_dim)
+ out = torch.empty_like(q)
+ rows_per_request, step, seq_lens, req_pool_indices, ancestors = self._group
+ rows_attention(
+ q,
+ self.token_to_kv_pool.get_key_buffer(layer.layer_id),
+ self.token_to_kv_pool.get_value_buffer(layer.layer_id),
+ out,
+ self.part_out,
+ self.part_lse,
+ self.req_to_token,
+ seq_lens,
+ ancestors,
+ rows_per_request=rows_per_request,
+ step=step,
+ window=self.window,
+ scale=layer.scaling,
+ launch=self.extend_launch if step == 0 else self.step_launch,
+ table_rows=req_pool_indices,
+ )
+ return out.view(rows, self.num_heads * self.head_dim)
diff --git a/eagle_harness/sglang/tail_mask.py b/eagle_harness/sglang/tail_mask.py
new file mode 100644
index 0000000..6c6216c
--- /dev/null
+++ b/eagle_harness/sglang/tail_mask.py
@@ -0,0 +1,114 @@
+# SPDX-FileCopyrightText: Copyright 2025-2026 NVIDIA
+# SPDX-FileCopyrightText: Copyright 2023-2026 FlashInfer community (https://flashinfer.ai/)
+# The attention variant below is derived from FlashInfer (Apache-2.0) include/flashinfer/attention/variants.cuh
+# (DefaultAttention). Modified by Eagle AI Corp: the mask reads one tail word per query row. Notices and license
+# texts: THIRD_PARTY_NOTICES.md and LICENSES/.
+"""FlashInfer's FA2 paged prefill with a tree-tail mask, for the tree verify.
+
+A tree verify attends ``width`` query rows to ``kv_len`` keys: every key before
+the tree is visible to every row, the last ``width`` keys (the tree) to the
+row's ancestors and itself. FlashInfer's custom-mask path loads one mask bit per
+(query, key) element on every KV tile and needs ``width * kv_len`` bits written
+and packed each round. This module compiles the same kernels (FlashInfer's FA2
+templates and JIT flags, ``MaskMode::kCustom``) with an attention variant whose
+mask is the stock mask evaluated from the tail alone: keys before the tail are
+visible without a load, tail key ``kv_len - width + j`` is bit ``j`` of one
+uint64 per query row, stored at the row's ``qo_indptr`` position in the custom
+mask buffer. Outputs are the stock kernel's, bit for bit, as long as the prefix
+is all-visible.
+
+:func:`jit_args` are the arguments of FlashInfer's public
+``gen_customize_batch_prefill_module``: a wrapper built with them
+(``BatchPrefillWithPagedKVCacheWrapper(jit_args=..., variant_owns_mask=True)``)
+runs this variant, and FlashInfer passes it the stock parameters by name.
+"""
+
+from __future__ import annotations
+
+import functools
+
+import torch
+
+MAX_WIDTH = 64 # the tail word is a uint64 per query row
+
+VARIANT_NAME = "TreeTailMaskAttention"
+
+# Same members and arithmetic as flashinfer::DefaultAttention<true, false, false, false> except the mask lookup.
+VARIANT_DECL = r"""
+#include <flashinfer/attention/variant_helper.cuh>
+
+struct TreeTailMaskAttention : flashinfer::AttentionVariantBase {
+ static constexpr bool use_softmax = true;
+
+ const uint64_t* tail_bits;
+ uint32_t qo_len, kv_len, tail_start;
+ uint32_t window_left;
+ float sm_scale_log2;
+
+ template <typename Params>
+ __device__ __host__ TreeTailMaskAttention(const Params& params, uint32_t batch_idx, uint8_t* smem_ptr) {
+ qo_len = params.get_qo_len(batch_idx);
+ kv_len = params.get_kv_len(batch_idx);
+ sm_scale_log2 = params.sm_scale * flashinfer::math::log2e;
+ tail_bits = reinterpret_cast<const uint64_t*>(params.maybe_custom_mask) + params.q_indptr[batch_idx];
+ tail_start = kv_len > qo_len ? kv_len - qo_len : 0;
+ window_left = (params.window_left >= 0) ? params.window_left : kv_len;
+ }
+
+ REGISTER_LOGITS_MASK(params, batch_idx, qo_idx, kv_idx, qo_head_idx, kv_head_idx, {
+ bool mask = true;
+ if (qo_idx >= qo_len || kv_idx >= kv_len) {
+ mask = false;
+ } else if (kv_idx >= tail_start) {
+ mask = (tail_bits[qo_idx] >> (kv_idx - tail_start)) & 1;
+ }
+ return mask;
+ })
+};
+"""
+
+# The stock FA2 module's additional parameters (gen_batch_prefill_module); FlashInfer fills them by name.
+_TENSOR_NAMES = [
+ "maybe_custom_mask",
+ "maybe_mask_indptr",
+ "maybe_alibi_slopes",
+ "maybe_prefix_len_ptr",
+ "maybe_token_pos_in_items_ptr",
+ "maybe_max_item_len_ptr",
+ "maybe_k_cache_sf",
+ "maybe_v_cache_sf",
+]
+_TENSOR_DTYPES = ["uint8_t", "int32_t", "float", "uint32_t", "uint16_t", "uint16_t", "uint8_t", "uint8_t"]
+_SCALAR_NAMES = ["logits_soft_cap", "sm_scale", "rope_rcp_scale", "rope_rcp_theta", "token_pos_in_items_len"]
+_SCALAR_DTYPES = ["double", "double", "double", "double", "int64_t"]
+
+
+def supported(q_dtype: torch.dtype, kv_dtype: torch.dtype) -> bool:
+ """Whether the tail-mask variant covers a wrapper's dtypes: 16-bit q and kv of one dtype."""
+ return q_dtype == kv_dtype and q_dtype in (torch.float16, torch.bfloat16)
+
+
+def jit_args(dtype: torch.dtype, head_dim: int) -> tuple:
+ """Arguments of FlashInfer's ``gen_customize_batch_prefill_module`` for the tail-mask FA2 variant with q,
+ kv and output of ``dtype`` and int32 indices (the ``jit_args`` of a prefill wrapper)."""
+ from flashinfer.jit.attention import get_batch_prefill_uri
+
+ uri = "tree_tail_mask_" + get_batch_prefill_uri(
+ "fa2", dtype, dtype, dtype, torch.int32, head_dim, head_dim, 0, False, False, False
+ )
+ return (
+ uri,
+ dtype,
+ dtype,
+ dtype,
+ torch.int32,
+ head_dim,
+ head_dim,
+ _TENSOR_NAMES,
+ _TENSOR_DTYPES,
+ _SCALAR_NAMES,
+ _SCALAR_DTYPES,
+ VARIANT_NAME,
+ VARIANT_DECL,
+ )
diff --git a/eagle_harness/sglang/verify_graphs.py b/eagle_harness/sglang/verify_graphs.py
new file mode 100644
index 0000000..58f9924
--- /dev/null
+++ b/eagle_harness/sglang/verify_graphs.py
@@ -0,0 +1,108 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Target-verify CUDA graphs per verify width (hook H7).
+
+The cost model picks the verify width of each round from the cost table's
+buckets (:func:`eagle_harness.core.limits.verify_buckets`). The target's
+decode runner captures one TARGET_VERIFY graph per (batch size, width) through
+sglang's ``DecodeGraphVariants`` hook; a round replays the graph of its width.
+
+At batch size 1 every tree width gets a second graph, keyed ``a<width>``, captured
+with a :class:`~.verify_input.HarnessVerifyInput` whose ``greedy_tokens_only`` is
+set: sglang's logits processor then returns the rows' greedy tokens from the vocab
+shards instead of gathering the logits. A round replays it when its verify input
+is greedy (a greedy round of the fused accept tail). The batch-size-1 graphs are
+captured with the tree-tail mask attention (:class:`~.verify_plan.TreeTailMask`).
+"""
+
+from __future__ import annotations
+
+from typing import Dict, Optional, Sequence
+
+from sglang.srt.model_executor.forward_batch_info import ForwardMode
+from sglang.srt.model_executor.runner.decode_graph_variants import DecodeGraphVariant, DecodeGraphVariants
+
+from eagle_harness.core.limits import ComputeIntensity, verify_buckets
+from eagle_harness.sglang.verify_input import HarnessVerifyInput
+from eagle_harness.sglang.verify_plan import TreeTailMask
+
+
+def verify_widths(batch_size: int, intensity: ComputeIntensity, max_width: int) -> list:
+ """Verify widths with a graph at ``batch_size``, widest first (``max_width`` and 1 always included)."""
+ widths = {w for w in verify_buckets(batch_size, intensity) if w <= max_width}
+ widths.update((1, max_width))
+ return sorted(widths, reverse=True)
+
+
+def round_up_width(width: int, widths: Sequence[int]) -> int:
+ """The smallest captured width ``>= width`` (``widths`` must contain one)."""
+ fitting = [w for w in widths if w >= width]
+ if not fitting:
+ raise ValueError(f"verify width {width} exceeds every captured width {list(widths)}")
+ return min(fitting)
+
+
+class VerifyWidthGraphs(DecodeGraphVariants):
+ """One target-verify graph per verify width, keyed ``w<width>``, and at batch size 1 one greedy graph
+ per tree width, keyed ``a<width>``."""
+
+ def __init__(
+ self,
+ intensity: ComputeIntensity,
+ max_width: int,
+ tail_mask: TreeTailMask,
+ greedy: bool = True,
+ *,
+ plain_decode: bool = False,
+ ):
+ self.intensity = intensity
+ self.max_width = max_width
+ self.tail_mask = tail_mask
+ self.greedy = greedy
+ if plain_decode and not hasattr(DecodeGraphVariant, "forward_mode"):
+ raise RuntimeError("Native no-spec fallback requires SGLang's per-variant forward-mode graph contract.")
+ self._plain = DecodeGraphVariant("decode", 1, ForwardMode.DECODE) if plain_decode else None
+ self._variants: Dict[int, DecodeGraphVariant] = {}
+ self._argmax_variants: Dict[int, DecodeGraphVariant] = {}
+
+ def _variant(self, width: int, argmax: bool = False) -> DecodeGraphVariant:
+ table = self._argmax_variants if argmax else self._variants
+ variant = table.get(width)
+ if variant is None:
+ variant = table[width] = DecodeGraphVariant(f"{'a' if argmax else 'w'}{width}", width)
+ return variant
+
+ def capture_variants(self, bs: int) -> Sequence[DecodeGraphVariant]:
+ """The verify-width graphs to capture for a batch size (the argmax graphs last)."""
+ widths = verify_widths(bs, self.intensity, self.max_width)
+ variants = [self._variant(w) for w in widths]
+ if self.greedy and bs == 1:
+ variants += [self._variant(w, argmax=True) for w in widths if w > 1]
+ if self._plain is not None:
+ variants.append(self._plain)
+ return variants
+
+ def replay_variant(self, forward_batch) -> Optional[DecodeGraphVariant]:
+ """The graph variant of this forward's verify width (its greedy graph for a greedy input), None for
+ other forwards."""
+ if self._plain is not None and forward_batch.forward_mode.is_decode():
+ return self._plain
+ spec = forward_batch.spec_info
+ table = self._argmax_variants if getattr(spec, "greedy_tokens_only", False) else self._variants
+ return table.get(getattr(spec, "draft_token_num", None))
+
+ def begin_capture(self, variant, forward_batch, attn_backend, stream_idx):
+ """Capture the variant with the harness's verify input at the variant's width (greedy for a greedy
+ variant, with the tail-mask attention); return the attention backend."""
+ if variant is self._plain:
+ forward_batch.spec_info = None
+ return attn_backend
+ greedy = self._argmax_variants.get(variant.num_tokens_per_req) is variant
+ spec = forward_batch.spec_info = HarnessVerifyInput.from_eagle(
+ forward_batch.spec_info, greedy_tokens_only=greedy, tail_mask=self.tail_mask
+ )
+ spec.draft_token_num = variant.num_tokens_per_req
+ spec.num_tokens_per_req = variant.num_tokens_per_req
+ spec.num_tokens_for_logprob_per_req = variant.num_tokens_per_req
+ return attn_backend
diff --git a/eagle_harness/sglang/verify_input.py b/eagle_harness/sglang/verify_input.py
new file mode 100644
index 0000000..f65a404
--- /dev/null
+++ b/eagle_harness/sglang/verify_input.py
@@ -0,0 +1,109 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The harness's EAGLE verify input: sglang's, plus the tree-tail mask attention of its batch-size-1 verify
+graphs and the CSR attention args the draft's verify-input graph builds for them.
+
+With :attr:`HarnessVerifyInput.greedy_tokens_only` set (a greedy round), the target forward returns the
+verify rows' argmax (``LogitsProcessorOutput.next_token_ids``) instead of gathering their logits; the
+target-verify graphs of a greedy batch-size-1 round are captured with such an input
+(:class:`.verify_graphs.VerifyWidthGraphs`).
+"""
+
+from __future__ import annotations
+
+import dataclasses
+from typing import TYPE_CHECKING, Optional, Tuple
+
+import torch
+
+from sglang.kernels.ops.attention.utils import create_flashinfer_kv_indices_triton
+from sglang.srt.mem_cache.kv_loc_plan import IdSpaceKind
+from sglang.srt.speculative.eagle_info import EagleVerifyInput
+
+if TYPE_CHECKING:
+ from sglang.srt.mem_cache.kv_index_translator import KVIndexTranslator
+ from sglang.srt.mem_cache.kv_loc_plan import KVLocPlan
+ from sglang.srt.speculative.spec_info import FlashInferVerifyVariant
+
+ from eagle_harness.sglang.verify_plan import TreeTailMask
+
+
+def build_attn_args(
+ req_to_token: torch.Tensor,
+ req_pool_indices: torch.Tensor,
+ seq_lens: torch.Tensor,
+ width: int,
+ kv_indices: torch.Tensor,
+) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
+ """sglang's CSR args of a one-request verify of ``width`` tokens over untranslated KV ids
+ (``EagleVerifyInput.generate_attn_arg_prefill``), from device lengths, so the launches can sit in a
+ CUDA graph: ``(kv_indices, kv_indptr, qo_indptr)``, kv_indices written into ``kv_indices`` (room for
+ the request's row)."""
+ kv_lens = seq_lens[:1] + width
+ kv_indptr = torch.zeros(2, dtype=torch.int32, device=kv_indices.device)
+ kv_indptr[1:] = kv_lens
+ create_flashinfer_kv_indices_triton[(1,)](
+ req_to_token, req_pool_indices, kv_lens, kv_indptr, None, kv_indices, req_to_token.stride(0)
+ )
+ qo_indptr = torch.arange(0, 2 * width, width, dtype=torch.int32, device=kv_indices.device)
+ return kv_indices, kv_indptr, qo_indptr
+
+
+class HarnessVerifyInput(EagleVerifyInput):
+ """``EagleVerifyInput`` with the greedy-ids flag and the tail mask."""
+
+ @classmethod
+ def from_eagle(cls, verify_input: EagleVerifyInput, **extra):
+ """This class's verify input with the fields of sglang's (and ``extra`` fields of this class)."""
+ fields = (f.name for f in dataclasses.fields(EagleVerifyInput) if f.init)
+ return cls(**{name: getattr(verify_input, name) for name in fields}, **extra)
+
+ # A greedy round: the target returns the rows' argmax, not their logits.
+ greedy_tokens_only: bool = False
+ # The tail-mask attention of the batch-size-1 verify graphs (set on the inputs they are captured with).
+ tail_mask: Optional["TreeTailMask"] = dataclasses.field(default=None, repr=False)
+ # (kv_indices, kv_indptr, qo_indptr) of a one-request verify over untranslated KV ids, built with the rest
+ # of the input in the draft's verify-input graph; kv_indices has room for the request's whole row.
+ prepared_attn_args: Optional[Tuple[torch.Tensor, torch.Tensor, torch.Tensor]] = dataclasses.field(
+ default=None, repr=False
+ )
+
+ def generate_attn_arg_prefill(
+ self,
+ *,
+ req_pool_indices: torch.Tensor,
+ paged_kernel_lens: torch.Tensor,
+ paged_kernel_lens_sum: int,
+ translator: "KVIndexTranslator",
+ plan: "KVLocPlan",
+ kind: IdSpaceKind = IdSpaceKind.FULL,
+ ):
+ """sglang's CSR verify args; the prepared ones when this input carries them for these reads (one
+ request, ids read untranslated), so the replay launches nothing for them."""
+ args = self.prepared_attn_args
+ if (
+ args is None
+ or req_pool_indices.numel() != 1
+ or kind is not IdSpaceKind.FULL
+ or translator.reads_are_translated
+ ):
+ return super().generate_attn_arg_prefill(
+ req_pool_indices=req_pool_indices,
+ paged_kernel_lens=paged_kernel_lens,
+ paged_kernel_lens_sum=paged_kernel_lens_sum,
+ translator=translator,
+ plan=plan,
+ kind=kind,
+ )
+ kv_indices, kv_indptr, qo_indptr = args
+ return kv_indices[: paged_kernel_lens_sum + self.draft_token_num], kv_indptr, qo_indptr, self.custom_mask
+
+ def flashinfer_verify_variant(
+ self, bs: int, num_tokens: int, *, q_dtype: torch.dtype, kv_dtype: torch.dtype, head_dim: int
+ ) -> Optional["FlashInferVerifyVariant"]:
+ """The tail-mask variant of a batch-size-1 verify graph under capture, else None."""
+ if self.tail_mask is None:
+ return None
+ return self.tail_mask.variant(bs, num_tokens, q_dtype, kv_dtype, head_dim)
diff --git a/eagle_harness/sglang/verify_plan.py b/eagle_harness/sglang/verify_plan.py
new file mode 100644
index 0000000..eb55015
--- /dev/null
+++ b/eagle_harness/sglang/verify_plan.py
@@ -0,0 +1,55 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree-tail mask attention of the batch-size-1 tree verify (FlashInfer variant).
+
+sglang plans each target-verify replay from host-known lengths, but its tree
+mask is a packed ``[width x kv_len]`` bit array that the kernel loads on every
+KV tile. The tail-mask variant (:mod:`.tail_mask`) needs only one 64-bit word
+per query row. A :class:`TreeTailMask` gives sglang that variant for the
+``(1, width)`` verify graphs (``SpecInput.flashinfer_verify_variant``, through
+FlashInfer's public ``jit_args``) and owns the mask buffer the variant reads,
+which the draft's verify-input graph fills each round (:meth:`TreeTailMask.write`).
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import Optional, Set
+
+import torch
+
+from sglang.srt.speculative.spec_info import FlashInferVerifyVariant
+
+from eagle_harness.kernels.verify_prep import MAX_TAIL_WIDTH, tree_tail_words
+from eagle_harness.sglang import tail_mask
+
+logger = logging.getLogger(__name__)
+
+
+class TreeTailMask:
+ """The tail-mask variant of the batch-size-1 verify graphs and the words it reads."""
+
+ def __init__(self, device: torch.device):
+ # Words of the rows at qo_indptr 0..width-1 (one request), 8-byte aligned.
+ self.tail_bits = torch.zeros(MAX_TAIL_WIDTH, dtype=torch.int64, device=device)
+ self.widths: Set[int] = set() # verify widths whose graph runs the variant
+
+ def variant(
+ self, bs: int, num_tokens: int, q_dtype: torch.dtype, kv_dtype: torch.dtype, head_dim: int
+ ) -> Optional[FlashInferVerifyVariant]:
+ """The variant of a ``(bs, num_tokens)`` verify graph under capture: batch size 1, a tree of at
+ most :data:`MAX_TAIL_WIDTH` tokens, 16-bit q and kv; else None (sglang's mask kernel)."""
+ if bs != 1 or not 1 < num_tokens <= MAX_TAIL_WIDTH or not tail_mask.supported(q_dtype, kv_dtype):
+ return None
+ self.widths.add(num_tokens)
+ logger.info("Tree verify at batch size 1, width %d: tree-tail mask attention.", num_tokens)
+ return FlashInferVerifyVariant(
+ jit_args=tail_mask.jit_args(q_dtype, head_dim), mask_buf=self.tail_bits.view(torch.uint8)
+ )
+
+ def write(self, mask: torch.Tensor, committed_len: torch.Tensor, width: int) -> None:
+ """Write the words of one request's verify of ``width`` tokens from its flattened ``[width, kv_len]``
+ mask, when its graph runs the variant (one launch; device inputs, so it can be graph-captured)."""
+ if width in self.widths:
+ tree_tail_words(mask, committed_len, self.tail_bits, width)
diff --git a/eagle_harness/sglang/verify_step.py b/eagle_harness/sglang/verify_step.py
new file mode 100644
index 0000000..c6b7d5c
--- /dev/null
+++ b/eagle_harness/sglang/verify_step.py
@@ -0,0 +1,210 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The accept step of a batch-size-1 greedy tree round, fused.
+
+sglang's ``run_eagle_verify`` ends in about thirty tiny kernels: the tree walk,
+accept lengths, the bonus token, the KV slots of the accepted path, and the
+compaction of the accepted path to the front. :func:`fused_accept_step` replaces
+them with :func:`eagle_harness.kernels.accept_tail.accept_tail` and
+:func:`...compact_rows` through sglang's ``accept_step`` hook of
+``run_eagle_verify``; the verify preparation, the target forward, the state
+commit of the accepted path and the result stay sglang's. Rounds it does not cover (other batch sizes, sampling,
+grammar, logprobs, chains) run sglang's accept code
+(:func:`fused_accept_supported`).
+
+When the verify input came from the draft's graphs and the target forward
+replayed a graph, every input of the step (target tokens, hidden states, the
+verify input's tables, the staged lengths) sits in a static buffer, so the step
+(acceptance, KV move, row compaction) replays as one CUDA graph per set of
+buffers (:class:`AcceptTailGraphs`).
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Set, Tuple
+
+import torch
+
+from sglang.srt.speculative.eagle_worker_common import VerifyAcceptInput, VerifyAcceptResult, VerifyAcceptStep
+
+from eagle_harness.kernels.accept_tail import Accepted, accept_tail, compact_rows
+from eagle_harness.sglang.graph_pool import graph_memory_pool
+
+if TYPE_CHECKING:
+ from sglang.srt.managers.schedule_batch import ScheduleBatch
+ from sglang.srt.mem_cache.memory_pool import ReqToTokenPool
+
+ from eagle_harness.sglang.draft_extend import DraftExtend
+
+logger = logging.getLogger(__name__)
+
+# Captured tails at most; a key past it runs eagerly (a guard against inputs that are not static).
+MAX_TAIL_GRAPHS = 256
+
+
+def fused_accept_supported(batch: "ScheduleBatch", topk: int, kv_pool: Any) -> bool:
+ """Whether the fused accept tail serves this round: one greedy request of a tree (``topk > 1``) without
+ grammar, logprobs, penalties or logit bias."""
+ sampling = batch.sampling_info
+ return (
+ topk > 1
+ and len(batch.seq_lens) == 1
+ and not batch.forward_mode.is_idle()
+ and not batch.has_grammar
+ and not batch.return_logprob
+ and sampling.is_all_greedy
+ and sampling.acc_additive_penalties is None
+ and sampling.acc_scaling_penalties is None
+ and sampling.logit_bias is None
+ and getattr(kv_pool, "clear_unaccepted_c128_draft_states", None) is None
+ )
+
+
+class AcceptTailGraphs:
+ """The accept tail of a batch-size-1 verify, one CUDA graph per set of input buffers.
+
+ A key's first round runs eagerly (it compiles the kernels, and the tail is not idempotent: its KV
+ move must run once per round); the second captures and replays. Keys past :data:`MAX_TAIL_GRAPHS`
+ stay eager.
+ """
+
+ def __init__(self) -> None:
+ self._graphs: Dict[Tuple, Tuple[torch.cuda.CUDAGraph, Any]] = {}
+ self._seen: Set[Tuple] = set()
+
+ def run(self, key: Tuple, body: Callable[[], Any]) -> Any:
+ """``body()``'s outputs, replayed from the key's graph once it has one."""
+ entry = self._graphs.get(key)
+ if entry is None:
+ if key not in self._seen or len(self._graphs) >= MAX_TAIL_GRAPHS:
+ if len(self._seen) < 4 * MAX_TAIL_GRAPHS:
+ self._seen.add(key)
+ return body()
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph, pool=graph_memory_pool(), capture_error_mode="thread_local"):
+ outputs = body()
+ entry = self._graphs[key] = (graph, outputs)
+ if len(self._graphs) == MAX_TAIL_GRAPHS:
+ logger.warning("eagle-harness: %d accept-tail graphs; new verify layouts run eagerly", MAX_TAIL_GRAPHS)
+ graph, outputs = entry
+ graph.replay()
+ return outputs
+
+
+def _accept(
+ verify_input: Any,
+ target_tokens: torch.Tensor,
+ hidden_states: Optional[torch.Tensor],
+ seq_lens: torch.Tensor,
+ req_pool_indices: torch.Tensor,
+ out_cache_loc: torch.Tensor,
+ req_to_token: torch.Tensor,
+ kv_cache: Any,
+ extend: Optional["DraftExtend"] = None,
+) -> Tuple[Accepted, Optional[torch.Tensor]]:
+ """Accept, move the KV of the accepted path and compact the hidden states (into the draft extend's input,
+ which this then stages, when ``extend`` is given)."""
+ if target_tokens.dim() == 2: # logits
+ target_tokens = torch.argmax(target_tokens, dim=-1)
+ accepted = accept_tail(
+ target_tokens,
+ verify_input.draft_token,
+ verify_input.retrieve_index,
+ verify_input.retrieve_next_token,
+ verify_input.retrieve_next_sibling,
+ seq_lens,
+ out_cache_loc,
+ req_to_token,
+ req_pool_indices,
+ verify_input.max_tree_depth,
+ )
+ kv_cache.move_kv_cache(accepted.committed_slots, accepted.accepted_slots)
+ if hidden_states is None:
+ return accepted, None
+ out = None if extend is None else extend.hidden_rows(hidden_states.shape[0])
+ compacted = compact_rows(hidden_states, accepted.accept_index, out=out)
+ if extend is not None:
+ extend.stage(accepted.predict, compacted, accepted.accept_lens)
+ return accepted, compacted
+
+
+def fused_accept_step(
+ *,
+ req_to_token_pool: "ReqToTokenPool",
+ token_to_kv_pool_allocator: Any,
+ num_draft_tokens: int,
+ tail_graphs: Optional[AcceptTailGraphs] = None,
+ staged: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
+ extend: Optional["DraftExtend"] = None,
+) -> VerifyAcceptStep:
+ """The ``accept_step`` of ``run_eagle_verify`` for a round :func:`fused_accept_supported` accepts.
+
+ ``staged`` holds static copies of the batch's ``(seq_lens, req_pool_indices)`` (the draft's); with
+ ``tail_graphs`` they let the step replay as a graph. With ``extend`` the step stages the draft extend's
+ input (:meth:`~eagle_harness.sglang.draft_extend.DraftExtend.stage`).
+ """
+
+ def accept_step(inp: VerifyAcceptInput) -> VerifyAcceptResult:
+ verify_input, hidden_states = inp.verify_input, inp.hidden_states
+ # A greedy input gets the rows' tokens; sglang returns logits where it cannot compute them that way.
+ target_tokens = inp.next_token_ids if inp.next_token_ids is not None else inp.next_token_logits
+ kv_cache = token_to_kv_pool_allocator.get_kvcache()
+ req_to_token = req_to_token_pool.req_to_token
+ slots = verify_input.prepared_out_cache_loc
+ static_tail = tail_graphs is not None and staged is not None and inp.can_run_cuda_graph and slots is not None
+ if static_tail:
+ # Every input is a static buffer: the target graph's outputs, the draft graph's verify input, the
+ # draft's staged lengths.
+ seq_lens, req_pool_indices = staged
+ key = (
+ num_draft_tokens,
+ verify_input.max_tree_depth,
+ target_tokens.data_ptr(),
+ None if hidden_states is None else hidden_states.data_ptr(),
+ verify_input.draft_token.data_ptr(),
+ slots.data_ptr(),
+ seq_lens.data_ptr(),
+ )
+ accepted, compacted = tail_graphs.run(
+ key,
+ lambda: _accept(
+ verify_input,
+ target_tokens,
+ hidden_states,
+ seq_lens,
+ req_pool_indices,
+ slots,
+ req_to_token,
+ kv_cache,
+ extend,
+ ),
+ )
+ else:
+ accepted, compacted = _accept(
+ verify_input,
+ target_tokens,
+ hidden_states,
+ inp.seq_lens,
+ inp.req_pool_indices,
+ inp.out_cache_loc,
+ req_to_token,
+ kv_cache,
+ extend,
+ )
+ new_seq_lens = accepted.new_seq_lens
+ if static_tail:
+ # A replayed tail's lengths are a static buffer, which the scheduler makes the next round's
+ # ``batch.seq_lens``: hand it a copy, or the next replay would rewrite the batch's lengths.
+ new_seq_lens = new_seq_lens.clone()
+ return VerifyAcceptResult(
+ next_token_ids=accepted.predict,
+ accept_lens=accepted.accept_lens,
+ accept_index=accepted.accept_index,
+ new_seq_lens=new_seq_lens,
+ bonus_tokens=accepted.bonus_tokens,
+ hidden_states=compacted,
+ )
+
+ return accept_step
diff --git a/eagle_harness/sglang/verify_tail.py b/eagle_harness/sglang/verify_tail.py
new file mode 100644
index 0000000..8606f52
--- /dev/null
+++ b/eagle_harness/sglang/verify_tail.py
@@ -0,0 +1,105 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The device work between a round's last draft step and its verify forward, as small CUDA graphs.
+
+Once the cost model stops the tree, a round ranks the nodes, scores the verify
+sets, selects the best ``width - 1`` and builds sglang's verify input (tree
+mask, positions, retrieve tables): about 40 tiny kernels launched from Python,
+a few hundred microseconds of host time while the GPU idles. Their inputs are
+static buffers (the tree, the staged ``seq_lens`` and bonus tokens), so one
+graph per ``(batch size, depth)`` for the ranking and one per ``(batch size,
+depth, width)`` for the selection and the build replay them with a launch
+each. When the width is known before the ranking (the cost model reads the
+previous round's scores), :meth:`VerifyTail.ranked_verify_input` replays the
+ranking, the hand-off of its scores and the build as one graph. A graph is
+captured the first time its key occurs.
+"""
+
+from __future__ import annotations
+
+from typing import Callable, Dict, NamedTuple, Tuple
+
+import torch
+
+from sglang.srt.speculative.eagle_info import EagleVerifyInput
+
+from eagle_harness.core.draft_tree import DraftTree, VerifySelection
+from eagle_harness.sglang.graph_pool import graph_memory_pool
+
+# (batch size, tree selection, num_steps, num_draft_tokens) -> sglang's verify input.
+BuildInput = Callable[[int, VerifySelection, int, int], EagleVerifyInput]
+
+
+class Ranking(NamedTuple):
+ """A tree's nodes ranked by score, with the cumulative verify scores."""
+
+ ranked: torch.Tensor # [bs, count] node indices, best first
+ scores: torch.Tensor # [count + 1] cumulative verify scores (root first), batch mean
+
+
+def _capture(body: Callable[[], object]):
+ """Run ``body`` once eagerly (Triton compiles), then capture it; returns ``(graph, outputs)``."""
+ body()
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph, pool=graph_memory_pool(), capture_error_mode="thread_local"):
+ outputs = body()
+ return graph, outputs
+
+
+class VerifyTail:
+ """Graph-replayed ranking and verify-input build of a drafted tree."""
+
+ def __init__(self, tree: DraftTree, build_input: BuildInput):
+ self.tree = tree
+ self._build_input = build_input
+ self._rankings: Dict[Tuple[int, int], Tuple[torch.cuda.CUDAGraph, Ranking]] = {}
+ self._inputs: Dict[Tuple[int, int, int], Tuple[torch.cuda.CUDAGraph, EagleVerifyInput]] = {}
+ self._ranked_inputs: Dict[Tuple[int, int, int, int], Tuple[torch.cuda.CUDAGraph, EagleVerifyInput]] = {}
+
+ def rank(self, bs: int, depth: int, count: int) -> Ranking:
+ """The best ``count`` nodes of the ``depth``-level tree and the cumulative scores of their prefixes."""
+ key = (bs, depth)
+ if key not in self._rankings:
+ self._rankings[key] = _capture(lambda: self._rank(bs, depth, count))
+ graph, ranking = self._rankings[key]
+ graph.replay()
+ return ranking
+
+ def verify_input(self, bs: int, depth: int, width: int, ranking: Ranking) -> EagleVerifyInput:
+ """sglang's verify input of the best ``width - 1`` ranked nodes plus the root."""
+ key = (bs, depth, width)
+ if key not in self._inputs:
+ self._inputs[key] = _capture(lambda: self._select(bs, depth, width, ranking))
+ graph, verify_input = self._inputs[key]
+ graph.replay()
+ return verify_input
+
+ def ranked_verify_input(
+ self, bs: int, depth: int, count: int, width: int, on_rank: Callable[[Ranking], None]
+ ) -> EagleVerifyInput:
+ """:meth:`rank`, ``on_rank(ranking)`` (device work, e.g. copying the scores out) and
+ :meth:`verify_input` in one graph replay."""
+ key = (bs, depth, count, width)
+ if key not in self._ranked_inputs:
+
+ def body() -> EagleVerifyInput:
+ ranking = self._rank(bs, depth, count)
+ on_rank(ranking)
+ return self._select(bs, depth, width, ranking)
+
+ self._ranked_inputs[key] = _capture(body)
+ graph, verify_input = self._ranked_inputs[key]
+ graph.replay()
+ return verify_input
+
+ def _rank(self, bs: int, depth: int, count: int) -> Ranking:
+ ranked, scores = self.tree.rank(bs, depth, count)
+ return Ranking(ranked, scores[0] if bs == 1 else scores.mean(dim=0))
+
+ def _select(self, bs: int, depth: int, width: int, ranking: Ranking) -> EagleVerifyInput:
+ # The verify set is ancestor-closed (a parent outranks its children), so its deepest node is at
+ # most width - 1 deep; sglang sizes the accept path by it.
+ steps = min(depth, width - 1)
+ selection = self.tree.select(bs, steps, ranking.ranked, width)
+ return self._build_input(bs, selection, steps, width)
diff --git a/eagle_harness/sglang/worker.py b/eagle_harness/sglang/worker.py
new file mode 100644
index 0000000..3d6e9b2
--- /dev/null
+++ b/eagle_harness/sglang/worker.py
@@ -0,0 +1,442 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EagleHarnessWorker: cost-model dynamic-tree serving on sglang's V2 schema.
+
+One decode round:
+
+1. draft: :class:`DynamicDrafter` grows the tree with the harness's per-step
+ graphs (tree attention, candidate top-k) until the cost model stops it, and
+ picks the verify width;
+2. verify: sglang's EAGLE verify (``run_eagle_verify``: target TARGET_VERIFY
+ forward, tree acceptance, accepted-path KV compaction, GDN state commit) at
+ that width, replaying the width's target graph (hook H7); a greedy batch-size-1
+ round plugs the fused accept step into sglang's ``accept_step`` hook
+ (:mod:`eagle_harness.sglang.verify_step`);
+3. draft extend: :class:`DraftExtend` over the accepted tokens (graph-replayed,
+ the draft's sliding window), which also seeds the next round's depth-1
+ candidates;
+4. prelaunch: the draft extend and then the next round's draft up to its first
+ host decision (:meth:`DynamicDrafter.prelaunch`) run on a side stream, so
+ the scheduler's read of this round's results does not wait for them and
+ they run on the GPU while the scheduler processes this round; the next draft
+ resumes them if the batch holds the same requests, else drafts from scratch.
+
+A chain (top-k 1, ``chain_intensity``) with served round times under ``data_path`` verifies a fixed width per
+batch size instead (:mod:`eagle_harness.sglang.chain_rounds`), and ``"mode": "calibrate"`` forces and times every
+chain width while it serves.
+
+Prefill (target extend with aux hidden capture, then the draft extend) is
+sglang's EAGLE V2 path unchanged. With overlap scheduling, the worker publishes
+lengths after verify and prelaunches on the forward stream for the scheduler's
+FutureMap relay. Synchronous scheduling instead prelaunches the
+next draft on a side stream before waiting for verify.
+"""
+
+from __future__ import annotations
+
+import contextlib
+import logging
+import os
+from typing import TYPE_CHECKING, Optional, Union
+
+import torch
+
+from sglang.srt.distributed.parallel_state import get_tp_group
+from sglang.srt.layers.moe.utils import speculative_moe_a2a_backend_context, speculative_moe_backend_context
+from sglang.srt.model_executor.cuda_graph_config import Backend, Phase, check_cuda_graph_backend
+from sglang.srt.model_executor.runner import get_batch_sizes_to_capture
+from sglang.srt.runtime_context import get_exec, get_model, get_parallel, get_schedule, get_spec
+from sglang.srt.speculative.draft_utils import DraftBackendFactory
+from sglang.srt.speculative.eagle_utils import default_tree_mask_mode
+from sglang.srt.speculative.eagle_worker_common import run_eagle_verify
+from sglang.srt.speculative.eagle_worker_v2 import EagleDraftWorker, EAGLEWorkerV2
+from sglang.srt.speculative.spec_utils import draft_tp_context, spec_stage_span
+from sglang.version import __version__ as sglang_version
+
+from eagle_harness.core.chain_width import chain_widths
+from eagle_harness.core.config import HarnessConfig, Mode, build_cost_model, parse_harness_config
+from eagle_harness.core.cost_model import CostModel, FixedShapePolicy
+from eagle_harness.core.limits import ComputeIntensity
+from eagle_harness.core.draft_tree import DraftTree, TreeShape
+from eagle_harness.core.models import target_is_moe
+from eagle_harness.sglang.chain_rounds import ChainCalibration, ChainRounds
+from eagle_harness.core.live_costs import CostKey, LiveCosts, config_digest
+from eagle_harness.core.gemm_solutions import load_gemm_solutions
+from eagle_harness.sglang.draft_extend import DraftExtend
+from eagle_harness.sglang.draft_steps import DraftSteps
+from eagle_harness.sglang.drafter import DynamicDrafter, PrelaunchResult, spin_wait
+from eagle_harness.sglang.l2_warm import MlpL2WarmAhead
+from eagle_harness.sglang.plain_decode import NativeDecode
+from eagle_harness.sglang.row_attention import DraftRowAttention
+from eagle_harness.sglang.verify_step import AcceptTailGraphs, fused_accept_step, fused_accept_supported
+from eagle_harness.sglang.verify_graphs import verify_widths
+from eagle_harness.sglang.verify_input import HarnessVerifyInput
+
+if TYPE_CHECKING:
+ from sglang.srt.managers.schedule_batch import ScheduleBatch
+ from sglang.srt.managers.tp_worker import TpModelWorker
+ from sglang.srt.server_args import ServerArgs
+ from sglang.srt.speculative.eagle_info import EagleVerifyInput
+
+logger = logging.getLogger(__name__)
+
+Policy = Union[CostModel, FixedShapePolicy]
+
+
+def cost_key(runner) -> CostKey:
+ """The setup this server's costs belong to (:class:`~eagle_harness.core.live_costs.CostKey`)."""
+ return CostKey(
+ gpu=torch.cuda.get_device_name(runner.device),
+ gpu_count=get_parallel().tp_size,
+ model=config_digest(get_model().model_path),
+ draft=config_digest(get_spec().speculative_draft_model_path),
+ engine=f"sglang {sglang_version}",
+ dtype=str(runner.dtype),
+ )
+
+
+class HarnessDraftWorker(EagleDraftWorker):
+ """sglang's EAGLE draft worker with the harness's decode-time draft forwards.
+
+ Kept from sglang: the draft TpModelWorker, its KV pool, the shared target
+ embedding and the prefill draft extend with its attention backend.
+ Replaced: the fixed multi-step draft (by :class:`DraftSteps`) and the
+ decode draft extend (by :class:`DraftExtend`), both on
+ :class:`DraftRowAttention` and in the harness's own CUDA graphs.
+ """
+
+ tree: DraftTree
+ steps: DraftSteps
+ extend: DraftExtend
+
+ def __init__(self, server_args, gpu_id, nccl_port, target_worker, *, policy: Policy):
+ # Read by init_attention_backend, which sglang's __init__ calls.
+ self._intensity = policy.intensity
+ self._verify_budget = policy.max_history_verify_num
+ self._delta_slots = policy.launch_depths
+ super().__init__(server_args, gpu_id, nccl_port, target_worker)
+
+ def init_attention_backend(self) -> None:
+ """Create the draft-extend attention backend and make it the draft runner's."""
+ factory = DraftBackendFactory(self.draft_runner, self.topk, self.speculative_num_steps)
+ self.draft_extend_attn_backend = factory.create_draft_extend_backend()
+ if self.draft_extend_attn_backend is not None:
+ self.draft_runner.attn_backend = self.draft_extend_attn_backend
+ model = self.draft_runner.model
+ max_bs = get_schedule().max_running_requests
+ width = self.speculative_num_draft_tokens
+ shape = TreeShape(top_k=self.topk, max_depth=self.speculative_num_steps)
+ device = torch.device(self.device)
+ self.tree = DraftTree(
+ shape,
+ max_bs,
+ model.config.hidden_size,
+ self.draft_runner.dtype,
+ device,
+ max_verify=self._verify_budget,
+ delta_slots=self._delta_slots,
+ )
+ self.draft_attn_backend = DraftRowAttention(
+ self.draft_runner, max_bs=max_bs, max_rows_per_request=max(self.topk, width), window=getattr(model, "window", model.get_attention_sliding_window_size())
+ )
+ self.draft_runner.draft_attn_backend = self.draft_attn_backend
+ self.steps = DraftSteps(self.draft_runner, self.tree, self.draft_attn_backend)
+ intensity = self._intensity
+ self.extend = DraftExtend(
+ self.draft_runner,
+ self.draft_attn_backend,
+ self.steps,
+ width=width,
+ input_hidden_size=(
+ model.model.fc.input_size if hasattr(model.model.fc, "input_size") else model.model.fc.in_features
+ ),
+ widths=lambda bs: verify_widths(bs, intensity, width),
+ )
+ self.tree_mask_mode = default_tree_mask_mode()
+
+ def _capture_cuda_graphs(self) -> None:
+ self.cuda_graph_runner = None
+ self.cuda_graph_runner_for_draft_extend = None
+ if check_cuda_graph_backend(Phase.DECODE, Backend.DISABLED):
+ return
+ capture_bs, _ = get_batch_sizes_to_capture(self.draft_runner)
+ self.steps.capture(capture_bs)
+ self.extend.capture(capture_bs)
+
+ def extend_after_verify(self, batch: "ScheduleBatch", result, width: int, staged: bool) -> None:
+ """The decode draft extend (its input staged first unless the verify ``staged`` it); installs the next
+ round's depth-1 candidates in ``result.next_draft_input``."""
+ if not staged:
+ self.extend.stage(result.next_token_ids, result.logits_output.hidden_states, result.accept_lens)
+ draft_input = result.next_draft_input
+ draft_input.topk_p, draft_input.topk_index, draft_input.hidden_states = self.extend.run(
+ len(batch.seq_lens), width
+ )
+
+
+class EagleHarnessWorker(EAGLEWorkerV2):
+ """The EAGLE_HARNESS speculative worker: the harness round in every mode.
+
+ ``mode: static`` runs the fixed shape (full depth, ``--speculative-num-draft-tokens`` verified) with no cost
+ model. The cost-model modes read offline tables from ``data_path`` (their ``key.json`` must name this GPU,
+ TP size, model pair, engine and dtype) or, without ``data_path``, measure the costs on the served rounds
+ (:class:`~eagle_harness.core.live_costs.LiveCosts`) and cache them under ``cost_cache``.
+ """
+
+ def __init__(self, server_args: "ServerArgs", gpu_id: int, nccl_port: int, target_worker: "TpModelWorker"):
+ spec = get_spec()
+ self.config: HarnessConfig = parse_harness_config(spec.speculative_algorithm_config)
+ shape = dict(
+ node_top_k=spec.speculative_eagle_topk,
+ tree_depth=spec.speculative_num_steps,
+ verify_num=spec.speculative_num_draft_tokens,
+ )
+ self._chain_schedule = self._fixed_chain_widths(spec)
+ native_decode = self.config.mode is Mode.CALIBRATE or any(
+ width == 0 for _, _, width in (self._chain_schedule or ())
+ )
+ if native_decode and (get_exec().mamba.enable_mamba_extra_buffer or get_parallel().dp_size != 1):
+ raise ValueError("Native no-spec fallback requires DP1 and disabled Mamba prefix-cache tracking.")
+ self._native_decode_enabled = native_decode
+ self.fixed = FixedShapePolicy(self.config.intensity, **shape)
+ # Built before sglang's __init__, which creates the draft worker through create_draft_worker.
+ self.cost_model: Optional[CostModel] = None
+ self.live: Optional[LiveCosts] = None
+ if self.config.mode.uses_cost_model and self._chain_schedule is None:
+ runner = target_worker.model_runner
+ key = cost_key(runner)
+ if self.config.data_path:
+ tables = None # loaded below, keyed
+ else:
+ tables = {}
+ self.live = LiveCosts(
+ widths=lambda bs: verify_widths(bs, self.config.intensity, shape["verify_num"]), key=key,
+ draft_shape=(shape["node_top_k"], shape["tree_depth"]),
+ )
+ self._cache_path = os.path.join(self.config.cost_cache_dir, f"{key.digest}.json")
+ if self.live.load(self._cache_path):
+ logger.info("eagle-harness: live costs loaded from %s", self._cache_path)
+ tables = self.live.tables()
+ self.cost_model = build_cost_model(
+ self.config, target_is_moe=target_is_moe(runner.model_config.hf_config), tables=tables, key=key, **shape
+ )
+ if not self.cost_model.tables and self.live is None:
+ raise ValueError(f"EAGLE_HARNESS: no cost tables under {self.config.cost_dir}.")
+ load_gemm_solutions(self.config.data_path) # before sglang captures any graph
+ super().__init__(server_args, gpu_id, nccl_port, target_worker)
+ # Hooked before the target's verify graphs are captured (sglang captures every worker's graphs after
+ # all workers exist): the graphs record the prefetch's fork and join.
+ runner = target_worker.model_runner
+ MlpL2WarmAhead.install(runner.model, self.config.l2_warm, runner.device)
+ self._drafter: Optional[DynamicDrafter] = None
+ self._tail_graphs = AcceptTailGraphs()
+ self._verified = torch.cuda.Event()
+
+ def _fixed_chain_widths(self, spec) -> Optional[list]:
+ """The served chain widths per batch size range for a chain with round times under ``data_path``; None for
+ trees, the calibration, and chains without them (the cost model then sizes each round)."""
+ config = self.config
+ chain = config.intensity is ComputeIntensity.CHAIN and spec.speculative_eagle_topk == 1
+ if config.mode is Mode.CALIBRATE:
+ if not chain or config.mode is Mode.STATIC or not config.data_path:
+ raise ValueError(
+ 'EAGLE_HARNESS "mode": "calibrate" times chains: set --speculative-eagle-topk 1 and '
+ '"intensity": "chain_intensity".'
+ )
+ return None
+ if not chain or config.mode is Mode.STATIC or not config.data_path:
+ return None
+ max_bs = get_schedule().max_running_requests
+ schedule = chain_widths(config.data_path, spec.speculative_num_draft_tokens, max_bs, allow_no_spec=True)
+ if schedule is None:
+ logger.warning(
+ "EAGLE_HARNESS: no served chain round times with an acceptance profile under %s; the cost model "
+ "sizes each chain round (tree rule)",
+ config.data_path,
+ )
+ return None
+ for first, last, width in schedule:
+ if width != 0 and width not in verify_widths(first, config.intensity, spec.speculative_num_draft_tokens):
+ raise ValueError(
+ f"EAGLE_HARNESS: chain width {width} (batch sizes {first}-{last}) has no verify graph."
+ )
+ logger.info("EAGLE_HARNESS: chain widths per batch size from %s: %s", config.data_path, schedule)
+ return schedule
+ def _build_trivial_verify_input(self, batch: "ScheduleBatch") -> "EagleVerifyInput":
+ """sglang's one-token verify input (plain decoding), with the root token as int64.
+
+ sglang's builder passes the int32 bonus tokens as ``draft_token``; its greedy verify kernel takes int64
+ candidates and rejects them (``Dtype value [int32] not in the allowed options: [int64]``) at every batch
+ size the fused accept step does not take.
+ """
+ verify_input = EAGLEWorkerV2._build_trivial_verify_input(self, batch)
+ verify_input.draft_token = verify_input.draft_token.to(torch.int64)
+ return verify_input
+
+ def create_draft_worker(self, server_args, gpu_id, nccl_port, target_worker) -> HarnessDraftWorker:
+ """sglang's EAGLE draft worker with the harness's decode-time draft forwards."""
+ return HarnessDraftWorker(
+ server_args, gpu_id, nccl_port, target_worker, policy=self.cost_model or self.fixed
+ )
+
+ def init_attention_backends(self) -> None:
+ """Target and draft backends, then the drafter that owns the per-round tree."""
+ super().init_attention_backends()
+ intensity, full = self.config.intensity, self.speculative_num_draft_tokens
+ calibration = None
+ if self.config.mode is Mode.CALIBRATE:
+ writer = not torch.distributed.is_initialized() or torch.distributed.get_rank() == 0
+ calibration = ChainCalibration(
+ self.config.data_path,
+ verify_widths(1, intensity, full),
+ torch.device(self.device),
+ writer=writer,
+ native_decode=True,
+ )
+ self._chain_rounds = ChainRounds(self._chain_schedule, calibration, DynamicDrafter.average_context)
+ capture_bs, _ = get_batch_sizes_to_capture(self.target_worker.model_runner)
+ tp_group = get_tp_group()
+ self._drafter = DynamicDrafter(
+ self._draft_worker.steps,
+ self.cost_model,
+ fixed=self.fixed,
+ build_trivial_input=self._build_trivial_verify_input,
+ target_worker=self.target_worker,
+ algorithm=self.speculative_algorithm,
+ widths=lambda bs: verify_widths(bs, intensity, full),
+ tree_mask_mode=self._draft_worker.tree_mask_mode,
+ device=self.device,
+ live=self.live,
+ bucket=lambda bs: min((b for b in capture_bs if b >= bs), default=max(capture_bs, default=bs)),
+ sync_cells=lambda cells: tp_group.broadcast_object(cells, src=0),
+ save_cells=self._save_live_costs if tp_group.rank_in_group == 0 else None,
+ chain_width=(
+ self._chain_rounds.draft_width if calibration is not None or self._chain_schedule is not None else None
+ ),
+ )
+ self._native_decode = NativeDecode(
+ self.target_worker,
+ self.req_to_token_pool.req_to_token,
+ self._chain_rounds,
+ enabled=self._native_decode_enabled,
+ )
+
+ def _save_live_costs(self) -> None:
+ try:
+ self.live.save(self._cache_path)
+ except OSError as e:
+ logger.warning("eagle-harness: could not write the live cost cache %s: %s", self._cache_path, e)
+
+ def forward_batch_generation(
+ self, batch: "ScheduleBatch", on_publish=None, grammar_barrier=None, pp_proxy_tensors=None
+ ):
+ """One scheduler step: prefill through sglang, else draft, verify and prelaunch the next round."""
+ rounds = self._chain_rounds
+ if batch.forward_mode.is_extend() or batch.is_extend_in_batch:
+ self._drafter.cancel_prelaunch()
+ rounds.interrupt()
+ return super().forward_batch_generation(batch, on_publish, grammar_barrier, pp_proxy_tensors)
+ native_decode = self._native_decode.select(batch)
+ if native_decode:
+ self._drafter.cancel_prelaunch()
+ result = self._native_decode.run(batch, grammar_barrier)
+ self._verified.record()
+ else:
+ draft = self._draft_worker
+ timer = self._drafter.timer
+ if batch.forward_mode.is_idle():
+ self._drafter.cancel_prelaunch()
+ batch.spec_info, width = self._build_trivial_verify_input(batch), 1
+ rounds.interrupt()
+ timer = None
+ else:
+ with self._draft_context(), spec_stage_span("draft"):
+ batch.spec_info = self._drafter.draft(batch)
+ width = self._drafter.last_width
+ rounds.round_start(len(batch.seq_lens), width, batch)
+ with spec_stage_span("verify"):
+ started = None if timer is None else timer.start()
+ result, staged = self._verify(batch, width, grammar_barrier)
+ self._verified.record()
+ if started is not None:
+ timer.stop(started, self._drafter.bucket(len(batch.reqs)), width, self._drafter.average_context(batch))
+ if not batch.forward_mode.is_idle():
+ rounds.accepted(width, result.accept_lens)
+ if on_publish is not None:
+ if native_decode:
+ self._native_decode.publish(on_publish, result)
+ else:
+ on_publish(result.new_seq_lens)
+ if not native_decode and not batch.forward_mode.is_idle():
+ with self._draft_context(), spec_stage_span("draft_extend"):
+ prelaunch_done = self._drafter.prelaunch(
+ batch,
+ extend=lambda: draft.extend_after_verify(batch, result, width, staged),
+ inputs=(
+ batch.seq_lens,
+ result.next_token_ids,
+ result.accept_lens,
+ result.logits_output.hidden_states,
+ ),
+ # FutureMap relays draft outputs immediately after return on this stream.
+ stream=torch.cuda.current_stream() if on_publish is not None else None,
+ )
+ result = PrelaunchResult(**vars(result), prelaunch_done=prelaunch_done)
+ # Only the synchronous scheduler reads the results right away; poll here rather than block in its copy.
+ if on_publish is None:
+ spin_wait(self._verified)
+ return result
+
+ def _verify(self, batch: "ScheduleBatch", width: int, grammar_barrier):
+ """sglang's EAGLE verify at ``width`` tokens per request (the width's target graph, via H7).
+
+ A greedy batch-size-1 round asks the target forward for the rows' greedy tokens and accepts with the
+ fused accept step (:func:`~eagle_harness.sglang.verify_step.fused_accept_step`, sglang's
+ ``accept_step`` hook), replayed as a graph once its inputs are the draft's and the target graph's
+ static buffers; that step also stages the draft extend's input.
+ Returns the result and whether the draft extend's input is staged.
+ """
+ accept_step = None
+ if fused_accept_supported(batch, self.topk, self.token_to_kv_pool_allocator.get_kvcache()):
+ if isinstance(batch.spec_info, HarnessVerifyInput):
+ batch.spec_info.greedy_tokens_only = True
+ steps = self._draft_worker.steps # the batch's lengths and rows, staged in static buffers
+ accept_step = fused_accept_step(
+ req_to_token_pool=self.req_to_token_pool,
+ token_to_kv_pool_allocator=self.token_to_kv_pool_allocator,
+ num_draft_tokens=width,
+ tail_graphs=self._tail_graphs,
+ staged=(steps.seq_lens[:1], steps.req_pool_indices[:1]),
+ extend=self._draft_worker.extend,
+ )
+ result = run_eagle_verify(
+ batch,
+ target_worker=self.target_worker,
+ req_to_token_pool=self.req_to_token_pool,
+ token_to_kv_pool_allocator=self.token_to_kv_pool_allocator,
+ plan_stream=self.plan_stream,
+ plan_stream_ctx=self.plan_stream_ctx,
+ topk=self.topk,
+ num_draft_tokens=width,
+ device=self.device,
+ metadata_ready_pre_pad=False,
+ finalize_tree_path=True,
+ grammar_barrier=grammar_barrier,
+ accept_step=accept_step,
+ )
+ if accept_step is not None and batch.enable_overlap:
+ # The scheduler reads on a leaf stream; the next tail replay may overwrite its graph buffers.
+ result.next_token_ids = result.next_token_ids.clone()
+ result.accept_lens = result.accept_lens.clone()
+ if batch.return_hidden_states and result.logits_output.hidden_states is not None:
+ result.logits_output.hidden_states = result.logits_output.hidden_states.clone()
+ return result, accept_step is not None
+
+ def _draft_context(self) -> contextlib.ExitStack:
+ """sglang's draft-side contexts (draft TP group, speculative MoE backends)."""
+ stack = contextlib.ExitStack()
+ stack.enter_context(draft_tp_context(self._draft_worker.draft_owns_attention))
+ stack.enter_context(speculative_moe_backend_context())
+ stack.enter_context(speculative_moe_a2a_backend_context())
+ return stack
diff --git a/eagle_harness/tokenspeed/__init__.py b/eagle_harness/tokenspeed/__init__.py
new file mode 100644
index 0000000..38d037d
--- /dev/null
+++ b/eagle_harness/tokenspeed/__init__.py
@@ -0,0 +1,17 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""TokenSpeed plugin: EAGLE-Harness as a TokenSpeed drafter.
+
+Registered through the ``tokenspeed.plugins`` entry point (see pyproject.toml) and TokenSpeed's plugin registries, with
+the generic hooks of TokenSpeed branch ``pr-spec-plugin-hooks``; nothing in TokenSpeed is patched.
+
+Modules (``cpu`` = tested without a GPU, ``gpu`` = tested on a GPU):
+
+- ``plugin`` cpu entry point: registers the ``EAGLE_HARNESS`` drafter and the EAGLE-4 draft architecture
+- ``hooks`` cpu the TokenSpeed API the adapter uses, checked against the installed TokenSpeed
+- ``config`` cpu ``--speculative-algorithm-config`` parsing (static trees)
+- ``tree_lanes`` cpu the core draft tree in TokenSpeed's terms: lane masks, verify window and parents
+- ``drafter`` gpu ``HarnessDrafter``: TokenSpeed's EAGLE tree round with the core tree and the candidate head
+- ``models`` gpu the EAGLE-4 draft model for TokenSpeed (candidate head, no whole-vocab LM head per step)
+"""
diff --git a/eagle_harness/tokenspeed/config.py b/eagle_harness/tokenspeed/config.py
new file mode 100644
index 0000000..ae6a416
--- /dev/null
+++ b/eagle_harness/tokenspeed/config.py
@@ -0,0 +1,72 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""``--speculative-algorithm-config`` of the ``EAGLE_HARNESS`` algorithm on TokenSpeed.
+
+TokenSpeed hands the parsed JSON object to the drafter (``BaseDrafter.configure_algorithm``, hook H1); the keys are
+:class:`~eagle_harness.core.config.HarnessConfig`'s, with sglang's strict parsing. The tree shape is TokenSpeed's own:
+``--speculative-eagle-topk`` (children per node), ``--speculative-num-steps`` (tree depth) and
+``--speculative-num-draft-tokens`` (verify width, root included).
+
+Static mode keeps a fixed tree. Serve mode uses the calibrated GPU-side policy
+for draft depth and the number of meaningful verify nodes; the physical verify
+window stays fixed and unused slots are unconnected roots.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Mapping
+from dataclasses import dataclass, fields, replace
+from typing import Any
+
+from eagle_harness.core.config import HarnessConfig, Mode, harness_config_from_dict
+
+ALGORITHM_NAME = "EAGLE_HARNESS"
+@dataclass(frozen=True)
+class TokenSpeedConfig(HarnessConfig):
+ """Core policy settings plus an optional explicit per-batch chain schedule."""
+
+ chain_width_table: tuple[tuple[int, int], ...] = ()
+
+
+STATIC = TokenSpeedConfig(mode=Mode.STATIC)
+
+
+def parse_algorithm_config(algorithm_config: Mapping[str, Any] | None) -> TokenSpeedConfig:
+ """The HarnessConfig of a launch (None: no ``--speculative-algorithm-config``); unknown keys and modes TokenSpeed
+ cannot serve raise."""
+ if algorithm_config is None:
+ return STATIC
+ values = dict(algorithm_config)
+ table = values.pop("chain_width_table", ())
+ if not isinstance(table, (list, tuple)):
+ raise ValueError("chain_width_table must contain [minimum batch size, verify width] pairs") # noqa: TRY004 — configuration validation
+ entries = []
+ for entry in table:
+ if (
+ not isinstance(entry, (list, tuple))
+ or len(entry) != 2
+ or any(type(value) is not int or value < 1 for value in entry)
+ or entry[1] < 2
+ or (entries and entry[0] <= entries[-1][0])
+ ):
+ raise ValueError("chain_width_table needs increasing positive batch sizes and verify widths >= 2")
+ entries.append(tuple(entry))
+ fully_scheduled = bool(entries and entries[0][0] == 1 and values.get("mode") == "serve"
+ and values.get("intensity") == "chain_intensity")
+ # A complete explicit schedule makes no cost decisions and needs no timing files.
+ core = harness_config_from_dict({**values, "mode": "static"} if fully_scheduled else values)
+ if fully_scheduled:
+ core = replace(core, mode=Mode.SERVE)
+ if core.mode is Mode.SERVE and not fully_scheduled and not core.data_path:
+ raise ValueError("TokenSpeed serve mode needs data_path or a complete explicit chain schedule; live costs are unsupported")
+ config = TokenSpeedConfig(**{field.name: getattr(core, field.name) for field in fields(core)},
+ chain_width_table=tuple(entries))
+ if entries:
+ from eagle_harness.core.limits import ComputeIntensity
+
+ if config.intensity is not ComputeIntensity.CHAIN or config.mode is not Mode.SERVE:
+ raise ValueError("chain_width_table requires serve mode and chain_intensity")
+ if config.mode not in (Mode.STATIC, Mode.SERVE):
+ raise NotImplementedError(f"{ALGORITHM_NAME} on TokenSpeed supports static and serve modes")
+ return config
diff --git a/eagle_harness/tokenspeed/costs.py b/eagle_harness/tokenspeed/costs.py
new file mode 100644
index 0000000..fd56dc6
--- /dev/null
+++ b/eagle_harness/tokenspeed/costs.py
@@ -0,0 +1,17 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Adapt shared cost records to TokenSpeed's fixed tree-policy ABI."""
+
+from dataclasses import replace
+
+from eagle_harness.core.cost_model import CostModel, TreePolicyCosts
+
+# TokenSpeed's tree policy packs exactly this many live-batch rows; its chain ABI is separate.
+TREE_POLICY_BATCH_CAPACITY = 32
+
+
+def tree_policy_costs(model: CostModel) -> TreePolicyCosts:
+ """Keep host-computed costs unchanged within the engine's supported tree capacity."""
+ costs = model.tree_policy_costs()
+ return replace(costs, batches=costs.batches[:TREE_POLICY_BATCH_CAPACITY])
diff --git a/eagle_harness/tokenspeed/drafter.py b/eagle_harness/tokenspeed/drafter.py
new file mode 100644
index 0000000..d43edc9
--- /dev/null
+++ b/eagle_harness/tokenspeed/drafter.py
@@ -0,0 +1,183 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""``HarnessDrafter``: EAGLE-Harness as a TokenSpeed drafter (algorithm ``EAGLE_HARNESS``).
+
+A round is TokenSpeed's EAGLE tree round (``Eagle``: the draft extend over the accepted rows, then ``S - 1`` lane
+forwards of ``K`` rows per request, all inside TokenSpeed's decode graph) with the harness's own tree policy in place
+of TokenSpeed's:
+
+- the EAGLE-4 candidate head ranks each row's next tokens (:meth:`LlamaForCausalLMEagle4.candidate_topk`; no
+ whole-vocab LM head per draft step);
+- the core :class:`~eagle_harness.core.draft_tree.DraftTree` (shared with the sglang and vLLM adapters) scores the
+ nodes, keeps the frontier and picks the ``N - 1`` verify nodes (:meth:`DraftTree.verify_rows`), so the tree verified
+ for the same draft outputs is the one the other engines verify;
+- :mod:`~eagle_harness.tokenspeed.tree_lanes` turns the frontier choices into TokenSpeed's lane masks and the verify
+ window and parents TokenSpeed verifies with its own tree attention and GDN tree verify.
+
+Static rounds use Eagle's complete graph. Serve rounds delegate chain/tree execution, fixed-ahead sampled-depth
+planning and recorded-q rejection to the engine. Cost decisions come only from eagle_harness.core; native EAGLE-3
+and reduced-vocabulary maps stay owned by TokenSpeed.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Mapping
+from dataclasses import replace
+from typing import Any
+
+import torch
+from tokenspeed.runtime.execution.drafter.tree_round.device_policy import DevicePolicy
+from tokenspeed.runtime.execution.drafter.tree_round.dynamic import DynamicDrafter
+from tokenspeed.runtime.models.llama_eagle3 import LlamaForCausalLMEagle3
+from typing_extensions import override
+
+from eagle_harness.core.config import DraftFamily, Mode, build_cost_model
+from eagle_harness.core.draft_tree import DraftTree, TreeShape
+from eagle_harness.core.limits import ComputeIntensity
+from eagle_harness.tokenspeed.config import ALGORITHM_NAME, STATIC, TokenSpeedConfig, parse_algorithm_config
+from eagle_harness.tokenspeed.costs import tree_policy_costs
+from eagle_harness.tokenspeed.models import CandidateRows, LlamaForCausalLMEagle4
+from eagle_harness.tokenspeed.tree_lanes import advance_lane_masks, lane_bits, seed_lane_masks, verify_window
+
+
+class HarnessDrafter(DynamicDrafter):
+ supports_speculative_sampling = True
+
+ def __init__(self, *args: Any, **kwargs: Any):
+ super().__init__(*args, **kwargs)
+ model = self.draft_model_runner.model
+ if not isinstance(model, LlamaForCausalLMEagle3):
+ raise TypeError(f"{ALGORITHM_NAME} requires an EAGLE-3 or EAGLE-4 draft, got {type(model)}")
+ self.draft_model = model
+ self.config: TokenSpeedConfig = STATIC
+ self.tree: DraftTree | None = None
+ self._lane_bits: torch.Tensor | None = None
+
+ def configure_algorithm(self, algorithm_config: Mapping[str, Any]) -> None:
+ self.config = parse_algorithm_config(algorithm_config)
+ if isinstance(self.draft_model, LlamaForCausalLMEagle4):
+ self.draft_model.cuda_candidate_kernels = self.config.draft_model.cuda_candidate_kernels
+ elif "draft_family" not in algorithm_config:
+ self.config = replace(self.config, draft_family=DraftFamily.EAGLE3)
+
+ @override
+ def wire_target(self, target: Any) -> None:
+ super().wire_target(target)
+ expert_counts = (
+ getattr(target.config, name, 0) for name in ("num_experts", "num_local_experts", "n_routed_experts")
+ )
+ self._target_is_moe = any(expert_counts)
+
+ @property
+ def dynamic(self) -> bool:
+ return self.config.mode is Mode.SERVE
+
+ def _make_policy(self, verify_num: int, topk: int, depth: int) -> DevicePolicy:
+ fully_scheduled = bool(self.config.chain_width_table and self.config.chain_width_table[0][0] == 1)
+ model = None if fully_scheduled else build_cost_model(
+ self.config,
+ node_top_k=topk,
+ tree_depth=depth,
+ verify_num=verify_num,
+ target_is_moe=self._target_is_moe,
+ )
+ costs = None
+ if model is not None:
+ costs = model.chain_policy_costs() if self.config.intensity is ComputeIntensity.CHAIN else tree_policy_costs(model)
+ return DevicePolicy(
+ costs,
+ verify_num=verify_num,
+ node_top_k=topk,
+ tree_depth=depth,
+ compute_intensity=self.config.intensity.value,
+ is_moe_target=self._target_is_moe,
+ exec_mode=0,
+ chain_width_table=self.config.chain_width_table,
+ device=self.device,
+ )
+
+ @override
+ def bind_tree(self, tree_spec: Any) -> None:
+ if self.dynamic:
+ shape = tree_spec.config
+ self.bind_dynamic_tree(tree_spec, self._make_policy(shape.num_nodes, shape.topk, shape.num_steps))
+ if self._sampling_backend.config.enable_speculative_sampling:
+ self.enable_sampled_trees(
+ num_candidates=(self.draft_model.num_candidates if isinstance(self.draft_model, LlamaForCausalLMEagle4)
+ else min(1024, getattr(self.draft_model.config, "draft_vocab_size", None) or self.draft_model.config.vocab_size)),
+ seed=self._sampling_backend.config.random_seed,
+ )
+ return
+ if self._sampling_backend.config.enable_speculative_sampling:
+ raise ValueError("recorded-q proposals require serve mode; static trees support target sampling")
+ super().bind_tree(tree_spec)
+ config = tree_spec.config
+ if config.num_steps < 2:
+ raise ValueError(f"{ALGORITHM_NAME} needs --speculative-num-steps >= 2, got {config.num_steps}")
+ shape = TreeShape(top_k=config.topk, max_depth=config.num_steps)
+ if config.num_nodes - 1 > shape.num_nodes(config.num_steps):
+ raise ValueError(
+ f"--speculative-num-draft-tokens {config.num_nodes} verifies more nodes than a tree of depth "
+ f"{config.num_steps} and top-k {config.topk} holds ({shape.num_nodes(config.num_steps)} + the root)"
+ )
+ self.tree = DraftTree(
+ shape,
+ self.input_buffers.max_bs,
+ self.draft_model.config.hidden_size,
+ self.draft_model_runner.model_config.dtype,
+ self.device,
+ max_verify=1,
+ delta_slots=(), # the work deltas are the cost model's input; the static tree does not read them
+ )
+ self._lane_bits = lane_bits(config.topk, config.num_steps, self.device)
+
+ @override
+ def run(self, base_ctx: Any, logits_output: Any, output_tokens: torch.Tensor, accept_lengths: torch.Tensor):
+ if self.tree_lanes is None:
+ raise NotImplementedError(
+ f"{ALGORITHM_NAME} requires an engine that binds explicit draft ancestry, including chains"
+ )
+ return super().run(base_ctx, logits_output, output_tokens, accept_lengths)
+
+ # ------------------------------------------------------------------ the tree policy
+ def _candidates(self, rows: CandidateRows) -> tuple[torch.Tensor, torch.Tensor]:
+ if isinstance(self.draft_model, LlamaForCausalLMEagle4):
+ if self.sampled_trees:
+ rows.next_token_logits, rows.candidate_ids, topk = self.draft_model.candidate_head(
+ rows.normed, self.lanes_per_request
+ )
+ return topk
+ return self.draft_model.candidate_topk(rows.normed, self.lanes_per_request)
+ return super()._candidates(rows)
+
+ @override
+ def _seed_tree_lanes(self, bs: int, logits_output: CandidateRows, frontier: torch.Tensor):
+ """Depth 1 from the draft extend's candidates; returns the lanes' ``[bs, K]`` tokens and ``[bs * K, H]`` rows."""
+ tree, k = self.tree, self.lanes_per_request
+ probs, tokens = self._candidates(logits_output)
+ tree.stage_root(bs, probs, tokens, logits_output.hidden_states)
+ tree.begin(bs)
+ seed_lane_masks(self.tree_lanes.lane_mask, bs, self._lane_bits)
+ self.tree_lanes.set_frontier(bs, frontier)
+ return tree.front_tokens[: bs * k].view(bs, k), tree.front_hidden[: bs * k]
+
+ @override
+ def _expand_tree_lanes(self, bs: int, step: int, logits_output: CandidateRows):
+ """Children of the depth-``step`` lanes; returns the next lanes' tokens and rows (``None`` after the last step)."""
+ tree, k = self.tree, self.lanes_per_request
+ probs, tokens = self._candidates(logits_output)
+ tree.step(bs, step, probs, tokens, logits_output.hidden_states)
+ lanes = tree.front_tokens[: bs * k].view(bs, k)
+ if step == self.spec_num_steps - 1:
+ return lanes, None
+ advance_lane_masks(tree, self.tree_lanes.lane_mask, bs, step, self._lane_bits)
+ return lanes, tree.front_hidden[: bs * k]
+
+ @override
+ def _draft_window(self, bs: int, next_tokens: torch.Tensor) -> torch.Tensor:
+ """The best ``N - 1`` nodes and the root as next round's verify window; their parents into the tree spec."""
+ verify_window(
+ self.tree, bs, self.spec_num_steps, next_tokens[:, 0], next_tokens, self.tree_spec.draft_parent_buf[:bs]
+ )
+ return next_tokens
diff --git a/eagle_harness/tokenspeed/hooks.py b/eagle_harness/tokenspeed/hooks.py
new file mode 100644
index 0000000..6470b02
--- /dev/null
+++ b/eagle_harness/tokenspeed/hooks.py
@@ -0,0 +1,104 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The TokenSpeed API the adapter is written against, checked against the installed TokenSpeed.
+
+:func:`hook_problems` lists what the running TokenSpeed lacks: the plugin refuses to register on such a TokenSpeed
+(:func:`eagle_harness.tokenspeed.plugin.register`) and ``eagle-harness-check`` reports it, so a TokenSpeed refactor that
+drops or renames a hook fails at load time instead of in a GPU run.
+
+Three groups:
+
+- the plugin API of TokenSpeed main (``tokenspeed.plugins`` entry points, the drafter and model registries);
+- the generic hooks of TokenSpeed branch ``pr-spec-plugin-hooks`` (``pr/TOKENSPEED_HOOKS.md``): H1 the algorithm config, H2 the
+ target's aux hidden states for a plugin algorithm, H3 tree drafting by a plugin drafter, and the sliding-window
+ attention of tree lanes (the EAGLE-4 draft layer has a window; TokenSpeed main refuses it in a tree);
+- the tree policy of TokenSpeed's ``Eagle`` drafter that :class:`~eagle_harness.tokenspeed.drafter.HarnessDrafter`
+ replaces (seed, expand, finalize of the draft tree). These are not public API yet: the check pins their names and
+ parameters so a change shows up here first.
+"""
+
+from __future__ import annotations
+
+import importlib
+import inspect
+from typing import NamedTuple
+
+MIN_PLUGIN_API_VERSION = 4
+
+
+class Hook(NamedTuple):
+ path: str # "module:attribute[.attribute]"
+ params: tuple[str, ...] = () # parameter names the callable must accept
+
+
+HOOKS: tuple[Hook, ...] = (
+ Hook("tokenspeed.runtime.plugins:PLUGIN_API_VERSION"),
+ Hook(
+ "tokenspeed.runtime.plugins.registry:register_drafter",
+ ("algorithm", "drafter_cls", "model_cls", "captures_aux_hidden_states", "uses_tree_layout"),
+ ),
+ Hook("tokenspeed.runtime.plugins.registry:register_model", ("cls", "architectures")),
+ Hook("tokenspeed.runtime.configs.model_profile:ModelProfile"),
+ Hook("tokenspeed.runtime.execution.drafter.base:BaseDrafter.configure_algorithm", ("algorithm_config",)), # H1
+ Hook("tokenspeed.runtime.execution.drafter:drafter_captures_aux_hidden_states", ("algorithm",)), # H2
+ Hook("tokenspeed.runtime.execution.drafter.eagle:Eagle.bind_tree", ("tree_spec",)),
+ Hook("tokenspeed.runtime.execution.drafter.eagle:Eagle.bind_tree_lanes", ("tree_spec",)),
+ Hook(
+ "tokenspeed.runtime.execution.drafter.tree_round.dynamic:DynamicDrafter.bind_dynamic_tree",
+ ("tree_spec", "policy"),
+ ),
+ Hook("tokenspeed.runtime.execution.drafter.tree_round.device_policy:DevicePolicy", ("costs", "device")),
+ Hook("tokenspeed.runtime.execution.drafter.base:BaseDrafter.replay_decode_graph", ("graph", "bs", "graph_bs")),
+ Hook("tokenspeed.runtime.execution.drafter.base:BaseDrafter.finish_round", ("ctx", "graph_bs")),
+ Hook("tokenspeed.runtime.execution.drafter.base:BaseDrafter.complete_round", ()),
+ Hook(
+ "tokenspeed.runtime.execution.drafter.base:BaseDrafter.capture_round_graphs",
+ ("graph_bs", "lo_bs", "stream", "pool"),
+ ),
+ Hook("tokenspeed.runtime.execution.drafter.base:BaseDrafter.has_round_graphs", ("graph_bs",)),
+ Hook("tokenspeed.runtime.execution.drafter.base:BaseDrafter.release_round_graphs", ()),
+ Hook("tokenspeed.runtime.execution.drafter.eagle:Eagle._seed_tree_lanes", ("bs", "logits_output", "frontier")),
+ Hook("tokenspeed.runtime.execution.drafter.eagle:Eagle._expand_tree_lanes", ("bs", "step", "logits_output")),
+ Hook("tokenspeed.runtime.execution.drafter.eagle:Eagle._draft_window", ("bs", "next_tokens")),
+ Hook("tokenspeed.runtime.layers.attention.backends.base:AttentionBackend.begin_tree_lanes", ("bs", "live_bs")),
+ Hook("tokenspeed.runtime.layers.attention.backends.paged.tree_verify:TreeDraftInputs.set_frontier"),
+ # the EAGLE-4 draft layer has a sliding window: tree lanes need the hooks branch's sliding-window lane attention
+ Hook(
+ "tokenspeed.runtime.layers.attention.backends.paged.trtllm:TRTLLMMHAAttnBackend._tree_lane_window_cascade",
+ ("lanes", "step"),
+ ),
+ Hook("tokenspeed.runtime.models.llama_eagle3:LlamaForCausalLMEagle3.exit_logits"),
+ Hook("tokenspeed.runtime.execution.context:ForwardContext.gather_ids"),
+ Hook("tokenspeed.runtime.distributed.comm_ops:all_gather", ("tensor", "group", "dim")),
+)
+
+
+def hook_problems() -> list[str]:
+ """What this TokenSpeed lacks of :data:`HOOKS` (empty: every hook the adapter uses is there)."""
+ problems = [_problem(hook) for hook in HOOKS]
+ problems = [p for p in problems if p]
+ if not problems:
+ from tokenspeed.runtime.plugins import PLUGIN_API_VERSION
+
+ if PLUGIN_API_VERSION < MIN_PLUGIN_API_VERSION:
+ problems.append(f"PLUGIN_API_VERSION {PLUGIN_API_VERSION} < {MIN_PLUGIN_API_VERSION}")
+ return problems
+
+
+def _problem(hook: Hook) -> str | None:
+ module_name, _, attr_path = hook.path.partition(":")
+ try:
+ obj = importlib.import_module(module_name)
+ except ImportError:
+ return f"{hook.path} (module {module_name} not importable)"
+ for part in attr_path.split("."):
+ if not hasattr(obj, part): # a dataclass field without a class-level default still counts
+ return None if part in getattr(obj, "__dataclass_fields__", {}) else hook.path
+ obj = getattr(obj, part)
+ if hook.params:
+ accepted = inspect.signature(obj).parameters
+ missing = [name for name in hook.params if name not in accepted]
+ if missing:
+ return f"{hook.path} (no parameter {', '.join(missing)})"
+ return None
diff --git a/eagle_harness/tokenspeed/models.py b/eagle_harness/tokenspeed/models.py
new file mode 100644
index 0000000..e18af6f
--- /dev/null
+++ b/eagle_harness/tokenspeed/models.py
@@ -0,0 +1,148 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The EAGLE-4 draft model for TokenSpeed (registered as ``LlamaForCausalLMEagle4``).
+
+TokenSpeed owns the single-layer draft, including dense or latent-MoE blocks and normalized or concatenated attention
+inputs. This adapter adds its own ``lm_head`` and a low-rank candidate head in place of full-vocabulary logits:
+
+1. ``scores = (hidden @ down_proj.T) @ efficient_lm_head.T`` (rank-r estimate over this rank's vocab shard);
+2. the top ``C`` scores of the shard are the candidates;
+3. their logits are re-scored with the full ``lm_head`` rows (:func:`~eagle_harness.kernels.gather_dot.gather_dot`);
+4. the candidates of every TP rank are merged.
+
+The model's exit (:meth:`exit_logits`) selects the forward's sampled rows, as TokenSpeed's logits processor does, and
+returns them without any logits (:class:`CandidateRows`): the drafter asks :meth:`candidate_topk` for the top-``k``
+it needs. The whole-vocab LM head GEMM of every draft step is skipped.
+"""
+
+from __future__ import annotations
+
+from dataclasses import dataclass
+from typing import Any
+
+import torch
+from tokenspeed.runtime.configs.model_config import configure_mha_attention
+from tokenspeed.runtime.configs.model_profile import ModelProfile
+from tokenspeed.runtime.distributed.comm_ops import all_gather
+from tokenspeed.runtime.layers.logits_processor import LogitsProcessorOutput
+from tokenspeed.runtime.layers.vocab_parallel_embedding import ParallelLMHead
+from tokenspeed.runtime.models.llama_eagle3 import Eagle3DecoderLayer, LlamaForCausalLMEagle3
+from torch import nn
+
+from eagle_harness.kernels.candidate_ops import candidate_head as fused_candidate_head
+from eagle_harness.models.eagle4_config import check_ported
+from eagle_harness.models.low_rank_head import low_rank_scores
+
+
+@dataclass
+class CandidateRows(LogitsProcessorOutput):
+ """A draft forward's exit: the sampled rows, no logits.
+
+ ``normed``: the final-norm output of each sampled row, the candidate head's input; ``hidden_states``: what the next
+ draft forward takes as input (``norm_output`` drafts: the same rows); ``next_token_logits`` is empty (``[rows, 0]``).
+ """
+
+ normed: torch.Tensor | None = None
+
+
+class LlamaForCausalLMEagle4(LlamaForCausalLMEagle3):
+ def __init__(self, config: Any, mapping: Any, quant_config: Any = None, prefix: str = ""):
+ # The engine owns dense and latent-MoE draft layers, including attn_norm and NoPE.
+ check_ported(config, unported={"enable_post_mlp_norm": True})
+ extended_draft = (
+ getattr(config, "enable_moe", False)
+ or getattr(config, "attn_norm", False)
+ or not getattr(config, "use_rope", True)
+ )
+ if extended_draft and not hasattr(Eagle3DecoderLayer, "prepare_attention_input"):
+ raise RuntimeError("This draft requires TokenSpeed's latent-MoE/attn_norm/NoPE model support.")
+ if (getattr(config, "draft_vocab_size", None) or config.vocab_size) != config.vocab_size:
+ raise NotImplementedError("EAGLE-4 drafts with a reduced vocab (d2t) are not ported.")
+ super().__init__(config, mapping, quant_config, prefix)
+ head = config.efficient_lm_head_config
+ self.num_candidates = int(head["num_candidates"])
+ rank = int(head["rank"])
+ lm_head = mapping.lm_head
+ self.efficient_lm_head = ParallelLMHead(
+ config.vocab_size,
+ rank,
+ tp_rank=lm_head.tp_rank,
+ tp_size=lm_head.tp_size,
+ tp_group=lm_head.tp_group,
+ prefix=f"{prefix}.efficient_lm_head" if prefix else "efficient_lm_head",
+ )
+ self.efficient_lm_head_down_proj = nn.Linear(config.hidden_size, rank, bias=False)
+ self.tp_size = lm_head.tp_size
+ self.tp_group = lm_head.tp_group
+ self.cuda_candidate_kernels = True # HarnessConfig.draft_model.cuda_candidate_kernels, set by the drafter
+
+ @classmethod
+ def model_profile(cls, hf_config: Any) -> ModelProfile:
+ """The draft's cache facts: one ordinary multi-head attention layer, as TokenSpeed's EAGLE-3 draft."""
+ del hf_config
+ return ModelProfile(
+ configure_attention=configure_mha_attention,
+ cache_family="mha",
+ linear_attention=None,
+ default_attention_backend=None,
+ default_prefix_granularity=None,
+ request_token_history=False,
+ is_multimodal=False,
+ tokenizer_kwargs={},
+ attention_instances_per_layer=1,
+ numerics_envelopes=frozenset({"auto"}),
+ )
+
+ # ---- the model exit: sampled rows, no logits
+ def exit_logits(self, input_ids: torch.Tensor, hidden_states: torch.Tensor, aux_hidden_states: Any, ctx: Any):
+ """The forward's sampled rows (``ctx.gather_ids``) as :class:`CandidateRows`; no LM head."""
+ if ctx.input_logprob_rows is not None or ctx.query_shard is not None:
+ raise NotImplementedError("the EAGLE-4 draft scores no prompt logprobs and runs no query shards")
+ (aux,) = aux_hidden_states
+ gather = ctx.gather_ids
+ # Rows already one per request (the first draft step narrows its attention to the live rows) stay as they are.
+ if gather is not None and not (ctx.logits_rows_selected or gather.shape[0] == hidden_states.shape[0]):
+ hidden_states, aux = hidden_states[gather], aux[gather]
+ empty = hidden_states.new_empty(hidden_states.shape[0], 0)
+ return CandidateRows(next_token_logits=empty, hidden_states=aux, normed=hidden_states)
+
+ # ---- candidate head
+ def candidate_topk(self, normed: torch.Tensor, k: int) -> tuple[torch.Tensor, torch.Tensor]:
+ """Top-``k`` next tokens of each row: ``([rows, k]`` fp32 probabilities, ``[rows, k]`` int64 ids).
+
+ The softmax runs over the ``C`` candidates of every rank together, which equals the softmax over the full
+ vocabulary with everything outside the candidates at ``-inf``.
+ """
+ return self.candidate_head(normed, k)[2]
+
+ def candidate_head(self, normed: torch.Tensor, k: int):
+ """Candidate logits, target ids and top-k for recorded-q proposals."""
+ shard = self.lm_head.shard_indices
+ scores = low_rank_scores(
+ normed,
+ self.efficient_lm_head_down_proj.weight,
+ self.efficient_lm_head.weight,
+ shard.org_vocab_end_index - shard.org_vocab_start_index,
+ )
+ return fused_candidate_head(
+ scores,
+ self.lm_head.weight,
+ normed,
+ num_candidates=self.num_candidates,
+ vocab_start=shard.org_vocab_start_index,
+ top_k=k,
+ all_gather=self._gather_candidates if self.tp_size > 1 else None,
+ cuda_kernels=self.cuda_candidate_kernels,
+ )
+
+ def _gather_candidates(self, packed: torch.Tensor) -> torch.Tensor:
+ """``[rows, n]`` int32 -> ``[tp, rows, n]`` in rank order.
+
+ Gathered along the rows as 16-bit words: that is the shape the engine serves with its barrier-free Lamport
+ exchange on the all-reduce workspace (as its own EAGLE-4 head does), so the draft's round graphs hold no NCCL
+ kernel and stay device-launchable.
+ """
+ rows, n = packed.shape
+ words = all_gather(packed.view(torch.int16), self.tp_group, dim=-1)
+ return words.view(rows, self.tp_size, 2 * n).transpose(0, 1).view(torch.int32)
diff --git a/eagle_harness/tokenspeed/plugin.py b/eagle_harness/tokenspeed/plugin.py
new file mode 100644
index 0000000..d415596
--- /dev/null
+++ b/eagle_harness/tokenspeed/plugin.py
@@ -0,0 +1,42 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""TokenSpeed plugin entry point (group ``tokenspeed.plugins``, see pyproject.toml).
+
+TokenSpeed calls :func:`register` once per process (frontend, scheduler, workers) before it resolves a model config.
+It registers the ``EAGLE_HARNESS`` drafter (:class:`~eagle_harness.tokenspeed.drafter.HarnessDrafter`, reading the
+target's aux hidden states) and the EAGLE-4 draft architecture through TokenSpeed's plugin registries; it patches
+nothing.
+
+On a TokenSpeed that lacks a hook (:func:`eagle_harness.tokenspeed.hooks.hook_problems`) it registers nothing and logs
+an error with the TokenSpeed version, the missing hooks and the fix (:mod:`eagle_harness.compat`); it never raises, so
+installing this package can never break a TokenSpeed install (``--speculative-algorithm EAGLE_HARNESS`` is then
+unknown).
+"""
+
+from __future__ import annotations
+
+import logging
+
+from eagle_harness.models.eagle4_config import EAGLE4_ARCH
+from eagle_harness.tokenspeed.config import ALGORITHM_NAME
+
+logger = logging.getLogger(__name__)
+
+
+def register() -> bool:
+ """Register the drafter and the draft model. False, registering nothing, if TokenSpeed lacks the hooks."""
+ from eagle_harness.compat import check_for_registration
+
+ if not check_for_registration("tokenspeed"):
+ return False
+
+ from tokenspeed.runtime.plugins.registry import register_drafter, register_model
+
+ from eagle_harness.tokenspeed.drafter import HarnessDrafter
+ from eagle_harness.tokenspeed.models import LlamaForCausalLMEagle4
+
+ register_drafter(ALGORITHM_NAME, HarnessDrafter, captures_aux_hidden_states=True, uses_tree_layout=True)
+ register_model(LlamaForCausalLMEagle4, architectures=(EAGLE4_ARCH,))
+ logger.info("eagle-harness: registered drafter %s and draft %s", ALGORITHM_NAME, EAGLE4_ARCH)
+ return True
diff --git a/eagle_harness/tokenspeed/tree_lanes.py b/eagle_harness/tokenspeed/tree_lanes.py
new file mode 100644
index 0000000..e3d51f5
--- /dev/null
+++ b/eagle_harness/tokenspeed/tree_lanes.py
@@ -0,0 +1,69 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The core draft tree in TokenSpeed's terms: lane visibility masks and the verify window.
+
+TokenSpeed drafts a tree in ``K`` lanes per request (``TreeDraftInputs``): draft step ``s >= 1`` forwards ``K`` rows
+per request, lane ``r`` writing its draft KV to window slot ``(s - 1) * K + r`` past the accepted frontier, and a lane
+row sees the committed prefix plus the window slots whose bits its 64-bit ``lane_mask`` sets (its ancestors and
+itself). The core :class:`~eagle_harness.core.draft_tree.DraftTree` keeps the scores, the frontier and the tree; this
+module carries its choices over to the lanes: after step ``s`` the frontier node ``j`` is a child of lane
+``parent_lane[j]``, so it sees that lane's slots plus its own next slot ``s * K + j``.
+
+TokenSpeed verifies the window ``[bs, N]`` (node 0 the root, the last verified token) with ``parent[0] = -1`` and
+``parent[i] < i`` (:meth:`DraftTree.verify_rows` gives exactly that shape). Pure torch: CPU-testable, graph-capturable.
+"""
+
+from __future__ import annotations
+
+import torch
+
+from eagle_harness.core.draft_tree import DraftTree
+
+
+def lane_bits(top_k: int, num_steps: int, device: torch.device) -> torch.Tensor:
+ """``[num_steps, K]`` int64: bit of window slot ``s * K + j`` (bit 63 as the int64 sign bit)."""
+ if (num_steps - 1) * top_k > 64:
+ raise ValueError(f"a lane window of {(num_steps - 1) * top_k} slots exceeds the 64-bit lane mask")
+ bits = [[_int64_bit(step * top_k + j) for j in range(top_k)] for step in range(num_steps)]
+ return torch.tensor(bits, dtype=torch.int64, device=device)
+
+
+def _int64_bit(position: int) -> int:
+ value = 1 << position if position < 64 else 0 # slots past the window are never written
+ return value - (1 << 64) if value >> 63 else value
+
+
+def seed_lane_masks(lane_mask: torch.Tensor, bs: int, bits: torch.Tensor) -> None:
+ """Depth 1: lane ``r`` sees its own step-1 slot ``r``."""
+ k = bits.shape[1]
+ lane_mask[: bs * k].view(bs, k).copy_(bits[0].expand(bs, k))
+
+
+def parent_lanes(tree: DraftTree, bs: int, step: int) -> torch.Tensor:
+ """``[bs, K]`` int64: the lane (frontier row of depth ``step``) each new frontier node of depth ``step + 1`` grew
+ from, read from the tree's frontier list after :meth:`DraftTree.step`."""
+ shape = tree.shape
+ first = shape.num_parents(step + 1)
+ nodes = tree.parents[:bs, first : first + shape.top_k]
+ return torch.div(nodes - shape.layer_start(step + 1), shape.top_k, rounding_mode="floor")
+
+
+def advance_lane_masks(tree: DraftTree, lane_mask: torch.Tensor, bs: int, step: int, bits: torch.Tensor) -> None:
+ """After draft step ``step``: each new frontier node sees its parent lane's slots and its own step-``step + 1``
+ slot (in place on ``lane_mask``, ``[>= bs * K]`` int64)."""
+ k = tree.shape.top_k
+ masks = lane_mask[: bs * k].view(bs, k)
+ masks.copy_(torch.gather(masks, 1, parent_lanes(tree, bs, step)) | bits[step])
+
+
+def verify_window(
+ tree: DraftTree, bs: int, depth: int, root_tokens: torch.Tensor, window: torch.Tensor, parents: torch.Tensor
+) -> None:
+ """Write the next verify window of a ``depth``-level tree: ``window`` ``[bs, N]`` int32 tokens (column 0 the root,
+ ``root_tokens`` ``[bs]``) and ``parents`` ``[bs, N]`` int32 (``-1`` for the root)."""
+ width = window.shape[1]
+ tokens, parent_rows = tree.verify_rows(bs, depth, width - 1)
+ window[:, 0] = root_tokens
+ window[:, 1:] = tokens
+ parents.copy_(parent_rows)
diff --git a/eagle_harness/vllm/__init__.py b/eagle_harness/vllm/__init__.py
new file mode 100644
index 0000000..6355242
--- /dev/null
+++ b/eagle_harness/vllm/__init__.py
@@ -0,0 +1,24 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""vLLM plugin: the EAGLE-Harness speculative method on vLLM's Model Runner V2.
+
+Registered through the ``vllm.general_plugins`` entry point (see pyproject.toml)
+and the generic hooks of vLLM branch ``eagle-hooks``; nothing in vLLM is patched.
+
+Modules (``cpu`` = tested without a GPU, ``gpu`` = tested on a GPU):
+
+- ``plugin`` cpu entry point: registers the method and the EAGLE-4 draft architecture
+- ``config`` cpu ``method_config`` parsing, the batch-size verify schedule, lookahead, aux layers
+- ``adapter`` cpu which vLLM hook carries which EngineAdapter need (checked against vLLM)
+- ``models`` gpu the EAGLE-4 draft model for vLLM (candidate head, rows with caller-supplied attention)
+- ``speculator`` gpu ``HarnessSpeculator``: chain mode on vLLM's EAGLE loop, tree mode on the verify hooks
+- ``tree_drafter`` gpu the draft tree's growth and verify-row selection (one CUDA graph per batch size)
+- ``verify_layout`` gpu the verify tree in graph-stable buffers (depth positions, ancestor masks)
+- ``tree_attention`` gpu ``CUSTOM`` attention backend: FlashAttention + tree part, merged by log-sum-exp
+- ``draft_attention`` gpu per-row key-list attention of the draft tree's steps
+- ``tree_accept`` gpu tree walk as the speculator's rejection sampler
+- ``round_commit`` gpu KV compaction of the accepted rows, draft inputs in path order (``chainize``)
+- ``gdn_tree_verify`` gpu GDN tree verify extension (tree conv, the shared recurrence of ``kernels.gdn_tree_recurrence``,
+ linear-state commit)
+"""
diff --git a/eagle_harness/vllm/adapter.py b/eagle_harness/vllm/adapter.py
new file mode 100644
index 0000000..b229df5
--- /dev/null
+++ b/eagle_harness/vllm/adapter.py
@@ -0,0 +1,90 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Which vLLM hook carries which :class:`EngineAdapter` need (``eagle_core_map.md`` section 3).
+
+:func:`missing_hooks` lists the named hooks the running vLLM lacks: the plugin refuses to register on such a vLLM
+(``plugin.register``) and the CPU tests fail on it, so a vLLM refactor that drops a hook fails at load time and in
+tests instead of in a GPU run. ``status`` is where the harness side
+stands: ``cpu`` (implemented, CPU-tested), ``gpu`` (implemented, tested in GPU
+jobs only), ``none`` (vLLM offers no hook; see VLLM_HOOKS.md open questions).
+"""
+
+from __future__ import annotations
+
+import importlib
+from typing import NamedTuple, Tuple
+
+
+class HookUse(NamedTuple):
+ need: str # EngineAdapter method or engine-facing need
+ hook: str # "module:attribute[.attribute]" in vLLM, or "" when vLLM has none
+ status: str
+
+
+HOOK_MAP: Tuple[HookUse, ...] = (
+ HookUse("algorithm registration", "vllm.v1.spec_decode.registry:register_speculative_method", "cpu"),
+ HookUse("H11 opaque algorithm config", "vllm.config.speculative:SpeculativeConfig.method_config", "cpu"),
+ HookUse(
+ "method configure / max tree budget / per-batch K",
+ "vllm.v1.spec_decode.registry:SpeculativeMethodSpec.configure",
+ "cpu",
+ ),
+ HookUse(
+ "H5 KV headroom (lookahead)", "vllm.v1.spec_decode.registry:SpeculativeMethodSpec.num_lookahead_tokens", "cpu"
+ ),
+ HookUse(
+ "draft + KV slots (draft_forward, alloc_slots)",
+ "vllm.v1.worker.gpu.spec_decode.speculator:DraftModelSpeculator.propose",
+ "gpu",
+ ),
+ HookUse(
+ "target_verify positions and tree mask (H9)",
+ "vllm.v1.worker.gpu.spec_decode.speculator:BaseSpeculator.prepare_verify_inputs",
+ "gpu",
+ ),
+ HookUse(
+ "verify accept (device_accept)",
+ "vllm.v1.worker.gpu.spec_decode.speculator:BaseSpeculator.make_rejection_sampler",
+ "gpu",
+ ),
+ HookUse(
+ "accepted-path KV compaction (compact_accept_kv)",
+ "vllm.v1.worker.gpu.spec_decode.speculator:BaseSpeculator.post_accept",
+ "gpu",
+ ),
+ HookUse(
+ "H10 GDN tree verify of the spec-decode rows",
+ "vllm.model_executor.layers.mamba.gdn.verify_extension:LinearAttnVerifyExtension.forward_spec_rows",
+ "gpu",
+ ),
+ HookUse(
+ "H7 per-width verify graphs",
+ "vllm.v1.worker.gpu.spec_decode.speculator:BaseSpeculator.uses_varlen_verify_graphs",
+ "gpu",
+ ),
+ HookUse(
+ "tree attention backend (H9 plan)", "vllm.v1.attention.backends.registry:AttentionBackendEnum.CUSTOM", "gpu"
+ ),
+ HookUse("H2 request admission (no logprobs, text only)", "", "none"),
+ HookUse("H1 worker idle / batch released (deferred frees)", "", "none"),
+)
+
+
+def missing_hooks() -> list[str]:
+ """The ``HOOK_MAP`` hooks this vLLM does not have (empty: every hook the harness uses is there)."""
+ return [use.hook for use in HOOK_MAP if use.hook and not _exists(use.hook)]
+
+
+def _exists(path: str) -> bool:
+ module_name, _, attr_path = path.partition(":")
+ try:
+ obj = importlib.import_module(module_name)
+ except ImportError:
+ return False
+ for part in attr_path.split("."):
+ if hasattr(obj, part):
+ obj = getattr(obj, part)
+ else: # a dataclass / pydantic field without a class-level default still counts
+ return part in getattr(obj, "__dataclass_fields__", {}) or part in getattr(obj, "model_fields", {})
+ return True
diff --git a/eagle_harness/vllm/calibrate.py b/eagle_harness/vllm/calibrate.py
new file mode 100644
index 0000000..71d4f39
--- /dev/null
+++ b/eagle_harness/vllm/calibrate.py
@@ -0,0 +1,471 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""vLLM whole-step calibration. Use ``eagle-harness calibrate`` for the full sweep."""
+
+from __future__ import annotations
+
+import argparse
+import json
+import math
+import os
+import statistics
+from collections.abc import Sequence
+from dataclasses import asdict
+from typing import Any
+
+import torch
+
+from eagle_harness.core.calibration import AttentionShape, CalibrationPaths, MeasureParams, StepTiming, fit_step_timings
+from eagle_harness.core.limits import MAX_CHAIN_VERIFY_NUM, ComputeIntensity
+from eagle_harness.core.live_costs import CostKey, config_digest, write_key
+
+CONTEXT_STEP = 256
+REPEATS = 30
+DRAFT_ROWS = (1, 2, 4, 8)
+
+
+def sweep(step: int = CONTEXT_STEP, *, context_stop: int) -> list[int]:
+ """Cache lengths timed: two inside every interval of the fits' grid (intervals of ``step`` from ``step`` to the stop)."""
+ if step < 4 or context_stop < 2 * step or context_stop % step:
+ raise ValueError("max_model_len must be at least two context steps and a multiple of context_step")
+ return [
+ step * (1 + i) + offset for i in range((context_stop - step) // step) for offset in (step // 4, 3 * step // 4)
+ ]
+
+
+def time_graph(run: Any) -> float:
+ """Median microseconds of ``run()`` replayed as a CUDA graph (captured once after two eager calls)."""
+ from vllm.distributed.parallel_state import graph_capture
+
+ run()
+ run()
+ torch.cuda.synchronize()
+ graph = torch.cuda.CUDAGraph()
+ with graph_capture(device=torch.device("cuda")) as capture, torch.cuda.graph(graph, stream=capture.stream):
+ run()
+ samples = []
+ for _ in range(REPEATS):
+ start, end = torch.cuda.Event(enable_timing=True), torch.cuda.Event(enable_timing=True)
+ start.record()
+ graph.replay()
+ end.record()
+ end.synchronize()
+ samples.append(1000 * start.elapsed_time(end))
+ return statistics.median(samples)
+
+
+def _elapsed_us(run: Any) -> float:
+ """Microseconds of one ``run()`` on the current stream (host launch included)."""
+ start, end = torch.cuda.Event(enable_timing=True), torch.cuda.Event(enable_timing=True)
+ start.record()
+ run()
+ end.record()
+ end.synchronize()
+ return 1000 * start.elapsed_time(end)
+
+
+class CalibrationProbe:
+ """Worker extension: ``collective_rpc("calibrate_target" | "calibrate_draft", ...)`` run in every worker (rank 0's rows are used)."""
+
+ def calibrate_target(
+ self, widths: list[int], lengths: list[int], batch_sizes: list[int], repeats: int = REPEATS
+ ) -> list[dict]:
+ """Time the target forward of ``q`` tokens per request at every batch size and cache length (``q`` must be 1 or the
+ engine's width)."""
+ speculator = self.model_runner.speculator
+ propose, speculator.propose = speculator.propose, lambda *args, **kwargs: None # the draft is timed separately
+ try:
+ return [
+ {
+ "batch_size": bs,
+ "query_length": q,
+ "cache_length": length,
+ "time_us": self._time_dummy(lambda bs=bs, q=q, length=length: self._step(bs, q, length), repeats),
+ }
+ for bs in batch_sizes
+ for q in widths
+ for length in lengths
+ ]
+ finally:
+ speculator.propose = propose
+
+ def calibrate_chain_draft(
+ self, width: int, lengths: list[int], batch_sizes: list[int], repeats: int = REPEATS
+ ) -> list[dict]:
+ """Time one step of vLLM's chain draft per batch size and cache length: a round (the verify forward and the
+ ``width - 1`` draft steps of the engine's chain) minus the verify forward alone, timed interleaved, over the steps."""
+ speculator = self.model_runner.speculator
+ propose = speculator.propose
+
+ def skip(*args, **kwargs):
+ return None
+
+ rows = []
+ for bs in batch_sizes:
+ for length in lengths:
+ spans: dict[bool, list[float]] = {True: [], False: []}
+ try:
+ for drafts in (True, False): # warm both paths (graph replays, metadata buffers)
+ speculator.propose = propose if drafts else skip
+ self._step(bs, width, length)
+ for _ in range(repeats):
+ for drafts in (True, False):
+ speculator.propose = propose if drafts else skip
+ spans[drafts].append(
+ _elapsed_us(lambda bs=bs, length=length: self._step(bs, width, length))
+ )
+ finally:
+ speculator.propose = propose
+ step = (statistics.median(spans[True]) - statistics.median(spans[False])) / (width - 1)
+ rows.append({"batch_size": bs, "query_length": 1, "cache_length": length, "time_us": max(step, 0.0)})
+ return rows
+
+ def _step(self, bs: int, q: int, length: int) -> None:
+ """One dummy step of ``bs`` requests with ``q`` tokens each at cache length ``length``, on distinct state slots."""
+ self.model_runner._dummy_run(q * bs, uniform_decode=q > 1, context_len=length, valid_dummy_state_slots=True)
+
+ def _time_dummy(self, run: Any, repeats: int = REPEATS) -> float:
+ run()
+ torch.cuda.synchronize()
+ return statistics.median(_elapsed_us(run) for _ in range(repeats))
+
+ def calibrate_draft(self, rows_per_step: list[int], lengths: list[int]) -> list[dict]:
+ """Time one tree step of the draft (``k`` rows of one request) at every cache length."""
+ from eagle_harness.vllm.tree_drafter import TreeDrafter
+
+ speculator = self.model_runner.speculator
+ context = speculator.vllm_config.compilation_config.static_forward_context
+ layer = context[speculator.draft_layer_name]
+ group = next(
+ g
+ for g, spec in enumerate(speculator.kv_cache_config.kv_cache_groups)
+ if speculator.draft_layer_name in spec.layer_names
+ )
+ block_size = speculator.kv_cache_config.kv_cache_groups[group].kv_cache_spec.block_size
+ table = speculator.block_tables.input_block_tables[group][:1]
+ table.copy_(
+ torch.arange(table.shape[1], device=table.device) % layer.kv_cache.shape[0]
+ ) # valid blocks, any content
+ out = []
+ for k in rows_per_step:
+ drafter = TreeDrafter(
+ speculator.model,
+ layer,
+ top_k=k,
+ depth=2,
+ max_reqs=1,
+ device=speculator.device,
+ )
+ drafter.bind_cache(layer.kv_cache, block_size)
+ hidden = torch.randn(
+ 1, speculator.model.config.hidden_size, device=speculator.device, dtype=drafter.tree.root_hidden.dtype
+ )
+ drafter.seed(
+ 1,
+ torch.full((1, k), 1.0 / k, device=speculator.device),
+ torch.arange(k, device=speculator.device)[None],
+ hidden,
+ )
+ for length in lengths:
+ committed = torch.full((1,), length, dtype=torch.int64, device=speculator.device)
+ us = time_graph(lambda drafter=drafter, committed=committed: drafter.grow(1, committed, table))
+ out.append({"query_length": k, "cache_length": length, "time_us": us})
+ return out
+
+
+def fit(
+ data_path: str,
+ target_rows: list[dict],
+ draft_rows: list[dict],
+ target: AttentionShape,
+ draft: AttentionShape,
+ tp: int,
+ *,
+ chain: bool = False,
+ context_step: int = CONTEXT_STEP,
+ context_stop: int,
+) -> list[int]:
+ """Run the core's fits for every timed batch size on the whole-step timings; returns the batch sizes."""
+
+ def rows(timings, bs):
+ return [
+ StepTiming(r["query_length"], r["cache_length"], r["time_us"])
+ for r in timings
+ if r.get("batch_size", 1) == bs
+ ]
+
+ batch_sizes = sorted({r.get("batch_size", 1) for r in target_rows})
+ for bs in batch_sizes:
+ widest = max(r["query_length"] for r in target_rows if r.get("batch_size", 1) == bs)
+ params = MeasureParams(
+ context_step=context_step,
+ context_stop=context_stop,
+ batch_size=bs,
+ verify_num=widest,
+ node_top_k=1 if chain else max(DRAFT_ROWS),
+ loop_top_m=widest,
+ repeat_cnt=1,
+ )
+ fit_step_timings(
+ CalibrationPaths(data_path),
+ params,
+ ComputeIntensity.CHAIN if chain else ComputeIntensity.HIGH,
+ (draft, rows(draft_rows, bs)),
+ (target, rows(target_rows, bs)),
+ tp_size=tp,
+ )
+ return batch_sizes
+
+
+def engine(model: str, draft: str, tp: int, width: int, chain: bool, max_num_seqs: int, **overrides: Any):
+ """The serving engine of a verify width: a static chain (vLLM's chain loop) or a static tree, with the probe."""
+ from vllm import LLM
+ from vllm.plugins import load_general_plugins
+
+ load_general_plugins()
+ if chain:
+ method_config = {"mode": "static", "node_top_k": 1, "tree_depth": width - 1, "max_verify_width": width}
+ backend = "FLASH_ATTN"
+ else:
+ method_config = {"mode": "static", "node_top_k": 8, "tree_depth": -(-width // 8) + 1, "max_verify_width": width}
+ backend = "CUSTOM"
+ args = {
+ "model": model,
+ "tensor_parallel_size": tp,
+ "max_model_len": 4608,
+ "gpu_memory_utilization": 0.85,
+ "max_num_seqs": max_num_seqs,
+ "max_num_batched_tokens": max(8192, max_num_seqs * width),
+ "speculative_config": {
+ "method": "eagle_harness",
+ "model": draft,
+ "method_config": method_config,
+ **({"attention_backend": backend} if chain else {}),
+ },
+ **({"attention_backend": backend} if not chain else {}),
+ "seed": 0,
+ "worker_extension_cls": "eagle_harness.vllm.calibrate.CalibrationProbe",
+ }
+ args.update(overrides)
+ return LLM(**args)
+
+
+def measure(
+ raw_path: str,
+ width: int,
+ chain: bool,
+ batch_sizes: Sequence[int],
+ context_step: int,
+ repeats: int,
+ *,
+ model: str,
+ draft: str,
+ tp: int = 1,
+ engine_args: dict | None = None,
+) -> None:
+ """Start an engine with verify width ``width``, time the target and the draft, write the raw timings to ``raw_path``."""
+ if not chain and list(batch_sizes) != [1]:
+ raise ValueError("tree calibration times batch size 1 only (the tree step is timed for one request)")
+ if chain and not 2 <= width <= MAX_CHAIN_VERIFY_NUM:
+ raise ValueError(f"a chain's width is 2..{MAX_CHAIN_VERIFY_NUM}, got {width}")
+ llm = engine(model, draft, tp, width, chain, max(batch_sizes), **(engine_args or {}))
+ config = llm.llm_engine.vllm_config
+ # Save the resolved configs, including revisions and overrides used by the engine.
+ target_shape = attention_shape(config.model_config.hf_config)
+ draft_shape = attention_shape(config.speculative_config.draft_model_config.hf_config)
+ context_stop = config.model_config.max_model_len
+ lengths = sweep(context_step, context_stop=context_stop)
+ if lengths[-1] + width > context_stop:
+ raise ValueError("context_step leaves too little room for the verify width; increase context_step")
+ sizes = sorted(batch_sizes)
+ widths = [1, width] if width > 1 else [1]
+ target_rows = llm.collective_rpc("calibrate_target", args=(widths, lengths, sizes, repeats))[0]
+ if chain:
+ draft_rows = llm.collective_rpc("calibrate_chain_draft", args=(width, lengths, sizes, repeats))[0]
+ else:
+ draft_rows = llm.collective_rpc("calibrate_draft", args=(list(DRAFT_ROWS), lengths))[0]
+ raw = {
+ "width": width,
+ "tp": tp,
+ "chain": chain,
+ "model": model,
+ "draft_model": draft,
+ "engine_args": engine_args or {},
+ "target_shape": asdict(target_shape),
+ "draft_shape": asdict(draft_shape),
+ "key": cost_key(model, draft, tp, config.model_config.dtype).to_dict(),
+ }
+ raw.update(context_step=context_step, context_stop=context_stop, target=target_rows, draft=draft_rows)
+ with open(raw_path, "w", encoding="utf-8") as f:
+ json.dump(raw, f)
+ print(f"width {width}: {len(target_rows)} target and {len(draft_rows)} draft timings -> {raw_path}")
+
+
+def merge(raw_paths: list[str]) -> tuple[list[dict], list[dict], int, bool, int, int]:
+ """The raw timings of several engines as one set: a (batch size, query length, cache length) timed by more than one
+ engine takes the median. Returns target and draft rows, TP size, chain flag, context step and context stop."""
+ raws = []
+ for path in raw_paths:
+ with open(path, encoding="utf-8") as source:
+ raws.append(json.load(source))
+ for key in (
+ "tp",
+ "chain",
+ "context_step",
+ "context_stop",
+ "model",
+ "draft_model",
+ "engine_args",
+ "target_shape",
+ "draft_shape",
+ "key",
+ ):
+ values = {
+ json.dumps(raw.get(key, {"chain": False, "context_step": CONTEXT_STEP}.get(key)), sort_keys=True)
+ for raw in raws
+ }
+ if len(values) != 1:
+ raise ValueError(f"the raw timings differ in {key}: {sorted(values)}")
+
+ def combined(key: str) -> list[dict]:
+ groups: dict[tuple[int, int, int], list[float]] = {}
+ for raw in raws:
+ for r in raw[key]:
+ groups.setdefault((r.get("batch_size", 1), r["query_length"], r["cache_length"]), []).append(
+ r["time_us"]
+ )
+ return [
+ {"batch_size": bs, "query_length": q, "cache_length": length, "time_us": statistics.median(v)}
+ for (bs, q, length), v in sorted(groups.items())
+ ]
+
+ first = raws[0]
+ if first.get("context_stop") is None:
+ raise ValueError("raw measurements lack context_stop; run calibration again with the served max_model_len")
+ return (
+ combined("target"),
+ combined("draft"),
+ first["tp"],
+ first.get("chain", False),
+ first.get("context_step", CONTEXT_STEP),
+ first["context_stop"],
+ )
+
+
+def cost_key(model: str, draft: str, tp: int, dtype: Any) -> CostKey:
+ """The setup the tables are measured on, checked by the server that loads them."""
+ import vllm
+
+ return CostKey(
+ gpu=torch.cuda.get_device_name(),
+ gpu_count=tp,
+ model=config_digest(model),
+ draft=config_digest(draft),
+ engine=f"vllm {vllm.__version__}",
+ dtype=str(dtype),
+ )
+
+
+def attention_shape(config: Any) -> AttentionShape:
+ """Read attention counts from a text config, refusing unknown layer layouts."""
+ config = getattr(config, "text_config", config)
+ layers = getattr(config, "num_hidden_layers", 0)
+ types = getattr(config, "layer_types", None)
+ window = getattr(config, "sliding_window", None) or 0
+ if types is None:
+ if getattr(config, "full_attention_interval", None) or getattr(config, "hybrid_override_pattern", None):
+ raise ValueError("hybrid calibration needs explicit layer_types in the model config")
+ types = [
+ "sliding_attention" if window and getattr(config, "use_sliding_window", True) else "full_attention"
+ ] * layers
+ known = {"full_attention", "sliding_attention", "linear_attention", "mamba"}
+ if len(types) != layers or set(types) - known:
+ raise ValueError(f"cannot infer attention layout for calibration: {types!r}")
+ count = sum(kind in {"full_attention", "sliding_attention"} for kind in types)
+ sliding = types.count("sliding_attention")
+ if count < 1 or (sliding and window <= 0):
+ raise ValueError("calibration needs attention layers and a positive window for sliding attention")
+ return AttentionShape(count, sliding, window)
+
+
+def validate_tables(data_path: str, *, context_stop: int | None = None) -> None:
+ """Require complete, readable batch-one tables before publishing a serve command."""
+ from eagle_harness.core.cost_table import load_cost_tables
+
+ try:
+ table = load_cost_tables(os.path.join(data_path, "cost"))[1]
+ if context_stop is None:
+ with open(os.path.join(data_path, "config", "measure_config.json"), encoding="utf-8") as source:
+ context_stop = json.load(source)["context_stop"]
+ if len(table.intervals) != (context_stop - table.cache_length_step) // table.cache_length_step:
+ raise ValueError("missing context intervals")
+ for interval in table.intervals:
+ for curve, indices in ((interval.target, (0, 7, 15, 31, 63)), (interval.draft, (0, 1, 3, 7))):
+ if curve.index != indices or len(curve.value) != len(indices):
+ raise ValueError("missing query widths")
+ if any(not math.isfinite(value) or value <= 0 for value in curve.value):
+ raise ValueError("nonpositive or nonfinite timing")
+ except (OSError, KeyError, IndexError, TypeError, ValueError, RuntimeError) as exc:
+ raise RuntimeError(f"incomplete vLLM calibration under {data_path}/cost: {exc}") from exc
+
+
+def main(argv: list[str] | None = None) -> None:
+ """Run one measurement process or fit its saved timings."""
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--model", required=True)
+ parser.add_argument("--draft", required=True)
+ parser.add_argument("--tp", type=int, default=1)
+ parser.add_argument("--engine-args", type=json.loads, default={})
+ sub = parser.add_subparsers(dest="command", required=True)
+ m = sub.add_parser("measure")
+ m.add_argument("raw")
+ m.add_argument("width", type=int)
+ m.add_argument("--chain", action="store_true")
+ m.add_argument("--batch-sizes", default="1")
+ m.add_argument("--context-step", type=int, default=CONTEXT_STEP)
+ m.add_argument("--repeats", type=int, default=REPEATS)
+ f = sub.add_parser("fit")
+ f.add_argument("data_path")
+ f.add_argument("raws", nargs="+")
+ args = parser.parse_args(argv)
+ os.environ["VLLM_USE_V2_MODEL_RUNNER"] = "1"
+ if args.command == "measure":
+ measure(
+ args.raw,
+ args.width,
+ args.chain,
+ [int(x) for x in args.batch_sizes.split(",")],
+ args.context_step,
+ args.repeats,
+ model=args.model,
+ draft=args.draft,
+ tp=args.tp,
+ engine_args=args.engine_args,
+ )
+ else:
+ target_rows, draft_rows, tp, chain, step, stop = merge(args.raws)
+ with open(args.raws[0], encoding="utf-8") as source:
+ geometry = json.load(source)
+ if "target_shape" not in geometry or "draft_shape" not in geometry:
+ raise ValueError("raw measurements lack resolved model geometry. Run calibration again.")
+ target = AttentionShape(**geometry["target_shape"])
+ draft = AttentionShape(**geometry["draft_shape"])
+ sizes = fit(
+ args.data_path,
+ target_rows,
+ draft_rows,
+ target,
+ draft,
+ tp,
+ chain=chain,
+ context_step=step,
+ context_stop=stop,
+ )
+ if geometry.get("key"):
+ write_key(args.data_path, CostKey.from_dict(geometry["key"]))
+ print(f"cost tables for batch sizes {sizes} under {args.data_path}/cost (TP{tp})")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/eagle_harness/vllm/candidate_gather.py b/eagle_harness/vllm/candidate_gather.py
new file mode 100644
index 0000000..626ccce
--- /dev/null
+++ b/eagle_harness/vllm/candidate_gather.py
@@ -0,0 +1,66 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Rank-major all-gather of the draft's packed candidates over NVLink multicast.
+
+Every draft step all-gathers each rank's packed candidates (a few KB). NCCL's ring all-gather is ~10-12 us there at
+TP4 on B300; ``torch.ops.symm_mem.multimem_all_gather_out`` into a symmetric buffer is one kernel. Where symmetric
+memory or multicast is missing the gather falls back to vLLM's (NCCL) all-gather. Both give the same bytes in the same
+rank-major order, so the outputs do not change.
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import Any
+
+import torch
+
+logger = logging.getLogger(__name__)
+
+
+def _multimem_all_gather_out(x: torch.Tensor, group_name: str, out: torch.Tensor) -> None:
+ """``out`` (``[world * rows, width]``, a view of a symmetric buffer) = the rank-major gather of ``x`` ``[rows, width]``.
+
+ The op wants ``out`` with the input's rank and ``out.shape[0] == world * x.shape[0]``."""
+ torch.ops.symm_mem.multimem_all_gather_out(x, group_name, out)
+
+
+class CandidateGather:
+ """``all_gather(x, dim=0)`` of the TP group for int64 ``[rows, width]`` with ``rows <= max_rows``.
+
+ The symmetric buffer is allocated at the first call (a warm-up run, which every rank makes at the same time;
+ never inside a CUDA graph capture) and holds the result until the next call.
+ """
+
+ def __init__(self, group: Any, max_rows: int):
+ self.group = group # vLLM's GroupCoordinator of the TP group
+ self.max_rows = max_rows
+ self.out: torch.Tensor | None = None
+ self._tried = False
+
+ def _allocate(self, x: torch.Tensor) -> None:
+ self._tried = True
+ try:
+ import torch.distributed._symmetric_memory as symm_mem
+
+ out = symm_mem.empty(self.group.world_size * self.max_rows * x.shape[1], dtype=x.dtype, device=x.device)
+ handle = symm_mem.rendezvous(out, self.group.device_group.group_name)
+ except (ImportError, RuntimeError) as error:
+ logger.info("candidate all-gather on NCCL: no symmetric memory (%s)", error)
+ return
+ if handle.multicast_ptr == 0:
+ logger.info("candidate all-gather on NCCL: no multicast")
+ return
+ self.out = out
+
+ def __call__(self, x: torch.Tensor) -> torch.Tensor:
+ if not self._tried and not torch.cuda.is_current_stream_capturing():
+ self._allocate(x)
+ rows, width = x.shape
+ world = self.group.world_size
+ if self.out is None or rows > self.max_rows or x.dtype != self.out.dtype or not x.is_contiguous():
+ return self.group.all_gather(x, dim=0)
+ out = self.out[: world * rows * width].view(world * rows, width)
+ _multimem_all_gather_out(x, self.group.device_group.group_name, out)
+ return out
diff --git a/eagle_harness/vllm/config.py b/eagle_harness/vllm/config.py
new file mode 100644
index 0000000..7d3ad9a
--- /dev/null
+++ b/eagle_harness/vllm/config.py
@@ -0,0 +1,267 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""``--speculative-config`` options of the ``eagle_harness`` method on vLLM.
+
+vLLM does not interpret ``SpeculativeConfig.method_config``; this module does.
+The keys are :class:`~eagle_harness.core.config.HarnessConfig` (same names and
+strict parsing as sglang's ``--speculative-algorithm-config``) plus three that
+sglang takes from its own server arguments, and one of the vLLM tree drafter:
+
+- ``max_verify_width``: the largest verify width (tree nodes including the root);
+ vLLM's ``num_speculative_tokens`` is this minus one.
+- ``node_top_k`` / ``tree_depth``: the draft tree shape, which sizes the draft's KV
+ lookahead (``req_to_token_span`` in sglang terms).
+- ``depth_stop_gain``: what one more draft step must add to the verify set's score sum (its
+ expected accepted length) for a round to run it (:mod:`eagle_harness.vllm.depth_stop`).
+ ``"derived"`` (default): the step's measured cost in accepted tokens, from the cost tables
+ under ``data_path`` (:func:`~eagle_harness.vllm.depth_stop.round_costs`: the round's expected
+ accept x draft step / (verify forward + steps run x draft step)); without tables that time
+ this shape, automatic serving refuses startup. Static mode keeps a lossless stop.
+ A number overrides it with a fixed gain;
+ ``0.0`` stops only when no deeper node can enter the verify set, so the verify rows equal
+ those of the full ``tree_depth``; ``null``: always ``tree_depth``.
+- ``record_rounds`` (tree, default false): time the served decode rounds and merge them into
+ ``<data_path>/rounds/tree.json`` (:mod:`eagle_harness.vllm.round_recorder`). A tree whose
+ ``data_path`` holds those rounds verifies fewer rows from the first batch size where that
+ measured faster (:func:`~eagle_harness.core.chain_width.served_tree_schedule`); smaller batches
+ keep ``max_verify_width``.
+
+Example::
+
+ --speculative-config '{"method": "eagle_harness", "model": "eagle-ai/EAGLE-4-Qwen3.8-27B",
+ "method_config": {"data_path": "/data/cost/qwen38-tp4", "max_verify_width": 32,
+ "node_top_k": 8, "tree_depth": 12}}'
+
+Pure Python over ``core``: no GPU and no vLLM import at module load.
+"""
+
+from __future__ import annotations
+
+import logging
+from dataclasses import dataclass
+from typing import Any, List, Literal, Mapping, Tuple
+
+from eagle_harness.core.chain_width import PROFILE_FILE, chain_widths, load_tree_rounds, served_tree_schedule
+from eagle_harness.core.config import HarnessConfig, harness_config_from_dict
+from eagle_harness.core.limits import (
+ MAX_CHAIN_VERIFY_NUM,
+ MAX_VERIFY_NUM,
+ ComputeIntensity,
+ check_shape,
+ cost_batch_sizes,
+ max_batch_size,
+ req_to_token_span,
+ verify_buckets,
+)
+
+METHOD_NAME = "eagle_harness"
+# Keys of ``method_config`` that are not HarnessConfig fields.
+VLLM_KEYS = ("max_verify_width", "node_top_k", "tree_depth", "depth_stop_gain", "record_rounds")
+DEFAULT_NODE_TOP_K = 8
+DEFAULT_TREE_DEPTH = 12
+DERIVED = "derived" # depth_stop_gain from the measured costs
+NATIVE_DECODE_UNSUPPORTED = (
+ "eagle_harness: the chain schedule selects native plain decode (width 0), "
+ "which requires vLLM's native_decode_batch_sizes capability. K=0 still extends draft KV. "
+ "Use a compatible host, run without speculative_config, or calibrate root-only width 1."
+)
+
+logger = logging.getLogger(__name__)
+
+
+@dataclass(frozen=True)
+class VllmMethodConfig:
+ """A parsed ``method_config``."""
+
+ harness: HarnessConfig
+ max_verify_width: int # tree nodes including the root; K = max_verify_width - 1
+ node_top_k: int
+ tree_depth: int
+ depth_stop_gain: float | Literal["derived"] | None = DERIVED
+ record_rounds: bool = False # time served rounds into <data_path>/rounds/tree.json
+
+ @property
+ def num_speculative_tokens(self) -> int:
+ return self.max_verify_width - 1
+
+ @property
+ def draft_kv_lookahead(self) -> int:
+ """KV slots past the scheduled query that a round writes (draft or verify)."""
+ return max(
+ self.num_speculative_tokens, req_to_token_span(self.node_top_k, self.tree_depth, self.max_verify_width, 1)
+ )
+
+
+def default_max_verify_width(intensity: ComputeIntensity) -> int:
+ return MAX_CHAIN_VERIFY_NUM if intensity is ComputeIntensity.CHAIN else 32
+
+
+def parse_method_config(method_config: Mapping[str, Any]) -> VllmMethodConfig:
+ """Parse and validate ``SpeculativeConfig.method_config``. Unknown keys raise."""
+ data = dict(method_config)
+ extra = {key: data.pop(key) for key in VLLM_KEYS if key in data}
+ harness = harness_config_from_dict(data)
+ chain = harness.intensity is ComputeIntensity.CHAIN
+ width = extra.get("max_verify_width", default_max_verify_width(harness.intensity))
+ top_k = extra.get("node_top_k", 1 if chain else DEFAULT_NODE_TOP_K)
+ depth = extra.get("tree_depth", MAX_CHAIN_VERIFY_NUM - 1 if chain else DEFAULT_TREE_DEPTH)
+ for name, value in (("max_verify_width", width), ("node_top_k", top_k), ("tree_depth", depth)):
+ if isinstance(value, bool) or not isinstance(value, int):
+ raise ValueError(f"method_config.{name} must be an integer, got {value!r}.")
+ if width > (MAX_CHAIN_VERIFY_NUM if chain else MAX_VERIFY_NUM):
+ raise NotImplementedError(f"max_verify_width={width} is not supported for {harness.intensity.value}.")
+ check_shape(harness.intensity, top_k, depth, width, 1)
+ gain = extra.get("depth_stop_gain", DERIVED)
+ if gain not in (None, DERIVED) and (isinstance(gain, bool) or not isinstance(gain, (int, float)) or gain < 0):
+ raise ValueError(f'method_config.depth_stop_gain must be "derived", a number >= 0 or null, got {gain!r}.')
+ record = extra.get("record_rounds", False)
+ if not isinstance(record, bool):
+ raise ValueError(f"method_config.record_rounds must be true or false, got {record!r}.")
+ if record and not harness.data_path:
+ raise ValueError("method_config.record_rounds needs a data_path to write rounds/tree.json under.")
+ return VllmMethodConfig(
+ harness=harness,
+ max_verify_width=width,
+ node_top_k=top_k,
+ tree_depth=depth,
+ depth_stop_gain=gain if gain in (None, DERIVED) else float(gain),
+ record_rounds=record,
+ )
+
+
+def verify_width_schedule(
+ intensity: ComputeIntensity, max_verify_width: int, data_path: str | None = None, *, allow_unpriced: bool = False
+) -> List[Tuple[int, int, int]]:
+ """The draft-count schedule for callers without native-decode metadata.
+
+ Trees schedule the widest verify bucket minus its root. Chains use the
+ canonical priced width minus one. A selected width zero is rejected here:
+ only configure_speculative_config can pass its separate native ranges to a
+ capable host. Unpriced chains require an explicit fixed width.
+ """
+ widths = _verify_widths(intensity, max_verify_width, data_path, allow_unpriced=allow_unpriced)
+ if any(width == 0 for _, _, width in widths):
+ raise ValueError(NATIVE_DECODE_UNSUPPORTED)
+ return _draft_token_schedule(widths, max_batch_size(intensity))
+
+
+def _verify_widths(
+ intensity: ComputeIntensity, max_verify_width: int, data_path: str | None, *, allow_unpriced: bool
+) -> List[Tuple[int, int, int]]:
+ limit = max_batch_size(intensity)
+ widths = derived_chain_widths(data_path, max_verify_width, limit) if intensity is ComputeIntensity.CHAIN else None
+ if widths is None and intensity is ComputeIntensity.CHAIN and not allow_unpriced:
+ raise ValueError(
+ f"eagle_harness: no priced chain schedule with an acceptance profile under {data_path} "
+ f"({PROFILE_FILE}); calibrate the chain or explicitly set max_verify_width for a fixed unpriced chain."
+ )
+ if widths is None:
+ widths = [(bs, bs, min(max(verify_buckets(bs, intensity)), max_verify_width)) for bs in cost_batch_sizes(limit)]
+ return widths
+
+
+def _draft_token_schedule(widths: List[Tuple[int, int, int]], limit: int) -> List[Tuple[int, int, int]]:
+ ranges: List[Tuple[int, int, int]] = []
+ for _, last, width in widths:
+ count = max(0, width - 1)
+ if ranges and ranges[-1][2] == count:
+ ranges[-1] = (ranges[-1][0], last, count)
+ else:
+ ranges.append((ranges[-1][1] + 1 if ranges else 1, last, count))
+ ranges.append((limit + 1, 1 << 16, 0))
+ return ranges
+
+
+def derived_chain_widths(data_path: str | None, max_verify_width: int, limit: int) -> List[Tuple[int, int, int]] | None:
+ """The chain widths per batch size range priced by the served round times (else the cost tables) and the acceptance
+ profile under ``data_path`` (:func:`eagle_harness.core.chain_width.chain_widths`); None when missing."""
+ if not data_path:
+ return None
+ widths = chain_widths(data_path, max_verify_width, limit, allow_no_spec=True)
+
+ if widths is not None:
+ logger.info("eagle_harness: chain widths per batch size from %s: %s", data_path, widths)
+ return widths
+
+
+def aux_hidden_state_layers(draft_hf_config: Any) -> Tuple[int, ...]:
+ """vLLM layer ids whose input the target captures for the draft (``()``: none named).
+
+ The checkpoint names the layers whose *output* the draft was trained on (the sglang convention);
+ vLLM captures the input of the layer it is given, one layer later.
+ """
+ named = (getattr(draft_hf_config, "eagle_config", None) or {}).get("eagle_aux_hidden_state_layer_ids") or ()
+ return tuple(layer + 1 for layer in named)
+
+
+def configure_speculative_config(spec_config: Any) -> None:
+ """``SpeculativeMethodSpec.configure``: runs at the end of ``SpeculativeConfig.__post_init__``.
+
+ ``num_speculative_tokens`` defaults to the widest verify the batch-size schedule runs, not to
+ ``max_verify_width - 1``: vLLM reserves ``1 + num_speculative_tokens`` linear-attention state slots per request
+ for the whole request, so a K no batch size verifies only costs running requests.
+ """
+ parsed = parse_method_config(spec_config.method_config)
+ if parsed.node_top_k > 1 and getattr(spec_config, "native_decode_batch_sizes", None):
+ raise ValueError("eagle_harness: native decode ranges require chain mode (node_top_k=1).")
+ if spec_config.draft_model_config is not None:
+ draft = spec_config.draft_model_config.hf_config
+ if "LlamaForCausalLMEagle4" in getattr(draft, "architectures", ()):
+ draft.eagle_aux_hidden_state_layer_ids = aux_hidden_state_layers(draft)
+ elif set(getattr(draft, "architectures", ())) & {
+ "Eagle3LlamaForCausalLM",
+ "LlamaForCausalLMEagle3",
+ "LlamaForCausalLM",
+ }:
+ # Native EAGLE3 top-level layer ids already name layer inputs.
+ draft.architectures = ["Eagle3ForHarness"]
+ spec_config.update_arch_()
+ if parsed.harness.mode.uses_cost_model and spec_config.num_speculative_tokens_per_batch_size is None:
+ widths = _verify_widths(
+ parsed.harness.intensity,
+ parsed.max_verify_width,
+ parsed.harness.data_path,
+ allow_unpriced="max_verify_width" in spec_config.method_config,
+ )
+ native_ranges = [(first, last) for first, last, width in widths if width == 0]
+ if native_ranges:
+ if not hasattr(spec_config, "native_decode_batch_sizes"):
+ raise ValueError(NATIVE_DECODE_UNSUPPORTED)
+ spec_config.native_decode_batch_sizes = native_ranges
+ spec_config.num_speculative_tokens_per_batch_size = _draft_token_schedule(
+ widths, max_batch_size(parsed.harness.intensity)
+ )
+ elif parsed.node_top_k > 1 and spec_config.num_speculative_tokens_per_batch_size is None:
+ tree = measured_tree_schedule(parsed)
+ if tree is not None:
+ spec_config.num_speculative_tokens_per_batch_size = tree
+ schedule = spec_config.num_speculative_tokens_per_batch_size
+ widest = parsed.num_speculative_tokens if schedule is None else max(1, max(k for _, _, k in schedule))
+ if spec_config.num_speculative_tokens is None:
+ spec_config.num_speculative_tokens = widest
+ elif spec_config.num_speculative_tokens not in (widest, parsed.num_speculative_tokens):
+ raise ValueError(
+ f"num_speculative_tokens={spec_config.num_speculative_tokens} disagrees with "
+ f"method_config.max_verify_width={parsed.max_verify_width} (they must differ by one); "
+ "set only one of them."
+ )
+
+
+def measured_tree_schedule(parsed: VllmMethodConfig) -> List[Tuple[int, int, int]] | None:
+ """The static tree's draft-count schedule from served rounds under ``data_path`` (None: one width throughout)."""
+ data_path = parsed.harness.data_path
+ rounds = load_tree_rounds(data_path) if data_path else None
+ if not rounds:
+ return None
+ limit = max_batch_size(parsed.harness.intensity)
+ widths = served_tree_schedule(rounds, parsed.max_verify_width, limit)
+ if widths is None:
+ return None
+ logger.info("eagle_harness: tree verify width per batch size from %s: %s", data_path, widths)
+ return _draft_token_schedule(widths, limit)
+
+
+def num_lookahead_tokens(spec_config: Any) -> int:
+ """``SpeculativeMethodSpec.num_lookahead_tokens`` (sglang hook H5's role)."""
+ return parse_method_config(spec_config.method_config).draft_kv_lookahead
diff --git a/eagle_harness/vllm/depth_stop.py b/eagle_harness/vllm/depth_stop.py
new file mode 100644
index 0000000..9c0c2a2
--- /dev/null
+++ b/eagle_harness/vllm/depth_stop.py
@@ -0,0 +1,240 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""When a round's draft tree stops growing: the stop rule of :class:`~eagle_harness.vllm.tree_drafter.TreeDrafter`.
+
+After draft step ``s`` the tree holds depths ``1 .. s + 1``; step ``s + 1`` would add the children of the depth-``s + 1``
+frontier. A node's score is its parent's times a probability, and the verify set ranks nodes by depth-decayed score,
+so a child at depth ``s + 2`` ranks at most ``front * DEPTH_DECAY ** (s + 2)`` (``front``: its parent's score); every
+later descendant ranks lower still. With ``threshold`` the decayed score of the ``count``-th best node so far (the
+last verify row), the next step runs only if
+
+- ``max(front) * decay >= threshold``: some child could still enter the verify set (with no gain asked of the step
+ this is the whole rule, and the verify rows are exactly those of the full-depth tree), and
+- ``gain = sum(relu(front * decay * ratio - threshold)) >= min_gain + step_share * expected``: what the step is
+ expected to add to the verify set's score sum (its expected accepted length) pays for the step. A child scores its
+ parent's score times its own probability; ``ratio`` estimates that probability by the last step's: the best score
+ of the newest layer over the best score of the layer above it.
+
+The price of a step comes from measured costs (:class:`RoundCosts`): a round that ran ``s`` steps takes
+``rest + s * draft_step`` and yields ``expected = 1 + sum(verify set scores)`` accepted tokens by the draft's own
+probabilities, so one more step keeps the tokens per time from falling only if it adds at least
+``expected * draft_step / (rest + s * draft_step)`` (``step_share = draft_step / (rest + s * draft_step)``). Without
+measured costs ``step_share`` is 0 and ``min_gain`` (0 unless the config overrides it) is the whole price.
+
+Across a batch, the next step runs if any request wants it (a request that would stop loses nothing). The decision
+stays on the GPU: :func:`keep_growing` writes a scalar bool that a CUDA graph conditional node reads, so a captured
+growth skips the steps it does not need without a host read.
+"""
+
+from __future__ import annotations
+
+import logging
+from dataclasses import dataclass
+from typing import Mapping
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.core.chain_width import median_cost
+from eagle_harness.core.config import Mode
+from eagle_harness.core.cost_table import BatchCostTable, load_cost_tables
+from eagle_harness.core.limits import MAX_BATCH_SIZE_TREE, nearest_cost_batch_size
+from eagle_harness.vllm.config import VllmMethodConfig, verify_width_schedule
+
+logger = logging.getLogger(__name__)
+
+
+@dataclass(frozen=True)
+class RoundCosts:
+ """What a draft step costs against its round, in microseconds (calibration tables, :func:`round_costs`).
+
+ shortcut: ``rest`` is the verify forward only; the draft prefill, the accept and the state commit are not in the
+ tables, which prices a step ~20% high on Qwen3.8-27B at TP4 (inside the flat optimum of the replay). Time them in
+ the calibration if a model's round has a larger share outside the verify.
+ """
+
+ draft_step: float # one draft step: the tree step over the frontier
+ rest: float # the round without its draft steps: the target's verify forward
+
+ def step_share(self, steps: int) -> float:
+ """One more draft step's cost over a round that ran ``steps`` of them."""
+ return self.draft_step / (self.rest + steps * self.draft_step)
+
+
+def round_costs(
+ tables: Mapping[int, BatchCostTable] | None, batch_size: int, top_k: int, count: int
+) -> RoundCosts | None:
+ """The costs of a round of ``batch_size`` requests with ``count`` verify rows each, from the cost tables of the
+ nearest measured batch size: the draft's step of ``top_k`` rows and the target's forward of ``count + 1`` tokens per
+ request, each the median over the tables' context intervals. None if the tables did not time these shapes."""
+ if not tables:
+ return None
+ table = tables[nearest_cost_batch_size(batch_size, tables)]
+ draft = median_cost([interval.draft for interval in table.intervals], top_k)
+ verify = median_cost([interval.target for interval in table.intervals], count + 1)
+ if draft is None or verify is None or draft <= 0 or verify <= 0:
+ return None
+ return RoundCosts(draft_step=draft, rest=verify)
+
+
+def derived_cost_tables(
+ config: VllmMethodConfig,
+ key=None,
+ *,
+ schedule: list[tuple[int, int, int]] | None = None,
+ max_batch_size: int = MAX_BATCH_SIZE_TREE,
+) -> dict[int, BatchCostTable] | None:
+ """Require prices for every automatic serving shape before drafting.
+
+ Static calibration may run without tables; serving must explicitly set
+ ``depth_stop_gain`` to opt out of measured pricing.
+ """
+ cost_dir = config.harness.cost_dir if config.harness.data_path else None
+ top_k, width = config.node_top_k, config.max_verify_width
+ tables = load_cost_tables(cost_dir, key) if cost_dir else {}
+ if config.harness.mode is not Mode.STATIC:
+ schedule = schedule if schedule is not None else verify_width_schedule(config.harness.intensity, width)
+ for first, last, count in schedule:
+ if count == 0:
+ continue
+ for bs in range(first, min(last, max_batch_size) + 1):
+ if round_costs(tables, bs, top_k, count) is None:
+ raise ValueError(
+ f"eagle_harness: no cost tables price batch size {bs}, draft step {top_k}, "
+ f"verify width {count + 1} under {cost_dir}; calibrate this shape or explicitly "
+ "set depth_stop_gain (0 for a lossless stop, null for fixed depth)."
+ )
+ costs = round_costs(tables, 1, top_k, width - 1)
+ if costs is None and config.harness.mode is not Mode.STATIC:
+ logger.info("eagle_harness: all active scheduled shapes are priced under %s", cost_dir)
+ return tables
+ if costs is None:
+ logger.warning(
+ "eagle_harness: no cost tables price a draft step of %d rows and a verify of width %d%s; the depth stop is "
+ "lossless (set data_path to calibrated cost tables for this round shape, or set depth_stop_gain)",
+ top_k,
+ width,
+ f" under {cost_dir}" if cost_dir else "",
+ )
+ return None
+ logger.info(
+ "eagle_harness: depth stop priced by the cost tables under %s: draft step %.1f us, verify %.1f us (batch "
+ "size 1, width %d)",
+ cost_dir,
+ costs.draft_step,
+ costs.rest,
+ width,
+ )
+ return tables
+
+
+def keep_growing_reference(
+ scores: torch.Tensor,
+ decay: torch.Tensor,
+ front: torch.Tensor,
+ count: int,
+ next_decay: float,
+ min_gain: float,
+ parent_layer: tuple[int, int],
+ step_share: float = 0.0,
+) -> torch.Tensor:
+ """The rule in torch: ``scores`` ``[bs, nodes]`` (0 where no node was grown), ``decay`` ``[nodes]``, ``front``
+ ``[bs, K]`` the frontier's scores (the newest layer's best), ``parent_layer`` the node range of the layer above the
+ newest, ``step_share`` :meth:`RoundCosts.step_share`; a scalar bool."""
+ ranked = torch.sort(scores * decay, dim=-1, descending=True).values
+ threshold = ranked[:, count - 1 : count]
+ reach = front * torch.tensor(next_decay, dtype=torch.float32, device=front.device)
+ parent_best = scores[:, parent_layer[0] : parent_layer[1]].max(-1, keepdim=True).values
+ ratio = front.max(-1, keepdim=True).values / parent_best.clamp(min=1e-30)
+ gain = (reach * ratio - threshold).clamp(min=0).sum(-1)
+ expected = 1.0 + ranked[:, :count].sum(-1)
+ keep = (reach.max(-1).values >= threshold[:, 0]) & (gain >= min_gain + step_share * expected)
+ return keep.any()
+
+
+def _keep_growing_kernel(
+ scores,
+ decay,
+ front,
+ go,
+ stats,
+ bs,
+ stride_scores,
+ stride_front,
+ count,
+ next_decay,
+ min_gain,
+ step_share,
+ parent_lo,
+ parent_hi,
+ NODES: tl.constexpr,
+ N_BLOCK: tl.constexpr,
+ K: tl.constexpr,
+ K_BLOCK: tl.constexpr,
+ STEPS_BEFORE: tl.constexpr,
+):
+ node = tl.arange(0, N_BLOCK)
+ lane = tl.arange(0, K_BLOCK)
+ d = tl.load(decay + node, mask=node < NODES, other=0.0)
+ keep = tl.full([], 0, tl.int32)
+ for b in range(bs):
+ raw = tl.load(scores + b * stride_scores + node, mask=node < NODES, other=0.0)
+ ranked = tl.sort(raw * d, descending=True)
+ threshold = tl.sum(tl.where(node == count - 1, ranked, 0.0))
+ f = tl.load(front + b * stride_front + lane, mask=lane < K, other=0.0)
+ reach = f * next_decay
+ parent_best = tl.max(tl.where((node >= parent_lo) & (node < parent_hi), raw, 0.0))
+ ratio = tl.max(f) / tl.maximum(parent_best, 1e-30)
+ gain = tl.sum(tl.where(lane < K, tl.maximum(reach * ratio - threshold, 0.0), 0.0))
+ expected = 1.0 + tl.sum(tl.where(node < count, ranked, 0.0))
+ wants = (tl.max(tl.where(lane < K, reach, -1.0)) >= threshold) & (gain >= min_gain + step_share * expected)
+ keep = tl.maximum(keep, wants.to(tl.int32))
+ tl.store(go, keep != 0)
+ # stats: [rounds, draft steps run]; the round's first decision also counts the steps before it
+ if STEPS_BEFORE > 0:
+ tl.store(stats, tl.load(stats) + 1)
+ tl.store(stats + 1, tl.load(stats + 1) + STEPS_BEFORE + keep)
+
+
+def keep_growing(
+ go: torch.Tensor,
+ stats: torch.Tensor,
+ scores: torch.Tensor,
+ decay: torch.Tensor,
+ front: torch.Tensor,
+ count: int,
+ next_decay: float,
+ min_gain: float,
+ parent_layer: tuple[int, int],
+ *,
+ steps_before: int,
+ step_share: float = 0.0,
+) -> None:
+ """Write the rule's decision into ``go`` (a scalar bool) in one launch; ``stats`` (int64 ``[2]``) counts rounds
+ and the draft steps they run (``steps_before`` > 0: a round's first decision, after that many steps)."""
+ bs, nodes = scores.shape
+ k = front.shape[1]
+ _keep_growing_kernel[(1,)](
+ scores,
+ decay,
+ front,
+ go,
+ stats,
+ bs,
+ scores.stride(0),
+ front.stride(0),
+ count,
+ float(next_decay),
+ float(min_gain),
+ float(step_share),
+ parent_layer[0],
+ parent_layer[1],
+ NODES=nodes,
+ N_BLOCK=triton.next_power_of_2(nodes),
+ K=k,
+ K_BLOCK=max(2, triton.next_power_of_2(k)),
+ STEPS_BEFORE=steps_before,
+ )
diff --git a/eagle_harness/vllm/draft_attention.py b/eagle_harness/vllm/draft_attention.py
new file mode 100644
index 0000000..7cbcd38
--- /dev/null
+++ b/eagle_harness/vllm/draft_attention.py
@@ -0,0 +1,277 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Attention of the draft tree's steps on vLLM.
+
+Draft step ``s`` runs ``K`` frontier rows per request, each at position ``c + s - 1`` (``c``: the committed
+length), writing its draft KV to a slot past ``c`` and attending to
+
+- the request's committed draft KV inside the draft's sliding window (the same keys for all rows), and
+- the row's own ``s`` tree ancestors, itself last, whose slots :attr:`DraftTree.ancestors` keeps.
+
+:func:`tree_step_attention` reads those keys through the block table and loads each committed key once for all the
+rows of a request (:mod:`eagle_harness.kernels.row_attention`, the kernel sglang's draft uses). The per-row pair
+:func:`build_tree_rows` + :func:`row_attention` (each row a one-token decode over an explicit list of KV slots) is
+its reference.
+"""
+
+from __future__ import annotations
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels.row_attention import RowsLaunch, program_splits, rows_attention, rows_padded, window_start
+
+KEYS_PER_SPLIT = 512
+MAX_SPLITS = 16
+BLOCK_KEYS = 64
+_BUILD_BLOCK = 1024
+
+
+def _tree_rows_kernel(
+ block_table_ptr, # [num_reqs, max_blocks] int32 of the draft KV group, by batch row
+ stride_table,
+ block_size,
+ committed_ptr, # [num_reqs] committed draft length c
+ ancestors_ptr, # [num_reqs, K, max_depth] int32: draft KV slot of each frontier row's ancestors
+ keys_ptr, # [rows, max_keys] int32 out
+ stride_keys,
+ num_keys_ptr, # [rows] int32 out
+ step,
+ window,
+ max_depth: tl.constexpr,
+ top_k: tl.constexpr,
+ BLOCK: tl.constexpr,
+):
+ row = tl.program_id(0)
+ chunk = tl.program_id(1)
+ b = row // top_k
+ committed = tl.load(committed_ptr + b).to(tl.int32)
+ start = window_start(committed + step - 1, window)
+ start = tl.minimum(start, committed)
+ prefix = committed - start
+ total = prefix + step
+ offs = chunk * BLOCK + tl.arange(0, BLOCK)
+ position = start + offs
+ block = tl.load(block_table_ptr + b * stride_table + position // block_size, mask=offs < prefix, other=0)
+ slot = block.to(tl.int32) * block_size + position % block_size
+ ancestor = tl.load(
+ ancestors_ptr + row * max_depth + (offs - prefix), mask=(offs >= prefix) & (offs < total), other=0
+ )
+ tl.store(keys_ptr + row * stride_keys + offs, tl.where(offs < prefix, slot, ancestor), mask=offs < total)
+ if chunk == 0:
+ tl.store(num_keys_ptr + row, total)
+
+
+def build_tree_rows(
+ block_table: torch.Tensor,
+ block_size: int,
+ committed: torch.Tensor,
+ ancestors: torch.Tensor,
+ keys: torch.Tensor,
+ num_keys: torch.Tensor,
+ *,
+ step: int,
+ window: int,
+) -> None:
+ """Key lists of draft step ``step`` for the ``bs * K`` frontier rows (``ancestors``: ``[bs, K, depth]``)."""
+ bs, top_k, max_depth = ancestors.shape
+ _tree_rows_kernel[(bs * top_k, triton.cdiv(keys.shape[1], _BUILD_BLOCK))](
+ block_table,
+ block_table.stride(0),
+ block_size,
+ committed,
+ ancestors,
+ keys,
+ keys.stride(0),
+ num_keys,
+ step,
+ window,
+ max_depth=max_depth,
+ top_k=top_k,
+ BLOCK=_BUILD_BLOCK,
+ )
+
+
+def _row_attention_split_kernel(
+ q_ptr, # [rows, H, D]
+ kv_ptr, # KV cache base
+ keys_ptr, # [rows, max_keys] int32 KV slots
+ stride_keys,
+ num_keys_ptr, # [rows]
+ partial_ptr, # [rows, H, SPLITS, D] fp32
+ partial_lse_ptr, # [rows, H, SPLITS] fp32
+ stride_qr,
+ stride_qh,
+ stride_block,
+ stride_head,
+ stride_slot,
+ block_size,
+ scale,
+ D: tl.constexpr,
+ H: tl.constexpr,
+ QUERY_GROUP_SIZE: tl.constexpr,
+ SPLITS: tl.constexpr,
+ PER_SPLIT: tl.constexpr,
+ BLOCK: tl.constexpr,
+):
+ row, head, split = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ num_keys = tl.load(num_keys_ptr + row)
+ lo = split * PER_SPLIT
+ hi = tl.minimum(lo + PER_SPLIT, num_keys)
+ dims = tl.arange(0, D)
+ q = tl.load(q_ptr + row * stride_qr + head * stride_qh + dims).to(tl.float32)
+ peak = tl.full([], float("-inf"), dtype=tl.float32)
+ total = tl.zeros([], dtype=tl.float32)
+ acc = tl.zeros([D], dtype=tl.float32)
+ for first in range(lo, hi, BLOCK):
+ offs = first + tl.arange(0, BLOCK)
+ valid = offs < hi
+ slot = tl.load(keys_ptr + row * stride_keys + offs, mask=valid, other=0).to(tl.int64)
+ at = (
+ (slot // block_size) * stride_block
+ + (head // QUERY_GROUP_SIZE) * stride_head
+ + (slot % block_size) * stride_slot
+ )
+ k = tl.load(kv_ptr + at[:, None] + dims[None, :], mask=valid[:, None], other=0.0).to(tl.float32)
+ scores = tl.sum(k * q[None, :], 1) * scale
+ scores = tl.where(valid, scores, float("-inf"))
+ new_peak = tl.maximum(peak, tl.max(scores, 0))
+ weights = tl.exp(scores - new_peak)
+ rescale = tl.exp(peak - new_peak)
+ v = tl.load(kv_ptr + at[:, None] + D + dims[None, :], mask=valid[:, None], other=0.0).to(tl.float32)
+ acc = acc * rescale + tl.sum(weights[:, None] * v, 0)
+ total = total * rescale + tl.sum(weights, 0)
+ peak = new_peak
+ out = (row * H + head) * SPLITS + split
+ tl.store(partial_ptr + out * D + dims, acc / total)
+ tl.store(partial_lse_ptr + out, peak + tl.log(total))
+
+
+def _row_attention_merge_kernel(
+ partial_ptr,
+ partial_lse_ptr,
+ num_keys_ptr,
+ out_ptr, # [rows, H, D]
+ H: tl.constexpr,
+ D: tl.constexpr,
+ SPLITS: tl.constexpr,
+ PER_SPLIT: tl.constexpr,
+):
+ row, head = tl.program_id(0), tl.program_id(1)
+ num_splits = tl.cdiv(tl.load(num_keys_ptr + row), PER_SPLIT)
+ splits = tl.arange(0, SPLITS)
+ base = (row * H + head) * SPLITS
+ lse = tl.load(partial_lse_ptr + base + splits, mask=splits < num_splits, other=float("-inf"))
+ weights = tl.exp(lse - tl.max(lse, 0))
+ parts = tl.load(
+ partial_ptr + (base + splits)[:, None] * D + tl.arange(0, D)[None, :],
+ mask=(splits < num_splits)[:, None],
+ other=0.0,
+ )
+ out = tl.sum(parts * (weights / tl.sum(weights, 0))[:, None], 0)
+ tl.store(out_ptr + (row * H + head) * D + tl.arange(0, D), out.to(out_ptr.dtype.element_ty))
+
+
+def row_attention(
+ q: torch.Tensor,
+ key_cache: torch.Tensor,
+ keys: torch.Tensor,
+ num_keys: torch.Tensor,
+ scale: float,
+) -> torch.Tensor:
+ """One-token attention of ``rows`` queries ``[rows, H, D]`` over the KV slots in ``keys``.
+
+ ``key_cache``: the layer's KV cache viewed ``[blocks, slots in a block, heads, 2 * D]`` (K then V of a token).
+ """
+ rows, num_heads, head_dim = q.shape
+ kv_heads = key_cache.shape[2]
+ if kv_heads <= 0 or num_heads % kv_heads:
+ raise ValueError(f"query heads ({num_heads}) must be divisible by KV heads ({kv_heads})")
+ block_size = key_cache.shape[1]
+ max_splits = triton.cdiv(keys.shape[1], KEYS_PER_SPLIT)
+ splits = min(triton.next_power_of_2(max_splits), MAX_SPLITS)
+ per_split = triton.cdiv(keys.shape[1], splits)
+ partial = torch.empty((rows, num_heads, splits, head_dim), dtype=torch.float32, device=q.device)
+ partial_lse = torch.empty((rows, num_heads, splits), dtype=torch.float32, device=q.device)
+ out = torch.empty_like(q)
+ _row_attention_split_kernel[(rows, num_heads, splits)](
+ q,
+ key_cache,
+ keys,
+ keys.stride(0),
+ num_keys,
+ partial,
+ partial_lse,
+ q.stride(0),
+ q.stride(1),
+ key_cache.stride(0),
+ key_cache.stride(2),
+ key_cache.stride(1),
+ block_size,
+ scale,
+ D=head_dim,
+ H=num_heads,
+ QUERY_GROUP_SIZE=num_heads // kv_heads,
+ SPLITS=splits,
+ PER_SPLIT=per_split,
+ BLOCK=BLOCK_KEYS,
+ )
+ _row_attention_merge_kernel[(rows, num_heads)](
+ partial, partial_lse, num_keys, out, H=num_heads, D=head_dim, SPLITS=splits, PER_SPLIT=per_split
+ )
+ return out
+
+
+# Keys per iteration of :func:`tree_step_attention` (a [rows, 128] x [128, D] tile per step).
+STEP_BLOCK = 128
+
+
+def tree_step_attention(
+ q: torch.Tensor,
+ key_cache: torch.Tensor,
+ block_table: torch.Tensor,
+ table_block: int,
+ committed: torch.Tensor,
+ ancestors: torch.Tensor,
+ scale: float,
+ *,
+ step: int,
+ window: int,
+) -> torch.Tensor:
+ """Attention of draft step ``step``'s ``bs * K`` rows ``q`` ``[bs * K, H, D]`` (no key lists).
+
+ ``key_cache``: the layer's KV cache viewed ``[blocks, slots, heads, 2 * D]``; ``block_table[b]`` maps request
+ ``b``'s positions to blocks of ``table_block`` tokens; ``ancestors`` ``[bs, K, depth]`` holds flat token slots.
+ The window is cut into about one program per SM in all. Same keys as :func:`build_tree_rows` +
+ :func:`row_attention`.
+ """
+ _, heads, head_dim = q.shape
+ bs, top_k, _ = ancestors.shape
+ launch = RowsLaunch(splits=program_splits(bs * heads, key_cache.device), block_n=STEP_BLOCK)
+ rows_p = rows_padded(top_k)
+ part = torch.empty(bs, heads, launch.splits + 1, rows_p, head_dim, dtype=torch.float32, device=q.device)
+ part_lse = torch.empty(bs, heads, launch.splits + 1, rows_p, dtype=torch.float32, device=q.device)
+ out = torch.empty_like(q)
+ rows_attention(
+ q,
+ key_cache,
+ None,
+ out,
+ part,
+ part_lse,
+ block_table,
+ committed,
+ ancestors,
+ rows_per_request=top_k,
+ step=step,
+ window=window,
+ scale=scale,
+ launch=launch,
+ table_page=table_block,
+ )
+ return out
diff --git a/eagle_harness/vllm/draft_rows.py b/eagle_harness/vllm/draft_rows.py
new file mode 100644
index 0000000..83bdc37
--- /dev/null
+++ b/eagle_harness/vllm/draft_rows.py
@@ -0,0 +1,146 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Index math and KV writes of the draft steps, one launch each (they replay inside the growth graph).
+
+:func:`draft_step_slots` gives every step's draft KV slots and positions at once (was ~16 small torch kernels per
+round); :func:`store_rows_kv` writes a step's keys and values into the draft KV cache (was a ``torch.cat`` and an
+indexed store, ~10 us per step at TP4); :func:`stack_layer_input` puts a step's token embeddings and input hidden states side by
+side for the draft layer's two input norms (one norm launch then writes the qkv projection's concatenated input).
+"""
+
+from __future__ import annotations
+
+import torch
+import triton
+import triton.language as tl
+
+
+def _draft_step_slots_kernel(
+ block_table,
+ committed,
+ slots,
+ blocks,
+ offsets,
+ positions,
+ stride_table,
+ num_reqs,
+ table_block,
+ cache_block,
+ STEPS: tl.constexpr,
+ K: tl.constexpr,
+ BLOCK: tl.constexpr,
+):
+ req = tl.program_id(0)
+ i = tl.arange(0, BLOCK) # step-major: (step - 1) * K + lane
+ ok = i < STEPS * K
+ step, lane = i // K, i % K
+ base = tl.load(committed + req)
+ scratch = base + i
+ block = tl.load(block_table + req * stride_table + scratch // table_block, mask=ok, other=0).to(tl.int64)
+ slot = block * table_block + scratch % table_block
+ tl.store(slots + req * STEPS * K + i, slot, mask=ok)
+ row = step * (num_reqs * K) + req * K + lane # a step's rows: request-major, then lane
+ tl.store(blocks + row, slot // cache_block, mask=ok)
+ tl.store(offsets + row, slot % cache_block, mask=ok)
+ tl.store(positions + row, base + step, mask=ok)
+
+
+def draft_step_slots(
+ block_table: torch.Tensor, committed: torch.Tensor, *, steps: int, top_k: int, table_block: int, cache_block: int
+) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
+ """Step ``s`` (1-based) writes lane ``j`` of request ``b`` at token ``committed[b] + (s - 1) * K + j`` and runs it
+ at position ``committed[b] + s - 1``. Returns ``slots [bs, steps, K]`` (flat token slots of the block table),
+ ``blocks`` / ``offsets`` ``[steps, bs * K]`` (in the cache's own blocks) and ``positions [steps, bs * K]``, int64."""
+ bs = committed.shape[0]
+ slots = torch.empty(bs, steps, top_k, dtype=torch.int64, device=committed.device)
+ blocks = torch.empty(steps, bs * top_k, dtype=torch.int64, device=committed.device)
+ offsets, positions = torch.empty_like(blocks), torch.empty_like(blocks)
+ _draft_step_slots_kernel[(bs,)](
+ block_table,
+ committed,
+ slots,
+ blocks,
+ offsets,
+ positions,
+ block_table.stride(0),
+ bs,
+ table_block,
+ cache_block,
+ STEPS=steps,
+ K=top_k,
+ BLOCK=triton.next_power_of_2(steps * top_k),
+ )
+ return slots, blocks, offsets, positions
+
+
+def _store_rows_kv_kernel(
+ cache,
+ key,
+ value,
+ blocks,
+ offsets,
+ stride_block,
+ stride_slot,
+ stride_head,
+ stride_key,
+ stride_value,
+ D: tl.constexpr,
+ BLOCK_D: tl.constexpr,
+):
+ row, head = tl.program_id(0), tl.program_id(1)
+ d = tl.arange(0, BLOCK_D)
+ ok = d < D
+ dst = cache + tl.load(blocks + row) * stride_block + tl.load(offsets + row) * stride_slot + head * stride_head
+ tl.store(dst + d, tl.load(key + row * stride_key + head * D + d, mask=ok), mask=ok)
+ tl.store(dst + D + d, tl.load(value + row * stride_value + head * D + d, mask=ok), mask=ok)
+
+
+def store_rows_kv(
+ cache: torch.Tensor, key: torch.Tensor, value: torch.Tensor, blocks: torch.Tensor, offsets: torch.Tensor
+) -> None:
+ """``cache[blocks, offsets] = cat(key, value)`` per head: ``cache`` ``[blocks, slots, heads, 2 * D]`` (any strides
+ with a unit last one), ``key`` / ``value`` ``[rows, heads * D]`` rows (unit last stride)."""
+ rows = key.shape[0]
+ heads, dim = cache.shape[2], cache.shape[3] // 2
+ assert cache.stride(3) == 1 and key.stride(1) == 1 and value.stride(1) == 1
+ _store_rows_kv_kernel[(rows, heads)](
+ cache,
+ key,
+ value,
+ blocks,
+ offsets,
+ cache.stride(0),
+ cache.stride(1),
+ cache.stride(2),
+ key.stride(0),
+ value.stride(0),
+ D=dim,
+ BLOCK_D=triton.next_power_of_2(dim),
+ )
+
+
+def _stack_layer_input_kernel(table, ids, hidden, out, stride_table, stride_hidden, H, BLOCK: tl.constexpr):
+ row, chunk = tl.program_id(0), tl.program_id(1)
+ cols = chunk * BLOCK + tl.arange(0, BLOCK)
+ ok = cols < H
+ token = tl.load(ids + row).to(tl.int64)
+ tl.store(out + row * 2 * H + cols, tl.load(table + token * stride_table + cols, mask=ok), mask=ok)
+ tl.store(out + row * 2 * H + H + cols, tl.load(hidden + row * stride_hidden + cols, mask=ok), mask=ok)
+
+
+def stack_layer_input(table: torch.Tensor, ids: torch.Tensor, hidden: torch.Tensor) -> torch.Tensor:
+ """``[rows, 2, H]``: row ``r`` holds ``table[ids[r]]`` (the full, unsharded embedding table) then ``hidden[r]``.
+
+ Replaces the vocab-parallel embedding (a masked lookup and a TP all-reduce of the shards' rows, which adds zeros:
+ the same values) and lets one RMSNorm launch with a per-row weight normalise both halves into ``cat`` layout."""
+ rows, hidden_size = hidden.shape
+ out = torch.empty(rows, 2, hidden_size, dtype=hidden.dtype, device=hidden.device)
+ block = 1024
+ _stack_layer_input_kernel[(rows, triton.cdiv(hidden_size, block))](
+ table, ids, hidden, out, table.stride(0), hidden.stride(0), hidden_size, BLOCK=block
+ )
+ return out
diff --git a/eagle_harness/vllm/eagle3.py b/eagle_harness/vllm/eagle3.py
new file mode 100644
index 0000000..99d1c03
--- /dev/null
+++ b/eagle_harness/vllm/eagle3.py
@@ -0,0 +1,19 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Native vLLM EAGLE3 loading and logits, with harness row forwards."""
+
+import torch
+from vllm.model_executor.models.llama_eagle3 import Eagle3LlamaForCausalLM
+
+from eagle_harness.vllm.model_rows import DraftRowsMixin
+
+
+class Eagle3ForHarness(DraftRowsMixin, Eagle3LlamaForCausalLM):
+ def __init__(self, *, vllm_config, prefix=""):
+ super().__init__(vllm_config=vllm_config, prefix=prefix)
+ self._init_row_forward(8 * vllm_config.scheduler_config.max_num_seqs)
+
+ def candidate_topk(self, hidden: torch.Tensor, k: int):
+ # Native compute_logits scatters d2t offsets into the target vocabulary.
+ return torch.topk(torch.softmax(self.compute_logits(hidden), dim=-1), k, dim=-1)
diff --git a/eagle_harness/vllm/gdn_tree_verify.py b/eagle_harness/vllm/gdn_tree_verify.py
new file mode 100644
index 0000000..69c9977
--- /dev/null
+++ b/eagle_harness/vllm/gdn_tree_verify.py
@@ -0,0 +1,319 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Linear-attention tree verify for vLLM hybrid targets: GDN (Qwen3.5 / 3.8) and Mamba2 (NemotronH).
+
+Plugs into vLLM's ``LinearAttnVerifyExtension``: the Qwen GDN layer hands it the speculative-decode rows of every
+forward (``GDNSpecRows``) and the Mamba2 layer its decode rows (``Mamba2SpecRows``) in place of their own conv and
+recurrence kernels. vLLM verifies a chain with one state row per verify row: row ``i`` of request ``b`` stores its
+recurrent state in the state slot ``slots[b, i]`` (the request's block table), the convolution window of the request
+lives in slot ``slots[b, 0]`` as the raw inputs of the last tokens, and the next step resumes from row / window offset
+``num_accepted - 1``.
+
+A tree keeps that layout and runs the shared tree kernels on it:
+
+- the conv (:func:`~eagle_harness.kernels.gdn_tree_conv.gdn_tree_conv1d_update`, a width-4 causal conv that serves
+ GDN's qkv and Mamba2's xBC alike) gathers each row's three earlier conv inputs through the ancestor table of
+ :class:`~eagle_harness.vllm.verify_layout.VerifyStage` (a row sees its ancestors, not the rows before it) and rolls
+ the window as the chain kernel does: ``[old[1:], x_0, .., x_{n-1}]``;
+- the recurrence walks each request's rows with vLLM's slot table: row ``i`` stores its state in ``slots[b, i]`` and
+ starts from its parent's, row 0 from ``slots[b, num_accepted - 1]``. GDN runs the shared tree walk
+ (:func:`eagle_harness.kernels.gdn_tree_recurrence.gdn_tree_recurrent_update`, and its Gluon twin where it applies),
+ Mamba2 the tree selective state update (:func:`eagle_harness.kernels.mamba2_tree.mamba2_tree_state_update`).
+
+The accepted rows are not a prefix of the verify rows, so :class:`LinearStateCommit` (run from
+``post_accept``) moves them into chain order: the window columns of the accepted path next to each other,
+and the last accepted row's recurrent state into row ``accepted - 1``, where vLLM's next step resumes from.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Sequence
+from typing import TYPE_CHECKING, Any
+
+import torch
+import triton
+import triton.language as tl
+
+from vllm.model_executor.layers.mamba.gdn.verify_extension import GDNSpecRows, LinearAttnVerifyExtension
+
+from eagle_harness.kernels.gdn_tree_conv import gdn_tree_conv1d_update
+from eagle_harness.kernels.gdn_tree_recurrence import gdn_tree_recurrent_update
+from eagle_harness.kernels.mamba2_tree import mamba2_tree_state_update
+from eagle_harness.vllm.verify_layout import VerifyStage, get_stage
+
+if TYPE_CHECKING: # vLLM builds without the Mamba2 hook lack it; the speculator refuses Mamba2 targets there
+ from vllm.model_executor.layers.mamba.gdn.verify_extension import Mamba2SpecRows
+
+# A padded request's state slot; the chain kernels skip it too.
+NULL_BLOCK_ID = tl.constexpr(0)
+
+
+class TreeVerify(LinearAttnVerifyExtension):
+ """Runs a GDN or Mamba2 layer's spec-decode rows through the tree kernels with the staged layout.
+
+ Trees when the stage verifies trees; otherwise the stage holds chain layouts (a mixed batch), which the same
+ kernels compute as vLLM's chain kernels do.
+ """
+
+ def __init__(self, vllm_config: Any):
+ self.vllm_config = vllm_config
+
+ def forward_spec_rows(self, rows: GDNSpecRows) -> None:
+ stage = _staged()
+ tokens, dim = rows.mixed_qkv.shape
+ conv = torch.empty(tokens, dim, dtype=rows.mixed_qkv.dtype, device=rows.mixed_qkv.device)
+ gdn_tree_conv1d_update(
+ rows.mixed_qkv.t()[None],
+ rows.conv_state,
+ rows.conv_weight,
+ rows.conv_bias,
+ rows.activation,
+ conv_state_indices=rows.state_indices[:, 0],
+ intermediate_conv_window=None,
+ intermediate_state_indices=None,
+ tree_ancestors=stage.ancestors[: rows.query_start_loc.shape[0] - 1],
+ pad_slot_id=NULL_BLOCK_ID.value,
+ out=conv.t()[None],
+ num_accepted_tokens=rows.num_accepted_tokens,
+ query_start_loc=rows.query_start_loc,
+ )
+ key_dim = rows.num_k_heads * rows.head_k_dim
+ q, k, v = conv.split([key_dim, key_dim, rows.num_v_heads * rows.head_v_dim], dim=-1)
+ published = stage.state_slots.get(rows.layer_name) # one layer per KV cache group publishes the group's slots
+ gdn_tree_recurrent_update(
+ rows.A_log,
+ rows.dt_bias,
+ q.view(1, tokens, -1, rows.head_k_dim),
+ k.view(1, tokens, -1, rows.head_k_dim),
+ v.view(1, tokens, -1, rows.head_v_dim),
+ rows.a,
+ rows.b,
+ initial_state_source=rows.ssm_state,
+ initial_state_indices=rows.state_indices,
+ num_accepted_tokens=rows.num_accepted_tokens,
+ cu_seqlens=rows.query_start_loc,
+ intermediate_states_buffer=rows.ssm_state,
+ intermediate_state_indices=rows.state_indices,
+ retrieve_parent_token=stage.parents,
+ pad_slot_id=NULL_BLOCK_ID.value,
+ out=rows.out.view(1, tokens, -1, rows.head_v_dim),
+ publish=None if published is None else published[: rows.state_indices.shape[0]],
+ gluon=True,
+ )
+
+ def forward_mamba2_spec_rows(self, rows: Mamba2SpecRows) -> None:
+ stage = _staged()
+ tokens, dim = rows.hidden_states_B_C.shape
+ reqs = rows.state_indices.shape[0]
+ conv = torch.empty(tokens, dim, dtype=rows.hidden_states_B_C.dtype, device=rows.hidden_states_B_C.device)
+ gdn_tree_conv1d_update(
+ rows.hidden_states_B_C.t()[None],
+ rows.conv_state,
+ rows.conv_weight,
+ rows.conv_bias,
+ rows.activation,
+ conv_state_indices=rows.state_indices[:, 0],
+ intermediate_conv_window=None,
+ intermediate_state_indices=None,
+ tree_ancestors=stage.ancestors[: rows.query_start_loc.shape[0] - 1],
+ pad_slot_id=NULL_BLOCK_ID.value,
+ out=conv.t()[None],
+ num_accepted_tokens=rows.num_accepted_tokens,
+ query_start_loc=rows.query_start_loc,
+ )
+ heads, head_dim, groups, dstate = rows.num_heads, rows.head_dim, rows.n_groups, rows.ssm_state_size
+ x, B, C = conv.split([heads * head_dim, groups * dstate, groups * dstate], dim=-1)
+ mamba2_tree_state_update(
+ rows.ssm_state,
+ x.view(tokens, heads, head_dim),
+ rows.dt,
+ rows.A,
+ B.view(tokens, groups, dstate),
+ C.view(tokens, groups, dstate),
+ rows.D,
+ rows.dt_bias,
+ rows.out.view(tokens, heads, head_dim),
+ state_indices=rows.state_indices,
+ parents=stage.parents,
+ query_start_loc=rows.query_start_loc,
+ num_accepted_tokens=rows.num_accepted_tokens,
+ pad_slot_id=NULL_BLOCK_ID.value,
+ )
+ published = stage.state_slots.get(rows.layer_name) # one layer per KV cache group publishes the group's slots
+ if published is not None:
+ published[:reqs].copy_(rows.state_indices)
+
+
+def check_tree_verifiable(layers: Sequence[Any]) -> None:
+ """Refuse a target with linear-attention layers that do not hand their rows to this extension: their in-tree
+ kernels would verify every tree as a chain."""
+ from vllm.model_executor.layers.mamba.gdn.qwen_gdn_linear_attn import QwenGatedDeltaNetAttention
+ from vllm.model_executor.layers.mamba.mamba_mixer2 import MambaMixer2
+
+ handled: tuple[type, ...] = (QwenGatedDeltaNetAttention,)
+ if "forward_mamba2_spec_rows" in vars(LinearAttnVerifyExtension):
+ handled += (MambaMixer2,)
+ unhandled = sorted({type(layer).__name__ for layer in layers if not isinstance(layer, handled)})
+ if unhandled:
+ raise RuntimeError(
+ f"eagle_harness: tree verify cannot run on {', '.join(unhandled)} layers with this vLLM (only "
+ f"{', '.join(t.__name__ for t in handled)} hand their rows to the verify extension); Mamba2 needs vLLM's "
+ "Mamba2 verify hook (LinearAttnVerifyExtension.forward_mamba2_spec_rows)"
+ )
+
+
+def _staged() -> VerifyStage:
+ stage = get_stage()
+ if stage is None:
+ raise RuntimeError("eagle_harness: a linear-attention verify ran before the speculator staged its layout")
+ return stage
+
+
+def create_extension(vllm_config: Any) -> TreeVerify | None:
+ """``SpeculativeMethodSpec.linear_attn_verify_extension`` factory."""
+ from eagle_harness.vllm.config import parse_method_config
+
+ if parse_method_config(vllm_config.speculative_config.method_config).node_top_k == 1:
+ return None # a chain is vLLM's own verify
+ return TreeVerify(vllm_config)
+
+
+def _compact_window_kernel(
+ conv_ptrs, # [L] uint64: base address of each layer's window cache
+ slots_ptrs, # [L] uint64: the layer's group's slots, [reqs, S] int32 (column 0: the window slot)
+ slots_strides, # [L] int64
+ idx_mapping_ptr,
+ path_ptr, # [state slots, W] int32
+ stride_path,
+ path_len_ptr,
+ stride_slot,
+ stride_dim,
+ stride_tok,
+ dim,
+ BLOCK: tl.constexpr,
+ DTYPE: tl.constexpr,
+):
+ b, layer, block = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ state = tl.load(idx_mapping_ptr + b)
+ slots_ptr = tl.load(slots_ptrs + layer).to(tl.pointer_type(tl.int32))
+ slot = tl.load(slots_ptr + b * tl.load(slots_strides + layer)).to(tl.int64)
+ if slot <= NULL_BLOCK_ID:
+ return
+ feats = block * BLOCK + tl.arange(0, BLOCK)
+ mask = feats < dim
+ base = tl.load(conv_ptrs + layer).to(tl.pointer_type(DTYPE)) + slot * stride_slot + feats * stride_dim
+ # Path row j moves from column 2 + path[j] to column 2 + j. Ascending, so no source is overwritten first.
+ for j in range(1, tl.load(path_len_ptr + state)):
+ src = 2 + tl.load(path_ptr + state * stride_path + j)
+ if src != 2 + j:
+ tl.store(base + (2 + j) * stride_tok, tl.load(base + src * stride_tok, mask=mask), mask=mask)
+ tl.debug_barrier()
+
+
+def _move_state_kernel(
+ ssm_ptrs, # [L] uint64
+ slots_ptrs, # [L] uint64: the layer's group's slots, [reqs, S] int32
+ slots_strides, # [L] int64
+ idx_mapping_ptr,
+ path_ptr,
+ stride_path,
+ path_len_ptr,
+ stride_slot,
+ numel,
+ BLOCK: tl.constexpr,
+ DTYPE: tl.constexpr,
+):
+ b, layer, block = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ state = tl.load(idx_mapping_ptr + b)
+ length = tl.load(path_len_ptr + state)
+ last = tl.load(path_ptr + state * stride_path + length - 1)
+ slots_ptr = tl.load(slots_ptrs + layer).to(tl.pointer_type(tl.int32)) + b * tl.load(slots_strides + layer)
+ src_slot = tl.load(slots_ptr + last).to(tl.int64)
+ dst_slot = tl.load(slots_ptr + length - 1).to(tl.int64)
+ if (last != length - 1) & (src_slot > NULL_BLOCK_ID) & (dst_slot > NULL_BLOCK_ID):
+ base = tl.load(ssm_ptrs + layer).to(tl.pointer_type(DTYPE))
+ offs = block * BLOCK + tl.arange(0, BLOCK)
+ mask = offs < numel
+ tl.store(
+ base + dst_slot * stride_slot + offs, tl.load(base + src_slot * stride_slot + offs, mask=mask), mask=mask
+ )
+
+
+_TL_DTYPES = {torch.bfloat16: tl.bfloat16, torch.float16: tl.float16, torch.float32: tl.float32}
+
+
+class LinearStateCommit:
+ """Moves the accepted rows of a tree round into chain order in GDN / Mamba2 layers, all layers in one launch each.
+
+ ``slots[i]``: layer ``i``'s KV cache group's persistent state-slot buffer (one state slot per verify row).
+ """
+
+ def __init__(self, layers: Sequence[Any], slots: Sequence[torch.Tensor], device: torch.device):
+ self.num_layers = len(layers)
+ if not self.num_layers:
+ return
+ from vllm.model_executor.layers.mamba.mamba_utils import is_conv_state_dim_first
+
+ def window(layer: Any) -> torch.Tensor:
+ cache = layer.kv_cache[0]
+ return cache if is_conv_state_dim_first() else cache.transpose(-1, -2)
+
+ first_conv, first_ssm = window(layers[0]), layers[0].kv_cache[1]
+ for layer in layers:
+ conv, ssm = window(layer), layer.kv_cache[1]
+ if (
+ conv.stride() != first_conv.stride()
+ or conv.dtype != first_conv.dtype
+ or ssm.stride() != first_ssm.stride()
+ ):
+ raise ValueError("the linear-attention layers must share one state layout")
+ self.conv_dtype, self.ssm_dtype = _TL_DTYPES[first_conv.dtype], _TL_DTYPES[first_ssm.dtype]
+ self.conv_strides = first_conv.stride()
+ self.dim = first_conv.shape[1]
+ self.ssm_stride, self.ssm_numel = first_ssm.stride(0), first_ssm[0].numel()
+ self.conv_ptrs = torch.tensor([window(layer).data_ptr() for layer in layers], dtype=torch.uint64, device=device)
+ self.ssm_ptrs = torch.tensor(
+ [layer.kv_cache[1].data_ptr() for layer in layers], dtype=torch.uint64, device=device
+ )
+ self.slots_ptrs = torch.tensor([s.data_ptr() for s in slots], dtype=torch.uint64, device=device)
+ self.slots_strides = torch.tensor([s.stride(0) for s in slots], dtype=torch.int64, device=device)
+ if any(s.dtype != torch.int32 for s in slots):
+ raise ValueError("state slots must be int32")
+
+ def commit(self, idx_mapping: torch.Tensor, path: torch.Tensor, path_len: torch.Tensor) -> None:
+ if not self.num_layers:
+ return
+ num_reqs, num_layers = idx_mapping.shape[0], self.conv_ptrs.shape[0]
+ block = 128
+ _compact_window_kernel[(num_reqs, num_layers, triton.cdiv(self.dim, block))](
+ self.conv_ptrs,
+ self.slots_ptrs,
+ self.slots_strides,
+ idx_mapping,
+ path,
+ path.stride(0),
+ path_len,
+ *self.conv_strides,
+ self.dim,
+ BLOCK=block,
+ DTYPE=self.conv_dtype,
+ num_warps=1,
+ )
+ block = 1024
+ _move_state_kernel[(num_reqs, num_layers, triton.cdiv(self.ssm_numel, block))](
+ self.ssm_ptrs,
+ self.slots_ptrs,
+ self.slots_strides,
+ idx_mapping,
+ path,
+ path.stride(0),
+ path_len,
+ self.ssm_stride,
+ self.ssm_numel,
+ BLOCK=block,
+ DTYPE=self.ssm_dtype,
+ num_warps=4,
+ )
diff --git a/eagle_harness/vllm/model_rows.py b/eagle_harness/vllm/model_rows.py
new file mode 100644
index 0000000..00d3909
--- /dev/null
+++ b/eagle_harness/vllm/model_rows.py
@@ -0,0 +1,127 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Row forwards shared by native EAGLE3 and candidate-head drafts."""
+
+from __future__ import annotations
+
+import contextlib
+from collections.abc import Callable
+from typing import Any
+
+import torch
+from vllm import ir
+from vllm.distributed import (
+ get_tensor_model_parallel_rank,
+ get_tensor_model_parallel_world_size,
+ tensor_model_parallel_all_gather,
+)
+from vllm.platforms import current_platform
+
+from eagle_harness.vllm.draft_rows import stack_layer_input
+
+Attend = Callable[[torch.Tensor, torch.Tensor, torch.Tensor], torch.Tensor]
+
+
+class DraftRowsMixin:
+ def _init_row_forward(self, max_rows: int) -> None:
+ self.tp_size = get_tensor_model_parallel_world_size()
+ self._max_rows = max_rows
+ self._full_embed = None
+ self._input_norm_weights = None
+ self._norm_before_residual = bool(getattr(self.config, "norm_before_residual", False))
+
+ # ---- the draft layer on rows with caller-supplied attention
+ def forward_rows(
+ self, input_ids: torch.Tensor, positions: torch.Tensor, hidden_states: torch.Tensor, attend: Attend
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ """``forward`` with ``attend(q, k, v)`` in place of the layer's attention.
+
+ Returns ``(normed, hidden)``: the final-norm output (the candidate head's input) and the hidden
+ state the next draft forward takes as input. The rows run outside torch.compile, where vLLM's
+ custom ops would fall back to their unfused torch code: they use the CUDA kernels instead.
+ """
+ model = self.model
+ layer = model.layers[0]
+ attn, mlp = layer.self_attn, layer.mlp
+ with _kernel_ops():
+ x, residual = self._layer_input(input_ids, hidden_states)
+ if getattr(layer, "eh_proj", None) is not None:
+ residual = layer.eh_proj(x)
+ x = layer.pre_attention_layernorm(residual)
+ qkv, _ = attn.qkv_proj(x)
+ q, k, v = qkv.split([attn.q_size, attn.kv_size, attn.kv_size], dim=-1)
+ q, k = _kernel(attn.rotary_emb)(positions, q, k)
+ x, _ = attn.o_proj(attend(q, k, v))
+ x, residual = layer.post_attention_layernorm(x, residual)
+ if getattr(self, "latent_moe", False):
+ x = self._moe_rows(mlp, x)
+ else:
+ gate_up, _ = mlp.gate_up_proj(x)
+ x, _ = mlp.down_proj(_kernel(mlp.act_fn)(gate_up))
+ normed, summed = model.norm(x, residual)
+ return normed, normed if model.norm_output else summed
+
+ def _layer_input(self, input_ids: torch.Tensor, hidden_states: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
+ """``(cat([input_layernorm(embed(ids)), hidden_norm(hidden)], -1), residual)`` of the draft layer.
+
+ On CUDA, with a vocab whose shards are plain slices, it is two launches instead of five: the token rows come
+ from a full copy of the embedding table (no TP all-reduce of the shards' rows, which only adds zeros) and land
+ beside the hidden rows (:func:`stack_layer_input`), then one RMSNorm call with a per-row weight normalises all
+ ``2 * rows`` rows into the concatenated layout. The rows go through the same norm kernel as before."""
+ layer = self.model.layers[0]
+ if not self._fused_layer_input(layer, hidden_states):
+ embeds = layer.input_layernorm(self.model.embed_input_ids(input_ids))
+ x = layer.hidden_norm(hidden_states)
+ residual = x if self._norm_before_residual else hidden_states
+ return torch.cat([embeds, x], dim=-1), residual
+ rows, hidden_size = hidden_states.shape
+ stacked = stack_layer_input(self._full_embed, input_ids, hidden_states).view(2 * rows, hidden_size)
+ normed = ir.ops.rms_norm(stacked, self._input_norm_weights[: 2 * rows], layer.input_layernorm.variance_epsilon)
+ return normed.view(rows, 2 * hidden_size), hidden_states
+
+ def _fused_layer_input(self, layer: Any, hidden_states: torch.Tensor) -> bool:
+ """Whether :meth:`_layer_input` takes the two-launch path (builds its tables on the first eager call)."""
+ if self._input_norm_weights is not None:
+ return hidden_states.shape[0] <= self._max_rows
+ if not current_platform.is_cuda() or torch.cuda.is_current_stream_capturing():
+ return False
+ norms = (layer.input_layernorm, layer.hidden_norm)
+ if (
+ self._norm_before_residual
+ or not hidden_states.is_contiguous()
+ or norms[0].variance_epsilon != norms[1].variance_epsilon
+ or not all(norm.has_weight for norm in norms)
+ ):
+ return False
+ embed = self.model.embed_tokens
+ shard = embed.shard_indices
+ per_rank = embed.weight.shape[0]
+ if (
+ shard.num_added_elements != 0
+ or shard.num_org_vocab_padding != 0
+ or shard.org_vocab_start_index != get_tensor_model_parallel_rank() * per_rank
+ ):
+ return False
+ weight = embed.weight.detach()
+ self._full_embed = tensor_model_parallel_all_gather(weight, dim=0) if self.tp_size > 1 else weight
+ self._input_norm_weights = (
+ torch.stack([norms[0].weight.detach(), norms[1].weight.detach()]).repeat(self._max_rows, 1).contiguous()
+ )
+ return hidden_states.shape[0] <= self._max_rows
+
+
+def _kernel(op: Any) -> Callable[..., Any]:
+ """The CUDA-kernel forward of a vLLM custom op where the platform has one, else the op's own dispatch."""
+ return op.forward_cuda if current_platform.is_cuda_alike() else op
+
+
+def _kernel_ops():
+ """Dispatch vLLM's RMSNorm IR ops to their compiled kernels (an inductor-compiled model selects the native torch code,
+ which is one launch per elementwise step outside a compiled graph)."""
+ with contextlib.ExitStack() as stack:
+ if current_platform.is_cuda_alike():
+ for op in (ir.ops.rms_norm, ir.ops.fused_add_rms_norm):
+ stack.enter_context(op.set_priority(["vllm_c", "native"]))
+ yield
diff --git a/eagle_harness/vllm/models.py b/eagle_harness/vllm/models.py
new file mode 100644
index 0000000..ab4f768
--- /dev/null
+++ b/eagle_harness/vllm/models.py
@@ -0,0 +1,283 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The EAGLE-4 draft model for vLLM (registered as ``LlamaForCausalLMEagle4``).
+
+The single-layer EAGLE-4 draft is vLLM's EAGLE-3 Llama draft (``fc`` over three normed aux hidden
+states, ``concat(input_layernorm(embed), hidden_norm(fc_out))`` into the qkv projection, ``norm_output``,
+the sliding window of ``layer_types``) plus its own ``lm_head`` and a low-rank candidate head. Three structures of
+the Nemotron drafts are built on top of it (:class:`_Eagle4DecoderLayer`): no rotary positions (``use_rope: false``),
+``attn_norm`` (``eh_proj`` maps the concatenated input to the hidden size, that projection is the attention residual
+and its RMSNorm feeds q/k/v) and the latent ReLU^2 MoE MLP (``moe_architecture: nemotron_latent_relu2``), which is
+vLLM's own ``NemotronHMoE``, the target's block. The candidate head:
+
+1. ``scores = (hidden @ down_proj.T) @ efficient_lm_head.T`` (rank-r estimate over this shard's vocab);
+2. the top ``C`` scores of the shard are the candidates;
+3. their logits are re-scored with the full ``lm_head`` rows (:func:`gather_dot`);
+4. the candidates of every TP rank are merged.
+
+:meth:`compute_logits` returns ``[rows, vocab]`` fp32 logits that are ``-inf`` outside the candidates, so
+vLLM's stock draft sampling works on them; :meth:`candidate_topk` is the top-``k`` the draft tree reads.
+:meth:`forward_rows` runs the layer on rows whose attention the caller supplies (the draft tree steps).
+"""
+
+from __future__ import annotations
+
+import contextlib
+import copy
+import logging
+from typing import Any
+
+import torch
+from torch import nn
+from vllm.config import VllmConfig
+from vllm.distributed import (
+ get_tensor_model_parallel_world_size,
+ get_tp_group,
+ tensor_model_parallel_all_gather,
+)
+from vllm.forward_context import is_forward_context_available, set_forward_context
+from vllm.model_executor.layers.layernorm import RMSNorm
+from vllm.model_executor.layers.linear import QKVParallelLinear, ReplicatedLinear
+from vllm.model_executor.layers.vocab_parallel_embedding import ParallelLMHead
+from vllm.model_executor.models.llama_eagle3 import Eagle3LlamaForCausalLM
+from vllm.model_executor.models.llama_eagle3 import LlamaDecoderLayer as Eagle3LlamaDecoderLayer
+from vllm.model_executor.models.utils import AutoWeightsLoader
+
+from eagle_harness.kernels.candidate_ops import candidate_tail, shard_topk
+from eagle_harness.kernels.candidate_ops import candidate_topk as fused_candidate_topk
+from eagle_harness.kernels.gather_dot import gather_dot, gather_dot_packed
+from eagle_harness.models.eagle4_config import UNPORTED, check_ported
+from eagle_harness.models.eagle4_structure import (
+ LATENT_MOE_ARCHITECTURE as LATENT_MOE,
+ base_layer_overrides,
+ draft_moe_architecture as _moe_architecture,
+ draft_uses_rope as uses_rope,
+ latent_moe_config,
+)
+from eagle_harness.models.low_rank_head import low_rank_scores
+from eagle_harness.vllm.candidate_gather import CandidateGather
+from eagle_harness.vllm.model_rows import DraftRowsMixin, _kernel_ops
+
+logger = logging.getLogger(__name__)
+
+# Attributes vLLM adds to draft configs, which the shared validator does not recognize.
+_VLLM_KEYS = ("eagle_aux_hidden_state_layer_ids", "target_layer_count")
+
+# The structures of UNPORTED this model builds: NoPE, attn_norm and the latent MoE (checked below).
+_BUILT = ("enable_moe", "attn_norm", "use_rope", "position_embedding_type", "partial_rotary_factor")
+_VLLM_UNPORTED = {key: value for key, value in UNPORTED.items() if key not in _BUILT}
+
+
+def check_supported(config: Any) -> None:
+ """Validate the config and refuse draft structures this model does not build."""
+ checked = copy.copy(config)
+ for key in _VLLM_KEYS:
+ checked.__dict__.pop(key, None)
+ check_ported(checked, _VLLM_UNPORTED)
+ if _moe_architecture(config) not in (None, LATENT_MOE):
+ raise NotImplementedError(
+ f"EAGLE-4 MoE drafts are ported for {LATENT_MOE} only, got {_moe_architecture(config)}."
+ )
+
+
+def _base_layer_config(config: Any):
+ """Let vLLM's EAGLE-3 layer build on a config whose MLP and rotary parts this model then replaces: its dense MLP
+ takes SiLU only (the latent MoE draft says relu2), and a NoPE draft needs no full-length rotary table (vLLM keeps
+ every table in a process-wide cache). The config is vLLM's draft config object, restored on exit."""
+ hidden_act = config.hidden_act
+ max_position_embeddings = config.max_position_embeddings
+ try:
+ overrides = base_layer_overrides(config)
+ config.hidden_act = overrides.get("hidden_act", hidden_act)
+ config.max_position_embeddings = overrides.get("max_position_embeddings", max_position_embeddings)
+ yield
+ finally:
+ config.hidden_act = hidden_act
+ config.max_position_embeddings = max_position_embeddings
+
+
+class _NoRotary(nn.Module):
+ """Positions do not rotate q and k (``use_rope: false``); they still address the KV cache."""
+
+ def forward(
+ self, positions: torch.Tensor, query: torch.Tensor, key: torch.Tensor
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ return query, key
+
+ forward_cuda = forward
+
+
+def _latent_moe(config: Any, vllm_config: VllmConfig, prefix: str) -> nn.Module:
+ """The draft's latent ReLU^2 MoE, built as the target's block (vLLM's ``NemotronHMoE``): sigmoid router over
+ bias-corrected scores, experts in the latent space between ``fc1_latent_proj`` / ``fc2_latent_proj``,
+ ``routed_scaling_factor`` on the routed sum, plus the ReLU^2 shared expert; reduced once over TP."""
+ from vllm.model_executor.models.nemotron_h import NemotronHMoE
+
+ moe_config = latent_moe_config(config)
+ return NemotronHMoE(moe_config, quant_config=None, parallel_config=vllm_config.parallel_config, prefix=prefix)
+
+
+class _Eagle4DecoderLayer(Eagle3LlamaDecoderLayer):
+ """vLLM's EAGLE-3 layer 0 with ``attn_norm``: ``residual = eh_proj(cat(embeds, hidden))`` and its RMSNorm feeds
+ q/k/v (``eh_proj`` and ``pre_attention_layernorm`` are None without it). Built by
+ :meth:`LlamaForCausalLMEagle4._build_structures`."""
+
+ def forward(
+ self,
+ positions: torch.Tensor,
+ embeds: torch.Tensor,
+ hidden_states: torch.Tensor,
+ residual: torch.Tensor | None,
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ embeds = self.input_layernorm(embeds)
+ hidden_states, residual = self._residual_norm(hidden_states=hidden_states)
+ hidden_states = torch.cat([embeds, hidden_states], dim=-1)
+ if self.eh_proj is not None:
+ residual = self.eh_proj(hidden_states)
+ hidden_states = self.pre_attention_layernorm(residual)
+ hidden_states = self.self_attn(positions=positions, hidden_states=hidden_states)
+ hidden_states, residual = self.post_attention_layernorm(hidden_states, residual)
+ return self.mlp(hidden_states), residual
+
+
+class LlamaForCausalLMEagle4(DraftRowsMixin, Eagle3LlamaForCausalLM):
+ # The draft trains its own lm_head; the embedding is the target's (vLLM shares it).
+ has_own_lm_head = True
+
+ def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
+ draft_config = vllm_config.speculative_config.draft_model_config.hf_config
+ check_supported(draft_config)
+ with _base_layer_config(draft_config):
+ super().__init__(vllm_config=vllm_config, prefix=prefix)
+ self.vllm_config = vllm_config
+ self._build_structures(vllm_config)
+ head = self.config.efficient_lm_head_config
+ self.num_candidates = int(head["num_candidates"])
+ rank, hidden, vocab = int(head["rank"]), self.config.hidden_size, self.config.vocab_size
+ self.efficient_lm_head = ParallelLMHead(vocab, rank, prefix=f"{prefix}.efficient_lm_head")
+ self.efficient_lm_head_down_proj = nn.Linear(hidden, rank, bias=False)
+ self.tp_size = get_tensor_model_parallel_world_size()
+ # A draft row's candidates: up to 8 rows (node_top_k) per request.
+ max_rows = 8 * vllm_config.scheduler_config.max_num_seqs
+ self.candidate_gather = CandidateGather(get_tp_group(), max_rows) if self.tp_size > 1 else None
+ self._init_row_forward(max_rows)
+
+ def _build_structures(self, vllm_config: VllmConfig) -> None:
+ """Turn vLLM's EAGLE-3 layer 0 into the draft's: NoPE, attn_norm and the latent MoE where the config says so."""
+ config, layer = self.config, self.model.layers[0]
+ layer.__class__ = _Eagle4DecoderLayer
+ # Instance attributes, not class defaults: a class attribute would shadow the submodules nn.Module registers.
+ layer.eh_proj = layer.pre_attention_layernorm = None
+ layer_prefix = layer.self_attn.attn.layer_name.removesuffix(".self_attn.attn")
+ hidden = config.hidden_size
+ if not uses_rope(config):
+ layer.self_attn.rotary_emb = _NoRotary()
+ if getattr(config, "attn_norm", False):
+ attn = layer.self_attn
+ attn.qkv_proj = QKVParallelLinear(
+ hidden,
+ attn.head_dim,
+ attn.total_num_heads,
+ attn.total_num_kv_heads,
+ bias=False,
+ quant_config=None,
+ prefix=f"{layer_prefix}.self_attn.qkv_proj",
+ )
+ layer.eh_proj = ReplicatedLinear(
+ 2 * hidden, hidden, bias=False, quant_config=None, prefix=f"{layer_prefix}.eh_proj", return_bias=False
+ )
+ layer.pre_attention_layernorm = RMSNorm(hidden, eps=config.rms_norm_eps)
+ self.latent_moe = _moe_architecture(config) == LATENT_MOE
+ if self.latent_moe:
+ layer.mlp = _latent_moe(config, vllm_config, f"{layer_prefix}.mlp")
+ # Auxiliary-stream event joins cannot cross conditional graph captures.
+ shared = layer.mlp.experts.shared_experts
+ if shared is not None:
+ disable = getattr(shared, "disable_aux_stream", None)
+ if disable is None:
+ raise NotImplementedError("Nemotron drafts require vLLM SharedExperts.disable_aux_stream")
+ disable()
+
+ def load_weights(self, weights: Any) -> Any:
+ """vLLM's EAGLE-3 loading, except the latent MoE's tensors (expert-per-index ``up_proj`` / ``down_proj``, the
+ router, the latent projections, the shared expert): they go to the MoE block's own loaders, as the target's
+ do, because the EAGLE-3 mapping would stack every ``up_proj`` into a ``gate_up_proj``."""
+ if not self.latent_moe:
+ return super().load_weights(weights)
+ moe: list[tuple[str, torch.Tensor]] = []
+
+ def dense(items: Any) -> Any:
+ for name, tensor in items:
+ head, sep, rest = name.partition(".mlp.")
+ if sep and head.removeprefix("model.").removeprefix("midlayer").removeprefix("layers.0") == "":
+ moe.append((rest, tensor))
+ else:
+ yield name, tensor
+
+ loaded = super().load_weights(dense(weights))
+ AutoWeightsLoader(self.model.layers[0].mlp).load_weights(moe)
+ if not moe:
+ raise ValueError("the latent MoE draft checkpoint has no layer-0 .mlp. tensors")
+ return loaded
+
+ # ---- candidate head
+ def _scores(self, hidden: torch.Tensor) -> tuple[torch.Tensor, int]:
+ """Steps 1-2: ``(low-rank scores [rows, shard vocab], first vocab id of the shard)``."""
+ shard = self.lm_head.shard_indices
+ scores = low_rank_scores(
+ hidden,
+ self.efficient_lm_head_down_proj.weight,
+ self.efficient_lm_head.weight,
+ shard.org_vocab_end_index - shard.org_vocab_start_index,
+ )
+ return scores, shard.org_vocab_start_index
+
+ def candidate_topk(self, hidden: torch.Tensor, k: int) -> tuple[torch.Tensor, torch.Tensor]:
+ """Top-``k`` next tokens of each row: ``([rows, k]`` fp32 probabilities, ``[rows, k]`` ids).
+
+ The softmax runs over the ``C`` candidates only, which equals the softmax over the full-vocab
+ row of :meth:`compute_logits`.
+ """
+ scores, vocab_start = self._scores(hidden)
+ return fused_candidate_topk(
+ scores,
+ self.lm_head.weight,
+ hidden,
+ num_candidates=self.num_candidates,
+ vocab_start=vocab_start,
+ top_k=k,
+ all_gather=self._gather_candidates if self.candidate_gather is not None else None,
+ )
+
+ def _gather_candidates(self, packed: torch.Tensor) -> torch.Tensor:
+ """``[rows, n]`` -> ``[tp, rows, n]``: a view of the dim-0 gather."""
+ return self.candidate_gather(packed).view(self.tp_size, *packed.shape)
+
+ def compute_logits(self, hidden_states: torch.Tensor) -> torch.Tensor:
+ scores, vocab_start = self._scores(hidden_states)
+ local_ids, global_ids = shard_topk(scores, self.num_candidates, vocab_start)
+ if self.tp_size == 1:
+ logits, ids = gather_dot(self.lm_head.weight, local_ids, hidden_states), global_ids
+ else:
+ packed = gather_dot_packed(self.lm_head.weight, local_ids, hidden_states, vocab_start)
+ packed = tensor_model_parallel_all_gather(packed, dim=0)
+ logits, ids = packed[:, : self.num_candidates].view(torch.float32), packed[:, self.num_candidates :]
+ logits, ids, _ = candidate_tail(logits, ids, hidden_states.shape[0], 0)
+ full = logits.new_full((logits.shape[0], self.config.vocab_size), float("-inf"))
+ return full.scatter_(1, ids, logits)
+
+ def combine_hidden_states(self, hidden_states: torch.Tensor) -> torch.Tensor:
+ """vLLM's per-chunk RMSNorms and ``fc`` over the aux hidden states, with the norms on vLLM's CUDA kernel: the draft
+ prefill calls this eagerly, where the native norm is ~7 launches per chunk (~45 us each at TP4)."""
+ with _kernel_ops():
+ return super().combine_hidden_states(hidden_states)
+
+ def _moe_rows(self, mlp: nn.Module, x: torch.Tensor) -> torch.Tensor:
+ """The MoE block on draft rows. vLLM's fused-MoE op finds its layer through the forward context, which the
+ draft tree's steps (and their CUDA graph captures) may run without: give them the engine's."""
+ if is_forward_context_available():
+ return mlp(x)
+ with set_forward_context(None, self.vllm_config):
+ return mlp(x)
diff --git a/eagle_harness/vllm/plugin.py b/eagle_harness/vllm/plugin.py
new file mode 100644
index 0000000..d5b5ff1
--- /dev/null
+++ b/eagle_harness/vllm/plugin.py
@@ -0,0 +1,78 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""vLLM plugin entry point (group ``vllm.general_plugins``, see pyproject.toml).
+
+vLLM calls :func:`register` in every process (API server, engine core, workers)
+before it resolves the speculative config. It registers the ``eagle_harness``
+speculative method, the EAGLE-4 draft architecture and the tree attention backend (``CUSTOM``) through
+vLLM's public registries; it patches nothing.
+
+On a vLLM that lacks a hook (:func:`eagle_harness.vllm.adapter.missing_hooks`, including the speculative-method
+registry of branch ``eagle-hooks``) it registers nothing and logs an error with the vLLM version, the missing hooks
+and the fix (:mod:`eagle_harness.compat`); it never raises, so installing this package can never break a vLLM install.
+"""
+
+from __future__ import annotations
+
+import logging
+
+from eagle_harness.vllm.config import METHOD_NAME
+
+logger = logging.getLogger(__name__)
+
+SPECULATOR = "eagle_harness.vllm.speculator:HarnessSpeculator"
+GDN_TREE_VERIFY = "eagle_harness.vllm.gdn_tree_verify:create_extension"
+TREE_ATTENTION = "eagle_harness.vllm.tree_attention.TreeFlashAttentionBackend"
+DRAFT_ARCHITECTURE = "LlamaForCausalLMEagle4"
+DRAFT_MODEL = "eagle_harness.vllm.models:LlamaForCausalLMEagle4"
+
+
+def register() -> bool:
+ """Register the method and the draft model (idempotent). False if vLLM lacks the hooks."""
+ from eagle_harness.compat import check_for_registration
+
+ _log_through_vllm()
+ if not check_for_registration("vllm"):
+ return False
+
+ from vllm.v1.spec_decode.registry import SpeculativeMethodSpec, register_speculative_method
+
+ from eagle_harness.vllm.config import configure_speculative_config, num_lookahead_tokens
+
+ register_speculative_method(
+ METHOD_NAME,
+ SpeculativeMethodSpec(
+ speculator_cls=SPECULATOR,
+ configure=configure_speculative_config,
+ uses_target_hidden_states=True,
+ uses_aux_hidden_states=True,
+ num_lookahead_tokens=num_lookahead_tokens,
+ supports_async_scheduling=True, # a round is device-only: no host read between verify and the next drafts
+ linear_attn_verify_extension=GDN_TREE_VERIFY,
+ ),
+ )
+
+ from vllm.v1.attention.backends.registry import AttentionBackendEnum, register_backend
+
+ register_backend(AttentionBackendEnum.CUSTOM, TREE_ATTENTION) # ``--attention-backend CUSTOM``
+
+ from vllm.model_executor.models.registry import ModelRegistry
+
+ if DRAFT_ARCHITECTURE not in ModelRegistry.get_supported_archs():
+ ModelRegistry.register_model(DRAFT_ARCHITECTURE, DRAFT_MODEL)
+ if "Eagle3ForHarness" not in ModelRegistry.get_supported_archs():
+ ModelRegistry.register_model("Eagle3ForHarness", "eagle_harness.vllm.eagle3:Eagle3ForHarness")
+ logger.info("eagle-harness: registered speculative method %s and draft %s", METHOD_NAME, DRAFT_ARCHITECTURE)
+ return True
+
+
+def _log_through_vllm() -> None:
+ """The package's loggers write where vLLM's do (vLLM configures only its own ``vllm`` logger, which does not
+ propagate, so ``eagle_harness.*`` records were dropped in vLLM processes)."""
+ ours, theirs = logging.getLogger("eagle_harness"), logging.getLogger("vllm")
+ if theirs.handlers and not ours.handlers:
+ for handler in theirs.handlers:
+ ours.addHandler(handler)
+ ours.setLevel(theirs.level)
+ ours.propagate = False
diff --git a/eagle_harness/vllm/round_commit.py b/eagle_harness/vllm/round_commit.py
new file mode 100644
index 0000000..37eb33d
--- /dev/null
+++ b/eagle_harness/vllm/round_commit.py
@@ -0,0 +1,215 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""What a tree round leaves behind, turned back into what vLLM expects after a chain round.
+
+After the tree walk the accepted rows are not a prefix of the verify rows. Two things put them in order,
+so that everything downstream of the verify (the next forward's KV cache, the draft's re-seeding) sees the
+chain it knows:
+
+- :class:`KvCompactor` (``post_accept``) copies the KV of the accepted rows of the target's full-attention
+ layers to the chain slots ``context + j``. A row's KV was written at ``context + row`` and is ready to
+ move because the sampler ran after the forward.
+- :func:`chainize` (before the draft's prefill) rewrites the target's inputs of the round the same way:
+ the draft sees the accepted rows in path order, at chain positions, with the sampled tokens.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Sequence
+
+import torch
+import triton
+import triton.language as tl
+
+
+def _is_tree(query_start_loc_ptr, cu_num_logits_ptr, b):
+ width = tl.load(query_start_loc_ptr + b + 1) - tl.load(query_start_loc_ptr + b)
+ return (width > 1) & (width == tl.load(cu_num_logits_ptr + b + 1) - tl.load(cu_num_logits_ptr + b))
+
+
+def _compact_kv_kernel(
+ layer_ptrs, # [L] uint64: base address of each layer's KV cache
+ table_ptrs, # [L] uint64: the layer's KV group's block table, [num_reqs, max_blocks] int32: the batch's rows
+ table_strides, # [L] int64: row stride of that table
+ table_block_sizes, # [L] int32: tokens per block of that table
+ idx_mapping_ptr,
+ query_start_loc_ptr,
+ cu_num_logits_ptr,
+ seq_lens_ptr,
+ path_ptr, # [slots, W] int32
+ stride_path,
+ path_len_ptr, # [slots] int32
+ stride_block, # KV cache strides in elements
+ stride_head,
+ stride_slot,
+ block_size, # tokens per block of the cache as the attention backend views it
+ DIM: tl.constexpr, # K and V of one token and head, adjacent
+ DTYPE: tl.constexpr,
+):
+ b, layer, head = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ if not _is_tree(query_start_loc_ptr, cu_num_logits_ptr, b):
+ return
+ slot = tl.load(idx_mapping_ptr + b)
+ context = tl.load(seq_lens_ptr + b) - (tl.load(query_start_loc_ptr + b + 1) - tl.load(query_start_loc_ptr + b))
+ base = tl.load(layer_ptrs + layer).to(tl.pointer_type(DTYPE))
+ block_table_ptr = tl.load(table_ptrs + layer).to(tl.pointer_type(tl.int32))
+ stride_table = tl.load(table_strides + layer)
+ table_block_size = tl.load(table_block_sizes + layer).to(tl.int64)
+ dims = tl.arange(0, DIM)
+ # One program per (request, layer, head) moves the rows in path order: a row's destination can be another
+ # accepted row's source, which was read earlier in the path.
+ for j in range(1, tl.load(path_len_ptr + slot)):
+ src = context + tl.load(path_ptr + slot * stride_path + j)
+ dst = context + j
+ if src != dst:
+ src_token = (
+ tl.load(block_table_ptr + b * stride_table + src // table_block_size).to(tl.int64) * table_block_size
+ + src % table_block_size
+ )
+ dst_token = (
+ tl.load(block_table_ptr + b * stride_table + dst // table_block_size).to(tl.int64) * table_block_size
+ + dst % table_block_size
+ )
+ src_at = (
+ (src_token // block_size) * stride_block + head * stride_head + (src_token % block_size) * stride_slot
+ )
+ dst_at = (
+ (dst_token // block_size) * stride_block + head * stride_head + (dst_token % block_size) * stride_slot
+ )
+ tl.store(base + dst_at + dims, tl.load(base + src_at + dims))
+ tl.debug_barrier()
+
+
+class KvCompactor:
+ """Moves the KV of the accepted rows of a tree round to the chain slots, in every given layer.
+
+ ``block_tables[i]`` and ``table_block_sizes[i]`` are layer ``i``'s KV cache group's persistent block table
+ (the batch's rows, as the forward got them) and its tokens per block; all layers go in one launch.
+ """
+
+ def __init__(
+ self,
+ kv_caches: Sequence[torch.Tensor],
+ block_tables: Sequence[torch.Tensor],
+ table_block_sizes: Sequence[int],
+ device: torch.device,
+ ):
+ first = kv_caches[0]
+ # (blocks, slots in a block, heads, 2 * head_dim): K then V of a token are adjacent, as the backend views it
+ view = first.transpose(1, 2)
+ if any(c.transpose(1, 2).stride() != view.stride() or c.dtype != first.dtype for c in kv_caches):
+ raise ValueError("the target's full-attention layers must share one KV cache layout")
+ if view.stride(3) != 1:
+ raise ValueError("KV cache rows must be contiguous")
+ self.strides = (view.stride(0), view.stride(2), view.stride(1)) # block, head, slot
+ self.num_heads, self.dim, self.dtype = view.shape[2], view.shape[3], first.dtype
+ self.block_size = view.shape[1]
+ self.layer_ptrs = torch.tensor([c.data_ptr() for c in kv_caches], dtype=torch.uint64, device=device)
+ self.table_ptrs = torch.tensor([t.data_ptr() for t in block_tables], dtype=torch.uint64, device=device)
+ self.table_strides = torch.tensor([t.stride(0) for t in block_tables], dtype=torch.int64, device=device)
+ self.table_block_sizes = torch.tensor(list(table_block_sizes), dtype=torch.int32, device=device)
+ if any(t.dtype != torch.int32 for t in block_tables):
+ raise ValueError("block tables must be int32")
+
+ def compact(
+ self,
+ idx_mapping: torch.Tensor,
+ query_start_loc: torch.Tensor,
+ cu_num_logits: torch.Tensor,
+ seq_lens: torch.Tensor,
+ path: torch.Tensor,
+ path_len: torch.Tensor,
+ ) -> None:
+ _compact_kv_kernel[(idx_mapping.shape[0], self.layer_ptrs.shape[0], self.num_heads)](
+ self.layer_ptrs,
+ self.table_ptrs,
+ self.table_strides,
+ self.table_block_sizes,
+ idx_mapping,
+ query_start_loc,
+ cu_num_logits,
+ seq_lens,
+ path,
+ path.stride(0),
+ path_len,
+ *self.strides,
+ self.block_size,
+ DIM=self.dim,
+ DTYPE={torch.bfloat16: tl.bfloat16, torch.float16: tl.float16}[self.dtype],
+ num_warps=2,
+ )
+
+
+def _chainize_kernel(
+ idx_mapping_ptr,
+ query_start_loc_ptr,
+ cu_num_logits_ptr,
+ seq_lens_ptr,
+ path_ptr,
+ stride_path,
+ path_len_ptr,
+ sampled_ptr, # [num_reqs, W] int64: the sampled tokens, in path order
+ stride_sampled,
+ input_ids_ptr, # [tokens] in/out
+ positions_ptr, # [tokens] in/out
+ src_rows_ptr, # [tokens] out: the row whose hidden state each row takes (rows of a tree only)
+ W: tl.constexpr,
+ WP: tl.constexpr,
+):
+ b = tl.program_id(0)
+ start = tl.load(query_start_loc_ptr + b)
+ width = tl.load(query_start_loc_ptr + b + 1) - start
+ rows = tl.arange(0, WP)
+ in_query = rows < width
+ if not _is_tree(query_start_loc_ptr, cu_num_logits_ptr, b):
+ return
+ slot = tl.load(idx_mapping_ptr + b)
+ accepted = tl.minimum(tl.load(path_len_ptr + slot), width)
+ context = tl.load(seq_lens_ptr + b) - width
+ path = tl.load(path_ptr + slot * stride_path + rows, mask=rows < accepted, other=0)
+ # Row j of the round is the j-th accepted row; rows past the path are padding the draft ignores.
+ tl.store(src_rows_ptr + start + rows, start + tl.where(rows < accepted, path, rows), mask=in_query)
+ tl.store(positions_ptr + start + rows, context + rows, mask=in_query)
+ # Row j holds the token the draft is given with it: the sampled token j - 1 (row 0 keeps the root).
+ sampled = tl.load(sampled_ptr + b * stride_sampled + rows - 1, mask=(rows >= 1) & (rows < accepted), other=0)
+ tl.store(input_ids_ptr + start + rows, sampled, mask=(rows >= 1) & (rows < accepted))
+
+
+def chainize(
+ input_ids: torch.Tensor,
+ positions: torch.Tensor,
+ src_rows: torch.Tensor,
+ *,
+ idx_mapping: torch.Tensor,
+ query_start_loc: torch.Tensor,
+ cu_num_logits: torch.Tensor,
+ seq_lens: torch.Tensor,
+ path: torch.Tensor,
+ path_len: torch.Tensor,
+ sampled: torch.Tensor,
+ width: int,
+) -> None:
+ """Rewrite the round's ``input_ids`` / ``positions`` in place for the draft's prefill and fill
+ ``src_rows`` (preset to the identity): row ``i`` of the draft's input takes the hidden state of target row
+ ``src_rows[i]``. Only the rows of a verified tree change."""
+ _chainize_kernel[(idx_mapping.shape[0],)](
+ idx_mapping,
+ query_start_loc,
+ cu_num_logits,
+ seq_lens,
+ path,
+ path.stride(0),
+ path_len,
+ sampled,
+ sampled.stride(0),
+ input_ids,
+ positions,
+ src_rows,
+ W=width,
+ WP=triton.next_power_of_2(width),
+ num_warps=1,
+ )
diff --git a/eagle_harness/vllm/round_recorder.py b/eagle_harness/vllm/round_recorder.py
new file mode 100644
index 0000000..b349f7c
--- /dev/null
+++ b/eagle_harness/vllm/round_recorder.py
@@ -0,0 +1,101 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Served decode rounds of the vLLM tree speculator, timed for :func:`eagle_harness.core.chain_width.served_tree_schedule`.
+
+vLLM fixes a round's verify width from its batch size, so a server times only the widths its schedule runs: calibrate
+a width by serving the workload once with ``max_verify_width`` set to it and ``record_rounds`` on, then the next
+width; every server merges its cells into ``<data_path>/rounds/tree.json`` and keeps the others.
+
+The speculator calls :meth:`ServedRoundRecorder.round` once per ``propose``. The period from one call to the next
+holds the draft growth of ``count`` rows and the verify of ``count + 1`` rows that follows it, plus the scheduler and
+the launches between them, so it is recorded as one round of width ``count + 1`` when both calls saw the same batch
+size, the previous call's ``count`` and no prefill. ``num_sampled`` (tokens each request committed in the verify just
+finished) is summed on the device; only :meth:`rows` reads it back, once per flush.
+"""
+
+from __future__ import annotations
+
+import contextlib
+import statistics
+import time
+from collections import defaultdict
+from collections.abc import Callable
+from typing import ContextManager
+
+import torch
+
+from eagle_harness.core.chain_width import merge_tree_rounds
+
+FLUSH_ROUNDS = 256
+MIN_ROUNDS = 8
+
+
+class ServedRoundRecorder:
+ def __init__(
+ self,
+ data_path: str,
+ *,
+ writer: bool,
+ flush_rounds: int = FLUSH_ROUNDS,
+ min_rounds: int = MIN_ROUNDS,
+ clock: Callable[[], float] = time.perf_counter,
+ sync_allowed: Callable[[], ContextManager] = contextlib.nullcontext,
+ ):
+ """``writer``: this rank writes the file (one rank of a tensor-parallel group); ``sync_allowed``: the context
+ under which a flush may read the device back (vLLM's ``gpu_sync_allowed``)."""
+ self.data_path = data_path
+ self.writer = writer
+ self.flush_rounds = flush_rounds
+ self.min_rounds = min_rounds
+ self.clock = clock
+ self.sync_allowed = sync_allowed
+ self._last: tuple[int, int] | None = None # (batch size, count) of the previous decode call
+ self._last_t = 0.0
+ self._periods: dict[tuple[int, int], list[float]] = defaultdict(list)
+ self._tokens: dict[tuple[int, int], torch.Tensor] = {} # committed tokens, on the device
+ self._recorded = 0
+
+ def round(self, num_reqs: int, count: int, has_prefill: bool, num_sampled: torch.Tensor) -> None:
+ """One ``propose`` call: ``count`` rows to draft now, ``num_sampled[:num_reqs]`` from the verify just done."""
+ now = self.clock()
+ last = self._last
+ if not has_prefill and last is not None and last[0] == num_reqs:
+ key = (num_reqs, last[1] + 1)
+ self._periods[key].append(now - self._last_t)
+ committed = num_sampled[:num_reqs].sum(dtype=torch.int64)
+ if key in self._tokens:
+ self._tokens[key] += committed
+ else:
+ self._tokens[key] = committed.clone()
+ self._recorded += 1
+ if self.writer and self._recorded % self.flush_rounds == 0:
+ self.flush()
+ self._last = None if has_prefill else (num_reqs, count)
+ self._last_t = now
+
+ def rows(self) -> list[dict]:
+ """The cells timed at least ``min_rounds`` times (reads the device sums back)."""
+ out = []
+ for (bs, width), periods in sorted(self._periods.items()):
+ if len(periods) < self.min_rounds:
+ continue
+ accept = int(self._tokens[(bs, width)].item()) / (bs * len(periods))
+ out.append(
+ {
+ "batch_size": bs,
+ "width": width,
+ "round_us": round(statistics.median(periods) * 1e6, 1),
+ "accept": round(accept, 4),
+ "count": len(periods),
+ }
+ )
+ return out
+
+ def flush(self) -> None:
+ if not self.writer:
+ return
+ with self.sync_allowed():
+ rows = self.rows()
+ if rows:
+ merge_tree_rounds(self.data_path, rows)
diff --git a/eagle_harness/vllm/speculator.py b/eagle_harness/vllm/speculator.py
new file mode 100644
index 0000000..eb7c33d
--- /dev/null
+++ b/eagle_harness/vllm/speculator.py
@@ -0,0 +1,339 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""``HarnessSpeculator``: EAGLE-Harness as a vLLM Model Runner V2 speculator.
+
+Chain mode (``node_top_k == 1``) drafts with vLLM's own EAGLE loop on the EAGLE-4 draft model and is
+verified by vLLM's chain rejection sampler; only the method registry is involved.
+
+Tree mode (``node_top_k > 1``) runs one round as follows (vLLM's hooks in brackets):
+
+1. [``prepare_verify_inputs``] the tree ``propose`` stored for each request becomes the batch's
+ :class:`~eagle_harness.vllm.verify_layout.VerifyStage` and the forward's positions become depths. The
+ target forward runs the ``CUSTOM`` tree attention and the linear-attention (GDN / Mamba2) tree verify extension.
+2. [``make_rejection_sampler``] the tree walk (:mod:`~eagle_harness.vllm.tree_accept`) accepts a path, greedy or
+ sampled (lossless). A batch whose logits processing reads each row's prefix (penalties, bad words, a thinking
+ budget) is verified as chains instead.
+3. [``post_accept``] the target's KV and linear-attention states of the accepted rows move to the chain slots.
+4. [``propose``] the draft prefill runs over the accepted rows in path order (:func:`chainize`) and yields
+ the next depth-1 candidates; :class:`~eagle_harness.vllm.tree_drafter.TreeDrafter` grows the tree and
+ writes the next verify rows (``draft_tokens`` in node order, their parents in the :class:`TreeStore`).
+
+vLLM's scheduler fixes the verify width of a step from the batch size (``num_speculative_tokens``), so the
+width is the batch-size schedule's, not a per-round choice. The draft depth is per round: a captured growth skips
+the steps whose nodes could not enter the verify set (:mod:`~eagle_harness.vllm.depth_stop`).
+"""
+
+from __future__ import annotations
+
+import logging
+import time
+from types import SimpleNamespace
+from typing import Any
+
+import torch
+
+from vllm.config.compilation import CUDAGraphMode
+from vllm.model_executor.layers.attention import Attention
+from vllm.utils.gpu_sync_debug import gpu_sync_allowed
+from vllm.v1.worker.gpu.spec_decode.eagle.speculator import EagleSpeculator
+from vllm.v1.worker.gpu.spec_decode.target_dependent_ar.cudagraph_utils import SpeculatorCudaGraphManager
+
+from eagle_harness.vllm.config import DERIVED, VllmMethodConfig, parse_method_config
+from eagle_harness.vllm.depth_stop import derived_cost_tables
+from eagle_harness.vllm.gdn_tree_verify import LinearStateCommit, check_tree_verifiable
+from eagle_harness.vllm.round_commit import KvCompactor, chainize
+from eagle_harness.vllm.round_recorder import ServedRoundRecorder
+from eagle_harness.vllm.tree_accept import TreeRejectionSampler
+from eagle_harness.vllm.tree_drafter import TreeDrafter
+from eagle_harness.vllm.verify_layout import TreeStore, VerifyStage, set_stage
+
+logger = logging.getLogger(__name__)
+STATS_LOG_INTERVAL_S = 60.0 # how often the draft steps per round are logged (one host read each)
+
+
+class HarnessSpeculator(EagleSpeculator):
+ def __init__(self, vllm_config: Any, device: Any):
+ super().__init__(vllm_config, device)
+ self.method_config: VllmMethodConfig = parse_method_config(self.speculative_config.method_config)
+ self.tree_mode = self.method_config.node_top_k > 1
+ if self.tree_mode:
+ width = self.num_speculative_steps + 1
+ self.store = TreeStore(self.max_num_reqs, width, device)
+ self.stage = VerifyStage(self.max_num_reqs, self.max_num_tokens, width, device)
+ set_stage(self.stage)
+ self.sampled_tokens: torch.Tensor | None = None # the last verify's tokens, by batch row
+ self.rejection_sampler: TreeRejectionSampler | None = None
+ self.rows = torch.arange(self.max_num_tokens, dtype=torch.int64, device=device)
+ self.src_rows = self.rows.clone() # the row each draft input takes its hidden state from
+ self._bound: SimpleNamespace | None = None
+ self.recorder: ServedRoundRecorder | None = None
+ if self.method_config.record_rounds:
+ from vllm.distributed import get_tensor_model_parallel_rank
+
+ self.recorder = ServedRoundRecorder(
+ self.method_config.harness.data_path,
+ writer=get_tensor_model_parallel_rank() == 0,
+ sync_allowed=gpu_sync_allowed,
+ )
+
+ def load_model(self, target_model: Any) -> None:
+ super().load_model(target_model)
+ if self.tree_mode:
+ (self.draft_layer_name,) = self.draft_attn_layer_names
+ layer = self.vllm_config.compilation_config.static_forward_context[self.draft_layer_name]
+ gain = self.method_config.depth_stop_gain
+ key = None
+ if gain == DERIVED and self.method_config.harness.data_path:
+ from eagle_harness.vllm.calibrate import cost_key
+
+ vc = self.vllm_config
+ key = cost_key(
+ vc.model_config.model,
+ vc.speculative_config.draft_model_config.model,
+ vc.parallel_config.tensor_parallel_size,
+ vc.model_config.dtype,
+ )
+ self.drafter = TreeDrafter(
+ self.model,
+ layer,
+ top_k=self.method_config.node_top_k,
+ depth=self.method_config.tree_depth,
+ max_reqs=self.max_num_reqs,
+ device=self.device,
+ min_gain=0.0 if gain == DERIVED else gain,
+ cost_tables=(
+ derived_cost_tables(
+ self.method_config, key,
+ schedule=self.speculative_config.num_speculative_tokens_per_batch_size,
+ max_batch_size=self.max_num_reqs,
+ )
+ if gain == DERIVED
+ else None
+ ),
+ )
+ self._next_stats_log = time.monotonic() + STATS_LOG_INTERVAL_S
+ if self.drafter.tree.shape.num_nodes(self.drafter.depth) < self.num_speculative_steps:
+ raise ValueError(
+ "the draft tree has fewer nodes than the verify width needs; raise tree_depth or node_top_k"
+ )
+
+ def init_cudagraph_manager(self, cudagraph_mode: CUDAGraphMode) -> None:
+ super().init_cudagraph_manager(cudagraph_mode)
+ if self.tree_mode:
+ linear = [layers for _, _, layers in self._groups() if layers and not isinstance(layers[0], Attention)]
+ check_tree_verifiable([layer for layers in linear for layer in layers])
+ for layers in linear: # one linear layer of each group publishes the group's state slots
+ self.stage.publish_slots_of(layers[0].prefix)
+ self.drafter.graphs = cudagraph_mode != CUDAGraphMode.NONE
+ # the draft steps are the drafter's (one graph of its own per batch size); only the draft prefill is a vLLM graph
+ self.decode_cudagraph_manager = SpeculatorCudaGraphManager(
+ self.vllm_config, self.device, CUDAGraphMode.NONE, decode_query_len=1
+ )
+
+ # ------------------------------------------------------------------ KV caches and state of the target
+ def _groups(self) -> list[tuple[int, int, list[Any]]]:
+ """``(group id, block size, layers)`` of the target's KV cache groups (the draft's layer is not one of them)."""
+ context = self.vllm_config.compilation_config.static_forward_context
+ return [
+ (
+ gid,
+ group.kv_cache_spec.block_size,
+ [context[name] for name in group.layer_names if name != self.draft_layer_name],
+ )
+ for gid, group in enumerate(self.kv_cache_config.kv_cache_groups)
+ ]
+
+ def _bind(self) -> SimpleNamespace:
+ """The layers' caches in one launch each (KV compaction, linear-state commit); needs the KV caches allocated."""
+ if self._bound is None:
+ tables = self.block_tables.input_block_tables
+ kv_layers, kv_tables, kv_blocks, linear_layers, linear_slots = [], [], [], [], []
+ for gid, block_size, layers in self._groups():
+ if layers and all(isinstance(layer, Attention) for layer in layers):
+ kv_layers += layers
+ kv_tables += [tables[gid]] * len(layers)
+ kv_blocks += [block_size] * len(layers)
+ elif layers:
+ linear_layers += layers
+ linear_slots += [self.stage.state_slots[layers[0].prefix]] * len(layers)
+ groups = self.kv_cache_config.kv_cache_groups
+ draft = next(gid for gid, group in enumerate(groups) if self.draft_layer_name in group.layer_names)
+ draft_layer = self.vllm_config.compilation_config.static_forward_context[self.draft_layer_name]
+ self.drafter.bind_cache(draft_layer.kv_cache, groups[draft].kv_cache_spec.block_size)
+ self._bound = SimpleNamespace(
+ kv=KvCompactor([layer.kv_cache for layer in kv_layers], kv_tables, kv_blocks, self.device),
+ state=LinearStateCommit(linear_layers, linear_slots, self.device),
+ draft_group=draft,
+ )
+ return self._bound
+
+ # ------------------------------------------------------------------ verify hooks
+ def prepare_verify_inputs(self, input_batch: Any, model_inputs: dict[str, Any], *, dummy_run: bool = False) -> None:
+ if not self.tree_mode:
+ return
+ if dummy_run: # a capture or warm-up batch: a uniform multi-token decode shape is a verify batch
+ per_req = input_batch.num_tokens // input_batch.num_reqs
+ tree = 1 < per_req <= self.stage.width and input_batch.num_tokens == per_req * input_batch.num_reqs
+ else:
+ drafts = input_batch.num_draft_tokens_per_req
+ tree = drafts is not None and not input_batch.has_prefill and bool((drafts >= 1).all())
+ # Logits processing that reads each row's prefix needs chains (exact, fewer accepted tokens).
+ tree = tree and not self.rejection_sampler.reads_draft_prefix(input_batch.idx_mapping_np)
+ self.stage.stage(
+ self.store,
+ input_batch.idx_mapping,
+ input_batch.query_start_loc,
+ input_batch.cu_num_logits,
+ input_batch.positions,
+ input_batch.num_reqs,
+ input_batch.num_tokens,
+ tree=tree,
+ model_positions=None if model_inputs["positions"] is input_batch.positions else model_inputs["positions"],
+ )
+
+ def make_rejection_sampler(self, sampler: Any) -> TreeRejectionSampler | None:
+ if not self.tree_mode:
+ return None
+ self.rejection_sampler = TreeRejectionSampler(
+ sampler, self.speculative_config, self.device, self.store, self.stage
+ )
+ return self.rejection_sampler
+
+ def post_accept(
+ self, input_batch: Any, sampler_output: Any, num_sampled: torch.Tensor, num_rejected: torch.Tensor
+ ) -> None:
+ if not self.tree_mode:
+ return
+ self.sampled_tokens = sampler_output.sampled_token_ids
+ if not self.stage.active:
+ return
+ bound, store = self._bind(), self.store
+ bound.kv.compact(
+ input_batch.idx_mapping,
+ input_batch.query_start_loc,
+ input_batch.cu_num_logits,
+ input_batch.seq_lens,
+ store.path,
+ store.path_len,
+ )
+ bound.state.commit(input_batch.idx_mapping, store.path, store.path_len)
+
+ # ------------------------------------------------------------------ propose
+ def propose(
+ self,
+ input_batch,
+ attn_metadata,
+ slot_mappings,
+ last_hidden_states,
+ aux_hidden_states,
+ num_sampled,
+ num_rejected,
+ last_sampled,
+ next_prefill_tokens,
+ temperature,
+ seeds,
+ dp_sync_state=None,
+ dummy_run=False,
+ skip_attn_for_dummy_run=False,
+ mm_inputs=None,
+ is_profile=False,
+ num_speculative_tokens=None,
+ ):
+ def draft_prefill(hidden, aux, steps):
+ return super(HarnessSpeculator, self).propose(
+ input_batch,
+ attn_metadata,
+ slot_mappings,
+ hidden,
+ aux,
+ num_sampled,
+ num_rejected,
+ last_sampled,
+ next_prefill_tokens,
+ temperature,
+ seeds,
+ dp_sync_state,
+ dummy_run,
+ skip_attn_for_dummy_run,
+ mm_inputs,
+ is_profile,
+ steps,
+ )
+
+ if not self.tree_mode:
+ return draft_prefill(last_hidden_states, aux_hidden_states, num_speculative_tokens)
+ count = self.num_speculative_steps if num_speculative_tokens is None else num_speculative_tokens
+ num_reqs = input_batch.num_reqs
+ if self.recorder is not None and not dummy_run:
+ self.recorder.round(num_reqs, count, bool(input_batch.has_prefill), num_sampled)
+ if not dummy_run and self.sampled_tokens is not None:
+ # Rows in path order: the draft prefill then sees the accepted chain, a prefix of the rows.
+ self.src_rows.copy_(self.rows) # rows that are not a verified tree keep their place
+ chainize(
+ input_batch.input_ids,
+ input_batch.positions,
+ self.src_rows,
+ idx_mapping=input_batch.idx_mapping,
+ query_start_loc=input_batch.query_start_loc,
+ cu_num_logits=input_batch.cu_num_logits,
+ seq_lens=input_batch.seq_lens,
+ path=self.store.path,
+ path_len=self.store.path_len,
+ sampled=self.sampled_tokens,
+ width=self.stage.width,
+ )
+ src = self.src_rows[: last_hidden_states.shape[0]]
+ last_hidden_states = last_hidden_states[src]
+ aux_hidden_states = [aux[src] for aux in aux_hidden_states] if aux_hidden_states else aux_hidden_states
+ draft_prefill(last_hidden_states, aux_hidden_states, 1)
+ drafts = self.draft_tokens[:num_reqs]
+ drafts.fill_(-1)
+ if dummy_run or count == 0:
+ return drafts
+ bound = self._bind()
+ committed = (input_batch.seq_lens[:num_reqs] - num_rejected[:num_reqs]).long()
+ table = self.block_tables.input_block_tables[bound.draft_group][:num_reqs]
+ tokens, parent_rows = self.drafter.grow_and_select(num_reqs, count, committed, table)
+ if self.drafter.min_gain is not None and time.monotonic() > self._next_stats_log:
+ self._next_stats_log = time.monotonic() + STATS_LOG_INTERVAL_S
+ with gpu_sync_allowed(): # one deliberate host read a minute (VLLM_GPU_SYNC_CHECK)
+ steps = self.drafter.mean_steps()
+ if steps is not None:
+ logger.info("eagle_harness: %.2f draft steps per round (tree_depth %d)", steps, self.drafter.depth)
+ drafts[:, :count] = tokens
+ self.store.parents[input_batch.idx_mapping, : count + 1] = parent_rows
+ return drafts
+
+ def _prefill(
+ self,
+ num_reqs,
+ num_tokens,
+ attn_metadata,
+ slot_mappings,
+ num_tokens_across_dp,
+ cudagraph_runtime_mode=CUDAGraphMode.NONE,
+ mm_inputs=None,
+ ):
+ """The draft prefill; in tree mode it ends in the depth-1 candidates instead of a sampled draft token."""
+ if not self.tree_mode:
+ return super()._prefill(
+ num_reqs,
+ num_tokens,
+ attn_metadata,
+ slot_mappings,
+ num_tokens_across_dp,
+ cudagraph_runtime_mode,
+ mm_inputs,
+ )
+ last = self.last_token_indices[:num_reqs]
+ normed, hidden = self._run_model(
+ num_tokens,
+ attn_metadata,
+ slot_mappings,
+ num_tokens_across_dp=num_tokens_across_dp,
+ cudagraph_runtime_mode=cudagraph_runtime_mode,
+ mm_inputs=mm_inputs,
+ )
+ probs, tokens = self.model.candidate_topk(normed[last], self.method_config.node_top_k)
+ self.drafter.seed(num_reqs, probs, tokens, hidden[last])
diff --git a/eagle_harness/vllm/tree_accept.py b/eagle_harness/vllm/tree_accept.py
new file mode 100644
index 0000000..686e025
--- /dev/null
+++ b/eagle_harness/vllm/tree_accept.py
@@ -0,0 +1,229 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Verification of a draft tree, greedy or sampled.
+
+Every verify row first gets the target's token: what vLLM's sampler would draw from that row's processed logits
+(temperature, top-k/top-p, min-p, logit bias), with vLLM's per-request Gumbel-max noise keyed by the request's
+seed and the row's own position (its depth). A greedy request's token is the argmax. The walk then goes from the
+root to the child whose draft token equals the current node's token, until a node has no such child. The
+accepted rows are the path (root first); the sampled tokens are the tokens of the path rows, the last of which is
+the bonus token.
+
+This is lossless: the token emitted at each position is a draw from the target's distribution given the accepted
+prefix (the row there has exactly that prefix), with noise that no other emitted token shares (the path's rows
+are at distinct positions). It is also the draw vLLM's sampler makes without speculation for the same seed and
+position, so a seeded request decodes the same text up to the logits' numerics. The draft tree must be fixed
+before the noise is drawn, which holds: the harness drafts deterministic top-k trees.
+
+The tree is the batch's :class:`~eagle_harness.vllm.verify_layout.VerifyStage` (a chain when the forward
+verified chains, so the walk is then vLLM's chain rule). The accepted rows of each request are kept in
+:class:`~eagle_harness.vllm.verify_layout.TreeStore` for the rest of the round (KV compaction, the draft's
+re-seeding and the GDN state commit read them).
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import torch
+import triton
+import triton.language as tl
+
+from vllm.config import SpeculativeConfig
+from vllm.v1.worker.gpu.sample.bad_words import BadWordsState
+from vllm.v1.worker.gpu.sample.gumbel import gumbel_sample
+from vllm.v1.worker.gpu.sample.logit_bias import LogitBiasState
+from vllm.v1.worker.gpu.sample.penalties import PenaltiesState
+from vllm.v1.worker.gpu.sample.sampler import Sampler
+from vllm.v1.worker.gpu.sample.states import NO_LOGPROBS
+from vllm.v1.worker.gpu.spec_decode.rejection_sampler import RejectionSampler
+
+from eagle_harness.vllm.verify_layout import TreeStore, VerifyStage
+
+
+def _tree_accept_kernel(
+ target_ptr, # [num_logits] int64: the target's token at every row (argmax, or a draw from its distribution)
+ drafted_ptr, # [num_logits] int64: the token every row holds (row 0: the last sampled token)
+ cu_num_logits_ptr, # [num_reqs + 1]
+ idx_mapping_ptr, # [num_reqs]
+ parents_ptr, # [slots, W] int32: the staged tree of each request state slot
+ stride_parents,
+ sampled_ptr, # [num_reqs, S] int64
+ stride_sampled,
+ num_sampled_ptr, # [num_reqs] int32
+ path_ptr, # [slots, W] int32: the accepted rows, root first
+ stride_path,
+ path_len_ptr, # [slots] int32
+ W: tl.constexpr,
+ WP: tl.constexpr,
+):
+ b = tl.program_id(0)
+ slot = tl.load(idx_mapping_ptr + b)
+ start = tl.load(cu_num_logits_ptr + b)
+ num_rows = tl.load(cu_num_logits_ptr + b + 1) - start
+ rows = tl.arange(0, WP)
+ parents = tl.load(parents_ptr + slot * stride_parents + rows, mask=rows < W, other=-1)
+ drafted = tl.load(drafted_ptr + start + rows, mask=rows < num_rows, other=-1)
+ target = tl.load(target_ptr + start + rows, mask=rows < num_rows, other=-1)
+
+ node = 0
+ alive = num_rows > 0
+ count = 0
+ for step in range(0, W):
+ token = tl.sum(tl.where(rows == node, target, 0))
+ tl.store(sampled_ptr + b * stride_sampled + step, token, mask=alive)
+ tl.store(path_ptr + slot * stride_path + step, node, mask=alive)
+ count += alive.to(tl.int32)
+ children = (parents == node) & (drafted == token) & (rows > 0) & (rows < num_rows)
+ child = tl.min(tl.where(children, rows, WP))
+ alive = alive & (child < WP)
+ node = tl.where(alive, child, node)
+ tl.store(num_sampled_ptr + b, count)
+ tl.store(path_len_ptr + slot, count)
+
+
+def accept_tree(
+ target: torch.Tensor,
+ drafted: torch.Tensor,
+ cu_num_logits: torch.Tensor,
+ idx_mapping: torch.Tensor,
+ parents: torch.Tensor,
+ store: TreeStore,
+) -> tuple[torch.Tensor, torch.Tensor]:
+ """The walk for every request: ``(sampled [num_reqs, W], num_sampled [num_reqs])``; the path goes to ``store``."""
+ num_reqs = cu_num_logits.shape[0] - 1
+ sampled = drafted.new_empty(num_reqs, store.width)
+ num_sampled = torch.empty(num_reqs, dtype=torch.int32, device=target.device)
+ _tree_accept_kernel[(num_reqs,)](
+ target,
+ drafted,
+ cu_num_logits,
+ idx_mapping,
+ parents,
+ parents.stride(0),
+ sampled,
+ sampled.stride(0),
+ num_sampled,
+ store.path,
+ store.path.stride(0),
+ store.path_len,
+ W=store.width,
+ WP=triton.next_power_of_2(store.width),
+ num_warps=1,
+ )
+ return sampled, num_sampled
+
+
+def accepted_rows_first(
+ expanded_idx_mapping: torch.Tensor, expanded_local_pos: torch.Tensor, store: TreeStore
+) -> torch.Tensor:
+ """For every logits row, the row it should hold: row ``k`` of a request takes its ``k``-th accepted row (path
+ order) while ``k`` is below the path length, and keeps its own place after it."""
+ rows = torch.arange(expanded_local_pos.shape[0], device=expanded_local_pos.device)
+ slots, k = expanded_idx_mapping.long(), expanded_local_pos.long()
+ accepted = rows - k + store.path[slots, k].long()
+ return torch.where(k < store.path_len[slots], accepted, rows)
+
+
+class TreeRejectionSampler(RejectionSampler):
+ """vLLM's rejection sampler with the chain rule replaced by the tree walk, for greedy and sampled requests."""
+
+ def __init__(
+ self,
+ sampler: Sampler,
+ spec_config: SpeculativeConfig,
+ device: torch.device,
+ store: TreeStore,
+ stage: VerifyStage,
+ ):
+ super().__init__(sampler, spec_config, device)
+ self.store = store
+ self.stage = stage
+
+ def reads_draft_prefix(self, idx_mapping_np: np.ndarray) -> bool:
+ """Whether a request of the batch has logits processing that reads the tokens before each row: penalties,
+ bad words, a thinking budget, or a custom logits processor (assumed to).
+
+ vLLM hands a processor the rows before a row of the request as that row's prefix; in a tree those are not the
+ row's ancestors, so the speculator verifies such a batch as chains. Logit bias (also allowed tokens and
+ min_tokens) reads only the row's position, which :meth:`_verify` passes per row.
+ """
+ sampler = self.sampler
+ if not np.any(sampler.needs_logits_processing[idx_mapping_np]):
+ return False
+ for processor in sampler.logits_processors:
+ if isinstance(processor, PenaltiesState):
+ uses = processor.use_penalty[idx_mapping_np]
+ elif isinstance(processor, BadWordsState):
+ uses = processor.num_bad_words.np[idx_mapping_np] > 0
+ elif isinstance(processor, LogitBiasState):
+ continue
+ else:
+ return True
+ if np.any(uses):
+ return True
+ thinking = sampler.thinking_budget_state # its per-request flags exist only with a reasoning config
+ return thinking.enabled and bool(np.any(thinking.use_thinking_budget[idx_mapping_np]))
+
+ def __call__(self, logits, input_batch, draft_logits=None, invalid_drafts=None):
+ # The forward ran on depth positions; the sampler and everything after it use chain positions.
+ self.stage.restore_positions(input_batch.positions, input_batch.num_tokens)
+ if input_batch.has_structured_output_reqs:
+ # The host masks a flattened chain, not each node's ancestry. Only the root is safe;
+ # keep the whole mixed batch root-only until the host can supply tree-aware masks.
+ non_root = input_batch.expanded_local_pos > 0
+ invalid_drafts = non_root if invalid_drafts is None else invalid_drafts | non_root
+ return super().__call__(logits, input_batch, draft_logits, invalid_drafts)
+
+ def _verify(
+ self,
+ logits: torch.Tensor,
+ draft_logits: torch.Tensor | None,
+ draft_sampled: torch.Tensor,
+ pos: torch.Tensor,
+ cu_num_logits: torch.Tensor,
+ idx_mapping: torch.Tensor,
+ idx_mapping_np: np.ndarray,
+ expanded_idx_mapping: torch.Tensor,
+ expanded_local_pos: torch.Tensor,
+ seq_lens_upper_bound_np: np.ndarray,
+ verify_draft_sampled: torch.Tensor,
+ ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
+ # `pos` holds chain positions; a tree row's own position is the root's plus its depth.
+ depth = self.stage.slot_depths[expanded_idx_mapping.long(), expanded_local_pos.long()]
+ row_pos = pos - expanded_local_pos + depth
+ processed = self.sampler.apply_sampling_params(
+ logits,
+ expanded_idx_mapping,
+ idx_mapping,
+ idx_mapping_np,
+ row_pos,
+ draft_sampled,
+ expanded_local_pos,
+ seq_lens_upper_bound_np,
+ )
+ states = self.sampler.sampling_states
+ target = gumbel_sample(
+ processed,
+ expanded_idx_mapping,
+ states.temperature.gpu,
+ states.seeds.gpu,
+ row_pos,
+ apply_temperature=False, # apply_sampling_params did
+ is_drafting=False,
+ use_fp64=self.sampler.use_fp64_gumbel,
+ )
+ sampled, num_sampled = accept_tree(
+ target, verify_draft_sampled, cu_num_logits, idx_mapping, self.stage.slot_parents, self.store
+ )
+ if self.sampler.return_sampling_mask or (
+ self.sampler.sampling_states.max_num_logprobs(idx_mapping_np) != NO_LOGPROBS
+ ):
+ # vLLM reads the logprobs and the sampling mask of sampled token k from logits row k of the request (raw
+ # rows from `logits`, processed ones from what this returns); a tree's accepted rows are not a prefix.
+ rows = accepted_rows_first(expanded_idx_mapping, expanded_local_pos, self.store)
+ if processed is not logits:
+ processed = processed[rows]
+ logits.copy_(logits[rows])
+ return processed, sampled, num_sampled
diff --git a/eagle_harness/vllm/tree_attention.py b/eagle_harness/vllm/tree_attention.py
new file mode 100644
index 0000000..a00754c
--- /dev/null
+++ b/eagle_harness/vllm/tree_attention.py
@@ -0,0 +1,98 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Tree attention for the target's full-attention layers.
+
+A tree verify forward holds, per request, ``W`` new tokens (the verify rows). Every row attends to the
+request's committed context, as in a chain, and to its own ancestors among the new tokens only (the ancestor
+bit masks of :class:`~eagle_harness.vllm.verify_layout.VerifyStage`). :func:`~eagle_harness.vllm.verify_attention.
+verify_attention` computes both, split over the context so a small batch uses the whole GPU.
+
+Everything but the scheduler's choice of batch shape is on the device, so the forward replays in CUDA
+graphs. Batches the stage is not active for (prefill, or no speculator) run FlashAttention unchanged, and
+so do the draft model's layers.
+
+Select it with ``--attention-backend CUSTOM`` (the plugin binds that name to :class:`TreeFlashAttentionBackend`).
+"""
+
+from __future__ import annotations
+
+import torch
+
+from vllm.v1.attention.backends.fa_utils import is_quantized_kv_cache
+from vllm.v1.attention.backends.flash_attn import FlashAttentionBackend, FlashAttentionImpl, FlashAttentionMetadata
+
+from eagle_harness.vllm.verify_attention import verify_attention
+from eagle_harness.vllm.verify_layout import get_stage
+
+
+class TreeFlashAttentionImpl(FlashAttentionImpl):
+ def forward(
+ self,
+ layer: torch.nn.Module,
+ query: torch.Tensor,
+ key: torch.Tensor,
+ value: torch.Tensor,
+ kv_cache: torch.Tensor,
+ attn_metadata: FlashAttentionMetadata,
+ output: torch.Tensor,
+ output_scale: torch.Tensor | None = None,
+ output_block_scale: torch.Tensor | None = None,
+ ) -> torch.Tensor:
+ stage = get_stage()
+ # A query of one token per request has no tree; a CUDA graph captured for it keeps the plain path.
+ if (
+ stage is None
+ or not stage.verifying
+ or attn_metadata is None
+ or attn_metadata.max_query_len <= 1
+ or getattr(layer, "is_draft_layer", False)
+ ):
+ return super().forward(
+ layer, query, key, value, kv_cache, attn_metadata, output, output_scale, output_block_scale
+ )
+ return self._forward_tree(query, key, value, kv_cache, attn_metadata, output, stage.masks, stage.context_lens)
+
+ def _forward_tree(
+ self,
+ query: torch.Tensor,
+ key: torch.Tensor,
+ value: torch.Tensor,
+ kv_cache: torch.Tensor,
+ attn_metadata: FlashAttentionMetadata,
+ output: torch.Tensor,
+ masks: torch.Tensor,
+ context_lens: torch.Tensor,
+ ) -> torch.Tensor:
+ """``context_lens``: the committed tokens of each request (``seq_lens - query lens``), staged once per forward
+ by :class:`~eagle_harness.vllm.verify_layout.VerifyStage` (computing it here cost two kernels per layer)."""
+ if is_quantized_kv_cache(self.kv_cache_dtype):
+ raise NotImplementedError("tree verify needs an unquantized KV cache")
+ tokens = attn_metadata.num_actual_tokens
+ num_reqs = attn_metadata.query_start_loc.shape[0] - 1
+ key_cache, value_cache = kv_cache.transpose(1, 2).split(self.head_size, dim=-1)
+ verify_attention(
+ query[:tokens],
+ key[:tokens],
+ value[:tokens],
+ key_cache,
+ value_cache,
+ attn_metadata.block_table,
+ context_lens[:num_reqs],
+ attn_metadata.query_start_loc,
+ masks,
+ self.scale,
+ output,
+ max_query_len=attn_metadata.max_query_len,
+ )
+ return output
+
+
+class TreeFlashAttentionBackend(FlashAttentionBackend):
+ @staticmethod
+ def get_name() -> str:
+ return "CUSTOM"
+
+ @staticmethod
+ def get_impl_cls() -> type[TreeFlashAttentionImpl]:
+ return TreeFlashAttentionImpl
diff --git a/eagle_harness/vllm/tree_drafter.py b/eagle_harness/vllm/tree_drafter.py
new file mode 100644
index 0000000..d8b8df1
--- /dev/null
+++ b/eagle_harness/vllm/tree_drafter.py
@@ -0,0 +1,274 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft tree of a round on vLLM: growth with the draft model's row forwards, and the verify rows.
+
+After the draft prefill (which yields the depth-1 candidates and the root hidden state, see
+:class:`~eagle_harness.vllm.speculator.HarnessSpeculator`), step ``s`` expands the ``K`` frontier nodes of
+depth ``s``: each row is one decode token of the draft layer at position ``c + s - 1`` (``c``: the committed
+length) that writes its draft KV to a scratch slot past ``c`` and attends to the committed draft KV inside
+the sliding window plus its own ancestors (:mod:`~eagle_harness.vllm.draft_attention`). Scores, frontier and
+the tree itself are the core's :class:`~eagle_harness.core.draft_tree.DraftTree`, shared with the sglang
+adapter. With ``min_gain`` set, a captured growth runs each step after the first inside a CUDA graph conditional
+node and skips it when :mod:`~eagle_harness.vllm.depth_stop` says the tree is done: a step must pay its measured cost
+when ``cost_tables`` price it, else ``min_gain`` (0: the verify rows are exactly those of the full-depth tree).
+:meth:`TreeDrafter.select` turns the best nodes into the verify rows vLLM schedules: their tokens in node order (a
+parent before its children) and, for each row, the row of its parent.
+"""
+
+from __future__ import annotations
+
+from contextlib import contextmanager
+from typing import Any, Mapping
+
+import torch
+
+from eagle_harness.core.cost_table import BatchCostTable
+from eagle_harness.core.draft_tree import DEPTH_DECAY, DraftTree, TreeShape
+from eagle_harness.vllm.depth_stop import keep_growing, round_costs
+from eagle_harness.vllm.draft_attention import tree_step_attention
+from eagle_harness.vllm.draft_rows import draft_step_slots, store_rows_kv
+
+
+class TreeDrafter:
+ def __init__(
+ self,
+ model: Any,
+ attn: Any,
+ *,
+ top_k: int,
+ depth: int,
+ max_reqs: int,
+ device: torch.device,
+ min_gain: float | None = None,
+ cost_tables: Mapping[int, BatchCostTable] | None = None,
+ ):
+ self.model = model
+ self.top_k = top_k
+ self.depth = depth
+ # Early stop of a captured growth (None: every round runs ``depth - 1`` steps).
+ self.min_gain = min_gain
+ self.cost_tables = cost_tables # what a step costs against its round (None: it costs min_gain)
+ self._go = torch.zeros((), dtype=torch.bool, device=device)
+ self.depth_stats = torch.zeros(2, dtype=torch.int64, device=device) # rounds, draft steps they ran
+ # The fp32 decay of each depth, as ``DraftTree.decay`` rounds it.
+ self._decay_of = [float(torch.tensor(DEPTH_DECAY**d, dtype=torch.float32)) for d in range(depth + 2)]
+ config = model.config
+ self.tree = DraftTree(
+ TreeShape(top_k=top_k, max_depth=depth),
+ max_reqs,
+ config.hidden_size,
+ model.model.layers[0].self_attn.qkv_proj.weight.dtype,
+ device,
+ max_verify=1,
+ delta_slots=(), # the work deltas are the cost model's input; a fixed depth does not read them
+ )
+ self.scale = attn.impl.scale
+ self.window = attn.sliding_window or 0 # keys a row sees, itself included; 0: the whole context
+ self.num_heads = attn.num_heads
+ if attn.num_kv_heads <= 0 or attn.num_heads % attn.num_kv_heads:
+ raise ValueError("draft query heads must be divisible by KV heads")
+ self.head_dim = attn.head_size
+ self.kv_view: torch.Tensor | None = None
+ self.table_block_size = 0
+ # CUDA graphs of the whole growth and selection, one per (batch size, count): the steps are device-only (no host
+ # reads), so a round's ``depth - 1`` draft forwards and the choice of verify rows replay as one launch. ``graphs``: switched on by the speculator when
+ # the engine runs with graphs.
+ self.graphs = False
+ self.device = device
+ self._committed = torch.zeros(max_reqs, dtype=torch.int64, device=device)
+ self._graphs: dict[tuple[int, int], Any] = {}
+ # Growth graphs run serially and their outputs are consumed before the next call.
+ # Reuse transient forward/logits storage across shapes instead of retaining it per batch size.
+ self._graph_pool = None
+ self._capture_stream = None
+ self._conditional_stream = None
+
+ def bind_cache(self, kv_cache: torch.Tensor, table_block_size: int) -> None:
+ """The draft layer's KV cache ``[blocks, heads, slots, 2 * head_dim]``, viewed ``[blocks, slots, heads, 2 * D]``;
+ ``table_block_size``: tokens per block of the block table (a multiple of the cache's own blocks)."""
+ self.kv_view = kv_cache.transpose(1, 2)
+ self.table_block_size = table_block_size
+
+ # ------------------------------------------------------------------ growth
+ def seed(self, num_reqs: int, probs: torch.Tensor, tokens: torch.Tensor, hidden: torch.Tensor) -> None:
+ """Depth 1 from the draft prefill's candidates of each request's last committed row."""
+ tree = self.tree
+ tree.root_probs[:num_reqs] = probs
+ tree.root_tokens[:num_reqs] = tokens
+ tree.root_hidden[:num_reqs] = hidden
+ tree.begin(num_reqs)
+
+ def grow_and_select(
+ self, num_reqs: int, count: int, committed: torch.Tensor, block_table: torch.Tensor
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ """Run draft steps ``1 .. depth - 1``, then :meth:`select` ``count`` verify rows.
+
+ ``committed``: ``[num_reqs]`` int64; ``block_table``: the draft KV group's (the batch's rows of the
+ persistent table: a graph keeps its address). With graphs, the whole growth and the selection replay as
+ one launch per (batch size, count); the returned tensors are the graph's, valid until the next call.
+ """
+ if not self.graphs:
+ return self._grow_and_select(num_reqs, count, committed, block_table)
+ key = (num_reqs, count)
+ entry = self._graphs.get(key)
+ if entry is None: # the first round of a shape runs eagerly: it compiles the kernels
+ self._graphs[key] = False
+ return self._grow_and_select(num_reqs, count, committed, block_table)
+ self._committed[:num_reqs].copy_(committed)
+ if entry is False:
+ from vllm.distributed.parallel_state import graph_capture
+
+ if self._graph_pool is None:
+ self._graph_pool = torch.cuda.graph_pool_handle()
+ self._capture_stream = torch.cuda.Stream(device=self.device)
+ self._conditional_stream = torch.cuda.Stream(device=self.device)
+ assert self._capture_stream is not None
+ graph = torch.cuda.CUDAGraph()
+ with graph_capture(device=self.device) as capture:
+ # The allocator reuses a pool's blocks on the same capture stream.
+ self._capture_stream.wait_stream(capture.stream)
+ with torch.cuda.graph(graph, pool=self._graph_pool, stream=self._capture_stream):
+ stop = graph if self.stops_early(count) else None
+ out = self._grow_and_select(num_reqs, count, self._committed[:num_reqs], block_table, stop)
+ entry = self._graphs[key] = (graph, block_table.data_ptr(), out)
+ graph, address, out = entry
+ if block_table.data_ptr() != address: # not the table the graph captured
+ return self._grow_and_select(num_reqs, count, committed, block_table)
+ graph.replay()
+ return out
+
+ def _grow_and_select(
+ self, num_reqs: int, count: int, committed: torch.Tensor, block_table: torch.Tensor, stop: Any = None
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ self.grow(num_reqs, committed, block_table, count=count, stop=stop)
+ return self.select(num_reqs, count)
+
+ def stops_early(self, count: int) -> bool:
+ """Whether a captured growth for ``count`` verify rows skips the steps it does not need (with ``min_gain``)."""
+ return self.min_gain is not None and self._first_decision(count) is not None
+
+ def _first_decision(self, count: int) -> int | None:
+ """The first step after which the tree has ``count`` nodes to rank against, if a later step remains."""
+ return next((s for s in range(1, self.depth - 1) if self.tree.shape.num_nodes(s + 1) >= count), None)
+
+ def grow(
+ self, num_reqs: int, committed: torch.Tensor, block_table: torch.Tensor, *, count: int = 0, stop: Any = None
+ ) -> None:
+ """Draft steps ``1 .. depth - 1`` (eager; :meth:`grow_and_select` is the serving path).
+
+ ``stop``: the CUDA graph being captured; each step after the tree first holds ``count`` nodes is then captured
+ into a conditional node that runs only while :func:`~eagle_harness.vllm.depth_stop.keep_growing` keeps
+ ``count`` verify rows open.
+ """
+ steps, k = self.depth - 1, self.top_k
+ if steps == 0:
+ return
+ first = self._first_decision(count) if stop is not None else None
+ if first is None:
+ stop = None
+ else: # the layers a skipped step leaves out must not rank with an older round's scores
+ self.tree.scores[:num_reqs, self.tree.shape.layer_start(first + 2) :] = 0
+ # The draft KV slots and positions of every step at once, one launch per round.
+ slots, blocks, offsets, positions = draft_step_slots(
+ block_table,
+ committed,
+ steps=steps,
+ top_k=k,
+ table_block=self.table_block_size,
+ cache_block=self.kv_view.shape[1],
+ )
+ for step in range(1, self.depth):
+ args = (slots[:, step - 1], blocks[step - 1], offsets[step - 1], positions[step - 1])
+ if stop is None:
+ self._step(num_reqs, step, committed, block_table, *args)
+ continue
+ with self._capture_if(stop if step > first else None):
+ self._step(num_reqs, step, committed, block_table, *args)
+ if first <= step < steps:
+ self._decide(num_reqs, step, count, first)
+
+ @contextmanager
+ def _capture_if(self, graph):
+ if graph is None:
+ yield
+ return
+ graph.begin_capture_to_if_node(self._go)
+ child = torch.cuda.current_stream(self.device)
+ # PyTorch creates a fresh child stream per node. Allocator blocks are stream-keyed,
+ # so route serial conditional work through one stream to reuse the shared pool.
+ assert self._conditional_stream is not None
+ self._conditional_stream.wait_stream(child)
+ try:
+ with torch.cuda.stream(self._conditional_stream):
+ yield
+ finally:
+ child.wait_stream(self._conditional_stream)
+ graph.end_capture_to_conditional_node()
+
+ def _decide(self, bs: int, step: int, count: int, first: int) -> None:
+ """Whether step ``step + 1`` runs, into ``self._go`` (``first``: the first deciding step)."""
+ tree = self.tree
+ costs = round_costs(self.cost_tables, bs, self.top_k, count)
+ keep_growing(
+ self._go,
+ self.depth_stats,
+ tree.scores[:bs],
+ tree.decay,
+ tree.front_scores[:bs],
+ count,
+ self._decay_of[step + 2],
+ self.min_gain,
+ (tree.shape.layer_start(step), tree.shape.layer_start(step + 1)),
+ steps_before=first if step == first else 0,
+ step_share=costs.step_share(step) if costs else 0.0,
+ )
+
+ def mean_steps(self) -> float | None:
+ """Draft steps per captured round with early stop so far (a host read; None before the first)."""
+ rounds, steps = self.depth_stats.tolist()
+ return steps / rounds if rounds else None
+
+ def _step(
+ self,
+ bs: int,
+ step: int,
+ committed: torch.Tensor,
+ block_table: torch.Tensor,
+ slots: torch.Tensor,
+ blocks: torch.Tensor,
+ offsets: torch.Tensor,
+ positions: torch.Tensor,
+ ) -> None:
+ """Draft step ``step``: ``slots`` ``[bs, K]`` the draft KV slots its rows write (``blocks`` / ``offsets`` in the
+ cache's own blocks, flat), ``positions`` ``[bs * K]``."""
+ tree = self.tree
+ rows = bs * self.top_k
+ tree.set_step_slots(bs, step, slots)
+
+ def attend(q: torch.Tensor, key: torch.Tensor, value: torch.Tensor) -> torch.Tensor:
+ heads, dim = self.num_heads, self.head_dim
+ store_rows_kv(self.kv_view, key, value, blocks, offsets)
+ out = tree_step_attention(
+ q.view(rows, heads, dim),
+ self.kv_view,
+ block_table,
+ self.table_block_size,
+ committed,
+ tree.ancestors[:bs],
+ self.scale,
+ step=step,
+ window=self.window,
+ )
+ return out.view(rows, heads * dim)
+
+ normed, hidden = self.model.forward_rows(tree.front_tokens[:rows], positions, tree.front_hidden[:rows], attend)
+ probs, tokens = self.model.candidate_topk(normed, self.top_k)
+ tree.step(bs, step, probs, tokens, hidden)
+
+ # ------------------------------------------------------------------ verify rows
+ def select(self, num_reqs: int, count: int) -> tuple[torch.Tensor, torch.Tensor]:
+ """The best ``count`` nodes of the grown tree as verify rows: ``(tokens [bs, count], parent_rows [bs, count + 1])``
+ (:meth:`~eagle_harness.core.draft_tree.DraftTree.verify_rows`: a parent's row before its children's, row 0 the
+ root)."""
+ return self.tree.verify_rows(num_reqs, self.depth, count)
diff --git a/eagle_harness/vllm/verify_attention.py b/eagle_harness/vllm/verify_attention.py
new file mode 100644
index 0000000..f22ea96
--- /dev/null
+++ b/eagle_harness/vllm/verify_attention.py
@@ -0,0 +1,207 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Attention of a tree verify forward's full-attention layers, split over the committed context.
+
+A request's ``W`` verify rows attend to its committed context in the paged KV cache (the same keys for every row)
+and to their own tree ancestors among the ``W`` new tokens. One program per (request, query head, split) loads its
+part of the context once for all ``W`` rows (a ``tl.dot`` over the rows); one more program per (request, query
+head) takes the new tokens with the rows' ancestor bit masks. A second kernel merges the parts by their
+log-sum-exp. The context is cut into as many equal parts as give every SM a program, so a long request at a small
+batch reads its keys with the whole GPU, not one SM per KV head.
+"""
+
+from __future__ import annotations
+
+import math
+
+import torch
+import triton
+import triton.language as tl
+
+from eagle_harness.kernels.online_softmax import online_block
+from eagle_harness.kernels.row_attention import program_splits
+
+BLOCK = 64 # context keys per inner step
+
+
+def _verify_attention_kernel(
+ q_ptr, # [tokens, Hq, D]
+ new_kv, # (keys, values) of the new tokens, [tokens, Hkv, D] each
+ cache_kv, # (keys, values): [blocks, page, Hkv, D] strided views of the paged cache
+ block_table_ptr, # [num_reqs, max_blocks]
+ context_lens_ptr, # [num_reqs] committed tokens of each request
+ query_start_loc_ptr, # [num_reqs + 1]
+ masks_ptr, # [num_reqs, W] int64: bit j set iff row j is row r or one of its ancestors
+ part_ptr, # [num_reqs, Hq, SPLITS + 1, ROWS_P, D] fp32
+ part_lse_ptr, # [num_reqs, Hq, SPLITS + 1, ROWS_P] fp32, log2 domain
+ q_strides, # (token, head)
+ new_strides, # (token, head) of the new keys, then of the new values
+ cache_strides, # (block, slot, head) of the cached keys, then of the cached values
+ stride_table,
+ page,
+ scale_log2,
+ HQ: tl.constexpr,
+ G: tl.constexpr, # query heads per KV head
+ D: tl.constexpr,
+ W: tl.constexpr,
+ ROWS_P: tl.constexpr,
+ SPLITS: tl.constexpr,
+ BLOCK: tl.constexpr,
+):
+ k_new_ptr, v_new_ptr = new_kv
+ k_cache_ptr, v_cache_ptr = cache_kv
+ stride_qt, stride_qh = q_strides
+ stride_knt, stride_knh, stride_vnt, stride_vnh = new_strides
+ stride_kb, stride_ks, stride_kh, stride_vb, stride_vs, stride_vh = cache_strides
+ b, h, split = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ kv_head = h // G
+ start = tl.load(query_start_loc_ptr + b)
+ width = tl.load(query_start_loc_ptr + b + 1) - start
+ r = tl.arange(0, ROWS_P)
+ d = tl.arange(0, D)
+ row_ok = r < width
+ qv = tl.load(q_ptr + (start + r)[:, None] * stride_qt + h * stride_qh + d[None, :], mask=row_ok[:, None], other=0.0)
+ peak = tl.full((ROWS_P,), float("-inf"), tl.float32)
+ denom = tl.zeros((ROWS_P,), tl.float32)
+ acc = tl.zeros((ROWS_P, D), tl.float32)
+ if split < SPLITS: # an equal part of the committed context
+ context = tl.load(context_lens_ptr + b).to(tl.int32)
+ per_split = tl.cdiv(tl.cdiv(context, SPLITS), BLOCK) * BLOCK
+ lo = split * per_split
+ hi = tl.minimum(lo + per_split, context)
+ for first in range(lo, hi, BLOCK):
+ p = first + tl.arange(0, BLOCK)
+ in_range = p < hi
+ block = tl.load(block_table_ptr + b * stride_table + p // page, mask=in_range, other=0).to(tl.int64)
+ slot = p % page
+ k = tl.load(
+ k_cache_ptr + (block * stride_kb + slot * stride_ks + kv_head * stride_kh)[:, None] + d[None, :],
+ mask=in_range[:, None],
+ other=0.0,
+ )
+ v = tl.load(
+ v_cache_ptr + (block * stride_vb + slot * stride_vs + kv_head * stride_vh)[:, None] + d[None, :],
+ mask=in_range[:, None],
+ other=0.0,
+ )
+ peak, denom, acc = online_block(qv, k, v, row_ok[:, None] & in_range[None, :], peak, denom, acc, scale_log2)
+ else: # the new tokens: each row sees itself and its ancestors
+ j = tl.arange(0, ROWS_P)
+ key_ok = j < width
+ k = tl.load(
+ k_new_ptr + (start + j)[:, None] * stride_knt + kv_head * stride_knh + d[None, :],
+ mask=key_ok[:, None],
+ other=0.0,
+ )
+ v = tl.load(
+ v_new_ptr + (start + j)[:, None] * stride_vnt + kv_head * stride_vnh + d[None, :],
+ mask=key_ok[:, None],
+ other=0.0,
+ )
+ row_mask = tl.load(masks_ptr + b * W + r, mask=row_ok, other=0)
+ visible = ((row_mask[:, None] >> j[None, :].to(tl.int64)) & 1) != 0
+ peak, denom, acc = online_block(
+ qv, k, v, row_ok[:, None] & key_ok[None, :] & visible, peak, denom, acc, scale_log2
+ )
+ part = ((b * HQ + h) * (SPLITS + 1) + split) * ROWS_P + r
+ safe = tl.maximum(denom, 1e-30)
+ tl.store(part_lse_ptr + part, tl.where(denom > 0, peak + tl.log2(safe), float("-inf")))
+ tl.store(part_ptr + part[:, None] * D + d[None, :], acc / safe[:, None])
+
+
+def _verify_merge_kernel(
+ part_ptr,
+ part_lse_ptr,
+ out_ptr, # [tokens, Hq, D]
+ query_start_loc_ptr,
+ stride_ot,
+ stride_oh,
+ HQ: tl.constexpr,
+ D: tl.constexpr,
+ ROWS_P: tl.constexpr,
+ SPLITS: tl.constexpr,
+ SPLITS_P: tl.constexpr,
+):
+ b, r, h = tl.program_id(0), tl.program_id(1), tl.program_id(2)
+ start = tl.load(query_start_loc_ptr + b)
+ if r < tl.load(query_start_loc_ptr + b + 1) - start:
+ s = tl.arange(0, SPLITS_P)
+ d = tl.arange(0, D)
+ used = s < SPLITS + 1
+ part = ((b * HQ + h) * (SPLITS + 1) + s) * ROWS_P + r
+ lse = tl.load(part_lse_ptr + part, mask=used, other=float("-inf"))
+ weight = tl.where(lse == float("-inf"), 0.0, tl.exp2(lse - tl.max(lse, 0)))
+ parts = tl.load(part_ptr + part[:, None] * D + d[None, :], mask=used[:, None], other=0.0)
+ merged = tl.sum(weight[:, None] * parts, 0) / tl.sum(weight, 0)
+ tl.store(out_ptr + (start + r) * stride_ot + h * stride_oh + d, merged.to(out_ptr.dtype.element_ty))
+
+
+def verify_attention(
+ q: torch.Tensor,
+ k_new: torch.Tensor,
+ v_new: torch.Tensor,
+ key_cache: torch.Tensor,
+ value_cache: torch.Tensor,
+ block_table: torch.Tensor,
+ context_lens: torch.Tensor,
+ query_start_loc: torch.Tensor,
+ masks: torch.Tensor,
+ scale: float,
+ out: torch.Tensor,
+ *,
+ max_query_len: int,
+) -> torch.Tensor:
+ """Tree verify attention into ``out`` ``[tokens, Hq, D]`` (rows past the last request's are left alone).
+
+ ``q`` ``[tokens, Hq, D]``; ``k_new`` / ``v_new`` ``[tokens, Hkv, D]`` the new tokens' keys and values;
+ ``key_cache`` / ``value_cache`` ``[blocks, page, Hkv, D]`` views of the paged cache, which holds each request's
+ first ``context_lens[b]`` tokens through ``block_table[b]``; ``masks[b, r]`` has bit ``j`` set iff new token
+ ``j`` is row ``r`` or one of its ancestors. Every request has at most ``max_query_len`` rows.
+ """
+ num_reqs = query_start_loc.shape[0] - 1
+ heads, head_dim = q.shape[1], q.shape[2]
+ rows_p = max(16, triton.next_power_of_2(max_query_len)) # tl.dot's smallest tile
+ splits = program_splits(num_reqs * heads, q.device)
+ part = torch.empty(num_reqs, heads, splits + 1, rows_p, head_dim, dtype=torch.float32, device=q.device)
+ part_lse = torch.empty(num_reqs, heads, splits + 1, rows_p, dtype=torch.float32, device=q.device)
+ _verify_attention_kernel[(num_reqs, heads, splits + 1)](
+ q,
+ (k_new, v_new),
+ (key_cache, value_cache),
+ block_table,
+ context_lens,
+ query_start_loc,
+ masks,
+ part,
+ part_lse,
+ (q.stride(0), q.stride(1)),
+ (k_new.stride(0), k_new.stride(1), v_new.stride(0), v_new.stride(1)),
+ (*key_cache.stride()[:3], *value_cache.stride()[:3]),
+ block_table.stride(0),
+ key_cache.shape[1],
+ scale * math.log2(math.e),
+ HQ=heads,
+ G=heads // key_cache.shape[2],
+ D=head_dim,
+ W=masks.shape[1],
+ ROWS_P=rows_p,
+ SPLITS=splits,
+ BLOCK=BLOCK,
+ )
+ _verify_merge_kernel[(num_reqs, max_query_len, heads)](
+ part,
+ part_lse,
+ out,
+ query_start_loc,
+ out.stride(0),
+ out.stride(1),
+ HQ=heads,
+ D=head_dim,
+ ROWS_P=rows_p,
+ SPLITS=splits,
+ SPLITS_P=triton.next_power_of_2(splits + 1),
+ )
+ return out
diff --git a/eagle_harness/vllm/verify_layout.py b/eagle_harness/vllm/verify_layout.py
new file mode 100644
index 0000000..73bd5a8
--- /dev/null
+++ b/eagle_harness/vllm/verify_layout.py
@@ -0,0 +1,203 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree of the current verify forward, in buffers that CUDA graphs replay.
+
+``propose`` stores the parent row of every verify row of a request (:class:`TreeStore`, by request state
+slot). Before each target forward :meth:`VerifyStage.stage` gathers the batch's rows into
+:class:`VerifyStage` (by batch row) and rewrites the forward's positions from chain positions to depths.
+The target's tree attention (:mod:`.tree_attention`), its GDN layers (:mod:`.gdn_tree_verify`) and the
+tree rejection sampler (:mod:`.tree_accept`) read the stage; it is one per process, like the forward
+context, because the attention and GDN layers do not take the speculator as an argument.
+
+A verify row ``r`` of a request holds a draft node; row 0 is the root (the last sampled token). Rows are
+ordered parent first, so any prefix of the rows is a tree too: when the scheduler grants fewer drafts than
+the tree has rows, the first ``1 + drafts`` rows are verified.
+"""
+
+from __future__ import annotations
+
+
+import torch
+import triton
+import triton.language as tl
+
+# The conv window of the root reads the request's conv state: codes -1, -2, -3 are the last, second to last
+# and third to last entry of the window before the root.
+WINDOW_CODES = (-1, -2, -3)
+
+
+def _stage_tree_kernel(
+ parents_ptr, # [slots, W] int32: parent row of each verify row (row 0: -1)
+ stride_parents,
+ idx_mapping_ptr, # [num_reqs] request state slot of each batch row
+ query_start_loc_ptr, # [num_reqs + 1] int32
+ cu_num_logits_ptr, # [num_reqs + 1] int32
+ positions_ptr, # [num_tokens] chain positions in, depth positions out
+ stage_parents_ptr, # [max_reqs, W] int32
+ stage_anc_ptr, # [max_reqs, 3, W] int32: codes of the 3 window ancestors of each row
+ stage_mask_ptr, # [max_reqs, W] int64: bit j set iff row j is an ancestor of the row or the row itself
+ context_lens_ptr, # [max_reqs] int32: committed tokens of each request (its first query token's position)
+ slot_parents_ptr, # [slots, W] int32: the staged parents again, by request state slot
+ slot_depths_ptr, # [slots, W] int32: the depth of each row, by request state slot
+ W: tl.constexpr,
+ WP: tl.constexpr,
+ TREE: tl.constexpr, # False: every request is staged as a chain (the forward verifies a chain)
+):
+ b = tl.program_id(0)
+ slot = tl.load(idx_mapping_ptr + b)
+ start = tl.load(query_start_loc_ptr + b)
+ width = tl.load(query_start_loc_ptr + b + 1) - start
+ tl.store(context_lens_ptr + b, tl.load(positions_ptr + start).to(tl.int32))
+ # A request verifies a tree when its query is all drafts (a prefill chunk has one logits row).
+ is_tree = TREE & (width > 1) & (width == tl.load(cu_num_logits_ptr + b + 1) - tl.load(cu_num_logits_ptr + b))
+ rows = tl.arange(0, WP)
+ in_tree = rows < tl.minimum(width, W)
+ parents = tl.load(parents_ptr + slot * stride_parents + rows, mask=rows < W, other=-1)
+ # Chain layout for anything that is not a tree, so the stage is valid for every request.
+ parents = tl.where(is_tree, parents, rows - 1)
+
+ depth = tl.zeros([WP], dtype=tl.int32)
+ anc1 = tl.full([WP], -1, dtype=tl.int32)
+ anc2 = tl.full([WP], -2, dtype=tl.int32)
+ anc3 = tl.full([WP], -3, dtype=tl.int32)
+ mask = tl.full([WP], 1, dtype=tl.int64)
+ for r in range(1, W):
+ parent = tl.sum(tl.where(rows == r, parents, 0))
+ at_parent = rows == parent
+ depth = tl.where(rows == r, tl.sum(tl.where(at_parent, depth, 0)) + 1, depth)
+ anc1 = tl.where(rows == r, parent, anc1)
+ anc2 = tl.where(rows == r, tl.sum(tl.where(at_parent, anc1, 0)), anc2)
+ anc3 = tl.where(rows == r, tl.sum(tl.where(at_parent, anc2, 0)), anc3)
+ own_bit = tl.cast(1, tl.int64) << r
+ mask = tl.where(rows == r, tl.sum(tl.where(at_parent, mask, 0)) | own_bit, mask)
+
+ out = b * W + rows
+ tl.store(stage_parents_ptr + out, parents, mask=rows < W)
+ tl.store(stage_anc_ptr + b * 3 * W + rows, anc1, mask=rows < W)
+ tl.store(stage_anc_ptr + b * 3 * W + W + rows, anc2, mask=rows < W)
+ tl.store(stage_anc_ptr + b * 3 * W + 2 * W + rows, anc3, mask=rows < W)
+ tl.store(stage_mask_ptr + out, mask, mask=rows < W)
+ tl.store(slot_parents_ptr + slot * W + rows, parents, mask=rows < W)
+ tl.store(slot_depths_ptr + slot * W + rows, depth, mask=rows < W)
+ # chain position = context + row; tree position = context + depth
+ positions = tl.load(positions_ptr + start + rows, mask=in_tree, other=0)
+ tl.store(positions_ptr + start + rows, positions - rows + depth, mask=in_tree & is_tree)
+
+
+class TreeStore:
+ """The tree of each request by request state slot: written by ``propose`` (``parents``) and by the
+ tree rejection sampler (``path``: the accepted rows, root first; ``path_len`` of them)."""
+
+ def __init__(self, max_reqs: int, width: int, device: torch.device):
+ self.width = width
+ self.parents = torch.full((max_reqs, width), -1, dtype=torch.int32, device=device)
+ self.path = torch.zeros(max_reqs, width, dtype=torch.int32, device=device)
+ self.path_len = torch.ones(max_reqs, dtype=torch.int32, device=device)
+
+
+class VerifyStage:
+ """The batch's trees, by batch row.
+
+ ``active``: the forward being built verifies trees (every request is a decode with drafts); otherwise
+ it verifies chains and the stage holds chain layouts, so the tree rejection sampler, which reads the
+ stage, walks a chain. The layers ask :attr:`verifying`, which is also true while a CUDA graph is captured.
+ """
+
+ def __init__(self, max_reqs: int, max_tokens: int, width: int, device: torch.device):
+ if width > 64:
+ raise ValueError(f"a verify tree has at most 64 rows, got {width}")
+ self.width = width
+ self.parents = torch.zeros(max_reqs, width, dtype=torch.int32, device=device)
+ self.ancestors = torch.zeros(max_reqs, 3, width, dtype=torch.int32, device=device)
+ self.masks = torch.ones(max_reqs, width, dtype=torch.int64, device=device)
+ # Committed tokens of each request (the tree attention's context), once per forward instead of per layer.
+ self.context_lens = torch.zeros(max_reqs, dtype=torch.int32, device=device)
+ # The staged parents and the rows' depths by request state slot: the rejection sampler splits a large batch
+ # into chunks of requests, which it addresses by slot.
+ self.slot_parents = torch.zeros(max_reqs, width, dtype=torch.int32, device=device)
+ self.slot_depths = torch.zeros(max_reqs, width, dtype=torch.int32, device=device)
+ self.chain_positions = torch.zeros(max_tokens, dtype=torch.int64, device=device)
+ # The GDN state slots of each verify row of the batch, per linear-attention KV cache group: what the forward's
+ # linear layers addressed. One layer of each group (its key) copies them in while the forward runs, so a CUDA
+ # graph replay refreshes them too.
+ self.max_reqs, self.device = max_reqs, device
+ self.state_slots: dict[str, torch.Tensor] = {} # by the publishing layer's name
+ self.active = True
+
+ @property
+ def verifying(self) -> bool:
+ """Whether the target's layers take the tree path now: a tree is staged, or a CUDA graph is being captured.
+
+ vLLM captures the target's verify graphs outside ``prepare_verify_inputs`` (no batch is staged then, and
+ ``active`` is whatever the last dummy run left), and a graph only replays the kernels it captured; so a
+ capture always takes the tree path. Only verify-shaped batches (several query tokens per request) reach
+ these layers in a capture; decode graphs of one token per request never do.
+ """
+ return self.active or torch.cuda.is_current_stream_capturing()
+
+ def publish_slots_of(self, layer_name: str) -> torch.Tensor:
+ """The buffer a linear-attention layer (one per KV cache group) publishes its group's slots to."""
+ buf = self.state_slots[layer_name] = torch.zeros(
+ self.max_reqs, self.width, dtype=torch.int32, device=self.device
+ )
+ return buf
+
+ def stage(
+ self,
+ store: TreeStore,
+ idx_mapping: torch.Tensor,
+ query_start_loc: torch.Tensor,
+ cu_num_logits: torch.Tensor,
+ positions: torch.Tensor,
+ num_reqs: int,
+ num_tokens: int,
+ *,
+ tree: bool,
+ model_positions: torch.Tensor | None = None,
+ ) -> None:
+ """Gather the batch's trees from ``store`` and turn ``positions`` from chain to depth positions
+ (``tree=False``: stage chains and leave the positions). ``model_positions``: the positions the model
+ takes when that is another tensor than ``positions`` (``[dims, tokens]`` for M-RoPE models), moved by
+ the same amount."""
+ self.chain_positions[:num_tokens].copy_(positions[:num_tokens])
+ _stage_tree_kernel[(num_reqs,)](
+ store.parents,
+ store.parents.stride(0),
+ idx_mapping,
+ query_start_loc,
+ cu_num_logits,
+ positions,
+ self.parents,
+ self.ancestors,
+ self.masks,
+ self.context_lens,
+ self.slot_parents,
+ self.slot_depths,
+ W=self.width,
+ WP=triton.next_power_of_2(self.width),
+ TREE=tree,
+ num_warps=1,
+ )
+ self.active = tree
+ if model_positions is not None:
+ model_positions[:, :num_tokens] += positions[:num_tokens] - self.chain_positions[:num_tokens]
+
+ def restore_positions(self, positions: torch.Tensor, num_tokens: int) -> None:
+ """Put the chain positions back after the verify forward (the sampler reads them)."""
+ if self.active:
+ positions[:num_tokens].copy_(self.chain_positions[:num_tokens])
+
+
+_STAGE: VerifyStage | None = None
+
+
+def set_stage(stage: VerifyStage | None) -> None:
+ global _STAGE
+ _STAGE = stage
+
+
+def get_stage() -> VerifyStage | None:
+ """The process's verify stage; ``None`` while no harness speculator is running."""
+ return _STAGE
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..e7d8854
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,58 @@
+[build-system]
+requires = ["setuptools>=77", "wheel"] # license-files (PEP 639)
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "eagle-harness"
+version = "0.1.0"
+description = "EAGLE-Harness: cost-model-driven dynamic-tree speculative decoding (out-of-tree sglang, vLLM and TokenSpeed plugin)"
+readme = "README.md"
+license = "LicenseRef-Eagle-4-Source-Available"
+license-files = ["LICENSE", "NOTICE", "TRADEMARKS.md", "THIRD_PARTY_NOTICES.md", "LICENSES/*.txt"]
+requires-python = ">=3.10"
+dependencies = ["numpy", "packaging", "torch"]
+
+[project.optional-dependencies]
+# No host release has the hooks yet (sglang v0.5.22 and vLLM v0.32.0 are the last without them);
+# eagle_harness/compat.py keeps the same ranges and checks the hooks at load time. FlashInfer 0.7.2 adds the public
+# variant API the sglang tree-tail mask verify uses (jit_args, variant_owns_mask).
+sglang = ["sglang>=0.5.23.dev0,<0.6", "flashinfer-python>=0.7.2"]
+vllm = ["vllm>=0.32.0rc1.dev283,!=0.32.0"]
+# TokenSpeed needs the release build with eagle-harness plugin hooks; see docs/install.md.
+tokenspeed = ["tokenspeed>=0.1.1,<0.2"]
+test = ["pytest", "scipy"]
+
+[project.scripts]
+eagle-harness = "eagle_harness.cli:main"
+eagle-harness-check = "eagle_harness.compat:main"
+
+# sglang's general plugin group: load_plugins() calls this in every sglang
+# process; it registers the EAGLE_HARNESS algorithm and the EAGLE-4 draft model.
+[project.entry-points."sglang.srt.plugins"]
+eagle_harness = "eagle_harness.sglang.plugin:register"
+
+# vLLM's general plugin group: load_general_plugins() calls this in every vLLM
+# process; it registers the eagle_harness speculative method and the EAGLE-4
+# draft architecture (needs vLLM with the speculative-method registry hooks).
+[project.entry-points."vllm.general_plugins"]
+eagle_harness = "eagle_harness.vllm.plugin:register"
+
+# TokenSpeed's runtime plugin group: tokenspeed.runtime.plugins.ensure_loaded() calls this in every TokenSpeed
+# process; it registers the EAGLE_HARNESS drafter and the EAGLE-4 draft architecture (requires the runtime plugin hooks).
+[project.entry-points."tokenspeed.plugins"]
+eagle_harness = "eagle_harness.tokenspeed.plugin:register"
+
+[tool.setuptools.packages.find]
+include = ["eagle_harness*"]
+
+[tool.setuptools.package-data]
+"eagle_harness.core" = ["*.csv", "profiles/**/*.json", "profiles/**/*.csv", "profiles/**/*.md"]
+"eagle_harness.kernels" = ["csrc/*.cu", "_native/*/*.so"]
+
+[tool.pytest.ini_options]
+testpaths = ["tests"]
+markers = ["slow: nvcc compile of the native library for every architecture (a few minutes)"]
+
+[tool.ruff]
+line-length = 120
+extend-exclude = ["eagle_harness/kernels/candidate_triton.py", "eagle_harness/kernels/gdn_tree_gluon.py"]
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..41576ca
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,28 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Wheel packaging: pure Python, plus the prebuilt native kernels when ``python -m eagle_harness.kernels.build prebuild``
+has put them in the package. The libraries need neither torch nor a Python ABI (ctypes, static CUDA runtime), so such a
+wheel is tagged ``py3-none-<platform>``; without them the wheel is the usual pure one and nvcc builds on first use."""
+
+from pathlib import Path
+
+from setuptools import setup
+from setuptools.command.bdist_wheel import bdist_wheel
+from setuptools.dist import Distribution
+
+PREBUILT = Path(__file__).parent / "eagle_harness" / "kernels" / "_native"
+
+
+class _Distribution(Distribution):
+ def has_ext_modules(self):
+ return any(PREBUILT.glob("*/*.so"))
+
+
+class _Wheel(bdist_wheel):
+ def get_tag(self):
+ python, abi, platform = super().get_tag()
+ return ("py3", "none", platform) if self.distribution.has_ext_modules() else (python, abi, platform)
+
+
+setup(distclass=_Distribution, cmdclass={"bdist_wheel": _Wheel})
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..25e9362
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,2 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
diff --git a/tests/golden/fork_golden.json b/tests/golden/fork_golden.json
new file mode 100644
index 0000000..106ecbf
--- /dev/null
+++ b/tests/golden/fork_golden.json
@@ -0,0 +1 @@
+{"budget": [{"args": [[0.8406, 0.7652, 1.7169, 2.7197, 1.8371, 2.3055, 0.3715, 1.2711, 1.6068, 0.7943], 19, [1.2022, 1.2374, 1.384, 1.7355, 2.0338, 2.3501], [0, 2, 3, 7, 10, 13], 1.35, [8, 6, 4, 2, 1]], "out": 8}, {"args": [[-0.178, -0.079, 0.3053, 0.1006, 2.5245, 1.6584, 0.5632, 2.0742, 1.8303, -0.0015], 18, [1.6948, 2.0732], [11, 14], 1.4, [8, 2, 16, 4, 2]], "out": 2}, {"args": [[1.0895, -0.1286, 1.8703, 2.2743, 0.058, 2.7387, 1.1411, 0.968, -0.1743, 2.8822], 10, [1.7533, 1.81, 1.9086, 1.927, 2.3401], [5, 9, 11, 12, 13], 1.4, [1, 6, 16, 1, 6]], "out": 10}, {"args": [[-0.1345, 0.5489, 1.7147, 2.8997, 0.5446, 2.8426, 1.0263, 2.0209, 0.7212, 0.309], 14, [1.3674, 1.6964, 1.8264, 2.8151, 2.8836], [0, 2, 4, 6, 13], 1.35, [4, 16, 1, 2, 16]], "out": 14}, {"args": [[1.021, 1.6334, 0.0952, 1.0084, 0.1391, 2.5926, 1.9184, 0.9586, 2.3355, 0.6298], 16, [1.5117, 1.8095, 1.8851, 2.5024, 2.6455, 2.7731], [2, 6, 7, 8, 9, 13], 1.4, [16, 16, 16, 6, 16]], "out": 10}, {"args": [[2.1273, 0.4183, 2.0219, 1.0745, 2.4243, 1.8854, 0.4913, 0.5467, 2.5865, 0.6432], 14, [1.6444, 2.2037, 2.5954, 2.9713], [1, 4, 8, 11], 1.4, [2, 16, 1, 16, 1]], "out": 12}, {"args": [[2.4491, 1.5495, 2.8024, 0.7979, 0.9416, 2.1782, 0.2224, 2.7188, 0.3529, 2.9724], 19, [2.6962, 2.9085], [13, 15], 1.35, [16, 6, 4, 8, 2]], "out": 16}, {"args": [[0.4224, 1.9813, 1.2009, 2.1395, 0.6482, 0.0185, 0.5513, 1.5281, 0.6894, 1.8458], 19, [1.2319, 1.6024, 1.783, 1.8219, 1.8657, 1.9284, 2.1716, 2.2721, 2.7113], [0, 2, 3, 5, 6, 7, 9, 11, 13], 1.6, [2, 8, 16, 16, 4]], "out": 4}, {"args": [[0.9354, 1.5068, 0.0755, 1.0632, 1.4106, -0.1254, 0.1333, 0.8363, 1.0223, 2.6841], 2, [1.2124, 2.2496, 2.3085], [0, 2, 3], 1.35, [2, 1, 1, 1, 16]], "out": 2}, {"args": [[1.0942, 1.9513, 2.629, 0.5387, 0.7617, 1.9566, 2.6156, 1.8499, 0.3103, 1.786], 18, [1.1449, 1.2837, 1.451, 1.9699, 1.9721, 2.3187], [1, 2, 5, 6, 7, 14], 1.35, [6, 1, 2, 1, 2]], "out": 6}, {"args": [[0.3129, 1.9161, 2.621, 1.4877, 0.1128, 1.2994, 2.5666, 2.6576, 2.9441, -0.1146], 18, [1.4727, 1.8114, 1.8758, 2.0043, 2.2108, 2.2514, 2.7066], [0, 1, 4, 6, 8, 12, 15], 1.4, [6, 1, 2, 8, 6]], "out": 16}, {"args": [[2.4203, 2.4178, 2.8541, 1.3046, 2.0361, 0.7345, 2.4651, 0.1483, 2.628, 1.6954], 6, [1.0596, 1.4739, 2.9393], [2, 7, 14], 1.35, [1, 1, 4, 4, 1]], "out": 2}, {"args": [[0.6057, 0.2993, 1.5503, 0.4533, 2.1678, 0.8256, 1.6536, 1.5487, 1.8094, 0.297], 6, [1.7688, 2.2627, 2.4294, 2.6446, 2.708, 2.977], [0, 3, 4, 9, 10, 13], 1.6, [4, 1, 16, 8, 2]], "out": 4}, {"args": [[2.2089, 1.9842, 0.4247, 1.4573, 1.6589, 1.2837, 1.9119, 2.7091, 2.3439, 2.3992], 17, [2.0525, 2.2285, 2.8888], [1, 4, 12], 1.4, [2, 2, 16, 16, 16]], "out": 2}, {"args": [[2.161, 1.1258, 2.3817, 2.1771, 1.4423, 0.7654, 1.0971, 1.0175, 2.87, 0.051], 19, [1.9066, 2.0122], [2, 7], 1.35, [8, 8, 16, 4, 1]], "out": 2}, {"args": [[0.7237, 2.3208, 0.0358, 1.6951, 0.401, -0.0637, 1.3307, 1.4635, 1.7601, 1.0008], 13, [1.2164, 1.3247, 1.5966, 1.7587, 1.9915, 2.1684, 2.4216, 2.4746], [1, 3, 4, 7, 8, 9, 11, 13], 1.6, [6, 1, 2, 1, 6]], "out": 4}, {"args": [[1.9659, 0.9273, 1.8913, 2.8348, 2.3374, 1.8103, 1.802, 0.7906, 1.8493, 1.8772], 15, [1.3532, 1.7462, 2.4003], [2, 7, 13], 1.35, [8, 4, 6, 4, 1]], "out": 14}, {"args": [[1.6591, 0.0226, 1.8149, -0.1755, 2.5178, 0.7676, 2.7566, 2.6724, 0.237, 1.0895], 13, [1.1649, 2.6356], [0, 8], 1.35, [2, 6, 8, 1, 1]], "out": 2}, {"args": [[1.323, 2.5589, 0.5795, 0.3567, 2.4761, 0.811, 2.6542, 2.4308, 0.9933, 0.8652], 4, [1.6812, 1.8264, 1.8924, 2.1036, 2.8942], [0, 3, 5, 11, 12], 1.35, [1, 2, 6, 1, 4]], "out": 4}, {"args": [[0.1322, 0.0344, 2.5925, 0.5716, 0.8122, 1.8565, 0.3544, 2.9213, 2.1463, 2.319], 12, [1.1323, 1.1984, 1.5809, 1.6091, 1.9279], [2, 7, 8, 13, 15], 1.6, [8, 1, 16, 2, 2]], "out": 2}, {"args": [[2.9869, 0.9854, 1.5195, 0.877, 1.6394, 1.6164, 2.6822, 0.1169, 0.8815, 2.0952], 11, [1.4917, 1.5622, 1.6176, 1.7449, 2.4369], [2, 6, 10, 13, 15], 1.35, [16, 16, 4, 8, 6]], "out": 2}, {"args": [[0.3728, 1.2197, 0.2123, 0.2752, 1.4721, 0.9681, 1.52, 0.4925, 0.7935, 0.8299], 19, [1.2978, 1.5478, 1.6088, 1.6649, 1.6784, 2.3517, 2.6669, 2.7939, 2.8245], [1, 3, 5, 7, 9, 10, 11, 14, 15], 1.35, [16, 1, 6, 2, 8]], "out": 10}, {"args": [[0.4684, 1.0779, 2.1686, 2.6803, 0.1795, 1.165, 2.3234, 2.8329, 2.1106, 0.3142], 9, [1.5178, 1.6423, 1.9758], [0, 4, 8], 1.4, [8, 6, 2, 4, 4]], "out": 2}, {"args": [[1.5761, 0.7051, 2.8452, 0.3027, 2.4777, -0.1431, 2.1659, 0.3539, 2.3229, 1.7449], 14, [1.0213, 2.6627], [3, 12], 1.4, [1, 6, 1, 6, 6]], "out": 2}, {"args": [[2.1851, 1.3935, 1.989, 0.3355, 0.8803, 0.0791, 2.4368, 0.604, 1.5037, 0.8013], 17, [1.0519, 2.1206, 2.1705, 2.187, 2.2032, 2.2765, 2.2933, 2.5184, 2.6262], [1, 4, 5, 7, 8, 10, 11, 12, 13], 1.6, [8, 1, 1, 8, 8]], "out": 6}, {"args": [[0.7479, 0.9444, 0.6865, 0.5178, 2.9695, 0.8967, 2.6075, 1.3241, 1.583, 0.0011], 5, [1.5879, 1.9774, 2.0276], [7, 9, 13], 1.6, [1, 1, 8, 6, 8]], "out": 2}, {"args": [[1.4072, 2.2494, 0.6277, 2.8444, 2.053, -0.1779, -0.1411, 1.2432, 0.8123, 1.8782], 10, [1.1274, 1.1989, 1.304, 1.627, 1.8479, 2.1708, 2.6729, 2.9957], [0, 4, 5, 7, 9, 10, 11, 12], 1.35, [6, 1, 2, 8, 16]], "out": 8}, {"args": [[2.9297, 1.5781, 1.9629, 1.8886, 2.5495, 2.5392, 0.7736, 0.4651, 1.5468, 1.6871], 12, [2.2733, 2.5734, 2.8166], [2, 5, 14], 1.4, [4, 16, 4, 16, 8]], "out": 2}, {"args": [[2.1633, 1.7402, 1.2238, 0.7368, 1.2908, -0.0998, 0.6189, 2.4425, 0.1845, 0.0751], 7, [1.1957, 1.858, 1.8796, 1.9278, 2.1995, 2.3933, 2.7506], [2, 3, 4, 6, 10, 11, 13], 1.4, [4, 4, 6, 8, 6]], "out": 2}, {"args": [[1.801, 0.7717, 2.1979, 1.0041, 1.7275, 0.8264, 2.4639, 2.2862, 0.4438, 2.2203], 11, [1.6198, 2.6949], [0, 13], 1.35, [16, 2, 2, 8, 2]], "out": 2}, {"args": [[1.3556, 2.651, 0.0392, 0.5656, 1.0006, -0.1265, 1.2203, 2.4539, 2.8252, 1.9474], 3, [1.4731, 1.7563, 1.8412, 1.9352, 2.6477, 2.7916], [2, 4, 8, 10, 12, 14], 1.6, [16, 1, 1, 16, 6]], "out": 2}, {"args": [[2.5795, 2.6063, 1.3212, 1.5724, 1.004, 1.5167, 1.2185, 0.0871, 2.8957, 0.791], 14, [1.7158, 2.1197, 2.2566, 2.361, 2.42, 2.7305, 2.868], [0, 1, 4, 9, 13, 14, 15], 1.4, [4, 4, 16, 4, 6]], "out": 2}, {"args": [[2.4976, 1.8485, 2.3642, 0.7708, 2.5825, 2.8104, 1.4953, -0.1263, 0.075, 2.2234], 5, [1.3106, 1.7107, 1.7449, 1.912, 2.136, 2.185], [3, 4, 8, 9, 11, 15], 1.4, [16, 16, 8, 8, 6]], "out": 2}, {"args": [[1.7195, 0.9663, 2.1458, 2.5402, 2.654, 1.6298, 0.0399, 2.8553, 1.1045, 0.4319], 20, [1.8323, 1.9849, 2.1118], [1, 3, 11], 1.6, [2, 6, 6, 2, 1]], "out": 4}, {"args": [[2.1415, 0.4078, 1.6718, 1.5628, 0.9162, 2.5352, 1.1996, 1.4384, 1.9317, 1.0943], 12, [1.4166, 1.6374], [1, 5], 1.6, [2, 6, 4, 16, 8]], "out": 6}, {"args": [[0.4813, 2.6425, 2.9346, 2.3762, 1.6699, 1.5387, 2.3033, 2.4324, 2.4699, 0.723], 16, [1.1977, 1.5444, 1.7473, 2.539, 2.9622, 2.9967], [0, 1, 7, 8, 12, 14], 1.35, [6, 8, 1, 1, 2]], "out": 8}, {"args": [[0.0263, 0.3812, 2.1407, 0.8403, 2.0643, 2.4473, 2.3868, -0.0724, 2.0031, 2.3543], 14, [1.1802, 1.5278, 2.0035, 2.4208, 2.8036, 2.8334, 2.9578], [2, 4, 5, 8, 9, 11, 14], 1.6, [16, 16, 8, 1, 8]], "out": 10}, {"args": [[2.5939, 1.9933, 2.3303, 1.3047, 1.4251, 0.0467, 0.4386, 0.3066, 1.5191, 1.4841], 19, [1.6728, 1.9429, 2.8652], [2, 4, 9], 1.6, [1, 16, 16, 1, 1]], "out": 2}, {"args": [[2.839, 1.9294, 2.4845, 1.9537, 1.2596, 2.1417, 2.396, 2.5634, 0.9755, 1.1003], 15, [1.449, 2.2755], [7, 8], 1.35, [6, 1, 6, 6, 8]], "out": 2}, {"args": [[0.6613, 1.5025, 1.808, 2.8637, 0.7088, 0.3562, 1.4226, 1.7096, 1.3589, 2.7211], 18, [1.4845, 1.5312, 2.0375, 2.2567, 2.3788, 2.3875, 2.7837], [0, 1, 2, 3, 4, 12, 15], 1.4, [2, 6, 8, 1, 6]], "out": 2}, {"args": [[0.0866, 0.0074, 2.8719, 1.4175, 1.1859, 0.1149, 2.6292, 2.9775, 2.001, 2.7192], 7, [1.1661, 1.4363, 1.7439, 2.8988, 2.9383, 2.9728], [1, 4, 5, 6, 7, 14], 1.6, [8, 2, 4, 1, 2]], "out": 6}, {"args": [[1.6159, 0.8752, 2.5261, 1.7854, 1.0048, -0.0821, 1.9648, -0.125, 1.9388, 1.0756], 10, [1.3776, 2.2277, 2.4433, 2.8809], [0, 5, 13, 14], 1.35, [1, 2, 2, 16, 2]], "out": 6}, {"args": [[2.2182, 1.707, 1.6921, 1.6168, 2.1673, 2.0105, 0.6673, 1.88, 2.0751, 1.2794], 12, [1.5583, 1.7762, 2.1736, 2.5121, 2.5216, 2.6926], [1, 2, 3, 7, 9, 15], 1.35, [2, 4, 8, 2, 8]], "out": 4}, {"args": [[-0.0694, 2.5504, 0.5311, 0.6879, 0.7766, 0.5488, 0.7247, 0.7221, 1.5052, 0.9517], 20, [1.4593, 1.9022, 1.9442, 2.0087, 2.3906, 2.7155, 2.82, 2.9688], [1, 5, 6, 8, 9, 10, 11, 13], 1.6, [8, 6, 6, 8, 16]], "out": 10}, {"args": [[1.7522, 0.4064, 0.4983, -0.1101, 0.6994, 2.5184, 1.6771, 2.3506, 2.9055, 0.2848], 8, [1.1344, 1.2283, 1.2825, 2.333, 2.3824, 2.5634, 2.5674, 2.7968, 2.9408], [0, 2, 3, 5, 10, 11, 12, 14, 15], 1.4, [16, 4, 4, 4, 2]], "out": 4}, {"args": [[1.1993, 1.8753, 1.017, 0.9701, 2.701, -0.0753, 1.3081, 2.5572, 2.6322, 1.038], 15, [1.25, 1.7108, 1.7384, 2.1299, 2.3263, 2.3368, 2.9079], [2, 3, 4, 8, 10, 13, 14], 1.4, [16, 1, 2, 8, 6]], "out": 14}, {"args": [[0.7407, 0.2546, 2.2333, 0.7811, 0.3959, 1.7196, 0.7064, 1.8139, 2.3632, 2.911], 18, [2.5284, 2.9864], [2, 15], 1.6, [1, 4, 2, 6, 16]], "out": 2}, {"args": [[0.3205, 1.3587, 2.5628, 1.0976, 2.2129, 0.1783, 0.1877, 2.0683, 2.8786, 0.8826], 18, [1.5922, 2.4923, 2.7493, 2.7555, 2.9146, 2.9154], [1, 6, 7, 8, 9, 14], 1.35, [16, 6, 6, 16, 4]], "out": 10}, {"args": [[2.851, 0.5006, 0.0595, 2.784, 1.5183, 1.6596, 2.7408, 2.1426, 0.6294, 0.7061], 17, [1.1162, 1.5157, 1.9779, 2.0646, 2.7778], [1, 4, 9, 13, 14], 1.35, [16, 4, 16, 1, 2]], "out": 10}, {"args": [[0.3259, 0.0283, 0.8242, 0.1122, 0.2792, 2.7815, 2.5917, 1.0009, 1.6078, 0.4486], 8, [1.1882, 1.1914, 1.4249, 1.4986, 1.5422, 2.2708, 2.3803, 2.3815, 2.4915], [0, 1, 2, 5, 7, 8, 10, 12, 13], 1.35, [8, 8, 2, 16, 16]], "out": 2}, {"args": [[0.5775, -0.1042, 0.629, 2.6604, 1.7747, 0.1777, 2.9095, 1.3816, 2.2961, 2.6927], 4, [1.0908, 1.0935, 1.6076, 2.0708, 2.1332, 2.3372, 2.527, 2.9929], [1, 2, 3, 7, 8, 11, 12, 15], 1.6, [8, 1, 2, 16, 16]], "out": 2}, {"args": [[1.9614, 2.9652, 1.3128, 1.6858, 2.3606, 1.9949, 1.6107, 2.2002, 1.5376, -0.1239], 2, [1.1006, 1.5328, 2.0051, 2.478], [1, 7, 10, 12], 1.4, [6, 6, 8, 6, 8]], "out": 2}, {"args": [[1.5693, 1.7363, 0.2799, 1.5187, 0.317, 1.8479, 0.1827, 2.3254, 2.502, 1.6775], 19, [1.0482, 1.3905, 1.7303, 1.8574, 1.8771, 2.1286, 2.5483, 2.8751, 2.8954], [1, 2, 3, 5, 6, 9, 10, 13, 15], 1.4, [1, 6, 16, 8, 2]], "out": 4}, {"args": [[1.6812, 1.8957, 0.8106, 0.6225, -0.1649, 1.7002, 2.0775, 0.1832, 0.5712, 2.2052], 4, [1.3472, 1.4691], [7, 9], 1.4, [16, 4, 2, 4, 8]], "out": 2}, {"args": [[1.3242, 0.9804, 1.3894, 1.1986, 2.1211, 1.13, 2.5741, 2.5071, 2.578, 2.1995], 15, [1.239, 1.2601, 1.3516, 1.4187, 2.0858, 2.6695, 2.7705], [1, 3, 6, 7, 10, 12, 14], 1.6, [2, 1, 6, 6, 1]], "out": 4}, {"args": [[0.2633, 0.9423, 1.5843, 2.511, 2.5711, 1.2708, 2.7491, 0.7518, 0.7597, 1.5166], 20, [1.3211, 1.3718, 1.8552, 1.8899, 2.31, 2.4338, 2.647], [5, 6, 7, 8, 11, 12, 13], 1.6, [16, 16, 4, 4, 6]], "out": 8}, {"args": [[0.5069, 2.6449, 0.7185, -0.1227, 0.1827, 1.9792, 0.9829, 0.7085, 1.9829, 0.398], 3, [1.0143, 1.4294, 1.5415, 1.6367, 1.91, 2.1355, 2.2807, 2.6109, 2.7791], [0, 1, 3, 4, 5, 6, 7, 8, 15], 1.6, [16, 2, 1, 16, 8]], "out": 2}, {"args": [[0.6635, 2.11, 2.9266, 1.2299, 2.5487, 2.0735, 0.6736, 1.2269, 2.5046, 1.3442], 2, [1.0733, 1.0926, 2.3084], [9, 10, 15], 1.6, [8, 16, 2, 2, 6]], "out": 2}, {"args": [[2.6092, 2.2032, 1.5811, 1.2712, 2.7964, 1.7089, 0.9547, 1.7125, 0.545, 0.4459], 17, [1.2708, 1.9232, 2.7584], [7, 8, 13], 1.6, [2, 16, 6, 1, 16]], "out": 14}, {"args": [[0.94, 0.5738, 0.7121, 1.0007, 0.2651, 2.6787, 1.4427, 2.1495, 0.6849, 1.9327], 18, [1.0231, 1.8368, 2.0228, 2.9747], [0, 3, 9, 14], 1.35, [16, 2, 6, 8, 4]], "out": 4}, {"args": [[2.1921, 2.7341, 0.5999, -0.1322, 1.7004, 0.4315, 0.5625, 1.1085, 0.1738, 0.5687], 16, [1.2387, 1.3803, 1.913, 1.9607, 1.9785, 2.1073, 2.3262, 2.5393, 2.5709], [0, 1, 2, 6, 8, 9, 12, 14, 15], 1.35, [16, 6, 2, 2, 8]], "out": 2}, {"args": [[0.0039, 1.6096, 0.2144, 1.165, 2.2752, 0.5473, 1.1498, 2.7825, 2.5814, 2.5794], 17, [1.155, 1.2304, 1.5556, 1.6362, 2.8346], [3, 5, 6, 8, 14], 1.35, [1, 1, 6, 8, 16]], "out": 6}, {"args": [[1.4739, 2.3838, 2.4111, 0.8154, -0.1757, 2.4573, 1.9548, 0.1537, 0.9031, 0.4723], 9, [1.1854, 1.7146, 2.1146], [0, 7, 13], 1.6, [4, 4, 2, 16, 6]], "out": 8}, {"args": [[0.3856, -0.0645, 2.9542, 2.0705, 0.6748, 2.1727, 1.6568, 1.8162, 0.9486, 1.9382], 11, [1.4242, 1.8128, 2.3151, 2.3564, 2.4069, 2.4255, 2.6725], [1, 2, 3, 9, 11, 12, 15], 1.4, [6, 6, 6, 4, 16]], "out": 10}, {"args": [[0.2778, 2.3023, 2.8754, 1.7933, 0.1409, 1.9649, 1.9679, 0.1765, 0.6226, 0.8642], 10, [2.3163, 2.5231, 2.6524], [4, 12, 14], 1.35, [6, 16, 2, 16, 1]], "out": 2}, {"args": [[2.9528, 0.7769, 2.5666, 1.1115, 1.2115, 1.5338, 1.5454, 2.2955, 1.6795, 0.3358], 1, [1.1406, 1.8508, 2.6545, 2.711], [0, 4, 9, 10], 1.35, [8, 1, 1, 4, 6]], "out": 2}, {"args": [[2.6789, 0.9245, 2.3615, 0.4849, 0.7295, 0.5429, 2.7723, 0.1053, 0.7203, 1.2991], 6, [1.6731, 1.858, 2.0216, 2.1385, 2.1845, 2.2726, 2.4762], [2, 4, 5, 8, 10, 12, 13], 1.4, [16, 16, 16, 1, 6]], "out": 2}, {"args": [[0.915, 1.1742, 1.5306, 2.6518, -0.0703, 0.4188, 1.0863, 1.8547, 0.2256, 1.1922], 2, [1.0007, 1.1591, 1.3754, 2.6702], [1, 7, 13, 14], 1.35, [8, 2, 1, 2, 4]], "out": 2}, {"args": [[1.0613, 0.8399, 2.4031, 2.4667, 2.7961, 0.1905, 0.6894, -0.1036, 1.0758, 2.5159], 2, [1.5147, 2.6922], [0, 6], 1.6, [6, 16, 6, 8, 1]], "out": 2}, {"args": [[0.6367, 2.9577, 0.596, 2.3815, -0.1814, 0.7837, 1.4497, 0.8015, 2.8191, 2.8656], 13, [1.1523, 1.5873, 1.7012, 1.7478, 1.7998, 2.0739, 2.5145], [0, 2, 7, 10, 12, 14, 15], 1.4, [4, 2, 2, 16, 6]], "out": 8}, {"args": [[2.7276, 2.2691, 1.0021, 2.0182, 1.0998, 1.7504, 2.4796, 1.2443, 1.1065, 0.1219], 17, [2.4542, 2.7681], [0, 8], 1.4, [6, 2, 8, 6, 16]], "out": 2}, {"args": [[1.4129, 1.8937, 0.5298, 1.942, 2.936, 2.8105, 1.1674, 2.6752, 0.3038, 0.2503], 8, [1.9841, 2.1497, 2.5038, 2.6638], [1, 2, 6, 7], 1.35, [8, 4, 4, 16, 1]], "out": 8}, {"args": [[0.0347, 2.1279, 1.0145, 2.6214, 1.8702, 0.5673, 2.2065, 1.6933, 0.9341, 2.345], 11, [1.2221, 1.6256, 1.7793, 1.9763, 2.3924, 2.6678], [0, 3, 7, 11, 12, 14], 1.4, [4, 2, 16, 1, 4]], "out": 8}, {"args": [[2.418, 0.5176, 2.8181, 1.7936, 2.509, 2.7055, 0.818, 1.0006, 2.6699, 0.7289], 9, [1.5583, 2.5468, 2.7178, 2.7865], [0, 5, 13, 14], 1.6, [1, 4, 1, 8, 1]], "out": 6}, {"args": [[1.555, 0.5058, 2.1176, 1.1026, 1.9029, 0.5678, 2.236, 0.5402, 1.8043, 1.6312], 10, [1.5935, 1.7326], [6, 14], 1.6, [16, 8, 8, 6, 4]], "out": 2}, {"args": [[0.9732, 1.3136, 0.8815, 2.8896, 0.2117, 0.5199, 2.2572, 0.5627, 0.0095, 0.9793], 3, [2.1111, 2.2065, 2.5604, 2.8752, 2.8762], [0, 5, 7, 9, 10], 1.4, [6, 16, 6, 16, 2]], "out": 2}, {"args": [[0.5294, 0.4143, 2.7736, 2.6368, 1.0154, 1.4944, 0.1112, -0.1388, 1.4422, 2.8241], 12, [1.3506, 2.0138], [9, 15], 1.35, [1, 16, 6, 1, 1]], "out": 2}, {"args": [[1.1515, 1.1021, 2.85, 0.5376, 2.5386, 0.2645, 2.0078, 1.2181, 1.061, 1.3279], 19, [1.1745, 1.4019, 1.6024, 1.9448, 2.119, 2.3145], [2, 5, 6, 9, 12, 14], 1.35, [2, 1, 2, 8, 6]], "out": 10}, {"args": [[1.7686, 1.2837, 1.4333, 2.8382, 0.7744, 2.4865, 0.4016, 2.5768, 0.1049, 1.6156], 7, [1.4541, 1.517, 2.1532, 2.4563, 2.6391, 2.6512, 2.7595], [1, 2, 5, 9, 10, 11, 12], 1.6, [16, 6, 6, 4, 16]], "out": 6}, {"args": [[-0.0061, -0.1566, 1.4478, 0.5216, 2.2087, 1.9714, 1.4159, 2.7702, 2.904, 0.784], 3, [1.007, 1.1837, 1.2274, 1.4393, 1.6843, 2.2999], [1, 2, 3, 4, 7, 8], 1.35, [8, 16, 2, 2, 6]], "out": 2}], "cost_files_chain_intensity": {"bs_1/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 2.1445,\n 2.1484,\n 0.0,\n 2.1738,\n 0.0,\n 2.1777,\n 0.0,\n 2.1914,\n 0.0,\n 2.2129,\n 0.0,\n 2.2188,\n 0.0,\n 2.2344,\n 0.0,\n 2.2559\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0018,\n 0.0,\n 1.0137,\n 0.0,\n 1.0155,\n 0.0,\n 1.0219,\n 0.0,\n 1.0319,\n 0.0,\n 1.0346,\n 0.0,\n 1.0419,\n 0.0,\n 1.0519\n ],\n \"array\": [\n 2.1445,\n 2.1484,\n 0.0,\n 2.1738,\n 0.0,\n 2.1777,\n 0.0,\n 2.1914,\n 0.0,\n 2.2129,\n 0.0,\n 2.2188,\n 0.0,\n 2.2344,\n 0.0,\n 2.2559\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 2.2676,\n 2.2734,\n 0.0,\n 2.3047,\n 0.0,\n 2.332,\n 0.0,\n 2.3496,\n 0.0,\n 2.3711,\n 0.0,\n 2.4023,\n 0.0,\n 2.4121,\n 0.0,\n 2.4277\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0026,\n 0.0,\n 1.0164,\n 0.0,\n 1.0284,\n 0.0,\n 1.0362,\n 0.0,\n 1.0457,\n 0.0,\n 1.0594,\n 0.0,\n 1.0637,\n 0.0,\n 1.0706\n ],\n \"array\": [\n 2.2676,\n 2.2734,\n 0.0,\n 2.3047,\n 0.0,\n 2.332,\n 0.0,\n 2.3496,\n 0.0,\n 2.3711,\n 0.0,\n 2.4023,\n 0.0,\n 2.4121,\n 0.0,\n 2.4277\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 3.3516,\n 3.4062,\n 0.0,\n 3.498,\n 0.0,\n 3.6074,\n 0.0,\n 3.7129,\n 0.0,\n 3.8164,\n 0.0,\n 3.9316,\n 0.0,\n 4.0352,\n 0.0,\n 4.1543\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0163,\n 0.0,\n 1.0437,\n 0.0,\n 1.0763,\n 0.0,\n 1.1078,\n 0.0,\n 1.1387,\n 0.0,\n 1.1731,\n 0.0,\n 1.204,\n 0.0,\n 1.2395\n ],\n \"array\": [\n 3.3516,\n 3.4062,\n 0.0,\n 3.498,\n 0.0,\n 3.6074,\n 0.0,\n 3.7129,\n 0.0,\n 3.8164,\n 0.0,\n 3.9316,\n 0.0,\n 4.0352,\n 0.0,\n 4.1543\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 3.4707,\n 3.5234,\n 0.0,\n 3.6387,\n 0.0,\n 3.75,\n 0.0,\n 3.8711,\n 0.0,\n 3.9844,\n 0.0,\n 4.1035,\n 0.0,\n 4.2109,\n 0.0,\n 4.3203\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0152,\n 0.0,\n 1.0484,\n 0.0,\n 1.0805,\n 0.0,\n 1.1154,\n 0.0,\n 1.148,\n 0.0,\n 1.1823,\n 0.0,\n 1.2133,\n 0.0,\n 1.2448\n ],\n \"array\": [\n 3.4707,\n 3.5234,\n 0.0,\n 3.6387,\n 0.0,\n 3.75,\n 0.0,\n 3.8711,\n 0.0,\n 3.9844,\n 0.0,\n 4.1035,\n 0.0,\n 4.2109,\n 0.0,\n 4.3203\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 3.5879,\n 3.6445,\n 0.0,\n 3.7715,\n 0.0,\n 3.9082,\n 0.0,\n 4.0273,\n 0.0,\n 4.1387,\n 0.0,\n 4.2793,\n 0.0,\n 4.3906,\n 0.0,\n 4.5059\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0158,\n 0.0,\n 1.0512,\n 0.0,\n 1.0893,\n 0.0,\n 1.1225,\n 0.0,\n 1.1535,\n 0.0,\n 1.1927,\n 0.0,\n 1.2237,\n 0.0,\n 1.2559\n ],\n \"array\": [\n 3.5879,\n 3.6445,\n 0.0,\n 3.7715,\n 0.0,\n 3.9082,\n 0.0,\n 4.0273,\n 0.0,\n 4.1387,\n 0.0,\n 4.2793,\n 0.0,\n 4.3906,\n 0.0,\n 4.5059\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 3.707,\n 3.7637,\n 0.0,\n 3.9082,\n 0.0,\n 4.0449,\n 0.0,\n 4.1777,\n 0.0,\n 4.2969,\n 0.0,\n 4.4434,\n 0.0,\n 4.582,\n 0.0,\n 4.7031\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0153,\n 0.0,\n 1.0543,\n 0.0,\n 1.0911,\n 0.0,\n 1.127,\n 0.0,\n 1.1591,\n 0.0,\n 1.1986,\n 0.0,\n 1.236,\n 0.0,\n 1.2687\n ],\n \"array\": [\n 3.707,\n 3.7637,\n 0.0,\n 3.9082,\n 0.0,\n 4.0449,\n 0.0,\n 4.1777,\n 0.0,\n 4.2969,\n 0.0,\n 4.4434,\n 0.0,\n 4.582,\n 0.0,\n 4.7031\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 3.8262,\n 3.8887,\n 0.0,\n 4.0508,\n 0.0,\n 4.1797,\n 0.0,\n 4.3301,\n 0.0,\n 4.4844,\n 0.0,\n 4.6113,\n 0.0,\n 4.752,\n 0.0,\n 4.8867\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0163,\n 0.0,\n 1.0587,\n 0.0,\n 1.0924,\n 0.0,\n 1.1317,\n 0.0,\n 1.172,\n 0.0,\n 1.2052,\n 0.0,\n 1.242,\n 0.0,\n 1.2772\n ],\n \"array\": [\n 3.8262,\n 3.8887,\n 0.0,\n 4.0508,\n 0.0,\n 4.1797,\n 0.0,\n 4.3301,\n 0.0,\n 4.4844,\n 0.0,\n 4.6113,\n 0.0,\n 4.752,\n 0.0,\n 4.8867\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 2.3887,\n 2.4062,\n 0.0,\n 2.4277,\n 0.0,\n 2.4629,\n 0.0,\n 2.498,\n 0.0,\n 2.5332,\n 0.0,\n 2.5645,\n 0.0,\n 2.6055,\n 0.0,\n 2.6289\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0074,\n 0.0,\n 1.0164,\n 0.0,\n 1.0311,\n 0.0,\n 1.0458,\n 0.0,\n 1.0605,\n 0.0,\n 1.0736,\n 0.0,\n 1.0908,\n 0.0,\n 1.1006\n ],\n \"array\": [\n 2.3887,\n 2.4062,\n 0.0,\n 2.4277,\n 0.0,\n 2.4629,\n 0.0,\n 2.498,\n 0.0,\n 2.5332,\n 0.0,\n 2.5645,\n 0.0,\n 2.6055,\n 0.0,\n 2.6289\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 2.5039,\n 2.5293,\n 0.0,\n 2.5742,\n 0.0,\n 2.6152,\n 0.0,\n 2.6543,\n 0.0,\n 2.6934,\n 0.0,\n 2.7344,\n 0.0,\n 2.7754,\n 0.0,\n 2.8125\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0101,\n 0.0,\n 1.0281,\n 0.0,\n 1.0445,\n 0.0,\n 1.0601,\n 0.0,\n 1.0757,\n 0.0,\n 1.092,\n 0.0,\n 1.1084,\n 0.0,\n 1.1232\n ],\n \"array\": [\n 2.5039,\n 2.5293,\n 0.0,\n 2.5742,\n 0.0,\n 2.6152,\n 0.0,\n 2.6543,\n 0.0,\n 2.6934,\n 0.0,\n 2.7344,\n 0.0,\n 2.7754,\n 0.0,\n 2.8125\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 2.6289,\n 2.6484,\n 0.0,\n 2.7012,\n 0.0,\n 2.7539,\n 0.0,\n 2.8066,\n 0.0,\n 2.8574,\n 0.0,\n 2.9004,\n 0.0,\n 2.957,\n 0.0,\n 2.998\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0074,\n 0.0,\n 1.0275,\n 0.0,\n 1.0475,\n 0.0,\n 1.0676,\n 0.0,\n 1.0869,\n 0.0,\n 1.1033,\n 0.0,\n 1.1248,\n 0.0,\n 1.1404\n ],\n \"array\": [\n 2.6289,\n 2.6484,\n 0.0,\n 2.7012,\n 0.0,\n 2.7539,\n 0.0,\n 2.8066,\n 0.0,\n 2.8574,\n 0.0,\n 2.9004,\n 0.0,\n 2.957,\n 0.0,\n 2.998\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 2.75,\n 2.7715,\n 0.0,\n 2.8359,\n 0.0,\n 2.8945,\n 0.0,\n 2.9648,\n 0.0,\n 3.0234,\n 0.0,\n 3.0684,\n 0.0,\n 3.1289,\n 0.0,\n 3.1953\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0078,\n 0.0,\n 1.0312,\n 0.0,\n 1.0526,\n 0.0,\n 1.0781,\n 0.0,\n 1.0994,\n 0.0,\n 1.1158,\n 0.0,\n 1.1378,\n 0.0,\n 1.1619\n ],\n \"array\": [\n 2.75,\n 2.7715,\n 0.0,\n 2.8359,\n 0.0,\n 2.8945,\n 0.0,\n 2.9648,\n 0.0,\n 3.0234,\n 0.0,\n 3.0684,\n 0.0,\n 3.1289,\n 0.0,\n 3.1953\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 2.877,\n 2.9121,\n 0.0,\n 2.9609,\n 0.0,\n 3.0352,\n 0.0,\n 3.1055,\n 0.0,\n 3.1738,\n 0.0,\n 3.2422,\n 0.0,\n 3.3242,\n 0.0,\n 3.375\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0122,\n 0.0,\n 1.0292,\n 0.0,\n 1.055,\n 0.0,\n 1.0794,\n 0.0,\n 1.1032,\n 0.0,\n 1.127,\n 0.0,\n 1.1555,\n 0.0,\n 1.1731\n ],\n \"array\": [\n 2.877,\n 2.9121,\n 0.0,\n 2.9609,\n 0.0,\n 3.0352,\n 0.0,\n 3.1055,\n 0.0,\n 3.1738,\n 0.0,\n 3.2422,\n 0.0,\n 3.3242,\n 0.0,\n 3.375\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 2.9805,\n 3.0215,\n 0.0,\n 3.0957,\n 0.0,\n 3.1797,\n 0.0,\n 3.2656,\n 0.0,\n 3.3398,\n 0.0,\n 3.4141,\n 0.0,\n 3.4883,\n 0.0,\n 3.5742\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0138,\n 0.0,\n 1.0387,\n 0.0,\n 1.0668,\n 0.0,\n 1.0957,\n 0.0,\n 1.1206,\n 0.0,\n 1.1455,\n 0.0,\n 1.1704,\n 0.0,\n 1.1992\n ],\n \"array\": [\n 2.9805,\n 3.0215,\n 0.0,\n 3.0957,\n 0.0,\n 3.1797,\n 0.0,\n 3.2656,\n 0.0,\n 3.3398,\n 0.0,\n 3.4141,\n 0.0,\n 3.4883,\n 0.0,\n 3.5742\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 3.0977,\n 3.1484,\n 0.0,\n 3.2422,\n 0.0,\n 3.3203,\n 0.0,\n 3.4082,\n 0.0,\n 3.498,\n 0.0,\n 3.5801,\n 0.0,\n 3.6797,\n 0.0,\n 3.7539\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0164,\n 0.0,\n 1.0467,\n 0.0,\n 1.0719,\n 0.0,\n 1.1003,\n 0.0,\n 1.1293,\n 0.0,\n 1.1557,\n 0.0,\n 1.1879,\n 0.0,\n 1.2119\n ],\n \"array\": [\n 3.0977,\n 3.1484,\n 0.0,\n 3.2422,\n 0.0,\n 3.3203,\n 0.0,\n 3.4082,\n 0.0,\n 3.498,\n 0.0,\n 3.5801,\n 0.0,\n 3.6797,\n 0.0,\n 3.7539\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 3.2227,\n 3.2734,\n 0.0,\n 3.3711,\n 0.0,\n 3.4727,\n 0.0,\n 3.5527,\n 0.0,\n 3.6719,\n 0.0,\n 3.7578,\n 0.0,\n 3.8555,\n 0.0,\n 3.9551\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0158,\n 0.0,\n 1.0461,\n 0.0,\n 1.0776,\n 0.0,\n 1.1024,\n 0.0,\n 1.1394,\n 0.0,\n 1.1661,\n 0.0,\n 1.1964,\n 0.0,\n 1.2273\n ],\n \"array\": [\n 3.2227,\n 3.2734,\n 0.0,\n 3.3711,\n 0.0,\n 3.4727,\n 0.0,\n 3.5527,\n 0.0,\n 3.6719,\n 0.0,\n 3.7578,\n 0.0,\n 3.8555,\n 0.0,\n 3.9551\n ],\n \"batch_size\": 1,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 1.2793\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.2793\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 1.3535\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.3535\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 1.9902\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.9902\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 2.0684\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.0684\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 2.1387\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.1387\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 2.209\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.209\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 2.2773\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.2773\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 1.418\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.418\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 1.4941\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.4941\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 1.5664\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.5664\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 1.6387\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.6387\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 1.707\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.707\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 1.7754\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.7754\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 1.8516\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.8516\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 1.9277\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.9277\n ],\n \"batch_size\": 1,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1450.4817,\n 1466.5544,\n 1502.9889,\n 1536.0992,\n 1568.13,\n 1601.5236,\n 1639.0739,\n 1671.7728,\n 1707.2205\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0111,\n 1.0362,\n 1.059,\n 1.0811,\n 1.1041,\n 1.13,\n 1.1526,\n 1.177\n ],\n \"array_model\": [\n 1450.4817,\n 1466.5544,\n 1502.9889,\n 1536.0992,\n 1568.13,\n 1601.5236,\n 1639.0739,\n 1671.7728,\n 1707.2205\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 34.312,\n 34.3744,\n 0.0,\n 34.7808,\n 0.0,\n 34.8432,\n 0.0,\n 35.0624,\n 0.0,\n 35.4064,\n 0.0,\n 35.5008,\n 0.0,\n 35.7504,\n 0.0,\n 36.0944\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1452.4513,\n 1468.5544,\n 1505.0833,\n 1538.568,\n 1570.6612,\n 1604.0548,\n 1642.0099,\n 1674.616,\n 1709.9693\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0111,\n 1.0362,\n 1.0593,\n 1.0814,\n 1.1044,\n 1.1305,\n 1.153,\n 1.1773\n ],\n \"array_model\": [\n 1452.4513,\n 1468.5544,\n 1505.0833,\n 1538.568,\n 1570.6612,\n 1604.0548,\n 1642.0099,\n 1674.616,\n 1709.9693\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 36.2816,\n 36.3744,\n 0.0,\n 36.8752,\n 0.0,\n 37.312,\n 0.0,\n 37.5936,\n 0.0,\n 37.9376,\n 0.0,\n 38.4368,\n 0.0,\n 38.5936,\n 0.0,\n 38.8432\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1469.7953,\n 1486.6792,\n 1524.1761,\n 1558.9744,\n 1592.474,\n 1627.1796,\n 1666.4787,\n 1700.5856,\n 1737.5949\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.037,\n 1.0607,\n 1.0835,\n 1.1071,\n 1.1338,\n 1.157,\n 1.1822\n ],\n \"array_model\": [\n 1469.7953,\n 1486.6792,\n 1524.1761,\n 1558.9744,\n 1592.474,\n 1627.1796,\n 1666.4787,\n 1700.5856,\n 1737.5949\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 53.6256,\n 54.4992,\n 0.0,\n 55.968,\n 0.0,\n 57.7184,\n 0.0,\n 59.4064,\n 0.0,\n 61.0624,\n 0.0,\n 62.9056,\n 0.0,\n 64.5632,\n 0.0,\n 66.4688\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1471.7009,\n 1488.5544,\n 1526.4273,\n 1561.256,\n 1595.0052,\n 1629.8676,\n 1669.2291,\n 1703.3968,\n 1740.2509\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.0372,\n 1.0609,\n 1.0838,\n 1.1075,\n 1.1342,\n 1.1574,\n 1.1825\n ],\n \"array_model\": [\n 1471.7009,\n 1488.5544,\n 1526.4273,\n 1561.256,\n 1595.0052,\n 1629.8676,\n 1669.2291,\n 1703.3968,\n 1740.2509\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 55.5312,\n 56.3744,\n 0.0,\n 58.2192,\n 0.0,\n 60.0,\n 0.0,\n 61.9376,\n 0.0,\n 63.7504,\n 0.0,\n 65.656,\n 0.0,\n 67.3744,\n 0.0,\n 69.1248\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1473.5761,\n 1490.492,\n 1528.5521,\n 1563.7872,\n 1597.5044,\n 1632.3364,\n 1672.0419,\n 1706.272,\n 1743.2205\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.0373,\n 1.0612,\n 1.0841,\n 1.1077,\n 1.1347,\n 1.1579,\n 1.183\n ],\n \"array_model\": [\n 1473.5761,\n 1490.492,\n 1528.5521,\n 1563.7872,\n 1597.5044,\n 1632.3364,\n 1672.0419,\n 1706.272,\n 1743.2205\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 57.4064,\n 58.312,\n 0.0,\n 60.344,\n 0.0,\n 62.5312,\n 0.0,\n 64.4368,\n 0.0,\n 66.2192,\n 0.0,\n 68.4688,\n 0.0,\n 70.2496,\n 0.0,\n 72.0944\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1475.4817,\n 1492.3992,\n 1530.7393,\n 1565.9744,\n 1599.9108,\n 1634.8676,\n 1674.6675,\n 1709.3344,\n 1746.3757\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.0375,\n 1.0613,\n 1.0843,\n 1.108,\n 1.135,\n 1.1585,\n 1.1836\n ],\n \"array_model\": [\n 1475.4817,\n 1492.3992,\n 1530.7393,\n 1565.9744,\n 1599.9108,\n 1634.8676,\n 1674.6675,\n 1709.3344,\n 1746.3757\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 59.312,\n 60.2192,\n 0.0,\n 62.5312,\n 0.0,\n 64.7184,\n 0.0,\n 66.8432,\n 0.0,\n 68.7504,\n 0.0,\n 71.0944,\n 0.0,\n 73.312,\n 0.0,\n 75.2496\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1477.3889,\n 1494.3992,\n 1533.0209,\n 1568.1312,\n 1602.3492,\n 1637.8676,\n 1677.3539,\n 1712.0544,\n 1749.3133\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.0377,\n 1.0614,\n 1.0846,\n 1.1086,\n 1.1354,\n 1.1588,\n 1.1841\n ],\n \"array_model\": [\n 1477.3889,\n 1494.3992,\n 1533.0209,\n 1568.1312,\n 1602.3492,\n 1637.8676,\n 1677.3539,\n 1712.0544,\n 1749.3133\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 61.2192,\n 62.2192,\n 0.0,\n 64.8128,\n 0.0,\n 66.8752,\n 0.0,\n 69.2816,\n 0.0,\n 71.7504,\n 0.0,\n 73.7808,\n 0.0,\n 76.032,\n 0.0,\n 78.1872\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1454.3889,\n 1470.6792,\n 1507.0513,\n 1540.6624,\n 1573.0356,\n 1606.6484,\n 1644.6051,\n 1677.7104,\n 1713.1885\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0112,\n 1.0362,\n 1.0593,\n 1.0816,\n 1.1047,\n 1.1308,\n 1.1536,\n 1.1779\n ],\n \"array_model\": [\n 1454.3889,\n 1470.6792,\n 1507.0513,\n 1540.6624,\n 1573.0356,\n 1606.6484,\n 1644.6051,\n 1677.7104,\n 1713.1885\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 38.2192,\n 38.4992,\n 0.0,\n 38.8432,\n 0.0,\n 39.4064,\n 0.0,\n 39.968,\n 0.0,\n 40.5312,\n 0.0,\n 41.032,\n 0.0,\n 41.688,\n 0.0,\n 42.0624\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1456.2321,\n 1472.6488,\n 1509.3953,\n 1543.0992,\n 1575.5364,\n 1609.2116,\n 1647.3235,\n 1680.4288,\n 1716.1261\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0113,\n 1.0365,\n 1.0597,\n 1.0819,\n 1.1051,\n 1.1312,\n 1.154,\n 1.1785\n ],\n \"array_model\": [\n 1456.2321,\n 1472.6488,\n 1509.3953,\n 1543.0992,\n 1575.5364,\n 1609.2116,\n 1647.3235,\n 1680.4288,\n 1716.1261\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 40.0624,\n 40.4688,\n 0.0,\n 41.1872,\n 0.0,\n 41.8432,\n 0.0,\n 42.4688,\n 0.0,\n 43.0944,\n 0.0,\n 43.7504,\n 0.0,\n 44.4064,\n 0.0,\n 45.0\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1458.2321,\n 1474.5544,\n 1511.4273,\n 1545.3184,\n 1577.9732,\n 1611.8356,\n 1649.9795,\n 1683.3344,\n 1719.0941\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0112,\n 1.0365,\n 1.0597,\n 1.0821,\n 1.1053,\n 1.1315,\n 1.1544,\n 1.1789\n ],\n \"array_model\": [\n 1458.2321,\n 1474.5544,\n 1511.4273,\n 1545.3184,\n 1577.9732,\n 1611.8356,\n 1649.9795,\n 1683.3344,\n 1719.0941\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 42.0624,\n 42.3744,\n 0.0,\n 43.2192,\n 0.0,\n 44.0624,\n 0.0,\n 44.9056,\n 0.0,\n 45.7184,\n 0.0,\n 46.4064,\n 0.0,\n 47.312,\n 0.0,\n 47.968\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1460.1697,\n 1476.524,\n 1513.5825,\n 1547.568,\n 1580.5044,\n 1614.4916,\n 1652.6675,\n 1686.0848,\n 1722.2509\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0112,\n 1.0366,\n 1.0599,\n 1.0824,\n 1.1057,\n 1.1318,\n 1.1547,\n 1.1795\n ],\n \"array_model\": [\n 1460.1697,\n 1476.524,\n 1513.5825,\n 1547.568,\n 1580.5044,\n 1614.4916,\n 1652.6675,\n 1686.0848,\n 1722.2509\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 44.0,\n 44.344,\n 0.0,\n 45.3744,\n 0.0,\n 46.312,\n 0.0,\n 47.4368,\n 0.0,\n 48.3744,\n 0.0,\n 49.0944,\n 0.0,\n 50.0624,\n 0.0,\n 51.1248\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1462.2017,\n 1478.7736,\n 1515.5825,\n 1549.8192,\n 1582.7556,\n 1616.898,\n 1655.4483,\n 1689.2096,\n 1725.1261\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0113,\n 1.0365,\n 1.0599,\n 1.0824,\n 1.1058,\n 1.1322,\n 1.1553,\n 1.1798\n ],\n \"array_model\": [\n 1462.2017,\n 1478.7736,\n 1515.5825,\n 1549.8192,\n 1582.7556,\n 1616.898,\n 1655.4483,\n 1689.2096,\n 1725.1261\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 46.032,\n 46.5936,\n 0.0,\n 47.3744,\n 0.0,\n 48.5632,\n 0.0,\n 49.688,\n 0.0,\n 50.7808,\n 0.0,\n 51.8752,\n 0.0,\n 53.1872,\n 0.0,\n 54.0\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1463.8577,\n 1480.524,\n 1517.7393,\n 1552.1312,\n 1585.3172,\n 1619.554,\n 1658.1987,\n 1691.8352,\n 1728.3133\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0114,\n 1.0368,\n 1.0603,\n 1.083,\n 1.1064,\n 1.1328,\n 1.1557,\n 1.1807\n ],\n \"array_model\": [\n 1463.8577,\n 1480.524,\n 1517.7393,\n 1552.1312,\n 1585.3172,\n 1619.554,\n 1658.1987,\n 1691.8352,\n 1728.3133\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 47.688,\n 48.344,\n 0.0,\n 49.5312,\n 0.0,\n 50.8752,\n 0.0,\n 52.2496,\n 0.0,\n 53.4368,\n 0.0,\n 54.6256,\n 0.0,\n 55.8128,\n 0.0,\n 57.1872\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1465.7329,\n 1482.5544,\n 1520.0833,\n 1554.3808,\n 1587.5988,\n 1622.0852,\n 1660.8547,\n 1694.8976,\n 1731.1885\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.0371,\n 1.0605,\n 1.0831,\n 1.1067,\n 1.1331,\n 1.1563,\n 1.1811\n ],\n \"array_model\": [\n 1465.7329,\n 1482.5544,\n 1520.0833,\n 1554.3808,\n 1587.5988,\n 1622.0852,\n 1660.8547,\n 1694.8976,\n 1731.1885\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 49.5632,\n 50.3744,\n 0.0,\n 51.8752,\n 0.0,\n 53.1248,\n 0.0,\n 54.5312,\n 0.0,\n 55.968,\n 0.0,\n 57.2816,\n 0.0,\n 58.8752,\n 0.0,\n 60.0624\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1467.7329,\n 1484.5544,\n 1522.1457,\n 1556.8192,\n 1589.9108,\n 1624.8676,\n 1663.6979,\n 1697.7104,\n 1734.4077\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 1.0371,\n 1.0607,\n 1.0832,\n 1.1071,\n 1.1335,\n 1.1567,\n 1.1817\n ],\n \"array_model\": [\n 1467.7329,\n 1484.5544,\n 1522.1457,\n 1556.8192,\n 1589.9108,\n 1624.8676,\n 1663.6979,\n 1697.7104,\n 1734.4077\n ],\n \"array_query\": [\n 1416.1697,\n 1432.18,\n 1468.2081,\n 1501.256,\n 1533.0676,\n 1566.1172,\n 1603.5731,\n 1636.0224,\n 1671.1261\n ],\n \"array_cache\": [\n 51.5632,\n 52.3744,\n 0.0,\n 53.9376,\n 0.0,\n 55.5632,\n 0.0,\n 56.8432,\n 0.0,\n 58.7504,\n 0.0,\n 60.1248,\n 0.0,\n 61.688,\n 0.0,\n 63.2816\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.2383\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.2383\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.2793\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.3125\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.3125\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.3535\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.9492\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.9492\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.9902\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.0274\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 101.0274\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 2.0684\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.0977\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 101.0977\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 2.1387\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.168\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 101.168\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 2.209\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.2363\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 101.2363\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 2.2773\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.377\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.377\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.418\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.4531\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.4531\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.4941\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.5254\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.5254\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.5664\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.5977\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.5977\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.6387\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.666\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.666\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.707\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.7344\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.7344\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.7754\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.8106\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.8106\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.8516\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.8867\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 100.8867\n ],\n \"array_query\": [\n 98.959\n ],\n \"array_cache\": [\n 1.9277\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_1.json": "{\n \"mean\": 1416.1697,\n \"array\": [\n 1419.688,\n 1398.688,\n 1398.7184,\n 1413.7184,\n 1427.7184,\n 1405.7808,\n 1418.7808,\n 1437.9376,\n 1404.9376,\n 1419.9376,\n 1402.9376,\n 1422.0,\n 1410.0,\n 1402.968,\n 1423.968,\n 1424.312,\n 1421.312,\n 1431.4368,\n 1403.4368,\n 1433.4368,\n 1420.4368,\n 1430.3744,\n 1410.3744,\n 1403.4688,\n 1428.4688,\n 1421.4688,\n 1422.5936,\n 1417.5936,\n 1399.688,\n 1396.688,\n 1410.7808,\n 1430.7808,\n 1420.688,\n 1435.688,\n 1400.7184,\n 1417.7184,\n 1427.7184,\n 1396.7808,\n 1413.7808,\n 1402.9376,\n 1436.9376,\n 1421.9376,\n 1398.9376,\n 1407.0,\n 1422.0,\n 1429.968,\n 1396.968,\n 1418.312,\n 1430.312,\n 1403.4368,\n 1408.4368,\n 1432.4368,\n 1425.4368,\n 1404.3744,\n 1435.3744,\n 1424.4688,\n 1411.4688,\n 1398.4688,\n 1402.5936,\n 1412.5936,\n 1428.688,\n 1434.688,\n 1417.7808,\n 1401.7808\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_10.json": "{\n \"mean\": 1566.1172,\n \"array\": [\n 1550.5936,\n 1574.5936,\n 1562.0624,\n 1551.0624,\n 1560.0624,\n 1547.4688,\n 1548.4688,\n 1585.9056,\n 1562.9056,\n 1587.2816,\n 1590.2816,\n 1555.6256,\n 1576.6256,\n 1576.2192,\n 1556.2192,\n 1549.5632,\n 1558.5632,\n 1545.032,\n 1560.032,\n 1572.2496,\n 1580.2496,\n 1587.9376,\n 1569.9376,\n 1564.2496,\n 1549.2496,\n 1563.2496,\n 1554.7808,\n 1549.7808,\n 1547.2496,\n 1569.2496,\n 1564.2496,\n 1584.2496,\n 1567.5936,\n 1568.5936,\n 1579.0624,\n 1580.0624,\n 1547.0624,\n 1585.4688,\n 1548.4688,\n 1554.9056,\n 1567.9056,\n 1563.2816,\n 1554.2816,\n 1570.6256,\n 1553.6256,\n 1583.2192,\n 1583.2192,\n 1584.5632,\n 1549.5632,\n 1590.032,\n 1548.032,\n 1582.2496,\n 1558.2496,\n 1585.9376,\n 1559.9376,\n 1570.2496,\n 1580.2496,\n 1560.2496,\n 1557.7808,\n 1565.7808,\n 1578.2496,\n 1569.2496,\n 1578.2496,\n 1550.2496\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_12.json": "{\n \"mean\": 1603.5731,\n \"array\": [\n 1589.4992,\n 1599.4992,\n 1607.5632,\n 1604.5632,\n 1599.5632,\n 1599.968,\n 1622.968,\n 1600.2496,\n 1590.2496,\n 1587.5936,\n 1614.5936,\n 1597.9056,\n 1582.9056,\n 1602.1248,\n 1609.1248,\n 1607.3744,\n 1600.3744,\n 1582.7184,\n 1597.7184,\n 1621.8752,\n 1608.8752,\n 1602.0944,\n 1614.0944,\n 1591.344,\n 1622.344,\n 1625.344,\n 1625.5312,\n 1579.5312,\n 1588.9056,\n 1586.9056,\n 1612.2192,\n 1605.2192,\n 1596.4992,\n 1605.4992,\n 1605.5632,\n 1601.5632,\n 1601.5632,\n 1613.968,\n 1601.968,\n 1599.2496,\n 1619.2496,\n 1596.5936,\n 1620.5936,\n 1615.9056,\n 1620.9056,\n 1621.1248,\n 1612.1248,\n 1624.3744,\n 1582.3744,\n 1588.7184,\n 1602.7184,\n 1607.8752,\n 1607.8752,\n 1605.0944,\n 1581.0944,\n 1581.344,\n 1578.344,\n 1607.344,\n 1603.5312,\n 1611.5312,\n 1578.9056,\n 1626.9056,\n 1608.2192,\n 1619.2192\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_14.json": "{\n \"mean\": 1636.0224,\n \"array\": [\n 1636.2496,\n 1615.2496,\n 1651.4064,\n 1653.4064,\n 1644.4064,\n 1640.312,\n 1655.312,\n 1643.5936,\n 1630.5936,\n 1641.688,\n 1648.688,\n 1627.9376,\n 1629.9376,\n 1614.8128,\n 1617.8128,\n 1646.1872,\n 1635.1872,\n 1636.1248,\n 1655.1248,\n 1646.312,\n 1651.312,\n 1652.4368,\n 1635.4368,\n 1643.6256,\n 1625.6256,\n 1634.6256,\n 1649.7504,\n 1615.7504,\n 1620.688,\n 1653.688,\n 1614.968,\n 1624.968,\n 1631.2496,\n 1658.2496,\n 1628.4064,\n 1625.4064,\n 1643.4064,\n 1624.312,\n 1624.312,\n 1642.5936,\n 1622.5936,\n 1629.688,\n 1643.688,\n 1655.9376,\n 1653.9376,\n 1633.8128,\n 1612.8128,\n 1620.1872,\n 1631.1872,\n 1612.1248,\n 1622.1248,\n 1631.312,\n 1644.312,\n 1645.4368,\n 1612.4368,\n 1644.6256,\n 1626.6256,\n 1645.6256,\n 1646.7504,\n 1627.7504,\n 1653.688,\n 1629.688,\n 1628.968,\n 1658.968\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_16.json": "{\n \"mean\": 1671.1261,\n \"array\": [\n 1653.9056,\n 1667.9056,\n 1691.1568,\n 1645.1568,\n 1686.1568,\n 1644.9376,\n 1671.9376,\n 1682.0,\n 1682.0,\n 1687.032,\n 1662.032,\n 1675.8752,\n 1682.8752,\n 1675.0,\n 1692.0,\n 1655.8128,\n 1688.8128,\n 1648.9376,\n 1689.9376,\n 1669.7184,\n 1692.7184,\n 1689.5312,\n 1687.5312,\n 1653.8752,\n 1667.8752,\n 1662.8752,\n 1666.9056,\n 1675.9056,\n 1678.7504,\n 1678.7504,\n 1657.8128,\n 1654.8128,\n 1648.9056,\n 1657.9056,\n 1688.1568,\n 1668.1568,\n 1692.1568,\n 1681.9376,\n 1664.9376,\n 1675.0,\n 1693.0,\n 1691.032,\n 1679.032,\n 1688.8752,\n 1657.8752,\n 1644.0,\n 1660.0,\n 1679.8128,\n 1653.8128,\n 1690.9376,\n 1650.9376,\n 1659.7184,\n 1671.7184,\n 1683.5312,\n 1670.5312,\n 1672.8752,\n 1668.8752,\n 1658.8752,\n 1653.9056,\n 1655.9056,\n 1655.7504,\n 1653.7504,\n 1679.8128,\n 1679.8128\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_2.json": "{\n \"mean\": 1432.18,\n \"array\": [\n 1413.6256,\n 1415.6256,\n 1424.6256,\n 1419.6256,\n 1447.6256,\n 1448.5008,\n 1417.5008,\n 1436.5312,\n 1449.5312,\n 1427.6256,\n 1441.6256,\n 1435.656,\n 1444.656,\n 1426.4064,\n 1438.4064,\n 1450.656,\n 1417.656,\n 1418.6256,\n 1413.6256,\n 1417.6256,\n 1443.6256,\n 1454.5008,\n 1439.5008,\n 1429.6256,\n 1440.6256,\n 1450.6256,\n 1438.688,\n 1432.688,\n 1425.7808,\n 1445.7808,\n 1429.7808,\n 1430.7808,\n 1444.6256,\n 1441.6256,\n 1431.6256,\n 1416.6256,\n 1449.6256,\n 1415.5008,\n 1439.5008,\n 1420.5312,\n 1413.5312,\n 1418.6256,\n 1413.6256,\n 1447.656,\n 1449.656,\n 1446.4064,\n 1430.4064,\n 1443.656,\n 1425.656,\n 1412.6256,\n 1436.6256,\n 1415.6256,\n 1427.6256,\n 1413.5008,\n 1440.5008,\n 1426.6256,\n 1447.6256,\n 1444.6256,\n 1421.688,\n 1451.688,\n 1414.7808,\n 1452.7808,\n 1412.7808,\n 1423.7808\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_4.json": "{\n \"mean\": 1468.2081,\n \"array\": [\n 1468.2192,\n 1479.2192,\n 1477.1248,\n 1454.1248,\n 1451.1248,\n 1486.1568,\n 1461.1568,\n 1447.8128,\n 1464.8128,\n 1475.7808,\n 1454.7808,\n 1466.6256,\n 1463.6256,\n 1457.6256,\n 1454.6256,\n 1487.4688,\n 1462.4688,\n 1473.1248,\n 1461.1248,\n 1449.0624,\n 1484.0624,\n 1484.032,\n 1488.032,\n 1443.7808,\n 1454.7808,\n 1454.7808,\n 1457.656,\n 1490.656,\n 1489.4688,\n 1465.4688,\n 1478.1872,\n 1482.1872,\n 1483.2192,\n 1455.2192,\n 1451.1248,\n 1452.1248,\n 1464.1248,\n 1489.1568,\n 1470.1568,\n 1482.8128,\n 1489.8128,\n 1457.7808,\n 1457.7808,\n 1466.6256,\n 1462.6256,\n 1465.6256,\n 1465.6256,\n 1467.4688,\n 1461.4688,\n 1444.1248,\n 1457.1248,\n 1482.0624,\n 1480.0624,\n 1456.032,\n 1452.032,\n 1477.7808,\n 1475.7808,\n 1460.7808,\n 1487.656,\n 1485.656,\n 1476.4688,\n 1469.4688,\n 1458.1872,\n 1490.1872\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_6.json": "{\n \"mean\": 1501.256,\n \"array\": [\n 1478.1568,\n 1508.1568,\n 1503.688,\n 1498.688,\n 1518.688,\n 1498.5936,\n 1490.5936,\n 1487.1568,\n 1491.1568,\n 1515.9376,\n 1519.9376,\n 1489.688,\n 1495.688,\n 1499.4368,\n 1520.4368,\n 1508.1248,\n 1489.1248,\n 1498.8752,\n 1506.8752,\n 1492.4368,\n 1512.4368,\n 1499.2816,\n 1500.2816,\n 1502.0,\n 1482.0,\n 1508.0,\n 1520.4688,\n 1478.4688,\n 1493.2816,\n 1487.2816,\n 1501.1248,\n 1520.1248,\n 1478.1568,\n 1496.1568,\n 1481.688,\n 1514.688,\n 1510.688,\n 1511.5936,\n 1487.5936,\n 1501.1568,\n 1522.1568,\n 1521.9376,\n 1483.9376,\n 1492.688,\n 1515.688,\n 1517.4368,\n 1485.4368,\n 1491.1248,\n 1515.1248,\n 1496.8752,\n 1488.8752,\n 1490.4368,\n 1517.4368,\n 1512.2816,\n 1485.2816,\n 1514.0,\n 1509.0,\n 1487.0,\n 1509.4688,\n 1482.4688,\n 1516.2816,\n 1514.2816,\n 1495.1248,\n 1518.1248\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_8.json": "{\n \"mean\": 1533.0676,\n \"array\": [\n 1529.9376,\n 1528.9376,\n 1512.4064,\n 1546.4064,\n 1530.4064,\n 1541.032,\n 1540.032,\n 1521.5312,\n 1542.5312,\n 1530.0944,\n 1549.0944,\n 1537.5632,\n 1554.5632,\n 1525.312,\n 1558.312,\n 1534.7504,\n 1538.7504,\n 1517.4688,\n 1558.4688,\n 1511.1568,\n 1513.1568,\n 1510.5936,\n 1516.5936,\n 1532.0624,\n 1519.0624,\n 1551.0624,\n 1519.5632,\n 1524.5632,\n 1552.1568,\n 1533.1568,\n 1511.7184,\n 1525.7184,\n 1513.9376,\n 1527.9376,\n 1515.4064,\n 1538.4064,\n 1520.4064,\n 1554.032,\n 1533.032,\n 1531.5312,\n 1536.5312,\n 1531.0944,\n 1540.0944,\n 1531.5632,\n 1552.5632,\n 1531.312,\n 1526.312,\n 1524.7504,\n 1526.7504,\n 1531.4688,\n 1539.4688,\n 1512.1568,\n 1551.1568,\n 1536.5936,\n 1529.5936,\n 1543.0624,\n 1536.0624,\n 1548.0624,\n 1556.5632,\n 1552.5632,\n 1523.1568,\n 1557.1568,\n 1531.7184,\n 1513.7184\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_slm/query_1.json": "{\n \"mean\": 98.959,\n \"array\": [\n 97.7207,\n 97.5957,\n 99.8965,\n 98.1465,\n 99.8965,\n 98.582,\n 98.957,\n 99.8809,\n 100.3809,\n 99.5586,\n 98.8086,\n 97.7363,\n 97.8613,\n 100.043,\n 100.418,\n 98.9746,\n 98.5996,\n 98.7734,\n 99.3984,\n 99.0723,\n 97.4473,\n 98.2598,\n 98.2598,\n 98.4316,\n 99.3066,\n 100.4316,\n 97.4863,\n 97.7363,\n 97.791,\n 97.666,\n 99.5977,\n 100.4727,\n 99.8457,\n 97.8457,\n 99.2715,\n 99.1465,\n 100.0215,\n 99.082,\n 98.207,\n 98.8809,\n 99.6309,\n 99.8086,\n 99.1836,\n 99.6113,\n 100.2363,\n 99.418,\n 100.418,\n 100.3496,\n 97.5996,\n 97.7734,\n 98.0234,\n 98.6973,\n 97.8223,\n 97.6348,\n 98.2598,\n 99.8066,\n 98.9316,\n 98.5566,\n 99.2363,\n 100.1113,\n 99.666,\n 98.791,\n 97.8477,\n 100.4727\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 4.8326,\n 4.8995,\n 0.0,\n 5.1458,\n 0.0,\n 5.3464,\n 0.0,\n 5.6589,\n 0.0,\n 5.755,\n 0.0,\n 5.9347,\n 0.0,\n 6.1658,\n 0.0,\n 6.3438\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0138,\n 0.0,\n 1.0648,\n 0.0,\n 1.1063,\n 0.0,\n 1.171,\n 0.0,\n 1.1909,\n 0.0,\n 1.228,\n 0.0,\n 1.2759,\n 0.0,\n 1.3127\n ],\n \"array\": [\n 4.8326,\n 4.8995,\n 0.0,\n 5.1458,\n 0.0,\n 5.3464,\n 0.0,\n 5.6589,\n 0.0,\n 5.755,\n 0.0,\n 5.9347,\n 0.0,\n 6.1658,\n 0.0,\n 6.3438\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 6.7402,\n 6.9141,\n 0.0,\n 7.2891,\n 0.0,\n 7.6426,\n 0.0,\n 8.0078,\n 0.0,\n 8.3867,\n 0.0,\n 8.7363,\n 0.0,\n 9.123,\n 0.0,\n 9.4727\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0258,\n 0.0,\n 1.0814,\n 0.0,\n 1.1339,\n 0.0,\n 1.1881,\n 0.0,\n 1.2443,\n 0.0,\n 1.2961,\n 0.0,\n 1.3535,\n 0.0,\n 1.4054\n ],\n \"array\": [\n 6.7402,\n 6.9141,\n 0.0,\n 7.2891,\n 0.0,\n 7.6426,\n 0.0,\n 8.0078,\n 0.0,\n 8.3867,\n 0.0,\n 8.7363,\n 0.0,\n 9.123,\n 0.0,\n 9.4727\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 23.9746,\n 24.7715,\n 0.0,\n 26.4961,\n 0.0,\n 28.2051,\n 0.0,\n 29.9121,\n 0.0,\n 31.5996,\n 0.0,\n 33.3379,\n 0.0,\n 35.0254,\n 0.0,\n 36.6836\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0332,\n 0.0,\n 1.1052,\n 0.0,\n 1.1765,\n 0.0,\n 1.2477,\n 0.0,\n 1.318,\n 0.0,\n 1.3905,\n 0.0,\n 1.4609,\n 0.0,\n 1.5301\n ],\n \"array\": [\n 23.9746,\n 24.7715,\n 0.0,\n 26.4961,\n 0.0,\n 28.2051,\n 0.0,\n 29.9121,\n 0.0,\n 31.5996,\n 0.0,\n 33.3379,\n 0.0,\n 35.0254,\n 0.0,\n 36.6836\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 25.8496,\n 26.75,\n 0.0,\n 28.6387,\n 0.0,\n 30.5273,\n 0.0,\n 32.3555,\n 0.0,\n 34.1816,\n 0.0,\n 35.9824,\n 0.0,\n 37.832,\n 0.0,\n 39.6797\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0348,\n 0.0,\n 1.1079,\n 0.0,\n 1.181,\n 0.0,\n 1.2517,\n 0.0,\n 1.3223,\n 0.0,\n 1.392,\n 0.0,\n 1.4635,\n 0.0,\n 1.535\n ],\n \"array\": [\n 25.8496,\n 26.75,\n 0.0,\n 28.6387,\n 0.0,\n 30.5273,\n 0.0,\n 32.3555,\n 0.0,\n 34.1816,\n 0.0,\n 35.9824,\n 0.0,\n 37.832,\n 0.0,\n 39.6797\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 27.7949,\n 28.7812,\n 0.0,\n 30.7812,\n 0.0,\n 32.8223,\n 0.0,\n 34.75,\n 0.0,\n 36.793,\n 0.0,\n 38.8691,\n 0.0,\n 40.7188,\n 0.0,\n 42.8184\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0355,\n 0.0,\n 1.1074,\n 0.0,\n 1.1809,\n 0.0,\n 1.2502,\n 0.0,\n 1.3237,\n 0.0,\n 1.3984,\n 0.0,\n 1.465,\n 0.0,\n 1.5405\n ],\n \"array\": [\n 27.7949,\n 28.7812,\n 0.0,\n 30.7812,\n 0.0,\n 32.8223,\n 0.0,\n 34.75,\n 0.0,\n 36.793,\n 0.0,\n 38.8691,\n 0.0,\n 40.7188,\n 0.0,\n 42.8184\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 29.7461,\n 30.7949,\n 0.0,\n 32.959,\n 0.0,\n 35.1582,\n 0.0,\n 37.2227,\n 0.0,\n 39.2812,\n 0.0,\n 41.5508,\n 0.0,\n 43.7969,\n 0.0,\n 45.8535\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0353,\n 0.0,\n 1.108,\n 0.0,\n 1.1819,\n 0.0,\n 1.2513,\n 0.0,\n 1.3206,\n 0.0,\n 1.3968,\n 0.0,\n 1.4724,\n 0.0,\n 1.5415\n ],\n \"array\": [\n 29.7461,\n 30.7949,\n 0.0,\n 32.959,\n 0.0,\n 35.1582,\n 0.0,\n 37.2227,\n 0.0,\n 39.2812,\n 0.0,\n 41.5508,\n 0.0,\n 43.7969,\n 0.0,\n 45.8535\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 31.6055,\n 32.6426,\n 0.0,\n 35.1172,\n 0.0,\n 37.3262,\n 0.0,\n 39.6289,\n 0.0,\n 41.8262,\n 0.0,\n 44.1992,\n 0.0,\n 46.3535,\n 0.0,\n 48.8008\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0328,\n 0.0,\n 1.1111,\n 0.0,\n 1.181,\n 0.0,\n 1.2539,\n 0.0,\n 1.3234,\n 0.0,\n 1.3985,\n 0.0,\n 1.4666,\n 0.0,\n 1.5441\n ],\n \"array\": [\n 31.6055,\n 32.6426,\n 0.0,\n 35.1172,\n 0.0,\n 37.3262,\n 0.0,\n 39.6289,\n 0.0,\n 41.8262,\n 0.0,\n 44.1992,\n 0.0,\n 46.3535,\n 0.0,\n 48.8008\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 8.6328,\n 8.8984,\n 0.0,\n 9.4141,\n 0.0,\n 9.9082,\n 0.0,\n 10.4238,\n 0.0,\n 10.9551,\n 0.0,\n 11.4434,\n 0.0,\n 11.9824,\n 0.0,\n 12.541\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0308,\n 0.0,\n 1.0905,\n 0.0,\n 1.1477,\n 0.0,\n 1.2075,\n 0.0,\n 1.269,\n 0.0,\n 1.3256,\n 0.0,\n 1.388,\n 0.0,\n 1.4527\n ],\n \"array\": [\n 8.6328,\n 8.8984,\n 0.0,\n 9.4141,\n 0.0,\n 9.9082,\n 0.0,\n 10.4238,\n 0.0,\n 10.9551,\n 0.0,\n 11.4434,\n 0.0,\n 11.9824,\n 0.0,\n 12.541\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 10.5938,\n 10.8945,\n 0.0,\n 11.5527,\n 0.0,\n 12.2051,\n 0.0,\n 12.8984,\n 0.0,\n 13.5234,\n 0.0,\n 14.1738,\n 0.0,\n 14.8418,\n 0.0,\n 15.5371\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0284,\n 0.0,\n 1.0905,\n 0.0,\n 1.1521,\n 0.0,\n 1.2176,\n 0.0,\n 1.2765,\n 0.0,\n 1.3379,\n 0.0,\n 1.401,\n 0.0,\n 1.4666\n ],\n \"array\": [\n 10.5938,\n 10.8945,\n 0.0,\n 11.5527,\n 0.0,\n 12.2051,\n 0.0,\n 12.8984,\n 0.0,\n 13.5234,\n 0.0,\n 14.1738,\n 0.0,\n 14.8418,\n 0.0,\n 15.5371\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 12.4863,\n 12.9082,\n 0.0,\n 13.7188,\n 0.0,\n 14.4746,\n 0.0,\n 15.2793,\n 0.0,\n 16.1094,\n 0.0,\n 16.9648,\n 0.0,\n 17.7578,\n 0.0,\n 18.5176\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0338,\n 0.0,\n 1.0987,\n 0.0,\n 1.1592,\n 0.0,\n 1.2237,\n 0.0,\n 1.2902,\n 0.0,\n 1.3587,\n 0.0,\n 1.4222,\n 0.0,\n 1.483\n ],\n \"array\": [\n 12.4863,\n 12.9082,\n 0.0,\n 13.7188,\n 0.0,\n 14.4746,\n 0.0,\n 15.2793,\n 0.0,\n 16.1094,\n 0.0,\n 16.9648,\n 0.0,\n 17.7578,\n 0.0,\n 18.5176\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 14.4141,\n 14.8926,\n 0.0,\n 15.7832,\n 0.0,\n 16.7773,\n 0.0,\n 17.7383,\n 0.0,\n 18.7441,\n 0.0,\n 19.668,\n 0.0,\n 20.5879,\n 0.0,\n 21.5762\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0332,\n 0.0,\n 1.095,\n 0.0,\n 1.164,\n 0.0,\n 1.2306,\n 0.0,\n 1.3004,\n 0.0,\n 1.3645,\n 0.0,\n 1.4283,\n 0.0,\n 1.4969\n ],\n \"array\": [\n 14.4141,\n 14.8926,\n 0.0,\n 15.7832,\n 0.0,\n 16.7773,\n 0.0,\n 17.7383,\n 0.0,\n 18.7441,\n 0.0,\n 19.668,\n 0.0,\n 20.5879,\n 0.0,\n 21.5762\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 16.3086,\n 16.873,\n 0.0,\n 17.9863,\n 0.0,\n 19.0586,\n 0.0,\n 20.1348,\n 0.0,\n 21.166,\n 0.0,\n 22.3691,\n 0.0,\n 23.4531,\n 0.0,\n 24.5977\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0346,\n 0.0,\n 1.1029,\n 0.0,\n 1.1686,\n 0.0,\n 1.2346,\n 0.0,\n 1.2978,\n 0.0,\n 1.3716,\n 0.0,\n 1.4381,\n 0.0,\n 1.5083\n ],\n \"array\": [\n 16.3086,\n 16.873,\n 0.0,\n 17.9863,\n 0.0,\n 19.0586,\n 0.0,\n 20.1348,\n 0.0,\n 21.166,\n 0.0,\n 22.3691,\n 0.0,\n 23.4531,\n 0.0,\n 24.5977\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 18.2441,\n 18.9102,\n 0.0,\n 20.0742,\n 0.0,\n 21.3262,\n 0.0,\n 22.6602,\n 0.0,\n 23.8984,\n 0.0,\n 25.1445,\n 0.0,\n 26.3145,\n 0.0,\n 27.5449\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0365,\n 0.0,\n 1.1003,\n 0.0,\n 1.1689,\n 0.0,\n 1.2421,\n 0.0,\n 1.3099,\n 0.0,\n 1.3782,\n 0.0,\n 1.4424,\n 0.0,\n 1.5098\n ],\n \"array\": [\n 18.2441,\n 18.9102,\n 0.0,\n 20.0742,\n 0.0,\n 21.3262,\n 0.0,\n 22.6602,\n 0.0,\n 23.8984,\n 0.0,\n 25.1445,\n 0.0,\n 26.3145,\n 0.0,\n 27.5449\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 20.166,\n 20.8086,\n 0.0,\n 22.2578,\n 0.0,\n 23.6211,\n 0.0,\n 25.0176,\n 0.0,\n 26.4238,\n 0.0,\n 27.8184,\n 0.0,\n 29.1836,\n 0.0,\n 30.6973\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0319,\n 0.0,\n 1.1037,\n 0.0,\n 1.1713,\n 0.0,\n 1.2406,\n 0.0,\n 1.3103,\n 0.0,\n 1.3795,\n 0.0,\n 1.4472,\n 0.0,\n 1.5222\n ],\n \"array\": [\n 20.166,\n 20.8086,\n 0.0,\n 22.2578,\n 0.0,\n 23.6211,\n 0.0,\n 25.0176,\n 0.0,\n 26.4238,\n 0.0,\n 27.8184,\n 0.0,\n 29.1836,\n 0.0,\n 30.6973\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 22.041,\n 22.8301,\n 0.0,\n 24.3242,\n 0.0,\n 26.0078,\n 0.0,\n 27.5332,\n 0.0,\n 29.0723,\n 0.0,\n 30.5762,\n 0.0,\n 32.0957,\n 0.0,\n 33.7109\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0358,\n 0.0,\n 1.1036,\n 0.0,\n 1.18,\n 0.0,\n 1.2492,\n 0.0,\n 1.319,\n 0.0,\n 1.3872,\n 0.0,\n 1.4562,\n 0.0,\n 1.5295\n ],\n \"array\": [\n 22.041,\n 22.8301,\n 0.0,\n 24.3242,\n 0.0,\n 26.0078,\n 0.0,\n 27.5332,\n 0.0,\n 29.0723,\n 0.0,\n 30.5762,\n 0.0,\n 32.0957,\n 0.0,\n 33.7109\n ],\n \"batch_size\": 16,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 2.8728\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.8728\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 4.0215\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 4.0215\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 14.3516\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 14.3516\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 15.4941\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 15.4941\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 16.6582\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 16.6582\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 17.8633\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 17.8633\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 18.9824\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 18.9824\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 5.1719\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 5.1719\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 6.3223\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 6.3223\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 7.4766\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 7.4766\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 8.623\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 8.623\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 9.7773\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 9.7773\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 10.9414\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 10.9414\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 12.0859\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 12.0859\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 13.2637\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 13.2637\n ],\n \"batch_size\": 16,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1745.2527,\n 2019.1937,\n 2559.0024,\n 3102.0817,\n 3644.9518,\n 4179.33,\n 4721.921,\n 5265.7556,\n 5799.3306\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.157,\n 1.4663,\n 1.7774,\n 2.0885,\n 2.3947,\n 2.7056,\n 3.0172,\n 3.3229\n ],\n \"array_model\": [\n 1745.2527,\n 2019.1937,\n 2559.0024,\n 3102.0817,\n 3644.9518,\n 4179.33,\n 4721.921,\n 5265.7556,\n 5799.3306\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 77.3216,\n 78.392,\n 0.0,\n 82.3328,\n 0.0,\n 85.5424,\n 0.0,\n 90.5424,\n 0.0,\n 92.08,\n 0.0,\n 94.9552,\n 0.0,\n 98.6528,\n 0.0,\n 101.5008\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1775.7743,\n 2051.4273,\n 2593.2952,\n 3138.8209,\n 3682.5342,\n 4221.4372,\n 4766.7466,\n 5313.0708,\n 5849.393\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1552,\n 1.4604,\n 1.7676,\n 2.0738,\n 2.3772,\n 2.6843,\n 2.992,\n 3.294\n ],\n \"array_model\": [\n 1775.7743,\n 2051.4273,\n 2593.2952,\n 3138.8209,\n 3682.5342,\n 4221.4372,\n 4766.7466,\n 5313.0708,\n 5849.393\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 107.8432,\n 110.6256,\n 0.0,\n 116.6256,\n 0.0,\n 122.2816,\n 0.0,\n 128.1248,\n 0.0,\n 134.1872,\n 0.0,\n 139.7808,\n 0.0,\n 145.968,\n 0.0,\n 151.5632\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2051.5247,\n 2337.1457,\n 2900.6072,\n 3467.8209,\n 4033.003,\n 4592.8436,\n 5160.3722,\n 5727.5092,\n 6284.7674\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1392,\n 1.4139,\n 1.6904,\n 1.9659,\n 2.2387,\n 2.5154,\n 2.7918,\n 3.0635\n ],\n \"array_model\": [\n 2051.5247,\n 2337.1457,\n 2900.6072,\n 3467.8209,\n 4033.003,\n 4592.8436,\n 5160.3722,\n 5727.5092,\n 6284.7674\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 383.5936,\n 396.344,\n 0.0,\n 423.9376,\n 0.0,\n 451.2816,\n 0.0,\n 478.5936,\n 0.0,\n 505.5936,\n 0.0,\n 533.4064,\n 0.0,\n 560.4064,\n 0.0,\n 586.9376\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2081.5247,\n 2368.8017,\n 2934.8888,\n 3504.9761,\n 4072.0974,\n 4634.1556,\n 5202.6842,\n 5772.4148,\n 6332.705\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.138,\n 1.41,\n 1.6839,\n 1.9563,\n 2.2263,\n 2.4995,\n 2.7732,\n 3.0423\n ],\n \"array_model\": [\n 2081.5247,\n 2368.8017,\n 2934.8888,\n 3504.9761,\n 4072.0974,\n 4634.1556,\n 5202.6842,\n 5772.4148,\n 6332.705\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 413.5936,\n 428.0,\n 0.0,\n 458.2192,\n 0.0,\n 488.4368,\n 0.0,\n 517.688,\n 0.0,\n 546.9056,\n 0.0,\n 575.7184,\n 0.0,\n 605.312,\n 0.0,\n 634.8752\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2112.6495,\n 2401.3009,\n 2969.1688,\n 3541.6961,\n 4110.4094,\n 4675.938,\n 5248.8714,\n 5818.6036,\n 6382.9242\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1366,\n 1.4054,\n 1.6764,\n 1.9456,\n 2.2133,\n 2.4845,\n 2.7542,\n 3.0213\n ],\n \"array_model\": [\n 2112.6495,\n 2401.3009,\n 2969.1688,\n 3541.6961,\n 4110.4094,\n 4675.938,\n 5248.8714,\n 5818.6036,\n 6382.9242\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 444.7184,\n 460.4992,\n 0.0,\n 492.4992,\n 0.0,\n 525.1568,\n 0.0,\n 556.0,\n 0.0,\n 588.688,\n 0.0,\n 621.9056,\n 0.0,\n 651.5008,\n 0.0,\n 685.0944\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2143.8687,\n 2433.5201,\n 3004.0136,\n 3579.0705,\n 4149.9726,\n 4715.7492,\n 5291.7786,\n 5867.8532,\n 6431.4858\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1351,\n 1.4012,\n 1.6694,\n 1.9357,\n 2.1996,\n 2.4683,\n 2.737,\n 2.9999\n ],\n \"array_model\": [\n 2143.8687,\n 2433.5201,\n 3004.0136,\n 3579.0705,\n 4149.9726,\n 4715.7492,\n 5291.7786,\n 5867.8532,\n 6431.4858\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 475.9376,\n 492.7184,\n 0.0,\n 527.344,\n 0.0,\n 562.5312,\n 0.0,\n 595.5632,\n 0.0,\n 628.4992,\n 0.0,\n 664.8128,\n 0.0,\n 700.7504,\n 0.0,\n 733.656\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2173.6191,\n 2463.0833,\n 3038.5448,\n 3613.7585,\n 4188.4718,\n 4756.4692,\n 5334.153,\n 5908.7588,\n 6478.6426\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1332,\n 1.3979,\n 1.6626,\n 1.927,\n 2.1883,\n 2.454,\n 2.7184,\n 2.9806\n ],\n \"array_model\": [\n 2173.6191,\n 2463.0833,\n 3038.5448,\n 3613.7585,\n 4188.4718,\n 4756.4692,\n 5334.153,\n 5908.7588,\n 6478.6426\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 505.688,\n 522.2816,\n 0.0,\n 561.8752,\n 0.0,\n 597.2192,\n 0.0,\n 634.0624,\n 0.0,\n 669.2192,\n 0.0,\n 707.1872,\n 0.0,\n 741.656,\n 0.0,\n 780.8128\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1806.0559,\n 2083.1761,\n 2627.2952,\n 3175.0705,\n 3721.1902,\n 4262.5316,\n 4810.0602,\n 5358.8212,\n 5898.4858\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1534,\n 1.4547,\n 1.758,\n 2.0604,\n 2.3601,\n 2.6633,\n 2.9671,\n 3.2659\n ],\n \"array_model\": [\n 1806.0559,\n 2083.1761,\n 2627.2952,\n 3175.0705,\n 3721.1902,\n 4262.5316,\n 4810.0602,\n 5358.8212,\n 5898.4858\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 138.1248,\n 142.3744,\n 0.0,\n 150.6256,\n 0.0,\n 158.5312,\n 0.0,\n 166.7808,\n 0.0,\n 175.2816,\n 0.0,\n 183.0944,\n 0.0,\n 191.7184,\n 0.0,\n 200.656\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1837.4319,\n 2115.1137,\n 2661.5128,\n 3211.8209,\n 3760.7838,\n 4303.6244,\n 4853.7466,\n 5404.5716,\n 5946.4234\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1511,\n 1.4485,\n 1.748,\n 2.0468,\n 2.3422,\n 2.6416,\n 2.9414,\n 3.2363\n ],\n \"array_model\": [\n 1837.4319,\n 2115.1137,\n 2661.5128,\n 3211.8209,\n 3760.7838,\n 4303.6244,\n 4853.7466,\n 5404.5716,\n 5946.4234\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 169.5008,\n 174.312,\n 0.0,\n 184.8432,\n 0.0,\n 195.2816,\n 0.0,\n 206.3744,\n 0.0,\n 216.3744,\n 0.0,\n 226.7808,\n 0.0,\n 237.4688,\n 0.0,\n 248.5936\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1867.7119,\n 2147.3329,\n 2696.1704,\n 3248.1329,\n 3798.8782,\n 4345.0004,\n 4898.4026,\n 5451.2276,\n 5994.1114\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1497,\n 1.4436,\n 1.7391,\n 2.034,\n 2.3264,\n 2.6227,\n 2.9187,\n 3.2093\n ],\n \"array_model\": [\n 1867.7119,\n 2147.3329,\n 2696.1704,\n 3248.1329,\n 3798.8782,\n 4345.0004,\n 4898.4026,\n 5451.2276,\n 5994.1114\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 199.7808,\n 206.5312,\n 0.0,\n 219.5008,\n 0.0,\n 231.5936,\n 0.0,\n 244.4688,\n 0.0,\n 257.7504,\n 0.0,\n 271.4368,\n 0.0,\n 284.1248,\n 0.0,\n 296.2816\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1898.5567,\n 2179.0833,\n 2729.2008,\n 3284.9761,\n 3838.2222,\n 4387.1556,\n 4941.6538,\n 5496.5092,\n 6043.049\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1478,\n 1.4375,\n 1.7302,\n 2.0217,\n 2.3108,\n 2.6028,\n 2.8951,\n 3.183\n ],\n \"array_model\": [\n 1898.5567,\n 2179.0833,\n 2729.2008,\n 3284.9761,\n 3838.2222,\n 4387.1556,\n 4941.6538,\n 5496.5092,\n 6043.049\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 230.6256,\n 238.2816,\n 0.0,\n 252.5312,\n 0.0,\n 268.4368,\n 0.0,\n 283.8128,\n 0.0,\n 299.9056,\n 0.0,\n 314.688,\n 0.0,\n 329.4064,\n 0.0,\n 345.2192\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1928.8687,\n 2210.7697,\n 2764.4504,\n 3321.4769,\n 3876.5662,\n 4425.906,\n 4984.8714,\n 5542.3524,\n 6091.393\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1461,\n 1.4332,\n 1.722,\n 2.0098,\n 2.2946,\n 2.5843,\n 2.8734,\n 3.158\n ],\n \"array_model\": [\n 1928.8687,\n 2210.7697,\n 2764.4504,\n 3321.4769,\n 3876.5662,\n 4425.906,\n 4984.8714,\n 5542.3524,\n 6091.393\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 260.9376,\n 269.968,\n 0.0,\n 287.7808,\n 0.0,\n 304.9376,\n 0.0,\n 322.1568,\n 0.0,\n 338.656,\n 0.0,\n 357.9056,\n 0.0,\n 375.2496,\n 0.0,\n 393.5632\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1959.8367,\n 2243.3649,\n 2797.8568,\n 3357.7585,\n 3916.9726,\n 4469.6244,\n 5029.2778,\n 5588.1348,\n 6138.5482\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1447,\n 1.4276,\n 1.7133,\n 1.9986,\n 2.2806,\n 2.5662,\n 2.8513,\n 3.1322\n ],\n \"array_model\": [\n 1959.8367,\n 2243.3649,\n 2797.8568,\n 3357.7585,\n 3916.9726,\n 4469.6244,\n 5029.2778,\n 5588.1348,\n 6138.5482\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 291.9056,\n 302.5632,\n 0.0,\n 321.1872,\n 0.0,\n 341.2192,\n 0.0,\n 362.5632,\n 0.0,\n 382.3744,\n 0.0,\n 402.312,\n 0.0,\n 421.032,\n 0.0,\n 440.7184\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1990.5871,\n 2273.7393,\n 2832.7944,\n 3394.4769,\n 3954.691,\n 4510.0308,\n 5072.0602,\n 5634.0404,\n 6188.9866\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1422,\n 1.4231,\n 1.7053,\n 1.9867,\n 2.2657,\n 2.548,\n 2.8303,\n 3.1091\n ],\n \"array_model\": [\n 1990.5871,\n 2273.7393,\n 2832.7944,\n 3394.4769,\n 3954.691,\n 4510.0308,\n 5072.0602,\n 5634.0404,\n 6188.9866\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 322.656,\n 332.9376,\n 0.0,\n 356.1248,\n 0.0,\n 377.9376,\n 0.0,\n 400.2816,\n 0.0,\n 422.7808,\n 0.0,\n 445.0944,\n 0.0,\n 466.9376,\n 0.0,\n 491.1568\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2020.5871,\n 2306.0833,\n 2865.8568,\n 3432.6641,\n 3994.9406,\n 4552.4068,\n 5116.185,\n 5680.634,\n 6237.2042\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.1413,\n 1.4183,\n 1.6988,\n 1.9771,\n 2.253,\n 2.532,\n 2.8114,\n 3.0868\n ],\n \"array_model\": [\n 2020.5871,\n 2306.0833,\n 2865.8568,\n 3432.6641,\n 3994.9406,\n 4552.4068,\n 5116.185,\n 5680.634,\n 6237.2042\n ],\n \"array_query\": [\n 1667.9311,\n 1940.8017,\n 2476.6696,\n 3016.5393,\n 3554.4094,\n 4087.25,\n 4626.9658,\n 5167.1028,\n 5697.8298\n ],\n \"array_cache\": [\n 352.656,\n 365.2816,\n 0.0,\n 389.1872,\n 0.0,\n 416.1248,\n 0.0,\n 440.5312,\n 0.0,\n 465.1568,\n 0.0,\n 489.2192,\n 0.0,\n 513.5312,\n 0.0,\n 539.3744\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 161.9641\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 161.9641\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 2.8728\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 163.1128\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 163.1128\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 4.0215\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 173.4429\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 173.4429\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 14.3516\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 174.5854\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 174.5854\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 15.4941\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 175.7495\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 175.7495\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 16.6582\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 176.9546\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 176.9546\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 17.8633\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 178.0737\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 178.0737\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 18.9824\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 164.2632\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 164.2632\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 5.1719\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 165.4136\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 165.4136\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 6.3223\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 166.5679\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 166.5679\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 7.4766\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 167.7143\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 167.7143\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 8.623\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 168.8686\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 168.8686\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 9.7773\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 170.0327\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 170.0327\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 10.9414\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 171.1772\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 171.1772\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 12.0859\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 172.355\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 172.355\n ],\n \"array_query\": [\n 159.0913\n ],\n \"array_cache\": [\n 13.2637\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_1.json": "{\n \"mean\": 1667.9311,\n \"array\": [\n 1656.6784,\n 1682.6784,\n 1629.1568,\n 1668.1568,\n 1677.1568,\n 1665.8752,\n 1675.8752,\n 1656.4992,\n 1695.4992,\n 1650.2192,\n 1652.2192,\n 1660.3744,\n 1705.3744,\n 1678.0624,\n 1655.0624,\n 1656.0944,\n 1660.0944,\n 1629.344,\n 1651.344,\n 1645.344,\n 1645.344,\n 1644.4064,\n 1644.4064,\n 1662.4064,\n 1674.4064,\n 1707.4064,\n 1650.2816,\n 1699.2816,\n 1637.0624,\n 1656.0624,\n 1661.312,\n 1651.312,\n 1654.6784,\n 1652.6784,\n 1663.1568,\n 1693.1568,\n 1709.1568,\n 1678.8752,\n 1695.8752,\n 1668.4992,\n 1654.4992,\n 1637.2192,\n 1658.2192,\n 1656.3744,\n 1679.3744,\n 1675.0624,\n 1687.0624,\n 1633.0944,\n 1684.0944,\n 1682.344,\n 1657.344,\n 1681.344,\n 1655.344,\n 1655.4064,\n 1698.4064,\n 1683.4064,\n 1662.4064,\n 1704.4064,\n 1667.2816,\n 1695.2816,\n 1677.0624,\n 1704.0624,\n 1657.312,\n 1700.312\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_10.json": "{\n \"mean\": 4087.25,\n \"array\": [\n 4040.92,\n 4141.92,\n 4020.8128,\n 4032.8128,\n 4151.8128,\n 4148.7184,\n 4068.7184,\n 4088.6256,\n 4095.6256,\n 4130.2496,\n 4127.2496,\n 4071.0944,\n 4040.0944,\n 4141.344,\n 4117.344,\n 4126.6256,\n 4107.6256,\n 4025.2192,\n 4151.2192,\n 4016.8432,\n 4144.8432,\n 4022.4064,\n 4070.4064,\n 4030.0944,\n 4029.0944,\n 4136.0944,\n 4032.312,\n 4135.312,\n 4130.5008,\n 4127.5008,\n 4089.7808,\n 4094.7808,\n 4088.92,\n 4100.92,\n 4091.8128,\n 4139.8128,\n 4056.8128,\n 4146.7184,\n 4061.7184,\n 4148.6256,\n 4100.6256,\n 4083.2496,\n 4039.2496,\n 4020.0944,\n 4080.0944,\n 4069.344,\n 4033.344,\n 4058.6256,\n 4038.6256,\n 4108.2192,\n 4116.2192,\n 4100.8432,\n 4126.8432,\n 4059.4064,\n 4141.4064,\n 4001.0944,\n 4129.0944,\n 4092.0944,\n 4039.312,\n 4136.312,\n 4025.5008,\n 4142.5008,\n 4080.7808,\n 4037.7808\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_12.json": "{\n \"mean\": 4626.9658,\n \"array\": [\n 4563.0448,\n 4676.0448,\n 4556.2192,\n 4609.2192,\n 4652.2192,\n 4673.9056,\n 4690.9056,\n 4588.2192,\n 4674.2192,\n 4606.5632,\n 4703.5632,\n 4548.312,\n 4599.312,\n 4616.0944,\n 4631.0944,\n 4573.688,\n 4652.688,\n 4622.9056,\n 4635.9056,\n 4549.7808,\n 4596.7808,\n 4571.5936,\n 4570.5936,\n 4615.2816,\n 4571.2816,\n 4605.2816,\n 4637.0944,\n 4577.0944,\n 4667.1872,\n 4618.1872,\n 4689.8128,\n 4596.8128,\n 4593.0448,\n 4667.0448,\n 4628.2192,\n 4688.2192,\n 4645.2192,\n 4653.9056,\n 4660.9056,\n 4578.2192,\n 4635.2192,\n 4550.5632,\n 4643.5632,\n 4683.312,\n 4679.312,\n 4687.0944,\n 4578.0944,\n 4622.688,\n 4607.688,\n 4666.9056,\n 4682.9056,\n 4654.7808,\n 4669.7808,\n 4672.5936,\n 4570.5936,\n 4545.2816,\n 4575.2816,\n 4673.2816,\n 4684.0944,\n 4582.0944,\n 4685.1872,\n 4717.1872,\n 4598.8128,\n 4603.8128\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_14.json": "{\n \"mean\": 5167.1028,\n \"array\": [\n 5197.3472,\n 5109.3472,\n 5076.032,\n 5122.032,\n 5138.032,\n 5089.2816,\n 5112.2816,\n 5193.5312,\n 5245.5312,\n 5096.8752,\n 5190.8752,\n 5176.5936,\n 5095.5936,\n 5112.7504,\n 5146.7504,\n 5127.968,\n 5220.968,\n 5080.0624,\n 5222.0624,\n 5189.4688,\n 5192.4688,\n 5132.5936,\n 5244.5936,\n 5214.688,\n 5134.688,\n 5182.688,\n 5074.4992,\n 5141.4992,\n 5096.2496,\n 5221.2496,\n 5241.344,\n 5185.344,\n 5122.3472,\n 5191.3472,\n 5087.032,\n 5112.032,\n 5148.032,\n 5093.2816,\n 5199.2816,\n 5183.5312,\n 5260.5312,\n 5205.8752,\n 5242.8752,\n 5211.5936,\n 5171.5936,\n 5174.7504,\n 5100.7504,\n 5227.968,\n 5131.968,\n 5125.0624,\n 5232.0624,\n 5193.4688,\n 5216.4688,\n 5208.5936,\n 5136.5936,\n 5161.688,\n 5163.688,\n 5269.688,\n 5181.4992,\n 5254.4992,\n 5164.2496,\n 5211.2496,\n 5102.344,\n 5203.344\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_16.json": "{\n \"mean\": 5697.8298,\n \"array\": [\n 5622.4992,\n 5777.4992,\n 5716.4368,\n 5681.4368,\n 5767.4368,\n 5614.344,\n 5686.344,\n 5650.4064,\n 5693.4064,\n 5736.7184,\n 5729.7184,\n 5734.7808,\n 5768.7808,\n 5712.4368,\n 5703.4368,\n 5630.2816,\n 5724.2816,\n 5696.8432,\n 5655.8432,\n 5701.6256,\n 5636.6256,\n 5592.0624,\n 5758.0624,\n 5762.1248,\n 5673.1248,\n 5698.1248,\n 5632.9056,\n 5734.9056,\n 5748.344,\n 5779.344,\n 5659.1872,\n 5701.1872,\n 5755.4992,\n 5683.4992,\n 5597.4368,\n 5662.4368,\n 5644.4368,\n 5720.344,\n 5670.344,\n 5729.4064,\n 5690.4064,\n 5652.7184,\n 5756.7184,\n 5636.7808,\n 5691.7808,\n 5625.4368,\n 5709.4368,\n 5745.2816,\n 5790.2816,\n 5724.8432,\n 5765.8432,\n 5710.6256,\n 5791.6256,\n 5609.0624,\n 5723.0624,\n 5712.1248,\n 5653.1248,\n 5662.1248,\n 5647.9056,\n 5757.9056,\n 5609.344,\n 5687.344,\n 5684.1872,\n 5779.1872\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_2.json": "{\n \"mean\": 1940.8017,\n \"array\": [\n 1912.608,\n 1963.608,\n 1945.3744,\n 1951.3744,\n 1953.3744,\n 1920.6256,\n 1955.6256,\n 1951.688,\n 1954.688,\n 1938.4688,\n 1954.4688,\n 1956.7184,\n 1977.7184,\n 1905.032,\n 1919.032,\n 1956.4368,\n 1933.4368,\n 1929.0624,\n 1977.0624,\n 1893.7184,\n 1975.7184,\n 1921.656,\n 1937.656,\n 1944.0,\n 1959.0,\n 1936.0,\n 1917.5008,\n 1954.5008,\n 1938.2816,\n 1953.2816,\n 1918.7184,\n 1918.7184,\n 1926.608,\n 1935.608,\n 1922.3744,\n 1921.3744,\n 1961.3744,\n 1946.6256,\n 1931.6256,\n 1940.688,\n 1972.688,\n 1957.4688,\n 1980.4688,\n 1957.7184,\n 1968.7184,\n 1944.032,\n 1935.032,\n 1901.4368,\n 1931.4368,\n 1917.0624,\n 1951.0624,\n 1893.7184,\n 1946.7184,\n 1931.656,\n 1965.656,\n 1924.0,\n 1941.0,\n 1937.0,\n 1956.5008,\n 1970.5008,\n 1910.2816,\n 1916.2816,\n 1933.7184,\n 1955.7184\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_4.json": "{\n \"mean\": 2476.6696,\n \"array\": [\n 2490.6672,\n 2468.6672,\n 2484.3744,\n 2454.3744,\n 2502.3744,\n 2464.3744,\n 2474.3744,\n 2501.1568,\n 2494.1568,\n 2449.4992,\n 2449.4992,\n 2445.4688,\n 2513.4688,\n 2441.2192,\n 2483.2192,\n 2468.8128,\n 2448.8128,\n 2446.8752,\n 2501.8752,\n 2421.8128,\n 2487.8128,\n 2445.0624,\n 2478.0624,\n 2425.7808,\n 2483.7808,\n 2525.7808,\n 2468.5008,\n 2451.5008,\n 2431.656,\n 2475.656,\n 2461.1248,\n 2482.1248,\n 2470.6672,\n 2482.6672,\n 2435.3744,\n 2497.3744,\n 2509.3744,\n 2484.3744,\n 2520.3744,\n 2470.1568,\n 2526.1568,\n 2455.4992,\n 2479.4992,\n 2431.4688,\n 2524.4688,\n 2425.2192,\n 2495.2192,\n 2495.8128,\n 2499.8128,\n 2498.8752,\n 2503.8752,\n 2488.8128,\n 2489.8128,\n 2468.0624,\n 2491.0624,\n 2499.7808,\n 2446.7808,\n 2527.7808,\n 2452.5008,\n 2491.5008,\n 2483.656,\n 2472.656,\n 2514.1248,\n 2452.1248\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_6.json": "{\n \"mean\": 3016.5393,\n \"array\": [\n 3012.4576,\n 3036.4576,\n 2997.7184,\n 3045.7184,\n 2989.7184,\n 2986.4688,\n 2985.4688,\n 3015.7184,\n 3055.7184,\n 3056.4064,\n 3016.4064,\n 2986.5632,\n 3027.5632,\n 3034.0624,\n 2997.0624,\n 3015.7808,\n 3027.7808,\n 3017.0624,\n 3055.0624,\n 3003.8752,\n 3002.8752,\n 3007.7184,\n 2976.7184,\n 3040.5632,\n 2983.5632,\n 3017.5632,\n 3056.8432,\n 3064.8432,\n 3050.4688,\n 3074.4688,\n 2961.7808,\n 3003.7808,\n 3028.4576,\n 2995.4576,\n 2964.7184,\n 2980.7184,\n 3020.7184,\n 3038.4688,\n 3040.4688,\n 2987.7184,\n 3060.7184,\n 3037.4064,\n 2983.4064,\n 3047.5632,\n 3028.5632,\n 3034.0624,\n 3045.0624,\n 3042.7808,\n 3056.7808,\n 2973.0624,\n 2986.0624,\n 2961.8752,\n 3043.8752,\n 2981.7184,\n 3020.7184,\n 3008.5632,\n 3045.5632,\n 2981.5632,\n 3032.8432,\n 3011.8432,\n 2999.4688,\n 3002.4688,\n 3021.7808,\n 2989.7808\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_8.json": "{\n \"mean\": 3554.4094,\n \"array\": [\n 3528.4576,\n 3576.4576,\n 3563.8752,\n 3554.8752,\n 3545.8752,\n 3521.2192,\n 3599.2192,\n 3575.6256,\n 3572.6256,\n 3570.5312,\n 3553.5312,\n 3578.1872,\n 3532.1872,\n 3597.8432,\n 3616.8432,\n 3559.4368,\n 3535.4368,\n 3591.7184,\n 3587.7184,\n 3534.4688,\n 3500.4688,\n 3562.4064,\n 3592.4064,\n 3512.312,\n 3565.312,\n 3541.312,\n 3583.0,\n 3613.0,\n 3538.4368,\n 3607.4368,\n 3543.9376,\n 3619.9376,\n 3543.4576,\n 3601.4576,\n 3534.8752,\n 3533.8752,\n 3549.8752,\n 3528.2192,\n 3566.2192,\n 3557.6256,\n 3566.6256,\n 3562.5312,\n 3558.5312,\n 3497.1872,\n 3573.1872,\n 3504.8432,\n 3588.8432,\n 3503.4368,\n 3505.4368,\n 3479.7184,\n 3538.7184,\n 3529.4688,\n 3570.4688,\n 3495.4064,\n 3569.4064,\n 3545.312,\n 3516.312,\n 3519.312,\n 3513.0,\n 3583.0,\n 3581.4368,\n 3551.4368,\n 3546.9376,\n 3589.9376\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_slm/query_1.json": "{\n \"mean\": 159.0913,\n \"array\": [\n 158.6272,\n 160.0022,\n 159.3535,\n 161.3535,\n 157.4785,\n 160.5781,\n 159.0781,\n 159.6777,\n 159.5527,\n 160.8984,\n 160.1484,\n 159.627,\n 157.002,\n 158.9727,\n 158.4727,\n 160.5586,\n 156.9336,\n 158.9141,\n 160.5391,\n 159.3613,\n 157.9863,\n 157.2734,\n 157.1484,\n 159.5059,\n 158.8809,\n 161.6309,\n 158.8418,\n 156.9668,\n 159.0117,\n 158.6367,\n 156.6426,\n 158.5176,\n 158.5022,\n 157.0022,\n 156.3535,\n 161.2285,\n 160.1035,\n 159.5781,\n 157.8281,\n 161.0527,\n 158.0527,\n 160.5234,\n 157.2734,\n 158.002,\n 157.502,\n 158.2227,\n 159.0977,\n 157.3086,\n 157.1836,\n 160.9141,\n 160.4141,\n 159.7363,\n 157.6113,\n 158.3984,\n 161.3984,\n 159.2559,\n 161.1309,\n 158.5059,\n 160.9668,\n 159.3418,\n 160.8867,\n 161.8867,\n 160.2676,\n 158.1426\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 2.6797,\n 2.7012,\n 0.0,\n 2.7637,\n 0.0,\n 2.8145,\n 0.0,\n 2.8613,\n 0.0,\n 2.9258,\n 0.0,\n 2.9844,\n 0.0,\n 3.0371,\n 0.0,\n 3.082\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.008,\n 0.0,\n 1.0313,\n 0.0,\n 1.0503,\n 0.0,\n 1.0678,\n 0.0,\n 1.0918,\n 0.0,\n 1.1137,\n 0.0,\n 1.1334,\n 0.0,\n 1.1501\n ],\n \"array\": [\n 2.6797,\n 2.7012,\n 0.0,\n 2.7637,\n 0.0,\n 2.8145,\n 0.0,\n 2.8613,\n 0.0,\n 2.9258,\n 0.0,\n 2.9844,\n 0.0,\n 3.0371,\n 0.0,\n 3.082\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 3.1699,\n 3.2109,\n 0.0,\n 3.291,\n 0.0,\n 3.3926,\n 0.0,\n 3.4824,\n 0.0,\n 3.5723,\n 0.0,\n 3.6699,\n 0.0,\n 3.748,\n 0.0,\n 3.8457\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0129,\n 0.0,\n 1.0382,\n 0.0,\n 1.0702,\n 0.0,\n 1.0986,\n 0.0,\n 1.1269,\n 0.0,\n 1.1577,\n 0.0,\n 1.1824,\n 0.0,\n 1.2132\n ],\n \"array\": [\n 3.1699,\n 3.2109,\n 0.0,\n 3.291,\n 0.0,\n 3.3926,\n 0.0,\n 3.4824,\n 0.0,\n 3.5723,\n 0.0,\n 3.6699,\n 0.0,\n 3.748,\n 0.0,\n 3.8457\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 7.459,\n 7.6777,\n 0.0,\n 8.0977,\n 0.0,\n 8.5508,\n 0.0,\n 8.9531,\n 0.0,\n 9.3633,\n 0.0,\n 9.7852,\n 0.0,\n 10.248,\n 0.0,\n 10.6504\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0293,\n 0.0,\n 1.0856,\n 0.0,\n 1.1464,\n 0.0,\n 1.2003,\n 0.0,\n 1.2553,\n 0.0,\n 1.3119,\n 0.0,\n 1.3739,\n 0.0,\n 1.4279\n ],\n \"array\": [\n 7.459,\n 7.6777,\n 0.0,\n 8.0977,\n 0.0,\n 8.5508,\n 0.0,\n 8.9531,\n 0.0,\n 9.3633,\n 0.0,\n 9.7852,\n 0.0,\n 10.248,\n 0.0,\n 10.6504\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 7.9551,\n 8.1758,\n 0.0,\n 8.6367,\n 0.0,\n 9.084,\n 0.0,\n 9.5723,\n 0.0,\n 10.0234,\n 0.0,\n 10.4648,\n 0.0,\n 10.959,\n 0.0,\n 11.4121\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0277,\n 0.0,\n 1.0857,\n 0.0,\n 1.1419,\n 0.0,\n 1.2033,\n 0.0,\n 1.26,\n 0.0,\n 1.3155,\n 0.0,\n 1.3776,\n 0.0,\n 1.4346\n ],\n \"array\": [\n 7.9551,\n 8.1758,\n 0.0,\n 8.6367,\n 0.0,\n 9.084,\n 0.0,\n 9.5723,\n 0.0,\n 10.0234,\n 0.0,\n 10.4648,\n 0.0,\n 10.959,\n 0.0,\n 11.4121\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 8.4492,\n 8.6797,\n 0.0,\n 9.1387,\n 0.0,\n 9.6641,\n 0.0,\n 10.166,\n 0.0,\n 10.6367,\n 0.0,\n 11.1602,\n 0.0,\n 11.6699,\n 0.0,\n 12.1777\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0273,\n 0.0,\n 1.0816,\n 0.0,\n 1.1438,\n 0.0,\n 1.2032,\n 0.0,\n 1.2589,\n 0.0,\n 1.3209,\n 0.0,\n 1.3812,\n 0.0,\n 1.4413\n ],\n \"array\": [\n 8.4492,\n 8.6797,\n 0.0,\n 9.1387,\n 0.0,\n 9.6641,\n 0.0,\n 10.166,\n 0.0,\n 10.6367,\n 0.0,\n 11.1602,\n 0.0,\n 11.6699,\n 0.0,\n 12.1777\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 8.918,\n 9.1523,\n 0.0,\n 9.7285,\n 0.0,\n 10.2324,\n 0.0,\n 10.7949,\n 0.0,\n 11.3086,\n 0.0,\n 11.8652,\n 0.0,\n 12.3906,\n 0.0,\n 12.9023\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0263,\n 0.0,\n 1.0909,\n 0.0,\n 1.1474,\n 0.0,\n 1.2105,\n 0.0,\n 1.2681,\n 0.0,\n 1.3305,\n 0.0,\n 1.3894,\n 0.0,\n 1.4468\n ],\n \"array\": [\n 8.918,\n 9.1523,\n 0.0,\n 9.7285,\n 0.0,\n 10.2324,\n 0.0,\n 10.7949,\n 0.0,\n 11.3086,\n 0.0,\n 11.8652,\n 0.0,\n 12.3906,\n 0.0,\n 12.9023\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 9.4141,\n 9.6855,\n 0.0,\n 10.252,\n 0.0,\n 10.8145,\n 0.0,\n 11.3887,\n 0.0,\n 11.9746,\n 0.0,\n 12.5254,\n 0.0,\n 13.0879,\n 0.0,\n 13.6367\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0288,\n 0.0,\n 1.089,\n 0.0,\n 1.1488,\n 0.0,\n 1.2098,\n 0.0,\n 1.272,\n 0.0,\n 1.3305,\n 0.0,\n 1.3902,\n 0.0,\n 1.4485\n ],\n \"array\": [\n 9.4141,\n 9.6855,\n 0.0,\n 10.252,\n 0.0,\n 10.8145,\n 0.0,\n 11.3887,\n 0.0,\n 11.9746,\n 0.0,\n 12.5254,\n 0.0,\n 13.0879,\n 0.0,\n 13.6367\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 3.6348,\n 3.6992,\n 0.0,\n 3.8281,\n 0.0,\n 3.9531,\n 0.0,\n 4.0801,\n 0.0,\n 4.2168,\n 0.0,\n 4.3438,\n 0.0,\n 4.4746,\n 0.0,\n 4.6055\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0177,\n 0.0,\n 1.0532,\n 0.0,\n 1.0876,\n 0.0,\n 1.1225,\n 0.0,\n 1.1601,\n 0.0,\n 1.1951,\n 0.0,\n 1.2311,\n 0.0,\n 1.2671\n ],\n \"array\": [\n 3.6348,\n 3.6992,\n 0.0,\n 3.8281,\n 0.0,\n 3.9531,\n 0.0,\n 4.0801,\n 0.0,\n 4.2168,\n 0.0,\n 4.3438,\n 0.0,\n 4.4746,\n 0.0,\n 4.6055\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 4.1211,\n 4.207,\n 0.0,\n 4.3613,\n 0.0,\n 4.5312,\n 0.0,\n 4.7012,\n 0.0,\n 4.8555,\n 0.0,\n 5.0156,\n 0.0,\n 5.2051,\n 0.0,\n 5.3516\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0209,\n 0.0,\n 1.0583,\n 0.0,\n 1.0995,\n 0.0,\n 1.1408,\n 0.0,\n 1.1782,\n 0.0,\n 1.2171,\n 0.0,\n 1.263,\n 0.0,\n 1.2986\n ],\n \"array\": [\n 4.1211,\n 4.207,\n 0.0,\n 4.3613,\n 0.0,\n 4.5312,\n 0.0,\n 4.7012,\n 0.0,\n 4.8555,\n 0.0,\n 5.0156,\n 0.0,\n 5.2051,\n 0.0,\n 5.3516\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 4.6016,\n 4.6953,\n 0.0,\n 4.9199,\n 0.0,\n 5.0879,\n 0.0,\n 5.2891,\n 0.0,\n 5.5059,\n 0.0,\n 5.7109,\n 0.0,\n 5.9043,\n 0.0,\n 6.1211\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0204,\n 0.0,\n 1.0692,\n 0.0,\n 1.1057,\n 0.0,\n 1.1494,\n 0.0,\n 1.1965,\n 0.0,\n 1.2411,\n 0.0,\n 1.2831,\n 0.0,\n 1.3302\n ],\n \"array\": [\n 4.6016,\n 4.6953,\n 0.0,\n 4.9199,\n 0.0,\n 5.0879,\n 0.0,\n 5.2891,\n 0.0,\n 5.5059,\n 0.0,\n 5.7109,\n 0.0,\n 5.9043,\n 0.0,\n 6.1211\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 5.0801,\n 5.2012,\n 0.0,\n 5.4434,\n 0.0,\n 5.6758,\n 0.0,\n 5.9121,\n 0.0,\n 6.1602,\n 0.0,\n 6.4043,\n 0.0,\n 6.6191,\n 0.0,\n 6.8672\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0238,\n 0.0,\n 1.0715,\n 0.0,\n 1.1173,\n 0.0,\n 1.1638,\n 0.0,\n 1.2126,\n 0.0,\n 1.2607,\n 0.0,\n 1.303,\n 0.0,\n 1.3518\n ],\n \"array\": [\n 5.0801,\n 5.2012,\n 0.0,\n 5.4434,\n 0.0,\n 5.6758,\n 0.0,\n 5.9121,\n 0.0,\n 6.1602,\n 0.0,\n 6.4043,\n 0.0,\n 6.6191,\n 0.0,\n 6.8672\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 5.5566,\n 5.707,\n 0.0,\n 5.9668,\n 0.0,\n 6.2324,\n 0.0,\n 6.5254,\n 0.0,\n 6.7969,\n 0.0,\n 7.0723,\n 0.0,\n 7.3594,\n 0.0,\n 7.6309\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0271,\n 0.0,\n 1.0738,\n 0.0,\n 1.1216,\n 0.0,\n 1.1743,\n 0.0,\n 1.2232,\n 0.0,\n 1.2728,\n 0.0,\n 1.3244,\n 0.0,\n 1.3733\n ],\n \"array\": [\n 5.5566,\n 5.707,\n 0.0,\n 5.9668,\n 0.0,\n 6.2324,\n 0.0,\n 6.5254,\n 0.0,\n 6.7969,\n 0.0,\n 7.0723,\n 0.0,\n 7.3594,\n 0.0,\n 7.6309\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 6.0508,\n 6.2031,\n 0.0,\n 6.5,\n 0.0,\n 6.8145,\n 0.0,\n 7.1211,\n 0.0,\n 7.4453,\n 0.0,\n 7.75,\n 0.0,\n 8.0586,\n 0.0,\n 8.3965\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0252,\n 0.0,\n 1.0742,\n 0.0,\n 1.1262,\n 0.0,\n 1.1769,\n 0.0,\n 1.2305,\n 0.0,\n 1.2808,\n 0.0,\n 1.3318,\n 0.0,\n 1.3877\n ],\n \"array\": [\n 6.0508,\n 6.2031,\n 0.0,\n 6.5,\n 0.0,\n 6.8145,\n 0.0,\n 7.1211,\n 0.0,\n 7.4453,\n 0.0,\n 7.75,\n 0.0,\n 8.0586,\n 0.0,\n 8.3965\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 6.5039,\n 6.6875,\n 0.0,\n 7.0312,\n 0.0,\n 7.4062,\n 0.0,\n 7.752,\n 0.0,\n 8.0879,\n 0.0,\n 8.4434,\n 0.0,\n 8.7969,\n 0.0,\n 9.1602\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0282,\n 0.0,\n 1.0811,\n 0.0,\n 1.1387,\n 0.0,\n 1.1919,\n 0.0,\n 1.2435,\n 0.0,\n 1.2982,\n 0.0,\n 1.3526,\n 0.0,\n 1.4084\n ],\n \"array\": [\n 6.5039,\n 6.6875,\n 0.0,\n 7.0312,\n 0.0,\n 7.4062,\n 0.0,\n 7.752,\n 0.0,\n 8.0879,\n 0.0,\n 8.4434,\n 0.0,\n 8.7969,\n 0.0,\n 9.1602\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 7.0,\n 7.1934,\n 0.0,\n 7.5508,\n 0.0,\n 7.9688,\n 0.0,\n 8.3457,\n 0.0,\n 8.75,\n 0.0,\n 9.1387,\n 0.0,\n 9.5,\n 0.0,\n 9.8711\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0276,\n 0.0,\n 1.0787,\n 0.0,\n 1.1384,\n 0.0,\n 1.1922,\n 0.0,\n 1.25,\n 0.0,\n 1.3055,\n 0.0,\n 1.3571,\n 0.0,\n 1.4102\n ],\n \"array\": [\n 7.0,\n 7.1934,\n 0.0,\n 7.5508,\n 0.0,\n 7.9688,\n 0.0,\n 8.3457,\n 0.0,\n 8.75,\n 0.0,\n 9.1387,\n 0.0,\n 9.5,\n 0.0,\n 9.8711\n ],\n \"batch_size\": 4,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 1.5996\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.5996\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 1.8887\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 1.8887\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 4.4746\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 4.4746\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 4.7617\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 4.7617\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 5.0566\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 5.0566\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 5.3398\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 5.3398\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 5.6074\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 5.6074\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 2.1621\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.1621\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 2.459\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.459\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 2.7441\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 2.7441\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 3.0391\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 3.0391\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 3.3203\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 3.3203\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 3.6074\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 3.6074\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 3.8984\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 3.8984\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 4.1836\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 4.1836\n ],\n \"batch_size\": 4,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1510.7188,\n 1580.8209,\n 1713.308,\n 1849.8209,\n 1985.6206,\n 2123.298,\n 2252.7396,\n 2387.6035,\n 2526.8002\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0464,\n 1.1341,\n 1.2245,\n 1.3144,\n 1.4055,\n 1.4912,\n 1.5804,\n 1.6726\n ],\n \"array_model\": [\n 1510.7188,\n 1580.8209,\n 1713.308,\n 1849.8209,\n 1985.6206,\n 2123.298,\n 2252.7396,\n 2387.6035,\n 2526.8002\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 42.8752,\n 43.2192,\n 0.0,\n 44.2192,\n 0.0,\n 45.032,\n 0.0,\n 45.7808,\n 0.0,\n 46.8128,\n 0.0,\n 47.7504,\n 0.0,\n 48.5936,\n 0.0,\n 49.312\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1518.562,\n 1588.9761,\n 1721.7448,\n 1859.0705,\n 1995.5582,\n 2133.642,\n 2263.7076,\n 2398.9779,\n 2539.0194\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0464,\n 1.1338,\n 1.2242,\n 1.3141,\n 1.405,\n 1.4907,\n 1.5798,\n 1.672\n ],\n \"array_model\": [\n 1518.562,\n 1588.9761,\n 1721.7448,\n 1859.0705,\n 1995.5582,\n 2133.642,\n 2263.7076,\n 2398.9779,\n 2539.0194\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 50.7184,\n 51.3744,\n 0.0,\n 52.656,\n 0.0,\n 54.2816,\n 0.0,\n 55.7184,\n 0.0,\n 57.1568,\n 0.0,\n 58.7184,\n 0.0,\n 59.968,\n 0.0,\n 61.5312\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1587.1876,\n 1660.4449,\n 1798.652,\n 1941.6017,\n 2083.0894,\n 2226.298,\n 2361.5524,\n 2502.9779,\n 2647.8946\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0462,\n 1.1332,\n 1.2233,\n 1.3124,\n 1.4027,\n 1.4879,\n 1.577,\n 1.6683\n ],\n \"array_model\": [\n 1587.1876,\n 1660.4449,\n 1798.652,\n 1941.6017,\n 2083.0894,\n 2226.298,\n 2361.5524,\n 2502.9779,\n 2647.8946\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 119.344,\n 122.8432,\n 0.0,\n 129.5632,\n 0.0,\n 136.8128,\n 0.0,\n 143.2496,\n 0.0,\n 149.8128,\n 0.0,\n 156.5632,\n 0.0,\n 163.968,\n 0.0,\n 170.4064\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1595.1252,\n 1668.4145,\n 1807.276,\n 1950.1329,\n 2092.9966,\n 2236.8596,\n 2372.426,\n 2514.3539,\n 2660.0818\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0459,\n 1.133,\n 1.2226,\n 1.3121,\n 1.4023,\n 1.4873,\n 1.5763,\n 1.6676\n ],\n \"array_model\": [\n 1595.1252,\n 1668.4145,\n 1807.276,\n 1950.1329,\n 2092.9966,\n 2236.8596,\n 2372.426,\n 2514.3539,\n 2660.0818\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 127.2816,\n 130.8128,\n 0.0,\n 138.1872,\n 0.0,\n 145.344,\n 0.0,\n 153.1568,\n 0.0,\n 160.3744,\n 0.0,\n 167.4368,\n 0.0,\n 175.344,\n 0.0,\n 182.5936\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1603.0308,\n 1676.4769,\n 1815.308,\n 1959.4145,\n 2102.4958,\n 2246.6724,\n 2383.5524,\n 2525.7283,\n 2672.3314\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0458,\n 1.1324,\n 1.2223,\n 1.3116,\n 1.4015,\n 1.4869,\n 1.5756,\n 1.667\n ],\n \"array_model\": [\n 1603.0308,\n 1676.4769,\n 1815.308,\n 1959.4145,\n 2102.4958,\n 2246.6724,\n 2383.5524,\n 2525.7283,\n 2672.3314\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 135.1872,\n 138.8752,\n 0.0,\n 146.2192,\n 0.0,\n 154.6256,\n 0.0,\n 162.656,\n 0.0,\n 170.1872,\n 0.0,\n 178.5632,\n 0.0,\n 186.7184,\n 0.0,\n 194.8432\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1610.5316,\n 1684.0385,\n 1824.7448,\n 1968.5073,\n 2112.5582,\n 2257.4228,\n 2394.8324,\n 2537.2595,\n 2683.925\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0456,\n 1.133,\n 1.2223,\n 1.3117,\n 1.4017,\n 1.487,\n 1.5754,\n 1.6665\n ],\n \"array_model\": [\n 1610.5316,\n 1684.0385,\n 1824.7448,\n 1968.5073,\n 2112.5582,\n 2257.4228,\n 2394.8324,\n 2537.2595,\n 2683.925\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 142.688,\n 146.4368,\n 0.0,\n 155.656,\n 0.0,\n 163.7184,\n 0.0,\n 172.7184,\n 0.0,\n 180.9376,\n 0.0,\n 189.8432,\n 0.0,\n 198.2496,\n 0.0,\n 206.4368\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1618.4692,\n 1692.5697,\n 1833.1208,\n 1977.8209,\n 2122.059,\n 2268.0788,\n 2405.3956,\n 2548.4163,\n 2695.6754\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0458,\n 1.1326,\n 1.222,\n 1.3112,\n 1.4014,\n 1.4862,\n 1.5746,\n 1.6656\n ],\n \"array_model\": [\n 1618.4692,\n 1692.5697,\n 1833.1208,\n 1977.8209,\n 2122.059,\n 2268.0788,\n 2405.3956,\n 2548.4163,\n 2695.6754\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 150.6256,\n 154.968,\n 0.0,\n 164.032,\n 0.0,\n 173.032,\n 0.0,\n 182.2192,\n 0.0,\n 191.5936,\n 0.0,\n 200.4064,\n 0.0,\n 209.4064,\n 0.0,\n 218.1872\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1526.0004,\n 1596.7889,\n 1730.3384,\n 1868.0385,\n 2005.1214,\n 2143.954,\n 2274.49,\n 2410.6035,\n 2551.1762\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0464,\n 1.1339,\n 1.2241,\n 1.314,\n 1.4049,\n 1.4905,\n 1.5797,\n 1.6718\n ],\n \"array_model\": [\n 1526.0004,\n 1596.7889,\n 1730.3384,\n 1868.0385,\n 2005.1214,\n 2143.954,\n 2274.49,\n 2410.6035,\n 2551.1762\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 58.1568,\n 59.1872,\n 0.0,\n 61.2496,\n 0.0,\n 63.2496,\n 0.0,\n 65.2816,\n 0.0,\n 67.4688,\n 0.0,\n 69.5008,\n 0.0,\n 71.5936,\n 0.0,\n 73.688\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1533.7812,\n 1604.9137,\n 1738.8696,\n 1877.2881,\n 2015.059,\n 2154.1732,\n 2285.2388,\n 2422.2915,\n 2563.1138\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0464,\n 1.1337,\n 1.224,\n 1.3138,\n 1.4045,\n 1.4899,\n 1.5793,\n 1.6711\n ],\n \"array_model\": [\n 1533.7812,\n 1604.9137,\n 1738.8696,\n 1877.2881,\n 2015.059,\n 2154.1732,\n 2285.2388,\n 2422.2915,\n 2563.1138\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 65.9376,\n 67.312,\n 0.0,\n 69.7808,\n 0.0,\n 72.4992,\n 0.0,\n 75.2192,\n 0.0,\n 77.688,\n 0.0,\n 80.2496,\n 0.0,\n 83.2816,\n 0.0,\n 85.6256\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1541.4692,\n 1612.7265,\n 1747.8072,\n 1886.1953,\n 2024.4654,\n 2164.5796,\n 2296.3636,\n 2433.4787,\n 2575.4258\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0462,\n 1.1339,\n 1.2236,\n 1.3133,\n 1.4042,\n 1.4897,\n 1.5787,\n 1.6708\n ],\n \"array_model\": [\n 1541.4692,\n 1612.7265,\n 1747.8072,\n 1886.1953,\n 2024.4654,\n 2164.5796,\n 2296.3636,\n 2433.4787,\n 2575.4258\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 73.6256,\n 75.1248,\n 0.0,\n 78.7184,\n 0.0,\n 81.4064,\n 0.0,\n 84.6256,\n 0.0,\n 88.0944,\n 0.0,\n 91.3744,\n 0.0,\n 94.4688,\n 0.0,\n 97.9376\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1549.1252,\n 1620.8209,\n 1756.1832,\n 1895.6017,\n 2034.4334,\n 2175.0484,\n 2307.458,\n 2444.9155,\n 2587.3634\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0463,\n 1.1337,\n 1.2237,\n 1.3133,\n 1.404,\n 1.4895,\n 1.5783,\n 1.6702\n ],\n \"array_model\": [\n 1549.1252,\n 1620.8209,\n 1756.1832,\n 1895.6017,\n 2034.4334,\n 2175.0484,\n 2307.458,\n 2444.9155,\n 2587.3634\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 81.2816,\n 83.2192,\n 0.0,\n 87.0944,\n 0.0,\n 90.8128,\n 0.0,\n 94.5936,\n 0.0,\n 98.5632,\n 0.0,\n 102.4688,\n 0.0,\n 105.9056,\n 0.0,\n 109.8752\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1556.7492,\n 1628.9137,\n 1764.5576,\n 1904.5073,\n 2044.2462,\n 2185.2356,\n 2318.146,\n 2456.7603,\n 2599.5826\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0464,\n 1.1335,\n 1.2234,\n 1.3132,\n 1.4037,\n 1.4891,\n 1.5781,\n 1.6699\n ],\n \"array_model\": [\n 1556.7492,\n 1628.9137,\n 1764.5576,\n 1904.5073,\n 2044.2462,\n 2185.2356,\n 2318.146,\n 2456.7603,\n 2599.5826\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 88.9056,\n 91.312,\n 0.0,\n 95.4688,\n 0.0,\n 99.7184,\n 0.0,\n 104.4064,\n 0.0,\n 108.7504,\n 0.0,\n 113.1568,\n 0.0,\n 117.7504,\n 0.0,\n 122.0944\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1564.6564,\n 1636.8513,\n 1773.0888,\n 1913.8209,\n 2053.7774,\n 2195.61,\n 2328.9892,\n 2467.9475,\n 2611.8322\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0461,\n 1.1332,\n 1.2232,\n 1.3126,\n 1.4033,\n 1.4885,\n 1.5773,\n 1.6693\n ],\n \"array_model\": [\n 1564.6564,\n 1636.8513,\n 1773.0888,\n 1913.8209,\n 2053.7774,\n 2195.61,\n 2328.9892,\n 2467.9475,\n 2611.8322\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 96.8128,\n 99.2496,\n 0.0,\n 104.0,\n 0.0,\n 109.032,\n 0.0,\n 113.9376,\n 0.0,\n 119.1248,\n 0.0,\n 124.0,\n 0.0,\n 128.9376,\n 0.0,\n 134.344\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1571.906,\n 1644.6017,\n 1781.588,\n 1923.2881,\n 2063.8718,\n 2205.8916,\n 2340.0836,\n 2479.7603,\n 2624.0514\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0462,\n 1.1334,\n 1.2235,\n 1.313,\n 1.4033,\n 1.4887,\n 1.5775,\n 1.6693\n ],\n \"array_model\": [\n 1571.906,\n 1644.6017,\n 1781.588,\n 1923.2881,\n 2063.8718,\n 2205.8916,\n 2340.0836,\n 2479.7603,\n 2624.0514\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 104.0624,\n 107.0,\n 0.0,\n 112.4992,\n 0.0,\n 118.4992,\n 0.0,\n 124.032,\n 0.0,\n 129.4064,\n 0.0,\n 135.0944,\n 0.0,\n 140.7504,\n 0.0,\n 146.5632\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1579.8436,\n 1652.6961,\n 1789.9016,\n 1932.2897,\n 2073.371,\n 2216.4852,\n 2351.2084,\n 2491.0099,\n 2635.4258\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0461,\n 1.133,\n 1.2231,\n 1.3124,\n 1.403,\n 1.4883,\n 1.5767,\n 1.6682\n ],\n \"array_model\": [\n 1579.8436,\n 1652.6961,\n 1789.9016,\n 1932.2897,\n 2073.371,\n 2216.4852,\n 2351.2084,\n 2491.0099,\n 2635.4258\n ],\n \"array_query\": [\n 1467.8436,\n 1537.6017,\n 1669.0888,\n 1804.7889,\n 1939.8398,\n 2076.4852,\n 2204.9892,\n 2339.0099,\n 2477.4882\n ],\n \"array_cache\": [\n 112.0,\n 115.0944,\n 0.0,\n 120.8128,\n 0.0,\n 127.5008,\n 0.0,\n 133.5312,\n 0.0,\n 140.0,\n 0.0,\n 146.2192,\n 0.0,\n 152.0,\n 0.0,\n 157.9376\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 112.502\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 112.502\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 1.5996\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 112.7911\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 112.7911\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 1.8887\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.377\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 115.377\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 4.4746\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.6641\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 115.6641\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 4.7617\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.959\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 115.959\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 5.0566\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 116.2422\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 116.2422\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 5.3398\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 116.5098\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 116.5098\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 5.6074\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.0645\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 113.0645\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 2.1621\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.3614\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 113.3614\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 2.459\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.6465\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 113.6465\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 2.7441\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.9415\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 113.9415\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 3.0391\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 114.2227\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 114.2227\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 3.3203\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 114.5098\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 114.5098\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 3.6074\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 114.8008\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 114.8008\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 3.8984\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.086\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 115.086\n ],\n \"array_query\": [\n 110.9024\n ],\n \"array_cache\": [\n 4.1836\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_1.json": "{\n \"mean\": 1467.8436,\n \"array\": [\n 1459.1248,\n 1467.1248,\n 1467.2816,\n 1461.2816,\n 1464.2816,\n 1454.8432,\n 1448.8432,\n 1450.0624,\n 1471.0624,\n 1468.3744,\n 1481.3744,\n 1465.7184,\n 1474.7184,\n 1456.0944,\n 1480.0944,\n 1481.1872,\n 1466.1872,\n 1475.9376,\n 1474.9376,\n 1459.0,\n 1486.0,\n 1482.656,\n 1452.656,\n 1458.7184,\n 1461.7184,\n 1470.7184,\n 1452.8128,\n 1467.8128,\n 1488.312,\n 1449.312,\n 1487.3744,\n 1482.3744,\n 1468.1248,\n 1485.1248,\n 1454.2816,\n 1457.2816,\n 1484.2816,\n 1483.8432,\n 1477.8432,\n 1464.0624,\n 1491.0624,\n 1479.3744,\n 1456.3744,\n 1462.7184,\n 1467.7184,\n 1464.0944,\n 1470.0944,\n 1471.1872,\n 1491.1872,\n 1486.9376,\n 1447.9376,\n 1444.0,\n 1445.0,\n 1454.656,\n 1455.656,\n 1487.7184,\n 1454.7184,\n 1481.7184,\n 1472.8128,\n 1453.8128,\n 1472.312,\n 1453.312,\n 1450.3744,\n 1484.3744\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_10.json": "{\n \"mean\": 2076.4852,\n \"array\": [\n 2052.1872,\n 2084.1872,\n 2063.8432,\n 2078.8432,\n 2100.8432,\n 2086.5312,\n 2101.5312,\n 2097.312,\n 2098.312,\n 2055.9056,\n 2089.9056,\n 2041.4368,\n 2049.4368,\n 2054.2496,\n 2053.2496,\n 2097.8752,\n 2067.8752,\n 2067.5936,\n 2094.5936,\n 2074.0,\n 2049.0,\n 2077.1872,\n 2069.1872,\n 2036.6256,\n 2102.6256,\n 2085.6256,\n 2068.8128,\n 2067.8128,\n 2086.0624,\n 2091.0624,\n 2094.4064,\n 2047.4064,\n 2094.1872,\n 2089.1872,\n 2053.8432,\n 2077.8432,\n 2101.8432,\n 2080.5312,\n 2097.5312,\n 2071.312,\n 2076.312,\n 2099.9056,\n 2047.9056,\n 2041.4368,\n 2084.4368,\n 2055.2496,\n 2090.2496,\n 2099.8752,\n 2103.8752,\n 2060.5936,\n 2047.5936,\n 2094.0,\n 2082.0,\n 2094.1872,\n 2042.1872,\n 2078.6256,\n 2094.6256,\n 2069.6256,\n 2102.8128,\n 2068.8128,\n 2070.0624,\n 2105.0624,\n 2074.4064,\n 2059.4064\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_12.json": "{\n \"mean\": 2204.9892,\n \"array\": [\n 2172.2496,\n 2192.2496,\n 2206.2816,\n 2214.2816,\n 2192.2816,\n 2237.4992,\n 2219.4992,\n 2188.7504,\n 2186.7504,\n 2211.6256,\n 2180.6256,\n 2234.5312,\n 2196.5312,\n 2178.8432,\n 2242.8432,\n 2228.0,\n 2178.0,\n 2190.9056,\n 2187.9056,\n 2177.7808,\n 2203.7808,\n 2176.4368,\n 2236.4368,\n 2181.5632,\n 2242.5632,\n 2215.5632,\n 2227.4368,\n 2227.4368,\n 2229.1568,\n 2229.1568,\n 2211.5936,\n 2207.5936,\n 2177.2496,\n 2215.2496,\n 2223.2816,\n 2209.2816,\n 2224.2816,\n 2188.4992,\n 2228.4992,\n 2181.7504,\n 2186.7504,\n 2205.6256,\n 2200.6256,\n 2205.5312,\n 2174.5312,\n 2201.8432,\n 2217.8432,\n 2222.0,\n 2202.0,\n 2236.9056,\n 2191.9056,\n 2194.7808,\n 2229.7808,\n 2173.4368,\n 2186.4368,\n 2220.5632,\n 2233.5632,\n 2186.5632,\n 2217.4368,\n 2176.4368,\n 2192.1568,\n 2219.1568,\n 2179.5936,\n 2209.5936\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_14.json": "{\n \"mean\": 2339.0099,\n \"array\": [\n 2370.4064,\n 2344.4064,\n 2325.032,\n 2355.032,\n 2378.032,\n 2305.4064,\n 2375.4064,\n 2320.7184,\n 2377.7184,\n 2333.5312,\n 2320.5312,\n 2371.0944,\n 2336.0944,\n 2372.2496,\n 2340.2496,\n 2369.0624,\n 2332.0624,\n 2320.2496,\n 2316.2496,\n 2308.0,\n 2365.0,\n 2314.032,\n 2330.032,\n 2308.656,\n 2314.656,\n 2334.656,\n 2370.2816,\n 2348.2816,\n 2316.7504,\n 2378.7504,\n 2323.5936,\n 2333.5936,\n 2303.4064,\n 2374.4064,\n 2331.032,\n 2336.032,\n 2371.032,\n 2312.4064,\n 2361.4064,\n 2364.7184,\n 2338.7184,\n 2303.5312,\n 2308.5312,\n 2331.0944,\n 2344.0944,\n 2370.2496,\n 2371.2496,\n 2344.0624,\n 2307.0624,\n 2339.2496,\n 2337.2496,\n 2345.0,\n 2329.0,\n 2306.032,\n 2341.032,\n 2354.656,\n 2330.656,\n 2330.656,\n 2361.2816,\n 2340.2816,\n 2314.7504,\n 2322.7504,\n 2329.5936,\n 2331.5936\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_16.json": "{\n \"mean\": 2477.4882,\n \"array\": [\n 2484.688,\n 2503.688,\n 2434.4688,\n 2474.4688,\n 2506.4688,\n 2448.312,\n 2514.312,\n 2475.3744,\n 2484.3744,\n 2491.0624,\n 2501.0624,\n 2447.1248,\n 2465.1248,\n 2509.9056,\n 2442.9056,\n 2507.656,\n 2452.656,\n 2437.4368,\n 2514.4368,\n 2457.0624,\n 2514.0624,\n 2495.5936,\n 2484.5936,\n 2437.4064,\n 2493.4064,\n 2495.4064,\n 2450.1568,\n 2480.1568,\n 2468.5632,\n 2441.5632,\n 2502.8128,\n 2517.8128,\n 2449.688,\n 2451.688,\n 2498.4688,\n 2509.4688,\n 2487.4688,\n 2499.312,\n 2518.312,\n 2438.3744,\n 2470.3744,\n 2479.0624,\n 2441.0624,\n 2479.1248,\n 2468.1248,\n 2437.9056,\n 2447.9056,\n 2477.656,\n 2456.656,\n 2508.4368,\n 2449.4368,\n 2497.0624,\n 2453.0624,\n 2431.5936,\n 2491.5936,\n 2477.4064,\n 2469.4064,\n 2520.4064,\n 2434.1568,\n 2519.1568,\n 2490.5632,\n 2519.5632,\n 2475.8128,\n 2476.8128\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_2.json": "{\n \"mean\": 1537.6017,\n \"array\": [\n 1550.7808,\n 1551.7808,\n 1538.6256,\n 1549.6256,\n 1546.6256,\n 1539.8128,\n 1555.8128,\n 1522.688,\n 1546.688,\n 1550.8752,\n 1539.8752,\n 1549.7808,\n 1539.7808,\n 1538.688,\n 1521.688,\n 1542.7504,\n 1517.7504,\n 1516.0,\n 1537.0,\n 1522.9056,\n 1516.9056,\n 1525.1568,\n 1534.1568,\n 1536.1872,\n 1550.1872,\n 1562.1872,\n 1542.1248,\n 1562.1248,\n 1544.5632,\n 1555.5632,\n 1526.032,\n 1529.032,\n 1546.7808,\n 1534.7808,\n 1513.6256,\n 1550.6256,\n 1521.6256,\n 1547.8128,\n 1561.8128,\n 1510.688,\n 1532.688,\n 1534.8752,\n 1522.8752,\n 1527.7808,\n 1523.7808,\n 1535.688,\n 1514.688,\n 1524.7504,\n 1555.7504,\n 1550.0,\n 1558.0,\n 1534.9056,\n 1556.9056,\n 1519.1568,\n 1532.1568,\n 1521.1872,\n 1510.1872,\n 1540.1872,\n 1546.1248,\n 1559.1248,\n 1555.5632,\n 1562.5632,\n 1518.032,\n 1518.032\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_4.json": "{\n \"mean\": 1669.0888,\n \"array\": [\n 1656.7808,\n 1654.7808,\n 1677.344,\n 1650.344,\n 1681.344,\n 1662.7504,\n 1662.7504,\n 1671.2192,\n 1662.2192,\n 1691.2816,\n 1660.2816,\n 1686.9056,\n 1649.9056,\n 1642.5312,\n 1653.5312,\n 1687.0,\n 1664.0,\n 1648.5008,\n 1694.5008,\n 1685.1872,\n 1692.1872,\n 1650.4368,\n 1665.4368,\n 1690.8128,\n 1685.8128,\n 1657.8128,\n 1684.7808,\n 1656.7808,\n 1663.344,\n 1645.344,\n 1677.968,\n 1685.968,\n 1639.7808,\n 1660.7808,\n 1684.344,\n 1666.344,\n 1682.344,\n 1646.7504,\n 1686.7504,\n 1642.2192,\n 1668.2192,\n 1693.2816,\n 1689.2816,\n 1679.9056,\n 1645.9056,\n 1653.5312,\n 1653.5312,\n 1642.0,\n 1684.0,\n 1690.5008,\n 1661.5008,\n 1665.1872,\n 1679.1872,\n 1654.4368,\n 1694.4368,\n 1674.8128,\n 1669.8128,\n 1679.8128,\n 1689.7808,\n 1651.7808,\n 1659.344,\n 1697.344,\n 1688.968,\n 1645.968\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_6.json": "{\n \"mean\": 1804.7889,\n \"array\": [\n 1778.968,\n 1810.968,\n 1806.7184,\n 1789.7184,\n 1820.7184,\n 1793.7504,\n 1829.7504,\n 1800.5008,\n 1826.5008,\n 1817.5936,\n 1799.5936,\n 1781.1872,\n 1798.1872,\n 1787.2816,\n 1785.2816,\n 1802.968,\n 1805.968,\n 1813.5008,\n 1807.5008,\n 1819.4992,\n 1790.4992,\n 1819.1872,\n 1818.1872,\n 1770.656,\n 1795.656,\n 1809.656,\n 1815.3744,\n 1785.3744,\n 1827.2816,\n 1794.2816,\n 1822.968,\n 1830.968,\n 1790.968,\n 1810.968,\n 1774.7184,\n 1806.7184,\n 1809.7184,\n 1798.7504,\n 1797.7504,\n 1797.5008,\n 1782.5008,\n 1827.5936,\n 1811.5936,\n 1802.1872,\n 1815.1872,\n 1819.2816,\n 1798.2816,\n 1816.968,\n 1781.968,\n 1803.5008,\n 1805.5008,\n 1815.4992,\n 1826.4992,\n 1801.1872,\n 1827.1872,\n 1811.656,\n 1827.656,\n 1795.656,\n 1808.3744,\n 1830.3744,\n 1777.2816,\n 1806.2816,\n 1772.968,\n 1797.968\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_8.json": "{\n \"mean\": 1939.8398,\n \"array\": [\n 1910.2192,\n 1959.2192,\n 1909.2816,\n 1945.2816,\n 1952.2816,\n 1961.7184,\n 1942.7184,\n 1961.7808,\n 1939.7808,\n 1946.3744,\n 1912.3744,\n 1918.4064,\n 1930.4064,\n 1930.5936,\n 1920.5936,\n 1907.0624,\n 1964.0624,\n 1961.968,\n 1938.968,\n 1946.4688,\n 1917.4688,\n 1906.7504,\n 1935.7504,\n 1930.8432,\n 1967.8432,\n 1942.8432,\n 1963.344,\n 1944.344,\n 1960.2816,\n 1953.2816,\n 1967.7808,\n 1943.7808,\n 1956.2192,\n 1957.2192,\n 1935.2816,\n 1959.2816,\n 1926.2816,\n 1951.7184,\n 1929.7184,\n 1912.7808,\n 1920.7808,\n 1956.3744,\n 1941.3744,\n 1913.4064,\n 1967.4064,\n 1943.5936,\n 1936.5936,\n 1916.0624,\n 1924.0624,\n 1952.968,\n 1965.968,\n 1956.4688,\n 1934.4688,\n 1946.7504,\n 1962.7504,\n 1928.8432,\n 1920.8432,\n 1915.8432,\n 1913.344,\n 1925.344,\n 1935.2816,\n 1943.2816,\n 1951.7808,\n 1953.7808\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_slm/query_1.json": "{\n \"mean\": 110.9024,\n \"array\": [\n 109.7754,\n 109.5254,\n 112.2363,\n 110.8613,\n 111.4863,\n 110.5879,\n 109.5879,\n 112.291,\n 111.666,\n 110.1309,\n 112.1309,\n 112.5859,\n 111.5859,\n 110.5547,\n 109.3047,\n 112.0176,\n 109.5176,\n 111.6016,\n 111.4766,\n 112.4414,\n 111.4414,\n 111.5254,\n 111.2754,\n 110.2383,\n 110.4883,\n 109.4883,\n 112.0684,\n 111.1934,\n 112.4102,\n 111.2852,\n 111.0176,\n 111.3926,\n 109.6504,\n 111.9004,\n 110.7363,\n 109.6113,\n 110.8613,\n 109.8379,\n 111.5879,\n 111.916,\n 112.666,\n 110.0059,\n 111.0059,\n 110.5859,\n 109.4609,\n 112.1797,\n 111.5547,\n 110.0176,\n 109.5176,\n 112.2266,\n 109.3516,\n 109.8164,\n 110.6914,\n 109.1504,\n 109.4004,\n 109.1133,\n 110.8633,\n 112.6133,\n 110.6934,\n 110.6934,\n 109.9102,\n 110.7852,\n 112.1426,\n 112.0176\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_64/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 13.4485,\n 13.663,\n 0.0,\n 14.9062,\n 0.0,\n 15.5312,\n 0.0,\n 16.5735,\n 0.0,\n 17.4485,\n 0.0,\n 18.356,\n 0.0,\n 19.3098,\n 0.0,\n 20.0662\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.016,\n 0.0,\n 1.1084,\n 0.0,\n 1.1549,\n 0.0,\n 1.2324,\n 0.0,\n 1.2974,\n 0.0,\n 1.3649,\n 0.0,\n 1.4358,\n 0.0,\n 1.4921\n ],\n \"array\": [\n 13.4485,\n 13.663,\n 0.0,\n 14.9062,\n 0.0,\n 15.5312,\n 0.0,\n 16.5735,\n 0.0,\n 17.4485,\n 0.0,\n 18.356,\n 0.0,\n 19.3098,\n 0.0,\n 20.0662\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 21.1099,\n 21.7539,\n 0.0,\n 23.2188,\n 0.0,\n 24.7458,\n 0.0,\n 26.1688,\n 0.0,\n 27.4461,\n 0.0,\n 28.7903,\n 0.0,\n 30.5402,\n 0.0,\n 31.7457\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0305,\n 0.0,\n 1.0999,\n 0.0,\n 1.1722,\n 0.0,\n 1.2396,\n 0.0,\n 1.3002,\n 0.0,\n 1.3638,\n 0.0,\n 1.4467,\n 0.0,\n 1.5038\n ],\n \"array\": [\n 21.1099,\n 21.7539,\n 0.0,\n 23.2188,\n 0.0,\n 24.7458,\n 0.0,\n 26.1688,\n 0.0,\n 27.4461,\n 0.0,\n 28.7903,\n 0.0,\n 30.5402,\n 0.0,\n 31.7457\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 90.1348,\n 93.127,\n 0.0,\n 100.2891,\n 0.0,\n 107.2227,\n 0.0,\n 113.7246,\n 0.0,\n 120.7188,\n 0.0,\n 127.0742,\n 0.0,\n 134.1152,\n 0.0,\n 140.8945\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0332,\n 0.0,\n 1.1127,\n 0.0,\n 1.1896,\n 0.0,\n 1.2617,\n 0.0,\n 1.3393,\n 0.0,\n 1.4098,\n 0.0,\n 1.4879,\n 0.0,\n 1.5632\n ],\n \"array\": [\n 90.1348,\n 93.127,\n 0.0,\n 100.2891,\n 0.0,\n 107.2227,\n 0.0,\n 113.7246,\n 0.0,\n 120.7188,\n 0.0,\n 127.0742,\n 0.0,\n 134.1152,\n 0.0,\n 140.8945\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 97.8691,\n 101.252,\n 0.0,\n 108.8809,\n 0.0,\n 116.4512,\n 0.0,\n 123.5625,\n 0.0,\n 130.7227,\n 0.0,\n 138.0254,\n 0.0,\n 145.6211,\n 0.0,\n 153.082\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0346,\n 0.0,\n 1.1125,\n 0.0,\n 1.1899,\n 0.0,\n 1.2625,\n 0.0,\n 1.3357,\n 0.0,\n 1.4103,\n 0.0,\n 1.4879,\n 0.0,\n 1.5642\n ],\n \"array\": [\n 97.8691,\n 101.252,\n 0.0,\n 108.8809,\n 0.0,\n 116.4512,\n 0.0,\n 123.5625,\n 0.0,\n 130.7227,\n 0.0,\n 138.0254,\n 0.0,\n 145.6211,\n 0.0,\n 153.082\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 105.3457,\n 109.1914,\n 0.0,\n 117.3672,\n 0.0,\n 125.4316,\n 0.0,\n 133.1426,\n 0.0,\n 141.2031,\n 0.0,\n 149.1641,\n 0.0,\n 156.9668,\n 0.0,\n 165.3516\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0365,\n 0.0,\n 1.1141,\n 0.0,\n 1.1907,\n 0.0,\n 1.2639,\n 0.0,\n 1.3404,\n 0.0,\n 1.4159,\n 0.0,\n 1.49,\n 0.0,\n 1.5696\n ],\n \"array\": [\n 105.3457,\n 109.1914,\n 0.0,\n 117.3672,\n 0.0,\n 125.4316,\n 0.0,\n 133.1426,\n 0.0,\n 141.2031,\n 0.0,\n 149.1641,\n 0.0,\n 156.9668,\n 0.0,\n 165.3516\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 112.9688,\n 117.4043,\n 0.0,\n 126.0566,\n 0.0,\n 134.2988,\n 0.0,\n 143.0098,\n 0.0,\n 151.4863,\n 0.0,\n 160.0762,\n 0.0,\n 168.5723,\n 0.0,\n 177.1973\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0393,\n 0.0,\n 1.1159,\n 0.0,\n 1.1888,\n 0.0,\n 1.2659,\n 0.0,\n 1.341,\n 0.0,\n 1.417,\n 0.0,\n 1.4922,\n 0.0,\n 1.5686\n ],\n \"array\": [\n 112.9688,\n 117.4043,\n 0.0,\n 126.0566,\n 0.0,\n 134.2988,\n 0.0,\n 143.0098,\n 0.0,\n 151.4863,\n 0.0,\n 160.0762,\n 0.0,\n 168.5723,\n 0.0,\n 177.1973\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 120.5977,\n 125.0508,\n 0.0,\n 134.6426,\n 0.0,\n 143.4199,\n 0.0,\n 152.0977,\n 0.0,\n 161.8984,\n 0.0,\n 170.9375,\n 0.0,\n 179.9824,\n 0.0,\n 189.5918\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0369,\n 0.0,\n 1.1165,\n 0.0,\n 1.1892,\n 0.0,\n 1.2612,\n 0.0,\n 1.3425,\n 0.0,\n 1.4174,\n 0.0,\n 1.4924,\n 0.0,\n 1.5721\n ],\n \"array\": [\n 120.5977,\n 125.0508,\n 0.0,\n 134.6426,\n 0.0,\n 143.4199,\n 0.0,\n 152.0977,\n 0.0,\n 161.8984,\n 0.0,\n 170.9375,\n 0.0,\n 179.9824,\n 0.0,\n 189.5918\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 28.6836,\n 29.7656,\n 0.0,\n 31.7148,\n 0.0,\n 33.8574,\n 0.0,\n 35.9883,\n 0.0,\n 38.0371,\n 0.0,\n 40.0293,\n 0.0,\n 42.0566,\n 0.0,\n 44.1426\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0377,\n 0.0,\n 1.1057,\n 0.0,\n 1.1804,\n 0.0,\n 1.2547,\n 0.0,\n 1.3261,\n 0.0,\n 1.3955,\n 0.0,\n 1.4662,\n 0.0,\n 1.5389\n ],\n \"array\": [\n 28.6836,\n 29.7656,\n 0.0,\n 31.7148,\n 0.0,\n 33.8574,\n 0.0,\n 35.9883,\n 0.0,\n 38.0371,\n 0.0,\n 40.0293,\n 0.0,\n 42.0566,\n 0.0,\n 44.1426\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 36.3184,\n 37.6211,\n 0.0,\n 40.3105,\n 0.0,\n 42.9082,\n 0.0,\n 45.5996,\n 0.0,\n 48.0859,\n 0.0,\n 50.8281,\n 0.0,\n 53.5566,\n 0.0,\n 56.0391\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0359,\n 0.0,\n 1.1099,\n 0.0,\n 1.1814,\n 0.0,\n 1.2556,\n 0.0,\n 1.324,\n 0.0,\n 1.3995,\n 0.0,\n 1.4746,\n 0.0,\n 1.543\n ],\n \"array\": [\n 36.3184,\n 37.6211,\n 0.0,\n 40.3105,\n 0.0,\n 42.9082,\n 0.0,\n 45.5996,\n 0.0,\n 48.0859,\n 0.0,\n 50.8281,\n 0.0,\n 53.5566,\n 0.0,\n 56.0391\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 44.0059,\n 45.6875,\n 0.0,\n 48.8105,\n 0.0,\n 52.1406,\n 0.0,\n 55.2734,\n 0.0,\n 58.6816,\n 0.0,\n 61.8809,\n 0.0,\n 64.957,\n 0.0,\n 68.3223\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0382,\n 0.0,\n 1.1092,\n 0.0,\n 1.1849,\n 0.0,\n 1.256,\n 0.0,\n 1.3335,\n 0.0,\n 1.4062,\n 0.0,\n 1.4761,\n 0.0,\n 1.5526\n ],\n \"array\": [\n 44.0059,\n 45.6875,\n 0.0,\n 48.8105,\n 0.0,\n 52.1406,\n 0.0,\n 55.2734,\n 0.0,\n 58.6816,\n 0.0,\n 61.8809,\n 0.0,\n 64.957,\n 0.0,\n 68.3223\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 51.6074,\n 53.5879,\n 0.0,\n 57.332,\n 0.0,\n 61.3027,\n 0.0,\n 64.8242,\n 0.0,\n 68.8086,\n 0.0,\n 73.0352,\n 0.0,\n 76.3535,\n 0.0,\n 80.4531\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0384,\n 0.0,\n 1.1109,\n 0.0,\n 1.1879,\n 0.0,\n 1.2561,\n 0.0,\n 1.3333,\n 0.0,\n 1.4152,\n 0.0,\n 1.4795,\n 0.0,\n 1.5589\n ],\n \"array\": [\n 51.6074,\n 53.5879,\n 0.0,\n 57.332,\n 0.0,\n 61.3027,\n 0.0,\n 64.8242,\n 0.0,\n 68.8086,\n 0.0,\n 73.0352,\n 0.0,\n 76.3535,\n 0.0,\n 80.4531\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 59.3145,\n 61.5527,\n 0.0,\n 65.9238,\n 0.0,\n 70.2969,\n 0.0,\n 74.8594,\n 0.0,\n 79.0996,\n 0.0,\n 83.5332,\n 0.0,\n 88.0059,\n 0.0,\n 92.3203\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0377,\n 0.0,\n 1.1114,\n 0.0,\n 1.1852,\n 0.0,\n 1.2621,\n 0.0,\n 1.3336,\n 0.0,\n 1.4083,\n 0.0,\n 1.4837,\n 0.0,\n 1.5565\n ],\n \"array\": [\n 59.3145,\n 61.5527,\n 0.0,\n 65.9238,\n 0.0,\n 70.2969,\n 0.0,\n 74.8594,\n 0.0,\n 79.0996,\n 0.0,\n 83.5332,\n 0.0,\n 88.0059,\n 0.0,\n 92.3203\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 66.9883,\n 69.4844,\n 0.0,\n 74.6094,\n 0.0,\n 79.6016,\n 0.0,\n 84.6738,\n 0.0,\n 89.3809,\n 0.0,\n 94.3184,\n 0.0,\n 99.7754,\n 0.0,\n 104.5137\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0373,\n 0.0,\n 1.1138,\n 0.0,\n 1.1883,\n 0.0,\n 1.264,\n 0.0,\n 1.3343,\n 0.0,\n 1.408,\n 0.0,\n 1.4894,\n 0.0,\n 1.5602\n ],\n \"array\": [\n 66.9883,\n 69.4844,\n 0.0,\n 74.6094,\n 0.0,\n 79.6016,\n 0.0,\n 84.6738,\n 0.0,\n 89.3809,\n 0.0,\n 94.3184,\n 0.0,\n 99.7754,\n 0.0,\n 104.5137\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 74.5957,\n 77.5566,\n 0.0,\n 82.7207,\n 0.0,\n 88.8125,\n 0.0,\n 94.1816,\n 0.0,\n 99.8301,\n 0.0,\n 105.5762,\n 0.0,\n 111.2852,\n 0.0,\n 116.7109\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.0397,\n 0.0,\n 1.1089,\n 0.0,\n 1.1906,\n 0.0,\n 1.2626,\n 0.0,\n 1.3383,\n 0.0,\n 1.4153,\n 0.0,\n 1.4918,\n 0.0,\n 1.5646\n ],\n \"array\": [\n 74.5957,\n 77.5566,\n 0.0,\n 82.7207,\n 0.0,\n 88.8125,\n 0.0,\n 94.1816,\n 0.0,\n 99.8301,\n 0.0,\n 105.5762,\n 0.0,\n 111.2852,\n 0.0,\n 116.7109\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 82.5586,\n 85.5273,\n 0.0,\n 91.5957,\n 0.0,\n 98.1387,\n 0.0,\n 103.9551,\n 0.0,\n 110.1367,\n 0.0,\n 116.4277,\n 0.0,\n 122.8672,\n 0.0,\n 128.5645\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.036,\n 0.0,\n 1.1095,\n 0.0,\n 1.1887,\n 0.0,\n 1.2592,\n 0.0,\n 1.334,\n 0.0,\n 1.4102,\n 0.0,\n 1.4882,\n 0.0,\n 1.5573\n ],\n \"array\": [\n 82.5586,\n 85.5273,\n 0.0,\n 91.5957,\n 0.0,\n 98.1387,\n 0.0,\n 103.9551,\n 0.0,\n 110.1367,\n 0.0,\n 116.4277,\n 0.0,\n 122.8672,\n 0.0,\n 128.5645\n ],\n \"batch_size\": 64,\n \"max_query_length\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 8.0069\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 8.0069\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 12.5812\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 12.5812\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 54.0957\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 54.0957\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 58.7422\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 58.7422\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 63.2969\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 63.2969\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 67.6172\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 67.6172\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 72.2734\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 72.2734\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 17.1309\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 17.1309\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 21.7988\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 21.7988\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 26.4199\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 26.4199\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 31.0605\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 31.0605\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 35.5586\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 35.5586\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 40.1758\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 40.1758\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 44.8477\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 44.8477\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 49.4648\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array\": [\n 49.4648\n ],\n \"batch_size\": 64,\n \"max_query_length\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2692.9208,\n 3771.2702,\n 5940.2112,\n 8100.9909,\n 10247.8473,\n 12410.5603,\n 14585.8448,\n 16759.0828,\n 18933.681\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.4004,\n 2.2059,\n 3.0083,\n 3.8055,\n 4.6086,\n 5.4164,\n 6.2234,\n 7.0309\n ],\n \"array_model\": [\n 2692.9208,\n 3771.2702,\n 5940.2112,\n 8100.9909,\n 10247.8473,\n 12410.5603,\n 14585.8448,\n 16759.0828,\n 18933.681\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 215.176,\n 218.608,\n 0.0,\n 238.4992,\n 0.0,\n 248.4992,\n 0.0,\n 265.176,\n 0.0,\n 279.176,\n 0.0,\n 293.696,\n 0.0,\n 308.9568,\n 0.0,\n 321.0592\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2815.5032,\n 3900.7246,\n 6073.2128,\n 8248.4245,\n 10401.3721,\n 12570.5219,\n 14752.7936,\n 16938.7692,\n 19120.553\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3854,\n 2.1571,\n 2.9296,\n 3.6943,\n 4.4648,\n 5.2398,\n 6.0162,\n 6.7912\n ],\n \"array_model\": [\n 2815.5032,\n 3900.7246,\n 6073.2128,\n 8248.4245,\n 10401.3721,\n 12570.5219,\n 14752.7936,\n 16938.7692,\n 19120.553\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 337.7584,\n 348.0624,\n 0.0,\n 371.5008,\n 0.0,\n 395.9328,\n 0.0,\n 418.7008,\n 0.0,\n 439.1376,\n 0.0,\n 460.6448,\n 0.0,\n 488.6432,\n 0.0,\n 507.9312\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3919.9016,\n 5042.6942,\n 7306.3376,\n 9568.0549,\n 11802.2649,\n 14062.8851,\n 16325.336,\n 18595.9692,\n 20866.9338\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.2864,\n 1.8639,\n 2.4409,\n 3.0109,\n 3.5876,\n 4.1647,\n 4.744,\n 5.3233\n ],\n \"array_model\": [\n 3919.9016,\n 5042.6942,\n 7306.3376,\n 9568.0549,\n 11802.2649,\n 14062.8851,\n 16325.336,\n 18595.9692,\n 20866.9338\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1442.1568,\n 1490.032,\n 0.0,\n 1604.6256,\n 0.0,\n 1715.5632,\n 0.0,\n 1819.5936,\n 0.0,\n 1931.5008,\n 0.0,\n 2033.1872,\n 0.0,\n 2145.8432,\n 0.0,\n 2254.312\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 4043.6504,\n 5172.6942,\n 7443.8064,\n 9715.7109,\n 11959.6713,\n 14222.9475,\n 16500.5552,\n 18780.0636,\n 21061.9338\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.2792,\n 1.8409,\n 2.4027,\n 2.9576,\n 3.5174,\n 4.0806,\n 4.6443,\n 5.2086\n ],\n \"array_model\": [\n 4043.6504,\n 5172.6942,\n 7443.8064,\n 9715.7109,\n 11959.6713,\n 14222.9475,\n 16500.5552,\n 18780.0636,\n 21061.9338\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1565.9056,\n 1620.032,\n 0.0,\n 1742.0944,\n 0.0,\n 1863.2192,\n 0.0,\n 1977.0,\n 0.0,\n 2091.5632,\n 0.0,\n 2208.4064,\n 0.0,\n 2329.9376,\n 0.0,\n 2449.312\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 4163.276,\n 5299.7246,\n 7579.5872,\n 9859.3973,\n 12112.9529,\n 14390.6339,\n 16678.7744,\n 18961.5948,\n 21258.2474\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.273,\n 1.8206,\n 2.3682,\n 2.9095,\n 3.4566,\n 4.0062,\n 4.5545,\n 5.1061\n ],\n \"array_model\": [\n 4163.276,\n 5299.7246,\n 7579.5872,\n 9859.3973,\n 12112.9529,\n 14390.6339,\n 16678.7744,\n 18961.5948,\n 21258.2474\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1685.5312,\n 1747.0624,\n 0.0,\n 1877.8752,\n 0.0,\n 2006.9056,\n 0.0,\n 2130.2816,\n 0.0,\n 2259.2496,\n 0.0,\n 2386.6256,\n 0.0,\n 2511.4688,\n 0.0,\n 2645.6256\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 4285.2456,\n 5431.131,\n 7718.6176,\n 10001.2725,\n 12270.8281,\n 14555.1651,\n 16853.368,\n 19147.2828,\n 21447.7786\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.2674,\n 1.8012,\n 2.3339,\n 2.8635,\n 3.3966,\n 3.9329,\n 4.4682,\n 5.005\n ],\n \"array_model\": [\n 4285.2456,\n 5431.131,\n 7718.6176,\n 10001.2725,\n 12270.8281,\n 14555.1651,\n 16853.368,\n 19147.2828,\n 21447.7786\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1807.5008,\n 1878.4688,\n 0.0,\n 2016.9056,\n 0.0,\n 2148.7808,\n 0.0,\n 2288.1568,\n 0.0,\n 2423.7808,\n 0.0,\n 2561.2192,\n 0.0,\n 2697.1568,\n 0.0,\n 2835.1568\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 4407.308,\n 5553.475,\n 7855.9936,\n 10147.2101,\n 12416.2345,\n 14721.7587,\n 17027.1488,\n 19329.8444,\n 21646.0906\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.2601,\n 1.7825,\n 2.3024,\n 2.8172,\n 3.3403,\n 3.8634,\n 4.3859,\n 4.9114\n ],\n \"array_model\": [\n 4407.308,\n 5553.475,\n 7855.9936,\n 10147.2101,\n 12416.2345,\n 14721.7587,\n 17027.1488,\n 19329.8444,\n 21646.0906\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1929.5632,\n 2000.8128,\n 0.0,\n 2154.2816,\n 0.0,\n 2294.7184,\n 0.0,\n 2433.5632,\n 0.0,\n 2590.3744,\n 0.0,\n 2735.0,\n 0.0,\n 2879.7184,\n 0.0,\n 3033.4688\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2936.6824,\n 4028.9118,\n 6209.1488,\n 8394.2101,\n 10558.4841,\n 12739.9779,\n 14932.6176,\n 17123.0316,\n 19318.9034\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3719,\n 2.1143,\n 2.8584,\n 3.5954,\n 4.3382,\n 5.0849,\n 5.8307,\n 6.5785\n ],\n \"array_model\": [\n 2936.6824,\n 4028.9118,\n 6209.1488,\n 8394.2101,\n 10558.4841,\n 12739.9779,\n 14932.6176,\n 17123.0316,\n 19318.9034\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 458.9376,\n 476.2496,\n 0.0,\n 507.4368,\n 0.0,\n 541.7184,\n 0.0,\n 575.8128,\n 0.0,\n 608.5936,\n 0.0,\n 640.4688,\n 0.0,\n 672.9056,\n 0.0,\n 706.2816\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3058.8392,\n 4154.5998,\n 6346.68,\n 8539.0229,\n 10712.2649,\n 12900.7587,\n 15105.3984,\n 17307.0316,\n 19509.2474\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3582,\n 2.0749,\n 2.7916,\n 3.5021,\n 4.2175,\n 4.9383,\n 5.658,\n 6.378\n ],\n \"array_model\": [\n 3058.8392,\n 4154.5998,\n 6346.68,\n 8539.0229,\n 10712.2649,\n 12900.7587,\n 15105.3984,\n 17307.0316,\n 19509.2474\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 581.0944,\n 601.9376,\n 0.0,\n 644.968,\n 0.0,\n 686.5312,\n 0.0,\n 729.5936,\n 0.0,\n 769.3744,\n 0.0,\n 813.2496,\n 0.0,\n 856.9056,\n 0.0,\n 896.6256\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3181.8392,\n 4283.6622,\n 6482.68,\n 8686.7413,\n 10867.0457,\n 13070.2899,\n 15282.2432,\n 17489.438,\n 19705.7786\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3463,\n 2.0374,\n 2.7301,\n 3.4153,\n 4.1078,\n 4.803,\n 5.4966,\n 6.1932\n ],\n \"array_model\": [\n 3181.8392,\n 4283.6622,\n 6482.68,\n 8686.7413,\n 10867.0457,\n 13070.2899,\n 15282.2432,\n 17489.438,\n 19705.7786\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 704.0944,\n 731.0,\n 0.0,\n 780.968,\n 0.0,\n 834.2496,\n 0.0,\n 884.3744,\n 0.0,\n 938.9056,\n 0.0,\n 990.0944,\n 0.0,\n 1039.312,\n 0.0,\n 1093.1568\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3303.4632,\n 4410.0686,\n 6619.024,\n 8833.3349,\n 11019.8585,\n 13232.3219,\n 15460.712,\n 17671.782,\n 19899.8714\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.335,\n 2.0037,\n 2.674,\n 3.3359,\n 4.0056,\n 4.6802,\n 5.3495,\n 6.0239\n ],\n \"array_model\": [\n 3303.4632,\n 4410.0686,\n 6619.024,\n 8833.3349,\n 11019.8585,\n 13232.3219,\n 15460.712,\n 17671.782,\n 19899.8714\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 825.7184,\n 857.4064,\n 0.0,\n 917.312,\n 0.0,\n 980.8432,\n 0.0,\n 1037.1872,\n 0.0,\n 1100.9376,\n 0.0,\n 1168.5632,\n 0.0,\n 1221.656,\n 0.0,\n 1287.2496\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3426.7768,\n 4537.5054,\n 6756.4928,\n 8977.2421,\n 11180.4217,\n 13396.9779,\n 15628.68,\n 17858.2204,\n 20089.7466\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3241,\n 1.9717,\n 2.6197,\n 3.2627,\n 3.9095,\n 4.5608,\n 5.2114,\n 5.8626\n ],\n \"array_model\": [\n 3426.7768,\n 4537.5054,\n 6756.4928,\n 8977.2421,\n 11180.4217,\n 13396.9779,\n 15628.68,\n 17858.2204,\n 20089.7466\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 949.032,\n 984.8432,\n 0.0,\n 1054.7808,\n 0.0,\n 1124.7504,\n 0.0,\n 1197.7504,\n 0.0,\n 1265.5936,\n 0.0,\n 1336.5312,\n 0.0,\n 1408.0944,\n 0.0,\n 1477.1248\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3549.5576,\n 4664.4126,\n 6895.4624,\n 9126.1173,\n 11337.4521,\n 13561.4787,\n 15801.2432,\n 18046.5324,\n 20284.841\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3141,\n 1.9426,\n 2.5711,\n 3.194,\n 3.8206,\n 4.4516,\n 5.0842,\n 5.7148\n ],\n \"array_model\": [\n 3549.5576,\n 4664.4126,\n 6895.4624,\n 9126.1173,\n 11337.4521,\n 13561.4787,\n 15801.2432,\n 18046.5324,\n 20284.841\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1071.8128,\n 1111.7504,\n 0.0,\n 1193.7504,\n 0.0,\n 1273.6256,\n 0.0,\n 1354.7808,\n 0.0,\n 1430.0944,\n 0.0,\n 1509.0944,\n 0.0,\n 1596.4064,\n 0.0,\n 1672.2192\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3671.276,\n 4793.5678,\n 7025.2432,\n 9273.4917,\n 11489.5769,\n 13728.6659,\n 15981.368,\n 18230.6892,\n 20479.9962\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.3057,\n 1.9136,\n 2.526,\n 3.1296,\n 3.7395,\n 4.3531,\n 4.9658,\n 5.5784\n ],\n \"array_model\": [\n 3671.276,\n 4793.5678,\n 7025.2432,\n 9273.4917,\n 11489.5769,\n 13728.6659,\n 15981.368,\n 18230.6892,\n 20479.9962\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1193.5312,\n 1240.9056,\n 0.0,\n 1323.5312,\n 0.0,\n 1421.0,\n 0.0,\n 1506.9056,\n 0.0,\n 1597.2816,\n 0.0,\n 1689.2192,\n 0.0,\n 1780.5632,\n 0.0,\n 1867.3744\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 3798.6824,\n 4921.099,\n 7167.2432,\n 9422.7109,\n 11645.9529,\n 13893.5715,\n 16154.992,\n 18416.0012,\n 20669.6538\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 5,\n 7,\n 9,\n 11,\n 13,\n 15\n ],\n \"ratio\": [\n 1.0,\n 1.2955,\n 1.8868,\n 2.4805,\n 3.0658,\n 3.6575,\n 4.2528,\n 4.848,\n 5.4413\n ],\n \"array_model\": [\n 3798.6824,\n 4921.099,\n 7167.2432,\n 9422.7109,\n 11645.9529,\n 13893.5715,\n 16154.992,\n 18416.0012,\n 20669.6538\n ],\n \"array_query\": [\n 2477.7448,\n 3552.6622,\n 5701.712,\n 7852.4917,\n 9982.6713,\n 12131.3843,\n 14292.1488,\n 16450.126,\n 18612.6218\n ],\n \"array_cache\": [\n 1320.9376,\n 1368.4368,\n 0.0,\n 1465.5312,\n 0.0,\n 1570.2192,\n 0.0,\n 1663.2816,\n 0.0,\n 1762.1872,\n 0.0,\n 1862.8432,\n 0.0,\n 1965.8752,\n 0.0,\n 2057.032\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 16,\n \"max_query_length_cache\": 16,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 358.6545\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 358.6545\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 8.0069\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 363.2288\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 363.2288\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 12.5812\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 404.7433\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 404.7433\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 54.0957\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 409.3898\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 409.3898\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 58.7422\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 413.9445\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 413.9445\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 63.2969\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 418.2648\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 418.2648\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 67.6172\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 422.921\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 422.921\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 72.2734\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 367.7785\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 367.7785\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 17.1309\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 372.4464\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 372.4464\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 21.7988\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 377.0675\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 377.0675\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 26.4199\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 381.7081\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 381.7081\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 31.0605\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 386.2062\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 386.2062\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 35.5586\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 390.8234\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 390.8234\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 40.1758\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 395.4953\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 395.4953\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 44.8477\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 400.1124\n ],\n \"index\": [\n 0\n ],\n \"ratio\": [\n 1.0\n ],\n \"array_model\": [\n 400.1124\n ],\n \"array_query\": [\n 350.6476\n ],\n \"array_cache\": [\n 49.4648\n ],\n \"batch_size\": 64,\n \"max_query_length_query\": 1,\n \"max_query_length_cache\": 1,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_64/query_llm/query_1.json": "{\n \"mean\": 2477.7448,\n \"array\": [\n 2429.824,\n 2482.824,\n 2421.2416,\n 2484.2416,\n 2532.2416,\n 2428.0624,\n 2502.0624,\n 2475.9056,\n 2555.9056,\n 2492.9056,\n 2544.9056,\n 2494.2816,\n 2544.2816,\n 2493.968,\n 2495.968,\n 2413.1872,\n 2481.1872,\n 2469.4688,\n 2453.4688,\n 2393.0624,\n 2442.0624,\n 2473.8432,\n 2511.8432,\n 2435.0944,\n 2509.0944,\n 2580.0944,\n 2460.4688,\n 2566.4688,\n 2406.4992,\n 2539.4992,\n 2481.4368,\n 2523.4368,\n 2457.824,\n 2491.824,\n 2450.2416,\n 2445.2416,\n 2524.2416,\n 2464.0624,\n 2513.0624,\n 2492.9056,\n 2476.9056,\n 2456.9056,\n 2487.9056,\n 2421.2816,\n 2501.2816,\n 2420.968,\n 2458.968,\n 2414.1872,\n 2501.1872,\n 2415.4688,\n 2501.4688,\n 2453.0624,\n 2442.0624,\n 2450.8432,\n 2471.8432,\n 2465.0944,\n 2496.0944,\n 2564.0944,\n 2444.4688,\n 2479.4688,\n 2471.4992,\n 2476.4992,\n 2435.4368,\n 2510.4368\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_10.json": "{\n \"mean\": 12131.3843,\n \"array\": [\n 11964.824,\n 12197.824,\n 12025.8624,\n 12225.8624,\n 12218.8624,\n 11986.4064,\n 12234.4064,\n 12157.6256,\n 12215.6256,\n 11979.0944,\n 12220.0944,\n 12232.0624,\n 12154.0624,\n 12308.4064,\n 11997.4064,\n 11963.9056,\n 12079.9056,\n 12021.7184,\n 12127.7184,\n 11986.8128,\n 12282.8128,\n 12213.4992,\n 12326.4992,\n 12054.4368,\n 12210.4368,\n 12024.4368,\n 12079.7504,\n 12311.7504,\n 12071.2192,\n 12051.2192,\n 11977.6256,\n 12354.6256,\n 12079.824,\n 12307.824,\n 12114.8624,\n 12070.8624,\n 12049.8624,\n 12208.4064,\n 12077.4064,\n 12173.6256,\n 12193.6256,\n 12305.0944,\n 12097.0944,\n 11933.0624,\n 12155.0624,\n 11925.4064,\n 12064.4064,\n 12060.9056,\n 12118.9056,\n 12066.7184,\n 12071.7184,\n 12274.8128,\n 12082.8128,\n 11917.4992,\n 12089.4992,\n 12276.4368,\n 11996.4368,\n 12222.4368,\n 12135.7504,\n 12314.7504,\n 12132.2192,\n 12232.2192,\n 12094.6256,\n 12307.6256\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_12.json": "{\n \"mean\": 14292.1488,\n \"array\": [\n 14439.304,\n 14332.304,\n 14174.3552,\n 14441.3552,\n 14177.3552,\n 14250.5312,\n 14420.5312,\n 14416.7504,\n 14348.7504,\n 14187.9056,\n 14381.9056,\n 14060.4368,\n 14528.4368,\n 14339.4688,\n 14302.4688,\n 14141.9056,\n 14470.9056,\n 14047.7808,\n 14401.7808,\n 14145.1568,\n 14363.1568,\n 14256.8128,\n 14157.8128,\n 14264.5936,\n 14225.5936,\n 14636.5936,\n 14308.3744,\n 14286.3744,\n 14349.7808,\n 14382.7808,\n 14247.0,\n 14444.0,\n 14085.304,\n 14283.304,\n 14004.3552,\n 14213.3552,\n 14535.3552,\n 14260.5312,\n 14279.5312,\n 14296.7504,\n 14356.7504,\n 14325.9056,\n 14552.9056,\n 14368.4368,\n 14145.4368,\n 14331.4688,\n 14154.4688,\n 14285.9056,\n 14206.9056,\n 14454.7808,\n 14159.7808,\n 14352.1568,\n 14468.1568,\n 14269.8128,\n 14158.8128,\n 14053.5936,\n 14092.5936,\n 14224.5936,\n 14439.3744,\n 14155.3744,\n 14199.7808,\n 14561.7808,\n 14097.0,\n 14391.0\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_14.json": "{\n \"mean\": 16450.126,\n \"array\": [\n 16524.0432,\n 16298.0432,\n 16603.3568,\n 16323.3568,\n 16486.3568,\n 16247.0944,\n 16447.0944,\n 16621.0944,\n 16514.0944,\n 16445.688,\n 16523.688,\n 16624.344,\n 16296.344,\n 16382.9056,\n 16495.9056,\n 16375.5936,\n 16361.5936,\n 16316.4368,\n 16284.4368,\n 16297.1248,\n 16406.1248,\n 16373.1568,\n 16346.1568,\n 16627.0624,\n 16457.0624,\n 16646.0624,\n 16166.5312,\n 16685.5312,\n 16378.8432,\n 16357.8432,\n 16160.2816,\n 16771.2816,\n 16358.0432,\n 16546.0432,\n 16580.3568,\n 16245.3568,\n 16734.3568,\n 16672.0944,\n 16428.0944,\n 16239.0944,\n 16646.0944,\n 16668.688,\n 16579.688,\n 16158.344,\n 16295.344,\n 16200.9056,\n 16567.9056,\n 16458.5936,\n 16438.5936,\n 16594.4368,\n 16526.4368,\n 16119.1248,\n 16420.1248,\n 16469.1568,\n 16321.1568,\n 16111.0624,\n 16673.0624,\n 16648.0624,\n 16496.5312,\n 16666.5312,\n 16235.8432,\n 16507.8432,\n 16633.2816,\n 16723.2816\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_16.json": "{\n \"mean\": 18612.6218,\n \"array\": [\n 18340.9408,\n 18334.9408,\n 18382.0688,\n 18321.0688,\n 18928.0688,\n 18608.7184,\n 18429.7184,\n 18827.3744,\n 18848.3744,\n 18501.8432,\n 18514.8432,\n 18275.7504,\n 18501.7504,\n 18842.8752,\n 18832.8752,\n 18428.7808,\n 18434.7808,\n 18429.6256,\n 18771.6256,\n 18281.968,\n 18798.968,\n 18768.688,\n 18325.688,\n 18582.688,\n 18692.688,\n 18402.688,\n 18721.3744,\n 18791.3744,\n 18642.8432,\n 18976.8432,\n 18639.5312,\n 18450.5312,\n 18727.9408,\n 18809.9408,\n 18346.0688,\n 18843.0688,\n 18976.0688,\n 18837.7184,\n 18963.7184,\n 18601.3744,\n 18630.3744,\n 18792.8432,\n 18952.8432,\n 18355.7504,\n 18807.7504,\n 18672.8752,\n 18461.8752,\n 18329.7808,\n 18657.7808,\n 18266.6256,\n 18477.6256,\n 18502.968,\n 18850.968,\n 18632.688,\n 18552.688,\n 18500.688,\n 18670.688,\n 18887.688,\n 18282.3744,\n 18374.3744,\n 18888.8432,\n 18521.8432,\n 18558.5312,\n 18839.5312\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_2.json": "{\n \"mean\": 3552.6622,\n \"array\": [\n 3490.392,\n 3609.392,\n 3463.9376,\n 3565.9376,\n 3630.9376,\n 3513.7504,\n 3574.7504,\n 3600.0624,\n 3597.0624,\n 3513.0,\n 3539.0,\n 3467.5936,\n 3551.5936,\n 3530.1568,\n 3620.1568,\n 3525.2496,\n 3612.2496,\n 3488.0944,\n 3613.0944,\n 3506.5632,\n 3608.5632,\n 3480.968,\n 3531.968,\n 3453.968,\n 3595.968,\n 3670.968,\n 3483.9376,\n 3540.9376,\n 3579.5312,\n 3542.5312,\n 3544.1872,\n 3622.1872,\n 3496.392,\n 3567.392,\n 3502.9376,\n 3606.9376,\n 3626.9376,\n 3484.7504,\n 3661.7504,\n 3523.0624,\n 3553.0624,\n 3566.0,\n 3534.0,\n 3545.5936,\n 3572.5936,\n 3482.1568,\n 3520.1568,\n 3470.2496,\n 3543.2496,\n 3546.0944,\n 3584.0944,\n 3523.5632,\n 3566.5632,\n 3491.968,\n 3528.968,\n 3482.968,\n 3486.968,\n 3685.968,\n 3523.9376,\n 3670.9376,\n 3607.5312,\n 3617.5312,\n 3509.1872,\n 3618.1872\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_4.json": "{\n \"mean\": 5701.712,\n \"array\": [\n 5642.5008,\n 5666.5008,\n 5547.4992,\n 5716.4992,\n 5819.4992,\n 5781.5632,\n 5838.5632,\n 5674.032,\n 5721.032,\n 5769.032,\n 5698.032,\n 5674.688,\n 5642.688,\n 5594.2192,\n 5731.2192,\n 5737.2496,\n 5656.2496,\n 5584.4688,\n 5725.4688,\n 5601.4688,\n 5749.4688,\n 5695.3744,\n 5733.3744,\n 5563.9056,\n 5685.9056,\n 5720.9056,\n 5662.1248,\n 5648.1248,\n 5734.0944,\n 5652.0944,\n 5787.7184,\n 5745.7184,\n 5681.5008,\n 5749.5008,\n 5651.4992,\n 5718.4992,\n 5735.4992,\n 5744.5632,\n 5751.5632,\n 5752.032,\n 5697.032,\n 5713.032,\n 5673.032,\n 5705.688,\n 5744.688,\n 5756.2192,\n 5743.2192,\n 5613.2496,\n 5721.2496,\n 5748.4688,\n 5734.4688,\n 5661.4688,\n 5804.4688,\n 5649.3744,\n 5636.3744,\n 5534.9056,\n 5628.9056,\n 5700.9056,\n 5685.1248,\n 5793.1248,\n 5665.0944,\n 5817.0944,\n 5710.7184,\n 5785.7184\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_6.json": "{\n \"mean\": 7852.4917,\n \"array\": [\n 7836.5008,\n 7831.5008,\n 7680.0672,\n 7931.0672,\n 7873.0672,\n 7790.2816,\n 8002.2816,\n 7740.4688,\n 7982.4688,\n 7890.7504,\n 7864.7504,\n 7829.1568,\n 7850.1568,\n 7825.2496,\n 7916.2496,\n 7762.3744,\n 7829.3744,\n 7839.0,\n 7839.0,\n 7812.7808,\n 7764.7808,\n 7767.4368,\n 7886.4368,\n 7715.7808,\n 7752.7808,\n 8061.7808,\n 7827.0944,\n 7909.0944,\n 7708.2192,\n 7827.2192,\n 7751.2816,\n 7875.2816,\n 7859.5008,\n 7971.5008,\n 7781.0672,\n 7733.0672,\n 7881.0672,\n 7852.2816,\n 7846.2816,\n 7810.4688,\n 8006.4688,\n 7928.7504,\n 8016.7504,\n 7749.1568,\n 8001.1568,\n 7923.2496,\n 7993.2496,\n 7679.3744,\n 7947.3744,\n 7755.0,\n 7783.0,\n 7872.7808,\n 7985.7808,\n 7827.4368,\n 7768.4368,\n 7883.7808,\n 7888.7808,\n 7965.7808,\n 7696.0944,\n 7943.0944,\n 7733.2192,\n 7851.2192,\n 7913.2816,\n 7937.2816\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_llm/query_8.json": "{\n \"mean\": 9982.6713,\n \"array\": [\n 10014.824,\n 10046.824,\n 9951.2992,\n 9965.2992,\n 10227.2992,\n 10102.1872,\n 9950.1872,\n 10058.4064,\n 9978.4064,\n 10001.6256,\n 9994.6256,\n 9832.8128,\n 10097.8128,\n 9898.2496,\n 9876.2496,\n 9868.2192,\n 9920.2192,\n 9803.0944,\n 10056.0944,\n 9794.7184,\n 10023.7184,\n 9833.4064,\n 10103.4064,\n 9801.0,\n 10102.0,\n 9973.0,\n 9937.7184,\n 9997.7184,\n 10112.8432,\n 10215.8432,\n 9954.4368,\n 10137.4368,\n 9791.824,\n 9862.824,\n 9803.2992,\n 9928.2992,\n 10140.2992,\n 10062.1872,\n 10045.1872,\n 10017.4064,\n 9912.4064,\n 9907.6256,\n 10065.6256,\n 9852.8128,\n 10018.8128,\n 10124.2496,\n 9915.2496,\n 9904.2192,\n 9963.2192,\n 10018.0944,\n 9945.0944,\n 10107.7184,\n 10084.7184,\n 9941.4064,\n 9888.4064,\n 9749.0,\n 9906.0,\n 10181.0,\n 9917.7184,\n 10020.7184,\n 10070.8432,\n 9927.8432,\n 9981.4368,\n 10204.4368\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}", "bs_64/query_slm/query_1.json": "{\n \"mean\": 350.6476,\n \"array\": [\n 350.4931,\n 348.1181,\n 348.4188,\n 351.4188,\n 357.4188,\n 354.3691,\n 348.1191,\n 349.9512,\n 350.5762,\n 354.2051,\n 346.8301,\n 350.6895,\n 348.5645,\n 346.4414,\n 350.6914,\n 353.5742,\n 348.9492,\n 347.0273,\n 351.0273,\n 346.4102,\n 352.2852,\n 354.0293,\n 346.4043,\n 345.6328,\n 356.0078,\n 353.7578,\n 347.7031,\n 347.4531,\n 354.7578,\n 350.5078,\n 351.6016,\n 353.7266,\n 344.1181,\n 345.9931,\n 352.1688,\n 352.5438,\n 352.1688,\n 347.7441,\n 353.9941,\n 352.4512,\n 349.4512,\n 353.8301,\n 348.4551,\n 346.0645,\n 353.0645,\n 344.4414,\n 357.5664,\n 346.4492,\n 355.6992,\n 353.1523,\n 351.5273,\n 351.0352,\n 356.2852,\n 348.7793,\n 347.1543,\n 352.7578,\n 348.3828,\n 346.8828,\n 352.9531,\n 353.9531,\n 344.8828,\n 352.6328,\n 351.3516,\n 356.3516\n ],\n \"batch_size\": 64,\n \"instability_rate\": 0.0\n}"}, "cost_files_high_intensity": {"bs_1/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 2.1484,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1914,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.25,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3652,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5801\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.02,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0473,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1009,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2009\n ],\n \"array\": [\n 2.1484,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1914,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.25,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3652,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5801\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 2.2715,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4375,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6289,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9941\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0731,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1574,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3181\n ],\n \"array\": [\n 2.2715,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4375,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6289,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9941\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 3.334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7129,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.1387,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.998,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.6875\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1136,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2414,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4991,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0059\n ],\n \"array\": [\n 3.334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7129,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.1387,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.998,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.6875\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 3.4648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.8711,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.2578,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.0781\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1172,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2508,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5175,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0428\n ],\n \"array\": [\n 3.4648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.8711,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.2578,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.0781\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 3.5938,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0273,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.5156,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.5234,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4941\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1207,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2565,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.537,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0853\n ],\n \"array\": [\n 3.5938,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0273,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.5156,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.5234,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4941\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 3.7012,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.1777,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.6992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.7715,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.9238\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1288,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2697,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1409\n ],\n \"array\": [\n 3.7012,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.1777,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.6992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.7715,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.9238\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 3.8223,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.3301,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.9102,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.0391,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.3164\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1329,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2846,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.58,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1758\n ],\n \"array\": [\n 3.8223,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.3301,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.9102,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.0391,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.3164\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 2.3828,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.498,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6328,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8848,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.4023\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0484,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1049,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2107,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4279\n ],\n \"array\": [\n 2.3828,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.498,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6328,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8848,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.4023\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 2.5059,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6543,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8203,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1426,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.8047\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0592,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1255,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2541,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5183\n ],\n \"array\": [\n 2.5059,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6543,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8203,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1426,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.8047\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 2.625,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8066,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.416,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.2324\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0692,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1429,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3013,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6124\n ],\n \"array\": [\n 2.625,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8066,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.416,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.2324\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 2.7363,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1953,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.666,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.6152\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0835,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1677,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3398,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6867\n ],\n \"array\": [\n 2.7363,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1953,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.666,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.6152\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 2.8672,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1055,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.3789,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.9277,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.041\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0831,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1785,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3699,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7582\n ],\n \"array\": [\n 2.8672,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1055,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.3789,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.9277,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.041\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 2.9863,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.2656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.5684,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.1973,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.4531\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0935,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4055,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.826\n ],\n \"array\": [\n 2.9863,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.2656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.5684,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.1973,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.4531\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 3.1016,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.4082,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7578,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.4492,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.8594\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0989,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2116,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4345,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8892\n ],\n \"array\": [\n 3.1016,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.4082,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7578,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.4492,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.8594\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 3.2324,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.5527,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.9609,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.7266,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.2656\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0991,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2254,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4622,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9384\n ],\n \"array\": [\n 3.2324,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.5527,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.9609,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.7266,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.2656\n ],\n \"batch_size\": 1,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 1.2793,\n 1.2812,\n 0.0,\n 1.2812,\n 0.0,\n 0.0,\n 0.0,\n 1.3105\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0015,\n 0.0,\n 1.0015,\n 0.0,\n 0.0,\n 0.0,\n 1.0244\n ],\n \"array\": [\n 1.2793,\n 1.2812,\n 0.0,\n 1.2812,\n 0.0,\n 0.0,\n 0.0,\n 1.3105\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 1.3535,\n 1.3516,\n 0.0,\n 1.3633,\n 0.0,\n 0.0,\n 0.0,\n 1.4043\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 0.9986,\n 0.0,\n 1.0072,\n 0.0,\n 0.0,\n 0.0,\n 1.0375\n ],\n \"array\": [\n 1.3535,\n 1.3516,\n 0.0,\n 1.3633,\n 0.0,\n 0.0,\n 0.0,\n 1.4043\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 1.9902,\n 2.0273,\n 0.0,\n 2.0918,\n 0.0,\n 0.0,\n 0.0,\n 2.2148\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0186,\n 0.0,\n 1.051,\n 0.0,\n 0.0,\n 0.0,\n 1.1129\n ],\n \"array\": [\n 1.9902,\n 2.0273,\n 0.0,\n 2.0918,\n 0.0,\n 0.0,\n 0.0,\n 2.2148\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 2.0684,\n 2.1094,\n 0.0,\n 2.1719,\n 0.0,\n 0.0,\n 0.0,\n 2.3105\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0198,\n 0.0,\n 1.05,\n 0.0,\n 0.0,\n 0.0,\n 1.1171\n ],\n \"array\": [\n 2.0684,\n 2.1094,\n 0.0,\n 2.1719,\n 0.0,\n 0.0,\n 0.0,\n 2.3105\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 2.1387,\n 2.1719,\n 0.0,\n 2.248,\n 0.0,\n 0.0,\n 0.0,\n 2.3984\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0155,\n 0.0,\n 1.0511,\n 0.0,\n 0.0,\n 0.0,\n 1.1215\n ],\n \"array\": [\n 2.1387,\n 2.1719,\n 0.0,\n 2.248,\n 0.0,\n 0.0,\n 0.0,\n 2.3984\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 2.209,\n 2.2461,\n 0.0,\n 2.3242,\n 0.0,\n 0.0,\n 0.0,\n 2.4922\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0168,\n 0.0,\n 1.0522,\n 0.0,\n 0.0,\n 0.0,\n 1.1282\n ],\n \"array\": [\n 2.209,\n 2.2461,\n 0.0,\n 2.3242,\n 0.0,\n 0.0,\n 0.0,\n 2.4922\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 2.2773,\n 2.3281,\n 0.0,\n 2.4062,\n 0.0,\n 0.0,\n 0.0,\n 2.5898\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0223,\n 0.0,\n 1.0566,\n 0.0,\n 0.0,\n 0.0,\n 1.1372\n ],\n \"array\": [\n 2.2773,\n 2.3281,\n 0.0,\n 2.4062,\n 0.0,\n 0.0,\n 0.0,\n 2.5898\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 1.418,\n 1.4277,\n 0.0,\n 1.4473,\n 0.0,\n 0.0,\n 0.0,\n 1.4766\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0069,\n 0.0,\n 1.0207,\n 0.0,\n 0.0,\n 0.0,\n 1.0413\n ],\n \"array\": [\n 1.418,\n 1.4277,\n 0.0,\n 1.4473,\n 0.0,\n 0.0,\n 0.0,\n 1.4766\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 1.4941,\n 1.5059,\n 0.0,\n 1.5273,\n 0.0,\n 0.0,\n 0.0,\n 1.584\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0078,\n 0.0,\n 1.0222,\n 0.0,\n 0.0,\n 0.0,\n 1.0601\n ],\n \"array\": [\n 1.4941,\n 1.5059,\n 0.0,\n 1.5273,\n 0.0,\n 0.0,\n 0.0,\n 1.584\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 1.5664,\n 1.5762,\n 0.0,\n 1.6016,\n 0.0,\n 0.0,\n 0.0,\n 1.666\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0062,\n 0.0,\n 1.0224,\n 0.0,\n 0.0,\n 0.0,\n 1.0636\n ],\n \"array\": [\n 1.5664,\n 1.5762,\n 0.0,\n 1.6016,\n 0.0,\n 0.0,\n 0.0,\n 1.666\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 1.6387,\n 1.6523,\n 0.0,\n 1.6875,\n 0.0,\n 0.0,\n 0.0,\n 1.7637\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0083,\n 0.0,\n 1.0298,\n 0.0,\n 0.0,\n 0.0,\n 1.0763\n ],\n \"array\": [\n 1.6387,\n 1.6523,\n 0.0,\n 1.6875,\n 0.0,\n 0.0,\n 0.0,\n 1.7637\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 1.707,\n 1.7305,\n 0.0,\n 1.7773,\n 0.0,\n 0.0,\n 0.0,\n 1.8496\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0137,\n 0.0,\n 1.0412,\n 0.0,\n 0.0,\n 0.0,\n 1.0835\n ],\n \"array\": [\n 1.707,\n 1.7305,\n 0.0,\n 1.7773,\n 0.0,\n 0.0,\n 0.0,\n 1.8496\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 1.7754,\n 1.7988,\n 0.0,\n 1.8457,\n 0.0,\n 0.0,\n 0.0,\n 1.9395\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0132,\n 0.0,\n 1.0396,\n 0.0,\n 0.0,\n 0.0,\n 1.0924\n ],\n \"array\": [\n 1.7754,\n 1.7988,\n 0.0,\n 1.8457,\n 0.0,\n 0.0,\n 0.0,\n 1.9395\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 1.8516,\n 1.875,\n 0.0,\n 1.9375,\n 0.0,\n 0.0,\n 0.0,\n 2.0352\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0127,\n 0.0,\n 1.0464,\n 0.0,\n 0.0,\n 0.0,\n 1.0992\n ],\n \"array\": [\n 1.8516,\n 1.875,\n 0.0,\n 1.9375,\n 0.0,\n 0.0,\n 0.0,\n 2.0352\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 1.9277,\n 1.9453,\n 0.0,\n 2.0098,\n 0.0,\n 0.0,\n 0.0,\n 2.1309\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0091,\n 0.0,\n 1.0426,\n 0.0,\n 0.0,\n 0.0,\n 1.1054\n ],\n \"array\": [\n 1.9277,\n 1.9453,\n 0.0,\n 2.0098,\n 0.0,\n 0.0,\n 0.0,\n 2.1309\n ],\n \"batch_size\": 1,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1451.5609,\n 1569.9581,\n 1703.7803,\n 1972.6245,\n 2517.3883\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0816,\n 1.1738,\n 1.359,\n 1.7343\n ],\n \"array_model\": [\n 1451.5609,\n 1569.9581,\n 1703.7803,\n 1972.6245,\n 2517.3883\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 34.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 35.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 36.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 37.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 41.2816\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1453.5305,\n 1572.4893,\n 1706.7803,\n 1976.8437,\n 2524.0123\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0818,\n 1.1742,\n 1.36,\n 1.7365\n ],\n \"array_model\": [\n 1453.5305,\n 1572.4893,\n 1706.7803,\n 1976.8437,\n 2524.0123\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 36.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 37.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 47.9056\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1470.5305,\n 1594.3021,\n 1733.9995,\n 2014.7493,\n 2583.1067\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0842,\n 1.1792,\n 1.3701,\n 1.7566\n ],\n \"array_model\": [\n 1470.5305,\n 1594.3021,\n 1733.9995,\n 2014.7493,\n 2583.1067\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 53.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 59.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 66.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 79.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 107.0\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1472.6233,\n 1596.8333,\n 1737.1243,\n 2018.9061,\n 2589.3563\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0843,\n 1.1796,\n 1.371,\n 1.7583\n ],\n \"array_model\": [\n 1472.6233,\n 1596.8333,\n 1737.1243,\n 2018.9061,\n 2589.3563\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 55.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 61.9376,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 69.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 84.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 113.2496\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1474.6873,\n 1599.3325,\n 1740.0299,\n 2023.1557,\n 2596.0123\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0845,\n 1.1799,\n 1.3719,\n 1.7604\n ],\n \"array_model\": [\n 1474.6873,\n 1599.3325,\n 1740.0299,\n 2023.1557,\n 2596.0123\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 57.5008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 64.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 72.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 88.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 119.9056\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1476.4057,\n 1601.7389,\n 1742.9675,\n 2027.1253,\n 2602.8875\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0849,\n 1.1805,\n 1.373,\n 1.763\n ],\n \"array_model\": [\n 1476.4057,\n 1601.7389,\n 1742.9675,\n 2027.1253,\n 2602.8875\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 59.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 66.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 75.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 92.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 126.7808\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1478.3433,\n 1604.1773,\n 1746.3435,\n 2031.4069,\n 2609.1691\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0851,\n 1.1813,\n 1.3741,\n 1.7649\n ],\n \"array_model\": [\n 1478.3433,\n 1604.1773,\n 1746.3435,\n 2031.4069,\n 2609.1691\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 61.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 69.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 78.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 96.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 133.0624\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1455.3113,\n 1574.8637,\n 1709.9051,\n 1980.9381,\n 2530.5435\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0821,\n 1.1749,\n 1.3612,\n 1.7388\n ],\n \"array_model\": [\n 1455.3113,\n 1574.8637,\n 1709.9051,\n 1980.9381,\n 2530.5435\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 38.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 46.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 54.4368\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1457.2809,\n 1577.3645,\n 1712.9051,\n 1985.0629,\n 2536.9819\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0824,\n 1.1754,\n 1.3622,\n 1.7409\n ],\n \"array_model\": [\n 1457.2809,\n 1577.3645,\n 1712.9051,\n 1985.0629,\n 2536.9819\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 40.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 45.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 50.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 60.8752\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1459.1865,\n 1579.8013,\n 1715.7803,\n 1989.4373,\n 2543.8251\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0827,\n 1.1758,\n 1.3634,\n 1.7433\n ],\n \"array_model\": [\n 1459.1865,\n 1579.8013,\n 1715.7803,\n 1989.4373,\n 2543.8251\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 42.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 44.9056,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 48.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 54.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 67.7184\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1460.9673,\n 1582.3325,\n 1718.9051,\n 1993.4373,\n 2549.9499\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0831,\n 1.1766,\n 1.3645,\n 1.7454\n ],\n \"array_model\": [\n 1460.9673,\n 1582.3325,\n 1718.9051,\n 1993.4373,\n 2549.9499\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 43.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 47.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 51.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 58.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 73.8432\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1463.0617,\n 1584.5837,\n 1721.8427,\n 1997.6245,\n 2556.7627\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0831,\n 1.1769,\n 1.3654,\n 1.7475\n ],\n \"array_model\": [\n 1463.0617,\n 1584.5837,\n 1721.8427,\n 1997.6245,\n 2556.7627\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 45.8752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 49.688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 54.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 62.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 80.656\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1464.9673,\n 1587.1453,\n 1724.8747,\n 2001.9381,\n 2563.3563\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0834,\n 1.1774,\n 1.3665,\n 1.7498\n ],\n \"array_model\": [\n 1464.9673,\n 1587.1453,\n 1724.8747,\n 2001.9381,\n 2563.3563\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 47.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 52.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 57.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 67.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 87.2496\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1466.8121,\n 1589.4269,\n 1727.9051,\n 2005.9685,\n 2569.8571\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0836,\n 1.178,\n 1.3676,\n 1.752\n ],\n \"array_model\": [\n 1466.8121,\n 1589.4269,\n 1727.9051,\n 2005.9685,\n 2569.8571\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 49.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 54.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 60.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 71.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 93.7504\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1468.9049,\n 1591.7389,\n 1731.1547,\n 2010.4069,\n 2576.3563\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.0836,\n 1.1785,\n 1.3686,\n 1.7539\n ],\n \"array_model\": [\n 1468.9049,\n 1591.7389,\n 1731.1547,\n 2010.4069,\n 2576.3563\n ],\n \"array_query\": [\n 1417.1865,\n 1534.8957,\n 1667.7803,\n 1934.7813,\n 2476.1067\n ],\n \"array_cache\": [\n 51.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 56.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 63.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 75.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 100.2496\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.1914,\n 104.2514,\n 112.1413,\n 128.0766\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2783\n ],\n \"array_model\": [\n 100.1914,\n 104.2514,\n 112.1413,\n 128.0766\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.2793,\n 1.2812,\n 0.0,\n 1.2812,\n 0.0,\n 0.0,\n 0.0,\n 1.3105\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.2656,\n 104.3218,\n 112.2234,\n 128.1704\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2783\n ],\n \"array_model\": [\n 100.2656,\n 104.3218,\n 112.2234,\n 128.1704\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.3535,\n 1.3516,\n 0.0,\n 1.3633,\n 0.0,\n 0.0,\n 0.0,\n 1.4043\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.9023,\n 104.9975,\n 112.9519,\n 128.9809\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0406,\n 1.1194,\n 1.2783\n ],\n \"array_model\": [\n 100.9023,\n 104.9975,\n 112.9519,\n 128.9809\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.9902,\n 2.0273,\n 0.0,\n 2.0918,\n 0.0,\n 0.0,\n 0.0,\n 2.2148\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.9805,\n 105.0796,\n 113.032,\n 129.0766\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0406,\n 1.1193,\n 1.2782\n ],\n \"array_model\": [\n 100.9805,\n 105.0796,\n 113.032,\n 129.0766\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 2.0684,\n 2.1094,\n 0.0,\n 2.1719,\n 0.0,\n 0.0,\n 0.0,\n 2.3105\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.0508,\n 105.1421,\n 113.1081,\n 129.1645\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2782\n ],\n \"array_model\": [\n 101.0508,\n 105.1421,\n 113.1081,\n 129.1645\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 2.1387,\n 2.1719,\n 0.0,\n 2.248,\n 0.0,\n 0.0,\n 0.0,\n 2.3984\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.1211,\n 105.2163,\n 113.1843,\n 129.2583\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2783\n ],\n \"array_model\": [\n 101.1211,\n 105.2163,\n 113.1843,\n 129.2583\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 2.209,\n 2.2461,\n 0.0,\n 2.3242,\n 0.0,\n 0.0,\n 0.0,\n 2.4922\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 101.1894,\n 105.2983,\n 113.2663,\n 129.3559\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0406,\n 1.1193,\n 1.2784\n ],\n \"array_model\": [\n 101.1894,\n 105.2983,\n 113.2663,\n 129.3559\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 2.2773,\n 2.3281,\n 0.0,\n 2.4062,\n 0.0,\n 0.0,\n 0.0,\n 2.5898\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.3301,\n 104.3979,\n 112.3074,\n 128.2427\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1194,\n 1.2782\n ],\n \"array_model\": [\n 100.3301,\n 104.3979,\n 112.3074,\n 128.2427\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.418,\n 1.4277,\n 0.0,\n 1.4473,\n 0.0,\n 0.0,\n 0.0,\n 1.4766\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.4062,\n 104.4761,\n 112.3874,\n 128.3501\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2783\n ],\n \"array_model\": [\n 100.4062,\n 104.4761,\n 112.3874,\n 128.3501\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.4941,\n 1.5059,\n 0.0,\n 1.5273,\n 0.0,\n 0.0,\n 0.0,\n 1.584\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.4785,\n 104.5464,\n 112.4617,\n 128.4321\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2782\n ],\n \"array_model\": [\n 100.4785,\n 104.5464,\n 112.4617,\n 128.4321\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.5664,\n 1.5762,\n 0.0,\n 1.6016,\n 0.0,\n 0.0,\n 0.0,\n 1.666\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.5508,\n 104.6225,\n 112.5476,\n 128.5298\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1193,\n 1.2783\n ],\n \"array_model\": [\n 100.5508,\n 104.6225,\n 112.5476,\n 128.5298\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.6387,\n 1.6523,\n 0.0,\n 1.6875,\n 0.0,\n 0.0,\n 0.0,\n 1.7637\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.6191,\n 104.7007,\n 112.6374,\n 128.6157\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0406,\n 1.1194,\n 1.2782\n ],\n \"array_model\": [\n 100.6191,\n 104.7007,\n 112.6374,\n 128.6157\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.707,\n 1.7305,\n 0.0,\n 1.7773,\n 0.0,\n 0.0,\n 0.0,\n 1.8496\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.6875,\n 104.769,\n 112.7058,\n 128.7056\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1194,\n 1.2783\n ],\n \"array_model\": [\n 100.6875,\n 104.769,\n 112.7058,\n 128.7056\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.7754,\n 1.7988,\n 0.0,\n 1.8457,\n 0.0,\n 0.0,\n 0.0,\n 1.9395\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.7637,\n 104.8452,\n 112.7976,\n 128.8013\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 1.1194,\n 1.2783\n ],\n \"array_model\": [\n 100.7637,\n 104.8452,\n 112.7976,\n 128.8013\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.8516,\n 1.875,\n 0.0,\n 1.9375,\n 0.0,\n 0.0,\n 0.0,\n 2.0352\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 100.8398,\n 104.9155,\n 112.8699,\n 128.897\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0404,\n 1.1193,\n 1.2782\n ],\n \"array_model\": [\n 100.8398,\n 104.9155,\n 112.8699,\n 128.897\n ],\n \"array_query\": [\n 98.9121,\n 102.9702,\n 110.8601,\n 126.7661\n ],\n \"array_cache\": [\n 1.9277,\n 1.9453,\n 0.0,\n 2.0098,\n 0.0,\n 0.0,\n 0.0,\n 2.1309\n ],\n \"batch_size\": 1,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_1.json": "{\n \"mean\": 1417.1865,\n \"array\": [\n 1416.6256,\n 1399.6256,\n 1429.656,\n 1415.656,\n 1432.656,\n 1419.8752,\n 1422.8752,\n 1404.9056,\n 1432.9056,\n 1403.0,\n 1396.0,\n 1414.2192,\n 1418.2192,\n 1410.1248,\n 1413.1248,\n 1415.2192,\n 1431.2192,\n 1419.3744,\n 1414.3744,\n 1409.2816,\n 1423.2816,\n 1398.656,\n 1403.656,\n 1398.5632,\n 1426.5632,\n 1408.5632,\n 1419.4992,\n 1405.4992,\n 1436.7808,\n 1432.7808,\n 1398.8432,\n 1400.8432,\n 1402.6256,\n 1408.6256,\n 1436.656,\n 1430.656,\n 1431.656,\n 1416.8752,\n 1435.8752,\n 1398.9056,\n 1429.9056,\n 1429.0,\n 1421.0,\n 1403.2192,\n 1428.2192,\n 1412.1248,\n 1398.1248,\n 1419.2192,\n 1420.2192,\n 1433.3744,\n 1417.3744,\n 1411.2816,\n 1402.2816,\n 1402.656,\n 1413.656,\n 1417.5632,\n 1432.5632,\n 1438.5632,\n 1420.4992,\n 1424.4992,\n 1423.7808,\n 1408.7808,\n 1426.8432,\n 1430.8432\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_16.json": "{\n \"mean\": 1667.7803,\n \"array\": [\n 1691.0,\n 1671.0,\n 1650.0,\n 1684.0,\n 1651.0,\n 1657.8752,\n 1690.8752,\n 1642.8752,\n 1645.8752,\n 1667.0,\n 1672.0,\n 1676.8752,\n 1671.8752,\n 1662.9376,\n 1694.9376,\n 1646.9056,\n 1656.9056,\n 1668.8752,\n 1656.8752,\n 1644.6256,\n 1646.6256,\n 1670.7808,\n 1659.7808,\n 1662.656,\n 1689.656,\n 1684.656,\n 1657.7504,\n 1673.7504,\n 1657.8128,\n 1643.8128,\n 1654.4368,\n 1663.4368,\n 1674.0,\n 1672.0,\n 1687.0,\n 1692.0,\n 1692.0,\n 1669.8752,\n 1682.8752,\n 1661.8752,\n 1682.8752,\n 1659.0,\n 1679.0,\n 1681.8752,\n 1685.8752,\n 1651.9376,\n 1674.9376,\n 1645.9056,\n 1666.9056,\n 1676.8752,\n 1676.8752,\n 1652.6256,\n 1682.6256,\n 1661.7808,\n 1644.7808,\n 1652.656,\n 1673.656,\n 1667.656,\n 1672.7504,\n 1677.7504,\n 1662.8128,\n 1690.8128,\n 1651.4368,\n 1663.4368\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_32.json": "{\n \"mean\": 1934.7813,\n \"array\": [\n 1922.1568,\n 1933.1568,\n 1952.9376,\n 1927.9376,\n 1941.9376,\n 1954.8432,\n 1940.8432,\n 1914.7184,\n 1967.7184,\n 1911.344,\n 1917.344,\n 1934.344,\n 1912.344,\n 1945.1568,\n 1913.1568,\n 1942.8432,\n 1947.8432,\n 1955.8128,\n 1910.8128,\n 1949.3744,\n 1947.3744,\n 1915.032,\n 1945.032,\n 1916.8752,\n 1945.8752,\n 1927.8752,\n 1953.6256,\n 1923.6256,\n 1909.656,\n 1957.656,\n 1952.3744,\n 1933.3744,\n 1932.1568,\n 1915.1568,\n 1907.9376,\n 1956.9376,\n 1921.9376,\n 1955.8432,\n 1932.8432,\n 1937.7184,\n 1957.7184,\n 1963.344,\n 1950.344,\n 1934.344,\n 1914.344,\n 1915.1568,\n 1960.1568,\n 1963.8432,\n 1939.8432,\n 1927.8128,\n 1934.8128,\n 1944.3744,\n 1942.3744,\n 1906.032,\n 1924.032,\n 1920.8752,\n 1928.8752,\n 1946.8752,\n 1966.6256,\n 1910.6256,\n 1912.656,\n 1914.656,\n 1909.3744,\n 1951.3744\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_64.json": "{\n \"mean\": 2476.1067,\n \"array\": [\n 2508.7184,\n 2498.7184,\n 2443.0944,\n 2485.0944,\n 2483.0944,\n 2499.5632,\n 2479.5632,\n 2455.1248,\n 2477.1248,\n 2488.2816,\n 2497.2816,\n 2479.1568,\n 2493.1568,\n 2506.344,\n 2489.344,\n 2509.7504,\n 2511.7504,\n 2437.2496,\n 2446.2496,\n 2447.7504,\n 2470.7504,\n 2444.0,\n 2442.0,\n 2454.7504,\n 2497.7504,\n 2478.7504,\n 2465.0944,\n 2486.0944,\n 2503.2192,\n 2495.2192,\n 2467.9376,\n 2449.9376,\n 2508.7184,\n 2481.7184,\n 2441.0944,\n 2446.0944,\n 2474.0944,\n 2491.5632,\n 2458.5632,\n 2476.1248,\n 2516.1248,\n 2452.2816,\n 2482.2816,\n 2448.1568,\n 2486.1568,\n 2461.344,\n 2453.344,\n 2485.7504,\n 2489.7504,\n 2480.2496,\n 2503.2496,\n 2447.7504,\n 2506.7504,\n 2478.0,\n 2501.0,\n 2460.7504,\n 2453.7504,\n 2498.7504,\n 2481.0944,\n 2488.0944,\n 2474.2192,\n 2447.2192,\n 2437.9376,\n 2466.9376\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_llm/query_8.json": "{\n \"mean\": 1534.8957,\n \"array\": [\n 1545.9376,\n 1557.9376,\n 1519.4064,\n 1525.4064,\n 1548.4064,\n 1524.032,\n 1543.032,\n 1555.5312,\n 1547.5312,\n 1542.0944,\n 1559.0944,\n 1547.5632,\n 1521.5632,\n 1522.312,\n 1555.312,\n 1519.7504,\n 1543.7504,\n 1546.4688,\n 1555.4688,\n 1533.1568,\n 1515.1568,\n 1542.5936,\n 1539.5936,\n 1552.0624,\n 1555.0624,\n 1529.0624,\n 1544.5632,\n 1547.5632,\n 1519.1568,\n 1534.1568,\n 1548.7184,\n 1528.7184,\n 1519.9376,\n 1531.9376,\n 1535.4064,\n 1526.4064,\n 1522.4064,\n 1514.032,\n 1523.032,\n 1526.5312,\n 1540.5312,\n 1534.0944,\n 1523.0944,\n 1511.5632,\n 1528.5632,\n 1525.312,\n 1544.312,\n 1522.7504,\n 1516.7504,\n 1539.4688,\n 1549.4688,\n 1518.1568,\n 1521.1568,\n 1518.5936,\n 1516.5936,\n 1538.0624,\n 1544.0624,\n 1530.0624,\n 1521.5632,\n 1539.5632,\n 1542.1568,\n 1540.1568,\n 1549.7184,\n 1547.7184\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_slm/query_1.json": "{\n \"mean\": 98.9121,\n \"array\": [\n 99.9707,\n 98.8457,\n 98.3965,\n 99.7715,\n 98.3965,\n 99.832,\n 98.957,\n 97.7559,\n 99.1309,\n 99.6836,\n 100.0586,\n 97.4863,\n 100.3613,\n 97.418,\n 98.418,\n 98.7246,\n 98.5996,\n 99.3984,\n 100.2734,\n 99.0723,\n 100.0723,\n 99.5098,\n 100.0098,\n 100.0566,\n 99.4316,\n 98.1816,\n 99.9863,\n 98.8613,\n 99.166,\n 97.666,\n 98.4727,\n 99.9727,\n 99.5957,\n 97.8457,\n 98.2715,\n 99.5215,\n 98.0215,\n 97.832,\n 97.457,\n 99.3809,\n 99.5059,\n 97.5586,\n 97.8086,\n 98.2363,\n 98.2363,\n 100.418,\n 97.793,\n 99.5996,\n 99.5996,\n 97.7734,\n 100.3984,\n 97.8223,\n 97.5723,\n 100.3848,\n 98.5098,\n 99.3066,\n 99.1816,\n 99.5566,\n 99.1113,\n 98.8613,\n 98.791,\n 98.166,\n 98.7227,\n 97.5977\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_slm/query_2.json": "{\n \"mean\": 102.9702,\n \"array\": [\n 104.3438,\n 102.9688,\n 101.6484,\n 102.0234,\n 101.5234,\n 103.8223,\n 102.0723,\n 102.4941,\n 103.4941,\n 103.6738,\n 102.7988,\n 104.3477,\n 102.4727,\n 102.7695,\n 104.1445,\n 102.9512,\n 102.3262,\n 103.75,\n 102.875,\n 103.8047,\n 102.9297,\n 102.8477,\n 102.3477,\n 103.3906,\n 102.6406,\n 102.5156,\n 102.9531,\n 103.3281,\n 103.7539,\n 102.5039,\n 104.4219,\n 104.2969,\n 104.4688,\n 102.9688,\n 102.7734,\n 103.8984,\n 103.0234,\n 103.5723,\n 103.4473,\n 103.3691,\n 101.7441,\n 101.6738,\n 102.6738,\n 102.7227,\n 101.4727,\n 103.3945,\n 102.1445,\n 103.2012,\n 102.8262,\n 101.875,\n 104.5,\n 102.0547,\n 102.3047,\n 104.2227,\n 101.9727,\n 101.6406,\n 103.1406,\n 101.5156,\n 104.4531,\n 102.3281,\n 103.0039,\n 103.8789,\n 101.9219,\n 103.6719\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_slm/query_4.json": "{\n \"mean\": 110.8601,\n \"array\": [\n 111.3438,\n 112.0938,\n 111.6367,\n 112.2617,\n 109.5117,\n 109.9277,\n 112.6777,\n 109.5977,\n 111.3477,\n 110.2734,\n 112.2734,\n 112.5625,\n 110.4375,\n 109.8477,\n 109.9727,\n 111.9043,\n 110.7793,\n 111.3125,\n 109.8125,\n 110.4902,\n 111.2402,\n 111.6582,\n 111.7832,\n 110.3281,\n 110.4531,\n 111.3281,\n 109.252,\n 111.252,\n 110.4258,\n 110.9258,\n 110.8438,\n 109.7188,\n 111.0938,\n 110.8438,\n 110.7617,\n 111.0117,\n 112.6367,\n 109.6777,\n 112.1777,\n 111.7227,\n 109.8477,\n 110.7734,\n 110.1484,\n 109.5625,\n 111.9375,\n 110.9727,\n 111.5977,\n 111.4043,\n 112.2793,\n 110.5625,\n 110.0625,\n 110.6152,\n 111.4902,\n 109.7832,\n 111.2832,\n 109.8281,\n 110.2031,\n 109.8281,\n 112.127,\n 109.502,\n 111.9258,\n 109.4258,\n 109.5938,\n 111.0938\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_1/query_slm/query_8.json": "{\n \"mean\": 126.7661,\n \"array\": [\n 126.3145,\n 128.0645,\n 125.2207,\n 126.9707,\n 125.5957,\n 126.2734,\n 125.6484,\n 125.416,\n 127.666,\n 127.584,\n 125.334,\n 125.6113,\n 125.6113,\n 127.2754,\n 128.0254,\n 127.4355,\n 128.6855,\n 126.3398,\n 127.8398,\n 127.3691,\n 128.3691,\n 127.1602,\n 125.6602,\n 127.1895,\n 126.4395,\n 126.4395,\n 127.2266,\n 125.6016,\n 126.8828,\n 125.7578,\n 125.0352,\n 125.0352,\n 125.1895,\n 125.4395,\n 125.9707,\n 128.3457,\n 126.2207,\n 126.5234,\n 125.6484,\n 128.041,\n 128.791,\n 125.834,\n 127.959,\n 127.4863,\n 128.7363,\n 128.9004,\n 126.0254,\n 125.5605,\n 125.3105,\n 125.2148,\n 128.0898,\n 128.2441,\n 126.6191,\n 128.1602,\n 125.5352,\n 126.6895,\n 126.1895,\n 125.3145,\n 128.4766,\n 126.4766,\n 128.6328,\n 127.7578,\n 127.5352,\n 127.0352\n ],\n \"batch_size\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 4.7802,\n 0.0,\n 0.0,\n 5.1362,\n 0.0,\n 0.0,\n 0.0,\n 5.5387,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.4557,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.168\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0745,\n 0.0,\n 0.0,\n 0.0,\n 1.1587,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3505,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7087\n ],\n \"array\": [\n 4.7802,\n 0.0,\n 0.0,\n 5.1362,\n 0.0,\n 0.0,\n 0.0,\n 5.5387,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.4557,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.168\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 6.7285,\n 0.0,\n 0.0,\n 7.2676,\n 0.0,\n 0.0,\n 0.0,\n 8.0098,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.4629,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.416\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0801,\n 0.0,\n 0.0,\n 0.0,\n 1.1904,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8453\n ],\n \"array\": [\n 6.7285,\n 0.0,\n 0.0,\n 7.2676,\n 0.0,\n 0.0,\n 0.0,\n 8.0098,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.4629,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.416\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 23.9766,\n 0.0,\n 0.0,\n 26.5215,\n 0.0,\n 0.0,\n 0.0,\n 29.9082,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 36.7324,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 50.2812\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1061,\n 0.0,\n 0.0,\n 0.0,\n 1.2474,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.532,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0971\n ],\n \"array\": [\n 23.9766,\n 0.0,\n 0.0,\n 26.5215,\n 0.0,\n 0.0,\n 0.0,\n 29.9082,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 36.7324,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 50.2812\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 25.918,\n 0.0,\n 0.0,\n 28.6719,\n 0.0,\n 0.0,\n 0.0,\n 32.3359,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.6602,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 54.3848\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1063,\n 0.0,\n 0.0,\n 0.0,\n 1.2476,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5302,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0983\n ],\n \"array\": [\n 25.918,\n 0.0,\n 0.0,\n 28.6719,\n 0.0,\n 0.0,\n 0.0,\n 32.3359,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.6602,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 54.3848\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 27.8477,\n 0.0,\n 0.0,\n 30.7812,\n 0.0,\n 0.0,\n 0.0,\n 34.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.8594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 58.6113\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1053,\n 0.0,\n 0.0,\n 0.0,\n 1.2495,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5391,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1047\n ],\n \"array\": [\n 27.8477,\n 0.0,\n 0.0,\n 30.7812,\n 0.0,\n 0.0,\n 0.0,\n 34.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.8594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 58.6113\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 29.8125,\n 0.0,\n 0.0,\n 32.957,\n 0.0,\n 0.0,\n 0.0,\n 37.1504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 45.8359,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 63.0918\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1055,\n 0.0,\n 0.0,\n 0.0,\n 1.2461,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5375,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1163\n ],\n \"array\": [\n 29.8125,\n 0.0,\n 0.0,\n 32.957,\n 0.0,\n 0.0,\n 0.0,\n 37.1504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 45.8359,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 63.0918\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 31.623,\n 0.0,\n 0.0,\n 35.0645,\n 0.0,\n 0.0,\n 0.0,\n 39.5488,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 48.7637,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 66.8438\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1088,\n 0.0,\n 0.0,\n 0.0,\n 1.2506,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.542,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1138\n ],\n \"array\": [\n 31.623,\n 0.0,\n 0.0,\n 35.0645,\n 0.0,\n 0.0,\n 0.0,\n 39.5488,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 48.7637,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 66.8438\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 8.6309,\n 0.0,\n 0.0,\n 9.4082,\n 0.0,\n 0.0,\n 0.0,\n 10.4395,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.4629,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.6074\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0901,\n 0.0,\n 0.0,\n 0.0,\n 1.2095,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.444,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9242\n ],\n \"array\": [\n 8.6309,\n 0.0,\n 0.0,\n 9.4082,\n 0.0,\n 0.0,\n 0.0,\n 10.4395,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.4629,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.6074\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 10.5625,\n 0.0,\n 0.0,\n 11.5684,\n 0.0,\n 0.0,\n 0.0,\n 12.8574,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.5,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.7891\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0952,\n 0.0,\n 0.0,\n 0.0,\n 1.2173,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4675,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9682\n ],\n \"array\": [\n 10.5625,\n 0.0,\n 0.0,\n 11.5684,\n 0.0,\n 0.0,\n 0.0,\n 12.8574,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.5,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.7891\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 12.457,\n 0.0,\n 0.0,\n 13.668,\n 0.0,\n 0.0,\n 0.0,\n 15.2969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 18.5859,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 25.0312\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0972,\n 0.0,\n 0.0,\n 0.0,\n 1.228,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.492,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0094\n ],\n \"array\": [\n 12.457,\n 0.0,\n 0.0,\n 13.668,\n 0.0,\n 0.0,\n 0.0,\n 15.2969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 18.5859,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 25.0312\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 14.3887,\n 0.0,\n 0.0,\n 15.8262,\n 0.0,\n 0.0,\n 0.0,\n 17.7891,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 21.582,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 29.1914\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0999,\n 0.0,\n 0.0,\n 0.0,\n 1.2363,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4999,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0288\n ],\n \"array\": [\n 14.3887,\n 0.0,\n 0.0,\n 15.8262,\n 0.0,\n 0.0,\n 0.0,\n 17.7891,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 21.582,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 29.1914\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 16.3047,\n 0.0,\n 0.0,\n 17.9336,\n 0.0,\n 0.0,\n 0.0,\n 20.0684,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 24.5762,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 33.3711\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0999,\n 0.0,\n 0.0,\n 0.0,\n 1.2308,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5073,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0467\n ],\n \"array\": [\n 16.3047,\n 0.0,\n 0.0,\n 17.9336,\n 0.0,\n 0.0,\n 0.0,\n 20.0684,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 24.5762,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 33.3711\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 18.2031,\n 0.0,\n 0.0,\n 20.1562,\n 0.0,\n 0.0,\n 0.0,\n 22.6445,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 27.6348,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 37.5527\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1073,\n 0.0,\n 0.0,\n 0.0,\n 1.244,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5181,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.063\n ],\n \"array\": [\n 18.2031,\n 0.0,\n 0.0,\n 20.1562,\n 0.0,\n 0.0,\n 0.0,\n 22.6445,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 27.6348,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 37.5527\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 20.127,\n 0.0,\n 0.0,\n 22.2188,\n 0.0,\n 0.0,\n 0.0,\n 25.0293,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 30.6133,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 41.7598\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1039,\n 0.0,\n 0.0,\n 0.0,\n 1.2436,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.521,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0748\n ],\n \"array\": [\n 20.127,\n 0.0,\n 0.0,\n 22.2188,\n 0.0,\n 0.0,\n 0.0,\n 25.0293,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 30.6133,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 41.7598\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 22.1211,\n 0.0,\n 0.0,\n 24.4375,\n 0.0,\n 0.0,\n 0.0,\n 27.5137,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 33.6719,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 46.002\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1047,\n 0.0,\n 0.0,\n 0.0,\n 1.2438,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5222,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0796\n ],\n \"array\": [\n 22.1211,\n 0.0,\n 0.0,\n 24.4375,\n 0.0,\n 0.0,\n 0.0,\n 27.5137,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 33.6719,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 46.002\n ],\n \"batch_size\": 16,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_16/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 2.8728,\n 2.9332,\n 0.0,\n 3.1208,\n 0.0,\n 0.0,\n 0.0,\n 3.3411\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.021,\n 0.0,\n 1.0864,\n 0.0,\n 0.0,\n 0.0,\n 1.163\n ],\n \"array\": [\n 2.8728,\n 2.9332,\n 0.0,\n 3.1208,\n 0.0,\n 0.0,\n 0.0,\n 3.3411\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 4.0215,\n 4.1445,\n 0.0,\n 4.3516,\n 0.0,\n 0.0,\n 0.0,\n 4.8027\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0306,\n 0.0,\n 1.0821,\n 0.0,\n 0.0,\n 0.0,\n 1.1943\n ],\n \"array\": [\n 4.0215,\n 4.1445,\n 0.0,\n 4.3516,\n 0.0,\n 0.0,\n 0.0,\n 4.8027\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 14.3516,\n 14.8848,\n 0.0,\n 15.8691,\n 0.0,\n 0.0,\n 0.0,\n 17.9102\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0372,\n 0.0,\n 1.1057,\n 0.0,\n 0.0,\n 0.0,\n 1.248\n ],\n \"array\": [\n 14.3516,\n 14.8848,\n 0.0,\n 15.8691,\n 0.0,\n 0.0,\n 0.0,\n 17.9102\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 15.4941,\n 16.0547,\n 0.0,\n 17.1387,\n 0.0,\n 0.0,\n 0.0,\n 19.375\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0362,\n 0.0,\n 1.1061,\n 0.0,\n 0.0,\n 0.0,\n 1.2505\n ],\n \"array\": [\n 15.4941,\n 16.0547,\n 0.0,\n 17.1387,\n 0.0,\n 0.0,\n 0.0,\n 19.375\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 16.6582,\n 17.2578,\n 0.0,\n 18.4492,\n 0.0,\n 0.0,\n 0.0,\n 20.8438\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.036,\n 0.0,\n 1.1075,\n 0.0,\n 0.0,\n 0.0,\n 1.2513\n ],\n \"array\": [\n 16.6582,\n 17.2578,\n 0.0,\n 18.4492,\n 0.0,\n 0.0,\n 0.0,\n 20.8438\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 17.8633,\n 18.4727,\n 0.0,\n 19.75,\n 0.0,\n 0.0,\n 0.0,\n 22.3242\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0341,\n 0.0,\n 1.1056,\n 0.0,\n 0.0,\n 0.0,\n 1.2497\n ],\n \"array\": [\n 17.8633,\n 18.4727,\n 0.0,\n 19.75,\n 0.0,\n 0.0,\n 0.0,\n 22.3242\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 18.9824,\n 19.6289,\n 0.0,\n 20.9336,\n 0.0,\n 0.0,\n 0.0,\n 23.7949\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0341,\n 0.0,\n 1.1028,\n 0.0,\n 0.0,\n 0.0,\n 1.2535\n ],\n \"array\": [\n 18.9824,\n 19.6289,\n 0.0,\n 20.9336,\n 0.0,\n 0.0,\n 0.0,\n 23.7949\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 5.1719,\n 5.3184,\n 0.0,\n 5.6387,\n 0.0,\n 0.0,\n 0.0,\n 6.248\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0283,\n 0.0,\n 1.0903,\n 0.0,\n 0.0,\n 0.0,\n 1.2081\n ],\n \"array\": [\n 5.1719,\n 5.3184,\n 0.0,\n 5.6387,\n 0.0,\n 0.0,\n 0.0,\n 6.248\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 6.3223,\n 6.543,\n 0.0,\n 6.9238,\n 0.0,\n 0.0,\n 0.0,\n 7.7129\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0349,\n 0.0,\n 1.0951,\n 0.0,\n 0.0,\n 0.0,\n 1.22\n ],\n \"array\": [\n 6.3223,\n 6.543,\n 0.0,\n 6.9238,\n 0.0,\n 0.0,\n 0.0,\n 7.7129\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 7.4766,\n 7.7188,\n 0.0,\n 8.2188,\n 0.0,\n 0.0,\n 0.0,\n 9.1934\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0324,\n 0.0,\n 1.0993,\n 0.0,\n 0.0,\n 0.0,\n 1.2296\n ],\n \"array\": [\n 7.4766,\n 7.7188,\n 0.0,\n 8.2188,\n 0.0,\n 0.0,\n 0.0,\n 9.1934\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 8.623,\n 8.9219,\n 0.0,\n 9.498,\n 0.0,\n 0.0,\n 0.0,\n 10.5977\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0347,\n 0.0,\n 1.1015,\n 0.0,\n 0.0,\n 0.0,\n 1.229\n ],\n \"array\": [\n 8.623,\n 8.9219,\n 0.0,\n 9.498,\n 0.0,\n 0.0,\n 0.0,\n 10.5977\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 9.7773,\n 10.1074,\n 0.0,\n 10.7773,\n 0.0,\n 0.0,\n 0.0,\n 12.1055\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0338,\n 0.0,\n 1.1023,\n 0.0,\n 0.0,\n 0.0,\n 1.2381\n ],\n \"array\": [\n 9.7773,\n 10.1074,\n 0.0,\n 10.7773,\n 0.0,\n 0.0,\n 0.0,\n 12.1055\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 10.9414,\n 11.3105,\n 0.0,\n 12.0859,\n 0.0,\n 0.0,\n 0.0,\n 13.5352\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0337,\n 0.0,\n 1.1046,\n 0.0,\n 0.0,\n 0.0,\n 1.2371\n ],\n \"array\": [\n 10.9414,\n 11.3105,\n 0.0,\n 12.0859,\n 0.0,\n 0.0,\n 0.0,\n 13.5352\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 12.0859,\n 12.5,\n 0.0,\n 13.3086,\n 0.0,\n 0.0,\n 0.0,\n 15.0195\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0343,\n 0.0,\n 1.1012,\n 0.0,\n 0.0,\n 0.0,\n 1.2427\n ],\n \"array\": [\n 12.0859,\n 12.5,\n 0.0,\n 13.3086,\n 0.0,\n 0.0,\n 0.0,\n 15.0195\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 13.2637,\n 13.6758,\n 0.0,\n 14.6133,\n 0.0,\n 0.0,\n 0.0,\n 16.4355\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0311,\n 0.0,\n 1.1018,\n 0.0,\n 0.0,\n 0.0,\n 1.2391\n ],\n \"array\": [\n 13.2637,\n 13.6758,\n 0.0,\n 14.6133,\n 0.0,\n 0.0,\n 0.0,\n 16.4355\n ],\n \"batch_size\": 16,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_16/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1749.1472,\n 2556.7958,\n 3648.5052,\n 5806.5512,\n 10121.0298\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4617,\n 2.0859,\n 3.3196,\n 5.7863\n ],\n \"array_model\": [\n 1749.1472,\n 2556.7958,\n 3648.5052,\n 5806.5512,\n 10121.0298\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 76.4832,\n 0.0,\n 0.0,\n 82.1792,\n 0.0,\n 0.0,\n 0.0,\n 88.6192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 103.2912,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 130.688\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1780.32,\n 2590.8982,\n 3688.0428,\n 5854.6664,\n 10188.9978\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4553,\n 2.0716,\n 3.2885,\n 5.7231\n ],\n \"array_model\": [\n 1780.32,\n 2590.8982,\n 3688.0428,\n 5854.6664,\n 10188.9978\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 107.656,\n 0.0,\n 0.0,\n 116.2816,\n 0.0,\n 0.0,\n 0.0,\n 128.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 151.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 198.656\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2056.2896,\n 2898.9606,\n 4038.4172,\n 6290.9784,\n 10794.841\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4098,\n 1.9639,\n 3.0594,\n 5.2497\n ],\n \"array_model\": [\n 2056.2896,\n 2898.9606,\n 4038.4172,\n 6290.9784,\n 10794.841\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 383.6256,\n 0.0,\n 0.0,\n 424.344,\n 0.0,\n 0.0,\n 0.0,\n 478.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 587.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 804.4992\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2087.352,\n 2933.367,\n 4077.2604,\n 6337.8232,\n 10860.4986\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4053,\n 1.9533,\n 3.0363,\n 5.203\n ],\n \"array_model\": [\n 2087.352,\n 2933.367,\n 4077.2604,\n 6337.8232,\n 10860.4986\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 414.688,\n 0.0,\n 0.0,\n 458.7504,\n 0.0,\n 0.0,\n 0.0,\n 517.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 634.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 870.1568\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2118.2272,\n 2967.1158,\n 4116.6044,\n 6389.0104,\n 10928.1226\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4008,\n 1.9434,\n 3.0162,\n 5.1591\n ],\n \"array_model\": [\n 2118.2272,\n 2967.1158,\n 4116.6044,\n 6389.0104,\n 10928.1226\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 445.5632,\n 0.0,\n 0.0,\n 492.4992,\n 0.0,\n 0.0,\n 0.0,\n 556.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 685.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 937.7808\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2149.664,\n 3001.9286,\n 4154.2924,\n 6436.6344,\n 10999.8106\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.3965,\n 1.9325,\n 2.9943,\n 5.117\n ],\n \"array_model\": [\n 2149.664,\n 3001.9286,\n 4154.2924,\n 6436.6344,\n 10999.8106\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 477.0,\n 0.0,\n 0.0,\n 527.312,\n 0.0,\n 0.0,\n 0.0,\n 594.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 733.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1009.4688\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2178.632,\n 3035.6486,\n 4192.6668,\n 6483.4792,\n 11059.8426\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.3934,\n 1.9244,\n 2.9759,\n 5.0765\n ],\n \"array_model\": [\n 2178.632,\n 3035.6486,\n 4192.6668,\n 6483.4792,\n 11059.8426\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 505.968,\n 0.0,\n 0.0,\n 561.032,\n 0.0,\n 0.0,\n 0.0,\n 632.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 780.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1069.5008\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1810.7584,\n 2625.1478,\n 3726.918,\n 5902.6664,\n 10256.0602\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4498,\n 2.0582,\n 3.2598,\n 5.664\n ],\n \"array_model\": [\n 1810.7584,\n 2625.1478,\n 3726.918,\n 5902.6664,\n 10256.0602\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 138.0944,\n 0.0,\n 0.0,\n 150.5312,\n 0.0,\n 0.0,\n 0.0,\n 167.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 199.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 265.7184\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1841.664,\n 2659.711,\n 3765.6044,\n 5951.26,\n 10322.9674\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4442,\n 2.0447,\n 3.2315,\n 5.6052\n ],\n \"array_model\": [\n 1841.664,\n 2659.711,\n 3765.6044,\n 5951.26,\n 10322.9674\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 169.0,\n 0.0,\n 0.0,\n 185.0944,\n 0.0,\n 0.0,\n 0.0,\n 205.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 248.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 332.6256\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1871.976,\n 2693.3046,\n 3804.6364,\n 6000.6344,\n 10390.841\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4387,\n 2.0324,\n 3.2055,\n 5.5507\n ],\n \"array_model\": [\n 1871.976,\n 2693.3046,\n 3804.6364,\n 6000.6344,\n 10390.841\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 199.312,\n 0.0,\n 0.0,\n 218.688,\n 0.0,\n 0.0,\n 0.0,\n 244.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 297.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 400.4992\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1902.8832,\n 2727.8358,\n 3844.5116,\n 6048.572,\n 10457.4042\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4335,\n 2.0204,\n 3.1786,\n 5.4956\n ],\n \"array_model\": [\n 1902.8832,\n 2727.8358,\n 3844.5116,\n 6048.572,\n 10457.4042\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 230.2192,\n 0.0,\n 0.0,\n 253.2192,\n 0.0,\n 0.0,\n 0.0,\n 284.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 345.312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 467.0624\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1933.5392,\n 2761.5542,\n 3880.9804,\n 6096.4792,\n 10524.2794\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4282,\n 2.0072,\n 3.153,\n 5.443\n ],\n \"array_model\": [\n 1933.5392,\n 2761.5542,\n 3880.9804,\n 6096.4792,\n 10524.2794\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 260.8752,\n 0.0,\n 0.0,\n 286.9376,\n 0.0,\n 0.0,\n 0.0,\n 321.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 393.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 533.9376\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1963.9136,\n 2797.1158,\n 3922.198,\n 6145.4168,\n 10591.185\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4243,\n 1.9971,\n 3.1292,\n 5.3929\n ],\n \"array_model\": [\n 1963.9136,\n 2797.1158,\n 3922.198,\n 6145.4168,\n 10591.185\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 291.2496,\n 0.0,\n 0.0,\n 322.4992,\n 0.0,\n 0.0,\n 0.0,\n 362.312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 442.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 600.8432\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1994.696,\n 2830.1174,\n 3960.3548,\n 6193.0728,\n 10658.4986\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.4188,\n 1.9854,\n 3.1048,\n 5.3434\n ],\n \"array_model\": [\n 1994.696,\n 2830.1174,\n 3960.3548,\n 6193.0728,\n 10658.4986\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 322.032,\n 0.0,\n 0.0,\n 355.5008,\n 0.0,\n 0.0,\n 0.0,\n 400.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 489.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 668.1568\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2026.6016,\n 2865.6166,\n 4000.1052,\n 6242.0104,\n 10726.3738\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.414,\n 1.9738,\n 3.08,\n 5.2928\n ],\n \"array_model\": [\n 2026.6016,\n 2865.6166,\n 4000.1052,\n 6242.0104,\n 10726.3738\n ],\n \"array_query\": [\n 1672.664,\n 2474.6166,\n 3559.886,\n 5703.26,\n 9990.3418\n ],\n \"array_cache\": [\n 353.9376,\n 0.0,\n 0.0,\n 391.0,\n 0.0,\n 0.0,\n 0.0,\n 440.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 538.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 736.032\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_16/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 161.7063,\n 226.3467,\n 353.8327,\n 609.5686\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3997,\n 2.1881,\n 3.7696\n ],\n \"array_model\": [\n 161.7063,\n 226.3467,\n 353.8327,\n 609.5686\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 2.8728,\n 2.9332,\n 0.0,\n 3.1208,\n 0.0,\n 0.0,\n 0.0,\n 3.3411\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 162.855,\n 227.558,\n 355.0635,\n 611.0302\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3973,\n 2.1802,\n 3.752\n ],\n \"array_model\": [\n 162.855,\n 227.558,\n 355.0635,\n 611.0302\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 4.0215,\n 4.1445,\n 0.0,\n 4.3516,\n 0.0,\n 0.0,\n 0.0,\n 4.8027\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 173.1851,\n 238.2983,\n 366.581,\n 624.1377\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.376,\n 2.1167,\n 3.6039\n ],\n \"array_model\": [\n 173.1851,\n 238.2983,\n 366.581,\n 624.1377\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 14.3516,\n 14.8848,\n 0.0,\n 15.8691,\n 0.0,\n 0.0,\n 0.0,\n 17.9102\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 174.3276,\n 239.4682,\n 367.8506,\n 625.6025\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3737,\n 2.1101,\n 3.5887\n ],\n \"array_model\": [\n 174.3276,\n 239.4682,\n 367.8506,\n 625.6025\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 15.4941,\n 16.0547,\n 0.0,\n 17.1387,\n 0.0,\n 0.0,\n 0.0,\n 19.375\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 175.4917,\n 240.6713,\n 369.1611,\n 627.0713\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3714,\n 2.1036,\n 3.5732\n ],\n \"array_model\": [\n 175.4917,\n 240.6713,\n 369.1611,\n 627.0713\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 16.6582,\n 17.2578,\n 0.0,\n 18.4492,\n 0.0,\n 0.0,\n 0.0,\n 20.8438\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 176.6968,\n 241.8862,\n 370.4619,\n 628.5517\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3689,\n 2.0966,\n 3.5572\n ],\n \"array_model\": [\n 176.6968,\n 241.8862,\n 370.4619,\n 628.5517\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 17.8633,\n 18.4727,\n 0.0,\n 19.75,\n 0.0,\n 0.0,\n 0.0,\n 22.3242\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 177.8159,\n 243.0424,\n 371.6455,\n 630.0224\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3668,\n 2.0901,\n 3.5431\n ],\n \"array_model\": [\n 177.8159,\n 243.0424,\n 371.6455,\n 630.0224\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 18.9824,\n 19.6289,\n 0.0,\n 20.9336,\n 0.0,\n 0.0,\n 0.0,\n 23.7949\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 164.0054,\n 228.7319,\n 356.3506,\n 612.4755\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3947,\n 2.1728,\n 3.7345\n ],\n \"array_model\": [\n 164.0054,\n 228.7319,\n 356.3506,\n 612.4755\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 5.1719,\n 5.3184,\n 0.0,\n 5.6387,\n 0.0,\n 0.0,\n 0.0,\n 6.248\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 165.1558,\n 229.9565,\n 357.6357,\n 613.9404\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3924,\n 2.1654,\n 3.7173\n ],\n \"array_model\": [\n 165.1558,\n 229.9565,\n 357.6357,\n 613.9404\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 6.3223,\n 6.543,\n 0.0,\n 6.9238,\n 0.0,\n 0.0,\n 0.0,\n 7.7129\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 166.3101,\n 231.1323,\n 358.9307,\n 615.4209\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3898,\n 2.1582,\n 3.7004\n ],\n \"array_model\": [\n 166.3101,\n 231.1323,\n 358.9307,\n 615.4209\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 7.4766,\n 7.7188,\n 0.0,\n 8.2188,\n 0.0,\n 0.0,\n 0.0,\n 9.1934\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 167.4565,\n 232.3354,\n 360.2099,\n 616.8252\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3874,\n 2.1511,\n 3.6835\n ],\n \"array_model\": [\n 167.4565,\n 232.3354,\n 360.2099,\n 616.8252\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 8.623,\n 8.9219,\n 0.0,\n 9.498,\n 0.0,\n 0.0,\n 0.0,\n 10.5977\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 168.6108,\n 233.5209,\n 361.4892,\n 618.333\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.385,\n 2.1439,\n 3.6672\n ],\n \"array_model\": [\n 168.6108,\n 233.5209,\n 361.4892,\n 618.333\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 9.7773,\n 10.1074,\n 0.0,\n 10.7773,\n 0.0,\n 0.0,\n 0.0,\n 12.1055\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 169.7749,\n 234.724,\n 362.7978,\n 619.7627\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3826,\n 2.1369,\n 3.6505\n ],\n \"array_model\": [\n 169.7749,\n 234.724,\n 362.7978,\n 619.7627\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 10.9414,\n 11.3105,\n 0.0,\n 12.0859,\n 0.0,\n 0.0,\n 0.0,\n 13.5352\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 170.9194,\n 235.9135,\n 364.0205,\n 621.247\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3803,\n 2.1298,\n 3.6347\n ],\n \"array_model\": [\n 170.9194,\n 235.9135,\n 364.0205,\n 621.247\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 12.0859,\n 12.5,\n 0.0,\n 13.3086,\n 0.0,\n 0.0,\n 0.0,\n 15.0195\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 172.0972,\n 237.0893,\n 365.3252,\n 622.663\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.3776,\n 2.1228,\n 3.6181\n ],\n \"array_model\": [\n 172.0972,\n 237.0893,\n 365.3252,\n 622.663\n ],\n \"array_query\": [\n 158.8335,\n 223.4135,\n 350.7119,\n 606.2275\n ],\n \"array_cache\": [\n 13.2637,\n 13.6758,\n 0.0,\n 14.6133,\n 0.0,\n 0.0,\n 0.0,\n 16.4355\n ],\n \"batch_size\": 16,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_1.json": "{\n \"mean\": 1672.664,\n \"array\": [\n 1664.5168,\n 1667.5168,\n 1650.344,\n 1675.344,\n 1683.344,\n 1648.9056,\n 1705.9056,\n 1643.0,\n 1701.0,\n 1682.688,\n 1690.688,\n 1642.7808,\n 1703.7808,\n 1674.1248,\n 1705.1248,\n 1685.7504,\n 1676.7504,\n 1668.968,\n 1674.968,\n 1654.0624,\n 1668.0624,\n 1648.3744,\n 1672.3744,\n 1643.312,\n 1652.312,\n 1653.312,\n 1679.4368,\n 1681.4368,\n 1660.0,\n 1702.0,\n 1688.032,\n 1690.032,\n 1642.5168,\n 1670.5168,\n 1679.344,\n 1692.344,\n 1667.344,\n 1674.9056,\n 1684.9056,\n 1683.0,\n 1664.0,\n 1690.688,\n 1661.688,\n 1643.7808,\n 1686.7808,\n 1678.1248,\n 1652.1248,\n 1658.7504,\n 1688.7504,\n 1684.968,\n 1680.968,\n 1636.0624,\n 1669.0624,\n 1680.3744,\n 1654.3744,\n 1681.312,\n 1669.312,\n 1708.312,\n 1640.4368,\n 1653.4368,\n 1690.0,\n 1701.0,\n 1644.032,\n 1699.032\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_16.json": "{\n \"mean\": 5703.26,\n \"array\": [\n 5725.7088,\n 5757.7088,\n 5728.5936,\n 5782.5936,\n 5702.5936,\n 5701.5936,\n 5764.5936,\n 5690.0,\n 5745.0,\n 5714.6256,\n 5676.6256,\n 5694.688,\n 5713.688,\n 5737.7808,\n 5762.7808,\n 5678.8432,\n 5635.8432,\n 5594.1872,\n 5792.1872,\n 5652.2496,\n 5646.2496,\n 5729.2816,\n 5626.2816,\n 5731.4368,\n 5733.4368,\n 5666.4368,\n 5658.2496,\n 5706.2496,\n 5729.6256,\n 5703.6256,\n 5606.7808,\n 5750.7808,\n 5652.7088,\n 5710.7088,\n 5713.5936,\n 5733.5936,\n 5809.5936,\n 5623.5936,\n 5781.5936,\n 5682.0,\n 5750.0,\n 5697.6256,\n 5790.6256,\n 5718.688,\n 5746.688,\n 5604.7808,\n 5724.7808,\n 5656.8432,\n 5780.8432,\n 5603.1872,\n 5722.1872,\n 5732.2496,\n 5738.2496,\n 5642.2816,\n 5658.2816,\n 5610.4368,\n 5739.4368,\n 5722.4368,\n 5770.2496,\n 5716.2496,\n 5604.6256,\n 5722.6256,\n 5668.7808,\n 5638.7808\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_32.json": "{\n \"mean\": 9990.3418,\n \"array\": [\n 9925.312,\n 10005.312,\n 9841.344,\n 9868.344,\n 10172.344,\n 10034.2816,\n 10068.2816,\n 9894.3744,\n 10163.3744,\n 9905.5008,\n 10130.5008,\n 9859.9376,\n 9974.9376,\n 9874.0624,\n 9985.0624,\n 9977.1568,\n 9930.1568,\n 9851.8432,\n 10155.8432,\n 10054.968,\n 10086.968,\n 9884.5008,\n 9997.5008,\n 10117.8432,\n 10051.8432,\n 10169.8432,\n 9937.2192,\n 10161.2192,\n 9980.5312,\n 10149.5312,\n 10148.4992,\n 10118.4992,\n 9902.312,\n 10015.312,\n 10044.344,\n 9859.344,\n 10030.344,\n 9966.2816,\n 10020.2816,\n 9958.3744,\n 9976.3744,\n 10080.5008,\n 9944.5008,\n 9839.9376,\n 10005.9376,\n 10140.0624,\n 10109.0624,\n 9865.1568,\n 9992.1568,\n 9901.8432,\n 9856.8432,\n 9862.968,\n 9940.968,\n 9829.5008,\n 9944.5008,\n 9831.8432,\n 10038.8432,\n 10058.8432,\n 10116.2192,\n 9941.2192,\n 10076.5312,\n 9874.5312,\n 9871.4992,\n 10008.4992\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_4.json": "{\n \"mean\": 2474.6166,\n \"array\": [\n 2476.8208,\n 2485.8208,\n 2458.7184,\n 2442.7184,\n 2486.7184,\n 2436.4688,\n 2528.4688,\n 2484.9056,\n 2517.9056,\n 2497.312,\n 2454.312,\n 2502.7808,\n 2461.7808,\n 2501.0624,\n 2518.0624,\n 2427.5008,\n 2475.5008,\n 2467.4992,\n 2503.4992,\n 2459.0,\n 2440.0,\n 2448.656,\n 2437.656,\n 2474.2496,\n 2475.2496,\n 2447.2496,\n 2475.5008,\n 2518.5008,\n 2478.688,\n 2502.688,\n 2476.968,\n 2449.968,\n 2445.8208,\n 2485.8208,\n 2481.7184,\n 2457.7184,\n 2502.7184,\n 2484.4688,\n 2459.4688,\n 2481.9056,\n 2521.9056,\n 2450.312,\n 2448.312,\n 2460.7808,\n 2525.7808,\n 2469.0624,\n 2501.0624,\n 2484.5008,\n 2448.5008,\n 2478.4992,\n 2501.4992,\n 2474.0,\n 2496.0,\n 2441.656,\n 2495.656,\n 2460.2496,\n 2432.2496,\n 2455.2496,\n 2452.5008,\n 2465.5008,\n 2490.688,\n 2452.688,\n 2445.968,\n 2510.968\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_llm/query_8.json": "{\n \"mean\": 3559.886,\n \"array\": [\n 3578.3808,\n 3506.3808,\n 3542.8432,\n 3579.8432,\n 3621.8432,\n 3561.968,\n 3537.968,\n 3540.2816,\n 3570.2816,\n 3589.2496,\n 3611.2496,\n 3518.3744,\n 3597.3744,\n 3584.9056,\n 3541.9056,\n 3512.688,\n 3500.688,\n 3515.5312,\n 3575.5312,\n 3523.7808,\n 3519.7808,\n 3586.4688,\n 3493.4688,\n 3583.6256,\n 3533.6256,\n 3623.6256,\n 3598.2816,\n 3595.2816,\n 3539.5936,\n 3586.5936,\n 3550.2192,\n 3584.2192,\n 3508.3808,\n 3534.3808,\n 3556.8432,\n 3538.8432,\n 3597.8432,\n 3592.968,\n 3585.968,\n 3579.2816,\n 3573.2816,\n 3515.2496,\n 3545.2496,\n 3546.3744,\n 3582.3744,\n 3537.9056,\n 3573.9056,\n 3541.688,\n 3600.688,\n 3536.5312,\n 3603.5312,\n 3566.7808,\n 3555.7808,\n 3511.4688,\n 3609.4688,\n 3591.6256,\n 3570.6256,\n 3592.6256,\n 3498.2816,\n 3515.2816,\n 3582.5936,\n 3551.5936,\n 3601.2192,\n 3528.2192\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_slm/query_1.json": "{\n \"mean\": 158.8335,\n \"array\": [\n 160.7522,\n 158.7522,\n 157.1035,\n 157.8535,\n 157.7285,\n 160.5781,\n 157.7031,\n 157.6777,\n 158.8027,\n 158.6484,\n 158.1484,\n 156.752,\n 157.877,\n 156.8477,\n 159.7227,\n 156.9336,\n 161.6836,\n 157.1641,\n 160.5391,\n 160.7363,\n 160.7363,\n 156.3984,\n 159.3984,\n 160.8809,\n 160.1309,\n 157.2559,\n 158.3418,\n 158.2168,\n 157.6367,\n 159.3867,\n 159.5176,\n 161.5176,\n 158.6272,\n 160.6272,\n 159.3535,\n 157.8535,\n 161.6035,\n 156.4531,\n 157.8281,\n 157.0527,\n 157.8027,\n 158.2734,\n 157.5234,\n 160.127,\n 161.002,\n 157.5977,\n 161.2227,\n 156.6836,\n 158.1836,\n 160.6641,\n 159.6641,\n 158.2363,\n 159.4863,\n 156.3984,\n 158.5234,\n 160.7559,\n 158.0059,\n 159.2559,\n 158.5918,\n 161.2168,\n 156.2617,\n 160.2617,\n 160.3926,\n 158.3926\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_slm/query_2.json": "{\n \"mean\": 223.4135,\n \"array\": [\n 224.5668,\n 220.6918,\n 225.6055,\n 221.6055,\n 224.1055,\n 221.9316,\n 220.8066,\n 226.207,\n 223.457,\n 224.9062,\n 226.4062,\n 224.0781,\n 226.0781,\n 224.1426,\n 219.7676,\n 223.1895,\n 222.3145,\n 224.625,\n 222.0,\n 225.5742,\n 220.1992,\n 225.3652,\n 225.8652,\n 222.8203,\n 219.6953,\n 220.1953,\n 222.1172,\n 226.9922,\n 226.1523,\n 225.9023,\n 226.4961,\n 225.8711,\n 219.9418,\n 221.1918,\n 224.2305,\n 224.2305,\n 222.1055,\n 220.9316,\n 221.1816,\n 221.207,\n 226.457,\n 225.9062,\n 223.4062,\n 221.8281,\n 221.8281,\n 219.3926,\n 222.5176,\n 224.4395,\n 226.0645,\n 220.5,\n 226.25,\n 219.0742,\n 224.9492,\n 221.6152,\n 223.7402,\n 222.5703,\n 225.5703,\n 223.0703,\n 224.1172,\n 222.8672,\n 223.1523,\n 224.7773,\n 223.6211,\n 225.9961\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_slm/query_4.json": "{\n \"mean\": 350.7119,\n \"array\": [\n 350.0042,\n 353.3792,\n 345.7734,\n 348.5234,\n 351.5234,\n 353.2363,\n 346.8613,\n 345.7012,\n 346.4512,\n 350.5312,\n 348.5312,\n 347.127,\n 350.752,\n 350.5977,\n 355.4727,\n 348.6641,\n 352.1641,\n 349.6914,\n 353.1914,\n 347.7617,\n 354.5117,\n 345.0059,\n 354.8809,\n 345.1113,\n 348.6113,\n 355.2363,\n 353.3008,\n 354.4258,\n 352.375,\n 348.625,\n 347.8164,\n 354.5664,\n 347.8792,\n 352.8792,\n 352.3984,\n 349.0234,\n 354.7734,\n 349.7363,\n 354.8613,\n 349.3262,\n 355.5762,\n 347.9062,\n 348.7812,\n 347.627,\n 355.377,\n 347.8477,\n 353.2227,\n 351.2891,\n 353.1641,\n 346.5664,\n 355.8164,\n 351.6367,\n 347.1367,\n 346.7559,\n 351.2559,\n 348.8613,\n 347.3613,\n 356.6113,\n 354.1758,\n 351.4258,\n 350.5,\n 353.625,\n 350.3164,\n 351.4414\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_16/query_slm/query_8.json": "{\n \"mean\": 606.2275,\n \"array\": [\n 601.4089,\n 599.0339,\n 600.6973,\n 607.1973,\n 608.4473,\n 614.252,\n 608.877,\n 604.5371,\n 605.9121,\n 604.4316,\n 603.8066,\n 609.9023,\n 609.6523,\n 604.2695,\n 611.1445,\n 601.8398,\n 599.9648,\n 598.3555,\n 605.8555,\n 615.4395,\n 604.1895,\n 605.4648,\n 608.5898,\n 602.125,\n 608.75,\n 615.25,\n 608.9062,\n 611.1562,\n 615.1758,\n 604.5508,\n 607.2051,\n 616.8301,\n 610.6589,\n 611.0339,\n 610.8223,\n 600.1973,\n 606.3223,\n 613.377,\n 609.252,\n 602.9121,\n 602.7871,\n 614.4316,\n 615.9316,\n 601.0273,\n 599.0273,\n 599.6445,\n 606.3945,\n 599.8398,\n 603.5898,\n 614.3555,\n 600.7305,\n 600.8145,\n 606.1895,\n 605.2148,\n 598.9648,\n 612.625,\n 598.375,\n 603.75,\n 607.1562,\n 602.0312,\n 612.0508,\n 605.6758,\n 602.2051,\n 597.9551\n ],\n \"batch_size\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 2.3359,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4219,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.748,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1816\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0836,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1764,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.362\n ],\n \"array\": [\n 2.3359,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4219,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.748,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1816\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 2.5625,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.7246,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9043,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.2832,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0633,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2812,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.561\n ],\n \"array\": [\n 2.5625,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.7246,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9043,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.2832,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 4.7148,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.3008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.0156,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.4023\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1599,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3364,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7001,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4184\n ],\n \"array\": [\n 4.7148,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.3008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.0156,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.4023\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 4.9707,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.7695,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.7031,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.5195,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.1797\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1607,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3485,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7139,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4503\n ],\n \"array\": [\n 4.9707,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.7695,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.7031,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.5195,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.1797\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 5.1992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.0742,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.0742,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.0527,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.0312\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1683,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3606,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7412,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5064\n ],\n \"array\": [\n 5.1992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.0742,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.0742,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.0527,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.0312\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 5.4453,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.3809,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4355,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.5781,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.8555\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1718,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3655,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.759,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5445\n ],\n \"array\": [\n 5.4453,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.3809,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4355,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.5781,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.8555\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 5.6855,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.6895,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.8242,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.0918,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.6699\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1766,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3762,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.775,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5802\n ],\n \"array\": [\n 5.6855,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.6895,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.8242,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.0918,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.6699\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 2.8086,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0195,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.2852,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7988,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.8281\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0751,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1697,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3526,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7191\n ],\n \"array\": [\n 2.8086,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0195,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.2852,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7988,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.8281\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 3.043,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.3379,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.6641,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.3184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.6602\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2041,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4191,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8601\n ],\n \"array\": [\n 3.043,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.3379,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.6641,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.3184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.6602\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 3.2734,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.6348,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0371,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.8438,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.4727\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1104,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2333,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4797,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9773\n ],\n \"array\": [\n 3.2734,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.6348,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0371,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.8438,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.4727\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 3.5176,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.9277,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.4238,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.375,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.2832\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1166,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2576,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.528,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0705\n ],\n \"array\": [\n 3.5176,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.9277,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.4238,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.375,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.2832\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 3.7656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.2344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.8926,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.127\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1245,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2733,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1582\n ],\n \"array\": [\n 3.7656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.2344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.8926,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.127\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 3.9902,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.541,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.1719,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.4355,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.9219\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.138,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2961,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.2359\n ],\n \"array\": [\n 3.9902,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.541,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.1719,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.4355,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.9219\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 4.2402,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.8594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.5508,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.9609,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.7891\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.146,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3091,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6416,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3086\n ],\n \"array\": [\n 4.2402,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.8594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.5508,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.9609,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.7891\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 4.4941,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.1465,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.9277,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4863,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.5332\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1452,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.319,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6658,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3438\n ],\n \"array\": [\n 4.4941,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.1465,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.9277,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4863,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.5332\n ],\n \"batch_size\": 2,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 1.3809,\n 1.3867,\n 0.0,\n 1.3984,\n 0.0,\n 0.0,\n 0.0,\n 1.4453\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0042,\n 0.0,\n 1.0127,\n 0.0,\n 0.0,\n 0.0,\n 1.0467\n ],\n \"array\": [\n 1.3809,\n 1.3867,\n 0.0,\n 1.3984,\n 0.0,\n 0.0,\n 0.0,\n 1.4453\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 1.5273,\n 1.5449,\n 0.0,\n 1.5625,\n 0.0,\n 0.0,\n 0.0,\n 1.6191\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0115,\n 0.0,\n 1.023,\n 0.0,\n 0.0,\n 0.0,\n 1.0601\n ],\n \"array\": [\n 1.5273,\n 1.5449,\n 0.0,\n 1.5625,\n 0.0,\n 0.0,\n 0.0,\n 1.6191\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 2.8281,\n 2.8867,\n 0.0,\n 3.0176,\n 0.0,\n 0.0,\n 0.0,\n 3.2715\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0207,\n 0.0,\n 1.067,\n 0.0,\n 0.0,\n 0.0,\n 1.1568\n ],\n \"array\": [\n 2.8281,\n 2.8867,\n 0.0,\n 3.0176,\n 0.0,\n 0.0,\n 0.0,\n 3.2715\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 2.959,\n 3.0352,\n 0.0,\n 3.1621,\n 0.0,\n 0.0,\n 0.0,\n 3.4609\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0257,\n 0.0,\n 1.0686,\n 0.0,\n 0.0,\n 0.0,\n 1.1696\n ],\n \"array\": [\n 2.959,\n 3.0352,\n 0.0,\n 3.1621,\n 0.0,\n 0.0,\n 0.0,\n 3.4609\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 3.1113,\n 3.1816,\n 0.0,\n 3.3438,\n 0.0,\n 0.0,\n 0.0,\n 3.6328\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0226,\n 0.0,\n 1.0747,\n 0.0,\n 0.0,\n 0.0,\n 1.1676\n ],\n \"array\": [\n 3.1113,\n 3.1816,\n 0.0,\n 3.3438,\n 0.0,\n 0.0,\n 0.0,\n 3.6328\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 3.2422,\n 3.3398,\n 0.0,\n 3.4863,\n 0.0,\n 0.0,\n 0.0,\n 3.8105\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0301,\n 0.0,\n 1.0753,\n 0.0,\n 0.0,\n 0.0,\n 1.1753\n ],\n \"array\": [\n 3.2422,\n 3.3398,\n 0.0,\n 3.4863,\n 0.0,\n 0.0,\n 0.0,\n 3.8105\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 3.4004,\n 3.4766,\n 0.0,\n 3.6465,\n 0.0,\n 0.0,\n 0.0,\n 4.002\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0224,\n 0.0,\n 1.0724,\n 0.0,\n 0.0,\n 0.0,\n 1.1769\n ],\n \"array\": [\n 3.4004,\n 3.4766,\n 0.0,\n 3.6465,\n 0.0,\n 0.0,\n 0.0,\n 4.002\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 1.6699,\n 1.6895,\n 0.0,\n 1.7305,\n 0.0,\n 0.0,\n 0.0,\n 1.8086\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0117,\n 0.0,\n 1.0363,\n 0.0,\n 0.0,\n 0.0,\n 1.083\n ],\n \"array\": [\n 1.6699,\n 1.6895,\n 0.0,\n 1.7305,\n 0.0,\n 0.0,\n 0.0,\n 1.8086\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 1.8164,\n 1.8379,\n 0.0,\n 1.8906,\n 0.0,\n 0.0,\n 0.0,\n 1.9805\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0118,\n 0.0,\n 1.0409,\n 0.0,\n 0.0,\n 0.0,\n 1.0903\n ],\n \"array\": [\n 1.8164,\n 1.8379,\n 0.0,\n 1.8906,\n 0.0,\n 0.0,\n 0.0,\n 1.9805\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 1.9609,\n 1.9902,\n 0.0,\n 2.0527,\n 0.0,\n 0.0,\n 0.0,\n 2.1777\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0149,\n 0.0,\n 1.0468,\n 0.0,\n 0.0,\n 0.0,\n 1.1106\n ],\n \"array\": [\n 1.9609,\n 1.9902,\n 0.0,\n 2.0527,\n 0.0,\n 0.0,\n 0.0,\n 2.1777\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 2.0977,\n 2.1367,\n 0.0,\n 2.209,\n 0.0,\n 0.0,\n 0.0,\n 2.3594\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0186,\n 0.0,\n 1.0531,\n 0.0,\n 0.0,\n 0.0,\n 1.1248\n ],\n \"array\": [\n 2.0977,\n 2.1367,\n 0.0,\n 2.209,\n 0.0,\n 0.0,\n 0.0,\n 2.3594\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 2.2422,\n 2.2891,\n 0.0,\n 2.3711,\n 0.0,\n 0.0,\n 0.0,\n 2.5449\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0209,\n 0.0,\n 1.0575,\n 0.0,\n 0.0,\n 0.0,\n 1.135\n ],\n \"array\": [\n 2.2422,\n 2.2891,\n 0.0,\n 2.3711,\n 0.0,\n 0.0,\n 0.0,\n 2.5449\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 2.3926,\n 2.4336,\n 0.0,\n 2.5293,\n 0.0,\n 0.0,\n 0.0,\n 2.7148\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0171,\n 0.0,\n 1.0571,\n 0.0,\n 0.0,\n 0.0,\n 1.1347\n ],\n \"array\": [\n 2.3926,\n 2.4336,\n 0.0,\n 2.5293,\n 0.0,\n 0.0,\n 0.0,\n 2.7148\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 2.5273,\n 2.5898,\n 0.0,\n 2.6855,\n 0.0,\n 0.0,\n 0.0,\n 2.9023\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0247,\n 0.0,\n 1.0626,\n 0.0,\n 0.0,\n 0.0,\n 1.1484\n ],\n \"array\": [\n 2.5273,\n 2.5898,\n 0.0,\n 2.6855,\n 0.0,\n 0.0,\n 0.0,\n 2.9023\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 2.6758,\n 2.7344,\n 0.0,\n 2.8496,\n 0.0,\n 0.0,\n 0.0,\n 3.082\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0219,\n 0.0,\n 1.065,\n 0.0,\n 0.0,\n 0.0,\n 1.1518\n ],\n \"array\": [\n 2.6758,\n 2.7344,\n 0.0,\n 2.8496,\n 0.0,\n 0.0,\n 0.0,\n 3.082\n ],\n \"batch_size\": 2,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1471.6862,\n 1705.804,\n 1979.7542,\n 2523.3227,\n 3598.3802\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1591,\n 1.3452,\n 1.7146,\n 2.4451\n ],\n \"array_model\": [\n 1471.6862,\n 1705.804,\n 1979.7542,\n 2523.3227,\n 3598.3802\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 37.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 38.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 40.4992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 43.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 50.9056\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1475.3118,\n 1710.6472,\n 1985.7238,\n 2531.8859,\n 3611.4746\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1595,\n 1.346,\n 1.7162,\n 2.4479\n ],\n \"array_model\": [\n 1475.3118,\n 1710.6472,\n 1985.7238,\n 2531.8859,\n 3611.4746\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 41.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 43.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 46.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 52.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 64.0\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1509.7486,\n 1754.5544,\n 2040.0678,\n 2607.6043,\n 3729.9114\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1622,\n 1.3513,\n 1.7272,\n 2.4706\n ],\n \"array_model\": [\n 1509.7486,\n 1754.5544,\n 2040.0678,\n 2607.6043,\n 3729.9114\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 75.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 87.5008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 100.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 128.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 182.4368\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1513.843,\n 1759.3656,\n 2046.5046,\n 2615.6667,\n 3742.3498\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1622,\n 1.3519,\n 1.7278,\n 2.4721\n ],\n \"array_model\": [\n 1513.843,\n 1759.3656,\n 2046.5046,\n 2615.6667,\n 3742.3498\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 79.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 92.312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 107.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 136.312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 194.8752\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1517.499,\n 1764.2408,\n 2052.4422,\n 2624.1979,\n 3755.9738\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1626,\n 1.3525,\n 1.7293,\n 2.4751\n ],\n \"array_model\": [\n 1517.499,\n 1764.2408,\n 2052.4422,\n 2624.1979,\n 3755.9738\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 83.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 97.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 113.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 144.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 208.4992\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1521.4366,\n 1769.148,\n 2058.223,\n 2632.6043,\n 3769.1626\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1628,\n 1.3528,\n 1.7303,\n 2.4774\n ],\n \"array_model\": [\n 1521.4366,\n 1769.148,\n 2058.223,\n 2632.6043,\n 3769.1626\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 87.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 102.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 118.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 153.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 221.688\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1525.2798,\n 1774.0856,\n 2064.4422,\n 2640.8235,\n 3782.193\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1631,\n 1.3535,\n 1.7314,\n 2.4797\n ],\n \"array_model\": [\n 1525.2798,\n 1774.0856,\n 2064.4422,\n 2640.8235,\n 3782.193\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 90.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 107.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 125.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 161.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 234.7184\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1479.2494,\n 1715.3656,\n 1991.8182,\n 2540.1355,\n 3624.7242\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1596,\n 1.3465,\n 1.7172,\n 2.4504\n ],\n \"array_model\": [\n 1479.2494,\n 1715.3656,\n 1991.8182,\n 2540.1355,\n 3624.7242\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 44.9376,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 48.312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 52.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 60.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 77.2496\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1482.9998,\n 1720.46,\n 1997.8806,\n 2548.4491,\n 3638.0378\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1601,\n 1.3472,\n 1.7184,\n 2.4532\n ],\n \"array_model\": [\n 1482.9998,\n 1720.46,\n 1997.8806,\n 2548.4491,\n 3638.0378\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 48.688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 53.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 58.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 69.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 90.5632\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1486.6862,\n 1725.2104,\n 2003.8486,\n 2556.8555,\n 3651.0378\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1604,\n 1.3479,\n 1.7198,\n 2.4558\n ],\n \"array_model\": [\n 1486.6862,\n 1725.2104,\n 2003.8486,\n 2556.8555,\n 3651.0378\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 52.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 58.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 64.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 77.5008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 103.5632\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1490.5934,\n 1729.8968,\n 2010.0358,\n 2565.3547,\n 3664.0058\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1605,\n 1.3485,\n 1.721,\n 2.4581\n ],\n \"array_model\": [\n 1490.5934,\n 1729.8968,\n 2010.0358,\n 2565.3547,\n 3664.0058\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 56.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 62.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 70.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 86.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 116.5312\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1494.5614,\n 1734.804,\n 2015.9734,\n 2573.6363,\n 3677.5066\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1607,\n 1.3489,\n 1.722,\n 2.4606\n ],\n \"array_model\": [\n 1494.5614,\n 1734.804,\n 2015.9734,\n 2573.6363,\n 3677.5066\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 60.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 67.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 76.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 94.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 130.032\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1498.155,\n 1739.7096,\n 2022.0054,\n 2582.3227,\n 3690.225\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1612,\n 1.3497,\n 1.7237,\n 2.4632\n ],\n \"array_model\": [\n 1498.155,\n 1739.7096,\n 2022.0054,\n 2582.3227,\n 3690.225\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 63.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 72.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 82.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 102.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 142.7504\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1502.155,\n 1744.804,\n 2028.0678,\n 2590.7291,\n 3704.1002\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1615,\n 1.3501,\n 1.7247,\n 2.4659\n ],\n \"array_model\": [\n 1502.155,\n 1744.804,\n 2028.0678,\n 2590.7291,\n 3704.1002\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 67.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 77.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 88.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 111.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 156.6256\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1506.2174,\n 1749.3976,\n 2034.0982,\n 2599.1355,\n 3716.0058\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.1615,\n 1.3505,\n 1.7256,\n 2.4671\n ],\n \"array_model\": [\n 1506.2174,\n 1749.3976,\n 2034.0982,\n 2599.1355,\n 3716.0058\n ],\n \"array_query\": [\n 1434.3118,\n 1667.0536,\n 1939.255,\n 2479.3547,\n 3547.4746\n ],\n \"array_cache\": [\n 71.9056,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 82.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 94.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 119.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 168.5312\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 104.3586,\n 112.3887,\n 128.3368,\n 160.5678\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0769,\n 1.2298,\n 1.5386\n ],\n \"array_model\": [\n 104.3586,\n 112.3887,\n 128.3368,\n 160.5678\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 1.3809,\n 1.3867,\n 0.0,\n 1.3984,\n 0.0,\n 0.0,\n 0.0,\n 1.4453\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 104.505,\n 112.5469,\n 128.5009,\n 160.7416\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.077,\n 1.2296,\n 1.5381\n ],\n \"array_model\": [\n 104.505,\n 112.5469,\n 128.5009,\n 160.7416\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 1.5273,\n 1.5449,\n 0.0,\n 1.5625,\n 0.0,\n 0.0,\n 0.0,\n 1.6191\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.8058,\n 113.8887,\n 129.956,\n 162.394\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0764,\n 1.2283,\n 1.5348\n ],\n \"array_model\": [\n 105.8058,\n 113.8887,\n 129.956,\n 162.394\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.8281,\n 2.8867,\n 0.0,\n 3.0176,\n 0.0,\n 0.0,\n 0.0,\n 3.2715\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.9367,\n 114.0372,\n 130.1005,\n 162.5834\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0765,\n 1.2281,\n 1.5347\n ],\n \"array_model\": [\n 105.9367,\n 114.0372,\n 130.1005,\n 162.5834\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.959,\n 3.0352,\n 0.0,\n 3.1621,\n 0.0,\n 0.0,\n 0.0,\n 3.4609\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 106.089,\n 114.1836,\n 130.2822,\n 162.7553\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0763,\n 1.228,\n 1.5341\n ],\n \"array_model\": [\n 106.089,\n 114.1836,\n 130.2822,\n 162.7553\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 3.1113,\n 3.1816,\n 0.0,\n 3.3438,\n 0.0,\n 0.0,\n 0.0,\n 3.6328\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 106.2199,\n 114.3418,\n 130.4247,\n 162.933\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0765,\n 1.2279,\n 1.5339\n ],\n \"array_model\": [\n 106.2199,\n 114.3418,\n 130.4247,\n 162.933\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 3.2422,\n 3.3398,\n 0.0,\n 3.4863,\n 0.0,\n 0.0,\n 0.0,\n 3.8105\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 106.3781,\n 114.4786,\n 130.5849,\n 163.1245\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0761,\n 1.2276,\n 1.5334\n ],\n \"array_model\": [\n 106.3781,\n 114.4786,\n 130.5849,\n 163.1245\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 3.4004,\n 3.4766,\n 0.0,\n 3.6465,\n 0.0,\n 0.0,\n 0.0,\n 4.002\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 104.6476,\n 112.6915,\n 128.6689,\n 160.9311\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0769,\n 1.2295,\n 1.5378\n ],\n \"array_model\": [\n 104.6476,\n 112.6915,\n 128.6689,\n 160.9311\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 1.6699,\n 1.6895,\n 0.0,\n 1.7305,\n 0.0,\n 0.0,\n 0.0,\n 1.8086\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 104.7941,\n 112.8399,\n 128.829,\n 161.103\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0768,\n 1.2294,\n 1.5373\n ],\n \"array_model\": [\n 104.7941,\n 112.8399,\n 128.829,\n 161.103\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 1.8164,\n 1.8379,\n 0.0,\n 1.8906,\n 0.0,\n 0.0,\n 0.0,\n 1.9805\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 104.9386,\n 112.9922,\n 128.9911,\n 161.3002\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0767,\n 1.2292,\n 1.5371\n ],\n \"array_model\": [\n 104.9386,\n 112.9922,\n 128.9911,\n 161.3002\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 1.9609,\n 1.9902,\n 0.0,\n 2.0527,\n 0.0,\n 0.0,\n 0.0,\n 2.1777\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.0754,\n 113.1387,\n 129.1474,\n 161.4819\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0767,\n 1.2291,\n 1.5368\n ],\n \"array_model\": [\n 105.0754,\n 113.1387,\n 129.1474,\n 161.4819\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.0977,\n 2.1367,\n 0.0,\n 2.209,\n 0.0,\n 0.0,\n 0.0,\n 2.3594\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.2199,\n 113.2911,\n 129.3095,\n 161.6674\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0767,\n 1.2289,\n 1.5365\n ],\n \"array_model\": [\n 105.2199,\n 113.2911,\n 129.3095,\n 161.6674\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.2422,\n 2.2891,\n 0.0,\n 2.3711,\n 0.0,\n 0.0,\n 0.0,\n 2.5449\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.3703,\n 113.4356,\n 129.4677,\n 161.8373\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0765,\n 1.2287,\n 1.5359\n ],\n \"array_model\": [\n 105.3703,\n 113.4356,\n 129.4677,\n 161.8373\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.3926,\n 2.4336,\n 0.0,\n 2.5293,\n 0.0,\n 0.0,\n 0.0,\n 2.7148\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.505,\n 113.5918,\n 129.6239,\n 162.0248\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0766,\n 1.2286,\n 1.5357\n ],\n \"array_model\": [\n 105.505,\n 113.5918,\n 129.6239,\n 162.0248\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.5273,\n 2.5898,\n 0.0,\n 2.6855,\n 0.0,\n 0.0,\n 0.0,\n 2.9023\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 105.6535,\n 113.7364,\n 129.788,\n 162.2045\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0765,\n 1.2284,\n 1.5352\n ],\n \"array_model\": [\n 105.6535,\n 113.7364,\n 129.788,\n 162.2045\n ],\n \"array_query\": [\n 102.9777,\n 111.002,\n 126.9384,\n 159.1225\n ],\n \"array_cache\": [\n 2.6758,\n 2.7344,\n 0.0,\n 2.8496,\n 0.0,\n 0.0,\n 0.0,\n 3.082\n ],\n \"batch_size\": 2,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_2/query_llm/query_1.json": "{\n \"mean\": 1434.3118,\n \"array\": [\n 1451.6256,\n 1452.6256,\n 1436.0,\n 1448.0,\n 1440.0,\n 1447.0624,\n 1415.0624,\n 1437.312,\n 1414.312,\n 1432.6256,\n 1431.6256,\n 1452.7184,\n 1450.7184,\n 1436.7504,\n 1426.7504,\n 1421.1568,\n 1421.1568,\n 1422.1568,\n 1433.1568,\n 1453.0944,\n 1447.0944,\n 1417.5632,\n 1455.5632,\n 1446.4688,\n 1413.4688,\n 1425.4688,\n 1422.8128,\n 1416.8128,\n 1410.8752,\n 1451.8752,\n 1452.032,\n 1454.032,\n 1431.6256,\n 1446.6256,\n 1428.0,\n 1441.0,\n 1425.0,\n 1424.0624,\n 1422.0624,\n 1438.312,\n 1423.312,\n 1452.6256,\n 1433.6256,\n 1423.7184,\n 1452.7184,\n 1439.7504,\n 1419.7504,\n 1419.1568,\n 1444.1568,\n 1419.1568,\n 1419.1568,\n 1419.0944,\n 1444.0944,\n 1419.5632,\n 1454.5632,\n 1418.4688,\n 1452.4688,\n 1439.4688,\n 1441.8128,\n 1445.8128,\n 1412.8752,\n 1419.8752,\n 1446.032,\n 1440.032\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_llm/query_16.json": "{\n \"mean\": 1939.255,\n \"array\": [\n 1940.5008,\n 1921.5008,\n 1941.5312,\n 1943.5312,\n 1961.5312,\n 1964.4368,\n 1926.4368,\n 1965.3744,\n 1967.3744,\n 1922.4064,\n 1931.4064,\n 1963.2192,\n 1946.2192,\n 1939.2816,\n 1950.2816,\n 1952.2496,\n 1919.2496,\n 1959.1872,\n 1926.1872,\n 1921.1568,\n 1939.1568,\n 1935.1872,\n 1936.1872,\n 1958.7504,\n 1923.7504,\n 1923.7504,\n 1941.8128,\n 1920.8128,\n 1937.032,\n 1930.032,\n 1919.8128,\n 1963.8128,\n 1948.5008,\n 1960.5008,\n 1932.5312,\n 1953.5312,\n 1959.5312,\n 1914.4368,\n 1916.4368,\n 1922.3744,\n 1946.3744,\n 1960.4064,\n 1927.4064,\n 1960.2192,\n 1942.2192,\n 1912.2816,\n 1934.2816,\n 1920.2496,\n 1912.2496,\n 1908.1872,\n 1945.1872,\n 1924.1568,\n 1959.1568,\n 1954.1872,\n 1920.1872,\n 1954.7504,\n 1965.7504,\n 1953.7504,\n 1949.8128,\n 1937.8128,\n 1931.032,\n 1943.032,\n 1936.8128,\n 1911.8128\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_llm/query_32.json": "{\n \"mean\": 2479.3547,\n \"array\": [\n 2486.032,\n 2485.032,\n 2438.4688,\n 2495.4688,\n 2481.4688,\n 2501.2192,\n 2510.2192,\n 2441.9056,\n 2484.9056,\n 2493.4992,\n 2508.4992,\n 2494.0,\n 2455.0,\n 2471.7184,\n 2484.7184,\n 2495.032,\n 2462.032,\n 2478.6256,\n 2449.6256,\n 2499.2192,\n 2508.2192,\n 2443.7504,\n 2496.7504,\n 2452.688,\n 2512.688,\n 2479.688,\n 2481.1568,\n 2518.1568,\n 2485.7504,\n 2458.7504,\n 2477.5312,\n 2498.5312,\n 2459.032,\n 2468.032,\n 2502.4688,\n 2477.4688,\n 2459.4688,\n 2485.2192,\n 2503.2192,\n 2444.9056,\n 2515.9056,\n 2480.4992,\n 2456.4992,\n 2483.0,\n 2496.0,\n 2452.7184,\n 2460.7184,\n 2500.032,\n 2448.032,\n 2495.6256,\n 2494.6256,\n 2476.2192,\n 2441.2192,\n 2484.7504,\n 2458.7504,\n 2441.688,\n 2479.688,\n 2501.688,\n 2488.1568,\n 2450.1568,\n 2501.7504,\n 2453.7504,\n 2481.5312,\n 2505.5312\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_llm/query_64.json": "{\n \"mean\": 3547.4746,\n \"array\": [\n 3598.0944,\n 3582.0944,\n 3499.0,\n 3511.0,\n 3511.0,\n 3534.7504,\n 3502.7504,\n 3522.4368,\n 3591.4368,\n 3552.4368,\n 3541.4368,\n 3557.4688,\n 3505.4688,\n 3532.968,\n 3541.968,\n 3571.2496,\n 3540.2496,\n 3491.3744,\n 3568.3744,\n 3534.4688,\n 3514.4688,\n 3528.5632,\n 3600.5632,\n 3538.1248,\n 3603.1248,\n 3554.1248,\n 3599.5008,\n 3540.5008,\n 3495.312,\n 3566.312,\n 3603.2816,\n 3576.2816,\n 3495.0944,\n 3537.0944,\n 3511.0,\n 3592.0,\n 3593.0,\n 3578.7504,\n 3559.7504,\n 3576.4368,\n 3509.4368,\n 3538.4368,\n 3536.4368,\n 3565.4688,\n 3577.4688,\n 3576.968,\n 3542.968,\n 3567.2496,\n 3501.2496,\n 3587.3744,\n 3545.3744,\n 3585.4688,\n 3496.4688,\n 3507.5632,\n 3527.5632,\n 3600.1248,\n 3495.1248,\n 3541.1248,\n 3550.5008,\n 3571.5008,\n 3581.312,\n 3503.312,\n 3575.2816,\n 3501.2816\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_llm/query_8.json": "{\n \"mean\": 1667.0536,\n \"array\": [\n 1657.2496,\n 1655.2496,\n 1663.4064,\n 1694.4064,\n 1680.4064,\n 1682.688,\n 1673.688,\n 1684.5936,\n 1653.5936,\n 1665.8432,\n 1679.8432,\n 1668.1568,\n 1677.1568,\n 1643.2496,\n 1668.2496,\n 1693.344,\n 1684.344,\n 1644.2496,\n 1649.2496,\n 1642.656,\n 1646.656,\n 1676.4992,\n 1682.4992,\n 1680.688,\n 1642.688,\n 1691.688,\n 1649.8128,\n 1650.8128,\n 1690.9056,\n 1669.9056,\n 1670.968,\n 1655.968,\n 1671.2496,\n 1659.2496,\n 1641.4064,\n 1663.4064,\n 1685.4064,\n 1644.688,\n 1673.688,\n 1642.5936,\n 1690.5936,\n 1678.8432,\n 1656.8432,\n 1642.1568,\n 1680.1568,\n 1692.2496,\n 1646.2496,\n 1664.344,\n 1664.344,\n 1663.2496,\n 1685.2496,\n 1663.656,\n 1678.656,\n 1671.4992,\n 1664.4992,\n 1646.688,\n 1660.688,\n 1644.688,\n 1649.8128,\n 1691.8128,\n 1672.9056,\n 1691.9056,\n 1681.968,\n 1655.968\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_slm/query_1.json": "{\n \"mean\": 102.9777,\n \"array\": [\n 102.9941,\n 103.1191,\n 101.7227,\n 101.9727,\n 102.9727,\n 104.0801,\n 101.5801,\n 103.9336,\n 103.4336,\n 103.9141,\n 102.0391,\n 103.1523,\n 103.2773,\n 103.7578,\n 103.2578,\n 102.3574,\n 104.1074,\n 101.5977,\n 103.7227,\n 102.8242,\n 104.1992,\n 104.4219,\n 103.2969,\n 103.666,\n 102.916,\n 102.291,\n 102.5137,\n 101.8887,\n 102.8828,\n 103.5078,\n 102.0996,\n 103.5996,\n 104.2441,\n 102.8691,\n 103.8477,\n 104.3477,\n 102.2227,\n 101.8301,\n 102.8301,\n 104.5586,\n 103.6836,\n 102.6641,\n 102.0391,\n 104.2773,\n 101.9023,\n 103.0078,\n 104.2578,\n 102.1074,\n 103.7324,\n 101.7227,\n 102.3477,\n 101.5742,\n 102.4492,\n 102.5469,\n 101.7969,\n 101.416,\n 104.041,\n 102.416,\n 104.1387,\n 103.8887,\n 102.1328,\n 103.2578,\n 103.4746,\n 101.8496\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_slm/query_2.json": "{\n \"mean\": 111.002,\n \"array\": [\n 110.8633,\n 110.4883,\n 110.9551,\n 112.2051,\n 110.8301,\n 112.6855,\n 109.9355,\n 112.0371,\n 112.1621,\n 109.5098,\n 111.8848,\n 110.4883,\n 110.7383,\n 109.9609,\n 110.5859,\n 110.3164,\n 110.6914,\n 110.0352,\n 111.7852,\n 111.3906,\n 111.5156,\n 109.3633,\n 112.4883,\n 109.9648,\n 111.7148,\n 110.2148,\n 110.8184,\n 112.4434,\n 110.1602,\n 111.7852,\n 109.5234,\n 109.8984,\n 110.6133,\n 112.4883,\n 111.0801,\n 110.7051,\n 109.4551,\n 112.1855,\n 109.6855,\n 112.0371,\n 111.4121,\n 110.0098,\n 112.3848,\n 109.3633,\n 112.7383,\n 112.5859,\n 111.8359,\n 111.4414,\n 112.0664,\n 110.0352,\n 112.1602,\n 111.5156,\n 109.3906,\n 110.4883,\n 111.4883,\n 112.0898,\n 109.5898,\n 110.4648,\n 109.6934,\n 110.1934,\n 111.9102,\n 111.9102,\n 110.3984,\n 111.2734\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_slm/query_4.json": "{\n \"mean\": 126.9384,\n \"array\": [\n 126.1016,\n 127.8516,\n 128.5625,\n 126.5625,\n 127.8125,\n 128.8945,\n 127.5195,\n 126.7344,\n 127.8594,\n 125.4473,\n 126.1973,\n 128.041,\n 126.416,\n 126.7539,\n 126.7539,\n 126.7207,\n 125.5957,\n 125.1895,\n 125.8145,\n 127.7754,\n 125.6504,\n 125.7324,\n 128.4824,\n 127.7129,\n 125.9629,\n 128.8379,\n 125.0312,\n 126.0312,\n 128.3887,\n 128.6387,\n 127.9785,\n 128.7285,\n 128.2266,\n 126.7266,\n 125.3125,\n 126.9375,\n 128.0625,\n 125.1445,\n 125.8945,\n 125.3594,\n 126.7344,\n 126.4473,\n 127.3223,\n 126.041,\n 127.416,\n 127.7539,\n 128.8789,\n 127.4707,\n 125.4707,\n 127.0645,\n 125.9395,\n 125.5254,\n 125.5254,\n 125.1074,\n 128.8574,\n 128.4629,\n 125.7129,\n 128.0879,\n 126.4062,\n 128.0312,\n 126.6387,\n 126.1387,\n 127.1035,\n 128.4785\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_2/query_slm/query_8.json": "{\n \"mean\": 159.1225,\n \"array\": [\n 157.8047,\n 158.1797,\n 159.7559,\n 159.7559,\n 156.7559,\n 160.8164,\n 160.5664,\n 159.7695,\n 161.1445,\n 156.5723,\n 160.8223,\n 157.0156,\n 159.3906,\n 158.4551,\n 160.7051,\n 157.5352,\n 159.1602,\n 156.8477,\n 160.0977,\n 160.168,\n 157.793,\n 160.1035,\n 158.7285,\n 159.2891,\n 160.7891,\n 158.4141,\n 157.6172,\n 158.8672,\n 159.0645,\n 160.9395,\n 157.748,\n 158.623,\n 159.9297,\n 160.0547,\n 158.5059,\n 158.7559,\n 161.0059,\n 161.3164,\n 158.3164,\n 157.0195,\n 160.2695,\n 157.6973,\n 156.5723,\n 158.7656,\n 159.6406,\n 161.3301,\n 160.2051,\n 160.1602,\n 161.1602,\n 159.5977,\n 159.4727,\n 160.543,\n 160.418,\n 156.8535,\n 157.3535,\n 159.5391,\n 160.7891,\n 157.1641,\n 160.4922,\n 156.7422,\n 157.4395,\n 160.9395,\n 158.873,\n 157.623\n ],\n \"batch_size\": 2,\n \"instability_rate\": 0.0\n}", "bs_32/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 7.6087,\n 0.0,\n 0.0,\n 8.2647,\n 0.0,\n 0.0,\n 0.0,\n 9.2017,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.7557,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.3167\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0862,\n 0.0,\n 0.0,\n 0.0,\n 1.2094,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4136,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8816\n ],\n \"array\": [\n 7.6087,\n 0.0,\n 0.0,\n 8.2647,\n 0.0,\n 0.0,\n 0.0,\n 9.2017,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.7557,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.3167\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 11.4766,\n 0.0,\n 0.0,\n 12.6055,\n 0.0,\n 0.0,\n 0.0,\n 14.0742,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.9922,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 22.8333\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.0984,\n 0.0,\n 0.0,\n 0.0,\n 1.2263,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4806,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9896\n ],\n \"array\": [\n 11.4766,\n 0.0,\n 0.0,\n 12.6055,\n 0.0,\n 0.0,\n 0.0,\n 14.0742,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.9922,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 22.8333\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 45.9688,\n 0.0,\n 0.0,\n 51.0508,\n 0.0,\n 0.0,\n 0.0,\n 57.8281,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 71.5078,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 98.6367\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1106,\n 0.0,\n 0.0,\n 0.0,\n 1.258,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5556,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1457\n ],\n \"array\": [\n 45.9688,\n 0.0,\n 0.0,\n 51.0508,\n 0.0,\n 0.0,\n 0.0,\n 57.8281,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 71.5078,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 98.6367\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 49.7246,\n 0.0,\n 0.0,\n 55.2227,\n 0.0,\n 0.0,\n 0.0,\n 62.6875,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 77.5273,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 106.832\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1106,\n 0.0,\n 0.0,\n 0.0,\n 1.2607,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5591,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1485\n ],\n \"array\": [\n 49.7246,\n 0.0,\n 0.0,\n 55.2227,\n 0.0,\n 0.0,\n 0.0,\n 62.6875,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 77.5273,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 106.832\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 53.7559,\n 0.0,\n 0.0,\n 59.709,\n 0.0,\n 0.0,\n 0.0,\n 67.623,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 83.459,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 115.2617\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1107,\n 0.0,\n 0.0,\n 0.0,\n 1.258,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5526,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1442\n ],\n \"array\": [\n 53.7559,\n 0.0,\n 0.0,\n 59.709,\n 0.0,\n 0.0,\n 0.0,\n 67.623,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 83.459,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 115.2617\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 57.5801,\n 0.0,\n 0.0,\n 63.9434,\n 0.0,\n 0.0,\n 0.0,\n 72.4824,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 89.4648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 123.8672\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1105,\n 0.0,\n 0.0,\n 0.0,\n 1.2588,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5537,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1512\n ],\n \"array\": [\n 57.5801,\n 0.0,\n 0.0,\n 63.9434,\n 0.0,\n 0.0,\n 0.0,\n 72.4824,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 89.4648,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 123.8672\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 61.2578,\n 0.0,\n 0.0,\n 68.0039,\n 0.0,\n 0.0,\n 0.0,\n 77.2578,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 95.2793,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 132.1816\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1101,\n 0.0,\n 0.0,\n 0.0,\n 1.2612,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5554,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1578\n ],\n \"array\": [\n 61.2578,\n 0.0,\n 0.0,\n 68.0039,\n 0.0,\n 0.0,\n 0.0,\n 77.2578,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 95.2793,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 132.1816\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 15.3223,\n 0.0,\n 0.0,\n 16.8809,\n 0.0,\n 0.0,\n 0.0,\n 18.9531,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 23.0781,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 31.3027\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1017,\n 0.0,\n 0.0,\n 0.0,\n 1.237,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5062,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.043\n ],\n \"array\": [\n 15.3223,\n 0.0,\n 0.0,\n 16.8809,\n 0.0,\n 0.0,\n 0.0,\n 18.9531,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 23.0781,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 31.3027\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 19.1523,\n 0.0,\n 0.0,\n 21.1621,\n 0.0,\n 0.0,\n 0.0,\n 23.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 29.0684,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.6055\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1049,\n 0.0,\n 0.0,\n 0.0,\n 1.2424,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5177,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0679\n ],\n \"array\": [\n 19.1523,\n 0.0,\n 0.0,\n 21.1621,\n 0.0,\n 0.0,\n 0.0,\n 23.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 29.0684,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.6055\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 22.9648,\n 0.0,\n 0.0,\n 25.4082,\n 0.0,\n 0.0,\n 0.0,\n 28.6953,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 35.1875,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 47.9297\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1064,\n 0.0,\n 0.0,\n 0.0,\n 1.2495,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5322,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0871\n ],\n \"array\": [\n 22.9648,\n 0.0,\n 0.0,\n 25.4082,\n 0.0,\n 0.0,\n 0.0,\n 28.6953,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 35.1875,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 47.9297\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 26.8359,\n 0.0,\n 0.0,\n 29.7344,\n 0.0,\n 0.0,\n 0.0,\n 33.4883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 41.2734,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 56.3906\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.108,\n 0.0,\n 0.0,\n 0.0,\n 1.2479,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.538,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1013\n ],\n \"array\": [\n 26.8359,\n 0.0,\n 0.0,\n 29.7344,\n 0.0,\n 0.0,\n 0.0,\n 33.4883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 41.2734,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 56.3906\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 30.7656,\n 0.0,\n 0.0,\n 33.9766,\n 0.0,\n 0.0,\n 0.0,\n 38.3164,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 47.3594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 64.9316\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1044,\n 0.0,\n 0.0,\n 0.0,\n 1.2454,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5394,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1105\n ],\n \"array\": [\n 30.7656,\n 0.0,\n 0.0,\n 33.9766,\n 0.0,\n 0.0,\n 0.0,\n 38.3164,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 47.3594,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 64.9316\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 34.3906,\n 0.0,\n 0.0,\n 38.1875,\n 0.0,\n 0.0,\n 0.0,\n 43.2227,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 53.2461,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 73.4688\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1104,\n 0.0,\n 0.0,\n 0.0,\n 1.2568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5483,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1363\n ],\n \"array\": [\n 34.3906,\n 0.0,\n 0.0,\n 38.1875,\n 0.0,\n 0.0,\n 0.0,\n 43.2227,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 53.2461,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 73.4688\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 38.4199,\n 0.0,\n 0.0,\n 42.6074,\n 0.0,\n 0.0,\n 0.0,\n 48.0703,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 59.2812,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 81.6309\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.109,\n 0.0,\n 0.0,\n 0.0,\n 1.2512,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.543,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1247\n ],\n \"array\": [\n 38.4199,\n 0.0,\n 0.0,\n 42.6074,\n 0.0,\n 0.0,\n 0.0,\n 48.0703,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 59.2812,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 81.6309\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 42.2402,\n 0.0,\n 0.0,\n 46.8691,\n 0.0,\n 0.0,\n 0.0,\n 53.0859,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 65.1641,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 90.3203\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 1.1096,\n 0.0,\n 0.0,\n 0.0,\n 1.2568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5427,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1383\n ],\n \"array\": [\n 42.2402,\n 0.0,\n 0.0,\n 46.8691,\n 0.0,\n 0.0,\n 0.0,\n 53.0859,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 65.1641,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 90.3203\n ],\n \"batch_size\": 32,\n \"max_query_length\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 4.5571,\n 4.7473,\n 0.0,\n 4.983,\n 0.0,\n 0.0,\n 0.0,\n 5.4844\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0417,\n 0.0,\n 1.0935,\n 0.0,\n 0.0,\n 0.0,\n 1.2035\n ],\n \"array\": [\n 4.5571,\n 4.7473,\n 0.0,\n 4.983,\n 0.0,\n 0.0,\n 0.0,\n 5.4844\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 6.8711,\n 7.0977,\n 0.0,\n 7.5449,\n 0.0,\n 0.0,\n 0.0,\n 8.418\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.033,\n 0.0,\n 1.0981,\n 0.0,\n 0.0,\n 0.0,\n 1.2251\n ],\n \"array\": [\n 6.8711,\n 7.0977,\n 0.0,\n 7.5449,\n 0.0,\n 0.0,\n 0.0,\n 8.418\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 27.5762,\n 28.6191,\n 0.0,\n 30.6445,\n 0.0,\n 0.0,\n 0.0,\n 34.7461\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0378,\n 0.0,\n 1.1113,\n 0.0,\n 0.0,\n 0.0,\n 1.26\n ],\n \"array\": [\n 27.5762,\n 28.6191,\n 0.0,\n 30.6445,\n 0.0,\n 0.0,\n 0.0,\n 34.7461\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 29.8438,\n 31.0527,\n 0.0,\n 33.2891,\n 0.0,\n 0.0,\n 0.0,\n 37.6777\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0405,\n 0.0,\n 1.1154,\n 0.0,\n 0.0,\n 0.0,\n 1.2625\n ],\n \"array\": [\n 29.8438,\n 31.0527,\n 0.0,\n 33.2891,\n 0.0,\n 0.0,\n 0.0,\n 37.6777\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 32.082,\n 33.4531,\n 0.0,\n 35.7559,\n 0.0,\n 0.0,\n 0.0,\n 40.5898\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0427,\n 0.0,\n 1.1145,\n 0.0,\n 0.0,\n 0.0,\n 1.2652\n ],\n \"array\": [\n 32.082,\n 33.4531,\n 0.0,\n 35.7559,\n 0.0,\n 0.0,\n 0.0,\n 40.5898\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 34.5742,\n 35.7129,\n 0.0,\n 38.2969,\n 0.0,\n 0.0,\n 0.0,\n 43.4141\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0329,\n 0.0,\n 1.1077,\n 0.0,\n 0.0,\n 0.0,\n 1.2557\n ],\n \"array\": [\n 34.5742,\n 35.7129,\n 0.0,\n 38.2969,\n 0.0,\n 0.0,\n 0.0,\n 43.4141\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 36.7812,\n 38.2383,\n 0.0,\n 40.9473,\n 0.0,\n 0.0,\n 0.0,\n 46.4043\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0396,\n 0.0,\n 1.1133,\n 0.0,\n 0.0,\n 0.0,\n 1.2616\n ],\n \"array\": [\n 36.7812,\n 38.2383,\n 0.0,\n 40.9473,\n 0.0,\n 0.0,\n 0.0,\n 46.4043\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 9.2012,\n 9.4746,\n 0.0,\n 10.1133,\n 0.0,\n 0.0,\n 0.0,\n 11.3223\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0297,\n 0.0,\n 1.0991,\n 0.0,\n 0.0,\n 0.0,\n 1.2305\n ],\n \"array\": [\n 9.2012,\n 9.4746,\n 0.0,\n 10.1133,\n 0.0,\n 0.0,\n 0.0,\n 11.3223\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 11.4941,\n 11.8945,\n 0.0,\n 12.6582,\n 0.0,\n 0.0,\n 0.0,\n 14.2559\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0348,\n 0.0,\n 1.1013,\n 0.0,\n 0.0,\n 0.0,\n 1.2403\n ],\n \"array\": [\n 11.4941,\n 11.8945,\n 0.0,\n 12.6582,\n 0.0,\n 0.0,\n 0.0,\n 14.2559\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 13.7988,\n 14.248,\n 0.0,\n 15.2363,\n 0.0,\n 0.0,\n 0.0,\n 17.209\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0326,\n 0.0,\n 1.1042,\n 0.0,\n 0.0,\n 0.0,\n 1.2471\n ],\n \"array\": [\n 13.7988,\n 14.248,\n 0.0,\n 15.2363,\n 0.0,\n 0.0,\n 0.0,\n 17.209\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 16.0547,\n 16.6504,\n 0.0,\n 17.8203,\n 0.0,\n 0.0,\n 0.0,\n 20.1133\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0371,\n 0.0,\n 1.11,\n 0.0,\n 0.0,\n 0.0,\n 1.2528\n ],\n \"array\": [\n 16.0547,\n 16.6504,\n 0.0,\n 17.8203,\n 0.0,\n 0.0,\n 0.0,\n 20.1133\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 18.3613,\n 19.0762,\n 0.0,\n 20.375,\n 0.0,\n 0.0,\n 0.0,\n 22.9805\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0389,\n 0.0,\n 1.1097,\n 0.0,\n 0.0,\n 0.0,\n 1.2516\n ],\n \"array\": [\n 18.3613,\n 19.0762,\n 0.0,\n 20.375,\n 0.0,\n 0.0,\n 0.0,\n 22.9805\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 20.7168,\n 21.416,\n 0.0,\n 22.9863,\n 0.0,\n 0.0,\n 0.0,\n 25.9473\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0338,\n 0.0,\n 1.1096,\n 0.0,\n 0.0,\n 0.0,\n 1.2525\n ],\n \"array\": [\n 20.7168,\n 21.416,\n 0.0,\n 22.9863,\n 0.0,\n 0.0,\n 0.0,\n 25.9473\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 23.0,\n 23.8809,\n 0.0,\n 25.5117,\n 0.0,\n 0.0,\n 0.0,\n 28.8359\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0383,\n 0.0,\n 1.1092,\n 0.0,\n 0.0,\n 0.0,\n 1.2537\n ],\n \"array\": [\n 23.0,\n 23.8809,\n 0.0,\n 25.5117,\n 0.0,\n 0.0,\n 0.0,\n 28.8359\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 25.2539,\n 26.2285,\n 0.0,\n 28.0098,\n 0.0,\n 0.0,\n 0.0,\n 31.8281\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0386,\n 0.0,\n 1.1091,\n 0.0,\n 0.0,\n 0.0,\n 1.2603\n ],\n \"array\": [\n 25.2539,\n 26.2285,\n 0.0,\n 28.0098,\n 0.0,\n 0.0,\n 0.0,\n 31.8281\n ],\n \"batch_size\": 32,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2058.2682,\n 3681.5699,\n 5854.7835,\n 10180.7809,\n 18858.7877\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.7887,\n 2.8445,\n 4.9463,\n 9.1625\n ],\n \"array_model\": [\n 2058.2682,\n 3681.5699,\n 5854.7835,\n 10180.7809,\n 18858.7877\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 121.7392,\n 0.0,\n 0.0,\n 132.2352,\n 0.0,\n 0.0,\n 0.0,\n 147.2272,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 172.0912,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 229.0672\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2120.1546,\n 3751.0227,\n 5932.7435,\n 10280.5649,\n 18995.0533\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.7692,\n 2.7983,\n 4.849,\n 8.9593\n ],\n \"array_model\": [\n 2120.1546,\n 3751.0227,\n 5932.7435,\n 10280.5649,\n 18995.0533\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 183.6256,\n 0.0,\n 0.0,\n 201.688,\n 0.0,\n 0.0,\n 0.0,\n 225.1872,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 271.8752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 365.3328\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2672.0298,\n 4366.1475,\n 6632.8059,\n 11152.8145,\n 20207.9077\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.634,\n 2.4823,\n 4.1739,\n 7.5628\n ],\n \"array_model\": [\n 2672.0298,\n 4366.1475,\n 6632.8059,\n 11152.8145,\n 20207.9077\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 735.5008,\n 0.0,\n 0.0,\n 816.8128,\n 0.0,\n 0.0,\n 0.0,\n 925.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1144.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1578.1872\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2732.1226,\n 4432.8979,\n 6710.5563,\n 11249.1265,\n 20339.0325\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.6225,\n 2.4562,\n 4.1174,\n 7.4444\n ],\n \"array_model\": [\n 2732.1226,\n 4432.8979,\n 6710.5563,\n 11249.1265,\n 20339.0325\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 795.5936,\n 0.0,\n 0.0,\n 883.5632,\n 0.0,\n 0.0,\n 0.0,\n 1003.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1240.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1709.312\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2796.6234,\n 4504.6787,\n 6789.5243,\n 11344.0337,\n 20473.9077\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.6108,\n 2.4278,\n 4.0563,\n 7.3209\n ],\n \"array_model\": [\n 2796.6234,\n 4504.6787,\n 6789.5243,\n 11344.0337,\n 20473.9077\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 860.0944,\n 0.0,\n 0.0,\n 955.344,\n 0.0,\n 0.0,\n 0.0,\n 1081.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1335.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1844.1872\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2857.8106,\n 4572.4291,\n 6867.2747,\n 11440.1265,\n 20611.5957\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.6,\n 2.403,\n 4.0031,\n 7.2124\n ],\n \"array_model\": [\n 2857.8106,\n 4572.4291,\n 6867.2747,\n 11440.1265,\n 20611.5957\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 921.2816,\n 0.0,\n 0.0,\n 1023.0944,\n 0.0,\n 0.0,\n 0.0,\n 1159.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1431.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1981.8752\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2916.6538,\n 4637.3971,\n 6943.6811,\n 11533.1585,\n 20744.6261\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.59,\n 2.3807,\n 3.9542,\n 7.1125\n ],\n \"array_model\": [\n 2916.6538,\n 4637.3971,\n 6943.6811,\n 11533.1585,\n 20744.6261\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 980.1248,\n 0.0,\n 0.0,\n 1088.0624,\n 0.0,\n 0.0,\n 0.0,\n 1236.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1524.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2114.9056\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2181.6858,\n 3819.4291,\n 6010.8059,\n 10377.9393,\n 19130.5637\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.7507,\n 2.7551,\n 4.7568,\n 8.7687\n ],\n \"array_model\": [\n 2181.6858,\n 3819.4291,\n 6010.8059,\n 10377.9393,\n 19130.5637\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 245.1568,\n 0.0,\n 0.0,\n 270.0944,\n 0.0,\n 0.0,\n 0.0,\n 303.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 369.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 500.8432\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2242.9658,\n 3887.9283,\n 6088.2747,\n 10473.7841,\n 19263.4085\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.7334,\n 2.7144,\n 4.6696,\n 8.5884\n ],\n \"array_model\": [\n 2242.9658,\n 3887.9283,\n 6088.2747,\n 10473.7841,\n 19263.4085\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 306.4368,\n 0.0,\n 0.0,\n 338.5936,\n 0.0,\n 0.0,\n 0.0,\n 380.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 465.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 633.688\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2303.9658,\n 3955.8659,\n 6166.6811,\n 10571.6897,\n 19396.5957\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.717,\n 2.6766,\n 4.5885,\n 8.4188\n ],\n \"array_model\": [\n 2303.9658,\n 3955.8659,\n 6166.6811,\n 10571.6897,\n 19396.5957\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 367.4368,\n 0.0,\n 0.0,\n 406.5312,\n 0.0,\n 0.0,\n 0.0,\n 459.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 563.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 766.8752\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2365.9034,\n 4025.0851,\n 6243.3691,\n 10669.0641,\n 19531.9701\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.7013,\n 2.6389,\n 4.5095,\n 8.2556\n ],\n \"array_model\": [\n 2365.9034,\n 4025.0851,\n 6243.3691,\n 10669.0641,\n 19531.9701\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 429.3744,\n 0.0,\n 0.0,\n 475.7504,\n 0.0,\n 0.0,\n 0.0,\n 535.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 660.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 902.2496\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2428.7786,\n 4092.9603,\n 6320.6187,\n 10766.4401,\n 19668.6261\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.6852,\n 2.6024,\n 4.4329,\n 8.0982\n ],\n \"array_model\": [\n 2428.7786,\n 4092.9603,\n 6320.6187,\n 10766.4401,\n 19668.6261\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 492.2496,\n 0.0,\n 0.0,\n 543.6256,\n 0.0,\n 0.0,\n 0.0,\n 613.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 757.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1038.9056\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2486.7786,\n 4160.3347,\n 6399.1195,\n 10860.6273,\n 19805.2213\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.673,\n 2.5733,\n 4.3673,\n 7.9642\n ],\n \"array_model\": [\n 2486.7786,\n 4160.3347,\n 6399.1195,\n 10860.6273,\n 19805.2213\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 550.2496,\n 0.0,\n 0.0,\n 611.0,\n 0.0,\n 0.0,\n 0.0,\n 691.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 851.9376,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1175.5008\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2551.2474,\n 4231.0531,\n 6476.6811,\n 10957.1889,\n 19935.8149\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.6584,\n 2.5386,\n 4.2948,\n 7.8141\n ],\n \"array_model\": [\n 2551.2474,\n 4231.0531,\n 6476.6811,\n 10957.1889,\n 19935.8149\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 614.7184,\n 0.0,\n 0.0,\n 681.7184,\n 0.0,\n 0.0,\n 0.0,\n 769.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 948.4992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1306.0944\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 2612.3722,\n 4299.2403,\n 6556.9307,\n 11051.3153,\n 20074.8453\n ],\n \"index\": [\n 0,\n 3,\n 7,\n 15,\n 31\n ],\n \"ratio\": [\n 1.0,\n 1.6457,\n 2.51,\n 4.2304,\n 7.6845\n ],\n \"array_model\": [\n 2612.3722,\n 4299.2403,\n 6556.9307,\n 11051.3153,\n 20074.8453\n ],\n \"array_query\": [\n 1936.529,\n 3549.3347,\n 5707.5563,\n 10008.6897,\n 18629.7205\n ],\n \"array_cache\": [\n 675.8432,\n 0.0,\n 0.0,\n 749.9056,\n 0.0,\n 0.0,\n 0.0,\n 849.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1042.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1445.1248\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 32,\n \"max_query_length_cache\": 32,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 227.1552,\n 355.953,\n 611.7801,\n 1125.604\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.567,\n 2.6932,\n 4.9552\n ],\n \"array_model\": [\n 227.1552,\n 355.953,\n 611.7801,\n 1125.604\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 4.5571,\n 4.7473,\n 0.0,\n 4.983,\n 0.0,\n 0.0,\n 0.0,\n 5.4844\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 229.4692,\n 358.3034,\n 614.342,\n 1128.5376\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5614,\n 2.6772,\n 4.918\n ],\n \"array_model\": [\n 229.4692,\n 358.3034,\n 614.342,\n 1128.5376\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 6.8711,\n 7.0977,\n 0.0,\n 7.5449,\n 0.0,\n 0.0,\n 0.0,\n 8.418\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 250.1743,\n 379.8248,\n 637.4416,\n 1154.8657\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5182,\n 2.548,\n 4.6162\n ],\n \"array_model\": [\n 250.1743,\n 379.8248,\n 637.4416,\n 1154.8657\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 27.5762,\n 28.6191,\n 0.0,\n 30.6445,\n 0.0,\n 0.0,\n 0.0,\n 34.7461\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 252.4419,\n 382.2584,\n 640.0862,\n 1157.7973\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5142,\n 2.5356,\n 4.5864\n ],\n \"array_model\": [\n 252.4419,\n 382.2584,\n 640.0862,\n 1157.7973\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 29.8438,\n 31.0527,\n 0.0,\n 33.2891,\n 0.0,\n 0.0,\n 0.0,\n 37.6777\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 254.6801,\n 384.6588,\n 642.553,\n 1160.7094\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5104,\n 2.523,\n 4.5575\n ],\n \"array_model\": [\n 254.6801,\n 384.6588,\n 642.553,\n 1160.7094\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 32.082,\n 33.4531,\n 0.0,\n 35.7559,\n 0.0,\n 0.0,\n 0.0,\n 40.5898\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 257.1723,\n 386.9186,\n 645.094,\n 1163.5337\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5045,\n 2.5084,\n 4.5243\n ],\n \"array_model\": [\n 257.1723,\n 386.9186,\n 645.094,\n 1163.5337\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 34.5742,\n 35.7129,\n 0.0,\n 38.2969,\n 0.0,\n 0.0,\n 0.0,\n 43.4141\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 259.3793,\n 389.444,\n 647.7444,\n 1166.5239\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5014,\n 2.4973,\n 4.4974\n ],\n \"array_model\": [\n 259.3793,\n 389.444,\n 647.7444,\n 1166.5239\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 36.7812,\n 38.2383,\n 0.0,\n 40.9473,\n 0.0,\n 0.0,\n 0.0,\n 46.4043\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 231.7993,\n 360.6803,\n 616.9104,\n 1131.4419\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.556,\n 2.6614,\n 4.8811\n ],\n \"array_model\": [\n 231.7993,\n 360.6803,\n 616.9104,\n 1131.4419\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 9.2012,\n 9.4746,\n 0.0,\n 10.1133,\n 0.0,\n 0.0,\n 0.0,\n 11.3223\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 234.0922,\n 363.1002,\n 619.4553,\n 1134.3755\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5511,\n 2.6462,\n 4.8458\n ],\n \"array_model\": [\n 234.0922,\n 363.1002,\n 619.4553,\n 1134.3755\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 11.4941,\n 11.8945,\n 0.0,\n 12.6582,\n 0.0,\n 0.0,\n 0.0,\n 14.2559\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 236.3969,\n 365.4537,\n 622.0334,\n 1137.3286\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5459,\n 2.6313,\n 4.8111\n ],\n \"array_model\": [\n 236.3969,\n 365.4537,\n 622.0334,\n 1137.3286\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 13.7988,\n 14.248,\n 0.0,\n 15.2363,\n 0.0,\n 0.0,\n 0.0,\n 17.209\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 238.6528,\n 367.8561,\n 624.6174,\n 1140.2329\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5414,\n 2.6173,\n 4.7778\n ],\n \"array_model\": [\n 238.6528,\n 367.8561,\n 624.6174,\n 1140.2329\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 16.0547,\n 16.6504,\n 0.0,\n 17.8203,\n 0.0,\n 0.0,\n 0.0,\n 20.1133\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 240.9594,\n 370.2819,\n 627.1721,\n 1143.1001\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5367,\n 2.6028,\n 4.744\n ],\n \"array_model\": [\n 240.9594,\n 370.2819,\n 627.1721,\n 1143.1001\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 18.3613,\n 19.0762,\n 0.0,\n 20.375,\n 0.0,\n 0.0,\n 0.0,\n 22.9805\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 243.3149,\n 372.6217,\n 629.7834,\n 1146.0669\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5314,\n 2.5883,\n 4.7102\n ],\n \"array_model\": [\n 243.3149,\n 372.6217,\n 629.7834,\n 1146.0669\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 20.7168,\n 21.416,\n 0.0,\n 22.9863,\n 0.0,\n 0.0,\n 0.0,\n 25.9473\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 245.5981,\n 375.0866,\n 632.3088,\n 1148.9555\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5272,\n 2.5746,\n 4.6782\n ],\n \"array_model\": [\n 245.5981,\n 375.0866,\n 632.3088,\n 1148.9555\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 23.0,\n 23.8809,\n 0.0,\n 25.5117,\n 0.0,\n 0.0,\n 0.0,\n 28.8359\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 247.852,\n 377.4342,\n 634.8069,\n 1151.9477\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.5228,\n 2.5612,\n 4.6477\n ],\n \"array_model\": [\n 247.852,\n 377.4342,\n 634.8069,\n 1151.9477\n ],\n \"array_query\": [\n 222.5981,\n 351.2057,\n 606.7971,\n 1120.1196\n ],\n \"array_cache\": [\n 25.2539,\n 26.2285,\n 0.0,\n 28.0098,\n 0.0,\n 0.0,\n 0.0,\n 31.8281\n ],\n \"batch_size\": 32,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.07\n}", "bs_32/query_llm/query_1.json": "{\n \"mean\": 1936.529,\n \"array\": [\n 1933.2608,\n 1943.2608,\n 1903.3744,\n 1954.3744,\n 1981.3744,\n 1924.8432,\n 1989.8432,\n 1910.5632,\n 1936.5632,\n 1947.5632,\n 1974.5632,\n 1913.6256,\n 1935.6256,\n 1914.7504,\n 1924.7504,\n 1903.7504,\n 1973.7504,\n 1916.2816,\n 1928.2816,\n 1938.1568,\n 1966.1568,\n 1875.4992,\n 1942.4992,\n 1880.4064,\n 1950.4064,\n 1967.4064,\n 1925.9056,\n 1938.9056,\n 1954.7184,\n 1972.7184,\n 1931.8752,\n 1946.8752,\n 1906.2608,\n 1957.2608,\n 1902.3744,\n 1941.3744,\n 1955.3744,\n 1907.8432,\n 1965.8432,\n 1941.5632,\n 1971.5632,\n 1951.5632,\n 1957.5632,\n 1914.6256,\n 1947.6256,\n 1910.7504,\n 1921.7504,\n 1934.7504,\n 1931.7504,\n 1940.2816,\n 1932.2816,\n 1884.1568,\n 1976.1568,\n 1911.4992,\n 1937.4992,\n 1884.4064,\n 1917.4064,\n 2006.4064,\n 1920.9056,\n 1979.9056,\n 1914.7184,\n 1956.7184,\n 1908.8752,\n 1944.8752\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_llm/query_16.json": "{\n \"mean\": 10008.6897,\n \"array\": [\n 9888.9088,\n 10109.9088,\n 10083.1248,\n 9853.1248,\n 10040.1248,\n 10041.7504,\n 9893.7504,\n 9987.9056,\n 10175.9056,\n 9858.0,\n 9922.0,\n 10099.6256,\n 9948.6256,\n 9974.2496,\n 10003.2496,\n 9901.0624,\n 9885.0624,\n 9952.5008,\n 10030.5008,\n 9948.3744,\n 10033.3744,\n 10106.8752,\n 10124.8752,\n 10076.5632,\n 9877.5632,\n 9880.5632,\n 9975.656,\n 10085.656,\n 9896.5632,\n 9919.5632,\n 10043.5312,\n 9947.5312,\n 9834.9088,\n 10019.9088,\n 10098.1248,\n 10048.1248,\n 10124.1248,\n 10105.7504,\n 10135.7504,\n 9906.9056,\n 10082.9056,\n 9995.0,\n 10035.0,\n 9924.6256,\n 10102.6256,\n 10091.2496,\n 10010.2496,\n 9951.0624,\n 10037.0624,\n 9904.5008,\n 10069.5008,\n 10009.3744,\n 10009.3744,\n 9991.8752,\n 10140.8752,\n 9955.5632,\n 10145.5632,\n 10185.5632,\n 9905.656,\n 10149.656,\n 9833.5632,\n 10192.5632,\n 10126.5312,\n 9866.5312\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_llm/query_32.json": "{\n \"mean\": 18629.7205,\n \"array\": [\n 18657.9328,\n 18679.9328,\n 18752.6672,\n 18769.6672,\n 18519.6672,\n 18748.1568,\n 18449.1568,\n 18314.312,\n 18737.312,\n 18452.1248,\n 18421.1248,\n 18397.7504,\n 18625.7504,\n 18376.0944,\n 18701.0944,\n 18577.4992,\n 18882.4992,\n 18388.9056,\n 18898.9056,\n 18350.8752,\n 18679.8752,\n 18449.8128,\n 18646.8128,\n 18431.688,\n 18821.688,\n 18944.688,\n 18466.8128,\n 18464.8128,\n 18426.1248,\n 18744.1248,\n 18401.0944,\n 18613.0944,\n 18586.9328,\n 18859.9328,\n 18527.6672,\n 18403.6672,\n 18657.6672,\n 18791.1568,\n 18784.1568,\n 18596.312,\n 18549.312,\n 18545.1248,\n 18940.1248,\n 18618.7504,\n 18779.7504,\n 18510.0944,\n 18861.0944,\n 18582.4992,\n 18813.4992,\n 18482.9056,\n 18797.9056,\n 18735.8752,\n 18874.8752,\n 18603.8128,\n 18314.8128,\n 18433.688,\n 18880.688,\n 18834.688,\n 18411.8128,\n 18780.8128,\n 18867.1248,\n 18782.1248,\n 18483.0944,\n 18818.0944\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_llm/query_4.json": "{\n \"mean\": 3549.3347,\n \"array\": [\n 3552.7648,\n 3511.7648,\n 3506.312,\n 3589.312,\n 3618.312,\n 3500.9056,\n 3568.9056,\n 3596.4064,\n 3534.4064,\n 3495.4688,\n 3529.4688,\n 3498.2496,\n 3520.2496,\n 3547.3744,\n 3595.3744,\n 3583.0,\n 3530.0,\n 3516.2816,\n 3523.2816,\n 3560.0944,\n 3611.0944,\n 3500.1872,\n 3580.1872,\n 3490.4368,\n 3600.4368,\n 3561.4368,\n 3604.656,\n 3597.656,\n 3485.9056,\n 3619.9056,\n 3570.9376,\n 3639.9376,\n 3497.7648,\n 3577.7648,\n 3546.312,\n 3585.312,\n 3594.312,\n 3510.9056,\n 3610.9056,\n 3594.4064,\n 3548.4064,\n 3486.4688,\n 3606.4688,\n 3506.2496,\n 3534.2496,\n 3486.3744,\n 3610.3744,\n 3516.0,\n 3517.0,\n 3464.2816,\n 3543.2816,\n 3539.0944,\n 3493.0944,\n 3532.1872,\n 3564.1872,\n 3577.4368,\n 3486.4368,\n 3641.4368,\n 3513.656,\n 3519.656,\n 3569.9056,\n 3562.9056,\n 3507.9376,\n 3571.9376\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_llm/query_8.json": "{\n \"mean\": 5707.5563,\n \"array\": [\n 5679.7728,\n 5642.7728,\n 5682.8128,\n 5648.8128,\n 5786.8128,\n 5747.7504,\n 5777.7504,\n 5769.2816,\n 5796.2816,\n 5733.8752,\n 5694.8752,\n 5596.1872,\n 5792.1872,\n 5755.9376,\n 5718.9376,\n 5683.4368,\n 5683.4368,\n 5631.8752,\n 5706.8752,\n 5744.6256,\n 5800.6256,\n 5743.7504,\n 5647.7504,\n 5764.0,\n 5730.0,\n 5810.0,\n 5666.032,\n 5640.032,\n 5592.2816,\n 5726.2816,\n 5762.8752,\n 5776.8752,\n 5611.7728,\n 5729.7728,\n 5589.8128,\n 5730.8128,\n 5800.8128,\n 5689.7504,\n 5651.7504,\n 5777.2816,\n 5640.2816,\n 5678.8752,\n 5818.8752,\n 5714.1872,\n 5641.1872,\n 5671.9376,\n 5813.9376,\n 5594.4368,\n 5763.4368,\n 5599.8752,\n 5732.8752,\n 5767.6256,\n 5647.6256,\n 5764.7504,\n 5760.7504,\n 5602.0,\n 5661.0,\n 5702.0,\n 5746.032,\n 5653.032,\n 5775.2816,\n 5648.2816,\n 5720.8752,\n 5647.8752\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_slm/query_1.json": "{\n \"mean\": 222.5981,\n \"array\": [\n 224.0679,\n 220.8179,\n 224.5039,\n 225.2539,\n 227.3789,\n 220.5488,\n 220.4238,\n 226.2559,\n 221.0059,\n 225.5762,\n 221.3262,\n 220.8203,\n 225.1953,\n 218.8887,\n 225.5137,\n 219.9082,\n 222.1582,\n 220.625,\n 223.375,\n 220.7461,\n 224.4961,\n 224.5488,\n 223.5488,\n 218.9062,\n 220.2812,\n 224.4062,\n 220.918,\n 221.668,\n 219.9258,\n 224.0508,\n 224.2188,\n 224.9688,\n 220.1929,\n 219.9429,\n 223.5039,\n 221.7539,\n 225.5039,\n 224.6738,\n 222.4238,\n 219.6309,\n 227.0059,\n 220.2012,\n 225.8262,\n 222.1953,\n 222.0703,\n 220.3887,\n 220.3887,\n 220.1582,\n 220.9082,\n 220.0,\n 222.25,\n 219.4961,\n 226.6211,\n 223.9238,\n 219.9238,\n 221.4062,\n 223.4062,\n 224.5312,\n 223.793,\n 220.668,\n 226.3008,\n 220.8008,\n 226.4688,\n 223.5938\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_slm/query_2.json": "{\n \"mean\": 351.2057,\n \"array\": [\n 351.3777,\n 347.5027,\n 344.9023,\n 352.0273,\n 352.5273,\n 350.6504,\n 354.2754,\n 346.9805,\n 348.9805,\n 355.252,\n 351.502,\n 355.3496,\n 350.3496,\n 348.6738,\n 353.6738,\n 348.459,\n 354.334,\n 347.9941,\n 353.3691,\n 352.5215,\n 356.5215,\n 350.8809,\n 356.1309,\n 351.4473,\n 348.4473,\n 353.9473,\n 345.4219,\n 352.5469,\n 354.4121,\n 355.6621,\n 354.7617,\n 353.8867,\n 346.1277,\n 349.6277,\n 351.0273,\n 348.5273,\n 349.5273,\n 352.0254,\n 355.7754,\n 350.6055,\n 347.9805,\n 355.752,\n 355.127,\n 354.4746,\n 350.5996,\n 347.6738,\n 355.5488,\n 351.584,\n 349.834,\n 344.9941,\n 345.6191,\n 351.7715,\n 346.5215,\n 348.0059,\n 351.6309,\n 350.5723,\n 352.4473,\n 357.4473,\n 346.2969,\n 352.2969,\n 355.2871,\n 349.1621,\n 349.1367,\n 349.3867\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_slm/query_4.json": "{\n \"mean\": 606.7971,\n \"array\": [\n 605.017,\n 613.017,\n 602.2051,\n 605.4551,\n 605.3301,\n 603.5117,\n 604.8867,\n 609.9668,\n 612.3418,\n 607.1387,\n 612.6387,\n 612.4297,\n 598.5547,\n 606.5,\n 603.5,\n 614.7637,\n 600.1387,\n 610.1133,\n 612.9883,\n 600.2402,\n 605.8652,\n 600.4805,\n 615.9805,\n 598.2109,\n 613.9609,\n 611.5859,\n 612.4941,\n 609.8691,\n 597.8281,\n 609.0781,\n 596.9277,\n 609.3027,\n 599.767,\n 603.892,\n 613.7051,\n 602.3301,\n 604.7051,\n 615.3867,\n 603.3867,\n 611.3418,\n 602.7168,\n 608.7637,\n 608.2637,\n 599.6797,\n 613.9297,\n 603.125,\n 605.125,\n 615.1387,\n 601.3887,\n 600.9883,\n 600.6133,\n 603.2402,\n 613.1152,\n 605.1055,\n 610.9805,\n 599.0859,\n 614.3359,\n 599.8359,\n 600.8691,\n 606.1191,\n 603.9531,\n 617.5781,\n 613.1777,\n 611.0527\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_32/query_slm/query_8.json": "{\n \"mean\": 1120.1196,\n \"array\": [\n 1124.2656,\n 1133.2656,\n 1131.707,\n 1131.332,\n 1124.082,\n 1113.0527,\n 1127.5527,\n 1120.2441,\n 1117.1191,\n 1132.166,\n 1123.416,\n 1107.6367,\n 1102.7617,\n 1130.7695,\n 1127.1445,\n 1123.1777,\n 1135.0527,\n 1130.5391,\n 1110.0391,\n 1125.7969,\n 1105.5469,\n 1123.3789,\n 1122.3789,\n 1134.1973,\n 1133.6973,\n 1129.5723,\n 1124.0352,\n 1131.2852,\n 1102.2109,\n 1107.3359,\n 1110.0957,\n 1107.5957,\n 1104.6406,\n 1129.7656,\n 1115.207,\n 1121.707,\n 1119.332,\n 1115.4277,\n 1118.4277,\n 1103.8691,\n 1106.9941,\n 1129.041,\n 1108.291,\n 1103.0117,\n 1118.2617,\n 1102.8945,\n 1135.6445,\n 1101.6777,\n 1133.1777,\n 1113.9141,\n 1107.7891,\n 1129.0469,\n 1118.6719,\n 1127.8789,\n 1123.1289,\n 1114.4473,\n 1132.4473,\n 1132.6973,\n 1132.4102,\n 1113.4102,\n 1117.7109,\n 1109.7109,\n 1113.8457,\n 1130.7207\n ],\n \"batch_size\": 32,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 2.6699,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8613,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0938,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.5332,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.3728\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0717,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1587,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3233,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6378\n ],\n \"array\": [\n 2.6699,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8613,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0938,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.5332,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.3728\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 3.1621,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.4824,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.8477,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.5879,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.043\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1013,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2168,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4509,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9111\n ],\n \"array\": [\n 3.1621,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.4824,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.8477,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.5879,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.043\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 7.4883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.9531,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.6289,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.0078,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.8652\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1956,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4194,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8706,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.7864\n ],\n \"array\": [\n 7.4883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.9531,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.6289,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.0078,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.8652\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 7.9297,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.5723,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.4004,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.0645,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 22.4766\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2071,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4377,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8998,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8345\n ],\n \"array\": [\n 7.9297,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.5723,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.4004,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.0645,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 22.4766\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 8.4297,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.166,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.123,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.1348,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 24.0996\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.206,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4381,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.914,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8589\n ],\n \"array\": [\n 8.4297,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.166,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.123,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.1348,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 24.0996\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 8.9062,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.9102,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.2109,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 25.75\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2121,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9325,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8912\n ],\n \"array\": [\n 8.9062,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.7949,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.9102,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.2109,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 25.75\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 9.3848,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.3887,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.6836,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 18.2266,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 27.334\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2135,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4581,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9421,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9126\n ],\n \"array\": [\n 9.3848,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.3887,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.6836,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 18.2266,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 27.334\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 3.6328,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0801,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.6094,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.627,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.6816\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1231,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5489,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.1145\n ],\n \"array\": [\n 3.6328,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.0801,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.6094,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.627,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.6816\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 4.1152,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.7012,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.3477,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.666,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.3496\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1424,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2995,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6198,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.272\n ],\n \"array\": [\n 4.1152,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.7012,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.3477,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.666,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.3496\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 4.5879,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.2891,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.1113,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.7344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.959\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1528,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3321,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6858,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3887\n ],\n \"array\": [\n 4.5879,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.2891,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.1113,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.7344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.959\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 5.0723,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.9121,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.875,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.7969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.5879\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3554,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7343,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.4817\n ],\n \"array\": [\n 5.0723,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.9121,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.875,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.7969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.5879\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 5.5391,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.5254,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.623,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.8301,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.2715\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1781,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3762,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7747,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5765\n ],\n \"array\": [\n 5.5391,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.5254,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.623,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.8301,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.2715\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 6.0332,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.1211,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.373,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.8848,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.875\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1803,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3878,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8041,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6313\n ],\n \"array\": [\n 6.0332,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.1211,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.373,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.8848,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.875\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 6.5293,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.1406,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.9453,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.5469\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1873,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3999,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8295,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.6874\n ],\n \"array\": [\n 6.5293,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.1406,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.9453,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.5469\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 6.998,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.3457,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.9082,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.0098,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.1504\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1926,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4159,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8591,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.7365\n ],\n \"array\": [\n 6.998,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.3457,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.9082,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.0098,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.1504\n ],\n \"batch_size\": 4,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 1.5996,\n 1.6094,\n 0.0,\n 1.6406,\n 0.0,\n 0.0,\n 0.0,\n 1.7168\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0061,\n 0.0,\n 1.0256,\n 0.0,\n 0.0,\n 0.0,\n 1.0733\n ],\n \"array\": [\n 1.5996,\n 1.6094,\n 0.0,\n 1.6406,\n 0.0,\n 0.0,\n 0.0,\n 1.7168\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 1.8887,\n 1.916,\n 0.0,\n 1.9727,\n 0.0,\n 0.0,\n 0.0,\n 2.0684\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0145,\n 0.0,\n 1.0445,\n 0.0,\n 0.0,\n 0.0,\n 1.0951\n ],\n \"array\": [\n 1.8887,\n 1.916,\n 0.0,\n 1.9727,\n 0.0,\n 0.0,\n 0.0,\n 2.0684\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 4.4746,\n 4.5957,\n 0.0,\n 4.8457,\n 0.0,\n 0.0,\n 0.0,\n 5.3652\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0271,\n 0.0,\n 1.0829,\n 0.0,\n 0.0,\n 0.0,\n 1.199\n ],\n \"array\": [\n 4.4746,\n 4.5957,\n 0.0,\n 4.8457,\n 0.0,\n 0.0,\n 0.0,\n 5.3652\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 4.7617,\n 4.9043,\n 0.0,\n 5.1641,\n 0.0,\n 0.0,\n 0.0,\n 5.7246\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0299,\n 0.0,\n 1.0845,\n 0.0,\n 0.0,\n 0.0,\n 1.2022\n ],\n \"array\": [\n 4.7617,\n 4.9043,\n 0.0,\n 5.1641,\n 0.0,\n 0.0,\n 0.0,\n 5.7246\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 5.0566,\n 5.2051,\n 0.0,\n 5.4941,\n 0.0,\n 0.0,\n 0.0,\n 6.0586\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0294,\n 0.0,\n 1.0865,\n 0.0,\n 0.0,\n 0.0,\n 1.1981\n ],\n \"array\": [\n 5.0566,\n 5.2051,\n 0.0,\n 5.4941,\n 0.0,\n 0.0,\n 0.0,\n 6.0586\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 5.3398,\n 5.498,\n 0.0,\n 5.7988,\n 0.0,\n 0.0,\n 0.0,\n 6.4609\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0296,\n 0.0,\n 1.086,\n 0.0,\n 0.0,\n 0.0,\n 1.2099\n ],\n \"array\": [\n 5.3398,\n 5.498,\n 0.0,\n 5.7988,\n 0.0,\n 0.0,\n 0.0,\n 6.4609\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 5.6074,\n 5.8105,\n 0.0,\n 6.1387,\n 0.0,\n 0.0,\n 0.0,\n 6.8281\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0362,\n 0.0,\n 1.0947,\n 0.0,\n 0.0,\n 0.0,\n 1.2177\n ],\n \"array\": [\n 5.6074,\n 5.8105,\n 0.0,\n 6.1387,\n 0.0,\n 0.0,\n 0.0,\n 6.8281\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 2.1621,\n 2.209,\n 0.0,\n 2.2891,\n 0.0,\n 0.0,\n 0.0,\n 2.4434\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0217,\n 0.0,\n 1.0587,\n 0.0,\n 0.0,\n 0.0,\n 1.1301\n ],\n \"array\": [\n 2.1621,\n 2.209,\n 0.0,\n 2.2891,\n 0.0,\n 0.0,\n 0.0,\n 2.4434\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 2.459,\n 2.5078,\n 0.0,\n 2.6074,\n 0.0,\n 0.0,\n 0.0,\n 2.8008\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0199,\n 0.0,\n 1.0604,\n 0.0,\n 0.0,\n 0.0,\n 1.139\n ],\n \"array\": [\n 2.459,\n 2.5078,\n 0.0,\n 2.6074,\n 0.0,\n 0.0,\n 0.0,\n 2.8008\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 2.7441,\n 2.8164,\n 0.0,\n 2.9277,\n 0.0,\n 0.0,\n 0.0,\n 3.1777\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0263,\n 0.0,\n 1.0669,\n 0.0,\n 0.0,\n 0.0,\n 1.158\n ],\n \"array\": [\n 2.7441,\n 2.8164,\n 0.0,\n 2.9277,\n 0.0,\n 0.0,\n 0.0,\n 3.1777\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 3.0391,\n 3.1055,\n 0.0,\n 3.2539,\n 0.0,\n 0.0,\n 0.0,\n 3.5371\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0219,\n 0.0,\n 1.0707,\n 0.0,\n 0.0,\n 0.0,\n 1.1639\n ],\n \"array\": [\n 3.0391,\n 3.1055,\n 0.0,\n 3.2539,\n 0.0,\n 0.0,\n 0.0,\n 3.5371\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 3.3203,\n 3.4062,\n 0.0,\n 3.5781,\n 0.0,\n 0.0,\n 0.0,\n 3.9004\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0259,\n 0.0,\n 1.0776,\n 0.0,\n 0.0,\n 0.0,\n 1.1747\n ],\n \"array\": [\n 3.3203,\n 3.4062,\n 0.0,\n 3.5781,\n 0.0,\n 0.0,\n 0.0,\n 3.9004\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 3.6074,\n 3.709,\n 0.0,\n 3.9043,\n 0.0,\n 0.0,\n 0.0,\n 4.2598\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0282,\n 0.0,\n 1.0823,\n 0.0,\n 0.0,\n 0.0,\n 1.1808\n ],\n \"array\": [\n 3.6074,\n 3.709,\n 0.0,\n 3.9043,\n 0.0,\n 0.0,\n 0.0,\n 4.2598\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 3.8984,\n 3.9941,\n 0.0,\n 4.2051,\n 0.0,\n 0.0,\n 0.0,\n 4.627\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0245,\n 0.0,\n 1.0787,\n 0.0,\n 0.0,\n 0.0,\n 1.1869\n ],\n \"array\": [\n 3.8984,\n 3.9941,\n 0.0,\n 4.2051,\n 0.0,\n 0.0,\n 0.0,\n 4.627\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 4.1836,\n 4.293,\n 0.0,\n 4.5371,\n 0.0,\n 0.0,\n 0.0,\n 4.9805\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0261,\n 0.0,\n 1.0845,\n 0.0,\n 0.0,\n 0.0,\n 1.1905\n ],\n \"array\": [\n 4.1836,\n 4.293,\n 0.0,\n 4.5371,\n 0.0,\n 0.0,\n 0.0,\n 4.9805\n ],\n \"batch_size\": 4,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1510.2721,\n 1984.6206,\n 2524.6541,\n 3605.1169,\n 5764.6075\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3141,\n 1.6717,\n 2.3871,\n 3.8169\n ],\n \"array_model\": [\n 1510.2721,\n 1984.6206,\n 2524.6541,\n 3605.1169,\n 5764.6075\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 42.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 45.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 49.5008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 56.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 69.9648\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1518.1473,\n 1994.5582,\n 2536.7165,\n 3621.9921,\n 5791.3307\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3138,\n 1.6709,\n 2.3858,\n 3.8147\n ],\n \"array_model\": [\n 1518.1473,\n 1994.5582,\n 2536.7165,\n 3621.9921,\n 5791.3307\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 50.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 55.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 61.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 73.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 96.688\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1587.3665,\n 2082.0894,\n 2645.2157,\n 3772.7105,\n 6028.4859\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3117,\n 1.6664,\n 2.3767,\n 3.7978\n ],\n \"array_model\": [\n 1587.3665,\n 2082.0894,\n 2645.2157,\n 3772.7105,\n 6028.4859\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 119.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 143.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 170.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 224.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 333.8432\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1594.4289,\n 2091.9966,\n 2657.5597,\n 3789.6177,\n 6054.2683\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3121,\n 1.6668,\n 2.3768,\n 3.7971\n ],\n \"array_model\": [\n 1594.4289,\n 2091.9966,\n 2657.5597,\n 3789.6177,\n 6054.2683\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 126.8752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 153.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 182.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 241.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 359.6256\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1602.4289,\n 2101.4958,\n 2669.1213,\n 3806.7425,\n 6080.2363\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3114,\n 1.6657,\n 2.3756,\n 3.7944\n ],\n \"array_model\": [\n 1602.4289,\n 2101.4958,\n 2669.1213,\n 3806.7425,\n 6080.2363\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 134.8752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 162.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 193.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 258.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 385.5936\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1610.0529,\n 2111.5582,\n 2681.7165,\n 3823.9601,\n 6106.6427\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3115,\n 1.6656,\n 2.3751,\n 3.7928\n ],\n \"array_model\": [\n 1610.0529,\n 2111.5582,\n 2681.7165,\n 3823.9601,\n 6106.6427\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 142.4992,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 172.7184,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 206.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 275.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 412.0\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1617.7105,\n 2121.059,\n 2694.0909,\n 3840.2113,\n 6131.9867\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3111,\n 1.6654,\n 2.3739,\n 3.7905\n ],\n \"array_model\": [\n 1617.7105,\n 2121.059,\n 2694.0909,\n 3840.2113,\n 6131.9867\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 150.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 182.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 218.9376,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 291.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 437.344\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1525.6785,\n 2004.1214,\n 2548.9037,\n 3638.6177,\n 5817.5483\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3136,\n 1.6707,\n 2.3849,\n 3.8131\n ],\n \"array_model\": [\n 1525.6785,\n 2004.1214,\n 2548.9037,\n 3638.6177,\n 5817.5483\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 58.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 65.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 73.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 90.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 122.9056\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1533.3969,\n 2014.059,\n 2560.7165,\n 3655.2417,\n 5844.2363\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3135,\n 1.67,\n 2.3838,\n 3.8113\n ],\n \"array_model\": [\n 1533.3969,\n 2014.059,\n 2560.7165,\n 3655.2417,\n 5844.2363\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 65.8432,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 75.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 85.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 106.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 149.5936\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1540.9601,\n 2023.4654,\n 2572.9341,\n 3672.3361,\n 5869.9867\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3131,\n 1.6697,\n 2.3831,\n 3.8093\n ],\n \"array_model\": [\n 1540.9601,\n 2023.4654,\n 2572.9341,\n 3672.3361,\n 5869.9867\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 73.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 84.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 97.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 123.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 175.344\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1548.7105,\n 2033.4334,\n 2585.1533,\n 3689.3361,\n 5896.0491\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.313,\n 1.6692,\n 2.3822,\n 3.8071\n ],\n \"array_model\": [\n 1548.7105,\n 2033.4334,\n 2585.1533,\n 3689.3361,\n 5896.0491\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 81.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 94.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 110.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 140.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 201.4064\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1556.1793,\n 2043.2462,\n 2597.1213,\n 3705.8673,\n 5922.9867\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.313,\n 1.6689,\n 2.3814,\n 3.8061\n ],\n \"array_model\": [\n 1556.1793,\n 2043.2462,\n 2597.1213,\n 3705.8673,\n 5922.9867\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 88.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 104.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 121.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 157.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 228.344\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1564.0849,\n 2052.7774,\n 2609.1213,\n 3722.7425,\n 5948.6427\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3124,\n 1.6681,\n 2.3801,\n 3.8033\n ],\n \"array_model\": [\n 1564.0849,\n 2052.7774,\n 2609.1213,\n 3722.7425,\n 5948.6427\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 96.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 113.9376,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 133.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 174.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 254.0\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1572.0225,\n 2062.8718,\n 2621.4029,\n 3739.7105,\n 5975.3931\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.3122,\n 1.6675,\n 2.3789,\n 3.8011\n ],\n \"array_model\": [\n 1572.0225,\n 2062.8718,\n 2621.4029,\n 3739.7105,\n 5975.3931\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 104.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 124.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 146.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 191.1248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 280.7504\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1579.5217,\n 2072.371,\n 2633.6845,\n 3756.7425,\n 6001.0491\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.312,\n 1.6674,\n 2.3784,\n 3.7993\n ],\n \"array_model\": [\n 1579.5217,\n 2072.371,\n 2633.6845,\n 3756.7425,\n 6001.0491\n ],\n \"array_query\": [\n 1467.5537,\n 1938.8398,\n 2475.1533,\n 3548.5857,\n 5694.6427\n ],\n \"array_cache\": [\n 111.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 133.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 158.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 208.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 306.4064\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 112.5098,\n 128.5749,\n 160.7722,\n 225.0741\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1428,\n 1.429,\n 2.0005\n ],\n \"array_model\": [\n 112.5098,\n 128.5749,\n 160.7722,\n 225.0741\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 1.5996,\n 1.6094,\n 0.0,\n 1.6406,\n 0.0,\n 0.0,\n 0.0,\n 1.7168\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 112.7989,\n 128.8815,\n 161.1043,\n 225.4257\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1426,\n 1.4282,\n 1.9985\n ],\n \"array_model\": [\n 112.7989,\n 128.8815,\n 161.1043,\n 225.4257\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 1.8887,\n 1.916,\n 0.0,\n 1.9727,\n 0.0,\n 0.0,\n 0.0,\n 2.0684\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.3848,\n 131.5612,\n 163.9773,\n 228.7225\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1402,\n 1.4211,\n 1.9823\n ],\n \"array_model\": [\n 115.3848,\n 131.5612,\n 163.9773,\n 228.7225\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 4.4746,\n 4.5957,\n 0.0,\n 4.8457,\n 0.0,\n 0.0,\n 0.0,\n 5.3652\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.6719,\n 131.8698,\n 164.2957,\n 229.0819\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.14,\n 1.4204,\n 1.9804\n ],\n \"array_model\": [\n 115.6719,\n 131.8698,\n 164.2957,\n 229.0819\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 4.7617,\n 4.9043,\n 0.0,\n 5.1641,\n 0.0,\n 0.0,\n 0.0,\n 5.7246\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.9668,\n 132.1706,\n 164.6257,\n 229.4159\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1397,\n 1.4196,\n 1.9783\n ],\n \"array_model\": [\n 115.9668,\n 132.1706,\n 164.6257,\n 229.4159\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 5.0566,\n 5.2051,\n 0.0,\n 5.4941,\n 0.0,\n 0.0,\n 0.0,\n 6.0586\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 116.25,\n 132.4635,\n 164.9304,\n 229.8182\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1395,\n 1.4188,\n 1.9769\n ],\n \"array_model\": [\n 116.25,\n 132.4635,\n 164.9304,\n 229.8182\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 5.3398,\n 5.498,\n 0.0,\n 5.7988,\n 0.0,\n 0.0,\n 0.0,\n 6.4609\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 116.5176,\n 132.776,\n 165.2703,\n 230.1854\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1395,\n 1.4184,\n 1.9755\n ],\n \"array_model\": [\n 116.5176,\n 132.776,\n 165.2703,\n 230.1854\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 5.6074,\n 5.8105,\n 0.0,\n 6.1387,\n 0.0,\n 0.0,\n 0.0,\n 6.8281\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.0723,\n 129.1745,\n 161.4207,\n 225.8007\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1424,\n 1.4276,\n 1.997\n ],\n \"array_model\": [\n 113.0723,\n 129.1745,\n 161.4207,\n 225.8007\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 2.1621,\n 2.209,\n 0.0,\n 2.2891,\n 0.0,\n 0.0,\n 0.0,\n 2.4434\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.3692,\n 129.4733,\n 161.739,\n 226.1581\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1421,\n 1.4267,\n 1.9949\n ],\n \"array_model\": [\n 113.3692,\n 129.4733,\n 161.739,\n 226.1581\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 2.459,\n 2.5078,\n 0.0,\n 2.6074,\n 0.0,\n 0.0,\n 0.0,\n 2.8008\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.6543,\n 129.7819,\n 162.0593,\n 226.535\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1419,\n 1.4259,\n 1.9932\n ],\n \"array_model\": [\n 113.6543,\n 129.7819,\n 162.0593,\n 226.535\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 2.7441,\n 2.8164,\n 0.0,\n 2.9277,\n 0.0,\n 0.0,\n 0.0,\n 3.1777\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 113.9493,\n 130.071,\n 162.3855,\n 226.8944\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1415,\n 1.4251,\n 1.9912\n ],\n \"array_model\": [\n 113.9493,\n 130.071,\n 162.3855,\n 226.8944\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 3.0391,\n 3.1055,\n 0.0,\n 3.2539,\n 0.0,\n 0.0,\n 0.0,\n 3.5371\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 114.2305,\n 130.3717,\n 162.7097,\n 227.2577\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1413,\n 1.4244,\n 1.9895\n ],\n \"array_model\": [\n 114.2305,\n 130.3717,\n 162.7097,\n 227.2577\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 3.3203,\n 3.4062,\n 0.0,\n 3.5781,\n 0.0,\n 0.0,\n 0.0,\n 3.9004\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 114.5176,\n 130.6745,\n 163.0359,\n 227.6171\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1411,\n 1.4237,\n 1.9876\n ],\n \"array_model\": [\n 114.5176,\n 130.6745,\n 163.0359,\n 227.6171\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 3.6074,\n 3.709,\n 0.0,\n 3.9043,\n 0.0,\n 0.0,\n 0.0,\n 4.2598\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 114.8086,\n 130.9596,\n 163.3367,\n 227.9843\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1407,\n 1.4227,\n 1.9858\n ],\n \"array_model\": [\n 114.8086,\n 130.9596,\n 163.3367,\n 227.9843\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 3.8984,\n 3.9941,\n 0.0,\n 4.2051,\n 0.0,\n 0.0,\n 0.0,\n 4.627\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 115.0938,\n 131.2585,\n 163.6687,\n 228.3378\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.1404,\n 1.422,\n 1.9839\n ],\n \"array_model\": [\n 115.0938,\n 131.2585,\n 163.6687,\n 228.3378\n ],\n \"array_query\": [\n 110.9102,\n 126.9655,\n 159.1316,\n 223.3573\n ],\n \"array_cache\": [\n 4.1836,\n 4.293,\n 0.0,\n 4.5371,\n 0.0,\n 0.0,\n 0.0,\n 4.9805\n ],\n \"batch_size\": 4,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_1.json": "{\n \"mean\": 1467.5537,\n \"array\": [\n 1484.2816,\n 1451.2816,\n 1469.4064,\n 1460.4064,\n 1463.4064,\n 1450.8752,\n 1489.8752,\n 1472.1568,\n 1473.1568,\n 1471.5936,\n 1478.5936,\n 1484.8432,\n 1449.8432,\n 1459.3744,\n 1463.3744,\n 1478.4688,\n 1471.4688,\n 1471.5312,\n 1463.5312,\n 1447.032,\n 1483.032,\n 1450.1872,\n 1480.1872,\n 1486.1248,\n 1480.1248,\n 1475.1248,\n 1478.1248,\n 1488.1248,\n 1487.5008,\n 1473.5008,\n 1446.8432,\n 1493.8432,\n 1468.2816,\n 1455.2816,\n 1444.4064,\n 1447.4064,\n 1472.4064,\n 1482.8752,\n 1464.8752,\n 1447.1568,\n 1457.1568,\n 1484.5936,\n 1450.5936,\n 1472.8432,\n 1459.8432,\n 1466.3744,\n 1491.3744,\n 1486.4688,\n 1453.4688,\n 1472.5312,\n 1456.5312,\n 1450.032,\n 1482.032,\n 1469.1872,\n 1446.1872,\n 1450.1248,\n 1451.1248,\n 1476.1248,\n 1473.1248,\n 1478.1248,\n 1443.5008,\n 1454.5008,\n 1486.8432,\n 1450.8432\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_16.json": "{\n \"mean\": 2475.1533,\n \"array\": [\n 2464.4992,\n 2462.4992,\n 2434.4368,\n 2489.4368,\n 2493.4368,\n 2468.2496,\n 2516.2496,\n 2504.4368,\n 2509.4368,\n 2473.2192,\n 2510.2192,\n 2484.0,\n 2446.0,\n 2501.032,\n 2465.032,\n 2472.032,\n 2492.032,\n 2433.7504,\n 2513.7504,\n 2443.4688,\n 2494.4688,\n 2502.9376,\n 2510.9376,\n 2466.5936,\n 2481.5936,\n 2466.5936,\n 2478.032,\n 2446.032,\n 2479.4368,\n 2501.4368,\n 2464.0624,\n 2458.0624,\n 2494.4992,\n 2450.4992,\n 2475.4368,\n 2505.4368,\n 2447.4368,\n 2437.2496,\n 2448.2496,\n 2451.4368,\n 2499.4368,\n 2478.2192,\n 2443.2192,\n 2459.0,\n 2445.0,\n 2490.032,\n 2485.032,\n 2501.032,\n 2476.032,\n 2459.7504,\n 2455.7504,\n 2466.4688,\n 2508.4688,\n 2451.9376,\n 2469.9376,\n 2464.5936,\n 2464.5936,\n 2479.5936,\n 2512.032,\n 2466.032,\n 2443.4368,\n 2483.4368,\n 2470.0624,\n 2499.0624\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_32.json": "{\n \"mean\": 3548.5857,\n \"array\": [\n 3542.4688,\n 3580.4688,\n 3516.5936,\n 3585.5936,\n 3553.5936,\n 3494.968,\n 3511.968,\n 3573.344,\n 3548.344,\n 3512.2496,\n 3548.2496,\n 3590.2496,\n 3520.2496,\n 3503.7184,\n 3571.7184,\n 3567.8432,\n 3556.8432,\n 3525.8752,\n 3558.8752,\n 3487.8432,\n 3565.8432,\n 3542.8752,\n 3497.8752,\n 3533.968,\n 3496.968,\n 3539.968,\n 3600.8432,\n 3558.8432,\n 3510.6256,\n 3500.6256,\n 3602.3744,\n 3553.3744,\n 3552.4688,\n 3518.4688,\n 3494.5936,\n 3595.5936,\n 3553.5936,\n 3561.968,\n 3544.968,\n 3500.344,\n 3601.344,\n 3565.2496,\n 3528.2496,\n 3581.2496,\n 3610.2496,\n 3565.7184,\n 3543.7184,\n 3489.8432,\n 3590.8432,\n 3494.8752,\n 3574.8752,\n 3558.8432,\n 3602.8432,\n 3558.8752,\n 3575.8752,\n 3553.968,\n 3530.968,\n 3542.968,\n 3496.8432,\n 3593.8432,\n 3552.6256,\n 3606.6256,\n 3554.3744,\n 3557.3744\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_64.json": "{\n \"mean\": 5694.6427,\n \"array\": [\n 5707.0352,\n 5644.0352,\n 5734.312,\n 5694.312,\n 5642.312,\n 5687.0944,\n 5652.0944,\n 5724.4064,\n 5760.4064,\n 5780.656,\n 5660.656,\n 5694.5936,\n 5694.5936,\n 5610.656,\n 5775.656,\n 5719.0,\n 5663.0,\n 5612.2496,\n 5775.2496,\n 5607.5936,\n 5648.5936,\n 5674.1568,\n 5613.1568,\n 5604.3744,\n 5611.3744,\n 5707.3744,\n 5780.4064,\n 5698.4064,\n 5677.0,\n 5658.0,\n 5681.656,\n 5772.656,\n 5739.0352,\n 5684.0352,\n 5687.312,\n 5714.312,\n 5691.312,\n 5673.0944,\n 5664.0944,\n 5614.4064,\n 5647.4064,\n 5699.656,\n 5718.656,\n 5740.5936,\n 5707.5936,\n 5714.656,\n 5670.656,\n 5735.0,\n 5768.0,\n 5684.2496,\n 5746.2496,\n 5716.5936,\n 5683.5936,\n 5759.1568,\n 5773.1568,\n 5631.3744,\n 5683.3744,\n 5690.3744,\n 5698.4064,\n 5660.4064,\n 5688.0,\n 5793.0,\n 5620.656,\n 5791.656\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_llm/query_8.json": "{\n \"mean\": 1938.8398,\n \"array\": [\n 1940.2192,\n 1923.2192,\n 1912.2816,\n 1940.2816,\n 1968.2816,\n 1920.7184,\n 1945.7184,\n 1913.7808,\n 1959.7808,\n 1939.3744,\n 1914.3744,\n 1946.4064,\n 1948.4064,\n 1951.5936,\n 1942.5936,\n 1937.0624,\n 1917.0624,\n 1936.968,\n 1954.968,\n 1919.4688,\n 1909.4688,\n 1920.7504,\n 1949.7504,\n 1933.8432,\n 1933.8432,\n 1947.8432,\n 1967.344,\n 1971.344,\n 1924.2816,\n 1967.2816,\n 1937.7808,\n 1928.7808,\n 1963.2192,\n 1910.2192,\n 1911.2816,\n 1910.2816,\n 1951.2816,\n 1954.7184,\n 1945.7184,\n 1954.7808,\n 1965.7808,\n 1919.3744,\n 1954.3744,\n 1956.4064,\n 1950.4064,\n 1941.5936,\n 1930.5936,\n 1936.0624,\n 1927.0624,\n 1922.968,\n 1932.968,\n 1945.4688,\n 1939.4688,\n 1961.7504,\n 1952.7504,\n 1917.8432,\n 1949.8432,\n 1929.8432,\n 1928.344,\n 1944.344,\n 1939.2816,\n 1948.2816,\n 1905.7808,\n 1958.7808\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_slm/query_1.json": "{\n \"mean\": 110.9102,\n \"array\": [\n 110.1504,\n 112.0254,\n 110.3613,\n 110.3613,\n 110.4863,\n 109.9629,\n 112.0879,\n 112.541,\n 112.666,\n 109.8809,\n 110.3809,\n 109.9609,\n 111.5859,\n 112.4297,\n 110.0547,\n 110.5176,\n 110.3926,\n 109.4766,\n 109.8516,\n 112.1914,\n 111.6914,\n 111.1504,\n 110.4004,\n 111.9883,\n 111.3633,\n 109.4883,\n 110.6934,\n 110.6934,\n 111.9102,\n 109.4102,\n 109.8926,\n 112.5176,\n 110.6504,\n 110.9004,\n 111.1113,\n 110.9863,\n 109.9863,\n 109.9629,\n 111.2129,\n 110.041,\n 112.416,\n 112.6309,\n 111.5059,\n 109.3359,\n 112.2109,\n 109.5547,\n 109.9297,\n 111.7676,\n 110.7676,\n 109.3516,\n 110.4766,\n 110.3164,\n 109.6914,\n 112.0254,\n 109.5254,\n 111.4883,\n 109.9883,\n 111.2383,\n 112.3184,\n 111.8184,\n 112.2852,\n 112.0352,\n 112.5176,\n 109.6426\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_slm/query_2.json": "{\n \"mean\": 126.9655,\n \"array\": [\n 126.6406,\n 127.5156,\n 126.834,\n 125.959,\n 126.209,\n 127.541,\n 128.416,\n 126.7422,\n 126.2422,\n 125.1836,\n 125.3086,\n 128.7695,\n 127.8945,\n 128.7188,\n 125.8438,\n 127.666,\n 128.541,\n 127.3809,\n 125.1309,\n 126.832,\n 126.582,\n 125.4043,\n 128.2793,\n 126.0957,\n 128.8457,\n 128.7207,\n 125.2949,\n 125.2949,\n 128.502,\n 127.502,\n 127.9395,\n 127.4395,\n 127.1406,\n 127.2656,\n 125.834,\n 125.334,\n 125.584,\n 126.291,\n 126.291,\n 125.8672,\n 126.3672,\n 128.5586,\n 127.6836,\n 127.6445,\n 127.6445,\n 127.7188,\n 125.9688,\n 125.541,\n 127.416,\n 125.5059,\n 125.6309,\n 126.207,\n 127.832,\n 128.2793,\n 128.4043,\n 125.7207,\n 127.7207,\n 126.8457,\n 126.5449,\n 128.2949,\n 126.877,\n 128.252,\n 126.6895,\n 127.5645\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_slm/query_4.json": "{\n \"mean\": 159.1316,\n \"array\": [\n 159.2344,\n 159.8594,\n 158.0273,\n 157.4023,\n 159.9023,\n 160.9609,\n 157.8359,\n 156.5176,\n 160.7676,\n 160.1973,\n 161.4473,\n 161.2461,\n 158.3711,\n 158.9219,\n 160.6719,\n 160.5957,\n 157.4707,\n 159.7949,\n 160.0449,\n 159.2129,\n 157.3379,\n 160.7793,\n 159.5293,\n 158.2109,\n 157.5859,\n 160.9609,\n 159.6309,\n 160.6309,\n 157.7012,\n 159.0762,\n 159.4863,\n 157.1113,\n 158.8594,\n 156.8594,\n 157.9023,\n 160.1523,\n 159.6523,\n 158.2109,\n 159.7109,\n 158.5176,\n 161.1426,\n 159.3223,\n 158.6973,\n 161.2461,\n 160.2461,\n 158.4219,\n 159.0469,\n 159.7207,\n 157.5957,\n 156.5449,\n 158.1699,\n 159.4629,\n 158.4629,\n 158.4043,\n 158.5293,\n 157.3359,\n 160.0859,\n 158.8359,\n 159.7559,\n 160.3809,\n 160.5762,\n 160.5762,\n 157.1113,\n 158.3613\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_4/query_slm/query_8.json": "{\n \"mean\": 223.3573,\n \"array\": [\n 221.4082,\n 225.2832,\n 222.6816,\n 222.5566,\n 223.9316,\n 223.0566,\n 225.0566,\n 223.9492,\n 224.9492,\n 222.0723,\n 225.8223,\n 222.5879,\n 224.3379,\n 223.3496,\n 221.5996,\n 220.6152,\n 224.2402,\n 219.498,\n 221.373,\n 224.6445,\n 220.7695,\n 222.0098,\n 222.8848,\n 225.4004,\n 224.9004,\n 222.7754,\n 222.8164,\n 223.5664,\n 224.5391,\n 225.5391,\n 223.0469,\n 223.1719,\n 224.4082,\n 223.9082,\n 223.1816,\n 222.5566,\n 223.4316,\n 223.1816,\n 225.6816,\n 226.0742,\n 221.9492,\n 220.1973,\n 221.5723,\n 224.3379,\n 224.2129,\n 221.8496,\n 224.4746,\n 223.9902,\n 220.6152,\n 225.748,\n 225.498,\n 222.5195,\n 225.5195,\n 223.5098,\n 220.5098,\n 224.6504,\n 223.7754,\n 225.1504,\n 222.0664,\n 223.5664,\n 219.7891,\n 223.5391,\n 222.6719,\n 226.2969\n ],\n \"batch_size\": 4,\n \"instability_rate\": 0.0\n}", "bs_8/cache_llm/cache_interval_0.json": "{\n \"value\": [\n 3.3945,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7676,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.2392,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.0516,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.8162\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1099,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2488,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4882,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.008\n ],\n \"array\": [\n 3.3945,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.7676,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.2392,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.0516,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.8162\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_1.json": "{\n \"value\": [\n 4.3613,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.9766,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.7246,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.2031,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.1113\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1411,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3126,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.6516,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.3184\n ],\n \"array\": [\n 4.3613,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 4.9766,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 5.7246,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.2031,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.1113\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_10.json": "{\n \"value\": [\n 12.9883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.9023,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.3301,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 26.0977,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.6875\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2244,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0093,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0556\n ],\n \"array\": [\n 12.9883,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.9023,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.3301,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 26.0977,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 39.6875\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_11.json": "{\n \"value\": [\n 13.9355,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.2109,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.8398,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 28.2598,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.8438\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.235,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4954,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0279,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0744\n ],\n \"array\": [\n 13.9355,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.2109,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.8398,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 28.2598,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 42.8438\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_12.json": "{\n \"value\": [\n 14.9023,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 18.334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 22.3477,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 30.2188,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 46.1641\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2303,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4996,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0278,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0978\n ],\n \"array\": [\n 14.9023,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 18.334,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 22.3477,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 30.2188,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 46.1641\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_13.json": "{\n \"value\": [\n 15.8438,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.5996,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 23.8672,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 32.4043,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 49.4199\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2371,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0452,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.1192\n ],\n \"array\": [\n 15.8438,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.5996,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 23.8672,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 32.4043,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 49.4199\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_14.json": "{\n \"value\": [\n 16.7969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.7832,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 25.3926,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 34.5488,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 52.7598\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2373,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.5117,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.0569,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.141\n ],\n \"array\": [\n 16.7969,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.7832,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 25.3926,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 34.5488,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 52.7598\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_2.json": "{\n \"value\": [\n 5.3047,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.2148,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.2168,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.2891,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.3809\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1716,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3605,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.7511,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.5225\n ],\n \"array\": [\n 5.3047,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 6.2148,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.2168,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.2891,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.3809\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_3.json": "{\n \"value\": [\n 6.2852,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4238,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.7539,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.3965,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.7188\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1812,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.3928,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8132,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.66\n ],\n \"array\": [\n 6.2852,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 7.4238,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.7539,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.3965,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.7188\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_4.json": "{\n \"value\": [\n 7.2148,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.6465,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.2754,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.4727,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.0059\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.1984,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4242,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8674,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.7729\n ],\n \"array\": [\n 7.2148,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 8.6465,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 10.2754,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.4727,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 20.0059\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_5.json": "{\n \"value\": [\n 8.2031,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.8496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.7285,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.5762,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 23.2266\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2007,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4298,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.8988,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.8314\n ],\n \"array\": [\n 8.2031,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 9.8496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.7285,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 15.5762,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 23.2266\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_6.json": "{\n \"value\": [\n 9.1289,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.0664,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.3105,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.6836,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 26.5332\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2122,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4581,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9371,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9065\n ],\n \"array\": [\n 9.1289,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 11.0664,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.3105,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.6836,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 26.5332\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_7.json": "{\n \"value\": [\n 10.0879,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.2832,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.791,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.8145,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 29.8223\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2176,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4662,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9642,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9562\n ],\n \"array\": [\n 10.0879,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 12.2832,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.791,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 19.8145,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 29.8223\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_8.json": "{\n \"value\": [\n 11.0273,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.5059,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.293,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 21.8633,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 33.0645\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2248,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4775,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.9826,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 2.9984\n ],\n \"array\": [\n 11.0273,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 13.5059,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 16.293,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 21.8633,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 33.0645\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_llm/cache_interval_9.json": "{\n \"value\": [\n 12.041,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.8418,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 24.0098,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 36.4531\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n 33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n 45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 60,\n 61,\n 62,\n 63\n ],\n \"ratio\": [\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.2251,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.4818,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.994,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 3.0274\n ],\n \"array\": [\n 12.041,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 14.752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 17.8418,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 24.0098,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 36.4531\n ],\n \"batch_size\": 8,\n \"max_query_length\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.03\n}", "bs_8/cache_slm/cache_interval_0.json": "{\n \"value\": [\n 2.0254,\n 2.0547,\n 0.0,\n 2.125,\n 0.0,\n 0.0,\n 0.0,\n 2.25\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0145,\n 0.0,\n 1.0492,\n 0.0,\n 0.0,\n 0.0,\n 1.1109\n ],\n \"array\": [\n 2.0254,\n 2.0547,\n 0.0,\n 2.125,\n 0.0,\n 0.0,\n 0.0,\n 2.25\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_1.json": "{\n \"value\": [\n 2.5996,\n 2.6426,\n 0.0,\n 2.7559,\n 0.0,\n 0.0,\n 0.0,\n 2.9883\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0165,\n 0.0,\n 1.0601,\n 0.0,\n 0.0,\n 0.0,\n 1.1495\n ],\n \"array\": [\n 2.5996,\n 2.6426,\n 0.0,\n 2.7559,\n 0.0,\n 0.0,\n 0.0,\n 2.9883\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_10.json": "{\n \"value\": [\n 7.7832,\n 8.041,\n 0.0,\n 8.5332,\n 0.0,\n 0.0,\n 0.0,\n 9.5723\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0331,\n 0.0,\n 1.0964,\n 0.0,\n 0.0,\n 0.0,\n 1.2299\n ],\n \"array\": [\n 7.7832,\n 8.041,\n 0.0,\n 8.5332,\n 0.0,\n 0.0,\n 0.0,\n 9.5723\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_11.json": "{\n \"value\": [\n 8.3496,\n 8.6172,\n 0.0,\n 9.1875,\n 0.0,\n 0.0,\n 0.0,\n 10.2773\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.032,\n 0.0,\n 1.1004,\n 0.0,\n 0.0,\n 0.0,\n 1.2309\n ],\n \"array\": [\n 8.3496,\n 8.6172,\n 0.0,\n 9.1875,\n 0.0,\n 0.0,\n 0.0,\n 10.2773\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_12.json": "{\n \"value\": [\n 8.9492,\n 9.2266,\n 0.0,\n 9.834,\n 0.0,\n 0.0,\n 0.0,\n 11.0059\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.031,\n 0.0,\n 1.0989,\n 0.0,\n 0.0,\n 0.0,\n 1.2298\n ],\n \"array\": [\n 8.9492,\n 9.2266,\n 0.0,\n 9.834,\n 0.0,\n 0.0,\n 0.0,\n 11.0059\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_13.json": "{\n \"value\": [\n 9.4805,\n 9.8223,\n 0.0,\n 10.4648,\n 0.0,\n 0.0,\n 0.0,\n 11.7246\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0361,\n 0.0,\n 1.1038,\n 0.0,\n 0.0,\n 0.0,\n 1.2367\n ],\n \"array\": [\n 9.4805,\n 9.8223,\n 0.0,\n 10.4648,\n 0.0,\n 0.0,\n 0.0,\n 11.7246\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_14.json": "{\n \"value\": [\n 10.082,\n 10.4277,\n 0.0,\n 11.1113,\n 0.0,\n 0.0,\n 0.0,\n 12.4551\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0343,\n 0.0,\n 1.1021,\n 0.0,\n 0.0,\n 0.0,\n 1.2354\n ],\n \"array\": [\n 10.082,\n 10.4277,\n 0.0,\n 11.1113,\n 0.0,\n 0.0,\n 0.0,\n 12.4551\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_2.json": "{\n \"value\": [\n 3.1797,\n 3.252,\n 0.0,\n 3.4062,\n 0.0,\n 0.0,\n 0.0,\n 3.7129\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0227,\n 0.0,\n 1.0713,\n 0.0,\n 0.0,\n 0.0,\n 1.1677\n ],\n \"array\": [\n 3.1797,\n 3.252,\n 0.0,\n 3.4062,\n 0.0,\n 0.0,\n 0.0,\n 3.7129\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_3.json": "{\n \"value\": [\n 3.7441,\n 3.8438,\n 0.0,\n 4.0547,\n 0.0,\n 0.0,\n 0.0,\n 4.4355\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0266,\n 0.0,\n 1.0829,\n 0.0,\n 0.0,\n 0.0,\n 1.1847\n ],\n \"array\": [\n 3.7441,\n 3.8438,\n 0.0,\n 4.0547,\n 0.0,\n 0.0,\n 0.0,\n 4.4355\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_4.json": "{\n \"value\": [\n 4.332,\n 4.457,\n 0.0,\n 4.6895,\n 0.0,\n 0.0,\n 0.0,\n 5.1758\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0289,\n 0.0,\n 1.0825,\n 0.0,\n 0.0,\n 0.0,\n 1.1948\n ],\n \"array\": [\n 4.332,\n 4.457,\n 0.0,\n 4.6895,\n 0.0,\n 0.0,\n 0.0,\n 5.1758\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_5.json": "{\n \"value\": [\n 4.8867,\n 5.0605,\n 0.0,\n 5.3203,\n 0.0,\n 0.0,\n 0.0,\n 5.9141\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0356,\n 0.0,\n 1.0887,\n 0.0,\n 0.0,\n 0.0,\n 1.2102\n ],\n \"array\": [\n 4.8867,\n 5.0605,\n 0.0,\n 5.3203,\n 0.0,\n 0.0,\n 0.0,\n 5.9141\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_6.json": "{\n \"value\": [\n 5.4688,\n 5.6523,\n 0.0,\n 5.9746,\n 0.0,\n 0.0,\n 0.0,\n 6.6367\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0336,\n 0.0,\n 1.0925,\n 0.0,\n 0.0,\n 0.0,\n 1.2136\n ],\n \"array\": [\n 5.4688,\n 5.6523,\n 0.0,\n 5.9746,\n 0.0,\n 0.0,\n 0.0,\n 6.6367\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_7.json": "{\n \"value\": [\n 6.041,\n 6.2441,\n 0.0,\n 6.6211,\n 0.0,\n 0.0,\n 0.0,\n 7.3535\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0336,\n 0.0,\n 1.096,\n 0.0,\n 0.0,\n 0.0,\n 1.2173\n ],\n \"array\": [\n 6.041,\n 6.2441,\n 0.0,\n 6.6211,\n 0.0,\n 0.0,\n 0.0,\n 7.3535\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_8.json": "{\n \"value\": [\n 6.6445,\n 6.8203,\n 0.0,\n 7.252,\n 0.0,\n 0.0,\n 0.0,\n 8.082\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0265,\n 0.0,\n 1.0914,\n 0.0,\n 0.0,\n 0.0,\n 1.2163\n ],\n \"array\": [\n 6.6445,\n 6.8203,\n 0.0,\n 7.252,\n 0.0,\n 0.0,\n 0.0,\n 8.082\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/cache_slm/cache_interval_9.json": "{\n \"value\": [\n 7.2031,\n 7.4102,\n 0.0,\n 7.8867,\n 0.0,\n 0.0,\n 0.0,\n 8.8184\n ],\n \"index\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.0287,\n 0.0,\n 1.0949,\n 0.0,\n 0.0,\n 0.0,\n 1.2242\n ],\n \"array\": [\n 7.2031,\n 7.4102,\n 0.0,\n 7.8867,\n 0.0,\n 0.0,\n 0.0,\n 8.8184\n ],\n \"batch_size\": 8,\n \"max_query_length\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_length_stop\": 2048,\n \"instability_rate\": 0.0\n}", "bs_8/model_llm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1591.3512,\n 2533.184,\n 3614.296,\n 5788.4387,\n 10097.0112\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5918,\n 2.2712,\n 3.6374,\n 6.3449\n ],\n \"array_model\": [\n 1591.3512,\n 2533.184,\n 3614.296,\n 5788.4387,\n 10097.0112\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 54.312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 60.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 67.8272,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 80.8256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 109.0592\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1606.82,\n 2552.528,\n 3638.0624,\n 5822.8627,\n 10149.7328\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5886,\n 2.2641,\n 3.6238,\n 6.3167\n ],\n \"array_model\": [\n 1606.82,\n 2552.528,\n 3638.0624,\n 5822.8627,\n 10149.7328\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 69.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 79.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 91.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 115.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 161.7808\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1744.852,\n 2727.3392,\n 3855.7504,\n 6125.1763,\n 10622.952\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5631,\n 2.2098,\n 3.5104,\n 6.0882\n ],\n \"array_model\": [\n 1744.852,\n 2727.3392,\n 3855.7504,\n 6125.1763,\n 10622.952\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 207.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 254.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 309.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 417.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 635.0\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1760.0072,\n 2748.2768,\n 3879.9056,\n 6159.7699,\n 10673.4528\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5615,\n 2.2045,\n 3.4999,\n 6.0644\n ],\n \"array_model\": [\n 1760.0072,\n 2748.2768,\n 3879.9056,\n 6159.7699,\n 10673.4528\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 222.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 275.3744,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 333.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 452.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 685.5008\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1775.476,\n 2766.2464,\n 3904.032,\n 6191.1139,\n 10726.5776\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.558,\n 2.1989,\n 3.487,\n 6.0415\n ],\n \"array_model\": [\n 1775.476,\n 2766.2464,\n 3904.032,\n 6191.1139,\n 10726.5776\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 238.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 293.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 357.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 483.5008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 738.6256\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1790.54,\n 2786.496,\n 3928.344,\n 6226.0819,\n 10778.6704\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5562,\n 2.1939,\n 3.4772,\n 6.0198\n ],\n \"array_model\": [\n 1790.54,\n 2786.496,\n 3928.344,\n 6226.0819,\n 10778.6704\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 253.5008,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 313.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 381.8752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 518.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 790.7184\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1805.7896,\n 2805.4336,\n 3952.7504,\n 6260.3939,\n 10832.1088\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5536,\n 2.1889,\n 3.4668,\n 5.9985\n ],\n \"array_model\": [\n 1805.7896,\n 2805.4336,\n 3952.7504,\n 6260.3939,\n 10832.1088\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 268.7504,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 332.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 406.2816,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 552.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 844.1568\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1621.9144,\n 2572.3392,\n 3661.9376,\n 5856.2387,\n 10202.0464\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.586,\n 2.2578,\n 3.6107,\n 6.2901\n ],\n \"array_model\": [\n 1621.9144,\n 2572.3392,\n 3661.9376,\n 5856.2387,\n 10202.0464\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 84.8752,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 99.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 115.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 148.6256,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 214.0944\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1637.6024,\n 2591.6832,\n 3686.5312,\n 5889.9571,\n 10255.4528\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5826,\n 2.2512,\n 3.5967,\n 6.2625\n ],\n \"array_model\": [\n 1637.6024,\n 2591.6832,\n 3686.5312,\n 5889.9571,\n 10255.4528\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 100.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 118.7808,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 140.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 182.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 267.5008\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1652.476,\n 2611.2464,\n 3710.8752,\n 5923.1763,\n 10308.0464\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5802,\n 2.2456,\n 3.5844,\n 6.2379\n ],\n \"array_model\": [\n 1652.476,\n 2611.2464,\n 3710.8752,\n 5923.1763,\n 10308.0464\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 115.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 138.344,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 164.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 215.5632,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 320.0944\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1668.2888,\n 2630.496,\n 3734.1248,\n 5956.8323,\n 10359.5776\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5768,\n 2.2383,\n 3.5706,\n 6.2097\n ],\n \"array_model\": [\n 1668.2888,\n 2630.496,\n 3734.1248,\n 5956.8323,\n 10359.5776\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 131.2496,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 157.5936,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 187.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 249.2192,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 371.6256\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1683.1016,\n 2649.9648,\n 3759.4368,\n 5990.5507,\n 10412.4832\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5745,\n 2.2336,\n 3.5592,\n 6.1865\n ],\n \"array_model\": [\n 1683.1016,\n 2649.9648,\n 3759.4368,\n 5990.5507,\n 10412.4832\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 146.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 177.0624,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 212.968,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 282.9376,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 424.5312\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1698.4456,\n 2669.4336,\n 3783.1248,\n 6024.6451,\n 10465.1088\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5717,\n 2.2274,\n 3.5472,\n 6.1616\n ],\n \"array_model\": [\n 1698.4456,\n 2669.4336,\n 3783.1248,\n 6024.6451,\n 10465.1088\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 161.4064,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 196.5312,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 236.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 317.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 477.1568\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1713.476,\n 2688.9968,\n 3807.1568,\n 6057.4259,\n 10516.984\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5693,\n 2.2219,\n 3.5352,\n 6.1378\n ],\n \"array_model\": [\n 1713.476,\n 2688.9968,\n 3807.1568,\n 6057.4259,\n 10516.984\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 176.4368,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 216.0944,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 260.688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 349.8128,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 529.032\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_llm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 1729.6952,\n 2708.9344,\n 3831.9376,\n 6091.7699,\n 10571.2016\n ],\n \"index\": [\n 0,\n 7,\n 15,\n 31,\n 63\n ],\n \"ratio\": [\n 1.0,\n 1.5661,\n 2.2154,\n 3.5219,\n 6.1116\n ],\n \"array_model\": [\n 1729.6952,\n 2708.9344,\n 3831.9376,\n 6091.7699,\n 10571.2016\n ],\n \"array_query\": [\n 1537.0392,\n 2472.9024,\n 3546.4688,\n 5707.6131,\n 9987.952\n ],\n \"array_cache\": [\n 192.656,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 236.032,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 285.4688,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 384.1568,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 583.2496\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 64,\n \"max_query_length_cache\": 64,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 16,\n \"instability_rate\": 0.03\n}", "bs_8/model_slm/model_interval_0.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 129.3148,\n 160.8468,\n 225.1894,\n 353.0759\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2438,\n 1.7414,\n 2.7304\n ],\n \"array_model\": [\n 129.3148,\n 160.8468,\n 225.1894,\n 353.0759\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 2.0254,\n 2.0547,\n 0.0,\n 2.125,\n 0.0,\n 0.0,\n 0.0,\n 2.25\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_1.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 129.889,\n 161.4347,\n 225.8203,\n 353.8142\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2429,\n 1.7386,\n 2.724\n ],\n \"array_model\": [\n 129.889,\n 161.4347,\n 225.8203,\n 353.8142\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 2.5996,\n 2.6426,\n 0.0,\n 2.7559,\n 0.0,\n 0.0,\n 0.0,\n 2.9883\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_10.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 135.0726,\n 166.8331,\n 231.5976,\n 360.3982\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2351,\n 1.7146,\n 2.6682\n ],\n \"array_model\": [\n 135.0726,\n 166.8331,\n 231.5976,\n 360.3982\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 7.7832,\n 8.041,\n 0.0,\n 8.5332,\n 0.0,\n 0.0,\n 0.0,\n 9.5723\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_11.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 135.639,\n 167.4093,\n 232.2519,\n 361.1032\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2342,\n 1.7123,\n 2.6622\n ],\n \"array_model\": [\n 135.639,\n 167.4093,\n 232.2519,\n 361.1032\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 8.3496,\n 8.6172,\n 0.0,\n 9.1875,\n 0.0,\n 0.0,\n 0.0,\n 10.2773\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_12.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 136.2386,\n 168.0187,\n 232.8984,\n 361.8318\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2333,\n 1.7095,\n 2.6559\n ],\n \"array_model\": [\n 136.2386,\n 168.0187,\n 232.8984,\n 361.8318\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 8.9492,\n 9.2266,\n 0.0,\n 9.834,\n 0.0,\n 0.0,\n 0.0,\n 11.0059\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_13.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 136.7699,\n 168.6144,\n 233.5292,\n 362.5505\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2328,\n 1.7075,\n 2.6508\n ],\n \"array_model\": [\n 136.7699,\n 168.6144,\n 233.5292,\n 362.5505\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 9.4805,\n 9.8223,\n 0.0,\n 10.4648,\n 0.0,\n 0.0,\n 0.0,\n 11.7246\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_14.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 137.3714,\n 169.2198,\n 234.1757,\n 363.281\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2318,\n 1.7047,\n 2.6445\n ],\n \"array_model\": [\n 137.3714,\n 169.2198,\n 234.1757,\n 363.281\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 10.082,\n 10.4277,\n 0.0,\n 11.1113,\n 0.0,\n 0.0,\n 0.0,\n 12.4551\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_2.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 130.4691,\n 162.0441,\n 226.4706,\n 354.5388\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.242,\n 1.7358,\n 2.7174\n ],\n \"array_model\": [\n 130.4691,\n 162.0441,\n 226.4706,\n 354.5388\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 3.1797,\n 3.252,\n 0.0,\n 3.4062,\n 0.0,\n 0.0,\n 0.0,\n 3.7129\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_3.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 131.0335,\n 162.6359,\n 227.1191,\n 355.2614\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2412,\n 1.7333,\n 2.7112\n ],\n \"array_model\": [\n 131.0335,\n 162.6359,\n 227.1191,\n 355.2614\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 3.7441,\n 3.8438,\n 0.0,\n 4.0547,\n 0.0,\n 0.0,\n 0.0,\n 4.4355\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_4.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 131.6214,\n 163.2491,\n 227.7539,\n 356.0017\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2403,\n 1.7304,\n 2.7047\n ],\n \"array_model\": [\n 131.6214,\n 163.2491,\n 227.7539,\n 356.0017\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 4.332,\n 4.457,\n 0.0,\n 4.6895,\n 0.0,\n 0.0,\n 0.0,\n 5.1758\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_5.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 132.1761,\n 163.8526,\n 228.3847,\n 356.74\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2397,\n 1.7279,\n 2.699\n ],\n \"array_model\": [\n 132.1761,\n 163.8526,\n 228.3847,\n 356.74\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 4.8867,\n 5.0605,\n 0.0,\n 5.3203,\n 0.0,\n 0.0,\n 0.0,\n 5.9141\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_6.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 132.7582,\n 164.4444,\n 229.039,\n 357.4626\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2387,\n 1.7252,\n 2.6926\n ],\n \"array_model\": [\n 132.7582,\n 164.4444,\n 229.039,\n 357.4626\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 5.4688,\n 5.6523,\n 0.0,\n 5.9746,\n 0.0,\n 0.0,\n 0.0,\n 6.6367\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_7.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 133.3304,\n 165.0362,\n 229.6855,\n 358.1794\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2378,\n 1.7227,\n 2.6864\n ],\n \"array_model\": [\n 133.3304,\n 165.0362,\n 229.6855,\n 358.1794\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 6.041,\n 6.2441,\n 0.0,\n 6.6211,\n 0.0,\n 0.0,\n 0.0,\n 7.3535\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_8.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 133.9339,\n 165.6124,\n 230.3164,\n 358.9079\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2365,\n 1.7196,\n 2.6797\n ],\n \"array_model\": [\n 133.9339,\n 165.6124,\n 230.3164,\n 358.9079\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 6.6445,\n 6.8203,\n 0.0,\n 7.252,\n 0.0,\n 0.0,\n 0.0,\n 8.082\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/model_slm/model_interval_9.json": "{\n \"notes\": \"Estimated model_cost = query_cost + cache_cost\",\n \"value\": [\n 134.4925,\n 166.2023,\n 230.9511,\n 359.6443\n ],\n \"index\": [\n 0,\n 1,\n 3,\n 7\n ],\n \"ratio\": [\n 1.0,\n 1.2358,\n 1.7172,\n 2.6741\n ],\n \"array_model\": [\n 134.4925,\n 166.2023,\n 230.9511,\n 359.6443\n ],\n \"array_query\": [\n 127.2894,\n 158.7921,\n 223.0644,\n 350.8259\n ],\n \"array_cache\": [\n 7.2031,\n 7.4102,\n 0.0,\n 7.8867,\n 0.0,\n 0.0,\n 0.0,\n 8.8184\n ],\n \"batch_size\": 8,\n \"max_query_length_query\": 8,\n \"max_query_length_cache\": 8,\n \"cache_length_start\": 128,\n \"cache_length_step\": 128,\n \"cache_layers_num\": 1,\n \"instability_rate\": 0.0\n}", "bs_8/query_llm/query_1.json": "{\n \"mean\": 1537.0392,\n \"array\": [\n 1539.688,\n 1544.688,\n 1548.2192,\n 1520.2192,\n 1558.2192,\n 1556.1248,\n 1529.1248,\n 1529.4368,\n 1533.4368,\n 1553.5632,\n 1531.5632,\n 1510.7504,\n 1537.7504,\n 1525.9376,\n 1554.9376,\n 1533.5936,\n 1518.5936,\n 1543.5632,\n 1552.5632,\n 1531.344,\n 1553.344,\n 1550.1872,\n 1561.1872,\n 1538.032,\n 1529.032,\n 1528.032,\n 1544.5632,\n 1554.5632,\n 1548.4992,\n 1513.4992,\n 1535.2496,\n 1525.2496,\n 1533.688,\n 1522.688,\n 1513.2192,\n 1516.2192,\n 1563.2192,\n 1522.1248,\n 1565.1248,\n 1529.4368,\n 1562.4368,\n 1528.5632,\n 1535.5632,\n 1550.7504,\n 1516.7504,\n 1533.9376,\n 1555.9376,\n 1543.5936,\n 1555.5936,\n 1549.5632,\n 1540.5632,\n 1542.344,\n 1531.344,\n 1504.1872,\n 1540.1872,\n 1515.032,\n 1554.032,\n 1526.032,\n 1517.5632,\n 1539.5632,\n 1543.4992,\n 1519.4992,\n 1529.2496,\n 1534.2496\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_llm/query_16.json": "{\n \"mean\": 3546.4688,\n \"array\": [\n 3525.1728,\n 3529.1728,\n 3514.4064,\n 3518.4064,\n 3528.4064,\n 3583.5312,\n 3537.5312,\n 3578.9376,\n 3610.9376,\n 3512.5936,\n 3609.5936,\n 3532.344,\n 3560.344,\n 3590.032,\n 3550.032,\n 3492.344,\n 3565.344,\n 3501.312,\n 3512.312,\n 3495.5312,\n 3566.5312,\n 3584.7184,\n 3526.7184,\n 3558.5632,\n 3545.5632,\n 3535.5632,\n 3571.4368,\n 3533.4368,\n 3527.1248,\n 3567.1248,\n 3595.7184,\n 3536.7184,\n 3512.1728,\n 3549.1728,\n 3529.4064,\n 3588.4064,\n 3531.4064,\n 3576.5312,\n 3512.5312,\n 3496.9376,\n 3562.9376,\n 3585.5936,\n 3504.5936,\n 3566.344,\n 3588.344,\n 3576.032,\n 3523.032,\n 3580.344,\n 3571.344,\n 3565.312,\n 3540.312,\n 3541.5312,\n 3502.5312,\n 3520.7184,\n 3503.7184,\n 3558.5632,\n 3583.5632,\n 3604.5632,\n 3562.4368,\n 3540.4368,\n 3527.1248,\n 3534.1248,\n 3503.7184,\n 3532.7184\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_llm/query_32.json": "{\n \"mean\": 5707.6131,\n \"array\": [\n 5740.1744,\n 5721.1744,\n 5695.7504,\n 5616.7504,\n 5632.7504,\n 5775.3744,\n 5662.3744,\n 5686.656,\n 5684.656,\n 5743.4368,\n 5647.4368,\n 5701.7808,\n 5729.7808,\n 5752.0624,\n 5710.0624,\n 5707.968,\n 5779.968,\n 5679.1872,\n 5677.1872,\n 5652.8432,\n 5736.8432,\n 5612.4368,\n 5686.4368,\n 5636.8432,\n 5717.8432,\n 5770.8432,\n 5641.4992,\n 5645.4992,\n 5677.5312,\n 5758.5312,\n 5657.2192,\n 5803.2192,\n 5639.1744,\n 5639.1744,\n 5761.7504,\n 5765.7504,\n 5796.7504,\n 5780.3744,\n 5736.3744,\n 5730.656,\n 5638.656,\n 5733.4368,\n 5636.4368,\n 5726.7808,\n 5751.7808,\n 5641.0624,\n 5745.0624,\n 5728.968,\n 5691.968,\n 5734.1872,\n 5789.1872,\n 5720.8432,\n 5676.8432,\n 5639.4368,\n 5720.4368,\n 5613.8432,\n 5777.8432,\n 5661.8432,\n 5691.4992,\n 5784.4992,\n 5753.5312,\n 5788.5312,\n 5705.2192,\n 5743.2192\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_llm/query_64.json": "{\n \"mean\": 9987.952,\n \"array\": [\n 9862.9408,\n 9980.9408,\n 9919.2192,\n 9977.2192,\n 10076.2192,\n 10133.9056,\n 10118.9056,\n 10120.4992,\n 10029.4992,\n 10066.9056,\n 10137.9056,\n 9938.3744,\n 10007.3744,\n 10107.4688,\n 9862.4688,\n 10081.8432,\n 9977.8432,\n 9888.968,\n 9861.968,\n 10110.7504,\n 9859.7504,\n 10138.0,\n 10048.0,\n 10044.4992,\n 9936.4992,\n 10157.4992,\n 9908.3744,\n 10063.3744,\n 9926.2816,\n 9872.2816,\n 10056.8432,\n 10006.8432,\n 9969.9408,\n 9981.9408,\n 10050.2192,\n 10010.2192,\n 10049.2192,\n 9928.9056,\n 9899.9056,\n 10087.4992,\n 10015.4992,\n 9933.9056,\n 10007.9056,\n 10022.3744,\n 10044.3744,\n 10013.4688,\n 9919.4688,\n 9966.8432,\n 9948.8432,\n 9830.968,\n 9920.968,\n 9835.7504,\n 9858.7504,\n 9976.0,\n 10007.0,\n 9831.4992,\n 10077.4992,\n 9954.4992,\n 9863.3744,\n 10004.3744,\n 10025.2816,\n 9921.2816,\n 10097.8432,\n 9893.8432\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_llm/query_8.json": "{\n \"mean\": 2472.9024,\n \"array\": [\n 2448.7184,\n 2507.7184,\n 2428.3744,\n 2499.3744,\n 2509.3744,\n 2448.5632,\n 2486.5632,\n 2494.2192,\n 2472.2192,\n 2476.656,\n 2483.656,\n 2507.4064,\n 2441.4064,\n 2432.9376,\n 2518.9376,\n 2464.4688,\n 2451.4688,\n 2443.9056,\n 2445.9056,\n 2480.968,\n 2500.968,\n 2432.5632,\n 2509.5632,\n 2489.6256,\n 2493.6256,\n 2446.6256,\n 2482.656,\n 2483.656,\n 2496.4064,\n 2443.4064,\n 2455.4688,\n 2467.4688,\n 2466.7184,\n 2459.7184,\n 2483.3744,\n 2511.3744,\n 2474.3744,\n 2480.5632,\n 2502.5632,\n 2438.2192,\n 2496.2192,\n 2434.656,\n 2510.656,\n 2448.4064,\n 2484.4064,\n 2453.9376,\n 2444.9376,\n 2443.4688,\n 2481.4688,\n 2486.9056,\n 2467.9056,\n 2493.968,\n 2489.968,\n 2429.5632,\n 2486.5632,\n 2486.6256,\n 2477.6256,\n 2466.6256,\n 2445.656,\n 2506.656,\n 2462.4064,\n 2451.4064,\n 2461.4688,\n 2492.4688\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_slm/query_1.json": "{\n \"mean\": 127.2894,\n \"array\": [\n 127.5996,\n 126.8496,\n 127.5254,\n 126.6504,\n 127.4004,\n 128.0703,\n 128.0703,\n 127.1309,\n 127.6309,\n 126.168,\n 128.918,\n 127.1133,\n 126.4883,\n 128.4062,\n 127.2812,\n 128.209,\n 126.084,\n 127.2305,\n 125.4805,\n 126.4219,\n 127.6719,\n 128.2168,\n 126.2168,\n 125.1504,\n 125.6504,\n 127.4004,\n 127.5508,\n 127.5508,\n 128.8945,\n 126.7695,\n 127.418,\n 126.043,\n 126.4746,\n 128.0996,\n 127.4004,\n 127.9004,\n 129.0254,\n 125.9453,\n 128.9453,\n 126.1309,\n 128.6309,\n 127.793,\n 128.543,\n 125.8633,\n 127.3633,\n 127.9062,\n 128.4062,\n 127.084,\n 126.709,\n 128.7305,\n 128.6055,\n 128.7969,\n 127.2969,\n 126.7168,\n 128.4668,\n 125.0254,\n 128.2754,\n 127.0254,\n 126.3008,\n 127.0508,\n 128.1445,\n 125.8945,\n 126.418,\n 126.293\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_slm/query_2.json": "{\n \"mean\": 158.7921,\n \"array\": [\n 157.0703,\n 160.0703,\n 160.3574,\n 159.3574,\n 160.1074,\n 157.748,\n 160.873,\n 160.4062,\n 157.0312,\n 156.918,\n 159.043,\n 157.3145,\n 160.0645,\n 157.4727,\n 157.0977,\n 158.8809,\n 157.2559,\n 158.9297,\n 156.6797,\n 157.4648,\n 160.5898,\n 159.459,\n 157.459,\n 157.3828,\n 156.5078,\n 156.8828,\n 161.0234,\n 160.2734,\n 159.8027,\n 161.6777,\n 158.4473,\n 158.8223,\n 159.1953,\n 161.0703,\n 157.2324,\n 160.3574,\n 159.3574,\n 158.623,\n 159.623,\n 157.1562,\n 157.9062,\n 159.418,\n 158.793,\n 158.4395,\n 158.4395,\n 158.4727,\n 156.7227,\n 156.3809,\n 159.2559,\n 160.5547,\n 157.9297,\n 157.9648,\n 157.3398,\n 157.084,\n 161.209,\n 159.7578,\n 159.6328,\n 158.5078,\n 158.5234,\n 160.2734,\n 160.5527,\n 161.6777,\n 159.8223,\n 156.9473\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_slm/query_4.json": "{\n \"mean\": 223.0644,\n \"array\": [\n 222.125,\n 220.0,\n 224.6191,\n 220.9941,\n 220.1191,\n 222.0938,\n 220.9688,\n 225.0703,\n 220.1953,\n 222.6855,\n 224.8105,\n 224.3047,\n 224.5547,\n 223.4004,\n 221.4004,\n 222.2539,\n 219.8789,\n 220.748,\n 224.998,\n 223.2383,\n 224.9883,\n 224.0918,\n 221.9668,\n 226.0625,\n 223.1875,\n 225.4375,\n 221.791,\n 221.666,\n 224.1602,\n 225.0352,\n 224.2637,\n 222.7637,\n 223.625,\n 220.875,\n 222.6191,\n 225.6191,\n 222.3691,\n 221.5938,\n 220.7188,\n 225.8203,\n 225.4453,\n 223.1855,\n 226.0605,\n 225.9297,\n 221.6797,\n 222.0254,\n 226.0254,\n 224.1289,\n 223.2539,\n 220.498,\n 224.248,\n 225.9883,\n 221.6133,\n 225.7168,\n 222.4668,\n 225.5625,\n 226.1875,\n 220.4375,\n 225.541,\n 220.791,\n 220.9102,\n 221.0352,\n 220.2637,\n 220.0137\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}", "bs_8/query_slm/query_8.json": "{\n \"mean\": 350.8259,\n \"array\": [\n 348.875,\n 346.0,\n 350.5117,\n 352.7617,\n 347.3867,\n 350.9121,\n 352.9121,\n 355.5645,\n 347.4395,\n 349.6992,\n 352.8242,\n 352.2109,\n 346.8359,\n 347.9883,\n 354.9883,\n 352.6465,\n 350.8965,\n 355.543,\n 354.043,\n 351.9316,\n 349.1816,\n 345.3027,\n 351.5527,\n 347.2227,\n 349.4727,\n 347.5977,\n 348.2441,\n 355.4941,\n 352.9004,\n 347.5254,\n 354.9199,\n 349.5449,\n 348.75,\n 349.875,\n 353.1367,\n 355.0117,\n 348.7617,\n 347.7871,\n 354.9121,\n 355.5645,\n 347.6895,\n 347.3242,\n 346.9492,\n 350.2109,\n 350.9609,\n 347.9883,\n 346.2383,\n 352.5215,\n 352.5215,\n 352.793,\n 348.668,\n 354.0566,\n 347.9316,\n 355.6777,\n 354.0527,\n 349.2227,\n 349.0977,\n 356.0977,\n 352.6191,\n 353.8691,\n 349.7754,\n 353.2754,\n 352.4199,\n 346.1699\n ],\n \"batch_size\": 8,\n \"instability_rate\": 0.0\n}"}, "decisions_chain_intensity": [{"case": {"eval_batch_size": null, "node_top_k": 1, "tree_depth": 15, "verify_num": 16}, "script": [{"args": [64, 2293], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 0.514118]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.903665]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.379804]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.982193, 1.791838, 2.584815, 3.278253, 3.581655, 3.675778, 3.766449, 3.808329], 8, 64, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [64, 646], "op": "update_interval", "out": 4}, {"args": [0, 64, [0.0, 1.246257]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.006316]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.019021]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.1910000000000003]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.931685, 1.689675, 2.344477, 2.935436, 3.486704, 3.999589, 4.406367, 4.732661, 5.026812, 5.280807, 5.514453, 5.709774, 5.794763, 5.877966, 5.907718, 5.912312], 16, 64, 700, true], "op": "verify_paged", "out": [6, false]}, {"args": [64, 6], "op": "record", "out": null}, {"args": [1, 1641], "op": "update_interval", "out": 11}, {"args": [0, 1, [0.0, 0.064682]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.038651]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.084731]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0766]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.980359, 1.450346], 2, 1, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [64, 1720], "op": "update_interval", "out": 12}, {"args": [0, 64, [0.0, 0.146077]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.39698]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.026978]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.7318999999999996]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.797022, 1.555062, 2.286956, 2.930671, 3.489967, 3.937391, 4.358147, 4.604535, 4.817401, 5.008085, 5.185763, 5.31673, 5.434722, 5.55123, 5.652276, 5.71217], 4, 64, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [16, 1246], "op": "update_interval", "out": 8}, {"args": [0, 16, [0.0, 0.09979]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.126426]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 1.991671]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.064184]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.004211]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8925999999999998]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.77269, 1.101645], 2, 16, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [16, 1582], "op": "update_interval", "out": 11}, {"args": [0, 16, [0.0, 0.00734]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.417467]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.486026]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8650333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.832359, 1.55775, 2.244724, 2.873701, 3.500946, 4.111391, 4.698662, 5.252594, 5.73511, 6.12332, 6.509417, 6.820228, 7.048611, 7.207087, 7.342825, 7.470046], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [1, 1727], "op": "update_interval", "out": 12}, {"args": [0, 1, [0.0, 0.00474]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.023218]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.476814]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.234967]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 1.647436]], "op": "chain", "out": false}, {"args": [5, 1, [0.0, 0.981999]], "op": "chain", "out": false}, {"args": [6, 1, [0.0, 0.350867]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0768666666666666]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.91736, 1.8083, 2.6607, 3.275003, 3.847173, 4.406539, 4.852245, 5.22103, 5.583175, 5.863395, 6.132588, 6.336567, 6.512821, 6.6444, 6.704855, 6.72143], 1, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [16, 2138], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.058444]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.058988]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.284876]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.730498, 1.366683, 1.848918, 1.870177], 4, 16, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [16, 560], "op": "update_interval", "out": 3}, {"args": [0, 16, [0.0, 0.099936]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.271854]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 1.474011]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.073715]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.47596]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9468333333333332]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.993322, 1.894158, 2.77395, 3.645051, 4.508524, 5.299056, 6.027263, 6.666667, 7.291628, 7.900495, 8.483174, 9.055981, 9.473134, 9.861571, 10.243904, 10.324106], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [64, 1805], "op": "update_interval", "out": 13}, {"args": [0, 64, [0.0, 0.925244]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.167564]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.05958]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.689833333333334]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.957396], 1, 64, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [1, 2037], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 1.559892]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.552279]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.537851]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.602065]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 1.223516]], "op": "chain", "out": false}, {"args": [5, 1, [0.0, 0.101764]], "op": "chain", "out": false}, {"args": [6, 1, [0.0, 0.395994]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.914221, 1.79449, 2.600479, 3.266378, 3.697273, 4.081692, 4.408652, 4.607158], 8, 1, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [16, 860], "op": "update_interval", "out": 5}, {"args": [0, 16, [0.0, 0.081706]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.035075]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.426731]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9243666666666666]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.982037, 1.854866, 2.693984, 3.402615, 4.028348, 4.59893, 5.092806, 5.545283, 5.959268, 6.27464, 6.58367, 6.858833, 7.072913, 7.147592, 7.189081, 7.220567], 2, 16, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [1, 557], "op": "update_interval", "out": 3}, {"args": [0, 1, [0.0, 0.040519]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.014836]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.023741]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.075]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.115305], 1, 1, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [1, 2193], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 0.393026]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 1.916921]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.11883]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.755051, 1.289899, 1.516356, 1.552531], 4, 1, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [1, 4], "op": "record", "out": null}, {"args": [16, 2211], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 1.394623]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.050042]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.787032]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.090624]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.820964]], "op": "chain", "out": false}, {"args": [5, 16, [0.0, 0.232783]], "op": "chain", "out": false}, {"args": [6, 16, [0.0, 0.907072]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.980493, 1.957852, 2.867841, 3.767825, 4.623609, 5.441954, 6.232741, 6.954677, 7.672339, 8.323661, 8.965278, 9.502234, 9.965942, 10.286337, 10.499633, 10.704528], 1, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [16, 2068], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.049664]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.205232]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.46094]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.428934], 1, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [1, 709], "op": "update_interval", "out": 4}, {"args": [0, 1, [0.0, 1.066244]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.078791]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.941124]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 1.801134]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 1.679953]], "op": "chain", "out": false}, {"args": [5, 1, [0.0, 0.264098]], "op": "chain", "out": false}, {"args": [6, 1, [0.0, 1.157902]], "op": "chain", "out": false}, {"args": [7, 1, [0.0, 0.008602]], "op": "chain", "out": false}, {"args": [8, 1, [0.0, 0.878844]], "op": "chain", "out": false}, {"args": [9, 1, [0.0, 0.580339]], "op": "chain", "out": false}, {"args": [10, 1, [0.0, 0.056153]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0751]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.954785, 1.861997, 2.732066, 3.403365, 4.0128, 4.557512, 5.095833, 5.593481, 6.004564, 6.381594, 6.68605, 6.959013, 7.215526, 7.356677, 7.470957, 7.475893], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [1, 2114], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 1.834707]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 1.602137]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.012193]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.956865, 1.882136, 2.805554, 3.70611, 4.521827, 5.301116, 5.919011, 6.395543, 6.868705, 7.302383, 7.716157, 8.033371, 8.302585, 8.494037, 8.623498, 8.750466], 2, 1, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [1, 146], "op": "update_interval", "out": 0}, {"args": [0, 1, [0.0, 0.019411]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.0071]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.193249]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0742333333333334]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.730894, 0.835779], 2, 1, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [1, 2091], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 1.247052]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.395458]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.087873]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.863839, 1.689019, 2.304813, 2.847754, 3.385938, 3.919943, 4.138287, 4.354458], 8, 1, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [4, 953], "op": "update_interval", "out": 6}, {"args": [0, 4, [0.0, 1.829647]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.081051]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.189524]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2826333333333333]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.887542, 1.021474], 2, 4, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [4, 543], "op": "update_interval", "out": 3}, {"args": [0, 4, [0.0, 0.435946]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.232739]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.499301]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 1.086554]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 0.075602]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2832333333333332]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.968378, 1.879751, 2.637906, 3.323588, 3.89233, 4.444002, 4.958826, 5.464507, 5.967293, 6.1563, 6.340836, 6.487391, 6.602801, 6.708975, 6.779527, 6.816963], 1, 4, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [4, 707], "op": "update_interval", "out": 4}, {"args": [0, 4, [0.0, 0.504129]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.092689]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.057978]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2828333333333333]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.844263, 1.545293, 2.146223, 2.66151, 3.12847, 3.558551, 3.885378, 3.898624], 8, 4, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [4, 1671], "op": "update_interval", "out": 12}, {"args": [0, 4, [0.0, 0.907902]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.037019]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.060487]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2812333333333334]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.939587, 1.873382, 2.782123, 3.65775, 4.499657, 5.262052, 6.005029, 6.589644, 7.159328, 7.500302, 7.823999, 8.103515, 8.294463, 8.454499, 8.570773, 8.655599], 16, 4, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [4, 16], "op": "record", "out": null}, {"args": [4, 1352], "op": "update_interval", "out": 9}, {"args": [0, 4, [0.0, 1.759683]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.221921]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.459137]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 0.020683]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 0.042331]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2819666666666667]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.990579, 1.893284, 2.781332, 2.830902], 4, 4, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [4, 4], "op": "record", "out": null}, {"args": [16, 1225], "op": "update_interval", "out": 8}, {"args": [0, 16, [0.0, 0.675631]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.040613]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.319848]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8925999999999998]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.980087, 1.88573, 2.64747, 3.386265, 4.087515, 4.729781, 5.345177, 5.895235, 6.29679, 6.672467, 6.9291, 7.179988, 7.375434, 7.473883, 7.52434, 7.547161], 16, 16, 700, false], "op": "verify_paged", "out": [12, false]}, {"args": [16, 12], "op": "record", "out": null}, {"args": [64, 2133], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 0.056798]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 1.276025]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.152392]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.385902], 1, 64, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [4, 2030], "op": "update_interval", "out": 14}, {"args": [0, 4, [0.0, 1.083907]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.035127]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.841408]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 0.239141]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 0.219345]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2808000000000002]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.716602, 1.277246, 1.573287, 1.856815, 2.101838, 2.258425, 2.301199, 2.315212], 8, 4, 700, false], "op": "verify_paged", "out": [6, false]}, {"args": [4, 6], "op": "record", "out": null}, {"args": [64, 217], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 1.795084]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.795542]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.593262]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.223705], 1, 64, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [64, 1028], "op": "update_interval", "out": 7}, {"args": [0, 64, [0.0, 0.097317]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.004543]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.874542]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.090947]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.097882]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9898000000000002]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.861129, 1.676261, 2.420128, 3.102134, 3.741727, 4.342778, 4.759936, 5.17691, 5.540929, 5.904232, 6.260929, 6.415653, 6.555431, 6.692404, 6.810369, 6.860769], 16, 64, 700, false], "op": "verify_paged", "out": [6, false]}, {"args": [64, 6], "op": "record", "out": null}, {"args": [16, 528], "op": "update_interval", "out": 3}, {"args": [0, 16, [0.0, 0.023841]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.301769]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 1.568618]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.507937]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.543024]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9468333333333332]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.951896, 1.707684, 2.390854, 3.043793, 3.672202, 4.174351, 4.452992, 4.73128, 4.990799, 5.230235, 5.452796, 5.648774, 5.838799, 5.876844, 5.903748, 5.913224], 16, 16, 700, false], "op": "verify_paged", "out": [10, false]}, {"args": [16, 10], "op": "record", "out": null}, {"args": [4, 2256], "op": "update_interval", "out": 14}, {"args": [0, 4, [0.0, 0.140852]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.290406]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.12638]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2808000000000002]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.838554, 1.647737, 2.416488, 3.04022, 3.464581, 3.677745, 3.797534, 3.871881], 8, 4, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [16, 1598], "op": "update_interval", "out": 11}, {"args": [0, 16, [0.0, 0.485926]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.306933]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.650781]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.075899]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.256592]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8650333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.775503, 1.5005, 2.194481, 2.879808, 3.541906, 4.106123, 4.59098, 4.894785, 5.193655, 5.476571, 5.689831, 5.832749, 5.915771, 5.997479, 6.075987, 6.152066], 16, 16, 700, true], "op": "verify_paged", "out": [10, false]}, {"args": [16, 10], "op": "record", "out": null}, {"args": [16, 1340], "op": "update_interval", "out": 9}, {"args": [0, 16, [0.0, 0.036639]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.193467]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 1.138549]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.548025]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.318127]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8838333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.96777, 1.796294, 2.592424, 3.331256, 4.061044, 4.738049, 5.32919, 5.913999, 6.430165, 6.820411, 7.188658, 7.365946, 7.520733, 7.610472, 7.69476, 7.718877], 8, 16, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [64, 1153], "op": "update_interval", "out": 8}, {"args": [0, 64, [0.0, 0.081185]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 1.031283]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.095211]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9324999999999997]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.804319], 1, 64, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [1, 2240], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 0.610949]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.008405]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.027364]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.816252, 1.528455, 1.950507, 2.047956], 4, 1, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [1, 4], "op": "record", "out": null}, {"args": [64, 2137], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 0.202901]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.23663]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.484365]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.914977, 1.623117], 2, 64, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [64, 1431], "op": "update_interval", "out": 10}, {"args": [0, 64, [0.0, 0.512102]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.500297]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.915574]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.014609]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.071009]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.8237666666666663]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.915562, 1.599631, 2.234815, 2.763887, 3.153214, 3.474093, 3.719814, 3.882067], 8, 64, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [16, 243], "op": "update_interval", "out": 0}, {"args": [0, 16, [0.0, 0.94289]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.229625]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.015552]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9838666666666667]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.01717], 1, 16, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [64, 149], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 0.031255]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.018454]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.176701]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 1.434487]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.305166]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.910678, 1.313165], 2, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [16, 2246], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 1.883993]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.287695]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.290856]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.862577, 1.634258, 2.033683, 2.126102], 4, 16, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [4, 551], "op": "update_interval", "out": 3}, {"args": [0, 4, [0.0, 0.480851]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.952058]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.077417]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2832333333333332]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.905229, 1.77928], 2, 4, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1010], "op": "update_interval", "out": 6}, {"args": [0, 64, [0.0, 1.426575]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.524897]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.094146]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.0517333333333334]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.993119, 1.630085], 2, 64, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [16, 2114], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.053458]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.057188]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.000137]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.889654, 1.671072, 2.419668, 3.11336, 3.795589, 4.410452, 4.953861, 5.481809, 5.987778, 6.427968, 6.841118, 7.034188, 7.221951, 7.30481, 7.342032, 7.361063], 2, 16, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [64, 646], "op": "update_interval", "out": 4}, {"args": [0, 64, [0.0, 0.567957]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.189659]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.045615]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.1910000000000003]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.784419, 1.531055, 2.206914, 2.874575, 3.015129, 3.137023, 3.211367, 3.278408], 8, 64, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [64, 51], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 1.727358]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.071001]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.029347]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.93745, 1.838983, 2.695048, 3.539556, 4.289286, 5.008516, 5.636288, 5.78842], 8, 64, 700, false], "op": "verify_paged", "out": [6, false]}, {"args": [64, 6], "op": "record", "out": null}, {"args": [16, 1607], "op": "update_interval", "out": 11}, {"args": [0, 16, [0.0, 0.055558]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.025645]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.037655]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8650333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.83692, 1.663805, 2.387597, 3.095886, 3.773581, 4.366321, 4.929129, 5.331408, 5.663066, 5.889649, 6.06952, 6.226606, 6.367428, 6.461825, 6.554098, 6.644199], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [1, 1777], "op": "update_interval", "out": 12}, {"args": [0, 1, [0.0, 0.040684]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.204993]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.09269]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0768666666666666]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.821108, 1.207053], 2, 1, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [16, 1689], "op": "update_interval", "out": 12}, {"args": [0, 16, [0.0, 1.246054]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.801416]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.03177]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8557333333333332]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.713433, 1.325446, 1.882649, 2.421487, 2.934933, 3.376166, 3.708921, 4.015699, 4.314185, 4.607662, 4.868376, 5.122255, 5.35617, 5.561053, 5.749813, 5.852476], 16, 16, 700, false], "op": "verify_paged", "out": [12, false]}, {"args": [16, 12], "op": "record", "out": null}, {"args": [4, 2114], "op": "update_interval", "out": 14}, {"args": [0, 4, [0.0, 1.996721]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.083552]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.056737]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2808000000000002]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.477885, 0.61416], 2, 4, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1367], "op": "update_interval", "out": 9}, {"args": [0, 64, [0.0, 0.197511]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.026617]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.904574]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.271209]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 1.086851]], "op": "chain", "out": false}, {"args": [5, 64, [0.0, 0.038152]], "op": "chain", "out": false}, {"args": [6, 64, [0.0, 0.337069]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.8746666666666667]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.897008, 1.72166, 2.010239, 2.132892], 4, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [4, 1488], "op": "update_interval", "out": 10}, {"args": [0, 4, [0.0, 0.083075]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.059758]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.272611]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2821666666666667]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.998855, 1.928747], 2, 4, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [4, 1261], "op": "update_interval", "out": 8}, {"args": [0, 4, [0.0, 1.512211]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.812889]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.05919]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2824]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.931707, 1.719215, 2.503192, 3.224821, 3.75268, 4.250232, 4.655966, 5.059144, 5.404589, 5.740832, 5.984964, 6.116437, 6.234713, 6.337233, 6.390706, 6.423767], 2, 4, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1154], "op": "update_interval", "out": 8}, {"args": [0, 64, [0.0, 0.291474]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 1.676483]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.245412]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9324999999999997]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.905248], 1, 64, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [16, 2151], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.312406]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.54257]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.544354]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.751885, 1.483892, 2.178797, 2.776319, 3.369756, 3.895976, 4.39861, 4.845569, 5.242293, 5.637819, 5.944118, 6.248871, 6.488018, 6.612463, 6.682263, 6.734228], 16, 16, 700, false], "op": "verify_paged", "out": [12, false]}, {"args": [16, 12], "op": "record", "out": null}, {"args": [4, 281], "op": "update_interval", "out": 1}, {"args": [0, 4, [0.0, 1.998554]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.932946]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.737543]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 0.04214]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 0.443559]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2834666666666668]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.950975, 1.854389, 2.646747, 3.184337, 3.428267, 3.552063, 3.650626, 3.651203], 8, 4, 700, false], "op": "verify_paged", "out": [6, false]}, {"args": [4, 6], "op": "record", "out": null}, {"args": [16, 98], "op": "update_interval", "out": 0}, {"args": [0, 16, [0.0, 0.032476]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.264462]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.489268]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9838666666666667]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.04589, 0.077021], 2, 16, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [16, 1261], "op": "update_interval", "out": 8}, {"args": [0, 16, [0.0, 0.032435]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.560362]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.087873]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8925999999999998]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.859177, 1.551699, 1.867576, 1.926537], 4, 16, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [64, 66], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 0.343771]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.09954]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.05331]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.976271, 1.626385], 2, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [16, 1282], "op": "update_interval", "out": 9}, {"args": [0, 16, [0.0, 0.576814]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 1.739173]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.527392]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8838333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.79049, 1.501026, 2.165617, 2.472781, 2.708226, 2.931463, 3.127928, 3.308944], 8, 16, 700, true], "op": "verify_paged", "out": [6, false]}, {"args": [16, 6], "op": "record", "out": null}]}, {"case": {"eval_batch_size": 64, "node_top_k": 1, "tree_depth": 9, "verify_num": 16}, "script": [{"args": [64, 1102], "op": "update_interval", "out": 7}, {"args": [0, 64, [0.0, 1.314945]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.209871]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.006516]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9898000000000002]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.905973, 1.748376, 2.567196, 3.257789, 3.944735, 4.606056, 5.207513, 5.765703, 6.205758, 6.610372, 6.947371, 7.109639, 7.254942, 7.329551, 7.388376, 7.40698], 8, 64, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [64, 8], "op": "record", "out": null}, {"args": [1, 2085], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 0.133946]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.094671]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.066086]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.976154, 1.917242, 2.802817, 3.590122, 4.258271, 4.898999, 5.508296, 6.115735, 6.670885, 7.212034, 7.719282, 8.188872, 8.450436, 8.642302, 8.725905, 8.808569], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [64, 1270], "op": "update_interval", "out": 8}, {"args": [0, 64, [0.0, 0.011383]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.20114]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.022701]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.107645]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.493541]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9324999999999997]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.222168], 1, 64, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [64, 179], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 0.776492]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.205226]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.022064]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.988528, 1.844068, 2.610506, 3.336383, 4.03333, 4.635398, 5.184255, 5.698273, 6.196572, 6.6613, 7.116931, 7.485236, 7.824896, 8.064808, 8.284692, 8.466594], 4, 64, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [1, 1099], "op": "update_interval", "out": 7}, {"args": [0, 1, [0.0, 0.549272]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.017954]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.050141]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0757999999999999]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.998495, 1.945173, 2.839491, 3.671445, 4.458847, 5.098258, 5.725263, 6.2525, 6.756099, 7.233488, 7.555944, 7.847266, 8.109944, 8.339458, 8.501606, 8.525515], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [1, 1140], "op": "update_interval", "out": 7}, {"args": [0, 1, [0.0, 0.660002]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.384139]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.07047]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0757999999999999]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.558021, 0.586538, 0.613797, 0.617489], 4, 1, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [1, 4], "op": "record", "out": null}, {"args": [16, 1722], "op": "update_interval", "out": 12}, {"args": [0, 16, [0.0, 0.013838]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.043528]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 1.119864]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.43128]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.456261]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8557333333333332]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.900962, 1.690194, 2.42603, 3.006193, 3.569521, 3.937991, 4.285469, 4.302581], 8, 16, 700, false], "op": "verify_paged", "out": [6, false]}, {"args": [16, 6], "op": "record", "out": null}, {"args": [4, 127], "op": "update_interval", "out": 0}, {"args": [0, 4, [0.0, 0.079773]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.821021]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.120101]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2837666666666667]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.188938], 1, 4, 700, false], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [16, 2219], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.983446]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.249441]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 1.198005]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.039416]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.043039]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.934707, 1.694334, 2.390105, 3.057502, 3.716895, 4.204718, 4.648407, 5.014011, 5.355276, 5.682726, 5.995203, 6.233548, 6.412917, 6.554726, 6.645263, 6.675003], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [4, 32], "op": "update_interval", "out": 0}, {"args": [0, 4, [0.0, 0.578327]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.027969]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.413086]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 0.022038]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 1.002069]], "op": "chain", "out": false}, {"args": [5, 4, [0.0, 0.66503]], "op": "chain", "out": false}, {"args": [6, 4, [0.0, 0.92926]], "op": "chain", "out": false}, {"args": [7, 4, [0.0, 1.001781]], "op": "chain", "out": false}, {"args": [8, 4, [0.0, 0.149926]], "op": "chain", "out": false}, {"args": [4], "op": "classify_chain", "out": [1, 1.2837666666666667]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.227505], 1, 4, 700, false], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 2136], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 1.346777]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.005225]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.107763]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.624115]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.010206]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.800896, 1.277967, 1.448323, 1.582817], 4, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [64, 189], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 0.257454]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.571262]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.359274]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.93989, 1.775636, 2.590352, 3.38644, 4.17522, 4.943896, 5.602376, 6.260588, 6.75304, 7.176876, 7.555295, 7.895137, 8.154438, 8.337143, 8.446796, 8.479373], 16, 64, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [64, 8], "op": "record", "out": null}, {"args": [16, 2142], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 1.775335]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 1.747068]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.717588]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 0.091504]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.515372]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.859543, 1.415153], 2, 16, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [1, 54], "op": "update_interval", "out": 0}, {"args": [0, 1, [0.0, 0.081029]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.326517]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.080865]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0742333333333334]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.546165, 0.567886], 2, 1, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [1, 1494], "op": "update_interval", "out": 10}, {"args": [0, 1, [0.0, 1.369988]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.020025]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 1.055141]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.075972]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 1.010563]], "op": "chain", "out": false}, {"args": [5, 1, [0.0, 0.176049]], "op": "chain", "out": false}, {"args": [6, 1, [0.0, 0.38044]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0764]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.844931, 1.688216, 2.44533, 2.811768, 2.966823, 3.069856, 3.098028, 3.118564], 8, 1, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [64, 2248], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 0.81173]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.037498]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.083905]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.933035, 1.769933, 2.575784, 2.998845], 4, 64, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [1, 464], "op": "update_interval", "out": 2}, {"args": [0, 1, [0.0, 1.373205]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 1.231626]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 1.921036]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.084552]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 1.186373]], "op": "chain", "out": false}, {"args": [5, 1, [0.0, 0.555691]], "op": "chain", "out": false}, {"args": [6, 1, [0.0, 0.377531]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0747]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.987581, 1.787686, 2.584548, 3.270112, 3.926138, 4.411715, 4.847642, 5.238399, 5.575726, 5.853551, 6.051039, 6.19316, 6.329859, 6.45308, 6.575537, 6.634266], 4, 1, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [1, 4], "op": "record", "out": null}, {"args": [16, 1661], "op": "update_interval", "out": 11}, {"args": [0, 16, [0.0, 0.454379]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.356421]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.685084]], "op": "chain", "out": false}, {"args": [3, 16, [0.0, 1.271047]], "op": "chain", "out": false}, {"args": [4, 16, [0.0, 0.036167]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8650333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.838477, 1.504703, 1.945049, 2.224099], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [16, 1715], "op": "update_interval", "out": 12}, {"args": [0, 16, [0.0, 0.099082]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 1.474106]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.295463]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8557333333333332]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.997562, 1.935503, 2.437974, 2.897893, 3.297653, 3.676047, 4.043183, 4.398028, 4.747924, 5.080304, 5.41066, 5.732997, 6.042835, 6.339703, 6.544663, 6.717674], 16, 16, 700, true], "op": "verify_paged", "out": [14, false]}, {"args": [16, 14], "op": "record", "out": null}, {"args": [64, 176], "op": "update_interval", "out": 0}, {"args": [0, 64, [0.0, 1.031474]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 1.074788]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.315292]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.5440333333333336]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.98955, 1.663279], 2, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [4, 1796], "op": "update_interval", "out": 13}, {"args": [0, 4, [0.0, 0.022855]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.084117]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.112625]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2811000000000001]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.589748], 1, 4, 700, false], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1271], "op": "update_interval", "out": 8}, {"args": [0, 64, [0.0, 0.275068]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.235044]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.233235]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9324999999999997]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.967201, 1.869647, 2.759984, 3.596662, 4.386538, 5.100872, 5.763259, 6.379446, 6.881009, 7.301861, 7.692141, 8.047418, 8.361679, 8.66825, 8.819756, 8.844413], 2, 64, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [16, 1732], "op": "update_interval", "out": 12}, {"args": [0, 16, [0.0, 0.041382]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.085315]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.07012]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8557333333333332]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.779293, 1.331004], 2, 16, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [64, 1260], "op": "update_interval", "out": 8}, {"args": [0, 64, [0.0, 0.060125]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.014611]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.759875]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 1.819298]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.082037]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9324999999999997]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.765335, 1.316994], 2, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [4, 1068], "op": "update_interval", "out": 7}, {"args": [0, 4, [0.0, 0.068565]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.090654]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.978975]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 0.370713]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 1.678517]], "op": "chain", "out": false}, {"args": [5, 4, [0.0, 0.034703]], "op": "chain", "out": false}, {"args": [6, 4, [0.0, 0.012903]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2822000000000002]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.971467, 1.882071, 2.670681, 3.428301, 4.106061, 4.652389, 5.156747, 5.611741, 6.026745, 6.426377, 6.761825, 7.038752, 7.180072, 7.265054, 7.337717, 7.34583], 8, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [16, 901], "op": "update_interval", "out": 6}, {"args": [0, 16, [0.0, 0.17976]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 1.599231]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.039369]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9138333333333335]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.650176], 1, 16, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [16, 1175], "op": "update_interval", "out": 8}, {"args": [0, 16, [0.0, 0.693249]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.012332]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.011481]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8925999999999998]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.134106], 1, 16, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [4, 726], "op": "update_interval", "out": 4}, {"args": [0, 4, [0.0, 0.32897]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.09779]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.083221]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2828333333333333]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.823958, 1.579499, 2.331045, 3.08196, 3.783069, 4.405343, 4.971589, 5.461649, 5.895336, 6.310228, 6.668181, 6.993435, 7.278847, 7.448266, 7.542277, 7.562992], 2, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [1, 1224], "op": "update_interval", "out": 8}, {"args": [0, 1, [0.0, 1.247197]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.031514]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.091815]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0761]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.998419, 1.958102, 2.917503, 3.828944, 4.648154, 5.427422, 6.133905, 6.81314, 7.250396, 7.681216, 7.99785, 8.202285, 8.3777, 8.499369, 8.565297, 8.616795], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [16, 1967], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.090144]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.062107]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.401266]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.673518, 1.14142], 2, 16, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [16, 2], "op": "record", "out": null}, {"args": [64, 1378], "op": "update_interval", "out": 9}, {"args": [0, 64, [0.0, 1.969712]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.269557]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.101205]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.8746666666666667]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.923262, 1.573289, 2.042992, 2.493719, 2.750074, 2.963394, 3.078052, 3.148653], 8, 64, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [64, 4], "op": "record", "out": null}, {"args": [1, 1778], "op": "update_interval", "out": 12}, {"args": [0, 1, [0.0, 0.065525]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.337784]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 1.300171]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.057715]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 0.05415]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0768666666666666]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.851815, 1.514685, 1.986538, 2.029873], 4, 1, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [1, 4], "op": "record", "out": null}, {"args": [4, 653], "op": "update_interval", "out": 4}, {"args": [0, 4, [0.0, 0.54807]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.217565]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.056199]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2828333333333333]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.969897, 1.763136], 2, 4, 700, false], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [4, 1128], "op": "update_interval", "out": 7}, {"args": [0, 4, [0.0, 1.033129]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.495154]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.026071]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2822000000000002]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.964198, 1.880009, 2.648332, 3.320656, 3.992857, 4.62309, 5.223371, 5.797587, 6.354456, 6.899383, 7.432402, 7.952841, 8.403466, 8.525688, 8.555302, 8.573842], 8, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1225], "op": "update_interval", "out": 8}, {"args": [0, 64, [0.0, 0.055821]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.877796]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.67995]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 1.631693]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.105413]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9324999999999997]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.915929], 1, 64, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [64, 1], "op": "record", "out": null}, {"args": [1, 1370], "op": "update_interval", "out": 9}, {"args": [0, 1, [0.0, 0.097775]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.015094]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.006006]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0763]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.998596, 1.983444, 2.933005, 3.846953, 4.732399, 5.611054, 6.353552, 7.049668, 7.707662, 8.302686, 8.738744, 9.145029, 9.418498, 9.587563, 9.706437, 9.8123], 4, 1, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [1, 4], "op": "record", "out": null}, {"args": [16, 1963], "op": "update_interval", "out": 14}, {"args": [0, 16, [0.0, 0.047696]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.071772]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.000728]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.8380666666666665]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.916256, 1.779378, 2.475593, 3.167529, 3.846929, 4.501436, 4.894197, 4.986808], 8, 16, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [4, 1825], "op": "update_interval", "out": 13}, {"args": [0, 4, [0.0, 0.336261]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.507271]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.187382]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2811000000000001]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.392448, 0.707758], 2, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [16, 713], "op": "update_interval", "out": 4}, {"args": [0, 16, [0.0, 0.092176]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.041369]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.373877]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.935833333333333]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.984157, 1.96716, 2.895155, 3.709048, 4.447483, 5.165737, 5.589547, 5.945016, 6.288693, 6.598667, 6.864962, 7.091731, 7.226587, 7.335413, 7.443429, 7.50309], 1, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [4, 89], "op": "update_interval", "out": 0}, {"args": [0, 4, [0.0, 1.583479]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.513843]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.126215]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2837666666666667]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.922206, 1.840138, 2.679547, 3.434584, 4.173315, 4.893396, 5.520415, 6.080106, 6.593759, 6.931118, 7.236129, 7.476849, 7.661873, 7.762836, 7.820221, 7.84844], 16, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [16, 53], "op": "update_interval", "out": 0}, {"args": [0, 16, [0.0, 0.095143]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 1.092763]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.041484]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9838666666666667]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.984726, 1.967772, 2.643474, 2.68419], 4, 16, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [1, 1934], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 0.536106]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 1.556376]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.619388]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.289078]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 1.156713]], "op": "chain", "out": false}, {"args": [5, 1, [0.0, 0.047612]], "op": "chain", "out": false}, {"args": [6, 1, [0.0, 1.256387]], "op": "chain", "out": false}, {"args": [7, 1, [0.0, 0.004511]], "op": "chain", "out": false}, {"args": [8, 1, [0.0, 0.46374]], "op": "chain", "out": false}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.481541, 0.715232], 2, 1, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [1, 849], "op": "update_interval", "out": 5}, {"args": [0, 1, [0.0, 0.01466]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.08282]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.340983]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 1.623985]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 0.042749]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0752666666666668]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.959656, 1.90301, 2.813143, 3.718004, 4.610497, 5.485268, 6.148262, 6.756095, 7.30613, 7.845412, 8.283149, 8.601509, 8.84836, 9.02407, 9.195948, 9.359696], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [64, 2306], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 0.170416]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.376147]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.043362]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.900763, 1.79626, 2.594632, 3.216974, 3.758324, 4.294321, 4.741319, 5.125543, 5.509635, 5.705435, 5.881293, 6.026264, 6.149875, 6.212073, 6.271703, 6.301535], 16, 64, 700, true], "op": "verify_paged", "out": [6, false]}, {"args": [64, 6], "op": "record", "out": null}, {"args": [64, 428], "op": "update_interval", "out": 2}, {"args": [0, 64, [0.0, 0.538851]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.330415]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.115608]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.235179]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 0.024465]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 3.353666666666667]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.875085, 1.477765], 2, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [4, 652], "op": "update_interval", "out": 4}, {"args": [0, 4, [0.0, 1.252683]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.118635]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.088113]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2828333333333333]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.810948, 1.618149, 2.307452, 2.986799, 3.665609, 4.28016, 4.890033, 5.489264, 6.039496, 6.486953, 6.920329, 7.340422, 7.626247, 7.831323, 7.976009, 8.101304], 4, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [1, 1661], "op": "update_interval", "out": 11}, {"args": [0, 1, [0.0, 1.711146]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.558955]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.030676]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0766]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.994417, 1.96838, 2.881002, 3.681856, 4.438465, 5.072025, 5.682785, 6.276945, 6.767201, 7.257379, 7.603467, 7.880979, 8.01568, 8.059155, 8.094691, 8.104986], 1, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [1, 1863], "op": "update_interval", "out": 13}, {"args": [0, 1, [0.0, 0.217283]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.445778]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.838378]], "op": "chain", "out": false}, {"args": [3, 1, [0.0, 0.067934]], "op": "chain", "out": false}, {"args": [4, 1, [0.0, 0.132938]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0771]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.824261, 1.599741], 2, 1, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [4, 266], "op": "update_interval", "out": 1}, {"args": [0, 4, [0.0, 0.069147]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 0.006661]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 1.492108]], "op": "chain", "out": false}, {"args": [3, 4, [0.0, 0.251335]], "op": "chain", "out": false}, {"args": [4, 4, [0.0, 0.085181]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2834666666666668]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.962905, 1.913582, 2.813583, 3.550456, 4.235132, 4.787465, 5.329535, 5.766754, 6.200783, 6.507907, 6.75428, 6.999753, 7.202303, 7.38867, 7.530069, 7.626595], 16, 4, 700, false], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1052], "op": "update_interval", "out": 7}, {"args": [0, 64, [0.0, 0.296831]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.296468]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.396139]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9898000000000002]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.819112, 1.635961, 2.443891, 3.227416, 3.977894, 4.721698, 5.460614, 6.088521, 6.687463, 7.264259, 7.769163, 8.2269, 8.600045, 8.905005, 9.022689, 9.033209], 2, 64, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [64, 1658], "op": "update_interval", "out": 11}, {"args": [0, 64, [0.0, 0.828476]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.220857]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.27709]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.7754]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.968239, 1.751114, 2.39944, 3.046291, 3.66601, 4.239334, 4.752054, 5.216361, 5.662427, 6.028908, 6.372849, 6.691414, 6.865779, 7.02724, 7.157863, 7.248088], 16, 64, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [64, 8], "op": "record", "out": null}, {"args": [4, 573], "op": "update_interval", "out": 3}, {"args": [0, 4, [0.0, 1.79704]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.179729]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.04071]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2832333333333332]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.865691, 1.709005], 2, 4, 700, false], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 1049], "op": "update_interval", "out": 7}, {"args": [0, 64, [0.0, 0.073849]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.503631]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.287175]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.9898000000000002]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.657657, 1.254932, 1.474874, 1.581283], 4, 64, 700, false], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [1, 655], "op": "update_interval", "out": 4}, {"args": [0, 1, [0.0, 0.044613]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.85979]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.064493]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0751]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.95737, 1.887755, 2.813671, 3.664844, 4.395159, 5.124976, 5.85378, 6.530443, 7.204646, 7.812445, 8.394669, 8.965324, 9.478751, 9.944045, 10.327936, 10.592322], 2, 1, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [1, 2], "op": "record", "out": null}, {"args": [64, 1596], "op": "update_interval", "out": 11}, {"args": [0, 64, [0.0, 0.034175]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 1.83704]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 0.020682]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.7754]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.930017, 1.835696, 2.499753, 2.601351], 4, 64, 700, true], "op": "verify_paged", "out": [2, false]}, {"args": [64, 2], "op": "record", "out": null}, {"args": [4, 2261], "op": "update_interval", "out": 14}, {"args": [0, 4, [0.0, 1.670991]], "op": "chain", "out": false}, {"args": [1, 4, [0.0, 1.2978]], "op": "chain", "out": false}, {"args": [2, 4, [0.0, 0.00228]], "op": "chain", "out": true}, {"args": [4], "op": "classify_chain", "out": [1, 1.2808000000000002]}, {"args": [4], "op": "ragged_active", "out": true}, {"args": [[0.661687, 1.313054, 1.823408, 2.331526, 2.676248, 3.015325, 3.331166, 3.361243], 8, 4, 700, true], "op": "verify_paged", "out": [2, true]}, {"args": [4, 2], "op": "record", "out": null}, {"args": [64, 2019], "op": "update_interval", "out": 14}, {"args": [0, 64, [0.0, 0.011866]], "op": "chain", "out": false}, {"args": [1, 64, [0.0, 0.599092]], "op": "chain", "out": false}, {"args": [2, 64, [0.0, 1.044684]], "op": "chain", "out": false}, {"args": [3, 64, [0.0, 0.025161]], "op": "chain", "out": false}, {"args": [4, 64, [0.0, 1.96066]], "op": "chain", "out": false}, {"args": [5, 64, [0.0, 0.878823]], "op": "chain", "out": false}, {"args": [6, 64, [0.0, 0.375601]], "op": "chain", "out": true}, {"args": [64], "op": "classify_chain", "out": [3, 2.6494666666666666]}, {"args": [64], "op": "ragged_active", "out": true}, {"args": [[0.988121, 1.89574, 2.79382, 3.686278, 4.51201, 5.119527, 5.710503, 6.270308, 6.829477, 7.35585, 7.720219, 8.058839, 8.282318, 8.440114, 8.498486, 8.510288], 16, 64, 700, false], "op": "verify_paged", "out": [10, false]}, {"args": [64, 10], "op": "record", "out": null}, {"args": [16, 205], "op": "update_interval", "out": 0}, {"args": [0, 16, [0.0, 1.540194]], "op": "chain", "out": false}, {"args": [1, 16, [0.0, 0.041475]], "op": "chain", "out": false}, {"args": [2, 16, [0.0, 0.098476]], "op": "chain", "out": true}, {"args": [16], "op": "classify_chain", "out": [2, 1.9838666666666667]}, {"args": [16], "op": "ragged_active", "out": true}, {"args": [[0.912835, 1.815998, 2.656377, 3.456882, 4.086085, 4.685456, 5.241868, 5.750095, 6.251849, 6.750593, 7.215129, 7.638222, 8.028355, 8.280062, 8.448118, 8.544117], 1, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [1, 2178], "op": "update_interval", "out": 14}, {"args": [0, 1, [0.0, 1.338794]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 1.55596]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.067076]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0772333333333333]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.894399, 1.611863, 2.316831, 2.966279, 3.612797, 4.163736, 4.687921, 5.107313, 5.508441, 5.81866, 6.078801, 6.305654, 6.413844, 6.514687, 6.593941, 6.645552], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [1, 32], "op": "update_interval", "out": 0}, {"args": [0, 1, [0.0, 0.686142]], "op": "chain", "out": false}, {"args": [1, 1, [0.0, 0.079378]], "op": "chain", "out": false}, {"args": [2, 1, [0.0, 0.050263]], "op": "chain", "out": true}, {"args": [1], "op": "classify_chain", "out": [0, 1.0742333333333334]}, {"args": [1], "op": "ragged_active", "out": false}, {"args": [[0.992194, 1.892773, 2.789884, 3.642598, 4.389, 4.995337, 5.471776, 5.923347, 6.254242, 6.426764, 6.597073, 6.722416, 6.832519, 6.906006, 6.970623, 6.994746], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}]}], "decisions_high_intensity": [{"case": {"eval_batch_size": null, "node_top_k": 4, "tree_depth": 12, "verify_num": 64}, "script": [{"args": [8], "op": "history", "out": 64}, {"args": [8, 2293], "op": "draft_cost_row", "out": [[1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], 2.6445, 1.3, 13.1453, 1.0]}, {"args": [0, 8, 64, [0.1710092, 0.3317892, 0.454581, 0.5497336, 0.6401, 0.7294186, 0.7673992, 0.8046338, 0.8329928]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.178076, 0.3258592, 0.4558734, 0.582764, 0.7073898, 0.826477, 0.9342158, 1.0248146, 1.1040466]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 9], "op": "verify_count", "out": 9}, {"args": [[0.599618], 1, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1337], "op": "draft_cost_row", "out": [[1.0, 1.2358, 1.7172, 2.6741], [0, 1, 3, 7], 2.6741, 1.3, 12.8609, 1.1741218286778514]}, {"args": [0, 8, 64, [0.1309604, 0.2491522, 0.3594058, 0.4407616, 0.4995918, 0.546321, 0.5853852, 0.602383, 0.6033018]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.186337, 0.337935, 0.4505636, 0.5531404, 0.6039394, 0.6255248, 0.6470854, 0.663726, 0.6696764]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 38], "op": "verify_count", "out": 38}, {"args": [[0.980359, 1.890631, 2.737941, 3.207928, 3.605352, 3.81507, 3.888108, 3.888653], 8, 8, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [8, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 814], "op": "draft_cost_row", "out": [[1.0, 1.5414, 2.6173, 4.7778], [0, 1, 3, 7], 4.7778, 1.1, 9.9136, 1.0]}, {"args": [0, 32, 64, [0.0461424, 0.0814932, 0.1047402, 0.1252427, 0.1420874, 0.1576479, 0.1643777, 0.1651352, 0.1656829]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0492641, 0.0877402, 0.1218441, 0.1472873, 0.1716285, 0.19259, 0.2123327, 0.2315202, 0.2409396]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 28], "op": "verify_count", "out": 28}, {"args": [[0.997904, 1.993739, 2.970918, 3.943983, 4.873219, 5.788167, 6.692991, 7.52535, 8.35564, 9.104625, 9.844453, 10.569844, 11.256818, 11.910326, 12.546913, 13.175891, 13.803136, 14.425285, 15.041155, 15.6516, 16.261933, 16.863952, 17.451223, 18.028183, 18.582114, 19.113118, 19.633192, 20.145548, 20.636547, 21.119063, 21.598363, 22.039905, 22.46072, 22.872147, 23.263758, 23.651968, 24.038138, 24.424235, 24.79291, 25.103721, 25.385683, 25.640862, 25.889926, 26.118309, 26.330709, 26.539443, 26.72675, 26.885226, 27.031584, 27.167322, 27.294544, 27.420944, 27.529991, 27.622183, 27.700681, 27.774962, 27.849102, 27.918256, 27.965658, 28.012256, 28.054364, 28.073995, 28.089504, 28.099079], 1, 32, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1845], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2279, 1.5339], [0, 1, 3, 7], 1.5339, 1.3, 14.3235, 1.669235363526447]}, {"args": [0, 2, 64, [0.0481386, 0.0936492, 0.1286976, 0.1632588, 0.1961054, 0.2253274, 0.2323447, 0.2340988, 0.2349934]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.0499679, 0.0868182, 0.1233431, 0.1551523, 0.1824571, 0.2065688, 0.2225141, 0.2262772, 0.2273401]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 17], "op": "verify_count", "out": 17}, {"args": [[0.98036, 1.937756, 2.881995, 3.816247, 4.746548, 5.67228, 6.593083, 7.489502, 8.385155, 9.24245, 10.073346, 10.895204, 11.698918, 12.478864, 13.233494, 13.987265, 14.681421, 15.343687, 16.003818, 16.637991, 17.249749, 17.791001, 18.309698, 18.828093, 19.342624, 19.84255, 20.340861, 20.827158, 21.300437, 21.771788, 22.234411, 22.692166, 23.108413, 23.51317, 23.892346, 24.260298, 24.611043, 24.953567, 25.295181, 25.625331, 25.935566, 26.192769, 26.443369, 26.684852, 26.90443, 27.118619, 27.328512, 27.528803, 27.672024, 27.806577, 27.922157, 28.035042, 28.147871, 28.23852, 28.326252, 28.411179, 28.488848, 28.561097, 28.625236, 28.665809, 28.696078, 28.718369, 28.732901, 28.745349], 64, 2, 700, false], "op": "verify_paged", "out": [64, false]}, {"args": [2, 64], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 2130], "op": "draft_cost_row", "out": [[1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], 2.6445, 1.3, 13.1453, 1.0]}, {"args": [0, 8, 64, [0.1683804, 0.3341258, 0.4773812, 0.6130322, 0.7474616, 0.8724168, 0.9939278, 1.057997, 1.1136218]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.1538426, 0.2837, 0.411897, 0.5247048, 0.6057426, 0.6765856, 0.7327996, 0.7860822, 0.8240658]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 19], "op": "verify_count", "out": 19}, {"args": [[0.980493, 1.957852, 2.916312, 3.86057, 4.793174, 5.703164, 6.613129, 7.519366, 8.41935, 9.298671, 10.154454, 10.9728, 11.78194, 12.589325, 13.389185, 14.185952, 14.977884, 15.768671, 16.556577, 17.324811, 18.081018, 18.803395, 19.52533, 20.242992, 20.957163, 21.654475, 22.338968, 22.994011, 23.645333, 24.28695, 24.916914, 25.542462, 26.15691, 26.725724, 27.276026, 27.812982, 28.333405, 28.820853, 29.295995, 29.768194, 30.231902, 30.685438, 31.131919, 31.57282, 31.966337, 32.343139, 32.691646, 33.037386, 33.37239, 33.692785, 33.96514, 34.178436, 34.383331, 34.582672, 34.761771, 34.940457, 35.113353, 35.253854, 35.383764, 35.470973, 35.553746, 35.617803, 35.646213, 35.65698], 64, 8, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [8, 64], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 2116], "op": "draft_cost_row", "out": [[1.0, 1.0761, 1.2276, 1.5334], [0, 1, 3, 7], 1.5334, 1.3, 14.3383, 1.2526799521234306]}, {"args": [0, 2, 64, [0.949154, 1.894902, 2.734878, 3.42425, 3.950913, 4.443494, 4.733664, 4.955078, 5.041102]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.900525, 1.745786, 2.589409, 3.318252, 3.957123, 4.517094, 5.039877, 5.421094, 5.732792]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 2, 64, [0.96844, 1.819212, 2.424439, 2.997428, 3.533332, 4.057558, 4.560732, 4.768972, 4.969939]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 2, 64, [0.969405, 1.770473, 2.46146, 3.024327, 3.540345, 4.031385, 4.431969, 4.497869, 4.525625]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 2, 64, [0.956865, 1.880284, 2.696001, 3.234716, 3.707878, 4.141555, 4.555329, 4.824543, 4.951511]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 2, 64, [0.925271, 1.825826, 2.605115, 3.22301, 3.699543, 4.016757, 4.208209, 4.33767, 4.360456]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 2, 64, [0.730894, 1.417928, 2.037694, 2.393041, 2.715123, 2.942383, 3.136489, 3.259273, 3.364158]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 2, 64, [0.530352, 1.0597, 1.570169, 2.006945, 2.420347, 2.796083, 3.046637, 3.244365, 3.404094]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 2, 64, [0.856764, 1.708022, 2.448794, 3.087261, 3.718576, 4.330287, 4.859906, 5.092565, 5.296831]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 2, 64, [0.998354, 1.921121, 2.823798, 3.71134, 4.521848, 4.837722, 5.15271, 5.370855, 5.504787]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 2, 64, [0.832169, 1.622104, 2.348681, 2.770311, 3.17309, 3.432588, 3.671935, 3.797939, 3.894954]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 2, 64, [0.968378, 1.879751, 2.637906, 3.323121, 4.005504, 4.511185, 4.712119, 4.827529, 4.845288]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [2, 25], "op": "verify_count", "out": 25}, {"args": [[0.990579, 1.952004, 2.89159, 3.825386, 4.747248, 5.655989, 6.56109, 7.463795, 8.351843, 9.22747, 10.069377, 10.86671, 11.659059, 12.421454, 13.183451, 13.926428, 14.607394, 15.280332, 15.914338, 16.527701, 17.132574, 17.717189, 18.296967, 18.866651, 19.405525, 19.886802, 20.318446, 20.744889, 21.152845, 21.543729, 21.916883, 22.287077, 22.656945, 23.016513, 23.371084, 23.712058, 24.041969, 24.365666, 24.667355, 24.950449, 25.229965, 25.502941, 25.713026, 25.919855, 26.120126, 26.311073, 26.500645, 26.685462, 26.867012, 27.039503, 27.19954, 27.357567, 27.492018, 27.625233, 27.741507, 27.856454, 27.957317, 28.054031, 28.148833, 28.233658, 28.311263, 28.360833, 28.401711, 28.426016], 64, 2, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [2, 64], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1384], "op": "draft_cost_row", "out": [[1.0, 1.1404, 1.422, 1.9839], [0, 1, 3, 7], 1.9839, 1.3, 13.7238, 1.0173675564438172]}, {"args": [0, 4, 64, [0.0099989, 0.0197997, 0.0274171, 0.0344296, 0.0410273, 0.0474499, 0.0531457, 0.0584765, 0.0623724]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.0073879, 0.0135419, 0.0175575, 0.0213142, 0.0238806, 0.025835, 0.0268195, 0.0273241, 0.0275523]], "op": "tree_width", "out": [4, 64, true]}, {"args": [4, 33], "op": "verify_count", "out": 33}, {"args": [[0.967136, 1.535115, 2.085172, 2.592992], 4, 4, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1821], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.6004, 1.265916000971087]}, {"args": [0, 1, 64, [0.0019401, 0.0038508, 0.005728, 0.0074394, 0.0087762, 0.0098751, 0.010959, 0.0117318, 0.0125036]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.0011931, 0.0022539, 0.003243, 0.0042095, 0.0050686, 0.0058658, 0.0064906, 0.0070594, 0.007599]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 37], "op": "verify_count", "out": 37}, {"args": [[0.988769, 1.96759, 2.940758, 3.885216, 4.822487, 5.728037, 6.62558, 7.442276, 8.19692, 8.945283, 9.668021, 10.292269, 10.895892, 11.423992, 11.947351, 12.42496, 12.89331, 13.348999, 13.791863, 14.221379, 14.611334, 14.907375, 15.152398, 15.396106, 15.599763, 15.75635, 15.880676, 15.995769, 16.069274, 16.121329, 16.171488, 16.214262, 16.228274], 33, 1, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [1, 32], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1708], "op": "draft_cost_row", "out": [[1.0, 1.5104, 2.523, 4.5575], [0, 1, 3, 7], 4.5575, 1.1, 10.9809, 1.0]}, {"args": [0, 32, 64, [0.1630264, 0.3117998, 0.448201, 0.5761196, 0.6963298, 0.7691338, 0.8271596, 0.8545544, 0.8803286]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.1693124, 0.3143274, 0.4541354, 0.576097, 0.6775674, 0.7781572, 0.874378, 0.9360984, 0.9910494]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 32, 64, [0.1903792, 0.3270132, 0.4576008, 0.5832828, 0.6837126, 0.7394408, 0.787328, 0.8265236, 0.8645284]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 32, 64, [0.1825772, 0.333735, 0.3893926, 0.4412964, 0.4858086, 0.51798, 0.5255892, 0.5309698, 0.532865]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 31], "op": "verify_count", "out": 31}, {"args": [[0.869608, 1.707598, 2.543942, 3.370099, 4.193595, 5.015637, 5.830938, 6.63319, 7.402128, 8.161113, 8.908434, 9.562241, 10.158897, 10.739486, 11.307454, 11.851087, 12.345493, 12.829503, 13.293015, 13.755031, 14.202341, 14.646679, 15.078668, 15.468793, 15.822893, 16.161148, 16.485302, 16.776187, 16.960055, 17.113521, 17.264206, 17.397569, 17.406861], 33, 32, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [32, 16], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 874], "op": "draft_cost_row", "out": [[1.0, 1.1415, 1.4251, 1.9912], [0, 1, 3, 7], 1.9912, 1.3, 13.5912, 1.6184238729190978]}, {"args": [0, 4, 64, [0.725976, 1.450973, 2.144954, 2.511348, 2.86915, 3.172955, 3.45587, 3.598788, 3.680497]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.939936, 1.858492, 2.771868, 3.574917, 4.284192, 4.853467, 5.291459, 5.596224, 5.713606]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 4, 64, [0.934666, 1.829393, 2.228985, 2.624595, 2.990159, 3.353471, 3.715165, 4.032784, 4.281089]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 4, 64, [0.836376, 1.633459, 2.392407, 2.956211, 3.51899, 4.059552, 4.447132, 4.642092, 4.818684]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 4, 64, [0.966416, 1.847314, 2.651633, 3.302837, 3.8703, 4.414452, 4.930093, 5.211548, 5.233778]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 4, 64, [0.899072, 1.687135, 2.424195, 3.058323, 3.605139, 3.689839, 3.773885, 3.855557, 3.919614]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 4, 64, [0.765353, 1.530062, 2.275854, 2.924857, 3.446411, 3.840794, 4.086244, 4.306694, 4.450572]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 4, 64, [0.968271, 1.883248, 2.604183, 3.312324, 3.984711, 4.522051, 5.015713, 5.426319, 5.764132]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 4, 64, [0.957787, 1.846434, 2.699938, 3.533765, 4.359998, 5.165905, 5.832641, 6.472915, 6.996771]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 4, 64, [0.99101, 1.793264, 2.534496, 3.244582, 3.666193, 4.08665, 4.462172, 4.629828, 4.776017]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 4, 64, [0.96976, 1.745695, 2.393676, 2.818621, 3.127065, 3.41909, 3.623455, 3.738267, 3.797474]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 4, 64, [0.909295, 1.493361, 1.952121, 2.169485, 2.354025, 2.533458, 2.642134, 2.704479, 2.740853]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 31], "op": "verify_count", "out": 31}, {"args": [[0.957019, 1.871272, 2.758691, 3.57582, 4.333324, 4.92811, 5.476344, 6.023694, 6.503185, 6.84526, 7.15699, 7.438052, 7.698516, 7.922475, 8.107463, 8.279976], 16, 4, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [4, 16], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 906], "op": "draft_cost_row", "out": [[1.0, 1.2387, 1.7252, 2.6926], [0, 1, 3, 7], 2.6926, 1.3, 12.6779, 1.1638967008283887]}, {"args": [0, 8, 64, [0.1980492, 0.3875532, 0.5478366, 0.6793474, 0.7848646, 0.8880282, 0.9650236, 1.0199336, 1.029875]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.1593546, 0.3020122, 0.4232268, 0.517756, 0.592068, 0.6395908, 0.671049, 0.702431, 0.7046064]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 42], "op": "verify_count", "out": 42}, {"args": [[0.993119, 1.630085], 2, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 2114], "op": "draft_cost_row", "out": [[1.0, 1.1395, 1.4184, 1.9755], [0, 1, 3, 7], 1.9755, 1.3, 13.8838, 1.2292422927770792]}, {"args": [0, 4, 64, [0.916227, 1.53109, 2.102966, 2.454693, 2.658996, 2.837295, 2.98632, 3.114735, 3.167677]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.889654, 1.63825, 2.331942, 2.875351, 3.403299, 3.909267, 4.09703, 4.179889, 4.19892]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 4, 64, [0.963934, 1.910529, 2.691946, 3.374176, 3.868359, 4.30855, 4.721699, 4.914769, 4.951991]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 4, 64, [0.997268, 1.664929, 2.332076, 2.888467, 3.293928, 3.610026, 3.75058, 3.824925, 3.891965]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 4, 64, [0.863679, 1.648098, 2.394734, 3.106494, 3.782352, 4.257609, 4.702919, 4.996388, 5.118281]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 4, 64, [0.93745, 1.838983, 2.695048, 3.539556, 4.311377, 5.030606, 5.658378, 5.81051, 5.923835]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 4, 64, [0.954089, 1.709011, 2.458741, 3.014325, 3.390875, 3.700589, 3.889247, 3.998831, 4.085756]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 4, 64, [0.640326, 1.270719, 1.892439, 2.362258, 2.809115, 3.191553, 3.46536, 3.596799, 3.698664]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 4, 64, [0.987414, 1.691351, 2.154516, 2.588331, 2.781496, 2.960741, 3.061173, 3.097649, 3.130008]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 4, 64, [0.926897, 1.750154, 2.521356, 3.212677, 3.695421, 4.037076, 4.242529, 4.390503, 4.529557]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 4, 64, [0.985547, 1.906871, 2.695627, 3.422565, 4.045592, 4.658687, 5.188579, 5.506282, 5.751333]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 4, 64, [0.557203, 0.998437, 1.331192, 1.63797, 1.931447, 2.192161, 2.397044, 2.585804, 2.688467]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 21], "op": "verify_count", "out": 21}, {"args": [[0.902997, 1.45125, 1.951666, 2.304227], 4, 4, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 812], "op": "draft_cost_row", "out": [[1.0, 1.0767, 1.2291, 1.5368], [0, 1, 3, 7], 1.5368, 1.3, 14.1859, 1.2448904372855476]}, {"args": [0, 2, 64, [0.99836, 1.93427, 2.710884, 3.417707, 4.07715, 4.644519, 5.122404, 5.258679, 5.285387]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.882983, 1.755494, 2.485276, 2.937563, 3.355059, 3.688637, 3.954805, 4.193435, 4.285192]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 2, 64, [0.915091, 1.812053, 2.557774, 3.127098, 3.673248, 4.007951, 4.176486, 4.322125, 4.385712]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 2, 64, [0.93399, 1.745241, 2.503567, 3.188639, 3.786221, 4.149854, 4.512954, 4.67883, 4.682628]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 2, 64, [0.998855, 1.928747, 2.835192, 3.682553, 4.465268, 5.221373, 5.675725, 6.079115, 6.217366]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 2, 64, [0.763326, 1.40365, 2.01887, 2.546729, 2.958735, 3.364469, 3.523019, 3.641295, 3.674356]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 2, 64, [0.931707, 1.719215, 2.503192, 3.224821, 3.627999, 3.964241, 4.208373, 4.339847, 4.39332]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 2, 64, [0.913056, 1.809754, 2.698932, 3.263708, 3.76126, 4.16822, 4.513665, 4.795232, 4.897752]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 2, 64, [0.938937, 1.844369, 2.669484, 3.359767, 3.880443, 4.343946, 4.67431, 4.791679, 4.906306]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 2, 64, [0.907257, 1.696824, 2.313033, 2.746253, 3.166604, 3.543089, 3.865, 4.161045, 4.185258]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 2, 64, [0.97255, 1.855147, 2.732203, 3.605253, 4.449635, 4.925349, 5.169692, 5.412039, 5.517412]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 2, 64, [0.999277, 1.939519, 2.849465, 3.729218, 4.600686, 5.331483, 5.988327, 6.533308, 6.902079]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [2, 54], "op": "verify_count", "out": 54}, {"args": [[0.950975, 1.854389, 2.749515, 3.564961, 4.357319, 5.103941, 5.670745, 6.208335, 6.533099, 6.832366, 7.076297, 7.298076, 7.421872, 7.520435, 7.583069, 7.583646], 16, 2, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [2, 16], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 579], "op": "draft_cost_row", "out": [[1.0, 1.2412, 1.7333, 2.7112], [0, 1, 3, 7], 2.7112, 1.3, 12.4976, 1.0]}, {"args": [0, 8, 64, [0.0388332, 0.07766, 0.1122739, 0.1350176, 0.1512352, 0.1669244, 0.1822356, 0.1937753, 0.2009367]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.0449665, 0.088903, 0.1318619, 0.1748122, 0.2094383, 0.2252321, 0.2353667, 0.2383148, 0.2391167]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 26], "op": "verify_count", "out": 26}, {"args": [[0.937806, 1.838113, 2.718282, 3.587869, 4.313646, 5.026791, 5.722742, 6.167897, 6.480885, 6.788048, 7.011286, 7.202794, 7.337673, 7.443774, 7.522764, 7.572766], 16, 8, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [8, 16], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 805], "op": "draft_cost_row", "out": [[1.0, 1.5414, 2.6173, 4.7778], [0, 1, 3, 7], 4.7778, 1.1, 9.9136, 1.0]}, {"args": [0, 32, 64, [0.0442221, 0.0837466, 0.1169761, 0.1500766, 0.1795716, 0.1981974, 0.2099697, 0.2214194, 0.2304702]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0491514, 0.0954889, 0.1288405, 0.1608371, 0.187252, 0.2092691, 0.2243158, 0.2381575, 0.2426568]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 6], "op": "verify_count", "out": 6}, {"args": [[0.28454], 1, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1735], "op": "draft_cost_row", "out": [[1.0, 1.1397, 1.4196, 1.9783], [0, 1, 3, 7], 1.9783, 1.3, 13.818, 1.634395883848838]}, {"args": [0, 4, 64, [0.987737, 1.884768, 2.64045, 3.188554, 3.473708, 3.75281, 3.998709, 4.185069, 4.272234]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.929264, 1.679855, 2.324821, 2.880827, 3.380727, 3.842359, 4.22707, 4.406965, 4.440576]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 4, 64, [0.95153, 1.796928, 2.579923, 3.264183, 3.922446, 4.442968, 4.959703, 5.465332, 5.824955]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 4, 64, [0.791132, 1.577696, 2.357351, 3.13038, 3.738459, 4.178892, 4.414236, 4.588159, 4.753334]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 4, 64, [0.71472, 1.311548, 1.891638, 2.464279, 2.963241, 3.452359, 3.688297, 3.909533, 3.944866]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 4, 64, [0.87288, 1.671399, 2.167504, 2.609177, 3.043813, 3.306759, 3.486796, 3.638607, 3.656395]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 4, 64, [0.907306, 1.698914, 2.267811, 2.811049, 3.122059, 3.360034, 3.506266, 3.578801, 3.62112]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 4, 64, [0.820564, 1.441761, 2.030456, 2.555913, 2.870268, 3.134991, 3.389826, 3.561426, 3.649903]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 4, 64, [0.970536, 1.801462, 2.588166, 3.278833, 3.689463, 4.053884, 4.270229, 4.43004, 4.491182]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 4, 64, [0.986186, 1.747451, 2.492392, 2.98193, 3.43725, 3.67787, 3.822447, 3.864564, 3.903787]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 4, 64, [0.996122, 1.886209, 2.649487, 3.073926, 3.466847, 3.764914, 3.906462, 3.982949, 4.017217]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 4, 64, [0.932453, 1.666515, 2.218402, 2.67996, 3.043959, 3.381005, 3.634214, 3.875896, 4.105771]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 28], "op": "verify_count", "out": 28}, {"args": [[0.737432], 1, 4, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 727], "op": "draft_cost_row", "out": [[1.0, 1.3898, 2.1582, 3.7004], [0, 1, 3, 7], 3.7004, 1.1, 11.2559, 1.0803624275736743]}, {"args": [0, 16, 64, [0.1870876, 0.3590794, 0.5199098, 0.6785654, 0.7622578, 0.8380034, 0.8873012, 0.9299654, 0.9398152]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.1519198, 0.2772504, 0.3960278, 0.4940708, 0.5914916, 0.6875292, 0.7820426, 0.862087, 0.898407]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 50], "op": "verify_count", "out": 50}, {"args": [[0.975601, 1.930744, 2.867376, 3.790938, 4.71001, 5.617081, 6.499468, 7.367843, 8.233814, 9.042582, 9.813296, 10.578983, 11.304464, 12.027917, 12.74311, 13.455877, 14.162484, 14.851695, 15.522185, 16.188779, 16.854954, 17.485348, 18.080739, 18.646678, 19.190665, 19.709965, 20.134019, 20.539329, 20.933301, 21.32626, 21.712767, 22.097178, 22.459995, 22.821093, 23.18083, 23.525787, 23.851037, 24.17312, 24.4854, 24.783493, 25.075567, 25.355911, 25.63043, 25.899052, 26.161389, 26.42178, 26.66008, 26.886124, 27.10233, 27.318085, 27.522891, 27.70494, 27.858458, 28.009328, 28.156519, 28.292526, 28.375694, 28.4306, 28.471424, 28.512114, 28.543889, 28.568414, 28.588811, 28.607377], 8, 16, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1064], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2287, 1.5359], [0, 1, 3, 7], 1.5359, 1.3, 14.218, 1.4542930621310421]}, {"args": [0, 2, 64, [0.0018614, 0.0037123, 0.0053114, 0.0067181, 0.0077039, 0.0086838, 0.0092529, 0.0096961, 0.0099358]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.001815, 0.0034234, 0.00496, 0.0064456, 0.0078702, 0.0089111, 0.0098677, 0.0105691, 0.0109729]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 33], "op": "verify_count", "out": 33}, {"args": [[0.914561, 1.826981, 2.736669, 3.639201, 4.536898, 5.423956, 6.310038, 7.156834, 7.971996, 8.691189, 9.398477, 10.040796, 10.653609, 11.196469, 11.660435, 12.044848, 12.422023, 12.795294, 13.136734, 13.460277, 13.768799, 14.06879, 14.366102, 14.638105, 14.854657, 14.974997, 15.050531, 15.122802, 15.191143, 15.254771, 15.302448, 15.3378, 15.368829], 33, 2, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [2, 32], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1565], "op": "draft_cost_row", "out": [[1.0, 1.2342, 1.7123, 2.6622], [0, 1, 3, 7], 2.6622, 1.3, 12.9757, 1.0]}, {"args": [0, 8, 64, [0.1953956, 0.296811, 0.3688908, 0.4306124, 0.4763116, 0.5148022, 0.5447736, 0.5719434, 0.5795706]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.136035, 0.2660686, 0.375695, 0.4844574, 0.5831798, 0.6619608, 0.7098278, 0.7567378, 0.7569238]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 43], "op": "verify_count", "out": 43}, {"args": [[0.715945, 1.411331, 2.097884, 2.411242], 4, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 660], "op": "draft_cost_row", "out": [[1.0, 1.0767, 1.2292, 1.5371], [0, 1, 3, 7], 1.5371, 1.3, 14.1672, 1.2439298508511085]}, {"args": [0, 2, 64, [0.0080499, 0.0149425, 0.0216228, 0.0280853, 0.033069, 0.037217, 0.0408855, 0.0442161, 0.0471529]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.0098917, 0.019066, 0.0279222, 0.036697, 0.0448753, 0.0522505, 0.0593123, 0.0629345, 0.0660362]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 58], "op": "verify_count", "out": 58}, {"args": [[0.869828, 1.736119, 2.57883, 3.375284, 4.134544, 4.850494, 5.56622, 6.073669, 6.554368, 6.946643, 7.280483, 7.607345, 7.861241, 8.113057, 8.275626, 8.329068], 16, 2, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [2, 16], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 2325], "op": "draft_cost_row", "out": [[1.0, 1.0761, 1.2276, 1.5334], [0, 1, 3, 7], 1.5334, 1.3, 14.3383, 1.043899960102859]}, {"args": [0, 2, 64, [0.1480498, 0.2784498, 0.4066996, 0.5309366, 0.589328, 0.6431158, 0.6832876, 0.7154506, 0.740564]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.1947626, 0.3802662, 0.5384186, 0.6771848, 0.8103396, 0.9047066, 0.9589276, 1.012532, 1.0629276]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 2, 64, [0.1994688, 0.3736318, 0.509492, 0.6171866, 0.6945192, 0.7658118, 0.8045722, 0.8360332, 0.8637856]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 2, 64, [0.1809466, 0.3549084, 0.5260202, 0.6925742, 0.8529028, 0.9406606, 1.0215756, 1.0558216, 1.0692974]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 2, 64, [0.1443746, 0.2793662, 0.4092852, 0.5245636, 0.6062008, 0.6627388, 0.7074732, 0.7507918, 0.7791916]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 2, 64, [0.1793358, 0.3562216, 0.5323268, 0.7056594, 0.8724268, 0.9836634, 1.0721126, 1.158637, 1.189009]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 2, 64, [0.113767, 0.2255534, 0.3358488, 0.4158784, 0.480307, 0.5350618, 0.5891008, 0.6293208, 0.6455214]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 2, 64, [0.1983282, 0.3561406, 0.5082616, 0.6423126, 0.709572, 0.739895, 0.7678414, 0.7692674, 0.7700712]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 53], "op": "verify_count", "out": 53}, {"args": [[0.994293, 1.980234, 2.939498, 3.889877, 4.828758, 5.738397, 6.643544, 7.508141, 8.341859, 9.169519, 9.980277, 10.79039, 11.597396, 12.400476, 13.192765, 13.960472, 14.714036, 15.457233, 16.198866, 16.934269, 17.659236, 18.364498, 19.044719, 19.701686, 20.358573, 20.996601, 21.619635, 22.196446, 22.747, 23.293238, 23.820491, 24.334736, 24.777937, 25.180202, 25.579473, 25.975411, 26.363811, 26.73313, 27.097812, 27.456739, 27.81079, 28.145592, 28.467218, 28.777226, 29.056441, 29.333548, 29.58404, 29.811271, 30.022609, 30.23275, 30.410045, 30.585893, 30.75474, 30.89768, 31.016457, 31.122279, 31.223118, 31.317268, 31.391925, 31.449569, 31.476349, 31.499844, 31.510872, 31.521345], 8, 2, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 747], "op": "draft_cost_row", "out": [[1.0, 1.1419, 1.4259, 1.9932], [0, 1, 3, 7], 1.9932, 1.3, 13.5583, 1.0100556345226068]}, {"args": [0, 4, 64, [0.190124, 0.3580964, 0.5103946, 0.5903398, 0.6252524, 0.6442, 0.6546424, 0.6590408, 0.6632028]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.1877386, 0.365293, 0.5213762, 0.6391912, 0.7549496, 0.854808, 0.949477, 1.0137832, 1.0270842]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 4, 64, [0.1841786, 0.3604716, 0.5229882, 0.6785242, 0.8245648, 0.9295824, 1.0076034, 1.0215934, 1.0236092]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 4, 64, [0.1938702, 0.3760816, 0.5189836, 0.651483, 0.7747734, 0.8626664, 0.947465, 1.0163826, 1.027443]], "op": "tree_width", "out": [4, 64, true]}, {"args": [4, 15], "op": "verify_count", "out": 15}, {"args": [[0.689838], 1, 4, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1787], "op": "draft_cost_row", "out": [[1.0, 1.2333, 1.7095, 2.6559], [0, 1, 3, 7], 2.6559, 1.3, 13.0321, 1.1835850581706886]}, {"args": [0, 8, 64, [0.1254664, 0.2455994, 0.360152, 0.4631984, 0.5525614, 0.6364352, 0.713364, 0.7593694, 0.7658108]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.1985744, 0.3848964, 0.5324948, 0.679845, 0.7987592, 0.9174324, 1.011169, 1.073762, 1.1041478]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 52], "op": "verify_count", "out": 52}, {"args": [[0.12669], 1, 8, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 455], "op": "draft_cost_row", "out": [[1.0, 1.242, 1.7358, 2.7174], [0, 1, 3, 7], 2.7174, 1.3, 12.4314, 1.1499411064585554]}, {"args": [0, 8, 64, [0.0092392, 0.0171385, 0.0197533, 0.0222711, 0.0241404, 0.0259895, 0.027413, 0.0285583, 0.0296002]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.0096173, 0.014794, 0.0196846, 0.023953, 0.0274407, 0.030865, 0.0329392, 0.033322, 0.0334655]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 31], "op": "verify_count", "out": 31}, {"args": [[0.994838, 1.9827, 2.924355, 3.865385, 4.771075, 5.672868, 6.549433, 7.414284, 8.269333, 9.118532, 9.95241, 10.772559, 11.572528, 12.369289, 13.156417, 13.92722, 14.663476, 15.391132, 16.094754, 16.789608, 17.483363, 18.175018, 18.843417, 19.474646, 20.104354, 20.733564, 21.350619, 21.960642, 22.563715, 23.112998, 23.619485, 24.110238, 24.576699, 25.033492, 25.464259, 25.888981, 26.297973, 26.706235, 27.094867, 27.460718, 27.821042, 28.17858, 28.524934, 28.870721, 29.210299, 29.525629, 29.835898, 30.11443, 30.356235, 30.562973, 30.760037, 30.956193, 31.137897, 31.31857, 31.470339, 31.61661, 31.745714, 31.873744, 31.991149, 32.107173, 32.207512, 32.279396, 32.3162, 32.331568], 1, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 2018], "op": "draft_cost_row", "out": [[1.0, 1.0761, 1.2276, 1.5334], [0, 1, 3, 7], 1.5334, 1.3, 14.3383, 1.2526799521234306]}, {"args": [0, 2, 64, [0.952014, 1.828801, 2.47715, 2.954627, 3.18026, 3.378986, 3.502167, 3.619727, 3.697891]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.661724, 1.320222, 1.959881, 2.544172, 2.958209, 3.325268, 3.658561, 3.926207, 4.146588]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 2, 64, [0.866232, 1.476835, 2.070136, 2.45823, 2.833063, 3.111384, 3.213453, 3.228581, 3.24127]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 2, 64, [0.880105, 1.670198, 2.439229, 3.096666, 3.549792, 3.759027, 3.863387, 3.893653, 3.909807]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 2, 64, [0.989888, 1.863013, 2.6787, 3.376004, 4.043976, 4.634201, 4.804616, 4.96032, 5.032861]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 2, 64, [0.789945, 1.441865, 1.947619, 2.427256, 2.860625, 3.090579, 3.312826, 3.373734, 3.394723]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 2, 64, [0.99975, 1.931808, 2.722055, 3.378242, 3.962537, 4.503898, 5.021754, 5.131768, 5.189266]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 2, 64, [0.958341, 1.788706, 2.583334, 3.369667, 4.065579, 4.581143, 5.078487, 5.174404, 5.178011]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 2, 64, [0.969889, 1.876012, 2.760029, 3.42339, 3.897146, 4.330286, 4.701202, 5.067383, 5.223186]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 2, 64, [0.998909, 1.973316, 2.855369, 3.68765, 4.463879, 5.024962, 5.437906, 5.546799, 5.641068]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 2, 64, [0.662693, 1.253475, 1.81749, 2.327197, 2.67996, 2.988421, 3.234322, 3.472187, 3.539926]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 2, 64, [0.989788, 1.888344, 2.698019, 3.28689, 3.790652, 4.257021, 4.427215, 4.564869, 4.669374]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [2, 19], "op": "verify_count", "out": 19}, {"args": [[0.966206, 1.929974, 2.793821, 3.612256, 4.346693, 5.059302, 5.671506, 6.202581, 6.615959, 7.022402, 7.323159, 7.479712, 7.633459, 7.743714, 7.772252, 7.782959], 16, 2, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [2, 16], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 189], "op": "draft_cost_row", "out": [[1.0, 1.567, 2.6932, 4.9552], [0, 1, 3, 7], 4.9552, 1.1, 9.0611, 1.0]}, {"args": [0, 32, 64, [0.1837646, 0.3611014, 0.4919062, 0.589705, 0.6729326, 0.73869, 0.7908552, 0.8132048, 0.828875]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.1892896, 0.3700622, 0.5179274, 0.6315098, 0.731699, 0.8105884, 0.8841602, 0.9440296, 0.995686]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 55], "op": "verify_count", "out": 55}, {"args": [[0.999725, 1.963058, 2.914035, 3.857763, 4.713545, 5.553627, 6.377421, 7.196071, 8.003764, 8.766422, 9.524882, 10.258017, 10.975706, 11.688825, 12.382621, 13.070196, 13.753053, 14.428092, 15.07681, 15.72402, 16.341016, 16.934304, 17.523769, 18.095975, 18.64283, 19.173919, 19.700775, 20.220648, 20.710978, 21.190146, 21.586831, 21.982041, 22.364211, 22.737636, 23.110991, 23.47059, 23.82781, 24.172487, 24.512536, 24.846404, 25.169102, 25.480258, 25.765742, 26.048123, 26.298439, 26.544736, 26.770039, 26.983343, 27.194856, 27.40465, 27.588354, 27.75161, 27.907508, 28.056879, 28.195384, 28.313289, 28.430089, 28.535013, 28.632268, 28.72205, 28.805845, 28.861893, 28.89443, 28.926832], 64, 32, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [32, 32], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 308], "op": "draft_cost_row", "out": [[1.0, 1.1426, 1.4282, 1.9985], [0, 1, 3, 7], 1.9985, 1.3, 13.4589, 1.6090068711165042]}, {"args": [0, 4, 64, [0.007814, 0.0153296, 0.0226765, 0.0271532, 0.0315584, 0.0359272, 0.0397056, 0.0429048, 0.0440846]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.0095386, 0.0178788, 0.0245413, 0.0300224, 0.033123, 0.0343069, 0.0354655, 0.0365979, 0.0373124]], "op": "tree_width", "out": [4, 64, true]}, {"args": [4, 15], "op": "verify_count", "out": 15}, {"args": [[0.993418, 1.964247, 2.911675, 3.842142, 4.763847, 5.671918, 6.568519, 7.423452, 8.246699, 9.049654, 9.852339, 10.651013, 11.423974, 12.194852, 12.898689, 13.601594, 14.285337, 14.964772, 15.616168, 16.248552, 16.868493, 17.4573, 18.006843, 18.537857, 19.049377, 19.549997, 20.044427, 20.534649, 21.024223, 21.513732, 21.995451, 22.457729, 22.910521, 23.357229, 23.793973, 24.207735, 24.618553, 25.026157, 25.422499, 25.809224, 26.186229, 26.543023, 26.894967, 27.245849, 27.569993, 27.894066, 28.196312, 28.470342, 28.725146, 28.968376, 29.181724, 29.382015, 29.568239, 29.747953, 29.907537, 30.062611, 30.212878, 30.360712, 30.5007, 30.618242, 30.708651, 30.773894, 30.819016, 30.833752], 64, 4, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [4, 64], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 640], "op": "draft_cost_row", "out": [[1.0, 1.0767, 1.2292, 1.5371], [0, 1, 3, 7], 1.5371, 1.3, 14.1672, 1.2439298508511085]}, {"args": [0, 2, 64, [0.0099605, 0.019821, 0.0284326, 0.0358084, 0.0394954, 0.0429372, 0.0448383, 0.0465223, 0.0481533]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.0098198, 0.0181267, 0.0261958, 0.0340715, 0.0401537, 0.0437338, 0.0469784, 0.0480826, 0.049172]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 23], "op": "verify_count", "out": 23}, {"args": [[0.94343, 1.765346, 2.56557, 3.359191, 4.026961, 4.587754, 5.132184, 5.521847, 5.808321, 6.07094, 6.233708, 6.385883, 6.516785, 6.606121, 6.681876, 6.710877], 16, 2, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [2, 16], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1065], "op": "draft_cost_row", "out": [[1.0, 1.5314, 2.5883, 4.7102], [0, 1, 3, 7], 4.7102, 1.1, 10.2204, 1.0]}, {"args": [0, 32, 64, [0.0471815, 0.094014, 0.1333781, 0.1698398, 0.1924813, 0.2110052, 0.2291393, 0.2408107, 0.2435273]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0474936, 0.0945182, 0.1273755, 0.1556765, 0.1809587, 0.1983967, 0.2100061, 0.215519, 0.2191085]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 1], "op": "verify_count", "out": 1}, {"args": [[0.961114], 1, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1505], "op": "draft_cost_row", "out": [[1.0, 1.0764, 1.2283, 1.5348], [0, 1, 3, 7], 1.5348, 1.3, 14.2691, 1.6655354240409]}, {"args": [0, 2, 64, [0.0487115, 0.0961715, 0.1412718, 0.1745105, 0.1951753, 0.212856, 0.220005, 0.2270472, 0.2340836]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.048732, 0.0949962, 0.1409838, 0.1757144, 0.209687, 0.2403132, 0.2674301, 0.2892689, 0.2935719]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 14], "op": "verify_count", "out": 14}, {"args": [[0.972541, 1.533993, 2.091566, 2.578517, 2.914146, 3.214362, 3.349257, 3.427951], 8, 2, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1117], "op": "draft_cost_row", "out": [[1.0, 1.5314, 2.5883, 4.7102], [0, 1, 3, 7], 4.7102, 1.1, 10.2204, 1.0]}, {"args": [0, 32, 64, [0.0097602, 0.0192597, 0.0286094, 0.0378628, 0.0464491, 0.0533063, 0.0592128, 0.0641097, 0.0643115]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0095947, 0.0189272, 0.0276177, 0.0337491, 0.0398766, 0.045069, 0.0461864, 0.0470504, 0.0473689]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 4], "op": "verify_count", "out": 4}, {"args": [[0.807807, 1.601974, 2.35935, 3.047823, 3.627898, 4.147665, 4.215573, 4.216254], 8, 32, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [32, 4], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 951], "op": "draft_cost_row", "out": [[1.0, 1.2387, 1.7252, 2.6926], [0, 1, 3, 7], 2.6926, 1.3, 12.6779, 1.5518622677711849]}, {"args": [0, 8, 64, [0.1797036, 0.3242784, 0.428507, 0.5069012, 0.5808396, 0.650955, 0.6993194, 0.7431842, 0.752747]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.1862026, 0.369954, 0.5002678, 0.590539, 0.6733784, 0.7437574, 0.787946, 0.8302332, 0.870395]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 24], "op": "verify_count", "out": 24}, {"args": [[0.610244, 1.205763], 2, 8, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1045], "op": "draft_cost_row", "out": [[1.0, 1.3826, 2.1369, 3.6505], [0, 1, 3, 7], 3.6505, 1.1, 11.5678, 1.0993290631592953]}, {"args": [0, 16, 64, [0.877007, 1.667324, 2.393765, 3.067893, 3.607977, 3.93756, 4.239052, 4.471268, 4.65579]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.989803, 1.900807, 2.664277, 3.07864, 3.449375, 3.805835, 4.05028, 4.268118, 4.346692]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 16, 64, [0.990453, 1.780884, 2.570503, 3.352806, 3.739976, 4.119449, 4.457606, 4.744674, 4.88023]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 16, 64, [0.91453, 1.732868, 2.474372, 3.06767, 3.566642, 4.042497, 4.422897, 4.488003, 4.501842]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 16, 64, [0.96049, 1.89197, 2.822703, 3.700836, 4.415362, 4.757276, 4.962862, 5.106329, 5.248087]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 16, 64, [0.949262, 1.894864, 2.777394, 3.503863, 4.182075, 4.635825, 5.008138, 5.200803, 5.336501]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 16, 64, [0.938879, 1.286406, 1.593366, 1.86637, 2.051205, 2.234046, 2.354189, 2.425844, 2.475093]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 16, 64, [0.947127, 1.709403, 2.277107, 2.817425, 3.34433, 3.871068, 4.094009, 4.216791, 4.298276]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 16, 64, [0.924189, 1.684868, 2.253304, 2.7571, 3.087516, 3.396924, 3.691353, 3.851686, 3.928378]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 16, 64, [0.977908, 1.950486, 2.894551, 3.740557, 4.533353, 5.136457, 5.601502, 6.061254, 6.252046]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 16, 64, [0.762702, 1.499089, 1.899621, 2.111216, 2.28425, 2.447081, 2.498973, 2.523404, 2.543015]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 16, 64, [0.799161, 1.45196, 1.951136, 2.416229, 2.72054, 2.940277, 3.122841, 3.164385, 3.179568]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 34], "op": "verify_count", "out": 34}, {"args": [[0.984549, 1.954674, 2.902147, 3.848031, 4.783884, 5.706448, 6.620152, 7.522981, 8.406868, 9.288853, 10.141831, 10.982977, 11.812039, 12.611976, 13.409928, 14.133321, 14.820626, 15.461923, 16.09381, 16.717719, 17.301349, 17.882321, 18.456526, 19.015858, 19.571031, 20.111152, 20.625356, 21.134208, 21.638159, 22.141183, 22.638685, 23.135909, 23.632409, 24.122284, 24.60449, 25.086282, 25.559214, 26.02147, 26.481811, 26.924546, 27.35074, 27.767702, 28.146645, 28.516019, 28.872594, 29.219699, 29.552133, 29.869235, 30.15985, 30.448503, 30.732546, 31.012669, 31.281745, 31.536393, 31.77151, 32.005988, 32.23933, 32.410291, 32.572908, 32.730521, 32.827456, 32.917394, 33.002019, 33.003666], 64, 16, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [16, 32], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 805], "op": "draft_cost_row", "out": [[1.0, 1.1415, 1.4251, 1.9912], [0, 1, 3, 7], 1.9912, 1.3, 13.5912, 1.4161208888042107]}, {"args": [0, 4, 64, [0.0072928, 0.0141888, 0.0208683, 0.0253292, 0.0283171, 0.031294, 0.0340287, 0.0364969, 0.0377763]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.0095616, 0.0183715, 0.0264585, 0.033602, 0.0401812, 0.0449381, 0.0496472, 0.0508236, 0.0512655]], "op": "tree_width", "out": [4, 64, true]}, {"args": [4, 52], "op": "verify_count", "out": 52}, {"args": [[0.979215, 1.955549, 2.879953, 3.763544, 4.538393, 5.290236, 6.039326, 6.750373, 7.458517, 8.127641, 8.776645, 9.394959, 10.005328, 10.505231, 10.998972, 11.46574, 11.901926, 12.333226, 12.740791, 13.135273, 13.525215, 13.813269, 14.077714, 14.33917, 14.598849, 14.853076, 15.083916, 15.308889, 15.468653, 15.62195, 15.739639, 15.778708, 15.781215], 33, 4, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [4, 32], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 768], "op": "draft_cost_row", "out": [[1.0, 1.5414, 2.6173, 4.7778], [0, 1, 3, 7], 4.7778, 1.1, 9.9136, 1.0]}, {"args": [0, 32, 64, [0.0019041, 0.0037885, 0.0056427, 0.0074658, 0.0088383, 0.010134, 0.0113727, 0.0120339, 0.012615]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0019251, 0.0036501, 0.0051984, 0.0062693, 0.0073144, 0.0082901, 0.0089567, 0.0095153, 0.0095861]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 61], "op": "verify_count", "out": 61}, {"args": [[0.997334, 1.956399, 2.911087, 3.860001, 4.79836, 5.700913, 6.589361, 7.356312, 8.122384, 8.884804, 9.629051, 10.355834, 11.075478, 11.78598, 12.491953, 13.186431, 13.872067, 14.553383, 15.203032, 15.850758, 16.491923, 17.13153, 17.747197, 18.327979, 18.901156, 19.456236, 20.007522, 20.54872, 21.076441, 21.603354, 22.078203, 22.552111, 23.025776, 23.482409, 23.920013, 24.352997, 24.785465, 25.211067, 25.62547, 26.03224, 26.435262, 26.790573, 27.118075, 27.437365, 27.709938, 27.97936, 28.230533, 28.480315, 28.721639, 28.957023, 29.15626, 29.345632, 29.495952, 29.624523, 29.752369, 29.87432, 29.980897, 30.05194, 30.121907, 30.178867, 30.234954, 30.289702, 30.341872, 30.388282], 64, 32, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [32, 32], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1570], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2782], [0, 1, 3, 7], 1.2782, 1.3, 14.5832, 1.6867380693515928]}, {"args": [0, 1, 64, [0.0019734, 0.0038256, 0.0055731, 0.0070591, 0.0085421, 0.010003, 0.0112411, 0.0117315, 0.0121474]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.0017395, 0.0034101, 0.0048884, 0.0063304, 0.0076065, 0.0087604, 0.0094318, 0.009815, 0.0098589]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 5], "op": "verify_count", "out": 5}, {"args": [[0.993672, 1.980748, 2.960705, 3.937088, 4.887433, 5.837211, 6.749959, 7.647956, 8.52751, 9.364842, 10.186121, 10.971824, 11.752477, 12.525228, 13.295597, 14.061979, 14.82368, 15.570323, 16.311258, 17.037837, 17.761841, 18.473966, 19.18564, 19.890857, 20.562025, 21.230814, 21.886584, 22.539992, 23.163831, 23.777356, 24.367705, 24.950686, 25.529602, 26.090892, 26.635198, 27.174348, 27.647899, 28.103027, 28.55769, 29.010718, 29.4591, 29.895952, 30.33106, 30.747194, 31.158336, 31.559774, 31.958126, 32.349377, 32.725373, 33.091167, 33.432864, 33.757631, 34.073174, 34.376886, 34.673143, 34.947584, 35.207057, 35.458623, 35.684612, 35.905515, 36.10215, 36.238635, 36.298415, 36.315147], 64, 1, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [1, 64], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1406], "op": "draft_cost_row", "out": [[1.0, 1.3776, 2.1228, 3.6181], [0, 1, 3, 7], 3.6181, 1.1, 11.7759, 1.0]}, {"args": [0, 16, 64, [0.967189, 1.920411, 2.842869, 3.749034, 4.542444, 5.218452, 5.712902, 6.200222, 6.527259]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.557219, 1.020054, 1.459696, 1.892292, 2.182526, 2.280626, 2.332451, 2.380655, 2.403203]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 16, 64, [0.705341, 1.283676, 1.82961, 2.343261, 2.706706, 2.922723, 3.090912, 3.237383, 3.24643]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 16, 64, [0.834394, 1.622676, 2.249054, 2.860366, 3.399866, 3.804456, 4.202271, 4.408896, 4.434327]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 16, 64, [0.91054, 1.576094, 2.2131, 2.795516, 3.086742, 3.278042, 3.335592, 3.362321, 3.383231]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 16, 64, [0.904385, 1.750144, 2.561681, 3.26296, 3.887637, 4.249951, 4.580599, 4.902209, 4.929854]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 16, 64, [0.917421, 1.705595, 2.353015, 2.954985, 3.503767, 4.00903, 4.368168, 4.687662, 4.969084]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 16, 64, [0.921722, 1.808443, 2.596407, 3.360217, 3.964826, 4.557477, 5.030594, 5.212895, 5.388516]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 16, 64, [0.854045, 1.704159, 2.474027, 3.142846, 3.635788, 4.114899, 4.463079, 4.781585, 4.840701]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 16, 64, [0.94106, 1.707715, 2.469403, 3.214888, 3.8952, 4.488703, 4.980585, 5.304642, 5.329064]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 16, 64, [0.908908, 1.701922, 2.316504, 2.870222, 3.403509, 3.821127, 4.207685, 4.360366, 4.404152]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 16, 64, [0.923821, 1.703329, 2.381983, 2.681708, 2.931361, 3.152406, 3.206122, 3.226651, 3.230138]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 2], "op": "verify_count", "out": 2}, {"args": [[0.993282, 1.98465, 2.974999, 3.946, 4.885347, 5.80234, 6.694929, 7.582015, 8.462457, 9.331072, 10.193044, 11.039067, 11.875189, 12.710627, 13.507, 14.295583, 15.057941, 15.811987, 16.556531, 17.248913, 17.940622, 18.624281, 19.283699, 19.92321, 20.545849, 21.166209, 21.758235, 22.350128, 22.932521, 23.494929, 24.047798, 24.591308, 25.124356, 25.653272, 26.170081, 26.684896, 27.196673, 27.700807, 28.201281, 28.670362, 29.138969, 29.593596, 30.029107, 30.442268, 30.839671, 31.229675, 31.61919, 31.931077, 32.240911, 32.541949, 32.827474, 33.096144, 33.34307, 33.56704, 33.758297, 33.931505, 34.079768, 34.192739, 34.303369, 34.37892, 34.453304, 34.485159, 34.507373, 34.520762], 1, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 993], "op": "draft_cost_row", "out": [[1.0, 1.2387, 1.7252, 2.6926], [0, 1, 3, 7], 2.6926, 1.3, 12.6779, 1.3578794842997868]}, {"args": [0, 8, 64, [0.1313382, 0.2576528, 0.3732048, 0.4819194, 0.5713132, 0.638666, 0.682669, 0.7260272, 0.7295966]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.191562, 0.34394, 0.4713054, 0.5830574, 0.6498314, 0.702283, 0.745151, 0.7654134, 0.779969]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 29], "op": "verify_count", "out": 29}, {"args": [[0.982875, 1.962619, 2.930958, 3.889013, 4.824338, 5.74185, 6.656557, 7.521266, 8.365865, 9.193804, 10.017452, 10.815324, 11.581149, 12.305768, 13.023157, 13.738137, 14.438654, 15.113119, 15.7828, 16.417923, 17.045782, 17.660955, 18.253452, 18.818531, 19.381707, 19.912667, 20.412898, 20.912599, 21.407702, 21.90117, 22.393186, 22.866786, 23.25085, 23.633967, 24.016816, 24.388068, 24.718091, 25.039396, 25.329312, 25.608205, 25.867534, 26.119826, 26.359756, 26.598631, 26.835812, 27.037578, 27.227239, 27.416732, 27.603205, 27.788472, 27.972906, 28.153275, 28.316786, 28.465119, 28.605627, 28.683747, 28.749646, 28.808527, 28.857276, 28.900998, 28.935214, 28.96867, 28.998586, 29.026511], 64, 8, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [8, 64], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 924], "op": "draft_cost_row", "out": [[1.0, 1.2387, 1.7252, 2.6926], [0, 1, 3, 7], 2.6926, 1.3, 12.6779, 1.1638967008283887]}, {"args": [0, 8, 64, [0.1650558, 0.3172608, 0.4664218, 0.6108982, 0.7348232, 0.7672864, 0.796832, 0.8071564, 0.8146646]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.1832628, 0.3586524, 0.5279284, 0.6482448, 0.7244398, 0.7417402, 0.7510734, 0.7585486, 0.7642272]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 15], "op": "verify_count", "out": 15}, {"args": [[0.450304, 0.887286], 2, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 2140], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.2663819680609771]}, {"args": [0, 1, 64, [0.0082648, 0.0161811, 0.0236516, 0.0277493, 0.031531, 0.0346053, 0.0355692, 0.0362756, 0.0363316]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.0098765, 0.0192298, 0.0277474, 0.0358122, 0.0436996, 0.0479277, 0.0508247, 0.0536843, 0.0539653]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 17], "op": "verify_count", "out": 17}, {"args": [[0.996893, 1.952109, 2.876676, 3.795974, 4.685347, 5.565881, 6.431025, 7.293489, 8.094798, 8.871858, 9.605382, 10.338901, 11.026525, 11.710486, 12.387156, 13.05941, 13.727304, 14.382805, 15.035877, 15.678746, 16.320098, 16.94818, 17.575419, 18.183153, 18.788747, 19.379369, 19.958144, 20.535063, 21.106974, 21.66447, 22.20674, 22.713811, 23.219958, 23.716645, 24.199946, 24.674126, 25.143235, 25.606163, 26.040487, 26.471732, 26.886848, 27.276189, 27.65651, 27.998273, 28.295235, 28.572606, 28.842192, 29.110127, 29.373935, 29.636742, 29.896368, 30.148079, 30.392528, 30.62668, 30.835191, 31.022221, 31.200135, 31.320848, 31.435994, 31.54368, 31.642921, 31.732799, 31.762984, 31.790019], 2, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1302], "op": "draft_cost_row", "out": [[1.0, 1.1404, 1.422, 1.9839], [0, 1, 3, 7], 1.9839, 1.3, 13.7238, 1.0]}, {"args": [0, 4, 64, [0.966757, 1.749564, 2.491219, 3.176732, 3.63971, 4.037183, 4.349921, 4.552925, 4.704891]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.967977, 1.698683, 2.373207, 2.989791, 3.562129, 3.976114, 4.159374, 4.32146, 4.356787]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 4, 64, [0.85617, 1.680648, 2.364426, 2.912243, 3.371649, 3.743806, 3.842165, 3.900425, 3.936186]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 4, 64, [0.641602, 1.173149, 1.40251, 1.56413, 1.692227, 1.805188, 1.869077, 1.898873, 1.924476]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 4, 64, [0.883999, 1.708178, 2.436697, 3.107912, 3.711336, 4.293394, 4.8475, 5.191904, 5.31224]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 4, 64, [0.97488, 1.837956, 2.612334, 3.289535, 3.922371, 4.398801, 4.867214, 5.154208, 5.164972]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 4, 64, [0.990533, 1.672572, 2.279515, 2.881036, 3.391451, 3.900911, 4.164293, 4.295835, 4.354603]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 4, 64, [0.920596, 1.724589, 2.51732, 3.023053, 3.507012, 3.962696, 4.360681, 4.755203, 5.045276]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 4, 64, [0.999632, 1.677547, 2.157317, 2.556955, 2.914305, 3.064968, 3.214108, 3.293543, 3.339898]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 4, 64, [0.888346, 1.651956, 2.254027, 2.698526, 3.121872, 3.489737, 3.784835, 3.99807, 4.009461]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 4, 64, [0.8904, 1.7762, 2.525325, 3.20044, 3.683379, 3.89722, 4.033256, 4.165538, 4.229946]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 4, 64, [0.935502, 1.715722, 2.320765, 2.766664, 3.101864, 3.24578, 3.354918, 3.405825, 3.443002]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 43], "op": "verify_count", "out": 43}, {"args": [[0.957734, 1.868969, 2.697477, 3.471924, 3.966684, 4.384586, 4.691448, 4.869938], 8, 4, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 645], "op": "draft_cost_row", "out": [[1.0, 1.2403, 1.7304, 2.7047], [0, 1, 3, 7], 2.7047, 1.3, 12.5548, 1.1569538132625603]}, {"args": [0, 8, 64, [0.1806968, 0.3396796, 0.4844708, 0.6080808, 0.717351, 0.8181676, 0.8822398, 0.9102262, 0.918375]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.1900072, 0.362993, 0.5148608, 0.6636082, 0.7739928, 0.8413344, 0.904823, 0.9545844, 0.988272]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 54], "op": "verify_count", "out": 54}, {"args": [[0.974611, 1.944292, 2.865584, 3.757609, 4.635293, 5.511767, 6.358551, 7.202173, 8.028553, 8.831118, 9.630854, 10.429349, 11.199254, 11.958351, 12.687455, 13.415033, 14.117697, 14.793924, 15.442273, 16.089544, 16.734015, 17.37667, 18.015459, 18.653651, 19.26692, 19.875297, 20.480825, 21.078741, 21.575038, 22.048457, 22.512009, 22.936549, 23.347128, 23.753854, 24.139918, 24.518239, 24.8926, 25.261536, 25.627676, 25.992228, 26.34503, 26.697535, 27.049523, 27.375644, 27.691014, 27.993734, 28.284477, 28.562689, 28.817302, 29.068539, 29.294422, 29.496076, 29.687588, 29.863614, 30.03317, 30.175373, 30.304008, 30.423914, 30.542144, 30.65918, 30.759823, 30.855464, 30.939425, 30.969613], 64, 8, 700, false], "op": "verify_paged", "out": [64, false]}, {"args": [8, 64], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 339], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.4968, 1.260708239604833]}, {"args": [0, 1, 64, [0.554055, 1.070273, 1.558112, 2.025485, 2.46381, 2.782418, 3.040248, 3.282421, 3.415711]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.756905, 1.440911, 2.097125, 2.726616, 3.348752, 3.852658, 4.194448, 4.370706, 4.494134]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 1, 64, [0.616888, 1.070449, 1.387423, 1.686615, 1.982592, 2.277219, 2.455953, 2.534254, 2.570056]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 1, 64, [0.895513, 1.766829, 2.57268, 3.317623, 3.925641, 4.444728, 4.757385, 4.890182, 5.009707]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 1, 64, [0.962297, 1.823881, 2.645333, 3.463449, 4.241592, 5.006573, 5.752068, 6.196895, 6.310758]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 1, 64, [0.628423, 1.23823, 1.81233, 2.304699, 2.723456, 3.057792, 3.22672, 3.366854, 3.470404]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 1, 64, [0.904841, 1.663414, 2.33064, 2.978674, 3.356888, 3.704901, 4.033307, 4.244964, 4.42683]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 1, 64, [0.654289, 1.250672, 1.817676, 2.365525, 2.904813, 3.370626, 3.798627, 3.858088, 3.899716]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 1, 64, [0.961154, 1.664119, 2.324381, 2.975508, 3.602129, 4.091853, 4.567932, 5.008059, 5.22173]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 1, 64, [0.911065, 1.783575, 2.429441, 3.015165, 3.509679, 3.937232, 4.302756, 4.393599, 4.398806]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 1, 64, [0.960145, 1.868236, 2.715114, 3.55778, 4.095406, 4.443363, 4.728073, 4.818893, 4.846162]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 1, 64, [0.971673, 1.922985, 2.798927, 3.592745, 4.369871, 5.067589, 5.593398, 6.099082, 6.253154]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 46], "op": "verify_count", "out": 46}, {"args": [[0.894969], 1, 1, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 920], "op": "draft_cost_row", "out": [[1.0, 1.5367, 2.6028, 4.744], [0, 1, 3, 7], 4.744, 1.1, 10.0796, 1.0]}, {"args": [0, 32, 64, [0.041954, 0.0714725, 0.0905573, 0.1089918, 0.1248283, 0.1403846, 0.1492022, 0.1560565, 0.1575664]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0395383, 0.0778047, 0.114004, 0.1297735, 0.1413134, 0.1507604, 0.1560243, 0.1601954, 0.1609534]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 32, 64, [0.0405243, 0.0802037, 0.1186482, 0.1554901, 0.1790756, 0.2016708, 0.2194255, 0.2345686, 0.2476546]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 32, 64, [0.0495732, 0.0975315, 0.1444316, 0.1904315, 0.230664, 0.2607138, 0.2707417, 0.2792986, 0.2853601]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 39], "op": "verify_count", "out": 39}, {"args": [[0.942591, 1.850834, 2.748676, 3.642549, 4.521494, 5.38691, 6.244998, 7.080687, 7.900296, 8.719427, 9.511755, 10.297097, 11.04913, 11.800353, 12.531628, 13.257508, 13.931887, 14.605815, 15.222048, 15.820416, 16.415509, 16.994546, 17.55957, 18.11604, 18.662326, 19.195716, 19.721373, 20.24662, 20.756505, 21.259648, 21.752923, 22.244363, 22.725036, 23.186616, 23.630363, 24.049153, 24.461502, 24.861393, 25.2391, 25.599375, 25.943133, 26.283585, 26.619294, 26.917299, 27.213878, 27.506327, 27.797244, 28.082903, 28.352873, 28.598367, 28.825829, 29.029668, 29.144585, 29.246029, 29.317325, 29.380358, 29.43245, 29.484211, 29.535068, 29.5857, 29.615233, 29.639305, 29.658858, 29.675682], 8, 32, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [32, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1946], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.6885092907479695]}, {"args": [0, 1, 64, [0.0094839, 0.0170228, 0.0243768, 0.0300071, 0.034898, 0.0386517, 0.0417221, 0.0433683, 0.0448117]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.0088336, 0.0176224, 0.0253951, 0.032729, 0.0398224, 0.0425736, 0.0448199, 0.0456294, 0.0456997]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 8], "op": "verify_count", "out": 8}, {"args": [[0.934623, 1.819963, 2.492254, 3.020088, 3.499612, 3.972398, 4.418024, 4.853208, 5.263518, 5.601692, 5.935209, 6.208608, 6.332699, 6.442497, 6.546834, 6.580343], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1276], "op": "draft_cost_row", "out": [[1.0, 1.3803, 2.1298, 3.6347], [0, 1, 3, 7], 3.6347, 1.1, 11.6704, 1.0]}, {"args": [0, 16, 64, [0.001863, 0.0036777, 0.0053356, 0.0066222, 0.0078348, 0.0087544, 0.0094535, 0.0099424, 0.0103991]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.0019835, 0.0036651, 0.0051268, 0.0057515, 0.0062255, 0.0066443, 0.0068259, 0.0069094, 0.0069482]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 16, 64, [0.0019429, 0.0038766, 0.0056719, 0.007245, 0.0086782, 0.0096235, 0.0101502, 0.0106349, 0.0108397]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 16, 64, [0.0015347, 0.0030283, 0.0043529, 0.0056315, 0.0066818, 0.0077004, 0.008349, 0.0088916, 0.0091851]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 28], "op": "verify_count", "out": 28}, {"args": [[0.950037, 1.875289], 2, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1370], "op": "draft_cost_row", "out": [[1.0, 1.2358, 1.7172, 2.6741], [0, 1, 3, 7], 2.6741, 1.3, 12.8609, 1.36980880012416]}, {"args": [0, 8, 64, [0.934782, 1.817212, 2.568656, 3.312709, 3.993251, 4.505146, 4.898384, 4.957313, 5.004796]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.985112, 1.839693, 2.600943, 3.288133, 3.873064, 4.30817, 4.625296, 4.824658, 4.883689]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 8, 64, [0.9432, 1.765222, 2.481081, 3.196626, 3.638872, 4.044008, 4.42279, 4.579092, 4.729059]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 8, 64, [0.987045, 1.955355, 2.874493, 3.709883, 4.530082, 5.335106, 5.926007, 6.063195, 6.197164]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 8, 64, [0.989075, 1.69528, 2.365399, 3.004703, 3.35353, 3.660172, 3.835273, 4.008818, 4.092024]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 8, 64, [0.921425, 1.770901, 2.593577, 3.143122, 3.627996, 4.094842, 4.556424, 4.630083, 4.682664]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 8, 64, [0.837018, 1.61359, 2.258582, 2.860488, 3.461751, 3.827662, 4.151358, 4.321305, 4.383656]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 8, 64, [0.900233, 1.608795, 2.242846, 2.842929, 3.334394, 3.819218, 4.028891, 4.226818, 4.261282]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 8, 64, [0.917485, 1.793035, 2.537247, 3.113009, 3.682873, 4.237014, 4.55333, 4.617931, 4.678527]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 8, 64, [0.744063, 1.427777, 2.049439, 2.625947, 3.135755, 3.492654, 3.793545, 3.88525, 3.930975]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 8, 64, [0.854759, 1.552443, 2.240578, 2.852024, 3.375498, 3.792074, 4.149882, 4.488829, 4.813278]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 8, 64, [0.995575, 1.947603, 2.841417, 3.644402, 4.420361, 4.828473, 5.205941, 5.516551, 5.649893]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [8, 45], "op": "verify_count", "out": 45}, {"args": [[0.989319, 1.829236], 2, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 647], "op": "draft_cost_row", "out": [[1.0, 1.3898, 2.1582, 3.7004], [0, 1, 3, 7], 3.7004, 1.1, 11.2559, 1.0803624275736743]}, {"args": [0, 16, 64, [0.964482, 1.786512, 2.250043, 2.690349, 3.128633, 3.511864, 3.824368, 3.932892, 3.992278]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.976213, 1.823436, 2.558254, 3.120383, 3.574315, 4.001736, 4.172275, 4.267443, 4.29024]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 16, 64, [0.90209, 1.712389, 2.457951, 3.174323, 3.774641, 4.287196, 4.76948, 5.127132, 5.336374]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 16, 64, [0.845121, 1.670294, 2.439852, 3.173665, 3.895534, 4.584033, 5.168818, 5.392558, 5.523862]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 16, 64, [0.999374, 1.85662, 2.506228, 3.001582, 3.468997, 3.917706, 4.245892, 4.514666, 4.518848]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 16, 64, [0.863582, 1.704607, 2.539356, 3.258868, 3.94702, 4.462491, 4.876981, 5.053316, 5.179293]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 16, 64, [0.992137, 1.911041, 2.687593, 3.083328, 3.376626, 3.581477, 3.681716, 3.77284, 3.858482]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 16, 64, [0.996161, 1.902458, 2.60833, 3.095983, 3.568464, 3.958207, 4.292308, 4.563979, 4.648497]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 16, 64, [0.880764, 1.728435, 2.309298, 2.857277, 3.271139, 3.577591, 3.766126, 3.925949, 3.944032]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 16, 64, [0.850682, 1.470205, 1.984895, 2.44827, 2.878721, 3.234298, 3.556655, 3.800459, 3.926207]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 16, 64, [0.819994, 1.627451, 2.130679, 2.627065, 3.119751, 3.415181, 3.631374, 3.834177, 3.941056]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 16, 64, [0.917261, 1.785228, 2.652065, 3.50259, 4.1852, 4.401325, 4.571884, 4.618216, 4.6207]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 56], "op": "verify_count", "out": 56}, {"args": [[0.65798, 0.754434], 2, 16, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1223], "op": "draft_cost_row", "out": [[1.0, 1.3803, 2.1298, 3.6347], [0, 1, 3, 7], 3.6347, 1.1, 11.6704, 1.289734262907952]}, {"args": [0, 16, 64, [0.0016476, 0.0031265, 0.004279, 0.0053681, 0.0062485, 0.0067791, 0.0070295, 0.007279, 0.0074777]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.001957, 0.0036573, 0.0046286, 0.0055265, 0.0062778, 0.00676, 0.0072069, 0.0074909, 0.0077407]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 12], "op": "verify_count", "out": 12}, {"args": [[0.98438, 1.926242, 2.861422, 3.742573, 4.591715, 5.395275, 6.12131, 6.537952, 6.927691, 7.136297, 7.306347, 7.43276, 7.553397, 7.636954, 7.686932, 7.691157], 16, 16, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1952], "op": "draft_cost_row", "out": [[1.0, 1.3668, 2.0901, 3.5431], [0, 1, 3, 7], 3.5431, 1.3, 12.2522, 1.3296054222657678]}, {"args": [0, 16, 64, [0.1653444, 0.3255222, 0.4542224, 0.5827192, 0.701486, 0.7289244, 0.7563038, 0.7830348, 0.805941]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.1824254, 0.3559508, 0.5176472, 0.6539826, 0.7522206, 0.8498932, 0.9106966, 0.9394788, 0.9451488]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 64], "op": "verify_count", "out": 64}, {"args": [[0.992514, 1.98032, 2.946352, 3.893357, 4.83773, 5.754102, 6.642358, 7.525656, 8.370527, 9.202008, 10.025303, 10.846969, 11.642636, 12.411731, 13.180678, 13.936578, 14.685962, 15.406664, 16.087114, 16.766867, 17.420941, 18.042529, 18.662276, 19.27733, 19.848353, 20.418442, 20.973533, 21.525179, 22.070117, 22.605165, 23.117339, 23.626016, 24.130761, 24.610699, 25.08011, 25.538779, 25.984002, 26.429171, 26.868427, 27.246802, 27.613205, 27.960387, 28.305104, 28.622171, 28.924763, 29.21767, 29.491366, 29.708833, 29.91729, 30.118806, 30.31131, 30.469991, 30.607261, 30.743057, 30.878611, 31.000899, 31.10938, 31.214924, 31.310812, 31.395969, 31.473162, 31.546598, 31.613065, 31.635543], 64, 16, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [16, 32], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 65], "op": "draft_cost_row", "out": [[1.0, 1.0769, 1.2298, 1.5386], [0, 1, 3, 7], 1.5386, 1.3, 14.1022, 1.4473465055040435]}, {"args": [0, 2, 64, [0.182361, 0.3566022, 0.518089, 0.6409956, 0.756252, 0.8055458, 0.8363014, 0.8420374, 0.8451104]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.1783696, 0.3522516, 0.504165, 0.6535882, 0.789256, 0.910582, 0.9684908, 1.0244852, 1.076115]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 2, 64, [0.1908318, 0.320202, 0.4422888, 0.5587332, 0.6278742, 0.6899796, 0.7414322, 0.7641002, 0.7720356]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 2, 64, [0.1865072, 0.3522324, 0.507565, 0.6585354, 0.7312132, 0.7858116, 0.8341914, 0.862588, 0.8825998]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 23], "op": "verify_count", "out": 23}, {"args": [[0.989755, 1.862206, 2.667515, 3.33254, 3.949429, 4.553446, 4.94598, 5.241143, 5.52504, 5.768009, 6.010841, 6.242812, 6.408996, 6.544884, 6.662242, 6.762357], 16, 2, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [2, 16], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 2266], "op": "draft_cost_row", "out": [[1.0, 1.3668, 2.0901, 3.5431], [0, 1, 3, 7], 3.5431, 1.3, 12.2522, 1.0]}, {"args": [0, 16, 64, [0.0018934, 0.0036666, 0.0050229, 0.0061383, 0.0072436, 0.0081229, 0.0087093, 0.0091813, 0.0094283]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.0015783, 0.0027278, 0.0037645, 0.0046726, 0.0052299, 0.0056858, 0.006092, 0.0064485, 0.0066191]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 25], "op": "verify_count", "out": 25}, {"args": [[0.932015, 1.823415, 2.675486, 3.47102, 4.255183, 5.018015, 5.772216, 6.524901, 7.209354, 7.794517, 8.343665, 8.869794, 9.394816, 9.913467, 10.42017, 10.924175, 11.417027, 11.888182, 12.3269, 12.682973, 13.021586, 13.338589, 13.646876, 13.946331, 14.22253, 14.491789, 14.721595, 14.930135, 15.086905, 15.23327, 15.374084, 15.49355, 15.59392], 33, 16, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [16, 32], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1992], "op": "draft_cost_row", "out": [[1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], 2.6445, 1.3, 13.1453, 1.3880866970581047]}, {"args": [0, 8, 64, [0.86018, 1.707073, 2.544919, 3.216819, 3.765098, 4.245155, 4.606735, 4.875441, 4.925384]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.810721, 1.554999, 2.282138, 2.902281, 3.293925, 3.592025, 3.773987, 3.927739, 3.955013]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 8, 64, [0.90769, 1.558971, 2.125426, 2.67435, 3.12649, 3.418635, 3.640559, 3.840441, 3.917972]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 8, 64, [0.98295, 1.954778, 2.81006, 3.627644, 4.412943, 5.198206, 5.811574, 6.180936, 6.466897]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 8, 64, [0.987691, 1.670468, 2.259978, 2.824468, 3.339255, 3.763984, 4.105175, 4.2936, 4.297149]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 8, 64, [0.919402, 1.807672, 2.301424, 2.744531, 3.094599, 3.439024, 3.676863, 3.907684, 4.116313]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 8, 64, [0.933298, 1.640642, 2.322132, 2.960188, 3.595492, 4.214836, 4.681022, 5.0418, 5.218565]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 8, 64, [0.998497, 1.991483, 2.978531, 3.601111, 4.208765, 4.705534, 5.139961, 5.533561, 5.916257]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 8, 64, [0.914376, 1.349173, 1.771891, 2.128154, 2.362492, 2.556706, 2.708831, 2.853066, 2.97637]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 8, 64, [0.969341, 1.93148, 2.858115, 3.765973, 4.639673, 5.428569, 5.954994, 6.4162, 6.521508]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 8, 64, [0.821176, 1.550303, 2.234764, 2.85177, 3.325617, 3.716904, 4.043784, 4.283947, 4.390701]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 8, 64, [0.720882, 1.319593, 1.794981, 2.222655, 2.637183, 2.998652, 3.222867, 3.381194, 3.41533]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [8, 63], "op": "verify_count", "out": 63}, {"args": [[0.505455, 0.746828, 0.934218, 1.02577], 4, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 417], "op": "draft_cost_row", "out": [[1.0, 1.556, 2.6614, 4.8811], [0, 1, 3, 7], 4.8811, 1.1, 9.412, 1.0]}, {"args": [0, 32, 64, [0.0093157, 0.0181232, 0.0243923, 0.029215, 0.0318458, 0.0342581, 0.0362197, 0.0365417, 0.0366512]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0099104, 0.0188395, 0.0273924, 0.0353419, 0.0427725, 0.0452849, 0.0463819, 0.046818, 0.0471127]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 58], "op": "verify_count", "out": 58}, {"args": [[0.838191, 1.540919, 2.079115, 2.524162], 4, 32, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [32, 4], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1017], "op": "draft_cost_row", "out": [[1.0, 1.385, 2.1439, 3.6672], [0, 1, 3, 7], 3.6672, 1.1, 11.4675, 1.4576944466513069]}, {"args": [0, 16, 64, [0.0018868, 0.003447, 0.0045695, 0.0055845, 0.0064511, 0.007019, 0.0073882, 0.0076448, 0.0078522]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.0018896, 0.0037331, 0.0053643, 0.0069015, 0.0082186, 0.0092031, 0.0101082, 0.0109069, 0.0111555]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 53], "op": "verify_count", "out": 53}, {"args": [[0.905325, 1.809044, 2.702988, 3.58418, 4.447822, 5.293446, 6.138854, 6.968515, 7.797582, 8.606721, 9.397674, 10.185999, 10.955672, 11.720551, 12.476046, 13.225798, 13.953833, 14.668396, 15.382595, 16.018567, 16.623232, 17.218886, 17.802005, 18.380684, 18.953889, 19.523621, 20.080987, 20.629247, 21.170589, 21.692576, 22.213302, 22.733569, 23.238023, 23.73378, 24.228459, 24.720404, 25.198976, 25.66744, 26.133592, 26.59504, 27.053255, 27.504073, 27.933173, 28.350427, 28.74584, 29.114574, 29.480671, 29.835875, 30.189956, 30.509349, 30.811834, 31.111845, 31.3993, 31.622936, 31.841878, 32.041771, 32.227009, 32.397832, 32.534387, 32.617767, 32.696232, 32.715927, 32.733515, 32.750978], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1015], "op": "draft_cost_row", "out": [[1.0, 1.385, 2.1439, 3.6672], [0, 1, 3, 7], 3.6672, 1.1, 11.4675, 1.2754826408198934]}, {"args": [0, 16, 64, [0.66101, 1.273381, 1.880567, 2.42991, 2.859182, 3.162832, 3.411015, 3.65046, 3.752857]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.885743, 1.65345, 2.409366, 3.106178, 3.73854, 4.186338, 4.615545, 4.934355, 5.2481]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 16, 64, [0.971758, 1.801138, 2.610191, 3.335637, 3.987072, 4.435725, 4.882405, 5.300239, 5.614119]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 16, 64, [0.95122, 1.854077, 2.410973, 2.930716, 3.406888, 3.771039, 4.049295, 4.186378, 4.196926]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 16, 64, [0.972676, 1.911514, 2.792023, 3.583159, 4.25682, 4.555119, 4.834611, 4.903019, 4.922224]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 16, 64, [0.833657, 1.657392, 2.474582, 2.979024, 3.47483, 3.853726, 4.142954, 4.321156, 4.41565]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 16, 64, [0.936821, 1.649796, 2.316222, 2.902446, 3.483285, 3.903027, 4.159578, 4.30058, 4.35918]], "op": "tree_width", "out": [4, 64, false]}, {"args": [7, 16, 64, [0.9554, 1.828881, 2.551355, 3.230513, 3.829892, 4.398257, 4.949724, 5.241898, 5.42165]], "op": "tree_width", "out": [4, 64, false]}, {"args": [8, 16, 64, [0.944295, 1.798915, 2.561181, 3.189385, 3.74069, 4.208053, 4.463588, 4.669153, 4.7157]], "op": "tree_width", "out": [4, 64, false]}, {"args": [9, 16, 64, [0.580692, 1.105994, 1.576454, 2.042655, 2.394612, 2.647677, 2.796882, 2.915344, 2.942445]], "op": "tree_width", "out": [4, 64, false]}, {"args": [10, 16, 64, [0.902186, 1.801093, 2.646241, 3.383787, 4.042225, 4.650637, 5.053247, 5.40117, 5.687363]], "op": "tree_width", "out": [4, 64, false]}, {"args": [11, 16, 64, [0.951964, 1.683559, 2.366597, 2.752004, 3.130536, 3.465268, 3.709352, 3.887765, 4.043295]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 47], "op": "verify_count", "out": 47}, {"args": [[0.969086, 1.904074, 2.827336, 3.749258, 4.667756, 5.578575, 6.431061, 7.276441, 8.100355, 8.92275, 9.717725, 10.502917, 11.28307, 12.038068, 12.784172, 13.525721, 14.250534, 14.964115, 15.65955, 16.346799, 17.024933, 17.701083, 18.374404, 19.034941, 19.692471, 20.32546, 20.952822, 21.575033, 22.151895, 22.718512, 23.251455, 23.779209, 24.294236, 24.79003, 25.27839, 25.763155, 26.22177, 26.67474, 27.111224, 27.530479, 27.930453, 28.314254, 28.690845, 29.06317, 29.42266, 29.755206, 30.078669, 30.398004, 30.688236, 30.958205, 31.221943, 31.464667, 31.697804, 31.904715, 32.081261, 32.249797, 32.409438, 32.564814, 32.66922, 32.750012, 32.810949, 32.863301, 32.891072, 32.900877], 2, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 2144], "op": "draft_cost_row", "out": [[1.0, 1.5014, 2.4973, 4.4974], [0, 1, 3, 7], 4.4974, 1.1, 11.2447, 1.259620031557352]}, {"args": [0, 32, 64, [0.0413498, 0.0823906, 0.1093722, 0.1309802, 0.1504548, 0.1691617, 0.1768951, 0.1821919, 0.1835771]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0499995, 0.0969244, 0.1436972, 0.1803379, 0.2104051, 0.2376244, 0.2615011, 0.2700924, 0.2738055]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 59], "op": "verify_count", "out": 59}, {"args": [[0.796207, 1.366353, 1.898993, 2.289455, 2.612077, 2.927543, 3.167566, 3.175272], 8, 32, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [32, 4], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1387], "op": "draft_cost_row", "out": [[1.0, 1.1404, 1.422, 1.9839], [0, 1, 3, 7], 1.9839, 1.3, 13.7238, 1.6277880903101074]}, {"args": [0, 4, 64, [0.1996786, 0.3603322, 0.5166918, 0.6570012, 0.7504904, 0.8276654, 0.9008102, 0.9614316, 0.9712362]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 4, 64, [0.1805978, 0.3562188, 0.521022, 0.6801374, 0.8152504, 0.9407662, 1.0563728, 1.146255, 1.1657062]], "op": "tree_width", "out": [4, 64, true]}, {"args": [4, 63], "op": "verify_count", "out": 63}, {"args": [[0.975253, 1.944576, 2.714034, 3.455112, 4.159282, 4.782887, 5.296873, 5.627768], 8, 4, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 1588], "op": "draft_cost_row", "out": [[1.0, 1.3737, 2.1101, 3.5887], [0, 1, 3, 7], 3.5887, 1.1, 11.9737, 1.123457716811004]}, {"args": [0, 16, 64, [0.1722226, 0.323188, 0.4697136, 0.5810618, 0.682448, 0.776198, 0.8553338, 0.9096304, 0.9147314]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 16, 64, [0.1859316, 0.3242706, 0.4561978, 0.5792704, 0.6814606, 0.7795136, 0.8618734, 0.8976762, 0.9135138]], "op": "tree_width", "out": [4, 64, true]}, {"args": [16, 26], "op": "verify_count", "out": 26}, {"args": [[0.987895, 1.966396, 2.930148, 3.887365, 4.827623, 5.76495, 6.692544, 7.596298, 8.467686, 9.331371, 10.194814, 11.038615, 11.880027, 12.713008, 13.520377, 14.324837, 15.093712, 15.845506, 16.584711, 17.31508, 18.04399, 18.75414, 19.453745, 20.152999, 20.839872, 21.525549, 22.208268, 22.876022, 23.505407, 24.070183, 24.613041, 25.106843, 25.587744, 26.061271, 26.518722, 26.975902, 27.414116, 27.804489, 28.194568, 28.5796, 28.961343, 29.336626, 29.653537, 29.950865, 30.234235, 30.492153, 30.749847, 30.973023, 31.184584, 31.395359, 31.578898, 31.759559, 31.931834, 32.090714, 32.234001, 32.358756, 32.481736, 32.601035, 32.709785, 32.795432, 32.874795, 32.934579, 32.991014, 33.025312], 64, 16, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [16, 32], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 2316], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.4774456294044733]}, {"args": [0, 1, 64, [0.1953304, 0.3835178, 0.5411652, 0.6686116, 0.7861344, 0.886686, 0.9790494, 1.0682606, 1.1225756]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.191957, 0.3712394, 0.5468998, 0.6917188, 0.8156672, 0.9359214, 1.047555, 1.116792, 1.1225136]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 1, 64, [0.1518954, 0.2988388, 0.4322024, 0.5426152, 0.6302994, 0.702837, 0.7577864, 0.8010242, 0.8347292]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 1, 64, [0.1672636, 0.3247488, 0.482, 0.6327678, 0.7253006, 0.7894214, 0.8456556, 0.8583034, 0.8693572]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 1, 64, [0.1647714, 0.2860028, 0.4068832, 0.4971142, 0.5565156, 0.5974286, 0.6075276, 0.6132444, 0.6161516]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 1, 64, [0.1121352, 0.2205784, 0.3251554, 0.421792, 0.4951604, 0.5560524, 0.6006768, 0.6318448, 0.6459146]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 36], "op": "verify_count", "out": 36}, {"args": [[0.745651, 1.003996], 2, 1, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}]}, {"case": {"eval_batch_size": null, "node_top_k": 6, "tree_depth": 7, "verify_num": 64}, "script": [{"args": [8], "op": "history", "out": 64}, {"args": [8, 1102], "op": "draft_cost_row", "out": [[1.0, 1.2378, 1.7227, 2.6864], [0, 1, 3, 7], 2.6864, 1.3, 12.7386, 1.0]}, {"args": [0, 8, 64, [0.810348, 1.500941, 2.167351, 2.768808, 3.326998, 3.701753, 3.975801, 4.118401, 4.129262]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.905973, 1.724793, 2.411739, 3.07306, 3.513114, 3.675382, 3.820685, 3.895294, 3.954119]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 8, 64, [0.987134, 1.902168, 2.744571, 3.253497, 3.658111, 3.995111, 4.086089, 4.146873, 4.165478]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 8, 64, [0.946713, 1.643548, 2.264999, 2.688206, 3.000747, 3.164271, 3.29934, 3.411868, 3.463221]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 8, 64, [0.815698, 1.542025, 2.137996, 2.614764, 3.033605, 3.434123, 3.818705, 3.989919, 4.020413]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 8, 64, [0.976304, 1.943763, 2.633877, 3.30765, 3.971246, 4.334375, 4.69072, 4.925692, 5.039525]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 8, 64, [0.822568, 1.632675, 2.151672, 2.663022, 3.163035, 3.593189, 3.956511, 4.178679, 4.206823]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [8, 55], "op": "verify_count", "out": 55}, {"args": [[0.753296], 1, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 730], "op": "draft_cost_row", "out": [[1.0, 1.0767, 1.2292, 1.5371], [0, 1, 3, 7], 1.5371, 1.3, 14.1672, 1.2439298508511085]}, {"args": [0, 2, 64, [0.0013918, 0.0026656, 0.0035842, 0.0042725, 0.0048363, 0.0053894, 0.005807, 0.0059111, 0.0059848]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.0019175, 0.0038293, 0.0056778, 0.0071748, 0.0081369, 0.0090894, 0.0098178, 0.0101963, 0.0105314]], "op": "tree_width", "out": [6, 64, true]}, {"args": [2, 1], "op": "verify_count", "out": 1}, {"args": [[0.801373, 1.596319, 2.097726, 2.277266], 4, 2, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 476], "op": "draft_cost_row", "out": [[1.0, 1.0769, 1.2295, 1.5378], [0, 1, 3, 7], 1.5378, 1.3, 14.1355, 1.0352492273439673]}, {"args": [0, 2, 64, [0.0499248, 0.0915225, 0.1308926, 0.1628632, 0.189225, 0.214405, 0.2305278, 0.2420035, 0.2431989]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.0473339, 0.0920498, 0.1357083, 0.1670585, 0.1909279, 0.205494, 0.2194093, 0.2325432, 0.2406505]], "op": "tree_width", "out": [6, 64, true]}, {"args": [2, 57], "op": "verify_count", "out": 57}, {"args": [[0.980012, 1.916425, 2.843472, 3.577479, 4.29628, 4.985087, 5.62315, 6.193354, 6.751375, 7.308304, 7.829284, 8.301055, 8.73223, 9.147703, 9.552433, 9.937473, 10.203304, 10.461219, 10.661488, 10.861657, 11.060649, 11.221572, 11.376996, 11.515375, 11.608247, 11.681238, 11.740026, 11.779231, 11.817162, 11.848057, 11.876574, 11.903834, 11.907526], 33, 2, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [2, 32], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1447], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1194, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5738, 1.0538182091641648]}, {"args": [0, 1, 64, [0.0093402, 0.0163464, 0.0232375, 0.0294586, 0.0348748, 0.0402173, 0.0441589, 0.04728, 0.0485272]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0075963, 0.014554, 0.0214068, 0.0254756, 0.0287115, 0.0318363, 0.0342939, 0.035712, 0.0366174]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 56], "op": "verify_count", "out": 56}, {"args": [[0.667397, 1.155219, 1.598909, 1.778278], 4, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1872], "op": "draft_cost_row", "out": [[1.0, 1.1395, 1.4188, 1.9769], [0, 1, 3, 7], 1.9769, 1.3, 13.8499, 1.0]}, {"args": [0, 4, 64, [0.0096388, 0.0184817, 0.0269695, 0.0338543, 0.0390183, 0.0426831, 0.0456437, 0.047887, 0.0488558]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.0090269, 0.0168813, 0.0239415, 0.0289504, 0.0339574, 0.0385592, 0.0424477, 0.0457728, 0.0472398]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 4, 64, [0.0079187, 0.0156415, 0.0226302, 0.0278443, 0.0322434, 0.0363188, 0.037382, 0.0379044, 0.0383968]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 4, 64, [0.008957, 0.0167077, 0.0243275, 0.0306528, 0.036357, 0.0411277, 0.0442483, 0.0459518, 0.0461219]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 18], "op": "verify_count", "out": 18}, {"args": [[0.971041, 1.907175, 2.804397, 3.684206, 4.55774, 5.430838, 6.296118, 7.158289, 8.000976, 8.836371, 9.669408, 10.490557, 11.29774, 12.101347, 12.902055, 13.686391, 14.421039, 15.136869, 15.821863, 16.473359, 17.114303, 17.749852, 18.383919, 19.001722, 19.610225, 20.217089, 20.815879, 21.352125, 21.879696, 22.402447, 22.919104, 23.424385, 23.891676, 24.340129, 24.754997, 25.167421, 25.574323, 25.973875, 26.362952, 26.751432, 27.136082, 27.515771, 27.874565, 28.195533, 28.507495, 28.815909, 29.121404, 29.417991, 29.703622, 29.966821, 30.221494, 30.432701, 30.637791, 30.827844, 31.011905, 31.182947, 31.352774, 31.516033, 31.653309, 31.779148, 31.881477, 31.934401, 31.958992, 31.971948], 4, 4, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1141], "op": "draft_cost_row", "out": [[1.0, 1.5314, 2.5883, 4.7102], [0, 1, 3, 7], 4.7102, 1.1, 10.2204, 1.0145861735781128]}, {"args": [0, 32, 64, [0.0019127, 0.0037624, 0.0054734, 0.0068542, 0.0082191, 0.0094345, 0.0104175, 0.0112712, 0.0120829]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.0016781, 0.0031858, 0.0036849, 0.0039435, 0.0041598, 0.0043283, 0.0044531, 0.0045659, 0.0045827]], "op": "tree_width", "out": [6, 64, true]}, {"args": [32, 15], "op": "verify_count", "out": 15}, {"args": [[0.986727, 1.952384, 2.912902, 3.865649, 4.815264, 5.748671, 6.674822, 7.598329, 8.424132, 9.189359, 9.946658, 10.703464, 11.450189, 12.181187, 12.85029, 13.466102, 14.072955, 14.673074, 15.216168, 15.698589, 16.174043, 16.597592, 16.95982, 17.299515, 17.615444, 17.913621, 18.155342, 18.383874, 18.611813, 18.818403, 18.905579, 18.933646, 18.946186], 33, 32, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [32, 32], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1987], "op": "draft_cost_row", "out": [[1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], 2.6445, 1.3, 13.1453, 1.586384796637834]}, {"args": [0, 8, 64, [0.0312218, 0.0618418, 0.0888883, 0.1156845, 0.1349519, 0.1530352, 0.1645607, 0.1742991, 0.1806409]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.047615, 0.0848622, 0.1217148, 0.1533079, 0.1807114, 0.2016353, 0.2142418, 0.2228829, 0.2279997]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 36], "op": "verify_count", "out": 36}, {"args": [[0.997562, 1.987112, 2.954312, 3.913382, 4.851323, 5.788344, 6.69079, 7.581127, 8.422297, 9.258974, 10.068748, 10.858625, 11.610121, 12.33662, 13.051739, 13.766073, 14.439802, 15.111368, 15.773754, 16.431304, 17.078846, 17.716929, 18.354112, 18.9703, 19.560048, 20.086059, 20.601797, 21.104267, 21.605831, 22.084674, 22.55003, 23.009949, 23.468396, 23.906658, 24.32751, 24.741327, 25.141087, 25.538338, 25.930079, 26.320358, 26.687494, 27.046899, 27.402176, 27.757021, 28.106917, 28.439298, 28.769654, 29.09199, 29.406251, 29.712822, 30.009691, 30.292334, 30.551473, 30.8017, 31.04089, 31.274103, 31.479063, 31.675313, 31.848324, 32.019921, 32.171427, 32.272593, 32.346264, 32.370921], 8, 8, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [8, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 583], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5139, 1.2615699761545347]}, {"args": [0, 1, 64, [0.0015586, 0.002662, 0.0037243, 0.0047486, 0.0056547, 0.0062696, 0.0067609, 0.0071825, 0.0073688]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0019138, 0.0035911, 0.0052318, 0.0068026, 0.0078601, 0.00862, 0.0091328, 0.0095179, 0.0097696]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 27], "op": "verify_count", "out": 27}, {"args": [[0.991074, 1.976158, 2.947625, 3.911892, 4.873883, 5.784488, 6.681781, 7.52841, 8.369966, 9.202178, 10.027332, 10.835059, 11.623668, 12.410246, 13.167866, 13.860265, 14.539904, 15.217664, 15.871855, 16.43995, 16.988234, 17.534562, 18.080885, 18.600675, 19.115853, 19.62021, 20.123702, 20.61319, 21.071268, 21.526968, 21.981962, 22.425537, 22.84054, 23.240172, 23.633864, 24.017939, 24.371109, 24.717734, 25.053183, 25.37936, 25.690995, 25.992214, 26.291815, 26.578382, 26.858261, 27.135188, 27.386885, 27.625942, 27.79373, 27.961363, 28.11169, 28.256254, 28.397574, 28.512388, 28.620698, 28.70568, 28.786464, 28.859126, 28.923156, 28.980994, 29.025937, 29.060219, 29.079724, 29.087837], 64, 1, 700, false], "op": "verify_paged", "out": [64, false]}, {"args": [1, 64], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1170], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1194, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5569, 1.0]}, {"args": [0, 1, 64, [0.1511082, 0.275563, 0.373575, 0.4603124, 0.5432908, 0.6148814, 0.6487652, 0.6675676, 0.6717106]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.1974518, 0.3784038, 0.5528014, 0.6660506, 0.7738094, 0.879769, 0.9448198, 1.0078478, 1.0675854]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 1, 64, [0.1919366, 0.3793372, 0.5657124, 0.707009, 0.839296, 0.9029036, 0.9437906, 0.9681244, 0.9796422]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 1, 64, [0.1996838, 0.381972, 0.545814, 0.7016676, 0.8375146, 0.9249658, 1.0111298, 1.0462128, 1.0593984]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 1, 64, [0.1918802, 0.3681178, 0.5001748, 0.5961786, 0.6595054, 0.7033694, 0.7441242, 0.7576146, 0.7679142]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 1, 64, [0.18645, 0.3657036, 0.520941, 0.6622006, 0.7969042, 0.8997758, 0.9955942, 1.0891744, 1.1079632]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 1, 64, [0.1969712, 0.3661002, 0.5016858, 0.6197578, 0.7140742, 0.8036044, 0.8439382, 0.8776732, 0.9085328]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 53], "op": "verify_count", "out": 53}, {"args": [[0.987884, 1.315908], 2, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1847], "op": "draft_cost_row", "out": [[1.0, 1.5045, 2.5084, 4.5243], [0, 1, 3, 7], 4.5243, 1.1, 11.1124, 1.0]}, {"args": [0, 32, 64, [0.908164, 1.753529, 2.40878, 2.98593, 3.556763, 3.735908, 3.9048, 3.995394, 4.079543]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.851815, 1.593282, 2.316557, 3.017906, 3.680776, 4.306897, 4.77875, 4.918604, 4.961938]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 32, 64, [0.994424, 1.964321, 2.892895, 3.806346, 4.663868, 5.457107, 6.0191, 6.479461, 6.709033]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 32, 64, [0.970793, 1.864396, 2.495202, 3.0897, 3.638086, 4.162706, 4.67927, 5.072146, 5.322296]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 32, 64, [0.964198, 1.880009, 2.510242, 3.110523, 3.684739, 4.229666, 4.750106, 5.20073, 5.230344]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 32, 64, [0.768323, 1.440647, 2.112848, 2.671056, 3.227926, 3.760944, 4.164055, 4.286278, 4.304818]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 32, 64, [0.839742, 1.655589, 2.448715, 3.157685, 3.808817, 4.319404, 4.48284, 4.571795, 4.640863]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [32, 52], "op": "verify_count", "out": 52}, {"args": [[0.977748], 1, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 619], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5139, 1.6820933015393797]}, {"args": [0, 1, 64, [0.0017783, 0.0032207, 0.0045367, 0.0057268, 0.0062584, 0.0067847, 0.0071228, 0.0073606, 0.0075203]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.0019972, 0.0039669, 0.005866, 0.0076939, 0.0094512, 0.0109362, 0.0118083, 0.0126209, 0.0128326]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 36], "op": "verify_count", "out": 36}, {"args": [[0.885446, 1.142198], 2, 1, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1954], "op": "draft_cost_row", "out": [[1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], 2.6445, 1.3, 13.1453, 1.0]}, {"args": [0, 8, 64, [0.0466368, 0.0924496, 0.1356056, 0.1695756, 0.1892137, 0.2006413, 0.2048953, 0.2052592, 0.2054605]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.0444239, 0.0816556, 0.1164664, 0.1510632, 0.1854429, 0.2181683, 0.2404371, 0.2482868, 0.2529174]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 8, 64, [0.043676, 0.084992, 0.1213722, 0.1409946, 0.1567602, 0.1724043, 0.1880195, 0.2029204, 0.2052724]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 8, 64, [0.04945, 0.085131, 0.1162873, 0.1394007, 0.148096, 0.1548668, 0.1614129, 0.1647219, 0.1650164]], "op": "tree_width", "out": [6, 64, true]}, {"args": [8, 46], "op": "verify_count", "out": 46}, {"args": [[0.982326, 1.904532, 2.822464, 3.710821, 4.574514, 5.433577, 6.289981, 7.135832, 7.981276, 8.820685, 9.640839, 10.436349, 11.217347, 11.972384, 12.711115, 13.431196, 14.138895, 14.790167, 15.431228, 16.05873, 16.68575, 17.303585, 17.863276, 18.409658, 18.938346, 19.451999, 19.949951, 20.436519, 20.912634, 21.384583, 21.819039, 22.246855, 22.668995, 23.083151, 23.452145, 23.819886, 24.157246, 24.493851, 24.822057, 25.138514, 25.449769, 25.759463, 26.064474, 26.354345, 26.597523, 26.838243, 27.074406, 27.281016, 27.477555, 27.672521, 27.857545, 28.029768, 28.161896, 28.286321, 28.403641, 28.504605, 28.604642, 28.662026, 28.713378, 28.741597, 28.763224, 28.783867, 28.796786, 28.806737], 1, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1907], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.6004, 1.265916000971087]}, {"args": [0, 1, 64, [0.0486694, 0.0900793, 0.1313348, 0.1718754, 0.2108385, 0.2405661, 0.2546052, 0.2649668, 0.273535]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0493071, 0.092902, 0.1335016, 0.168339, 0.2014886, 0.2337477, 0.2584002, 0.2665876, 0.267692]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 45], "op": "verify_count", "out": 45}, {"args": [[0.983919, 1.932743, 2.860438, 3.784943, 4.573743, 5.289055, 5.984155, 6.641438, 7.268351, 7.831319, 8.287891, 8.740189, 8.996671, 9.100112, 9.1214, 9.127013], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 2142], "op": "draft_cost_row", "out": [[1.0, 1.5014, 2.4973, 4.4974], [0, 1, 3, 7], 4.4974, 1.1, 11.2447, 1.0]}, {"args": [0, 32, 64, [0.0018015, 0.0035925, 0.0046752, 0.0057472, 0.0065154, 0.006907, 0.0071969, 0.0074442, 0.0075686]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.0018964, 0.0034931, 0.0047378, 0.0056318, 0.0064003, 0.006752, 0.0069609, 0.0070801, 0.0071398]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 32, 64, [0.0018481, 0.0032201, 0.0045591, 0.0058345, 0.0069501, 0.0075099, 0.0079992, 0.0084151, 0.0088305]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 32, 64, [0.0017142, 0.0032698, 0.0047973, 0.00605, 0.0071981, 0.0082795, 0.0092567, 0.0101662, 0.0103495]], "op": "tree_width", "out": [6, 64, true]}, {"args": [32, 56], "op": "verify_count", "out": 56}, {"args": [[0.986412, 1.963776, 2.934398, 3.895655, 4.8411, 5.751502, 6.641801, 7.497374, 8.345276, 9.192165, 10.024523, 10.855739, 11.671113, 12.485704, 13.286085, 14.079719, 14.842979, 15.597078, 16.314315, 17.002861, 17.682198, 18.350669, 18.997774, 19.620427, 20.236237, 20.850892, 21.452743, 22.043822, 22.607076, 23.121602, 23.623233, 24.119765, 24.604121, 25.0808, 25.535525, 25.981746, 26.400935, 26.798667, 27.194188, 27.577562, 27.953652, 28.327736, 28.658982, 28.973344, 29.280101, 29.58079, 29.877583, 30.143535, 30.383342, 30.604843, 30.783113, 30.958275, 31.107054, 31.248226, 31.383946, 31.506058, 31.625072, 31.742223, 31.846376, 31.945831, 32.03244, 32.088965, 32.099147, 32.100083], 64, 32, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [32, 32], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 936], "op": "draft_cost_row", "out": [[1.0, 1.5367, 2.6028, 4.744], [0, 1, 3, 7], 4.744, 1.1, 10.0796, 1.3403901647628291]}, {"args": [0, 32, 64, [0.0019183, 0.0036219, 0.0052043, 0.0067412, 0.0082333, 0.0093996, 0.0105598, 0.0108051, 0.0110262]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0017921, 0.0032242, 0.0045759, 0.0058683, 0.0068294, 0.0076621, 0.0083092, 0.008846, 0.0091936]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 24], "op": "verify_count", "out": 24}, {"args": [[0.998942, 1.983931, 2.939603, 3.892193, 4.833318, 5.73332, 6.60865, 7.481801, 8.354602, 9.219362, 10.037238, 10.845853, 11.648363, 12.433194, 13.179623, 13.91774, 14.654613, 15.384521, 16.107107, 16.816436, 17.525128, 18.200891, 18.855763, 19.509786, 20.123594, 20.730108, 21.333799, 21.923664, 22.498634, 23.041485, 23.584039, 24.117346, 24.643867, 25.162296, 25.670544, 26.178249, 26.68284, 27.177559, 27.665078, 28.138488, 28.598019, 29.057377, 29.489249, 29.906579, 30.311316, 30.679411, 31.046207, 31.39417, 31.718429, 32.025553, 32.328199, 32.609079, 32.878752, 33.125124, 33.355572, 33.529736, 33.673882, 33.813747, 33.951947, 34.071237, 34.098294, 34.111241, 34.122306, 34.129659], 64, 32, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [32, 32], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 2040], "op": "draft_cost_row", "out": [[1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], 2.6445, 1.3, 13.1453, 1.586384796637834]}, {"args": [0, 8, 64, [0.0450641, 0.0819888, 0.1170486, 0.1516525, 0.1811157, 0.2070027, 0.2309338, 0.2486693, 0.2592974]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.0415361, 0.0671439, 0.0910198, 0.1144873, 0.1367936, 0.1530017, 0.1590062, 0.163267, 0.1648793]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 55], "op": "verify_count", "out": 55}, {"args": [[0.954839, 1.882172, 2.786041, 3.657026, 4.481656, 5.264308, 6.025709, 6.752798, 7.326817, 7.885268, 8.291855, 8.592181, 8.833017, 9.059983, 9.285421, 9.406697], 16, 8, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [8, 16], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1596], "op": "draft_cost_row", "out": [[1.0, 1.2342, 1.7123, 2.6622], [0, 1, 3, 7], 2.6622, 1.3, 12.9757, 1.1804783522411957]}, {"args": [0, 8, 64, [0.045926, 0.0911655, 0.1265256, 0.1578142, 0.1833941, 0.1963515, 0.2077567, 0.2160057, 0.2200007]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.0402839, 0.0727288, 0.1034836, 0.1310734, 0.1585496, 0.1827211, 0.1966615, 0.2080036, 0.2099686]], "op": "tree_width", "out": [6, 64, true]}, {"args": [8, 35], "op": "verify_count", "out": 35}, {"args": [[0.998486, 1.96493, 2.919183, 3.860167, 4.757511, 5.631436, 6.504353, 7.333995, 8.159813, 8.962907, 9.741857, 10.463066, 11.157299, 11.839132, 12.508909, 13.159184, 13.808914, 14.43365, 15.052164, 15.657026, 16.255173, 16.845331, 17.411397, 17.958886, 18.50356, 19.030934, 19.556659, 20.0716, 20.583394, 21.08868, 21.581525, 22.020937, 22.454747, 22.870694, 23.279529, 23.660146, 24.034874, 24.405264, 24.771228, 25.134687, 25.49553, 25.817856, 26.117472, 26.397933, 26.658887, 26.910508, 27.162121, 27.412487, 27.632473, 27.848279, 28.036168, 28.187495, 28.318111, 28.448469, 28.55633, 28.63428, 28.707449, 28.776574, 28.827965, 28.877993, 28.923003, 28.953761, 28.967801, 28.97855], 64, 8, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [8, 64], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 155], "op": "draft_cost_row", "out": [[1.0, 1.567, 2.6932, 4.9552], [0, 1, 3, 7], 4.9552, 1.1, 9.0611, 1.0]}, {"args": [0, 32, 64, [0.823742, 1.493139, 2.027241, 2.384062, 2.69428, 2.990174, 3.250316, 3.362109, 3.460908]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.894399, 1.611863, 2.316831, 2.963349, 3.514288, 3.933679, 4.334808, 4.561661, 4.613272]], "op": "tree_width", "out": [8, 64, false]}, {"args": [2, 32, 64, [0.70537, 1.374354, 2.023802, 2.547987, 3.016583, 3.124773, 3.225616, 3.30487, 3.312605]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 32, 64, [0.862549, 1.624916, 2.268334, 2.840976, 3.392038, 3.894663, 4.0881, 4.125622, 4.128472]], "op": "tree_width", "out": [8, 64, false]}, {"args": [4, 32, 64, [0.984857, 1.782945, 2.53324, 3.007812, 3.44201, 3.818894, 4.162447, 4.493209, 4.652119]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 32, 64, [0.879116, 1.596657, 2.288438, 2.857604, 3.311247, 3.751439, 4.112393, 4.345567, 4.438263]], "op": "tree_width", "out": [8, 64, false]}, {"args": [6, 32, 64, [0.931962, 1.809018, 2.666868, 3.382853, 3.836483, 4.129146, 4.389572, 4.570321, 4.682498]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [32, 26], "op": "verify_count", "out": 26}, {"args": [[0.982212, 1.962549, 2.884798, 3.618441, 4.289044, 4.959122, 5.564203, 6.130114, 6.65775, 7.074453, 7.435115, 7.787333, 8.099604, 8.354053, 8.50753, 8.609102], 16, 32, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [32, 8], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1035], "op": "draft_cost_row", "out": [[1.0, 1.2378, 1.7227, 2.6864], [0, 1, 3, 7], 2.6864, 1.3, 12.7386, 1.5564013122124956]}, {"args": [0, 8, 64, [0.97662, 1.908127, 2.691385, 3.182613, 3.506487, 3.771575, 4.025959, 4.258576, 4.362022]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.925725, 1.798911, 2.406074, 2.935325, 3.27632, 3.59746, 3.811762, 3.941223, 3.945479]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 8, 64, [0.862475, 1.554426, 2.051033, 2.531111, 2.976512, 3.369929, 3.641265, 3.825682, 3.965409]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 8, 64, [0.997778, 1.80645, 2.513738, 3.210442, 3.855476, 4.439224, 4.756951, 4.866872, 4.975953]], "op": "tree_width", "out": [4, 64, false]}, {"args": [4, 8, 64, [0.837118, 1.66225, 2.477557, 3.211969, 3.836444, 4.397789, 4.912831, 5.263469, 5.597784]], "op": "tree_width", "out": [4, 64, false]}, {"args": [5, 8, 64, [0.952738, 1.79555, 2.625918, 3.247658, 3.863746, 4.213616, 4.521405, 4.7213, 4.88227]], "op": "tree_width", "out": [4, 64, false]}, {"args": [6, 8, 64, [0.955911, 1.695512, 2.273914, 2.785419, 3.20297, 3.591695, 3.771409, 3.943577, 4.089625]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [8, 51], "op": "verify_count", "out": 51}, {"args": [[0.990589, 1.955927, 2.908955, 3.839023, 4.703708, 5.56699, 6.412165, 7.209089, 7.993817, 8.77398, 9.550326, 10.325767, 11.098535, 11.868375, 12.555298, 13.239144, 13.911325, 14.575757, 15.224023, 15.870794, 16.479149, 17.078614, 17.654501, 18.222094, 18.764221, 19.299777, 19.805002, 20.303831, 20.800648, 21.278843, 21.680551, 22.070196, 22.449154, 22.800617, 23.131958, 23.43504, 23.736923, 24.037557, 24.32925, 24.610009, 24.814309, 25.017526, 25.21315, 25.4079, 25.590399, 25.763095, 25.928857, 26.092665, 26.255442, 26.403963, 26.547908, 26.689722, 26.822576, 26.945766, 27.06524, 27.177091, 27.285992, 27.385448, 27.472322, 27.550186, 27.600493, 27.650737, 27.679901, 27.694959], 64, 8, 700, true], "op": "verify_paged", "out": [64, false]}, {"args": [8, 64], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 720], "op": "draft_cost_row", "out": [[1.0, 1.3898, 2.1582, 3.7004], [0, 1, 3, 7], 3.7004, 1.1, 11.2559, 1.0803624275736743]}, {"args": [0, 16, 64, [0.0480479, 0.0959084, 0.1363793, 0.1746943, 0.2064323, 0.2249958, 0.2364122, 0.2440138, 0.2455526]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 16, 64, [0.0478279, 0.093325, 0.1341087, 0.1684592, 0.2002866, 0.231364, 0.2586298, 0.2663951, 0.2708086]], "op": "tree_width", "out": [6, 64, true]}, {"args": [16, 2], "op": "verify_count", "out": 2}, {"args": [[0.80163, 1.338116, 1.841315, 2.33456], 4, 16, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 532], "op": "draft_cost_row", "out": [[1.0, 1.2412, 1.7333, 2.7112], [0, 1, 3, 7], 2.7112, 1.3, 12.4976, 1.3459947811530697]}, {"args": [0, 8, 64, [0.0018157, 0.0033108, 0.0045885, 0.0058139, 0.0067452, 0.0073599, 0.0079421, 0.0084731, 0.0086972]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.0016827, 0.0033442, 0.004822, 0.0058712, 0.0067943, 0.0076344, 0.0081821, 0.0084866, 0.0085526]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 27], "op": "verify_count", "out": 27}, {"args": [[0.996199, 1.951185, 2.894621, 3.800842, 4.698079, 5.594054, 6.473977, 7.352288, 8.218185, 9.073265, 9.92301, 10.76067, 11.525425, 12.175407, 12.790686, 13.380186, 13.961906, 14.519131, 15.064981, 15.591193, 16.102119, 16.529688, 16.934515, 17.32396, 17.696712, 18.065154, 18.397003, 18.688689, 18.950205, 19.187776, 19.40012, 19.576099, 19.6602], 33, 8, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [8, 32], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 2151], "op": "draft_cost_row", "out": [[1.0, 1.5014, 2.4973, 4.4974], [0, 1, 3, 7], 4.4974, 1.1, 11.2447, 1.0796743127634447]}, {"args": [0, 32, 64, [0.1640824, 0.3202838, 0.4648414, 0.6049154, 0.7209006, 0.7521348, 0.7801296, 0.7942576, 0.8046486]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.1739302, 0.2978652, 0.3804464, 0.4509858, 0.5211996, 0.562273, 0.5686344, 0.5704778, 0.5719506]], "op": "tree_width", "out": [6, 64, true]}, {"args": [32, 37], "op": "verify_count", "out": 37}, {"args": [[0.991321, 1.97513, 2.921589, 3.859006, 4.792141, 5.71452, 6.628162, 7.517068, 8.383238, 9.238083, 10.072111, 10.885441, 11.697302, 12.494852, 13.262931, 13.991675, 14.714029, 15.428905, 16.133826, 16.800146, 17.465648, 18.126833, 18.773801, 19.392242, 20.009451, 20.578479, 21.141975, 21.697118, 22.250382, 22.780154, 23.219264, 23.655288, 24.081371, 24.507346, 24.929181, 25.350361, 25.746761, 26.088146, 26.42387, 26.74305, 27.050906, 27.337746, 27.618625, 27.890761, 28.146481, 28.397995, 28.645166, 28.889004, 29.130391, 29.349479, 29.558656, 29.76117, 29.962176, 30.15926, 30.34743, 30.528415, 30.672235, 30.751151, 30.823109, 30.891595, 30.940562, 30.982224, 31.018545, 31.046995], 2, 32, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 366], "op": "draft_cost_row", "out": [[1.0, 1.5614, 2.6772, 4.918], [0, 1, 3, 7], 4.918, 1.1, 9.2394, 1.2639657448511255]}, {"args": [0, 32, 64, [0.0018842, 0.0037209, 0.005368, 0.0067244, 0.0074476, 0.0081282, 0.008543, 0.0087401, 0.0088522]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.00173, 0.0034556, 0.004725, 0.0054641, 0.0061283, 0.0065707, 0.0070121, 0.0071476, 0.0072747]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 22], "op": "verify_count", "out": 22}, {"args": [[0.847235, 1.381184], 2, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1448], "op": "draft_cost_row", "out": [[1.0, 1.0764, 1.2283, 1.5348], [0, 1, 3, 7], 1.5348, 1.3, 14.2691, 1.6655354240409]}, {"args": [0, 2, 64, [0.0099123, 0.0193278, 0.0280076, 0.0357463, 0.0431017, 0.0503939, 0.0560084, 0.0600745, 0.0611728]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.0094287, 0.0177524, 0.0238894, 0.0297003, 0.0336694, 0.0359039, 0.0377752, 0.0392876, 0.0406574]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 31], "op": "verify_count", "out": 31}, {"args": [[0.957816, 1.894219, 2.808884, 3.652373, 4.458051, 5.215621, 5.960787, 6.672449, 7.361069, 8.011779, 8.654604, 9.286527, 9.913365, 10.474593, 11.003075, 11.5292, 12.013172, 12.454949, 12.873983, 13.239659, 13.599564, 13.872295, 14.141627, 14.397684, 14.591443, 14.784924, 14.946805, 15.106983, 15.206138, 15.303403, 15.360956, 15.407969, 15.439408], 33, 2, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [2, 32], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1767], "op": "draft_cost_row", "out": [[1.0, 1.1397, 1.4196, 1.9783], [0, 1, 3, 7], 1.9783, 1.3, 13.818, 1.0214974274055237]}, {"args": [0, 4, 64, [0.0018548, 0.0034662, 0.0050012, 0.0061632, 0.0072761, 0.0083391, 0.0092498, 0.0101154, 0.0106787]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.0012829, 0.0024931, 0.0035868, 0.0046582, 0.0057241, 0.0062365, 0.0064505, 0.0066558, 0.0066985]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 31], "op": "verify_count", "out": 31}, {"args": [[0.984537, 1.946408, 2.901869, 3.840121, 4.773386, 5.704256, 6.57476, 7.437502, 8.297604, 9.155014, 9.979486, 10.766434, 11.537014, 12.286507, 13.026116, 13.750706, 14.403191, 15.05326, 15.685929, 16.293805, 16.897881, 17.488074, 18.071011, 18.624263, 19.15956, 19.678276, 20.179395, 20.665201, 21.149425, 21.630822, 22.08023, 22.51121, 22.938421, 23.351877, 23.752474, 24.097537, 24.425901, 24.749956, 25.071018, 25.378876, 25.686556, 25.980205, 26.262975, 26.525071, 26.721098, 26.899925, 27.058222, 27.211769, 27.356249, 27.4985, 27.639492, 27.762523, 27.884423, 27.990346, 28.085367, 28.178683, 28.266084, 28.35098, 28.420774, 28.476283, 28.517899, 28.538728, 28.553336, 28.554645], 33, 4, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [4, 32], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1916], "op": "draft_cost_row", "out": [[1.0, 1.5045, 2.5084, 4.5243], [0, 1, 3, 7], 4.5243, 1.1, 11.1124, 1.071508466077834]}, {"args": [0, 32, 64, [0.0019988, 0.0038767, 0.0056886, 0.0074541, 0.0089385, 0.0099727, 0.0109871, 0.0118665, 0.0125441]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.0018536, 0.0036861, 0.0052509, 0.0066875, 0.0080927, 0.0087411, 0.0091487, 0.0094153, 0.0095688]], "op": "tree_width", "out": [6, 64, true]}, {"args": [32, 22], "op": "verify_count", "out": 22}, {"args": [[0.965583, 1.877977, 2.656595, 2.986355, 3.306036, 3.595078, 3.825215, 3.996741], 8, 32, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [32, 4], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1022], "op": "draft_cost_row", "out": [[1.0, 1.5367, 2.6028, 4.744], [0, 1, 3, 7], 4.744, 1.1, 10.0796, 1.3403901647628291]}, {"args": [0, 32, 64, [0.0390232, 0.0729887, 0.1063031, 0.1363999, 0.1663413, 0.179731, 0.1878691, 0.1931376, 0.1982911]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 32, 64, [0.0485474, 0.0947389, 0.1398714, 0.1826403, 0.2253626, 0.267221, 0.3017054, 0.3351462, 0.3425144]], "op": "tree_width", "out": [4, 64, true]}, {"args": [32, 37], "op": "verify_count", "out": 37}, {"args": [[0.993829, 1.984048, 2.973258, 3.957128, 4.923638, 5.858861, 6.781535, 7.67235, 8.556282, 9.434412, 10.302062, 11.057032, 11.722445, 12.364503, 13.003698, 13.574728, 14.133902, 14.599455, 15.05759, 15.494394, 15.916854, 16.319051, 16.699796, 17.010532, 17.29766, 17.516943, 17.689966, 17.820486, 17.922992, 17.972328, 18.015374, 18.052364, 18.063617], 33, 32, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [32, 16], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 2001], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.6885092907479695]}, {"args": [0, 1, 64, [0.1939234, 0.3651968, 0.5319034, 0.6763946, 0.809104, 0.9043578, 0.9558806, 0.9977542, 1.020687]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.1447556, 0.2534964, 0.3506756, 0.4287488, 0.5046736, 0.5766982, 0.6324324, 0.6784216, 0.7067072]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 36], "op": "verify_count", "out": 36}, {"args": [[0.714029], 1, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 2038], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.0]}, {"args": [0, 1, 64, [0.0016811, 0.0032992, 0.004298, 0.0049107, 0.0054972, 0.0058938, 0.0062044, 0.0063829, 0.0063866]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0018512, 0.0035758, 0.0051168, 0.0065033, 0.0077698, 0.0089797, 0.009529, 0.0099661, 0.0100953]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 1, 64, [0.0019816, 0.0038427, 0.0054349, 0.0061152, 0.006593, 0.0069946, 0.0073802, 0.0075906, 0.0076903]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 1, 64, [0.0017968, 0.0033752, 0.0048163, 0.00613, 0.007424, 0.0081583, 0.0086144, 0.0090252, 0.0093582]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 55], "op": "verify_count", "out": 55}, {"args": [[0.98058, 1.956158, 2.87474, 3.763597, 4.649318, 5.532078, 6.39621, 7.237339, 8.072457, 8.877906, 9.673847, 10.454918, 11.23289, 12.004942, 12.763449, 13.485517, 14.190322, 14.890326, 15.542298, 16.180085, 16.78222, 17.379027, 17.971383, 18.559349, 19.147148, 19.728044, 20.298034, 20.852572, 21.384979, 21.915359, 22.427306, 22.935528, 23.425631, 23.910524, 24.33339, 24.750942, 25.164627, 25.563804, 25.958358, 26.35101, 26.738233, 27.073234, 27.391614, 27.698438, 27.971698, 28.23549, 28.491081, 28.746427, 28.99497, 29.214839, 29.42304, 29.611734, 29.787426, 29.959001, 30.110952, 30.240697, 30.3596, 30.475329, 30.589148, 30.682439, 30.774993, 30.86689, 30.923481, 30.929007], 1, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1014], "op": "draft_cost_row", "out": [[1.0, 1.1413, 1.4244, 1.9895], [0, 1, 3, 7], 1.9895, 1.3, 13.6232, 1.0]}, {"args": [0, 4, 64, [0.852074, 1.60731, 2.246834, 2.785407, 3.202473, 3.600508, 3.933244, 4.22902, 4.383583]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.976438, 1.866768, 2.618206, 3.338703, 3.993465, 4.506719, 4.626633, 4.720481, 4.729055]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 4, 64, [0.94022, 1.840981, 2.722895, 3.554575, 4.295122, 4.998318, 5.445309, 5.885338, 6.024242]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 4, 64, [0.871302, 1.731379, 2.476491, 2.981555, 3.402571, 3.771783, 4.075735, 4.294196, 4.362174]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 4, 64, [0.999874, 1.888605, 2.720363, 3.470423, 4.107321, 4.633906, 5.026559, 5.150281, 5.221602]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 4, 64, [0.991409, 1.738071, 2.431003, 3.089665, 3.587938, 4.053913, 4.374248, 4.68788, 4.739493]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 4, 64, [0.80328, 1.549353, 2.160457, 2.666683, 3.033999, 3.392106, 3.704513, 3.850405, 3.908287]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 3], "op": "verify_count", "out": 3}, {"args": [[0.917251, 1.472125, 1.768631, 2.057572], 4, 4, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1192], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1194, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5569, 1.2637331473598616]}, {"args": [0, 1, 64, [0.1727664, 0.3042732, 0.4059954, 0.5064576, 0.6012878, 0.6489984, 0.6803562, 0.6930936, 0.7033526]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.1899188, 0.3616764, 0.5007612, 0.6299936, 0.7507638, 0.866547, 0.9294176, 0.9796218, 1.0091666]], "op": "tree_width", "out": [8, 64, false]}, {"args": [2, 1, 64, [0.1969458, 0.3811014, 0.5266894, 0.6595502, 0.778953, 0.88256, 0.9720504, 1.0143886, 1.0356192]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 1, 64, [0.15421, 0.2925122, 0.4293684, 0.4982922, 0.5664394, 0.6242646, 0.6748532, 0.7005828, 0.7170368]], "op": "tree_width", "out": [8, 64, false]}, {"args": [4, 1, 64, [0.1756532, 0.258238, 0.3359372, 0.3908212, 0.4316674, 0.4721712, 0.5112166, 0.533319, 0.5464902]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 1, 64, [0.1714766, 0.2967754, 0.4168872, 0.534798, 0.647165, 0.7527336, 0.7982336, 0.8299718, 0.8382494]], "op": "tree_width", "out": [8, 64, false]}, {"args": [6, 1, 64, [0.171111, 0.3250386, 0.4765582, 0.5993934, 0.657602, 0.7157158, 0.7541242, 0.7913142, 0.7944674]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 14], "op": "verify_count", "out": 14}, {"args": [[0.996666, 1.936963, 2.875024, 3.812555, 4.734228, 5.653522, 6.54285, 7.397433, 8.250607, 9.099229, 9.938333, 10.745829, 11.540301, 12.327598, 13.108779, 13.88675, 14.658556, 15.42347, 16.174653, 16.887146, 17.543, 18.198465, 18.851326, 19.488004, 20.09217, 20.669726, 21.227613, 21.783361, 22.301976, 22.795921, 23.277928, 23.718619, 24.137737, 24.555749, 24.903156, 25.231891, 25.56014, 25.861648, 26.1563, 26.445388, 26.724449, 27.002925, 27.262911, 27.516448, 27.764444, 27.988902, 28.203565, 28.399151, 28.567258, 28.714097, 28.850326, 28.986396, 29.106944, 29.224216, 29.340849, 29.449717, 29.55225, 29.622129, 29.680941, 29.739452, 29.784464, 29.819031, 29.849305, 29.870705], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1754], "op": "draft_cost_row", "out": [[1.0, 1.0763, 1.228, 1.5341], [0, 1, 3, 7], 1.5341, 1.3, 14.304, 1.0]}, {"args": [0, 2, 64, [0.888218, 1.709318, 2.524709, 3.197932, 3.843231, 4.460191, 5.030403, 5.400124, 5.721792]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.850612, 1.559718, 2.171871, 2.775542, 3.224736, 3.659414, 3.894443, 4.128978, 4.22133]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 2, 64, [0.958056, 1.815023, 2.453833, 2.791145, 3.094214, 3.319562, 3.411353, 3.487879, 3.521019]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 2, 64, [0.934804, 1.861582, 2.631783, 3.269667, 3.806497, 4.164341, 4.484514, 4.730113, 4.752577]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 2, 64, [0.887801, 1.679762, 2.311169, 2.886765, 3.452806, 3.851859, 4.237981, 4.573334, 4.730376]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 2, 64, [0.803757, 1.567276, 2.236667, 2.588028, 2.929097, 3.250904, 3.543915, 3.70774, 3.732939]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 2, 64, [0.933307, 1.806303, 2.635652, 3.367826, 3.943405, 4.374378, 4.656115, 4.893846, 5.063716]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [2, 26], "op": "verify_count", "out": 26}, {"args": [[0.97497, 1.90774, 2.784735, 3.651608, 4.000814, 4.33558, 4.662081, 4.93], 8, 2, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1342], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2284, 1.5352], [0, 1, 3, 7], 1.5352, 1.3, 14.2562, 1.0404102031165163]}, {"args": [0, 2, 64, [0.0018571, 0.0035112, 0.0050007, 0.0063762, 0.0076418, 0.0085869, 0.0091892, 0.0096786, 0.0101462]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.0015215, 0.0028118, 0.003906, 0.0047573, 0.0055133, 0.0059221, 0.0061446, 0.0063029, 0.0064405]], "op": "tree_width", "out": [6, 64, true]}, {"args": [2, 27], "op": "verify_count", "out": 27}, {"args": [[0.161696], 1, 2, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 827], "op": "draft_cost_row", "out": [[1.0, 1.2397, 1.7279, 2.699], [0, 1, 3, 7], 2.699, 1.3, 12.6217, 1.0]}, {"args": [0, 8, 64, [0.0019145, 0.0036285, 0.0052599, 0.0066479, 0.0078698, 0.0087272, 0.0095464, 0.0103634, 0.0104602]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.0019636, 0.0037969, 0.0055188, 0.0070176, 0.0083502, 0.0092506, 0.0095466, 0.009805, 0.0100467]], "op": "tree_width", "out": [6, 64, true]}, {"args": [8, 18], "op": "verify_count", "out": 18}, {"args": [[0.999958, 1.989306, 2.975872, 3.958479, 4.931456, 5.892509, 6.85194, 7.808868, 8.740819, 9.654256, 10.559087, 11.461785, 12.338383, 13.213969, 14.054678, 14.878896, 15.691926, 16.502143, 17.292643, 18.07567, 18.837185, 19.59818, 20.352617, 21.102917, 21.847871, 22.490884, 23.121606, 23.725563, 24.320973, 24.896682, 25.445097, 25.990197, 26.482501, 26.967895, 27.452618, 27.916922, 28.367017, 28.796435, 29.219589, 29.628491, 30.036566, 30.441531, 30.845563, 31.247131, 31.638176, 32.02032, 32.356402, 32.68095, 32.975807, 33.244459, 33.499056, 33.708848, 33.908717, 34.092764, 34.271074, 34.437387, 34.602484, 34.709235, 34.81556, 34.896778, 34.952659, 34.978374, 34.998193, 34.999307], 8, 8, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [8, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 554], "op": "draft_cost_row", "out": [[1.0, 1.5511, 2.6462, 4.8458], [0, 1, 3, 7], 4.8458, 1.1, 9.5815, 1.0]}, {"args": [0, 32, 64, [0.032, 0.0607924, 0.087019, 0.1051814, 0.1197716, 0.1341952, 0.1377227, 0.1404287, 0.1430466]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.0440147, 0.0772917, 0.1097665, 0.1413355, 0.1655918, 0.1835062, 0.1901853, 0.1942929, 0.1980637]], "op": "tree_width", "out": [6, 64, true]}, {"args": [32, 2], "op": "verify_count", "out": 2}, {"args": [[0.938005, 1.861617, 2.719391, 3.571388, 4.389383, 5.204145, 6.014789, 6.82506, 7.558053, 8.284054, 8.978425, 9.65031, 10.31925, 10.968897, 11.600059, 12.115764, 12.629705, 13.09755, 13.552881, 13.982641, 14.379965, 14.75643, 15.107416, 15.439874, 15.750848, 16.037915, 16.322793, 16.552923, 16.739707, 16.91718, 17.004828, 17.070719, 17.135386], 33, 32, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [32, 16], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 2122], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.6885092907479695]}, {"args": [0, 1, 64, [0.1897912, 0.3227588, 0.423744, 0.5212506, 0.5977014, 0.6730286, 0.7397598, 0.8040964, 0.8375054]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 1, 64, [0.1735558, 0.3369548, 0.4844146, 0.6207924, 0.7450944, 0.8358378, 0.8702678, 0.8921638, 0.9132426]], "op": "tree_width", "out": [4, 64, false]}, {"args": [2, 1, 64, [0.1978278, 0.3842572, 0.5321352, 0.6769742, 0.8019138, 0.9189622, 0.9689944, 1.0024652, 1.0309556]], "op": "tree_width", "out": [4, 64, false]}, {"args": [3, 1, 64, [0.1497174, 0.2982806, 0.430737, 0.5540684, 0.6662566, 0.725862, 0.7768008, 0.7988222, 0.7990812]], "op": "tree_width", "out": [4, 64, true]}, {"args": [1, 6], "op": "verify_count", "out": 6}, {"args": [[0.875441, 1.710801, 2.534116, 3.29885, 3.91098, 4.409563, 4.885052, 5.35907], 8, 1, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1694], "op": "draft_cost_row", "out": [[1.0, 1.1397, 1.4196, 1.9783], [0, 1, 3, 7], 1.9783, 1.3, 13.818, 1.0]}, {"args": [0, 4, 64, [0.0013789, 0.0024108, 0.0032164, 0.0040203, 0.0046827, 0.0052624, 0.0056832, 0.0060363, 0.0063704]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.0019007, 0.0035152, 0.0050757, 0.0065369, 0.007795, 0.0090274, 0.0101331, 0.0107139, 0.010717]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 4, 64, [0.0018626, 0.0034998, 0.005016, 0.0064877, 0.007854, 0.0088407, 0.0095977, 0.0099617, 0.0100491]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 4, 64, [0.0014279, 0.0028417, 0.0041019, 0.0053535, 0.0064745, 0.0074286, 0.0083392, 0.0091401, 0.0093764]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 15], "op": "verify_count", "out": 15}, {"args": [[0.934995, 1.84647, 2.733629, 3.608792, 4.346888, 5.040668, 5.655054, 6.226268, 6.776217, 7.25614, 7.73572, 8.092356, 8.403782, 8.706364, 8.828446, 8.848406], 16, 4, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [4, 16], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1464], "op": "draft_cost_row", "out": [[1.0, 1.2351, 1.7146, 2.6682], [0, 1, 3, 7], 2.6682, 1.3, 12.9179, 1.177283484061863]}, {"args": [0, 8, 64, [0.0097323, 0.0191422, 0.0284094, 0.0363642, 0.0440297, 0.0514664, 0.0583887, 0.0622688, 0.062955]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.0085798, 0.0148128, 0.0203374, 0.0244883, 0.0282265, 0.0314945, 0.0340518, 0.0365349, 0.0376287]], "op": "tree_width", "out": [6, 64, true]}, {"args": [8, 60], "op": "verify_count", "out": 60}, {"args": [[0.988819, 1.855867, 2.641317, 3.276441, 3.893595, 4.488358, 4.901232, 5.297296, 5.635652, 5.888319, 6.127123, 6.239266, 6.307632, 6.365164, 6.403649, 6.429263], 16, 8, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [8, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 674], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2782], [0, 1, 3, 7], 1.2782, 1.3, 14.5224, 1.2619980070910481]}, {"args": [0, 1, 64, [0.0064923, 0.0128835, 0.0174859, 0.0218427, 0.0250957, 0.0282072, 0.0312774, 0.0329923, 0.0330831]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0098521, 0.0194699, 0.0275252, 0.034428, 0.0387786, 0.0417616, 0.044443, 0.0451344, 0.0453651]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 47], "op": "verify_count", "out": 47}, {"args": [[0.495265], 1, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 343], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.4968, 1.0]}, {"args": [0, 1, 64, [0.568158, 1.084786, 1.534535, 1.853407, 2.137794, 2.419139, 2.630195, 2.736392, 2.841187]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.930332, 1.716779, 2.457638, 3.125007, 3.720389, 3.989209, 4.246639, 4.407639, 4.535158]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 1, 64, [0.999921, 1.530753, 1.941384, 2.030576, 2.107815, 2.15595, 2.185591, 2.213756, 2.226811]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 1, 64, [0.957764, 1.861741, 2.603698, 3.262337, 3.572757, 3.88238, 4.121442, 4.284104, 4.383577]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 1, 64, [0.666196, 1.15711, 1.589304, 1.981993, 2.229105, 2.418897, 2.520532, 2.548182, 2.566198]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 1, 64, [0.907445, 1.576707, 2.202259, 2.76125, 3.256002, 3.705745, 4.084464, 4.43131, 4.474721]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 1, 64, [0.936716, 1.788536, 2.56364, 3.332391, 4.030134, 4.684145, 4.885607, 4.936064, 4.982026]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 50], "op": "verify_count", "out": 50}, {"args": [[0.92195, 1.54974, 2.071943, 2.453537, 2.758654, 3.002802, 3.08471, 3.090121], 8, 1, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 2310], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.0]}, {"args": [0, 1, 64, [0.893938, 1.604515, 2.31046, 2.744623, 3.117435, 3.367901, 3.613102, 3.858096, 3.872418]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.899306, 1.793297, 2.631604, 3.145019, 3.419753, 3.672804, 3.813196, 3.93107, 3.947585]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 1, 64, [0.836895, 1.599194, 2.221195, 2.835244, 3.312321, 3.601971, 3.816633, 3.878307, 3.927562]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 1, 64, [0.700955, 1.381068, 2.047649, 2.628589, 3.179938, 3.696218, 4.187373, 4.606748, 4.617102]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 1, 64, [0.682396, 1.293979, 1.832881, 2.130031, 2.419338, 2.6599, 2.848469, 2.949154, 3.011659]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 1, 64, [0.955553, 1.861177, 2.582926, 3.165793, 3.473883, 3.777435, 4.05972, 4.084001, 4.092029]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 1, 64, [0.994844, 1.940392, 2.735646, 3.377686, 3.961691, 4.364655, 4.74595, 4.916419, 4.977513]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 9], "op": "verify_count", "out": 9}, {"args": [[0.99405, 1.817417, 2.446511, 3.05333, 3.614961, 4.065571, 4.500711, 4.904847, 5.235482, 5.500161, 5.70471, 5.858695, 5.937925, 5.994431, 6.031741, 6.035076], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1413], "op": "draft_cost_row", "out": [[1.0, 1.0764, 1.2283, 1.5348], [0, 1, 3, 7], 1.5348, 1.3, 14.2691, 1.0]}, {"args": [0, 2, 64, [0.0308238, 0.0560867, 0.0788507, 0.0960988, 0.1126252, 0.1279511, 0.1425523, 0.1470749, 0.1471046]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.0496256, 0.0897509, 0.1246468, 0.1563833, 0.1855324, 0.2120029, 0.2375596, 0.2584347, 0.2657951]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 2, 64, [0.0485978, 0.0776029, 0.1025721, 0.1215259, 0.1396128, 0.1496527, 0.1595647, 0.1666455, 0.1711625]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 2, 64, [0.0352328, 0.0704413, 0.100311, 0.1273387, 0.151089, 0.1633187, 0.1720308, 0.179367, 0.1794207]], "op": "tree_width", "out": [6, 64, true]}, {"args": [2, 15], "op": "verify_count", "out": 15}, {"args": [[0.992543, 1.98213, 2.949889, 3.904919, 4.851763, 5.788233, 6.700167, 7.604079, 8.49232, 9.379515, 10.261901, 11.143467, 12.021661, 12.881842, 13.703247, 14.495147, 15.264027, 16.011425, 16.756457, 17.469507, 18.171323, 18.845469, 19.481364, 20.069733, 20.654003, 21.226013, 21.785115, 22.336337, 22.838124, 23.322467, 23.806079, 24.228705, 24.63525, 25.009057, 25.372137, 25.729199, 26.06481, 26.395264, 26.721116, 27.032826, 27.339399, 27.643894, 27.912063, 28.179606, 28.433132, 28.680631, 28.905781, 29.109781, 29.311094, 29.496416, 29.676004, 29.851732, 30.009685, 30.160834, 30.311875, 30.462129, 30.592589, 30.713716, 30.828701, 30.93635, 31.038296, 31.129149, 31.183599, 31.211232], 4, 2, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 813], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5296, 1.0519670080163106]}, {"args": [0, 1, 64, [0.732684, 1.401406, 1.902955, 2.400048, 2.85951, 3.155651, 3.414573, 3.66187, 3.798767]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.99814, 1.870633, 2.595319, 3.2874, 3.968704, 4.401486, 4.776823, 5.130675, 5.36828]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 1, 64, [0.636562, 1.16297, 1.531926, 1.785553, 2.031947, 2.269234, 2.482804, 2.623425, 2.707544]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 1, 64, [0.98359, 1.794586, 2.589181, 3.365269, 4.050428, 4.653081, 5.226663, 5.736812, 6.106648]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 1, 64, [0.876736, 1.623229, 2.279739, 2.826567, 3.365312, 3.676992, 3.909502, 4.047796, 4.175295]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 1, 64, [0.910235, 1.638829, 2.102842, 2.566809, 2.956872, 3.139932, 3.294317, 3.40266, 3.414629]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 1, 64, [0.858687, 1.509792, 2.078639, 2.616069, 2.983023, 3.330106, 3.601307, 3.860514, 3.943518]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 8], "op": "verify_count", "out": 8}, {"args": [[0.98387, 1.965, 2.895459, 3.823988, 4.738804, 5.64452, 6.546994, 7.448708, 8.342948, 9.217794, 10.082715, 10.934145, 11.763456, 12.582825, 13.398422, 14.193907, 14.989197, 15.739686, 16.46526, 17.17874, 17.89112, 18.573984, 19.24932, 19.921708, 20.501442, 21.059183, 21.588456, 22.08611, 22.57145, 23.034409, 23.484296, 23.931452, 24.377254, 24.810687, 25.231153, 25.647844, 26.048702, 26.439766, 26.752701, 27.03144, 27.302344, 27.566876, 27.825373, 28.081081, 28.328512, 28.551181, 28.763452, 28.966294, 29.151705, 29.336579, 29.520194, 29.6999, 29.860673, 30.007235, 30.150349, 30.292628, 30.403269, 30.509454, 30.596085, 30.667261, 30.737279, 30.78079, 30.820497, 30.845524], 64, 1, 700, false], "op": "verify_paged", "out": [64, false]}, {"args": [1, 64], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1003], "op": "draft_cost_row", "out": [[1.0, 1.1413, 1.4244, 1.9895], [0, 1, 3, 7], 1.9895, 1.3, 13.6232, 1.0]}, {"args": [0, 4, 64, [0.0098435, 0.019568, 0.029088, 0.0368941, 0.0433713, 0.0463287, 0.0492457, 0.0506248, 0.0509344]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.0085937, 0.0170759, 0.0233633, 0.0283797, 0.0333425, 0.0381214, 0.0399967, 0.0413322, 0.0416731]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 4, 64, [0.0092667, 0.0172949, 0.0252401, 0.0307375, 0.0361126, 0.0404768, 0.0442522, 0.047585, 0.0498877]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 4, 64, [0.0089402, 0.0169143, 0.0236517, 0.0293826, 0.0327249, 0.0354632, 0.0373324, 0.0383667, 0.0391181]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 34], "op": "verify_count", "out": 34}, {"args": [[0.900336, 1.795111, 2.627772, 3.377527], 4, 4, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 334], "op": "draft_cost_row", "out": [[1.0, 1.1426, 1.4282, 1.9985], [0, 1, 3, 7], 1.9985, 1.3, 13.4589, 1.2067551533373782]}, {"args": [0, 4, 64, [0.807119, 1.535159, 2.18957, 2.787219, 3.336127, 3.63398, 3.796003, 3.874789, 3.893172]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.822176, 1.62022, 2.380137, 2.927339, 3.471872, 3.941958, 4.332597, 4.519995, 4.665824]], "op": "tree_width", "out": [8, 64, false]}, {"args": [2, 4, 64, [0.851717, 1.414171, 1.871681, 2.290712, 2.676067, 3.035493, 3.320649, 3.509746, 3.524576]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 4, 64, [0.739116, 1.376173, 2.004306, 2.335653, 2.586541, 2.771527, 2.821829, 2.841091, 2.851336]], "op": "tree_width", "out": [8, 64, false]}, {"args": [4, 4, 64, [0.986146, 1.809538, 2.486649, 3.148888, 3.785201, 4.405096, 4.869817, 5.238976, 5.595685]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 4, 64, [0.827397, 1.584713, 2.080407, 2.448243, 2.718885, 2.939273, 3.130861, 3.20852, 3.273681]], "op": "tree_width", "out": [8, 64, false]}, {"args": [6, 4, 64, [0.979005, 1.881391, 2.737798, 3.572793, 4.376539, 5.113338, 5.550265, 5.782694, 5.983651]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 18], "op": "verify_count", "out": 18}, {"args": [[0.538127], 1, 4, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1031], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2287, 1.5359], [0, 1, 3, 7], 1.5359, 1.3, 14.218, 1.2465369103980362]}, {"args": [0, 2, 64, [0.0017218, 0.0034093, 0.0049251, 0.0060589, 0.0070512, 0.0080177, 0.0085977, 0.0090382, 0.0091923]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.0018734, 0.0036807, 0.0054413, 0.0069864, 0.0077474, 0.0084414, 0.0089904, 0.009275, 0.0093495]], "op": "tree_width", "out": [6, 64, true]}, {"args": [2, 4], "op": "verify_count", "out": 4}, {"args": [[0.985078, 1.93852, 2.88266, 3.8078, 4.728837, 5.639254, 6.537413, 7.419351, 8.288338, 9.150878, 9.988726, 10.812069, 11.620885, 12.399415, 13.168229, 13.918072, 14.659249, 15.399157, 16.133767, 16.850313, 17.553175, 18.25334, 18.952424, 19.649846, 20.335631, 21.019303, 21.637065, 22.254364, 22.862139, 23.443946, 24.008875, 24.567836, 25.09677, 25.612964, 26.094303, 26.559981, 26.972934, 27.367577, 27.75882, 28.14921, 28.47588, 28.774791, 29.069453, 29.348054, 29.599344, 29.850156, 30.096761, 30.341816, 30.561901, 30.771294, 30.962897, 31.153362, 31.341472, 31.509803, 31.673575, 31.828659, 31.952844, 32.07548, 32.197904, 32.303778, 32.400862, 32.488388, 32.55679, 32.623681], 4, 2, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1408], "op": "draft_cost_row", "out": [[1.0, 1.2351, 1.7146, 2.6682], [0, 1, 3, 7], 2.6682, 1.3, 12.9179, 1.0]}, {"args": [0, 8, 64, [0.755618, 1.447022, 2.098042, 2.676024, 3.23702, 3.743029, 4.162234, 4.236528, 4.242811]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.744285, 1.47499, 2.192645, 2.883547, 3.528276, 4.126535, 4.717569, 5.106154, 5.189508]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 8, 64, [0.999173, 1.96292, 2.698166, 3.27321, 3.80509, 4.224862, 4.636008, 5.02147, 5.210536]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 8, 64, [0.712707, 1.416341, 1.966689, 2.358679, 2.70889, 3.050922, 3.307645, 3.43251, 3.453997]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 8, 64, [0.947986, 1.885897, 2.774673, 3.464663, 4.108188, 4.646904, 5.046223, 5.301811, 5.315992]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 8, 64, [0.923991, 1.636528, 2.19746, 2.724422, 3.034869, 3.30976, 3.544032, 3.740681, 3.782111]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 8, 64, [0.963564, 1.797766, 2.567048, 3.27545, 3.917079, 4.392163, 4.818829, 5.176283, 5.204989]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [8, 14], "op": "verify_count", "out": 14}, {"args": [[0.900749, 1.737709, 2.51836, 3.258616, 3.950735, 4.631918, 5.289306, 5.942232, 6.45981, 6.938543, 7.378629, 7.760193, 7.979597, 8.183583, 8.311703, 8.384867], 16, 8, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [8, 16], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 516], "op": "draft_cost_row", "out": [[1.0, 1.0768, 1.2294, 1.5373], [0, 1, 3, 7], 1.5373, 1.3, 14.1516, 1.2431277011911595]}, {"args": [0, 2, 64, [0.0082861, 0.0161596, 0.0232945, 0.0295101, 0.0352653, 0.0402248, 0.0427037, 0.0448453, 0.0458593]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.0084113, 0.0164731, 0.0240325, 0.0314713, 0.0381579, 0.0440459, 0.049702, 0.054848, 0.0573862]], "op": "tree_width", "out": [6, 64, true]}, {"args": [2, 32], "op": "verify_count", "out": 32}, {"args": [[0.975192, 1.939806, 2.878078, 3.814179, 4.748114, 5.629461, 6.502181, 7.326385, 8.147572, 8.949679, 9.747313, 10.521738, 11.2869, 12.03537, 12.776352, 13.514853, 14.24298, 14.936708, 15.572248, 16.185554, 16.759982, 17.312454, 17.834655, 18.355183, 18.870823, 19.385368, 19.89639, 20.400196, 20.895581, 21.375774, 21.852574, 22.303449, 22.744164, 23.16434, 23.562127, 23.950387, 24.334793, 24.715226, 25.090351, 25.453351, 25.815782, 26.170961, 26.507219, 26.822032, 27.1164, 27.397371, 27.665677, 27.925129, 28.153754, 28.336085, 28.517464, 28.697876, 28.871874, 29.030863, 29.18741, 29.342875, 29.49256, 29.587508, 29.681386, 29.758441, 29.828265, 29.890322, 29.94577, 29.995777], 4, 2, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 1887], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.6004, 1.0549300008092393]}, {"args": [0, 1, 64, [0.0278556, 0.0538042, 0.0788702, 0.1032366, 0.1267013, 0.1425334, 0.1554635, 0.156798, 0.1579452]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0496588, 0.0968684, 0.142603, 0.1882499, 0.2296177, 0.2498629, 0.2604715, 0.2699039, 0.2710694]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 48], "op": "verify_count", "out": 48}, {"args": [[0.890125, 1.758752, 2.615914, 3.466086, 4.287505, 5.048029, 5.782472, 6.495919, 7.09986, 7.679488, 8.088457, 8.387755, 8.575898, 8.726931, 8.795153, 8.840486], 16, 1, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 64}, {"args": [32, 1294], "op": "draft_cost_row", "out": [[1.0, 1.5228, 2.5612, 4.6477], [0, 1, 3, 7], 4.6477, 1.1, 10.54, 1.0]}, {"args": [0, 32, 64, [0.0496424, 0.0906511, 0.1284752, 0.1604889, 0.1891556, 0.2159453, 0.2360875, 0.2536387, 0.2561014]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 32, 64, [0.0495892, 0.0984747, 0.14035, 0.1784576, 0.2139106, 0.2436568, 0.2703378, 0.2951927, 0.3109482]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 32, 64, [0.0481305, 0.0938285, 0.1320045, 0.15664, 0.1764925, 0.1942109, 0.1953274, 0.1959711, 0.1960805]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 32, 64, [0.0494136, 0.0925607, 0.1250658, 0.1404347, 0.1554604, 0.164314, 0.172951, 0.1801374, 0.1801614]], "op": "tree_width", "out": [6, 64, true]}, {"args": [32, 52], "op": "verify_count", "out": 52}, {"args": [[0.602214], 1, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 199], "op": "draft_cost_row", "out": [[1.0, 1.2438, 1.7414, 2.7304], [0, 1, 3, 7], 2.7304, 1.3, 12.306, 1.5236798117996657]}, {"args": [0, 8, 64, [0.0401912, 0.0763552, 0.1120055, 0.1472914, 0.1700521, 0.1846239, 0.199193, 0.2099612, 0.2130635]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 8, 64, [0.0489214, 0.0919852, 0.1333823, 0.1732023, 0.2071324, 0.2260989, 0.2326952, 0.2392211, 0.2440986]], "op": "tree_width", "out": [4, 64, true]}, {"args": [8, 41], "op": "verify_count", "out": 41}, {"args": [[0.936612, 1.643981, 2.19933, 2.711523, 3.192703, 3.587503, 3.777326, 3.846042], 8, 8, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [8, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 160], "op": "draft_cost_row", "out": [[1.0, 1.1428, 1.429, 2.0005], [0, 1, 3, 7], 2.0005, 1.3, 13.4235, 1.2048558648854848]}, {"args": [0, 4, 64, [0.0019274, 0.0034958, 0.0048169, 0.0061141, 0.0071765, 0.0074144, 0.0075607, 0.0076981, 0.0077199]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.0018964, 0.0037335, 0.0055138, 0.0072, 0.00885, 0.0104441, 0.0115792, 0.0124399, 0.0128856]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 13], "op": "verify_count", "out": 13}, {"args": [[0.886901, 1.396519], 2, 4, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 949], "op": "draft_cost_row", "out": [[1.0, 1.1413, 1.4244, 1.9895], [0, 1, 3, 7], 1.9895, 1.3, 13.6232, 1.2155178567179805]}, {"args": [0, 4, 64, [0.0402974, 0.0777659, 0.1139774, 0.1437223, 0.1717424, 0.1842007, 0.1887196, 0.1918306, 0.1941701]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.0482739, 0.0926151, 0.1337004, 0.1619824, 0.188086, 0.2136214, 0.235599, 0.2565249, 0.2670143]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 35], "op": "verify_count", "out": 35}, {"args": [[0.981037, 1.781673, 2.578455, 3.329714, 3.886398, 4.392802, 4.844515, 5.180553], 8, 4, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 64}, {"args": [16, 484], "op": "draft_cost_row", "out": [[1.0, 1.3947, 2.1728, 3.7345], [0, 1, 3, 7], 3.7345, 1.1, 11.0408, 1.0670601273163063]}, {"args": [0, 16, 64, [0.814571, 1.613923, 2.411413, 3.172587, 3.855837, 4.2924, 4.698384, 5.078797, 5.182705]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 16, 64, [0.960027, 1.871394, 2.675181, 3.33277, 3.944349, 4.54339, 4.891865, 5.16368, 5.353344]], "op": "tree_width", "out": [8, 64, false]}, {"args": [2, 16, 64, [0.977239, 1.876158, 2.762059, 3.407001, 3.791465, 4.124346, 4.439084, 4.59476, 4.713734]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 16, 64, [0.978024, 1.797485, 2.550532, 3.240485, 3.885068, 4.250369, 4.417275, 4.58394, 4.616946]], "op": "tree_width", "out": [8, 64, false]}, {"args": [4, 16, 64, [0.938678, 1.770178, 2.591979, 3.12846, 3.645431, 4.075204, 4.371678, 4.617052, 4.72205]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 16, 64, [0.771566, 1.505082, 2.217151, 2.762087, 3.176723, 3.503232, 3.739018, 3.905432, 3.910528]], "op": "tree_width", "out": [8, 64, false]}, {"args": [6, 16, 64, [0.784736, 1.557649, 2.298723, 3.034429, 3.609759, 4.057862, 4.332345, 4.526576, 4.601731]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 32], "op": "verify_count", "out": 32}, {"args": [[0.995274, 1.944538, 2.879498, 3.813647, 4.697202, 5.571605, 6.409401, 7.235104, 8.058173, 8.87953, 9.685391, 10.474259, 11.231068, 11.959684, 12.656239, 13.285885, 13.914101, 14.456334, 14.96563, 15.42226, 15.874118, 16.313612, 16.740794, 17.138098, 17.459061, 17.757156, 18.03534, 18.244834, 18.406978, 18.55083, 18.579586, 18.595752, 18.609573], 33, 16, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [16, 32], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1430], "op": "draft_cost_row", "out": [[1.0, 1.0764, 1.2283, 1.5348], [0, 1, 3, 7], 1.5348, 1.3, 14.2691, 1.4573434960357874]}, {"args": [0, 2, 64, [0.0454356, 0.0787585, 0.1109709, 0.1421874, 0.16461, 0.1860784, 0.1983734, 0.2075132, 0.2098838]], "op": "tree_width", "out": [4, 64, false]}, {"args": [1, 2, 64, [0.0433012, 0.0718957, 0.0977135, 0.1214498, 0.1412465, 0.1567852, 0.1697658, 0.1759862, 0.1781218]], "op": "tree_width", "out": [4, 64, true]}, {"args": [2, 30], "op": "verify_count", "out": 30}, {"args": [[0.583906], 1, 2, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 2321], "op": "draft_cost_row", "out": [[1.0, 1.1395, 1.4184, 1.9755], [0, 1, 3, 7], 1.9755, 1.3, 13.8838, 1.0243685773142328]}, {"args": [0, 4, 64, [0.921557, 1.838182, 2.644454, 3.425774, 4.197257, 4.954028, 5.492156, 5.940572, 6.136578]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.907625, 1.796903, 2.492165, 3.02189, 3.539426, 3.702058, 3.857139, 3.918604, 3.92915]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 4, 64, [0.970336, 1.882034, 2.704571, 3.361525, 3.574698, 3.714487, 3.844767, 3.927773, 3.971682]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 4, 64, [0.964258, 1.926331, 2.797121, 3.624165, 4.38195, 5.034974, 5.28778, 5.377264, 5.417582]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 4, 64, [0.98787, 1.923631, 2.72907, 3.444432, 4.075556, 4.60069, 5.06506, 5.44952, 5.723017]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 4, 64, [0.810462, 1.56021, 2.287064, 2.784177, 3.2681, 3.639387, 3.999406, 4.205693, 4.392704]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 4, 64, [0.763809, 1.511264, 2.21532, 2.824487, 3.32693, 3.826459, 4.205156, 4.401749, 4.589733]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [4, 15], "op": "verify_count", "out": 15}, {"args": [[0.953615, 1.879878, 2.803307, 3.724707, 4.645627, 5.565579, 6.43575, 7.288636, 8.13106, 8.953085, 9.768371, 10.579578, 11.361358, 12.107286, 12.832859, 13.552798, 14.16873, 14.773267, 15.375495, 15.968767, 16.558171, 17.145398, 17.726294, 18.304416, 18.875918, 19.436915, 19.99274, 20.530423, 21.047009, 21.53829, 22.0185, 22.493597, 22.930437, 23.36246, 23.782939, 24.174122, 24.558374, 24.936865, 25.287891, 25.625365, 25.942461, 26.25345, 26.554273, 26.848994, 27.117343, 27.360499, 27.593501, 27.809792, 28.017666, 28.202552, 28.365105, 28.521858, 28.677434, 28.82623, 28.963511, 29.046989, 29.128204, 29.200699, 29.257644, 29.30597, 29.335282, 29.361406, 29.371744, 29.376131], 33, 4, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [4, 32], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 64}, {"args": [2, 1614], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2281, 1.5347], [0, 1, 3, 7], 1.5347, 1.3, 14.2901, 1.2502238255356501]}, {"args": [0, 2, 64, [0.987553, 1.936033, 2.74284, 3.487555, 4.187469, 4.857978, 5.371226, 5.845872, 5.973707]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 2, 64, [0.86026, 1.685066, 2.406282, 3.085693, 3.321934, 3.505327, 3.683507, 3.75589, 3.763753]], "op": "tree_width", "out": [8, 64, false]}, {"args": [2, 2, 64, [0.983725, 1.759018, 2.419883, 3.059564, 3.515594, 3.794485, 4.004469, 4.105864, 4.121276]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 2, 64, [0.858446, 1.546626, 2.234022, 2.64897, 3.038228, 3.406176, 3.722361, 3.851628, 3.892689]], "op": "tree_width", "out": [8, 64, false]}, {"args": [4, 2, 64, [0.962308, 1.772218, 2.414807, 3.03844, 3.654146, 4.109807, 4.483672, 4.74884, 4.920775]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 2, 64, [0.956639, 1.763195, 2.481281, 3.107532, 3.654026, 4.176964, 4.623666, 5.047666, 5.42243]], "op": "tree_width", "out": [8, 64, false]}, {"args": [6, 2, 64, [0.962986, 1.89745, 2.603878, 3.040728, 3.363168, 3.678375, 3.969744, 4.181913, 4.185882]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [2, 3], "op": "verify_count", "out": 3}, {"args": [[0.984242, 1.964819, 2.91904, 3.869915, 4.809275, 5.734978, 6.650191, 7.55801, 8.455036, 9.348136, 10.210891, 11.048832, 11.884453, 12.667997, 13.388273, 14.061341, 14.721659, 15.347048, 15.948906, 16.545084, 17.114439, 17.674229, 18.231006, 18.782897, 19.3065, 19.828739, 20.32468, 20.793403, 21.249578, 21.687605, 22.114823, 22.539058, 22.961333, 23.36414, 23.764166, 24.162504, 24.533259, 24.894456, 25.231324, 25.52519, 25.811913, 26.063725, 26.298678, 26.525013, 26.742414, 26.948291, 27.138843, 27.319444, 27.497159, 27.659916, 27.817342, 27.962406, 28.10255, 28.229738, 28.332951, 28.428267, 28.522597, 28.603451, 28.679951, 28.748312, 28.815911, 28.829989, 28.843611, 28.846343], 2, 2, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [2, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 64}, {"args": [4, 1089], "op": "draft_cost_row", "out": [[1.0, 1.1411, 1.4237, 1.9876], [0, 1, 3, 7], 1.9876, 1.3, 13.658, 1.0144690712460633]}, {"args": [0, 4, 64, [0.1845376, 0.360497, 0.4986222, 0.604547, 0.6912734, 0.744137, 0.7940146, 0.8312078, 0.850082]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 4, 64, [0.1198468, 0.2247042, 0.3294004, 0.4266482, 0.5085516, 0.5863816, 0.6536324, 0.7047708, 0.7441936]], "op": "tree_width", "out": [6, 64, true]}, {"args": [4, 14], "op": "verify_count", "out": 14}, {"args": [[0.115009], 1, 4, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [4, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 64}, {"args": [1, 180], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.4879, 1.2602593953241572]}, {"args": [0, 1, 64, [0.0093259, 0.0175928, 0.0253755, 0.0330392, 0.0394299, 0.0446682, 0.0496286, 0.053891, 0.0545751]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 1, 64, [0.0099484, 0.0193945, 0.0264355, 0.0317597, 0.0370408, 0.0415911, 0.0442694, 0.0459561, 0.0461583]], "op": "tree_width", "out": [6, 64, true]}, {"args": [1, 35], "op": "verify_count", "out": 35}, {"args": [[0.92879, 1.810561, 2.686046, 3.54451, 4.244201, 4.92376, 5.603236, 6.257712, 6.910281, 7.546886, 8.150214, 8.734225, 9.282248, 9.783147, 10.273608, 10.744985, 11.149727, 11.547475, 11.940107, 12.311015, 12.669132, 13.010033, 13.314117, 13.617012, 13.916526, 14.190787, 14.361228, 14.529929, 14.652855, 14.737818, 14.813116, 14.884854, 14.893734], 33, 1, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [1, 32], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 64}, {"args": [8, 1299], "op": "draft_cost_row", "out": [[1.0, 1.2358, 1.7172, 2.6741], [0, 1, 3, 7], 2.6741, 1.3, 12.8609, 1.0]}, {"args": [0, 8, 64, [0.998882, 1.903986, 2.755894, 3.573865, 4.249104, 4.922705, 5.581523, 6.08944, 6.177999]], "op": "tree_width", "out": [6, 64, false]}, {"args": [1, 8, 64, [0.869126, 1.45167, 1.892863, 2.263108, 2.611951, 2.916985, 3.178059, 3.376583, 3.424013]], "op": "tree_width", "out": [6, 64, false]}, {"args": [2, 8, 64, [0.955446, 1.884935, 2.694012, 3.426022, 4.05628, 4.675787, 5.01426, 5.25739, 5.308199]], "op": "tree_width", "out": [6, 64, false]}, {"args": [3, 8, 64, [0.996529, 1.915394, 2.755364, 3.582196, 4.068554, 4.43062, 4.61829, 4.789162, 4.8133]], "op": "tree_width", "out": [6, 64, false]}, {"args": [4, 8, 64, [0.98062, 1.732136, 2.312191, 2.86082, 3.239515, 3.546185, 3.739, 3.909471, 4.014929]], "op": "tree_width", "out": [6, 64, false]}, {"args": [5, 8, 64, [0.99592, 1.858153, 2.716172, 3.558706, 4.109787, 4.537307, 4.833561, 5.100958, 5.157496]], "op": "tree_width", "out": [6, 64, false]}, {"args": [6, 8, 64, [0.988129, 1.965722, 2.628351, 3.260151, 3.827734, 4.331755, 4.67533, 4.843233, 4.917535]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [8, 22], "op": "verify_count", "out": 22}, {"args": [[0.994129, 1.986753, 2.961228, 3.9165, 4.856338, 5.792826, 6.719073, 7.588514, 8.399745, 9.207265, 9.990733, 10.746755, 11.416701, 12.076287, 12.724027, 13.363213, 13.949147, 14.508222, 15.028779, 15.50028, 15.948145, 16.391582, 16.829566, 17.231067, 17.562641, 17.870206, 18.118939, 18.366392, 18.549448, 18.700567, 18.848872, 18.957723, 19.016327], 33, 8, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [8, 32], "op": "record", "out": null}]}, {"case": {"eval_batch_size": 32, "node_top_k": 8, "tree_depth": 12, "verify_num": 48}, "script": [{"args": [4], "op": "history", "out": 48}, {"args": [4, 1191], "op": "draft_cost_row", "out": [[1.0, 1.1407, 1.4227, 1.9858], [0, 1, 3, 7], 1.9858, 1.3, 13.6926, 1.0159946100924238]}, {"args": [0, 4, 48, [0.0086923, 0.0171502, 0.0245971, 0.031259, 0.0377791, 0.0441887, 0.0460624, 0.0467707, 0.0470704]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.0099801, 0.0199098, 0.0287933, 0.0371372, 0.0450783, 0.0519199, 0.0545444, 0.0558073, 0.0566568]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 58], "op": "verify_count", "out": 48}, {"args": [[0.985681, 1.83562, 2.655264, 3.453522, 4.247293, 5.002297, 5.750708, 6.441631, 7.118453, 7.723951, 8.28809, 8.842316, 9.36501, 9.855867, 10.342652, 10.802111, 11.245511, 11.675334, 12.104911, 12.500669, 12.867108, 13.231311, 13.545072, 13.80178, 14.055092, 14.29077, 14.526217, 14.728844, 14.923313, 15.099947, 15.234801, 15.365582, 15.482942], 33, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 1763], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2782], [0, 1, 3, 7], 1.2782, 1.3, 14.5935, 1.2655701215546276]}, {"args": [0, 1, 48, [0.1865956, 0.3542246, 0.5154436, 0.65922, 0.7870312, 0.864969, 0.8969202, 0.9252694, 0.9339112]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.1772384, 0.3508868, 0.5216176, 0.682252, 0.8255542, 0.9082524, 0.9832038, 1.0238154, 1.0512168]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.1942606, 0.3397994, 0.4843422, 0.6077904, 0.7284904, 0.8467354, 0.9629102, 1.0347804, 1.0771236]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.1368062, 0.2655116, 0.3767422, 0.445009, 0.504074, 0.5491854, 0.5820822, 0.6045342, 0.618363]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 1, 48, [0.1995828, 0.3082458, 0.396164, 0.4647758, 0.5250764, 0.5493796, 0.567912, 0.5756776, 0.5762724]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 1, 48, [0.1669006, 0.2863524, 0.3856642, 0.4796424, 0.552982, 0.6199324, 0.6737214, 0.6892068, 0.69035]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 1, 48, [0.1939574, 0.3760378, 0.5237124, 0.6576128, 0.7609502, 0.8612256, 0.95607, 1.0153812, 1.0217292]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 1, 48, [0.1698238, 0.3066332, 0.4242356, 0.4953486, 0.5528194, 0.6045288, 0.6561918, 0.7050434, 0.745813]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 1, 48, [0.1547702, 0.3063996, 0.4263614, 0.5058882, 0.5760522, 0.6141378, 0.6314892, 0.6391106, 0.6399298]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 1, 48, [0.172713, 0.3374138, 0.4483394, 0.5444864, 0.6314786, 0.6980518, 0.755939, 0.7833366, 0.8057236]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 1, 48, [0.1979706, 0.3732592, 0.4616332, 0.5393018, 0.611507, 0.6721776, 0.7158326, 0.7414874, 0.7481624]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 1, 48, [0.1785796, 0.3393136, 0.4483942, 0.5554046, 0.6199474, 0.6458186, 0.6709458, 0.6796608, 0.6806486]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 32], "op": "verify_count", "out": 32}, {"args": [[0.97919, 1.921767, 2.853646, 3.785357, 4.703699, 5.531591, 6.353109, 7.139299, 7.902784, 8.662777, 9.363604, 10.037868, 10.665255, 11.278576, 11.825686, 12.37116, 12.903366, 13.429701, 13.953816, 14.359575, 14.756125, 15.14921, 15.539304, 15.926994, 16.29967, 16.670418, 17.004064, 17.304988, 17.581242, 17.852521, 18.116588, 18.377357, 18.616077, 18.853878, 19.048927, 19.215959, 19.376498, 19.527348, 19.676844, 19.825849, 19.92052, 20.011452, 20.08182, 20.136044, 20.18799, 20.234941, 20.275727, 20.29131], 33, 1, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [1, 32], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 1013], "op": "draft_cost_row", "out": [[1.0, 1.0767, 1.2289, 1.5365], [0, 1, 3, 7], 1.5365, 1.3, 14.2042, 1.0]}, {"args": [0, 2, 48, [0.0496623, 0.0947647, 0.1328567, 0.1596911, 0.1838935, 0.2069472, 0.2277544, 0.2408271, 0.2505224]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.0410617, 0.0705052, 0.099152, 0.1229572, 0.1417358, 0.1512717, 0.1602075, 0.1653513, 0.167061]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 2, 48, [0.0442589, 0.085985, 0.1232524, 0.1557043, 0.1817737, 0.2066204, 0.2280424, 0.2434061, 0.2541212]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 2, 48, [0.0479666, 0.0942594, 0.137373, 0.1793599, 0.204394, 0.2120812, 0.2192518, 0.221931, 0.2230324]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 33], "op": "verify_count", "out": 33}, {"args": [[0.530356, 0.774024], 2, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 2341], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.0]}, {"args": [0, 1, 48, [0.1985114, 0.379918, 0.558319, 0.6889088, 0.8105344, 0.915458, 1.017463, 1.0645472, 1.0670922]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.0933564, 0.1671532, 0.2376458, 0.3066022, 0.3633036, 0.4086238, 0.4382964, 0.4649598, 0.4835322]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.1470684, 0.2896388, 0.3989918, 0.4913822, 0.5270664, 0.5554072, 0.5804786, 0.6013768, 0.6065866]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.1718236, 0.3327978, 0.4484104, 0.5626214, 0.6680738, 0.7707248, 0.8419858, 0.8980816, 0.9115612]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 1, 48, [0.186335, 0.3719526, 0.5251016, 0.6410928, 0.7170052, 0.7824776, 0.8425058, 0.8836408, 0.9085582]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 1, 48, [0.1788888, 0.3215054, 0.4279816, 0.5242732, 0.6021808, 0.652265, 0.6644532, 0.669702, 0.6703474]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 1, 48, [0.198057, 0.3733146, 0.5413418, 0.6912676, 0.8170562, 0.9293608, 1.0355442, 1.1218348, 1.1240918]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 1, 48, [0.1983262, 0.3895066, 0.5207214, 0.646308, 0.7572212, 0.8198994, 0.8569436, 0.8889428, 0.9000562]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 1, 48, [0.1970642, 0.3510274, 0.4536802, 0.551062, 0.6385544, 0.7204376, 0.756075, 0.778342, 0.7944794]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 1, 48, [0.1640502, 0.319776, 0.4748548, 0.6248408, 0.6945758, 0.7555458, 0.815033, 0.8333388, 0.8437014]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 1, 48, [0.1678666, 0.3290694, 0.4777122, 0.620776, 0.7043146, 0.7608996, 0.8133454, 0.855701, 0.8725962]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 1, 48, [0.19937, 0.3498834, 0.4747942, 0.5945484, 0.6931556, 0.7230678, 0.7469454, 0.7669814, 0.7763884]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 6], "op": "verify_count", "out": 6}, {"args": [[0.956834, 1.877158, 2.732806, 3.573973, 4.343354, 5.055852, 5.762035, 6.45839, 7.090472, 7.635539, 8.125499, 8.603648, 9.081261, 9.517554, 9.949803, 10.378376, 10.805697, 11.215949, 11.572835, 11.921813, 12.269652, 12.598107, 12.866939, 13.059836, 13.229177, 13.389121, 13.537082, 13.677362, 13.814184, 13.93908, 14.062268, 14.11897, 14.134278], 33, 1, 700, false], "op": "verify_paged", "out": [32, false]}, {"args": [1, 32], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 632], "op": "draft_cost_row", "out": [[1.0, 1.0768, 1.2294, 1.5373], [0, 1, 3, 7], 1.5373, 1.3, 14.1516, 1.0]}, {"args": [0, 2, 48, [0.949801, 1.861575, 2.661255, 3.061453, 3.459559, 3.853336, 4.095689, 4.264169, 4.344555]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.956759, 1.809149, 2.560231, 3.072633, 3.533991, 3.986332, 4.129277, 4.232237, 4.281459]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 2, 48, [0.972123, 1.751363, 2.526161, 3.248877, 3.673464, 3.946398, 3.991117, 4.034511, 4.061395]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 2, 48, [0.908221, 1.662284, 2.278144, 2.71795, 3.11823, 3.511504, 3.902268, 4.108299, 4.298978]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 29], "op": "verify_count", "out": 29}, {"args": [[0.969149, 1.932816, 2.891885, 3.827677, 4.762863, 5.637448, 6.507991, 7.336933, 8.134568, 8.865502, 9.589561, 10.288754, 10.92796, 11.539923, 12.126757, 12.690752, 13.203031, 13.711458, 14.210882, 14.676332, 15.124074, 15.57043, 15.993365, 16.413427, 16.815511, 17.055115, 17.257258, 17.389392, 17.503068, 17.589112, 17.649025, 17.68803, 17.723815], 33, 2, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 636], "op": "draft_cost_row", "out": [[1.0, 1.0768, 1.2294, 1.5373], [0, 1, 3, 7], 1.5373, 1.3, 14.1516, 1.0]}, {"args": [0, 2, 48, [0.0019867, 0.003421, 0.004373, 0.0047611, 0.0051164, 0.0054541, 0.0055899, 0.0057233, 0.0057272]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.0018295, 0.0033908, 0.0048548, 0.0062493, 0.0074396, 0.0082149, 0.0089786, 0.0093626, 0.0094918]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 2, 48, [0.0019981, 0.0037634, 0.0053721, 0.0069067, 0.0081072, 0.009009, 0.0099052, 0.0105621, 0.0109729]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 2, 48, [0.0018756, 0.003554, 0.0051786, 0.0067621, 0.0081667, 0.0095621, 0.0107209, 0.0117286, 0.0125879]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 52], "op": "verify_count", "out": 48}, {"args": [[0.991966, 1.975443, 2.938258, 3.897027, 4.834193, 5.754742, 6.666145, 7.564253, 8.459747, 9.305179, 10.111236, 10.882719, 11.65339, 12.423848, 13.188831, 13.953079, 14.699395, 15.412466, 16.117728, 16.7799, 17.398468, 18.004092, 18.579412, 19.151049, 19.711144, 20.264173, 20.775742, 21.261723, 21.71916, 22.12835, 22.534843, 22.934579, 23.264687, 23.592939, 23.879628, 24.065006, 24.192768, 24.293136, 24.378041, 24.457498, 24.533084, 24.568625, 24.596941, 24.617291, 24.635356, 24.65333, 24.659828, 24.660533], 16, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 858], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5296, 1.0]}, {"args": [0, 1, 48, [0.0406028, 0.0749566, 0.1041154, 0.1328079, 0.1536766, 0.1679364, 0.1778078, 0.1855812, 0.189297]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.0487295, 0.0828871, 0.1117908, 0.1354088, 0.1567316, 0.1759427, 0.1912328, 0.2009009, 0.2032422]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.0473064, 0.0810873, 0.1119395, 0.1425472, 0.1530534, 0.1591605, 0.1627168, 0.1637532, 0.1642875]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.0480441, 0.0936422, 0.1335109, 0.1706732, 0.2078011, 0.2292889, 0.2457252, 0.2540252, 0.2607033]], "op": "tree_width", "out": [8, 48, true]}, {"args": [1, 7], "op": "verify_count", "out": 7}, {"args": [[0.988979, 1.959286, 2.923494, 3.870801, 4.764545, 5.657847, 6.532703, 7.399481, 8.263879, 9.105555, 9.936277, 10.706045, 11.444097, 12.175348, 12.856648, 13.529741, 14.185158, 14.83464, 15.465566, 16.025696, 16.540784, 17.055489, 17.522593, 17.965027, 18.388801, 18.810478, 19.20925, 19.565585, 19.89929, 20.193876, 20.442422, 20.684097, 20.903835, 21.110284, 21.316573, 21.507047, 21.696757, 21.86567, 21.989584, 22.112132, 22.217506, 22.321952, 22.418413, 22.509475, 22.575422, 22.639887, 22.6957, 22.707261], 4, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 48}, {"args": [8, 310], "op": "draft_cost_row", "out": [[1.0, 1.2429, 1.7386, 2.724], [0, 1, 3, 7], 2.724, 1.3, 12.3707, 1.0]}, {"args": [0, 8, 48, [0.0454815, 0.0845686, 0.1129441, 0.1402508, 0.1668217, 0.1922143, 0.2109752, 0.2240549, 0.2273556]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 8, 48, [0.0441626, 0.0814543, 0.1171895, 0.149994, 0.1708761, 0.1902327, 0.2068583, 0.214719, 0.2153683]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 8, 48, [0.0477365, 0.0837583, 0.1171658, 0.1498625, 0.1814482, 0.21179, 0.236981, 0.2568858, 0.2672017]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 8, 48, [0.0433314, 0.0781078, 0.1117452, 0.1433724, 0.1638683, 0.1840245, 0.1975455, 0.2011573, 0.2015172]], "op": "tree_width", "out": [8, 48, true]}, {"args": [8, 25], "op": "verify_count", "out": 25}, {"args": [[0.965433, 1.930405, 2.891521, 3.82056, 4.715904, 5.579626, 6.395402, 7.180299, 7.939824, 8.591134, 9.202521, 9.789448, 10.363041, 10.933273, 11.474913, 11.939624, 12.385919, 12.817636, 13.240554, 13.655852, 14.070302, 14.469088, 14.843728, 15.195087, 15.532245, 15.863375, 16.17869, 16.472578, 16.765686, 17.052988, 17.315395, 17.575186, 17.834003, 18.089228, 18.327963, 18.560002, 18.763436, 18.945976, 19.12321, 19.29513, 19.442102, 19.531157, 19.617659, 19.697705, 19.767576, 19.797343, 19.816988, 19.833251], 4, 8, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 1966], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], 1.2784, 1.3, 14.6097, 1.2663819680609771]}, {"args": [0, 1, 48, [0.841405, 1.481907, 1.978964, 2.273583, 2.533313, 2.731169, 2.900575, 2.97362, 3.010428]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.916502, 1.772903, 2.504558, 3.13652, 3.626678, 4.095099, 4.470114, 4.79242, 4.825283]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.831082, 1.654471, 2.476287, 3.294621, 3.909197, 4.476931, 5.014691, 5.359778, 5.563309]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.930379, 1.81932, 2.708174, 3.469795, 4.177539, 4.744523, 5.151505, 5.429922, 5.439892]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 1, 48, [0.735919, 1.416825, 2.085017, 2.703082, 3.142807, 3.447986, 3.528612, 3.602632, 3.655738]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 1, 48, [0.962096, 1.817453, 2.305085, 2.514641, 2.697348, 2.825445, 2.950998, 2.988563, 3.000508]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 1, 48, [0.957187, 1.76484, 2.447449, 2.891975, 3.188353, 3.421225, 3.458791, 3.494895, 3.507224]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 1, 48, [0.927491, 1.561092, 2.106539, 2.58367, 2.858134, 3.04229, 3.226306, 3.256895, 3.284086]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 1, 48, [0.636275, 1.019919, 1.344145, 1.664386, 1.947468, 2.217537, 2.444532, 2.669704, 2.833456]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 1, 48, [0.960449, 1.908027, 2.776247, 3.449947, 4.118198, 4.651036, 5.118901, 5.500958, 5.633606]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 1, 48, [0.901892, 1.579788, 2.195541, 2.66908, 3.141225, 3.408193, 3.480371, 3.537601, 3.582685]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 1, 48, [0.894783, 1.673763, 2.264164, 2.737159, 3.082745, 3.37306, 3.662785, 3.91656, 4.043719]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 54], "op": "verify_count", "out": 48}, {"args": [[0.84099, 1.614877, 2.226902, 2.744357, 3.170496, 3.411008, 3.580161, 3.643466], 8, 1, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 1333], "op": "draft_cost_row", "out": [[1.0, 1.0404, 1.1193, 1.2782], [0, 1, 3, 7], 1.2782, 1.3, 14.5667, 1.0]}, {"args": [0, 1, 48, [0.0099568, 0.0194311, 0.025302, 0.0309166, 0.0360436, 0.0411504, 0.0447919, 0.0481814, 0.0492056]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.0099169, 0.0183692, 0.0258103, 0.0316621, 0.0374754, 0.0425097, 0.0464159, 0.0489284, 0.0510132]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.0091719, 0.0177652, 0.0248733, 0.0317776, 0.0385072, 0.0446782, 0.0479249, 0.0495025, 0.0500699]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.0091252, 0.0174366, 0.0252274, 0.0321297, 0.037369, 0.041656, 0.0457777, 0.0483819, 0.0488407]], "op": "tree_width", "out": [8, 48, true]}, {"args": [1, 29], "op": "verify_count", "out": 29}, {"args": [[0.968323, 1.915877, 2.844079, 3.745287, 4.622635, 5.477092, 6.314035, 7.131919, 7.934109, 8.688605, 9.404571, 10.100438, 10.628079, 11.118805, 11.582003, 12.032616, 12.424005, 12.807043, 13.163144, 13.505572, 13.846809, 14.178032, 14.499605, 14.778749, 15.051238, 15.314696, 15.550193, 15.778321, 15.982705, 16.177466, 16.297541, 16.410429, 16.44762], 33, 1, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [1, 32], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 48}, {"args": [8, 184], "op": "draft_cost_row", "out": [[1.0, 1.2438, 1.7414, 2.7304], [0, 1, 3, 7], 2.7304, 1.3, 12.306, 1.0]}, {"args": [0, 8, 48, [0.0019579, 0.0039057, 0.0058232, 0.0069263, 0.0079262, 0.00884, 0.0093072, 0.0094972, 0.0095857]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 8, 48, [0.0019913, 0.0039581, 0.005071, 0.0060699, 0.0069865, 0.0078401, 0.0083945, 0.0088266, 0.0088853]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 8, 48, [0.0018303, 0.0036098, 0.0048246, 0.005942, 0.0066107, 0.0072273, 0.0075859, 0.0078386, 0.0080827]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 8, 48, [0.0013832, 0.0025389, 0.0036627, 0.004667, 0.0056659, 0.0062944, 0.0067239, 0.0070805, 0.0074338]], "op": "tree_width", "out": [8, 48, true]}, {"args": [8, 58], "op": "verify_count", "out": 48}, {"args": [[0.899004, 1.730557, 2.549104, 3.34568, 3.993461, 4.571801, 5.098683, 5.460919, 5.801661, 6.132453, 6.417257, 6.659223, 6.869747, 7.043064, 7.160163, 7.188756], 16, 8, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [8, 16], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 48}, {"args": [8, 591], "op": "draft_cost_row", "out": [[1.0, 1.2412, 1.7333, 2.7112], [0, 1, 3, 7], 2.7112, 1.3, 12.4976, 1.153709812416917]}, {"args": [0, 8, 48, [0.0497672, 0.0984405, 0.1457099, 0.1808132, 0.2146177, 0.2470226, 0.2747351, 0.294166, 0.3050053]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 8, 48, [0.0495596, 0.0975607, 0.1451043, 0.1924752, 0.2274102, 0.2546653, 0.2795175, 0.3002597, 0.3151553]], "op": "tree_width", "out": [8, 48, true]}, {"args": [8, 7], "op": "verify_count", "out": 7}, {"args": [[0.10824, 0.201558], 2, 8, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 860], "op": "draft_cost_row", "out": [[1.0, 1.1415, 1.4251, 1.9912], [0, 1, 3, 7], 1.9912, 1.3, 13.5912, 1.2138179046893234]}, {"args": [0, 4, 48, [0.0437855, 0.0838281, 0.1220558, 0.1559081, 0.1891224, 0.2211551, 0.2447978, 0.2617924, 0.2769104]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.0494971, 0.0976195, 0.1432294, 0.1700069, 0.1967657, 0.2194501, 0.225146, 0.2305983, 0.2354639]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 63], "op": "verify_count", "out": 48}, {"args": [[0.728167, 1.389026, 1.633941, 1.685215], 4, 4, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 48}, {"args": [8, 1217], "op": "draft_cost_row", "out": [[1.0, 1.2365, 1.7196, 2.6797], [0, 1, 3, 7], 2.6797, 1.3, 12.7934, 1.170363548762861]}, {"args": [0, 8, 48, [0.0099385, 0.0190316, 0.0274351, 0.0352798, 0.0403924, 0.044975, 0.0481477, 0.0504141, 0.0508499]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 8, 48, [0.0099985, 0.0188401, 0.0274601, 0.0344789, 0.0412613, 0.0463907, 0.0483697, 0.0495187, 0.0496965]], "op": "tree_width", "out": [8, 48, true]}, {"args": [8, 36], "op": "verify_count", "out": 36}, {"args": [[0.993385, 1.951863, 2.909038, 3.752445, 4.583415, 5.369045, 5.966459, 6.557199, 7.101023, 7.515641, 7.892727, 8.22429, 8.523413, 8.784515, 8.941877, 9.080934], 16, 8, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [8, 16], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 2194], "op": "draft_cost_row", "out": [[1.0, 1.3668, 2.0901, 3.5431], [0, 1, 3, 7], 3.5431, 1.3, 12.2522, 1.1396617905135153]}, {"args": [0, 16, 48, [0.001755, 0.0034213, 0.005044, 0.0059883, 0.0064847, 0.0069173, 0.0072106, 0.0074366, 0.0074385]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 16, 48, [0.0019783, 0.0039155, 0.0052805, 0.0063444, 0.0073627, 0.0079142, 0.0082588, 0.00857, 0.0086641]], "op": "tree_width", "out": [8, 48, true]}, {"args": [16, 43], "op": "verify_count", "out": 43}, {"args": [[0.969845, 1.925381, 2.675316, 3.230809, 3.759037, 4.212236, 4.662762, 4.803412], 8, 16, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 1158], "op": "draft_cost_row", "out": [[1.0, 1.1407, 1.4227, 1.9858], [0, 1, 3, 7], 1.9858, 1.3, 13.6926, 1.4223924541293933]}, {"args": [0, 4, 48, [0.933275, 1.546593, 2.082068, 2.58664, 2.896694, 3.191001, 3.455072, 3.533214, 3.600842]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 4, 48, [0.773599, 1.508974, 2.066938, 2.586605, 3.100453, 3.463174, 3.619068, 3.709523, 3.757035]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 53], "op": "verify_count", "out": 48}, {"args": [[0.997105, 1.993085, 2.972379, 3.928394, 4.874931, 5.755272, 6.624718, 7.493161, 8.361406, 9.209414, 10.049357, 10.875672, 11.653439, 12.425526, 13.124096, 13.806356, 14.444558, 15.067375, 15.672515, 16.271225, 16.860692, 17.429053, 17.939271, 18.390785, 18.829968, 19.268513, 19.698468, 20.127789, 20.523882, 20.919948, 21.305405, 21.688056, 22.068728, 22.444531, 22.779345, 23.067133, 23.292059, 23.468826, 23.639218, 23.80772, 23.960198, 24.07418, 24.186781, 24.281842, 24.365752, 24.431224, 24.483037, 24.531744], 2, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 157], "op": "draft_cost_row", "out": [[1.0, 1.1428, 1.429, 2.0005], [0, 1, 3, 7], 2.0005, 1.3, 13.4235, 1.2048558648854848]}, {"args": [0, 4, 48, [0.009162, 0.0158161, 0.0219575, 0.0280902, 0.0331002, 0.0368696, 0.0387099, 0.0394292, 0.0396624]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.009768, 0.0190497, 0.0275247, 0.035512, 0.0424465, 0.0472559, 0.0516551, 0.0555073, 0.0588114]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 16], "op": "verify_count", "out": 16}, {"args": [[0.864241], 1, 4, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 1567], "op": "draft_cost_row", "out": [[1.0, 1.14, 1.4204, 1.9804], [0, 1, 3, 7], 1.9804, 1.3, 13.7841, 1.224016623204407]}, {"args": [0, 4, 48, [0.0017627, 0.0030633, 0.004242, 0.0052716, 0.0062735, 0.0071866, 0.0079797, 0.0081953, 0.0082992]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.0019392, 0.0035629, 0.0051146, 0.0062924, 0.0073386, 0.0081663, 0.0088528, 0.0095006, 0.0099803]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 23], "op": "verify_count", "out": 23}, {"args": [[0.998775, 1.856974, 2.463639, 3.050692, 3.528478, 3.995727, 4.262968, 4.485095], 8, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 1653], "op": "draft_cost_row", "out": [[1.0, 1.14, 1.4204, 1.9804], [0, 1, 3, 7], 1.9804, 1.3, 13.7841, 1.224016623204407]}, {"args": [0, 4, 48, [0.922557, 1.727737, 2.352574, 2.881042, 3.406315, 3.847347, 4.113306, 4.250078, 4.344464]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.949152, 1.773469, 2.373225, 2.944664, 3.430458, 3.91316, 4.301893, 4.574863, 4.713316]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 11], "op": "verify_count", "out": 11}, {"args": [[0.978066, 1.939192, 2.894051, 3.757619, 4.564534, 5.35847, 6.148778, 6.919927, 7.644084, 8.342266, 9.021526, 9.680721, 10.329724, 10.975525, 11.579915, 12.139184, 12.687854, 13.194824, 13.647381, 14.09078, 14.496033, 14.898763, 15.269873, 15.636665, 15.99344, 16.344496, 16.691494, 17.00222, 17.253318, 17.489853, 17.715918, 17.939612, 18.160723, 18.372395, 18.583168, 18.769183, 18.929113, 19.087644, 19.245994, 19.398707, 19.535658, 19.664477, 19.764023, 19.861332, 19.891616, 19.921337, 19.93593, 19.936315], 4, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 1144], "op": "draft_cost_row", "out": [[1.0, 1.1411, 1.4237, 1.9876], [0, 1, 3, 7], 1.9876, 1.3, 13.658, 1.217362885495276]}, {"args": [0, 4, 48, [0.0016923, 0.0032534, 0.0045706, 0.0057446, 0.0066561, 0.00748, 0.0082221, 0.0086095, 0.0089263]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.0019474, 0.0033396, 0.0047252, 0.0060015, 0.0067351, 0.0072865, 0.0078356, 0.008134, 0.0081347]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 17], "op": "verify_count", "out": 17}, {"args": [[0.900427, 1.45, 1.556561, 1.580243], 4, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 598], "op": "draft_cost_row", "out": [[1.0, 1.0768, 1.2294, 1.5373], [0, 1, 3, 7], 1.5373, 1.3, 14.1516, 1.2431277011911595]}, {"args": [0, 2, 48, [0.0015868, 0.0029368, 0.0042687, 0.0053936, 0.0063584, 0.0071614, 0.00791, 0.0081368, 0.0082215]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.001925, 0.0037896, 0.0055875, 0.0072128, 0.0086251, 0.0099474, 0.0108074, 0.0115923, 0.0116333]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 47], "op": "verify_count", "out": 47}, {"args": [[0.964636, 1.9243, 2.881231, 3.816898, 4.722334, 5.576072, 6.417815, 7.188138, 7.9574, 8.720278, 9.473413, 10.217615, 10.948619, 11.673995, 12.395347, 13.095252, 13.792612, 14.470093, 15.13405, 15.78811, 16.427895, 17.054784, 17.621529, 18.169499, 18.717029, 19.189024, 19.63321, 20.075576, 20.515206, 20.954726, 21.365627, 21.765961, 22.161656, 22.556342, 22.897341, 23.232575, 23.524345, 23.766784, 23.960944, 24.133546, 24.266758, 24.366985, 24.437983, 24.491647, 24.543629, 24.594066, 24.597315, 24.600285], 8, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 2103], "op": "draft_cost_row", "out": [[1.0, 1.0761, 1.2276, 1.5334], [0, 1, 3, 7], 1.5334, 1.3, 14.3383, 1.043899960102859]}, {"args": [0, 2, 48, [0.912806, 1.80611, 2.341632, 2.640889, 2.928935, 3.211514, 3.449451, 3.559713, 3.638763]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.982619, 1.823048, 2.625736, 3.311857, 3.880998, 4.296388, 4.680589, 4.917655, 4.997272]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 17], "op": "verify_count", "out": 17}, {"args": [[0.983023, 1.95385, 2.923969, 3.887619, 4.850231, 5.793198, 6.669494, 7.507704, 8.345587, 9.174446, 9.996231, 10.813483, 11.623459, 12.411484, 13.192873, 13.967816, 14.735506, 15.49482, 16.240168, 16.984772, 17.683476, 18.371783, 19.055618, 19.710206, 20.296738, 20.878778, 21.369763, 21.858121, 22.340317, 22.783472, 23.200878, 23.600754, 23.987323, 24.367526, 24.722352, 25.066637, 25.373584, 25.675834, 25.972734, 26.266939, 26.537854, 26.750032, 26.907536, 27.060087, 27.204228, 27.31595, 27.425437, 27.524692], 16, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 1733], "op": "draft_cost_row", "out": [[1.0, 1.0763, 1.228, 1.5341], [0, 1, 3, 7], 1.5341, 1.3, 14.304, 1.0424440298507465]}, {"args": [0, 2, 48, [0.0098337, 0.0192886, 0.0280607, 0.0365117, 0.0443583, 0.0468297, 0.0483598, 0.0489534, 0.0493497]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.0080008, 0.0159593, 0.0237793, 0.0303653, 0.0359136, 0.0414038, 0.0449313, 0.0478841, 0.0484016]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 58], "op": "verify_count", "out": 48}, {"args": [[0.95443, 1.872932, 2.755386, 3.608643, 4.447943, 5.282269, 6.075673, 6.851444, 7.596565, 8.31338, 9.021955, 9.715772, 10.321632, 10.864974, 11.395047, 11.869962, 12.343888, 12.789008, 13.217616, 13.637889, 14.055675, 14.470192, 14.884056, 15.255772, 15.618569, 15.981145, 16.339746, 16.697644, 17.047416, 17.379165, 17.703461, 17.994416, 18.254945, 18.514084, 18.771114, 18.986375, 19.197459, 19.387895, 19.558917, 19.727904, 19.888991, 20.048671, 20.201233, 20.322374, 20.426712, 20.527771, 20.611986, 20.68159], 33, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 998], "op": "draft_cost_row", "out": [[1.0, 1.0406, 1.1194, 1.2782], [0, 1, 3, 7], 1.2782, 1.3, 14.5406, 1.0524281570094325]}, {"args": [0, 1, 48, [0.19987, 0.3797564, 0.5399702, 0.6904812, 0.8143744, 0.932879, 1.0204444, 1.0598076, 1.0606026]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.1698702, 0.3365578, 0.4516434, 0.555505, 0.6264092, 0.6900148, 0.7445336, 0.7719614, 0.7912202]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.1898414, 0.3661308, 0.4914378, 0.601368, 0.7044912, 0.7810716, 0.8373674, 0.8740848, 0.8841264]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.191098, 0.337393, 0.4825662, 0.6096392, 0.7363942, 0.7705558, 0.8014374, 0.8262208, 0.8386152]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 1, 48, [0.1964964, 0.3600068, 0.5217752, 0.672721, 0.8003884, 0.8801392, 0.9446052, 1.00382, 1.0048436]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 1, 48, [0.1740636, 0.3140902, 0.382521, 0.4495448, 0.5098176, 0.5450452, 0.56374, 0.5814302, 0.597346]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 1, 48, [0.1904498, 0.3503208, 0.4695914, 0.5482072, 0.6156778, 0.6556852, 0.6953752, 0.726504, 0.7469394]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 1, 48, [0.1968314, 0.3331614, 0.4400942, 0.5372204, 0.5997582, 0.6569906, 0.7086794, 0.7572502, 0.801261]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 1, 48, [0.1998788, 0.3882536, 0.5756632, 0.7527844, 0.90505, 1.0125418, 1.05622, 1.0864858, 1.113608]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 1, 48, [0.1821364, 0.3515312, 0.4777436, 0.5978202, 0.7115964, 0.8071876, 0.8936492, 0.9631286, 0.969602]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 1, 48, [0.1815118, 0.354572, 0.4871058, 0.6041008, 0.7148344, 0.8240716, 0.9306462, 1.0284338, 1.1126968]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 1, 48, [0.180627, 0.3441824, 0.4918958, 0.6298626, 0.7551532, 0.8692268, 0.977989, 1.0678032, 1.069642]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 27], "op": "verify_count", "out": 27}, {"args": [[0.769932, 1.434859, 1.904954, 2.217187, 2.373337, 2.524699, 2.624521, 2.625963], 8, 1, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 862], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.5296, 1.0]}, {"args": [0, 1, 48, [0.191572, 0.3734206, 0.4993102, 0.622455, 0.729559, 0.8129684, 0.8927048, 0.9710792, 0.9969736]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.1821212, 0.3413584, 0.4849074, 0.6122244, 0.7212696, 0.8136228, 0.8541326, 0.8748416, 0.8763938]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.179676, 0.3549614, 0.5033878, 0.6142788, 0.7071546, 0.7872958, 0.8140682, 0.8236806, 0.8264278]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.1564726, 0.3047944, 0.4472362, 0.5777568, 0.681511, 0.7813658, 0.8779174, 0.9631072, 1.0220112]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 1, 48, [0.154415, 0.295316, 0.418574, 0.5319558, 0.6422642, 0.7408014, 0.8078702, 0.8670142, 0.8965998]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 1, 48, [0.1774012, 0.3123548, 0.4455206, 0.5447308, 0.5986844, 0.6479512, 0.6830824, 0.68698, 0.6899504]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 1, 48, [0.1783208, 0.333556, 0.4850556, 0.6121262, 0.7235722, 0.8325248, 0.9202122, 0.9888236, 1.0342492]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 1, 48, [0.1800328, 0.3592624, 0.502531, 0.626449, 0.747305, 0.8596348, 0.878443, 0.8952056, 0.8985632]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 1, 48, [0.1625706, 0.324849, 0.453629, 0.5549816, 0.6496022, 0.7281648, 0.798253, 0.8619152, 0.896762]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 1, 48, [0.160014, 0.29377, 0.4181574, 0.5182084, 0.6111212, 0.6860032, 0.7287696, 0.7626256, 0.7883358]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 1, 48, [0.1939256, 0.3806642, 0.5490338, 0.659767, 0.7641276, 0.8508212, 0.9173566, 0.9730204, 0.9995528]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 1, 48, [0.1423384, 0.2796262, 0.4002646, 0.5102718, 0.6153278, 0.684981, 0.7369364, 0.7566472, 0.7664374]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 28], "op": "verify_count", "out": 28}, {"args": [[0.978251, 1.888156, 2.776339, 3.499859, 4.086779, 4.559568, 4.795656, 4.84161], 8, 1, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [1, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 1215], "op": "draft_cost_row", "out": [[1.0, 1.5272, 2.5746, 4.6782], [0, 1, 3, 7], 4.6782, 1.1, 10.3879, 1.0]}, {"args": [0, 32, 48, [0.1979922, 0.3725074, 0.5116522, 0.6446922, 0.7749514, 0.8688666, 0.960292, 1.0473206, 1.0923406]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.164084, 0.3081374, 0.4473378, 0.5207778, 0.585702, 0.6330198, 0.6441852, 0.6546228, 0.6610232]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 32, 48, [0.1639296, 0.3136926, 0.459635, 0.5904576, 0.7002666, 0.8029222, 0.8917222, 0.9665014, 0.9774496]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 32, 48, [0.1940346, 0.3571994, 0.4682984, 0.5786298, 0.680314, 0.7756048, 0.864336, 0.9501622, 1.0039448]], "op": "tree_width", "out": [8, 48, true]}, {"args": [32, 32], "op": "verify_count", "out": 32}, {"args": [[0.724706, 0.9633], 2, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 1863], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2279, 1.5339], [0, 1, 3, 7], 1.5339, 1.3, 14.3235, 1.669235363526447]}, {"args": [0, 2, 48, [0.933642, 1.820823, 2.470035, 3.033998, 3.266344, 3.47551, 3.662574, 3.73802, 3.793685]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 2, 48, [0.710929, 1.223807, 1.70878, 2.174211, 2.475496, 2.693205, 2.897621, 3.031913, 3.068643]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 47], "op": "verify_count", "out": 47}, {"args": [[0.839619, 0.840499], 2, 2, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 2238], "op": "draft_cost_row", "out": [[1.0, 1.5014, 2.4973, 4.4974], [0, 1, 3, 7], 4.4974, 1.1, 11.2447, 1.0]}, {"args": [0, 32, 48, [0.0457097, 0.0816058, 0.114573, 0.1398106, 0.1631121, 0.1813659, 0.1980653, 0.2101984, 0.2184464]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.0462994, 0.0902151, 0.1336857, 0.1636778, 0.1924858, 0.2152684, 0.2377464, 0.2583622, 0.2610869]], "op": "tree_width", "out": [8, 48, true]}, {"args": [32, 13], "op": "verify_count", "out": 13}, {"args": [[0.938151, 1.873738, 2.807008, 3.712014, 4.613666, 5.483342, 6.331856, 7.150495, 7.967428, 8.76521, 9.542832, 10.3191, 11.090136, 11.845124, 12.588984, 13.304969, 13.96773, 14.621289, 15.273688, 15.914219, 16.553608, 17.151242, 17.720721, 18.286083, 18.850857, 19.396133, 19.937104, 20.444866, 20.92481, 21.390241, 21.845913, 22.263666, 22.640388, 23.013384, 23.346879, 23.668446, 23.984393, 24.242651, 24.46447, 24.673342, 24.854518, 25.022241, 25.133956, 25.180567, 25.221613, 25.246451, 25.260021, 25.261854], 4, 32, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [32, 4], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 861], "op": "draft_cost_row", "out": [[1.0, 1.3874, 2.1511, 3.6835], [0, 1, 3, 7], 3.6835, 1.1, 11.3634, 1.4492561393216297]}, {"args": [0, 16, 48, [0.1010972, 0.190338, 0.2746472, 0.3519932, 0.4275792, 0.5021672, 0.5740456, 0.6181622, 0.6221712]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 16, 48, [0.1740266, 0.3453272, 0.5051196, 0.6421818, 0.6908598, 0.737556, 0.753779, 0.7687832, 0.7808916]], "op": "tree_width", "out": [4, 48, true]}, {"args": [16, 20], "op": "verify_count", "out": 20}, {"args": [[0.973101, 1.732121, 2.490826, 3.130252, 3.740401, 4.339888, 4.854373, 5.12697, 5.371726, 5.577265, 5.744552, 5.874606, 5.979908, 6.030934, 6.067445, 6.081529], 16, 16, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 7], "op": "draft_cost_row", "out": [[1.0, 1.1428, 1.429, 2.0005], [0, 1, 3, 7], 2.0005, 1.3, 13.4235, 1.4056651756997323]}, {"args": [0, 4, 48, [0.893984, 1.685166, 2.343116, 2.953559, 3.273373, 3.569829, 3.844292, 3.983658, 4.011568]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 4, 48, [0.841692, 1.681826, 2.416039, 3.127846, 3.733818, 4.143798, 4.330182, 4.507142, 4.606567]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 2], "op": "verify_count", "out": 2}, {"args": [[0.620762], 1, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 450], "op": "draft_cost_row", "out": [[1.0, 1.3947, 2.1728, 3.7345], [0, 1, 3, 7], 3.7345, 1.1, 11.0408, 1.0670601273163063]}, {"args": [0, 16, 48, [0.941418, 1.630676, 2.250313, 2.731798, 3.047246, 3.362335, 3.658836, 3.781423, 3.803148]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 16, 48, [0.902657, 1.756519, 2.531678, 3.225342, 3.699057, 4.104563, 4.230746, 4.353448, 4.431208]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 16, 48, [0.991998, 1.54041, 1.980383, 2.29001, 2.559422, 2.769766, 2.957444, 3.127857, 3.19364]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 16, 48, [0.719969, 1.359725, 1.954121, 2.486504, 3.007564, 3.39144, 3.673994, 3.887706, 4.028152]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 16, 48, [0.999863, 1.927246, 2.851034, 3.69977, 4.485484, 5.106566, 5.591134, 6.058929, 6.132328]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 16, 48, [0.963455, 1.898658, 2.468965, 2.686277, 2.886849, 3.044767, 3.192614, 3.275997, 3.305417]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 16, 48, [0.955455, 1.547964, 2.056846, 2.549717, 2.988375, 3.364309, 3.724814, 3.778293, 3.83059]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 16, 48, [0.959782, 1.850938, 2.654177, 3.379605, 4.086733, 4.734662, 5.015971, 5.23126, 5.320079]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 16, 48, [0.814017, 1.300195, 1.76278, 2.174133, 2.477586, 2.756066, 2.981558, 3.153738, 3.177146]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 16, 48, [0.949505, 1.857016, 2.63626, 3.406289, 4.048185, 4.680305, 5.230797, 5.722391, 6.005967]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 16, 48, [0.966281, 1.578314, 2.124536, 2.542991, 2.815042, 3.085783, 3.257024, 3.341854, 3.390695]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 16, 48, [0.986884, 1.964221, 2.684742, 3.235223, 3.601226, 3.794852, 3.986265, 4.143833, 4.299883]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 63], "op": "verify_count", "out": 48}, {"args": [[0.971603, 1.936496, 2.887141, 3.831481, 4.754921, 5.657313, 6.556138, 7.442346, 8.291002, 9.095575, 9.868032, 10.627619, 11.376337, 12.09514, 12.793925, 13.479699, 14.144419, 14.805301, 15.462273, 16.107737, 16.737951, 17.345661, 17.935779, 18.485883, 19.00714, 19.483616, 19.931406, 20.374133, 20.816228, 21.132665, 21.445888, 21.752205, 22.049561, 22.346563, 22.629528, 22.905123, 23.156531, 23.379468, 23.584328, 23.745171, 23.898783, 24.04956, 24.18263, 24.313381, 24.432246, 24.480319, 24.520794, 24.546901], 4, 16, 700, true], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 984], "op": "draft_cost_row", "out": [[1.0, 1.1413, 1.4244, 1.9895], [0, 1, 3, 7], 1.9895, 1.3, 13.6232, 1.4181041661709772]}, {"args": [0, 4, 48, [0.983219, 1.818876, 2.599899, 3.202872, 3.758801, 4.210256, 4.550796, 4.877223, 4.946148]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 4, 48, [0.971284, 1.896328, 2.669396, 3.429567, 4.171048, 4.486251, 4.684044, 4.829958, 4.890115]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 58], "op": "verify_count", "out": 48}, {"args": [[0.754732, 1.355013, 1.444254, 1.500642], 4, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 497], "op": "draft_cost_row", "out": [[1.0, 1.1424, 1.4276, 1.997], [0, 1, 3, 7], 1.997, 1.3, 13.4929, 1.2085755488476662]}, {"args": [0, 4, 48, [0.940492, 1.80636, 2.6483, 3.484023, 4.08998, 4.643797, 5.03101, 5.289198, 5.405199]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.895998, 1.586042, 2.090759, 2.593703, 2.981313, 3.330812, 3.677763, 3.980635, 4.203197]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 6], "op": "verify_count", "out": 6}, {"args": [[0.978298, 1.90637, 2.793287, 3.521025, 4.242604, 4.920007, 5.591855, 6.257865, 6.909276, 7.435772, 7.948589, 8.340665, 8.622686, 8.708461, 8.765412, 8.784072], 16, 4, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 1164], "op": "draft_cost_row", "out": [[1.0, 1.5272, 2.5746, 4.6782], [0, 1, 3, 7], 4.6782, 1.1, 10.3879, 1.0255298984135133]}, {"args": [0, 32, 48, [0.0091172, 0.0178704, 0.0264227, 0.0329257, 0.0390015, 0.0450662, 0.050692, 0.0543779, 0.0575185]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.0095958, 0.0188339, 0.0276317, 0.0358521, 0.0420773, 0.0475862, 0.0511555, 0.0518255, 0.052424]], "op": "tree_width", "out": [8, 48, true]}, {"args": [32, 41], "op": "verify_count", "out": 41}, {"args": [[0.961833, 1.811329, 2.614055, 3.403253, 4.105982, 4.681554, 5.101374, 5.24582], 8, 32, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [32, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 1768], "op": "draft_cost_row", "out": [[1.0, 1.1397, 1.4196, 1.9783], [0, 1, 3, 7], 1.9783, 1.3, 13.818, 1.634395883848838]}, {"args": [0, 4, 48, [0.978345, 1.804395, 2.497368, 3.095454, 3.482055, 3.679196, 3.714098, 3.743548, 3.761036]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 4, 48, [0.741965, 1.477576, 1.97247, 2.462875, 2.908737, 3.354316, 3.62032, 3.866674, 3.894686]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 43], "op": "verify_count", "out": 43}, {"args": [[0.9731, 1.658659, 2.121289, 2.567381, 2.90439, 3.231666, 3.306259, 3.325578], 8, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 744], "op": "draft_cost_row", "out": [[1.0, 1.0767, 1.2292, 1.5371], [0, 1, 3, 7], 1.5371, 1.3, 14.1672, 1.2439298508511085]}, {"args": [0, 2, 48, [0.887596, 1.671355, 2.450757, 3.18853, 3.697352, 4.197092, 4.626441, 4.993803, 5.099024]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.762877, 1.259455, 1.695586, 2.103264, 2.495092, 2.868616, 3.190431, 3.405399, 3.532469]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 53], "op": "verify_count", "out": 48}, {"args": [[0.511535, 0.842209, 0.875378, 0.887371], 4, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 521], "op": "draft_cost_row", "out": [[1.0, 1.5511, 2.6462, 4.8458], [0, 1, 3, 7], 4.8458, 1.1, 9.5815, 1.0]}, {"args": [0, 32, 48, [0.0098372, 0.0184611, 0.0262334, 0.0340052, 0.0413244, 0.0486352, 0.0547333, 0.059855, 0.0611548]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.0089877, 0.0178964, 0.0266204, 0.0340925, 0.0391398, 0.0428551, 0.0460926, 0.0491635, 0.0506232]], "op": "tree_width", "out": [8, 48, true]}, {"args": [32, 50], "op": "verify_count", "out": 48}, {"args": [[0.990634, 1.968436, 2.860237, 3.714452, 4.551044, 5.326714, 6.009016, 6.664361, 7.272417, 7.845917, 8.403548, 8.904524, 9.323823, 9.66224, 9.953693, 10.073348], 16, 32, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [32, 16], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 658], "op": "draft_cost_row", "out": [[1.0, 1.5459, 2.6313, 4.8111], [0, 1, 3, 7], 4.8111, 1.1, 9.7462, 1.3105808473015041]}, {"args": [0, 32, 48, [0.001661, 0.0032715, 0.004767, 0.0060777, 0.0073639, 0.0081001, 0.0087516, 0.0090609, 0.00912]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 32, 48, [0.0019082, 0.0038024, 0.0052962, 0.0067047, 0.0079114, 0.008773, 0.0095753, 0.0102191, 0.0105469]], "op": "tree_width", "out": [4, 48, true]}, {"args": [32, 59], "op": "verify_count", "out": 48}, {"args": [[0.936835, 1.860202, 2.769709, 3.678562, 4.556359, 5.293353, 5.98196, 6.62817, 7.168981, 7.654988, 8.135354, 8.522562, 8.859143, 8.9137, 8.965523, 8.994747], 16, 32, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [32, 8], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 16], "op": "draft_cost_row", "out": [[1.0, 1.3997, 2.1881, 3.7696], [0, 1, 3, 7], 3.7696, 1.1, 10.8168, 1.4040133952908804]}, {"args": [0, 16, 48, [0.0095783, 0.0176583, 0.022751, 0.0260908, 0.0293861, 0.0314168, 0.0333032, 0.0342627, 0.03444]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 16, 48, [0.0099086, 0.0197069, 0.0258824, 0.0320486, 0.0362144, 0.0400461, 0.0428518, 0.0450579, 0.0466096]], "op": "tree_width", "out": [4, 48, true]}, {"args": [16, 11], "op": "verify_count", "out": 11}, {"args": [[0.945543, 1.869965, 2.436574, 2.879136, 3.216909, 3.388066, 3.529516, 3.601886], 8, 16, 700, false], "op": "verify_paged", "out": [4, false]}, {"args": [16, 4], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 263], "op": "draft_cost_row", "out": [[1.0, 1.077, 1.2296, 1.5381], [0, 1, 3, 7], 1.5381, 1.3, 14.1171, 1.4482429632061342]}, {"args": [0, 2, 48, [0.001968, 0.0038889, 0.0050675, 0.0061689, 0.0071772, 0.0081458, 0.0090697, 0.0094359, 0.0095144]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 2, 48, [0.0019474, 0.0035315, 0.004764, 0.0059057, 0.0067271, 0.0075096, 0.0082292, 0.0089332, 0.008972]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 20], "op": "verify_count", "out": 20}, {"args": [[0.952727, 1.622397, 2.058986, 2.074205], 4, 2, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [4], "op": "history", "out": 48}, {"args": [4, 778], "op": "draft_cost_row", "out": [[1.0, 1.1415, 1.4251, 1.9912], [0, 1, 3, 7], 1.9912, 1.3, 13.5912, 1.0115149205744363]}, {"args": [0, 4, 48, [0.049338, 0.0975259, 0.1397503, 0.1754914, 0.2104181, 0.2400397, 0.2597526, 0.2778211, 0.2784535]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 4, 48, [0.0473987, 0.0924476, 0.1336655, 0.1581066, 0.1820658, 0.1999259, 0.2045828, 0.2065193, 0.2067659]], "op": "tree_width", "out": [1, 48, true]}, {"args": [4, 23], "op": "verify_count", "out": 23}, {"args": [[0.152125], 1, 4, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [4, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 873], "op": "draft_cost_row", "out": [[1.0, 1.5414, 2.6173, 4.7778], [0, 1, 3, 7], 4.7778, 1.1, 9.9136, 1.0]}, {"args": [0, 32, 48, [0.1224528, 0.2418092, 0.3361174, 0.4281614, 0.50989, 0.5867124, 0.6478568, 0.6761914, 0.6942254]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.198833, 0.3833352, 0.5544226, 0.7250894, 0.8574176, 0.9829462, 1.076741, 1.1255582, 1.1280632]], "op": "tree_width", "out": [8, 48, true]}, {"args": [32, 5], "op": "verify_count", "out": 5}, {"args": [[0.999159, 1.995961, 2.878879, 3.732263, 4.577801, 5.40081, 6.216153, 6.985109, 7.745846, 8.472067, 9.174642, 9.770084, 10.354479, 10.929264, 11.444925, 11.958584, 12.469438, 12.979303, 13.473287, 13.959184, 14.439079, 14.911996, 15.36932, 15.821344, 16.264956, 16.696863, 17.092676, 17.4874, 17.864993, 18.217779, 18.555488, 18.885819, 19.127324, 19.345222, 19.55956, 19.760679, 19.960836, 20.107803, 20.24555, 20.381153, 20.500814, 20.574193, 20.644722, 20.700196, 20.753041, 20.792655, 20.831297, 20.858647], 2, 32, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 230], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.4879, 1.6803458604322095]}, {"args": [0, 1, 48, [0.1345884, 0.2664428, 0.3822022, 0.4791948, 0.5743736, 0.6662006, 0.6874112, 0.7045314, 0.717021]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 1, 48, [0.1930116, 0.3688744, 0.4804978, 0.5636288, 0.625379, 0.6759912, 0.7247894, 0.7426352, 0.757959]], "op": "tree_width", "out": [4, 48, true]}, {"args": [1, 60], "op": "verify_count", "out": 48}, {"args": [[0.956827, 1.864625], 2, 1, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 643], "op": "draft_cost_row", "out": [[1.0, 1.3898, 2.1582, 3.7004], [0, 1, 3, 7], 3.7004, 1.1, 11.2559, 1.0]}, {"args": [0, 16, 48, [0.0019588, 0.0037357, 0.0052562, 0.0067292, 0.008176, 0.0092355, 0.0098487, 0.0103939, 0.0106803]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 16, 48, [0.0018694, 0.0035238, 0.0047861, 0.0058923, 0.0065968, 0.0072854, 0.0079495, 0.0082653, 0.008413]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 16, 48, [0.0018638, 0.003666, 0.0053569, 0.0070037, 0.0084859, 0.0097106, 0.0105799, 0.0111041, 0.0112208]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 16, 48, [0.0019112, 0.0037387, 0.0052391, 0.0065262, 0.0076202, 0.0085836, 0.0094837, 0.0101143, 0.0104914]], "op": "tree_width", "out": [8, 48, true]}, {"args": [16, 9], "op": "verify_count", "out": 9}, {"args": [[0.989166, 1.931292, 2.864148, 3.783139, 4.689701, 5.57576, 6.409045, 7.227958, 8.029539, 8.826904, 9.605664, 10.382558, 11.101094, 11.809645, 12.487762, 13.165878, 13.811918, 14.436493, 15.040603, 15.640803, 16.184386, 16.715962, 17.191274, 17.662107, 18.127858, 18.591991, 19.055171, 19.517656, 19.970465, 20.329974, 20.687452, 20.987563, 21.271644, 21.54626, 21.807515, 22.032441, 22.255837, 22.435737, 22.606645, 22.759235, 22.897688, 23.016924, 23.120134, 23.171221, 23.215815, 23.259047, 23.298101, 23.320461], 2, 16, 700, true], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 161], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.4879, 1.4703026278781832]}, {"args": [0, 1, 48, [0.1826978, 0.3623184, 0.4390994, 0.5117464, 0.573313, 0.631142, 0.68552, 0.7080004, 0.7095636]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 1, 48, [0.1996662, 0.3971052, 0.5406454, 0.6819406, 0.7851928, 0.8411334, 0.8923034, 0.9416242, 0.9879058]], "op": "tree_width", "out": [4, 48, false]}, {"args": [2, 1, 48, [0.1771796, 0.3374356, 0.4783052, 0.5946778, 0.6846866, 0.7616538, 0.787318, 0.7961164, 0.7970096]], "op": "tree_width", "out": [4, 48, false]}, {"args": [3, 1, 48, [0.134759, 0.264334, 0.3930518, 0.5030422, 0.610809, 0.7161426, 0.8052542, 0.8168908, 0.8259368]], "op": "tree_width", "out": [4, 48, true]}, {"args": [1, 24], "op": "verify_count", "out": 24}, {"args": [[0.90136, 1.795118, 2.670474, 3.540878, 4.340539, 5.133124, 5.919785, 6.695338, 7.465623, 8.225391, 8.891693, 9.555738, 10.19994, 10.843132, 11.469633, 12.082368, 12.689572, 13.293159, 13.891627, 14.460069, 15.025449, 15.571129, 16.091278, 16.597682, 17.096839, 17.590378, 18.072135, 18.552955, 19.031025, 19.504075, 19.968559, 20.424249, 20.80532, 21.170919, 21.532859, 21.876621, 22.202005, 22.513457, 22.813406, 23.100796, 23.36641, 23.588309, 23.793243, 23.981935, 24.112797, 24.196522, 24.257899, 24.299406], 33, 1, 700, true], "op": "verify_paged", "out": [32, false]}, {"args": [1, 32], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 1019], "op": "draft_cost_row", "out": [[1.0, 1.385, 2.1439, 3.6672], [0, 1, 3, 7], 3.6672, 1.1, 11.4675, 1.0]}, {"args": [0, 16, 48, [0.773103, 1.366011, 1.866338, 2.366456, 2.61419, 2.791955, 2.880957, 2.928772, 2.974235]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 16, 48, [0.944919, 1.883467, 2.594869, 3.160497, 3.660487, 4.034457, 4.262886, 4.4584, 4.572877]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 16, 48, [0.838562, 1.40795, 1.811111, 2.189537, 2.504061, 2.783354, 3.042839, 3.143027, 3.166284]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 16, 48, [0.841551, 1.618909, 2.338887, 2.80901, 3.200605, 3.50068, 3.782598, 4.008908, 4.110503]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 16, 48, [0.979656, 1.933792, 2.840166, 3.572453, 4.082695, 4.299918, 4.472185, 4.552011, 4.579606]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 16, 48, [0.895929, 1.660167, 2.406984, 3.063008, 3.665508, 4.028247, 4.389285, 4.42455, 4.441335]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 16, 48, [0.937841, 1.809773, 2.612774, 3.336434, 3.769353, 4.117043, 4.456769, 4.652968, 4.814503]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 16, 48, [0.975723, 1.656327, 2.280158, 2.777621, 3.215023, 3.49718, 3.702369, 3.851052, 3.995389]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 16, 48, [0.80313, 1.471675, 2.058812, 2.585109, 3.045651, 3.504208, 3.897793, 4.16437, 4.27677]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 16, 48, [0.900808, 1.791305, 2.581859, 3.118684, 3.654022, 4.06715, 4.436334, 4.754395, 4.89704]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 16, 48, [0.954298, 1.808803, 2.616352, 3.390784, 4.127935, 4.679436, 5.227033, 5.362684, 5.478458]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 16, 48, [0.89352, 1.617733, 2.194309, 2.737381, 3.126999, 3.45684, 3.712295, 3.799322, 3.803608]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [16, 27], "op": "verify_count", "out": 27}, {"args": [[0.255624], 1, 16, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [16, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 235], "op": "draft_cost_row", "out": [[1.0, 1.567, 2.6932, 4.9552], [0, 1, 3, 7], 4.9552, 1.1, 9.0611, 1.0912818165864333]}, {"args": [0, 32, 48, [0.0014419, 0.0028099, 0.0041583, 0.0054843, 0.0066174, 0.0076193, 0.0081558, 0.0086236, 0.0090019]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 32, 48, [0.0019436, 0.003363, 0.0045771, 0.0056662, 0.0067476, 0.0075229, 0.0077845, 0.007908, 0.0080118]], "op": "tree_width", "out": [4, 48, true]}, {"args": [32, 3], "op": "verify_count", "out": 3}, {"args": [[0.96086, 1.915822, 2.824826, 3.620119, 4.304064, 4.985835, 5.654953, 6.188522, 6.635948, 7.080751, 7.484138, 7.831745, 8.154258, 8.476623, 8.713793, 8.91334], 16, 32, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [32, 16], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 457], "op": "draft_cost_row", "out": [[1.0, 1.0769, 1.2295, 1.5378], [0, 1, 3, 7], 1.5378, 1.3, 14.1355, 1.6563987637503477]}, {"args": [0, 2, 48, [0.0097936, 0.0189331, 0.0280066, 0.0365358, 0.04415, 0.0480785, 0.0519044, 0.0546725, 0.0560916]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 2, 48, [0.0090663, 0.0179305, 0.0259008, 0.0328698, 0.0391116, 0.0433767, 0.0465385, 0.048446, 0.0495198]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 56], "op": "verify_count", "out": 48}, {"args": [[0.986438, 1.927214, 2.84875, 3.769807, 4.673419, 5.457469, 6.234496, 6.829376, 7.400264, 7.967685, 8.507527, 9.037201, 9.414444, 9.778971, 9.860652, 9.932359], 16, 2, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 2187], "op": "draft_cost_row", "out": [[1.0, 1.3668, 2.0901, 3.5431], [0, 1, 3, 7], 3.5431, 1.3, 12.2522, 1.0]}, {"args": [0, 16, 48, [0.0019508, 0.0036963, 0.0053055, 0.0067231, 0.0077926, 0.0084048, 0.0088684, 0.0092728, 0.0092998]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 16, 48, [0.0017225, 0.0032703, 0.004703, 0.0058314, 0.0064196, 0.0068641, 0.0073034, 0.0075071, 0.0076285]], "op": "tree_width", "out": [8, 48, true]}, {"args": [16, 61], "op": "verify_count", "out": 48}, {"args": [[0.896123, 1.729321, 2.509794, 3.058381, 3.477862, 3.729389, 3.977004, 4.141859], 8, 16, 700, true], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 1490], "op": "draft_cost_row", "out": [[1.0, 1.0764, 1.2283, 1.5348], [0, 1, 3, 7], 1.5348, 1.3, 14.2691, 1.4573434960357874]}, {"args": [0, 2, 48, [0.0479697, 0.0881381, 0.124764, 0.1526675, 0.1704106, 0.182915, 0.1927946, 0.1993092, 0.2040948]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 2, 48, [0.0460105, 0.0755486, 0.0960337, 0.1143662, 0.1264868, 0.1368872, 0.1435912, 0.1501777, 0.1540332]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 36], "op": "verify_count", "out": 36}, {"args": [[0.891592, 1.569206, 2.108356, 2.527367], 4, 2, 700, false], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [2], "op": "history", "out": 48}, {"args": [2, 1604], "op": "draft_cost_row", "out": [[1.0, 1.0765, 1.2281, 1.5347], [0, 1, 3, 7], 1.5347, 1.3, 14.2901, 1.041853187946375]}, {"args": [0, 2, 48, [0.958965, 1.841096, 2.633675, 3.405318, 3.973589, 4.275367, 4.525071, 4.690528, 4.79077]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 2, 48, [0.748931, 1.47736, 2.202714, 2.745403, 3.049583, 3.338319, 3.496416, 3.523807, 3.525007]], "op": "tree_width", "out": [1, 48, true]}, {"args": [2, 9], "op": "verify_count", "out": 9}, {"args": [[0.988512, 1.976297, 2.945556, 3.910631, 4.838836, 5.76593, 6.673232, 7.580501, 8.474751, 9.368903, 10.223927, 11.056671, 11.858844, 12.654642, 13.448676, 14.231516, 15.004704, 15.737823, 16.457343, 17.175048, 17.865803, 18.546122, 19.209039, 19.835778, 20.38461, 20.931373, 21.429052, 21.896012, 22.358119, 22.819575, 23.278437, 23.716375, 24.131265, 24.520223, 24.845125, 25.169437, 25.442029, 25.675888, 25.906275, 26.125009, 26.342583, 26.557846, 26.702649, 26.813755, 26.923318, 26.945676, 26.967713, 26.968068], 16, 2, 700, true], "op": "verify_paged", "out": [8, true]}, {"args": [2, 8], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 1083], "op": "draft_cost_row", "out": [[1.0, 1.5314, 2.5883, 4.7102], [0, 1, 3, 7], 4.7102, 1.1, 10.2204, 1.0]}, {"args": [0, 32, 48, [0.0099068, 0.0196405, 0.0289239, 0.0378614, 0.0437113, 0.0493249, 0.0549109, 0.0576538, 0.0581648]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.0089718, 0.0176247, 0.0244971, 0.0313634, 0.0367688, 0.0416184, 0.0459617, 0.0489437, 0.0504308]], "op": "tree_width", "out": [8, 48, true]}, {"args": [32, 31], "op": "verify_count", "out": 31}, {"args": [[0.961589, 1.901099, 2.837594, 3.768266, 4.618486, 5.46302, 6.30564, 7.134007, 7.960027, 8.721743, 9.469977, 10.209032, 10.937019, 11.655925, 12.356621, 13.03161, 13.695606, 14.313813, 14.910163, 15.455975, 15.998536, 16.536503, 17.06475, 17.525648, 17.98378, 18.430972, 18.877111, 19.300844, 19.716909, 20.099842, 20.470183, 20.799199, 21.11309, 21.382916, 21.64265, 21.874406, 22.074873, 22.250467, 22.404511, 22.554505, 22.688493, 22.782016, 22.854246, 22.922393, 22.984218, 23.03188, 23.052349, 23.065945], 16, 32, 700, true], "op": "verify_paged", "out": [16, false]}, {"args": [32, 16], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 1890], "op": "draft_cost_row", "out": [[1.0, 1.3689, 2.0966, 3.5572], [0, 1, 3, 7], 3.5572, 1.3, 12.1658, 1.512886357559893]}, {"args": [0, 16, 48, [0.0388742, 0.070484, 0.0963721, 0.121769, 0.1469223, 0.1703493, 0.1878017, 0.1968414, 0.2020284]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 16, 48, [0.0418625, 0.0803631, 0.093103, 0.1024952, 0.1067171, 0.1094626, 0.1119037, 0.1131144, 0.114308]], "op": "tree_width", "out": [4, 48, true]}, {"args": [16, 43], "op": "verify_count", "out": 43}, {"args": [[0.964404, 1.820854, 2.658961, 3.323294, 3.941623, 4.528714, 5.111182, 5.689016, 6.233593, 6.480406, 6.723934, 6.938677, 7.136112, 7.267006, 7.327881, 7.334626], 16, 16, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 317], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.4968, 1.470826279538972]}, {"args": [0, 1, 48, [0.0406209, 0.0770221, 0.1009652, 0.1234558, 0.1384607, 0.1488621, 0.1585337, 0.1656753, 0.1690625]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 1, 48, [0.0497573, 0.0982795, 0.1419887, 0.1835501, 0.2249337, 0.2612918, 0.2896719, 0.3108854, 0.3222585]], "op": "tree_width", "out": [4, 48, true]}, {"args": [1, 54], "op": "verify_count", "out": 48}, {"args": [[0.23853, 0.47507], 2, 1, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [1, 1], "op": "record", "out": null}, {"args": [32], "op": "history", "out": 48}, {"args": [32, 1670], "op": "draft_cost_row", "out": [[1.0, 1.5104, 2.523, 4.5575], [0, 1, 3, 7], 4.5575, 1.1, 10.9809, 1.0]}, {"args": [0, 32, 48, [0.811841, 1.52336, 2.025808, 2.442803, 2.742221, 2.962473, 3.143614, 3.293071, 3.323611]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 32, 48, [0.89756, 1.709349, 2.48905, 3.266661, 3.658032, 3.986008, 4.166284, 4.254377, 4.311537]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 32, 48, [0.924961, 1.837972, 2.683474, 3.515583, 4.344505, 5.015946, 5.206162, 5.301729, 5.377275]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 32, 48, [0.981136, 1.907445, 2.668988, 3.320748, 3.780379, 4.239456, 4.679116, 5.017933, 5.269922]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 32, 48, [0.937536, 1.86763, 2.74671, 3.395686, 4.040428, 4.334668, 4.600159, 4.818636, 5.00602]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 32, 48, [0.939556, 1.764063, 2.439077, 2.803043, 3.068397, 3.175214, 3.273995, 3.302698, 3.319389]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 32, 48, [0.925847, 1.771767, 2.536985, 3.220134, 3.77981, 3.952104, 4.032479, 4.041538, 4.047351]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 32, 48, [0.880023, 1.720034, 2.402685, 3.023696, 3.627703, 3.90612, 4.091249, 4.168503, 4.204762]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 32, 48, [0.806501, 1.569091, 2.263722, 2.734162, 3.173363, 3.483205, 3.707766, 3.814053, 3.827699]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 32, 48, [0.755687, 1.510734, 2.199549, 2.878719, 3.402039, 3.799328, 4.141821, 4.43839, 4.508659]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 32, 48, [0.933045, 1.485639, 2.020088, 2.540804, 2.965819, 3.36906, 3.758686, 4.022302, 4.103967]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 32, 48, [0.679048, 1.277831, 1.861471, 2.422476, 2.921781, 3.331661, 3.687416, 3.939483, 4.148968]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [32, 17], "op": "verify_count", "out": 17}, {"args": [[0.429738, 0.700985], 2, 32, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [32, 1], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 48}, {"args": [8, 1185], "op": "draft_cost_row", "out": [[1.0, 1.2365, 1.7196, 2.6797], [0, 1, 3, 7], 2.6797, 1.3, 12.7934, 1.5604847316838146]}, {"args": [0, 8, 48, [0.0090304, 0.0162427, 0.0228613, 0.0267724, 0.03041, 0.0324334, 0.0329699, 0.0332274, 0.0334357]], "op": "tree_width", "out": [4, 48, false]}, {"args": [1, 8, 48, [0.0094832, 0.0184073, 0.0270563, 0.0349204, 0.0403764, 0.0445118, 0.0480658, 0.0506354, 0.0509462]], "op": "tree_width", "out": [4, 48, true]}, {"args": [8, 29], "op": "verify_count", "out": 29}, {"args": [[0.436015], 1, 8, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 657], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2782], [0, 1, 3, 7], 1.2782, 1.3, 14.5224, 1.2619980070910481]}, {"args": [0, 1, 48, [0.0424112, 0.0839807, 0.1177586, 0.1381156, 0.1565855, 0.1692503, 0.1760584, 0.1809529, 0.1830514]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.0369726, 0.0707458, 0.1008716, 0.1267645, 0.149428, 0.17137, 0.1795333, 0.1846348, 0.1878656]], "op": "tree_width", "out": [8, 48, true]}, {"args": [1, 23], "op": "verify_count", "out": 23}, {"args": [[0.980919, 1.923205, 2.679278, 3.362051, 3.937153, 4.390711, 4.816609, 5.229437, 5.638684, 6.012396, 6.377263, 6.727097, 6.986046, 7.155255, 7.312754, 7.320108], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [1], "op": "history", "out": 48}, {"args": [1, 1840], "op": "draft_cost_row", "out": [[1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], 1.2783, 1.3, 14.6004, 1.0]}, {"args": [0, 1, 48, [0.995942, 1.978669, 2.959436, 3.616974, 4.248291, 4.87531, 5.166936, 5.337016, 5.500971]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 1, 48, [0.98614, 1.82594, 2.479261, 3.126689, 3.703685, 4.246461, 4.752058, 4.926004, 5.01954]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 1, 48, [0.895722, 1.741398, 2.566954, 3.195052, 3.660426, 4.116179, 4.514585, 4.617465, 4.652993]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 1, 48, [0.880536, 1.644501, 2.356367, 2.908513, 3.229391, 3.501794, 3.732532, 3.805485, 3.809977]], "op": "tree_width", "out": [8, 48, false]}, {"args": [4, 1, 48, [0.977652, 1.947184, 2.406654, 2.781466, 3.121134, 3.319765, 3.407783, 3.425628, 3.432434]], "op": "tree_width", "out": [8, 48, false]}, {"args": [5, 1, 48, [0.708978, 1.354138, 1.898607, 2.361166, 2.752162, 3.029785, 3.302357, 3.452636, 3.483043]], "op": "tree_width", "out": [8, 48, false]}, {"args": [6, 1, 48, [0.993958, 1.984802, 2.962373, 3.761264, 4.389219, 4.997645, 5.481673, 5.782805, 5.8073]], "op": "tree_width", "out": [8, 48, false]}, {"args": [7, 1, 48, [0.845593, 1.633689, 2.376997, 3.093144, 3.583555, 3.990868, 4.310397, 4.600272, 4.638451]], "op": "tree_width", "out": [8, 48, false]}, {"args": [8, 1, 48, [0.994157, 1.975706, 2.909862, 3.738785, 4.154788, 4.538448, 4.791333, 4.847149, 4.902026]], "op": "tree_width", "out": [8, 48, false]}, {"args": [9, 1, 48, [0.7346, 1.384943, 1.95117, 2.437863, 2.890538, 3.266693, 3.459394, 3.568255, 3.654495]], "op": "tree_width", "out": [8, 48, false]}, {"args": [10, 1, 48, [0.941817, 1.775497, 2.483889, 3.096582, 3.549989, 3.708151, 3.852901, 3.959358, 4.008172]], "op": "tree_width", "out": [8, 48, false]}, {"args": [11, 1, 48, [0.913467, 1.662761, 2.382607, 2.841515, 3.280566, 3.620522, 3.944769, 4.152608, 4.190139]], "op": "tree_width", "out": [-1, -1, true]}, {"args": [1, 44], "op": "verify_count", "out": 44}, {"args": [[0.879014, 1.603379, 2.252534, 2.840494, 3.389933, 3.925059, 4.364882, 4.792516, 5.12355, 5.445841, 5.744532, 5.996423, 6.232048, 6.349649, 6.362334, 6.367804], 16, 1, 700, false], "op": "verify_paged", "out": [16, false]}, {"args": [1, 16], "op": "record", "out": null}, {"args": [8], "op": "history", "out": 48}, {"args": [8, 1341], "op": "draft_cost_row", "out": [[1.0, 1.2358, 1.7172, 2.6741], [0, 1, 3, 7], 2.6741, 1.3, 12.8609, 1.0]}, {"args": [0, 8, 48, [0.0093204, 0.0164933, 0.022335, 0.0280508, 0.0329802, 0.0354869, 0.036637, 0.0377097, 0.0384829]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 8, 48, [0.0089167, 0.016783, 0.0212056, 0.0242634, 0.0271426, 0.0299604, 0.0326105, 0.0338937, 0.0351578]], "op": "tree_width", "out": [8, 48, false]}, {"args": [2, 8, 48, [0.0076237, 0.0143103, 0.0198724, 0.0241334, 0.0281432, 0.0297282, 0.0310225, 0.0321263, 0.0329357]], "op": "tree_width", "out": [8, 48, false]}, {"args": [3, 8, 48, [0.0090044, 0.0173785, 0.0253951, 0.03307, 0.038658, 0.0430368, 0.0455375, 0.0473495, 0.0484293]], "op": "tree_width", "out": [8, 48, true]}, {"args": [8, 22], "op": "verify_count", "out": 22}, {"args": [[0.536831, 0.892913], 2, 8, 700, false], "op": "verify_paged", "out": [1, false]}, {"args": [8, 1], "op": "record", "out": null}, {"args": [16], "op": "history", "out": 48}, {"args": [16, 1572], "op": "draft_cost_row", "out": [[1.0, 1.3737, 2.1101, 3.5887], [0, 1, 3, 7], 3.5887, 1.1, 11.9737, 1.123457716811004]}, {"args": [0, 16, 48, [0.1947512, 0.3798848, 0.5634736, 0.7373114, 0.9005674, 1.026316, 1.1174458, 1.2044384, 1.285657]], "op": "tree_width", "out": [8, 48, false]}, {"args": [1, 16, 48, [0.1652776, 0.3239516, 0.4771046, 0.5881436, 0.6909076, 0.7814964, 0.8528612, 0.8966634, 0.898]], "op": "tree_width", "out": [8, 48, true]}, {"args": [16, 52], "op": "verify_count", "out": 48}, {"args": [[0.950815, 1.854554, 2.751176, 3.631862, 4.463573, 5.152679, 5.710138, 6.237038, 6.76074, 7.133936, 7.483776, 7.629544, 7.743436, 7.818902, 7.843362, 7.866907], 16, 16, 700, false], "op": "verify_paged", "out": [8, false]}, {"args": [16, 8], "op": "record", "out": null}]}], "loaded_chain_intensity": {"1": [[[[[1450.4817, 1466.5544, 1502.9889, 1536.0992, 1568.13, 1601.5236, 1639.0739, 1671.7728, 1707.2205], [1.0, 1.0111, 1.0362, 1.059, 1.0811, 1.1041, 1.13, 1.1526, 1.177], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [34.312, 34.3744, 0.0, 34.7808, 0.0, 34.8432, 0.0, 35.0624, 0.0, 35.4064, 0.0, 35.5008, 0.0, 35.7504, 0.0, 36.0944]], [[100.2383], [1.0], [0], [98.959], [1.2793]]], [[[1452.4513, 1468.5544, 1505.0833, 1538.568, 1570.6612, 1604.0548, 1642.0099, 1674.616, 1709.9693], [1.0, 1.0111, 1.0362, 1.0593, 1.0814, 1.1044, 1.1305, 1.153, 1.1773], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [36.2816, 36.3744, 0.0, 36.8752, 0.0, 37.312, 0.0, 37.5936, 0.0, 37.9376, 0.0, 38.4368, 0.0, 38.5936, 0.0, 38.8432]], [[100.3125], [1.0], [0], [98.959], [1.3535]]], [[[1454.3889, 1470.6792, 1507.0513, 1540.6624, 1573.0356, 1606.6484, 1644.6051, 1677.7104, 1713.1885], [1.0, 1.0112, 1.0362, 1.0593, 1.0816, 1.1047, 1.1308, 1.1536, 1.1779], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [38.2192, 38.4992, 0.0, 38.8432, 0.0, 39.4064, 0.0, 39.968, 0.0, 40.5312, 0.0, 41.032, 0.0, 41.688, 0.0, 42.0624]], [[100.377], [1.0], [0], [98.959], [1.418]]], [[[1456.2321, 1472.6488, 1509.3953, 1543.0992, 1575.5364, 1609.2116, 1647.3235, 1680.4288, 1716.1261], [1.0, 1.0113, 1.0365, 1.0597, 1.0819, 1.1051, 1.1312, 1.154, 1.1785], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [40.0624, 40.4688, 0.0, 41.1872, 0.0, 41.8432, 0.0, 42.4688, 0.0, 43.0944, 0.0, 43.7504, 0.0, 44.4064, 0.0, 45.0]], [[100.4531], [1.0], [0], [98.959], [1.4941]]], [[[1458.2321, 1474.5544, 1511.4273, 1545.3184, 1577.9732, 1611.8356, 1649.9795, 1683.3344, 1719.0941], [1.0, 1.0112, 1.0365, 1.0597, 1.0821, 1.1053, 1.1315, 1.1544, 1.1789], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [42.0624, 42.3744, 0.0, 43.2192, 0.0, 44.0624, 0.0, 44.9056, 0.0, 45.7184, 0.0, 46.4064, 0.0, 47.312, 0.0, 47.968]], [[100.5254], [1.0], [0], [98.959], [1.5664]]], [[[1460.1697, 1476.524, 1513.5825, 1547.568, 1580.5044, 1614.4916, 1652.6675, 1686.0848, 1722.2509], [1.0, 1.0112, 1.0366, 1.0599, 1.0824, 1.1057, 1.1318, 1.1547, 1.1795], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [44.0, 44.344, 0.0, 45.3744, 0.0, 46.312, 0.0, 47.4368, 0.0, 48.3744, 0.0, 49.0944, 0.0, 50.0624, 0.0, 51.1248]], [[100.5977], [1.0], [0], [98.959], [1.6387]]], [[[1462.2017, 1478.7736, 1515.5825, 1549.8192, 1582.7556, 1616.898, 1655.4483, 1689.2096, 1725.1261], [1.0, 1.0113, 1.0365, 1.0599, 1.0824, 1.1058, 1.1322, 1.1553, 1.1798], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [46.032, 46.5936, 0.0, 47.3744, 0.0, 48.5632, 0.0, 49.688, 0.0, 50.7808, 0.0, 51.8752, 0.0, 53.1872, 0.0, 54.0]], [[100.666], [1.0], [0], [98.959], [1.707]]], [[[1463.8577, 1480.524, 1517.7393, 1552.1312, 1585.3172, 1619.554, 1658.1987, 1691.8352, 1728.3133], [1.0, 1.0114, 1.0368, 1.0603, 1.083, 1.1064, 1.1328, 1.1557, 1.1807], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [47.688, 48.344, 0.0, 49.5312, 0.0, 50.8752, 0.0, 52.2496, 0.0, 53.4368, 0.0, 54.6256, 0.0, 55.8128, 0.0, 57.1872]], [[100.7344], [1.0], [0], [98.959], [1.7754]]], [[[1465.7329, 1482.5544, 1520.0833, 1554.3808, 1587.5988, 1622.0852, 1660.8547, 1694.8976, 1731.1885], [1.0, 1.0115, 1.0371, 1.0605, 1.0831, 1.1067, 1.1331, 1.1563, 1.1811], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [49.5632, 50.3744, 0.0, 51.8752, 0.0, 53.1248, 0.0, 54.5312, 0.0, 55.968, 0.0, 57.2816, 0.0, 58.8752, 0.0, 60.0624]], [[100.8106], [1.0], [0], [98.959], [1.8516]]], [[[1467.7329, 1484.5544, 1522.1457, 1556.8192, 1589.9108, 1624.8676, 1663.6979, 1697.7104, 1734.4077], [1.0, 1.0115, 1.0371, 1.0607, 1.0832, 1.1071, 1.1335, 1.1567, 1.1817], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [51.5632, 52.3744, 0.0, 53.9376, 0.0, 55.5632, 0.0, 56.8432, 0.0, 58.7504, 0.0, 60.1248, 0.0, 61.688, 0.0, 63.2816]], [[100.8867], [1.0], [0], [98.959], [1.9277]]], [[[1469.7953, 1486.6792, 1524.1761, 1558.9744, 1592.474, 1627.1796, 1666.4787, 1700.5856, 1737.5949], [1.0, 1.0115, 1.037, 1.0607, 1.0835, 1.1071, 1.1338, 1.157, 1.1822], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [53.6256, 54.4992, 0.0, 55.968, 0.0, 57.7184, 0.0, 59.4064, 0.0, 61.0624, 0.0, 62.9056, 0.0, 64.5632, 0.0, 66.4688]], [[100.9492], [1.0], [0], [98.959], [1.9902]]], [[[1471.7009, 1488.5544, 1526.4273, 1561.256, 1595.0052, 1629.8676, 1669.2291, 1703.3968, 1740.2509], [1.0, 1.0115, 1.0372, 1.0609, 1.0838, 1.1075, 1.1342, 1.1574, 1.1825], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [55.5312, 56.3744, 0.0, 58.2192, 0.0, 60.0, 0.0, 61.9376, 0.0, 63.7504, 0.0, 65.656, 0.0, 67.3744, 0.0, 69.1248]], [[101.0274], [1.0], [0], [98.959], [2.0684]]], [[[1473.5761, 1490.492, 1528.5521, 1563.7872, 1597.5044, 1632.3364, 1672.0419, 1706.272, 1743.2205], [1.0, 1.0115, 1.0373, 1.0612, 1.0841, 1.1077, 1.1347, 1.1579, 1.183], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [57.4064, 58.312, 0.0, 60.344, 0.0, 62.5312, 0.0, 64.4368, 0.0, 66.2192, 0.0, 68.4688, 0.0, 70.2496, 0.0, 72.0944]], [[101.0977], [1.0], [0], [98.959], [2.1387]]], [[[1475.4817, 1492.3992, 1530.7393, 1565.9744, 1599.9108, 1634.8676, 1674.6675, 1709.3344, 1746.3757], [1.0, 1.0115, 1.0375, 1.0613, 1.0843, 1.108, 1.135, 1.1585, 1.1836], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [59.312, 60.2192, 0.0, 62.5312, 0.0, 64.7184, 0.0, 66.8432, 0.0, 68.7504, 0.0, 71.0944, 0.0, 73.312, 0.0, 75.2496]], [[101.168], [1.0], [0], [98.959], [2.209]]], [[[1477.3889, 1494.3992, 1533.0209, 1568.1312, 1602.3492, 1637.8676, 1677.3539, 1712.0544, 1749.3133], [1.0, 1.0115, 1.0377, 1.0614, 1.0846, 1.1086, 1.1354, 1.1588, 1.1841], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1416.1697, 1432.18, 1468.2081, 1501.256, 1533.0676, 1566.1172, 1603.5731, 1636.0224, 1671.1261], [61.2192, 62.2192, 0.0, 64.8128, 0.0, 66.8752, 0.0, 69.2816, 0.0, 71.7504, 0.0, 73.7808, 0.0, 76.032, 0.0, 78.1872]], [[101.2363], [1.0], [0], [98.959], [2.2773]]]], {"batch_size": 1, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 16, "llm_max_qo_len_query": 16, "max_interval_id": 14, "model_ratio_array": [14.4703, 14.4793, 14.4893, 14.4966, 14.5061, 14.5149, 14.5253, 14.5319, 14.5395, 14.5483, 14.5598, 14.5673, 14.5758, 14.5845, 14.5935], "slm_max_qo_len": 1}], "16": [[[[[1745.2527, 2019.1937, 2559.0024, 3102.0817, 3644.9518, 4179.33, 4721.921, 5265.7556, 5799.3306], [1.0, 1.157, 1.4663, 1.7774, 2.0885, 2.3947, 2.7056, 3.0172, 3.3229], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [77.3216, 78.392, 0.0, 82.3328, 0.0, 85.5424, 0.0, 90.5424, 0.0, 92.08, 0.0, 94.9552, 0.0, 98.6528, 0.0, 101.5008]], [[161.9641], [1.0], [0], [159.0913], [2.8728]]], [[[1775.7743, 2051.4273, 2593.2952, 3138.8209, 3682.5342, 4221.4372, 4766.7466, 5313.0708, 5849.393], [1.0, 1.1552, 1.4604, 1.7676, 2.0738, 2.3772, 2.6843, 2.992, 3.294], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [107.8432, 110.6256, 0.0, 116.6256, 0.0, 122.2816, 0.0, 128.1248, 0.0, 134.1872, 0.0, 139.7808, 0.0, 145.968, 0.0, 151.5632]], [[163.1128], [1.0], [0], [159.0913], [4.0215]]], [[[1806.0559, 2083.1761, 2627.2952, 3175.0705, 3721.1902, 4262.5316, 4810.0602, 5358.8212, 5898.4858], [1.0, 1.1534, 1.4547, 1.758, 2.0604, 2.3601, 2.6633, 2.9671, 3.2659], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [138.1248, 142.3744, 0.0, 150.6256, 0.0, 158.5312, 0.0, 166.7808, 0.0, 175.2816, 0.0, 183.0944, 0.0, 191.7184, 0.0, 200.656]], [[164.2632], [1.0], [0], [159.0913], [5.1719]]], [[[1837.4319, 2115.1137, 2661.5128, 3211.8209, 3760.7838, 4303.6244, 4853.7466, 5404.5716, 5946.4234], [1.0, 1.1511, 1.4485, 1.748, 2.0468, 2.3422, 2.6416, 2.9414, 3.2363], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [169.5008, 174.312, 0.0, 184.8432, 0.0, 195.2816, 0.0, 206.3744, 0.0, 216.3744, 0.0, 226.7808, 0.0, 237.4688, 0.0, 248.5936]], [[165.4136], [1.0], [0], [159.0913], [6.3223]]], [[[1867.7119, 2147.3329, 2696.1704, 3248.1329, 3798.8782, 4345.0004, 4898.4026, 5451.2276, 5994.1114], [1.0, 1.1497, 1.4436, 1.7391, 2.034, 2.3264, 2.6227, 2.9187, 3.2093], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [199.7808, 206.5312, 0.0, 219.5008, 0.0, 231.5936, 0.0, 244.4688, 0.0, 257.7504, 0.0, 271.4368, 0.0, 284.1248, 0.0, 296.2816]], [[166.5679], [1.0], [0], [159.0913], [7.4766]]], [[[1898.5567, 2179.0833, 2729.2008, 3284.9761, 3838.2222, 4387.1556, 4941.6538, 5496.5092, 6043.049], [1.0, 1.1478, 1.4375, 1.7302, 2.0217, 2.3108, 2.6028, 2.8951, 3.183], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [230.6256, 238.2816, 0.0, 252.5312, 0.0, 268.4368, 0.0, 283.8128, 0.0, 299.9056, 0.0, 314.688, 0.0, 329.4064, 0.0, 345.2192]], [[167.7143], [1.0], [0], [159.0913], [8.623]]], [[[1928.8687, 2210.7697, 2764.4504, 3321.4769, 3876.5662, 4425.906, 4984.8714, 5542.3524, 6091.393], [1.0, 1.1461, 1.4332, 1.722, 2.0098, 2.2946, 2.5843, 2.8734, 3.158], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [260.9376, 269.968, 0.0, 287.7808, 0.0, 304.9376, 0.0, 322.1568, 0.0, 338.656, 0.0, 357.9056, 0.0, 375.2496, 0.0, 393.5632]], [[168.8686], [1.0], [0], [159.0913], [9.7773]]], [[[1959.8367, 2243.3649, 2797.8568, 3357.7585, 3916.9726, 4469.6244, 5029.2778, 5588.1348, 6138.5482], [1.0, 1.1447, 1.4276, 1.7133, 1.9986, 2.2806, 2.5662, 2.8513, 3.1322], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [291.9056, 302.5632, 0.0, 321.1872, 0.0, 341.2192, 0.0, 362.5632, 0.0, 382.3744, 0.0, 402.312, 0.0, 421.032, 0.0, 440.7184]], [[170.0327], [1.0], [0], [159.0913], [10.9414]]], [[[1990.5871, 2273.7393, 2832.7944, 3394.4769, 3954.691, 4510.0308, 5072.0602, 5634.0404, 6188.9866], [1.0, 1.1422, 1.4231, 1.7053, 1.9867, 2.2657, 2.548, 2.8303, 3.1091], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [322.656, 332.9376, 0.0, 356.1248, 0.0, 377.9376, 0.0, 400.2816, 0.0, 422.7808, 0.0, 445.0944, 0.0, 466.9376, 0.0, 491.1568]], [[171.1772], [1.0], [0], [159.0913], [12.0859]]], [[[2020.5871, 2306.0833, 2865.8568, 3432.6641, 3994.9406, 4552.4068, 5116.185, 5680.634, 6237.2042], [1.0, 1.1413, 1.4183, 1.6988, 1.9771, 2.253, 2.532, 2.8114, 3.0868], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [352.656, 365.2816, 0.0, 389.1872, 0.0, 416.1248, 0.0, 440.5312, 0.0, 465.1568, 0.0, 489.2192, 0.0, 513.5312, 0.0, 539.3744]], [[172.355], [1.0], [0], [159.0913], [13.2637]]], [[[2051.5247, 2337.1457, 2900.6072, 3467.8209, 4033.003, 4592.8436, 5160.3722, 5727.5092, 6284.7674], [1.0, 1.1392, 1.4139, 1.6904, 1.9659, 2.2387, 2.5154, 2.7918, 3.0635], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [383.5936, 396.344, 0.0, 423.9376, 0.0, 451.2816, 0.0, 478.5936, 0.0, 505.5936, 0.0, 533.4064, 0.0, 560.4064, 0.0, 586.9376]], [[173.4429], [1.0], [0], [159.0913], [14.3516]]], [[[2081.5247, 2368.8017, 2934.8888, 3504.9761, 4072.0974, 4634.1556, 5202.6842, 5772.4148, 6332.705], [1.0, 1.138, 1.41, 1.6839, 1.9563, 2.2263, 2.4995, 2.7732, 3.0423], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [413.5936, 428.0, 0.0, 458.2192, 0.0, 488.4368, 0.0, 517.688, 0.0, 546.9056, 0.0, 575.7184, 0.0, 605.312, 0.0, 634.8752]], [[174.5854], [1.0], [0], [159.0913], [15.4941]]], [[[2112.6495, 2401.3009, 2969.1688, 3541.6961, 4110.4094, 4675.938, 5248.8714, 5818.6036, 6382.9242], [1.0, 1.1366, 1.4054, 1.6764, 1.9456, 2.2133, 2.4845, 2.7542, 3.0213], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [444.7184, 460.4992, 0.0, 492.4992, 0.0, 525.1568, 0.0, 556.0, 0.0, 588.688, 0.0, 621.9056, 0.0, 651.5008, 0.0, 685.0944]], [[175.7495], [1.0], [0], [159.0913], [16.6582]]], [[[2143.8687, 2433.5201, 3004.0136, 3579.0705, 4149.9726, 4715.7492, 5291.7786, 5867.8532, 6431.4858], [1.0, 1.1351, 1.4012, 1.6694, 1.9357, 2.1996, 2.4683, 2.737, 2.9999], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [475.9376, 492.7184, 0.0, 527.344, 0.0, 562.5312, 0.0, 595.5632, 0.0, 628.4992, 0.0, 664.8128, 0.0, 700.7504, 0.0, 733.656]], [[176.9546], [1.0], [0], [159.0913], [17.8633]]], [[[2173.6191, 2463.0833, 3038.5448, 3613.7585, 4188.4718, 4756.4692, 5334.153, 5908.7588, 6478.6426], [1.0, 1.1332, 1.3979, 1.6626, 1.927, 2.1883, 2.454, 2.7184, 2.9806], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1667.9311, 1940.8017, 2476.6696, 3016.5393, 3554.4094, 4087.25, 4626.9658, 5167.1028, 5697.8298], [505.688, 522.2816, 0.0, 561.8752, 0.0, 597.2192, 0.0, 634.0624, 0.0, 669.2192, 0.0, 707.1872, 0.0, 741.656, 0.0, 780.8128]], [[178.0737], [1.0], [0], [159.0913], [18.9824]]]], {"batch_size": 16, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 16, "llm_max_qo_len_query": 16, "max_interval_id": 14, "model_ratio_array": [10.7756, 10.8868, 10.9949, 11.1081, 11.2129, 11.3202, 11.4223, 11.5262, 11.6288, 11.7234, 11.8282, 11.9227, 12.0208, 12.1154, 12.2063], "slm_max_qo_len": 1}], "4": [[[[[1510.7188, 1580.8209, 1713.308, 1849.8209, 1985.6206, 2123.298, 2252.7396, 2387.6035, 2526.8002], [1.0, 1.0464, 1.1341, 1.2245, 1.3144, 1.4055, 1.4912, 1.5804, 1.6726], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [42.8752, 43.2192, 0.0, 44.2192, 0.0, 45.032, 0.0, 45.7808, 0.0, 46.8128, 0.0, 47.7504, 0.0, 48.5936, 0.0, 49.312]], [[112.502], [1.0], [0], [110.9024], [1.5996]]], [[[1518.562, 1588.9761, 1721.7448, 1859.0705, 1995.5582, 2133.642, 2263.7076, 2398.9779, 2539.0194], [1.0, 1.0464, 1.1338, 1.2242, 1.3141, 1.405, 1.4907, 1.5798, 1.672], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [50.7184, 51.3744, 0.0, 52.656, 0.0, 54.2816, 0.0, 55.7184, 0.0, 57.1568, 0.0, 58.7184, 0.0, 59.968, 0.0, 61.5312]], [[112.7911], [1.0], [0], [110.9024], [1.8887]]], [[[1526.0004, 1596.7889, 1730.3384, 1868.0385, 2005.1214, 2143.954, 2274.49, 2410.6035, 2551.1762], [1.0, 1.0464, 1.1339, 1.2241, 1.314, 1.4049, 1.4905, 1.5797, 1.6718], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [58.1568, 59.1872, 0.0, 61.2496, 0.0, 63.2496, 0.0, 65.2816, 0.0, 67.4688, 0.0, 69.5008, 0.0, 71.5936, 0.0, 73.688]], [[113.0645], [1.0], [0], [110.9024], [2.1621]]], [[[1533.7812, 1604.9137, 1738.8696, 1877.2881, 2015.059, 2154.1732, 2285.2388, 2422.2915, 2563.1138], [1.0, 1.0464, 1.1337, 1.224, 1.3138, 1.4045, 1.4899, 1.5793, 1.6711], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [65.9376, 67.312, 0.0, 69.7808, 0.0, 72.4992, 0.0, 75.2192, 0.0, 77.688, 0.0, 80.2496, 0.0, 83.2816, 0.0, 85.6256]], [[113.3614], [1.0], [0], [110.9024], [2.459]]], [[[1541.4692, 1612.7265, 1747.8072, 1886.1953, 2024.4654, 2164.5796, 2296.3636, 2433.4787, 2575.4258], [1.0, 1.0462, 1.1339, 1.2236, 1.3133, 1.4042, 1.4897, 1.5787, 1.6708], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [73.6256, 75.1248, 0.0, 78.7184, 0.0, 81.4064, 0.0, 84.6256, 0.0, 88.0944, 0.0, 91.3744, 0.0, 94.4688, 0.0, 97.9376]], [[113.6465], [1.0], [0], [110.9024], [2.7441]]], [[[1549.1252, 1620.8209, 1756.1832, 1895.6017, 2034.4334, 2175.0484, 2307.458, 2444.9155, 2587.3634], [1.0, 1.0463, 1.1337, 1.2237, 1.3133, 1.404, 1.4895, 1.5783, 1.6702], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [81.2816, 83.2192, 0.0, 87.0944, 0.0, 90.8128, 0.0, 94.5936, 0.0, 98.5632, 0.0, 102.4688, 0.0, 105.9056, 0.0, 109.8752]], [[113.9415], [1.0], [0], [110.9024], [3.0391]]], [[[1556.7492, 1628.9137, 1764.5576, 1904.5073, 2044.2462, 2185.2356, 2318.146, 2456.7603, 2599.5826], [1.0, 1.0464, 1.1335, 1.2234, 1.3132, 1.4037, 1.4891, 1.5781, 1.6699], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [88.9056, 91.312, 0.0, 95.4688, 0.0, 99.7184, 0.0, 104.4064, 0.0, 108.7504, 0.0, 113.1568, 0.0, 117.7504, 0.0, 122.0944]], [[114.2227], [1.0], [0], [110.9024], [3.3203]]], [[[1564.6564, 1636.8513, 1773.0888, 1913.8209, 2053.7774, 2195.61, 2328.9892, 2467.9475, 2611.8322], [1.0, 1.0461, 1.1332, 1.2232, 1.3126, 1.4033, 1.4885, 1.5773, 1.6693], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [96.8128, 99.2496, 0.0, 104.0, 0.0, 109.032, 0.0, 113.9376, 0.0, 119.1248, 0.0, 124.0, 0.0, 128.9376, 0.0, 134.344]], [[114.5098], [1.0], [0], [110.9024], [3.6074]]], [[[1571.906, 1644.6017, 1781.588, 1923.2881, 2063.8718, 2205.8916, 2340.0836, 2479.7603, 2624.0514], [1.0, 1.0462, 1.1334, 1.2235, 1.313, 1.4033, 1.4887, 1.5775, 1.6693], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [104.0624, 107.0, 0.0, 112.4992, 0.0, 118.4992, 0.0, 124.032, 0.0, 129.4064, 0.0, 135.0944, 0.0, 140.7504, 0.0, 146.5632]], [[114.8008], [1.0], [0], [110.9024], [3.8984]]], [[[1579.8436, 1652.6961, 1789.9016, 1932.2897, 2073.371, 2216.4852, 2351.2084, 2491.0099, 2635.4258], [1.0, 1.0461, 1.133, 1.2231, 1.3124, 1.403, 1.4883, 1.5767, 1.6682], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [112.0, 115.0944, 0.0, 120.8128, 0.0, 127.5008, 0.0, 133.5312, 0.0, 140.0, 0.0, 146.2192, 0.0, 152.0, 0.0, 157.9376]], [[115.086], [1.0], [0], [110.9024], [4.1836]]], [[[1587.1876, 1660.4449, 1798.652, 1941.6017, 2083.0894, 2226.298, 2361.5524, 2502.9779, 2647.8946], [1.0, 1.0462, 1.1332, 1.2233, 1.3124, 1.4027, 1.4879, 1.577, 1.6683], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [119.344, 122.8432, 0.0, 129.5632, 0.0, 136.8128, 0.0, 143.2496, 0.0, 149.8128, 0.0, 156.5632, 0.0, 163.968, 0.0, 170.4064]], [[115.377], [1.0], [0], [110.9024], [4.4746]]], [[[1595.1252, 1668.4145, 1807.276, 1950.1329, 2092.9966, 2236.8596, 2372.426, 2514.3539, 2660.0818], [1.0, 1.0459, 1.133, 1.2226, 1.3121, 1.4023, 1.4873, 1.5763, 1.6676], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [127.2816, 130.8128, 0.0, 138.1872, 0.0, 145.344, 0.0, 153.1568, 0.0, 160.3744, 0.0, 167.4368, 0.0, 175.344, 0.0, 182.5936]], [[115.6641], [1.0], [0], [110.9024], [4.7617]]], [[[1603.0308, 1676.4769, 1815.308, 1959.4145, 2102.4958, 2246.6724, 2383.5524, 2525.7283, 2672.3314], [1.0, 1.0458, 1.1324, 1.2223, 1.3116, 1.4015, 1.4869, 1.5756, 1.667], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [135.1872, 138.8752, 0.0, 146.2192, 0.0, 154.6256, 0.0, 162.656, 0.0, 170.1872, 0.0, 178.5632, 0.0, 186.7184, 0.0, 194.8432]], [[115.959], [1.0], [0], [110.9024], [5.0566]]], [[[1610.5316, 1684.0385, 1824.7448, 1968.5073, 2112.5582, 2257.4228, 2394.8324, 2537.2595, 2683.925], [1.0, 1.0456, 1.133, 1.2223, 1.3117, 1.4017, 1.487, 1.5754, 1.6665], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [142.688, 146.4368, 0.0, 155.656, 0.0, 163.7184, 0.0, 172.7184, 0.0, 180.9376, 0.0, 189.8432, 0.0, 198.2496, 0.0, 206.4368]], [[116.2422], [1.0], [0], [110.9024], [5.3398]]], [[[1618.4692, 1692.5697, 1833.1208, 1977.8209, 2122.059, 2268.0788, 2405.3956, 2548.4163, 2695.6754], [1.0, 1.0458, 1.1326, 1.222, 1.3112, 1.4014, 1.4862, 1.5746, 1.6656], [0, 1, 3, 5, 7, 9, 11, 13, 15], [1467.8436, 1537.6017, 1669.0888, 1804.7889, 1939.8398, 2076.4852, 2204.9892, 2339.0099, 2477.4882], [150.6256, 154.968, 0.0, 164.032, 0.0, 173.032, 0.0, 182.2192, 0.0, 191.5936, 0.0, 200.4064, 0.0, 209.4064, 0.0, 218.1872]], [[116.5098], [1.0], [0], [110.9024], [5.6074]]]], {"batch_size": 4, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 16, "llm_max_qo_len_query": 16, "max_interval_id": 14, "model_ratio_array": [13.4284, 13.4635, 13.4967, 13.53, 13.5637, 13.5958, 13.6291, 13.664, 13.6925, 13.7275, 13.7565, 13.791, 13.8241, 13.855, 13.8913], "slm_max_qo_len": 1}], "64": [[[[[2692.9208, 3771.2702, 5940.2112, 8100.9909, 10247.8473, 12410.5603, 14585.8448, 16759.0828, 18933.681], [1.0, 1.4004, 2.2059, 3.0083, 3.8055, 4.6086, 5.4164, 6.2234, 7.0309], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [215.176, 218.608, 0.0, 238.4992, 0.0, 248.4992, 0.0, 265.176, 0.0, 279.176, 0.0, 293.696, 0.0, 308.9568, 0.0, 321.0592]], [[358.6545], [1.0], [0], [350.6476], [8.0069]]], [[[2815.5032, 3900.7246, 6073.2128, 8248.4245, 10401.3721, 12570.5219, 14752.7936, 16938.7692, 19120.553], [1.0, 1.3854, 2.1571, 2.9296, 3.6943, 4.4648, 5.2398, 6.0162, 6.7912], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [337.7584, 348.0624, 0.0, 371.5008, 0.0, 395.9328, 0.0, 418.7008, 0.0, 439.1376, 0.0, 460.6448, 0.0, 488.6432, 0.0, 507.9312]], [[363.2288], [1.0], [0], [350.6476], [12.5812]]], [[[2936.6824, 4028.9118, 6209.1488, 8394.2101, 10558.4841, 12739.9779, 14932.6176, 17123.0316, 19318.9034], [1.0, 1.3719, 2.1143, 2.8584, 3.5954, 4.3382, 5.0849, 5.8307, 6.5785], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [458.9376, 476.2496, 0.0, 507.4368, 0.0, 541.7184, 0.0, 575.8128, 0.0, 608.5936, 0.0, 640.4688, 0.0, 672.9056, 0.0, 706.2816]], [[367.7785], [1.0], [0], [350.6476], [17.1309]]], [[[3058.8392, 4154.5998, 6346.68, 8539.0229, 10712.2649, 12900.7587, 15105.3984, 17307.0316, 19509.2474], [1.0, 1.3582, 2.0749, 2.7916, 3.5021, 4.2175, 4.9383, 5.658, 6.378], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [581.0944, 601.9376, 0.0, 644.968, 0.0, 686.5312, 0.0, 729.5936, 0.0, 769.3744, 0.0, 813.2496, 0.0, 856.9056, 0.0, 896.6256]], [[372.4464], [1.0], [0], [350.6476], [21.7988]]], [[[3181.8392, 4283.6622, 6482.68, 8686.7413, 10867.0457, 13070.2899, 15282.2432, 17489.438, 19705.7786], [1.0, 1.3463, 2.0374, 2.7301, 3.4153, 4.1078, 4.803, 5.4966, 6.1932], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [704.0944, 731.0, 0.0, 780.968, 0.0, 834.2496, 0.0, 884.3744, 0.0, 938.9056, 0.0, 990.0944, 0.0, 1039.312, 0.0, 1093.1568]], [[377.0675], [1.0], [0], [350.6476], [26.4199]]], [[[3303.4632, 4410.0686, 6619.024, 8833.3349, 11019.8585, 13232.3219, 15460.712, 17671.782, 19899.8714], [1.0, 1.335, 2.0037, 2.674, 3.3359, 4.0056, 4.6802, 5.3495, 6.0239], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [825.7184, 857.4064, 0.0, 917.312, 0.0, 980.8432, 0.0, 1037.1872, 0.0, 1100.9376, 0.0, 1168.5632, 0.0, 1221.656, 0.0, 1287.2496]], [[381.7081], [1.0], [0], [350.6476], [31.0605]]], [[[3426.7768, 4537.5054, 6756.4928, 8977.2421, 11180.4217, 13396.9779, 15628.68, 17858.2204, 20089.7466], [1.0, 1.3241, 1.9717, 2.6197, 3.2627, 3.9095, 4.5608, 5.2114, 5.8626], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [949.032, 984.8432, 0.0, 1054.7808, 0.0, 1124.7504, 0.0, 1197.7504, 0.0, 1265.5936, 0.0, 1336.5312, 0.0, 1408.0944, 0.0, 1477.1248]], [[386.2062], [1.0], [0], [350.6476], [35.5586]]], [[[3549.5576, 4664.4126, 6895.4624, 9126.1173, 11337.4521, 13561.4787, 15801.2432, 18046.5324, 20284.841], [1.0, 1.3141, 1.9426, 2.5711, 3.194, 3.8206, 4.4516, 5.0842, 5.7148], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1071.8128, 1111.7504, 0.0, 1193.7504, 0.0, 1273.6256, 0.0, 1354.7808, 0.0, 1430.0944, 0.0, 1509.0944, 0.0, 1596.4064, 0.0, 1672.2192]], [[390.8234], [1.0], [0], [350.6476], [40.1758]]], [[[3671.276, 4793.5678, 7025.2432, 9273.4917, 11489.5769, 13728.6659, 15981.368, 18230.6892, 20479.9962], [1.0, 1.3057, 1.9136, 2.526, 3.1296, 3.7395, 4.3531, 4.9658, 5.5784], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1193.5312, 1240.9056, 0.0, 1323.5312, 0.0, 1421.0, 0.0, 1506.9056, 0.0, 1597.2816, 0.0, 1689.2192, 0.0, 1780.5632, 0.0, 1867.3744]], [[395.4953], [1.0], [0], [350.6476], [44.8477]]], [[[3798.6824, 4921.099, 7167.2432, 9422.7109, 11645.9529, 13893.5715, 16154.992, 18416.0012, 20669.6538], [1.0, 1.2955, 1.8868, 2.4805, 3.0658, 3.6575, 4.2528, 4.848, 5.4413], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1320.9376, 1368.4368, 0.0, 1465.5312, 0.0, 1570.2192, 0.0, 1663.2816, 0.0, 1762.1872, 0.0, 1862.8432, 0.0, 1965.8752, 0.0, 2057.032]], [[400.1124], [1.0], [0], [350.6476], [49.4648]]], [[[3919.9016, 5042.6942, 7306.3376, 9568.0549, 11802.2649, 14062.8851, 16325.336, 18595.9692, 20866.9338], [1.0, 1.2864, 1.8639, 2.4409, 3.0109, 3.5876, 4.1647, 4.744, 5.3233], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1442.1568, 1490.032, 0.0, 1604.6256, 0.0, 1715.5632, 0.0, 1819.5936, 0.0, 1931.5008, 0.0, 2033.1872, 0.0, 2145.8432, 0.0, 2254.312]], [[404.7433], [1.0], [0], [350.6476], [54.0957]]], [[[4043.6504, 5172.6942, 7443.8064, 9715.7109, 11959.6713, 14222.9475, 16500.5552, 18780.0636, 21061.9338], [1.0, 1.2792, 1.8409, 2.4027, 2.9576, 3.5174, 4.0806, 4.6443, 5.2086], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1565.9056, 1620.032, 0.0, 1742.0944, 0.0, 1863.2192, 0.0, 1977.0, 0.0, 2091.5632, 0.0, 2208.4064, 0.0, 2329.9376, 0.0, 2449.312]], [[409.3898], [1.0], [0], [350.6476], [58.7422]]], [[[4163.276, 5299.7246, 7579.5872, 9859.3973, 12112.9529, 14390.6339, 16678.7744, 18961.5948, 21258.2474], [1.0, 1.273, 1.8206, 2.3682, 2.9095, 3.4566, 4.0062, 4.5545, 5.1061], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1685.5312, 1747.0624, 0.0, 1877.8752, 0.0, 2006.9056, 0.0, 2130.2816, 0.0, 2259.2496, 0.0, 2386.6256, 0.0, 2511.4688, 0.0, 2645.6256]], [[413.9445], [1.0], [0], [350.6476], [63.2969]]], [[[4285.2456, 5431.131, 7718.6176, 10001.2725, 12270.8281, 14555.1651, 16853.368, 19147.2828, 21447.7786], [1.0, 1.2674, 1.8012, 2.3339, 2.8635, 3.3966, 3.9329, 4.4682, 5.005], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1807.5008, 1878.4688, 0.0, 2016.9056, 0.0, 2148.7808, 0.0, 2288.1568, 0.0, 2423.7808, 0.0, 2561.2192, 0.0, 2697.1568, 0.0, 2835.1568]], [[418.2648], [1.0], [0], [350.6476], [67.6172]]], [[[4407.308, 5553.475, 7855.9936, 10147.2101, 12416.2345, 14721.7587, 17027.1488, 19329.8444, 21646.0906], [1.0, 1.2601, 1.7825, 2.3024, 2.8172, 3.3403, 3.8634, 4.3859, 4.9114], [0, 1, 3, 5, 7, 9, 11, 13, 15], [2477.7448, 3552.6622, 5701.712, 7852.4917, 9982.6713, 12131.3843, 14292.1488, 16450.126, 18612.6218], [1929.5632, 2000.8128, 0.0, 2154.2816, 0.0, 2294.7184, 0.0, 2433.5632, 0.0, 2590.3744, 0.0, 2735.0, 0.0, 2879.7184, 0.0, 3033.4688]], [[422.921], [1.0], [0], [350.6476], [72.2734]]]], {"batch_size": 64, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 16, "llm_max_qo_len_query": 16, "max_interval_id": 14, "model_ratio_array": [7.5084, 7.7513, 7.9849, 8.2128, 8.4384, 8.6544, 8.8729, 9.0823, 9.2827, 9.494, 9.6849, 9.8773, 10.0576, 10.2453, 10.4211], "slm_max_qo_len": 1}]}, "loaded_high_intensity": {"1": [[[[[1451.5609, 1569.9581, 1703.7803, 1972.6245, 2517.3883], [1.0, 1.0816, 1.1738, 1.359, 1.7343], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [34.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 35.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 36.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 37.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 41.2816]], [[100.1914, 104.2514, 112.1413, 128.0766], [1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.2793, 1.2812, 0.0, 1.2812, 0.0, 0.0, 0.0, 1.3105]]], [[[1453.5305, 1572.4893, 1706.7803, 1976.8437, 2524.0123], [1.0, 1.0818, 1.1742, 1.36, 1.7365], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [36.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 37.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 39.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 42.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.9056]], [[100.2656, 104.3218, 112.2234, 128.1704], [1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.3535, 1.3516, 0.0, 1.3633, 0.0, 0.0, 0.0, 1.4043]]], [[[1455.3113, 1574.8637, 1709.9051, 1980.9381, 2530.5435], [1.0, 1.0821, 1.1749, 1.3612, 1.7388], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [38.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 39.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 42.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 46.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 54.4368]], [[100.3301, 104.3979, 112.3074, 128.2427], [1.0, 1.0405, 1.1194, 1.2782], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.418, 1.4277, 0.0, 1.4473, 0.0, 0.0, 0.0, 1.4766]]], [[[1457.2809, 1577.3645, 1712.9051, 1985.0629, 2536.9819], [1.0, 1.0824, 1.1754, 1.3622, 1.7409], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [40.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 42.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 45.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 50.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 60.8752]], [[100.4062, 104.4761, 112.3874, 128.3501], [1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.4941, 1.5059, 0.0, 1.5273, 0.0, 0.0, 0.0, 1.584]]], [[[1459.1865, 1579.8013, 1715.7803, 1989.4373, 2543.8251], [1.0, 1.0827, 1.1758, 1.3634, 1.7433], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [42.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 44.9056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 48.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 54.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 67.7184]], [[100.4785, 104.5464, 112.4617, 128.4321], [1.0, 1.0405, 1.1193, 1.2782], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.5664, 1.5762, 0.0, 1.6016, 0.0, 0.0, 0.0, 1.666]]], [[[1460.9673, 1582.3325, 1718.9051, 1993.4373, 2549.9499], [1.0, 1.0831, 1.1766, 1.3645, 1.7454], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [43.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 51.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 58.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 73.8432]], [[100.5508, 104.6225, 112.5476, 128.5298], [1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.6387, 1.6523, 0.0, 1.6875, 0.0, 0.0, 0.0, 1.7637]]], [[[1463.0617, 1584.5837, 1721.8427, 1997.6245, 2556.7627], [1.0, 1.0831, 1.1769, 1.3654, 1.7475], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [45.8752, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 49.688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 54.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 62.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 80.656]], [[100.6191, 104.7007, 112.6374, 128.6157], [1.0, 1.0406, 1.1194, 1.2782], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.707, 1.7305, 0.0, 1.7773, 0.0, 0.0, 0.0, 1.8496]]], [[[1464.9673, 1587.1453, 1724.8747, 2001.9381, 2563.3563], [1.0, 1.0834, 1.1774, 1.3665, 1.7498], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [47.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 52.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 57.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 67.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 87.2496]], [[100.6875, 104.769, 112.7058, 128.7056], [1.0, 1.0405, 1.1194, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.7754, 1.7988, 0.0, 1.8457, 0.0, 0.0, 0.0, 1.9395]]], [[[1466.8121, 1589.4269, 1727.9051, 2005.9685, 2569.8571], [1.0, 1.0836, 1.178, 1.3676, 1.752], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [49.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 54.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 60.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 71.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 93.7504]], [[100.7637, 104.8452, 112.7976, 128.8013], [1.0, 1.0405, 1.1194, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.8516, 1.875, 0.0, 1.9375, 0.0, 0.0, 0.0, 2.0352]]], [[[1468.9049, 1591.7389, 1731.1547, 2010.4069, 2576.3563], [1.0, 1.0836, 1.1785, 1.3686, 1.7539], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [51.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 56.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 63.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 75.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.2496]], [[100.8398, 104.9155, 112.8699, 128.897], [1.0, 1.0404, 1.1193, 1.2782], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.9277, 1.9453, 0.0, 2.0098, 0.0, 0.0, 0.0, 2.1309]]], [[[1470.5305, 1594.3021, 1733.9995, 2014.7493, 2583.1067], [1.0, 1.0842, 1.1792, 1.3701, 1.7566], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [53.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 59.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 66.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 79.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 107.0]], [[100.9023, 104.9975, 112.9519, 128.9809], [1.0, 1.0406, 1.1194, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [1.9902, 2.0273, 0.0, 2.0918, 0.0, 0.0, 0.0, 2.2148]]], [[[1472.6233, 1596.8333, 1737.1243, 2018.9061, 2589.3563], [1.0, 1.0843, 1.1796, 1.371, 1.7583], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [55.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 61.9376, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 69.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 84.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 113.2496]], [[100.9805, 105.0796, 113.032, 129.0766], [1.0, 1.0406, 1.1193, 1.2782], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [2.0684, 2.1094, 0.0, 2.1719, 0.0, 0.0, 0.0, 2.3105]]], [[[1474.6873, 1599.3325, 1740.0299, 2023.1557, 2596.0123], [1.0, 1.0845, 1.1799, 1.3719, 1.7604], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [57.5008, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 64.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 72.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 88.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 119.9056]], [[101.0508, 105.1421, 113.1081, 129.1645], [1.0, 1.0405, 1.1193, 1.2782], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [2.1387, 2.1719, 0.0, 2.248, 0.0, 0.0, 0.0, 2.3984]]], [[[1476.4057, 1601.7389, 1742.9675, 2027.1253, 2602.8875], [1.0, 1.0849, 1.1805, 1.373, 1.763], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [59.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 66.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 75.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 92.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 126.7808]], [[101.1211, 105.2163, 113.1843, 129.2583], [1.0, 1.0405, 1.1193, 1.2783], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [2.209, 2.2461, 0.0, 2.3242, 0.0, 0.0, 0.0, 2.4922]]], [[[1478.3433, 1604.1773, 1746.3435, 2031.4069, 2609.1691], [1.0, 1.0851, 1.1813, 1.3741, 1.7649], [0, 7, 15, 31, 63], [1417.1865, 1534.8957, 1667.7803, 1934.7813, 2476.1067], [61.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 69.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 78.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 96.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 133.0624]], [[101.1894, 105.2983, 113.2663, 129.3559], [1.0, 1.0406, 1.1193, 1.2784], [0, 1, 3, 7], [98.9121, 102.9702, 110.8601, 126.7661], [2.2773, 2.3281, 0.0, 2.4062, 0.0, 0.0, 0.0, 2.5898]]]], {"batch_size": 1, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 64, "llm_max_qo_len_query": 64, "max_interval_id": 14, "model_ratio_array": [14.4879, 14.4968, 14.5052, 14.5139, 14.5224, 14.5296, 14.5406, 14.5496, 14.5569, 14.5667, 14.5738, 14.5832, 14.5935, 14.6004, 14.6097], "slm_max_qo_len": 8}], "16": [[[[[1749.1472, 2556.7958, 3648.5052, 5806.5512, 10121.0298], [1.0, 1.4617, 2.0859, 3.3196, 5.7863], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [76.4832, 0.0, 0.0, 82.1792, 0.0, 0.0, 0.0, 88.6192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 103.2912, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 130.688]], [[161.7063, 226.3467, 353.8327, 609.5686], [1.0, 1.3997, 2.1881, 3.7696], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [2.8728, 2.9332, 0.0, 3.1208, 0.0, 0.0, 0.0, 3.3411]]], [[[1780.32, 2590.8982, 3688.0428, 5854.6664, 10188.9978], [1.0, 1.4553, 2.0716, 3.2885, 5.7231], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [107.656, 0.0, 0.0, 116.2816, 0.0, 0.0, 0.0, 128.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 151.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 198.656]], [[162.855, 227.558, 355.0635, 611.0302], [1.0, 1.3973, 2.1802, 3.752], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [4.0215, 4.1445, 0.0, 4.3516, 0.0, 0.0, 0.0, 4.8027]]], [[[1810.7584, 2625.1478, 3726.918, 5902.6664, 10256.0602], [1.0, 1.4498, 2.0582, 3.2598, 5.664], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [138.0944, 0.0, 0.0, 150.5312, 0.0, 0.0, 0.0, 167.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 199.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 265.7184]], [[164.0054, 228.7319, 356.3506, 612.4755], [1.0, 1.3947, 2.1728, 3.7345], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [5.1719, 5.3184, 0.0, 5.6387, 0.0, 0.0, 0.0, 6.248]]], [[[1841.664, 2659.711, 3765.6044, 5951.26, 10322.9674], [1.0, 1.4442, 2.0447, 3.2315, 5.6052], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [169.0, 0.0, 0.0, 185.0944, 0.0, 0.0, 0.0, 205.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 248.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 332.6256]], [[165.1558, 229.9565, 357.6357, 613.9404], [1.0, 1.3924, 2.1654, 3.7173], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [6.3223, 6.543, 0.0, 6.9238, 0.0, 0.0, 0.0, 7.7129]]], [[[1871.976, 2693.3046, 3804.6364, 6000.6344, 10390.841], [1.0, 1.4387, 2.0324, 3.2055, 5.5507], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [199.312, 0.0, 0.0, 218.688, 0.0, 0.0, 0.0, 244.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 297.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 400.4992]], [[166.3101, 231.1323, 358.9307, 615.4209], [1.0, 1.3898, 2.1582, 3.7004], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [7.4766, 7.7188, 0.0, 8.2188, 0.0, 0.0, 0.0, 9.1934]]], [[[1902.8832, 2727.8358, 3844.5116, 6048.572, 10457.4042], [1.0, 1.4335, 2.0204, 3.1786, 5.4956], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [230.2192, 0.0, 0.0, 253.2192, 0.0, 0.0, 0.0, 284.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 345.312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 467.0624]], [[167.4565, 232.3354, 360.2099, 616.8252], [1.0, 1.3874, 2.1511, 3.6835], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [8.623, 8.9219, 0.0, 9.498, 0.0, 0.0, 0.0, 10.5977]]], [[[1933.5392, 2761.5542, 3880.9804, 6096.4792, 10524.2794], [1.0, 1.4282, 2.0072, 3.153, 5.443], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [260.8752, 0.0, 0.0, 286.9376, 0.0, 0.0, 0.0, 321.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 393.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 533.9376]], [[168.6108, 233.5209, 361.4892, 618.333], [1.0, 1.385, 2.1439, 3.6672], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [9.7773, 10.1074, 0.0, 10.7773, 0.0, 0.0, 0.0, 12.1055]]], [[[1963.9136, 2797.1158, 3922.198, 6145.4168, 10591.185], [1.0, 1.4243, 1.9971, 3.1292, 5.3929], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [291.2496, 0.0, 0.0, 322.4992, 0.0, 0.0, 0.0, 362.312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 442.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 600.8432]], [[169.7749, 234.724, 362.7978, 619.7627], [1.0, 1.3826, 2.1369, 3.6505], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [10.9414, 11.3105, 0.0, 12.0859, 0.0, 0.0, 0.0, 13.5352]]], [[[1994.696, 2830.1174, 3960.3548, 6193.0728, 10658.4986], [1.0, 1.4188, 1.9854, 3.1048, 5.3434], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [322.032, 0.0, 0.0, 355.5008, 0.0, 0.0, 0.0, 400.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 489.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 668.1568]], [[170.9194, 235.9135, 364.0205, 621.247], [1.0, 1.3803, 2.1298, 3.6347], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [12.0859, 12.5, 0.0, 13.3086, 0.0, 0.0, 0.0, 15.0195]]], [[[2026.6016, 2865.6166, 4000.1052, 6242.0104, 10726.3738], [1.0, 1.414, 1.9738, 3.08, 5.2928], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [353.9376, 0.0, 0.0, 391.0, 0.0, 0.0, 0.0, 440.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 538.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 736.032]], [[172.0972, 237.0893, 365.3252, 622.663], [1.0, 1.3776, 2.1228, 3.6181], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [13.2637, 13.6758, 0.0, 14.6133, 0.0, 0.0, 0.0, 16.4355]]], [[[2056.2896, 2898.9606, 4038.4172, 6290.9784, 10794.841], [1.0, 1.4098, 1.9639, 3.0594, 5.2497], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [383.6256, 0.0, 0.0, 424.344, 0.0, 0.0, 0.0, 478.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 587.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 804.4992]], [[173.1851, 238.2983, 366.581, 624.1377], [1.0, 1.376, 2.1167, 3.6039], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [14.3516, 14.8848, 0.0, 15.8691, 0.0, 0.0, 0.0, 17.9102]]], [[[2087.352, 2933.367, 4077.2604, 6337.8232, 10860.4986], [1.0, 1.4053, 1.9533, 3.0363, 5.203], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [414.688, 0.0, 0.0, 458.7504, 0.0, 0.0, 0.0, 517.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 634.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 870.1568]], [[174.3276, 239.4682, 367.8506, 625.6025], [1.0, 1.3737, 2.1101, 3.5887], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [15.4941, 16.0547, 0.0, 17.1387, 0.0, 0.0, 0.0, 19.375]]], [[[2118.2272, 2967.1158, 4116.6044, 6389.0104, 10928.1226], [1.0, 1.4008, 1.9434, 3.0162, 5.1591], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [445.5632, 0.0, 0.0, 492.4992, 0.0, 0.0, 0.0, 556.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 685.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 937.7808]], [[175.4917, 240.6713, 369.1611, 627.0713], [1.0, 1.3714, 2.1036, 3.5732], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [16.6582, 17.2578, 0.0, 18.4492, 0.0, 0.0, 0.0, 20.8438]]], [[[2149.664, 3001.9286, 4154.2924, 6436.6344, 10999.8106], [1.0, 1.3965, 1.9325, 2.9943, 5.117], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [477.0, 0.0, 0.0, 527.312, 0.0, 0.0, 0.0, 594.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 733.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1009.4688]], [[176.6968, 241.8862, 370.4619, 628.5517], [1.0, 1.3689, 2.0966, 3.5572], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [17.8633, 18.4727, 0.0, 19.75, 0.0, 0.0, 0.0, 22.3242]]], [[[2178.632, 3035.6486, 4192.6668, 6483.4792, 11059.8426], [1.0, 1.3934, 1.9244, 2.9759, 5.0765], [0, 3, 7, 15, 31], [1672.664, 2474.6166, 3559.886, 5703.26, 9990.3418], [505.968, 0.0, 0.0, 561.032, 0.0, 0.0, 0.0, 632.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 780.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1069.5008]], [[177.8159, 243.0424, 371.6455, 630.0224], [1.0, 1.3668, 2.0901, 3.5431], [0, 1, 3, 7], [158.8335, 223.4135, 350.7119, 606.2275], [18.9824, 19.6289, 0.0, 20.9336, 0.0, 0.0, 0.0, 23.7949]]]], {"batch_size": 16, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 32, "llm_max_qo_len_query": 32, "max_interval_id": 14, "model_ratio_array": [10.8168, 10.9319, 11.0408, 11.1511, 11.2559, 11.3634, 11.4675, 11.5678, 11.6704, 11.7759, 11.8734, 11.9737, 12.0702, 12.1658, 12.2522], "slm_max_qo_len": 8}], "2": [[[[[1471.6862, 1705.804, 1979.7542, 2523.3227, 3598.3802], [1.0, 1.1591, 1.3452, 1.7146, 2.4451], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [37.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 38.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 40.4992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 43.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 50.9056]], [[104.3586, 112.3887, 128.3368, 160.5678], [1.0, 1.0769, 1.2298, 1.5386], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [1.3809, 1.3867, 0.0, 1.3984, 0.0, 0.0, 0.0, 1.4453]]], [[[1475.3118, 1710.6472, 1985.7238, 2531.8859, 3611.4746], [1.0, 1.1595, 1.346, 1.7162, 2.4479], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [41.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 43.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 46.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 52.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 64.0]], [[104.505, 112.5469, 128.5009, 160.7416], [1.0, 1.077, 1.2296, 1.5381], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [1.5273, 1.5449, 0.0, 1.5625, 0.0, 0.0, 0.0, 1.6191]]], [[[1479.2494, 1715.3656, 1991.8182, 2540.1355, 3624.7242], [1.0, 1.1596, 1.3465, 1.7172, 2.4504], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [44.9376, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 48.312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 52.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 60.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 77.2496]], [[104.6476, 112.6915, 128.6689, 160.9311], [1.0, 1.0769, 1.2295, 1.5378], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [1.6699, 1.6895, 0.0, 1.7305, 0.0, 0.0, 0.0, 1.8086]]], [[[1482.9998, 1720.46, 1997.8806, 2548.4491, 3638.0378], [1.0, 1.1601, 1.3472, 1.7184, 2.4532], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [48.688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 53.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 58.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 69.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 90.5632]], [[104.7941, 112.8399, 128.829, 161.103], [1.0, 1.0768, 1.2294, 1.5373], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [1.8164, 1.8379, 0.0, 1.8906, 0.0, 0.0, 0.0, 1.9805]]], [[[1486.6862, 1725.2104, 2003.8486, 2556.8555, 3651.0378], [1.0, 1.1604, 1.3479, 1.7198, 2.4558], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [52.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 58.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 64.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 77.5008, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 103.5632]], [[104.9386, 112.9922, 128.9911, 161.3002], [1.0, 1.0767, 1.2292, 1.5371], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [1.9609, 1.9902, 0.0, 2.0527, 0.0, 0.0, 0.0, 2.1777]]], [[[1490.5934, 1729.8968, 2010.0358, 2565.3547, 3664.0058], [1.0, 1.1605, 1.3485, 1.721, 2.4581], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [56.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 62.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 70.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 86.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 116.5312]], [[105.0754, 113.1387, 129.1474, 161.4819], [1.0, 1.0767, 1.2291, 1.5368], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.0977, 2.1367, 0.0, 2.209, 0.0, 0.0, 0.0, 2.3594]]], [[[1494.5614, 1734.804, 2015.9734, 2573.6363, 3677.5066], [1.0, 1.1607, 1.3489, 1.722, 2.4606], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [60.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 67.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 76.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 94.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 130.032]], [[105.2199, 113.2911, 129.3095, 161.6674], [1.0, 1.0767, 1.2289, 1.5365], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.2422, 2.2891, 0.0, 2.3711, 0.0, 0.0, 0.0, 2.5449]]], [[[1498.155, 1739.7096, 2022.0054, 2582.3227, 3690.225], [1.0, 1.1612, 1.3497, 1.7237, 2.4632], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [63.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 72.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 82.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 102.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 142.7504]], [[105.3703, 113.4356, 129.4677, 161.8373], [1.0, 1.0765, 1.2287, 1.5359], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.3926, 2.4336, 0.0, 2.5293, 0.0, 0.0, 0.0, 2.7148]]], [[[1502.155, 1744.804, 2028.0678, 2590.7291, 3704.1002], [1.0, 1.1615, 1.3501, 1.7247, 2.4659], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [67.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 77.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 88.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 111.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 156.6256]], [[105.505, 113.5918, 129.6239, 162.0248], [1.0, 1.0766, 1.2286, 1.5357], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.5273, 2.5898, 0.0, 2.6855, 0.0, 0.0, 0.0, 2.9023]]], [[[1506.2174, 1749.3976, 2034.0982, 2599.1355, 3716.0058], [1.0, 1.1615, 1.3505, 1.7256, 2.4671], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [71.9056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 82.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 94.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 119.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 168.5312]], [[105.6535, 113.7364, 129.788, 162.2045], [1.0, 1.0765, 1.2284, 1.5352], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.6758, 2.7344, 0.0, 2.8496, 0.0, 0.0, 0.0, 3.082]]], [[[1509.7486, 1754.5544, 2040.0678, 2607.6043, 3729.9114], [1.0, 1.1622, 1.3513, 1.7272, 2.4706], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [75.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 87.5008, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 128.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 182.4368]], [[105.8058, 113.8887, 129.956, 162.394], [1.0, 1.0764, 1.2283, 1.5348], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.8281, 2.8867, 0.0, 3.0176, 0.0, 0.0, 0.0, 3.2715]]], [[[1513.843, 1759.3656, 2046.5046, 2615.6667, 3742.3498], [1.0, 1.1622, 1.3519, 1.7278, 2.4721], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [79.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 92.312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 107.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 136.312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 194.8752]], [[105.9367, 114.0372, 130.1005, 162.5834], [1.0, 1.0765, 1.2281, 1.5347], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [2.959, 3.0352, 0.0, 3.1621, 0.0, 0.0, 0.0, 3.4609]]], [[[1517.499, 1764.2408, 2052.4422, 2624.1979, 3755.9738], [1.0, 1.1626, 1.3525, 1.7293, 2.4751], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [83.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 97.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 113.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 144.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 208.4992]], [[106.089, 114.1836, 130.2822, 162.7553], [1.0, 1.0763, 1.228, 1.5341], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [3.1113, 3.1816, 0.0, 3.3438, 0.0, 0.0, 0.0, 3.6328]]], [[[1521.4366, 1769.148, 2058.223, 2632.6043, 3769.1626], [1.0, 1.1628, 1.3528, 1.7303, 2.4774], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [87.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 102.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 118.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 153.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 221.688]], [[106.2199, 114.3418, 130.4247, 162.933], [1.0, 1.0765, 1.2279, 1.5339], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [3.2422, 3.3398, 0.0, 3.4863, 0.0, 0.0, 0.0, 3.8105]]], [[[1525.2798, 1774.0856, 2064.4422, 2640.8235, 3782.193], [1.0, 1.1631, 1.3535, 1.7314, 2.4797], [0, 7, 15, 31, 63], [1434.3118, 1667.0536, 1939.255, 2479.3547, 3547.4746], [90.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 107.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 125.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 161.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 234.7184]], [[106.3781, 114.4786, 130.5849, 163.1245], [1.0, 1.0761, 1.2276, 1.5334], [0, 1, 3, 7], [102.9777, 111.002, 126.9384, 159.1225], [3.4004, 3.4766, 0.0, 3.6465, 0.0, 0.0, 0.0, 4.002]]]], {"batch_size": 2, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 64, "llm_max_qo_len_query": 64, "max_interval_id": 14, "model_ratio_array": [14.1022, 14.1171, 14.1355, 14.1516, 14.1672, 14.1859, 14.2042, 14.218, 14.2378, 14.2562, 14.2691, 14.2901, 14.304, 14.3235, 14.3383], "slm_max_qo_len": 8}], "32": [[[[[2058.2682, 3681.5699, 5854.7835, 10180.7809, 18858.7877], [1.0, 1.7887, 2.8445, 4.9463, 9.1625], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [121.7392, 0.0, 0.0, 132.2352, 0.0, 0.0, 0.0, 147.2272, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 172.0912, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 229.0672]], [[227.1552, 355.953, 611.7801, 1125.604], [1.0, 1.567, 2.6932, 4.9552], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [4.5571, 4.7473, 0.0, 4.983, 0.0, 0.0, 0.0, 5.4844]]], [[[2120.1546, 3751.0227, 5932.7435, 10280.5649, 18995.0533], [1.0, 1.7692, 2.7983, 4.849, 8.9593], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [183.6256, 0.0, 0.0, 201.688, 0.0, 0.0, 0.0, 225.1872, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 271.8752, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 365.3328]], [[229.4692, 358.3034, 614.342, 1128.5376], [1.0, 1.5614, 2.6772, 4.918], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [6.8711, 7.0977, 0.0, 7.5449, 0.0, 0.0, 0.0, 8.418]]], [[[2181.6858, 3819.4291, 6010.8059, 10377.9393, 19130.5637], [1.0, 1.7507, 2.7551, 4.7568, 8.7687], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [245.1568, 0.0, 0.0, 270.0944, 0.0, 0.0, 0.0, 303.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 369.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 500.8432]], [[231.7993, 360.6803, 616.9104, 1131.4419], [1.0, 1.556, 2.6614, 4.8811], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [9.2012, 9.4746, 0.0, 10.1133, 0.0, 0.0, 0.0, 11.3223]]], [[[2242.9658, 3887.9283, 6088.2747, 10473.7841, 19263.4085], [1.0, 1.7334, 2.7144, 4.6696, 8.5884], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [306.4368, 0.0, 0.0, 338.5936, 0.0, 0.0, 0.0, 380.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 465.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 633.688]], [[234.0922, 363.1002, 619.4553, 1134.3755], [1.0, 1.5511, 2.6462, 4.8458], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [11.4941, 11.8945, 0.0, 12.6582, 0.0, 0.0, 0.0, 14.2559]]], [[[2303.9658, 3955.8659, 6166.6811, 10571.6897, 19396.5957], [1.0, 1.717, 2.6766, 4.5885, 8.4188], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [367.4368, 0.0, 0.0, 406.5312, 0.0, 0.0, 0.0, 459.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 563.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 766.8752]], [[236.3969, 365.4537, 622.0334, 1137.3286], [1.0, 1.5459, 2.6313, 4.8111], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [13.7988, 14.248, 0.0, 15.2363, 0.0, 0.0, 0.0, 17.209]]], [[[2365.9034, 4025.0851, 6243.3691, 10669.0641, 19531.9701], [1.0, 1.7013, 2.6389, 4.5095, 8.2556], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [429.3744, 0.0, 0.0, 475.7504, 0.0, 0.0, 0.0, 535.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 660.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 902.2496]], [[238.6528, 367.8561, 624.6174, 1140.2329], [1.0, 1.5414, 2.6173, 4.7778], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [16.0547, 16.6504, 0.0, 17.8203, 0.0, 0.0, 0.0, 20.1133]]], [[[2428.7786, 4092.9603, 6320.6187, 10766.4401, 19668.6261], [1.0, 1.6852, 2.6024, 4.4329, 8.0982], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [492.2496, 0.0, 0.0, 543.6256, 0.0, 0.0, 0.0, 613.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 757.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1038.9056]], [[240.9594, 370.2819, 627.1721, 1143.1001], [1.0, 1.5367, 2.6028, 4.744], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [18.3613, 19.0762, 0.0, 20.375, 0.0, 0.0, 0.0, 22.9805]]], [[[2486.7786, 4160.3347, 6399.1195, 10860.6273, 19805.2213], [1.0, 1.673, 2.5733, 4.3673, 7.9642], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [550.2496, 0.0, 0.0, 611.0, 0.0, 0.0, 0.0, 691.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 851.9376, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1175.5008]], [[243.3149, 372.6217, 629.7834, 1146.0669], [1.0, 1.5314, 2.5883, 4.7102], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [20.7168, 21.416, 0.0, 22.9863, 0.0, 0.0, 0.0, 25.9473]]], [[[2551.2474, 4231.0531, 6476.6811, 10957.1889, 19935.8149], [1.0, 1.6584, 2.5386, 4.2948, 7.8141], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [614.7184, 0.0, 0.0, 681.7184, 0.0, 0.0, 0.0, 769.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 948.4992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1306.0944]], [[245.5981, 375.0866, 632.3088, 1148.9555], [1.0, 1.5272, 2.5746, 4.6782], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [23.0, 23.8809, 0.0, 25.5117, 0.0, 0.0, 0.0, 28.8359]]], [[[2612.3722, 4299.2403, 6556.9307, 11051.3153, 20074.8453], [1.0, 1.6457, 2.51, 4.2304, 7.6845], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [675.8432, 0.0, 0.0, 749.9056, 0.0, 0.0, 0.0, 849.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1042.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1445.1248]], [[247.852, 377.4342, 634.8069, 1151.9477], [1.0, 1.5228, 2.5612, 4.6477], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [25.2539, 26.2285, 0.0, 28.0098, 0.0, 0.0, 0.0, 31.8281]]], [[[2672.0298, 4366.1475, 6632.8059, 11152.8145, 20207.9077], [1.0, 1.634, 2.4823, 4.1739, 7.5628], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [735.5008, 0.0, 0.0, 816.8128, 0.0, 0.0, 0.0, 925.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1144.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1578.1872]], [[250.1743, 379.8248, 637.4416, 1154.8657], [1.0, 1.5182, 2.548, 4.6162], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [27.5762, 28.6191, 0.0, 30.6445, 0.0, 0.0, 0.0, 34.7461]]], [[[2732.1226, 4432.8979, 6710.5563, 11249.1265, 20339.0325], [1.0, 1.6225, 2.4562, 4.1174, 7.4444], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [795.5936, 0.0, 0.0, 883.5632, 0.0, 0.0, 0.0, 1003.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1240.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1709.312]], [[252.4419, 382.2584, 640.0862, 1157.7973], [1.0, 1.5142, 2.5356, 4.5864], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [29.8438, 31.0527, 0.0, 33.2891, 0.0, 0.0, 0.0, 37.6777]]], [[[2796.6234, 4504.6787, 6789.5243, 11344.0337, 20473.9077], [1.0, 1.6108, 2.4278, 4.0563, 7.3209], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [860.0944, 0.0, 0.0, 955.344, 0.0, 0.0, 0.0, 1081.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1335.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1844.1872]], [[254.6801, 384.6588, 642.553, 1160.7094], [1.0, 1.5104, 2.523, 4.5575], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [32.082, 33.4531, 0.0, 35.7559, 0.0, 0.0, 0.0, 40.5898]]], [[[2857.8106, 4572.4291, 6867.2747, 11440.1265, 20611.5957], [1.0, 1.6, 2.403, 4.0031, 7.2124], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [921.2816, 0.0, 0.0, 1023.0944, 0.0, 0.0, 0.0, 1159.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1431.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1981.8752]], [[257.1723, 386.9186, 645.094, 1163.5337], [1.0, 1.5045, 2.5084, 4.5243], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [34.5742, 35.7129, 0.0, 38.2969, 0.0, 0.0, 0.0, 43.4141]]], [[[2916.6538, 4637.3971, 6943.6811, 11533.1585, 20744.6261], [1.0, 1.59, 2.3807, 3.9542, 7.1125], [0, 3, 7, 15, 31], [1936.529, 3549.3347, 5707.5563, 10008.6897, 18629.7205], [980.1248, 0.0, 0.0, 1088.0624, 0.0, 0.0, 0.0, 1236.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1524.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2114.9056]], [[259.3793, 389.444, 647.7444, 1166.5239], [1.0, 1.5014, 2.4973, 4.4974], [0, 1, 3, 7], [222.5981, 351.2057, 606.7971, 1120.1196], [36.7812, 38.2383, 0.0, 40.9473, 0.0, 0.0, 0.0, 46.4043]]]], {"batch_size": 32, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 32, "llm_max_qo_len_query": 32, "max_interval_id": 14, "model_ratio_array": [9.0611, 9.2394, 9.412, 9.5815, 9.7462, 9.9136, 10.0796, 10.2204, 10.3879, 10.54, 10.6807, 10.8228, 10.9809, 11.1124, 11.2447], "slm_max_qo_len": 8}], "4": [[[[[1510.2721, 1984.6206, 2524.6541, 3605.1169, 5764.6075], [1.0, 1.3141, 1.6717, 2.3871, 3.8169], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [42.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 45.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 49.5008, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 56.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 69.9648]], [[112.5098, 128.5749, 160.7722, 225.0741], [1.0, 1.1428, 1.429, 2.0005], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [1.5996, 1.6094, 0.0, 1.6406, 0.0, 0.0, 0.0, 1.7168]]], [[[1518.1473, 1994.5582, 2536.7165, 3621.9921, 5791.3307], [1.0, 1.3138, 1.6709, 2.3858, 3.8147], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [50.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 55.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 61.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 73.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 96.688]], [[112.7989, 128.8815, 161.1043, 225.4257], [1.0, 1.1426, 1.4282, 1.9985], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [1.8887, 1.916, 0.0, 1.9727, 0.0, 0.0, 0.0, 2.0684]]], [[[1525.6785, 2004.1214, 2548.9037, 3638.6177, 5817.5483], [1.0, 1.3136, 1.6707, 2.3849, 3.8131], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [58.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 65.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 73.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 90.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 122.9056]], [[113.0723, 129.1745, 161.4207, 225.8007], [1.0, 1.1424, 1.4276, 1.997], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [2.1621, 2.209, 0.0, 2.2891, 0.0, 0.0, 0.0, 2.4434]]], [[[1533.3969, 2014.059, 2560.7165, 3655.2417, 5844.2363], [1.0, 1.3135, 1.67, 2.3838, 3.8113], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [65.8432, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 75.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 85.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 106.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 149.5936]], [[113.3692, 129.4733, 161.739, 226.1581], [1.0, 1.1421, 1.4267, 1.9949], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [2.459, 2.5078, 0.0, 2.6074, 0.0, 0.0, 0.0, 2.8008]]], [[[1540.9601, 2023.4654, 2572.9341, 3672.3361, 5869.9867], [1.0, 1.3131, 1.6697, 2.3831, 3.8093], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [73.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 84.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 97.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 123.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 175.344]], [[113.6543, 129.7819, 162.0593, 226.535], [1.0, 1.1419, 1.4259, 1.9932], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [2.7441, 2.8164, 0.0, 2.9277, 0.0, 0.0, 0.0, 3.1777]]], [[[1548.7105, 2033.4334, 2585.1533, 3689.3361, 5896.0491], [1.0, 1.313, 1.6692, 2.3822, 3.8071], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [81.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 94.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 110.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 140.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 201.4064]], [[113.9493, 130.071, 162.3855, 226.8944], [1.0, 1.1415, 1.4251, 1.9912], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [3.0391, 3.1055, 0.0, 3.2539, 0.0, 0.0, 0.0, 3.5371]]], [[[1556.1793, 2043.2462, 2597.1213, 3705.8673, 5922.9867], [1.0, 1.313, 1.6689, 2.3814, 3.8061], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [88.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 104.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 121.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 157.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 228.344]], [[114.2305, 130.3717, 162.7097, 227.2577], [1.0, 1.1413, 1.4244, 1.9895], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [3.3203, 3.4062, 0.0, 3.5781, 0.0, 0.0, 0.0, 3.9004]]], [[[1564.0849, 2052.7774, 2609.1213, 3722.7425, 5948.6427], [1.0, 1.3124, 1.6681, 2.3801, 3.8033], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [96.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 113.9376, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 133.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 174.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 254.0]], [[114.5176, 130.6745, 163.0359, 227.6171], [1.0, 1.1411, 1.4237, 1.9876], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [3.6074, 3.709, 0.0, 3.9043, 0.0, 0.0, 0.0, 4.2598]]], [[[1572.0225, 2062.8718, 2621.4029, 3739.7105, 5975.3931], [1.0, 1.3122, 1.6675, 2.3789, 3.8011], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [104.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 124.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 146.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 191.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 280.7504]], [[114.8086, 130.9596, 163.3367, 227.9843], [1.0, 1.1407, 1.4227, 1.9858], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [3.8984, 3.9941, 0.0, 4.2051, 0.0, 0.0, 0.0, 4.627]]], [[[1579.5217, 2072.371, 2633.6845, 3756.7425, 6001.0491], [1.0, 1.312, 1.6674, 2.3784, 3.7993], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [111.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 133.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 158.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 208.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 306.4064]], [[115.0938, 131.2585, 163.6687, 228.3378], [1.0, 1.1404, 1.422, 1.9839], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [4.1836, 4.293, 0.0, 4.5371, 0.0, 0.0, 0.0, 4.9805]]], [[[1587.3665, 2082.0894, 2645.2157, 3772.7105, 6028.4859], [1.0, 1.3117, 1.6664, 2.3767, 3.7978], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [119.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 143.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 170.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 224.1248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 333.8432]], [[115.3848, 131.5612, 163.9773, 228.7225], [1.0, 1.1402, 1.4211, 1.9823], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [4.4746, 4.5957, 0.0, 4.8457, 0.0, 0.0, 0.0, 5.3652]]], [[[1594.4289, 2091.9966, 2657.5597, 3789.6177, 6054.2683], [1.0, 1.3121, 1.6668, 2.3768, 3.7971], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [126.8752, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 153.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 182.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 241.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 359.6256]], [[115.6719, 131.8698, 164.2957, 229.0819], [1.0, 1.14, 1.4204, 1.9804], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [4.7617, 4.9043, 0.0, 5.1641, 0.0, 0.0, 0.0, 5.7246]]], [[[1602.4289, 2101.4958, 2669.1213, 3806.7425, 6080.2363], [1.0, 1.3114, 1.6657, 2.3756, 3.7944], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [134.8752, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 162.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 193.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 258.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 385.5936]], [[115.9668, 132.1706, 164.6257, 229.4159], [1.0, 1.1397, 1.4196, 1.9783], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [5.0566, 5.2051, 0.0, 5.4941, 0.0, 0.0, 0.0, 6.0586]]], [[[1610.0529, 2111.5582, 2681.7165, 3823.9601, 6106.6427], [1.0, 1.3115, 1.6656, 2.3751, 3.7928], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [142.4992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 172.7184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 206.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 275.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 412.0]], [[116.25, 132.4635, 164.9304, 229.8182], [1.0, 1.1395, 1.4188, 1.9769], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [5.3398, 5.498, 0.0, 5.7988, 0.0, 0.0, 0.0, 6.4609]]], [[[1617.7105, 2121.059, 2694.0909, 3840.2113, 6131.9867], [1.0, 1.3111, 1.6654, 2.3739, 3.7905], [0, 7, 15, 31, 63], [1467.5537, 1938.8398, 2475.1533, 3548.5857, 5694.6427], [150.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 182.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 218.9376, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 291.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 437.344]], [[116.5176, 132.776, 165.2703, 230.1854], [1.0, 1.1395, 1.4184, 1.9755], [0, 1, 3, 7], [110.9102, 126.9655, 159.1316, 223.3573], [5.6074, 5.8105, 0.0, 6.1387, 0.0, 0.0, 0.0, 6.8281]]]], {"batch_size": 4, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 64, "llm_max_qo_len_query": 64, "max_interval_id": 14, "model_ratio_array": [13.4235, 13.4589, 13.4929, 13.5257, 13.5583, 13.5912, 13.6232, 13.658, 13.6926, 13.7238, 13.7572, 13.7841, 13.818, 13.8499, 13.8838], "slm_max_qo_len": 8}], "8": [[[[[1591.3512, 2533.184, 3614.296, 5788.4387, 10097.0112], [1.0, 1.5918, 2.2712, 3.6374, 6.3449], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [54.312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 60.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 67.8272, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 80.8256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 109.0592]], [[129.3148, 160.8468, 225.1894, 353.0759], [1.0, 1.2438, 1.7414, 2.7304], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [2.0254, 2.0547, 0.0, 2.125, 0.0, 0.0, 0.0, 2.25]]], [[[1606.82, 2552.528, 3638.0624, 5822.8627, 10149.7328], [1.0, 1.5886, 2.2641, 3.6238, 6.3167], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [69.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 79.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 91.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 115.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 161.7808]], [[129.889, 161.4347, 225.8203, 353.8142], [1.0, 1.2429, 1.7386, 2.724], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [2.5996, 2.6426, 0.0, 2.7559, 0.0, 0.0, 0.0, 2.9883]]], [[[1621.9144, 2572.3392, 3661.9376, 5856.2387, 10202.0464], [1.0, 1.586, 2.2578, 3.6107, 6.2901], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [84.8752, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 99.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 115.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 148.6256, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 214.0944]], [[130.4691, 162.0441, 226.4706, 354.5388], [1.0, 1.242, 1.7358, 2.7174], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [3.1797, 3.252, 0.0, 3.4062, 0.0, 0.0, 0.0, 3.7129]]], [[[1637.6024, 2591.6832, 3686.5312, 5889.9571, 10255.4528], [1.0, 1.5826, 2.2512, 3.5967, 6.2625], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [100.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 118.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 140.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 182.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 267.5008]], [[131.0335, 162.6359, 227.1191, 355.2614], [1.0, 1.2412, 1.7333, 2.7112], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [3.7441, 3.8438, 0.0, 4.0547, 0.0, 0.0, 0.0, 4.4355]]], [[[1652.476, 2611.2464, 3710.8752, 5923.1763, 10308.0464], [1.0, 1.5802, 2.2456, 3.5844, 6.2379], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [115.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 138.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 164.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 215.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 320.0944]], [[131.6214, 163.2491, 227.7539, 356.0017], [1.0, 1.2403, 1.7304, 2.7047], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [4.332, 4.457, 0.0, 4.6895, 0.0, 0.0, 0.0, 5.1758]]], [[[1668.2888, 2630.496, 3734.1248, 5956.8323, 10359.5776], [1.0, 1.5768, 2.2383, 3.5706, 6.2097], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [131.2496, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 157.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 187.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 249.2192, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 371.6256]], [[132.1761, 163.8526, 228.3847, 356.74], [1.0, 1.2397, 1.7279, 2.699], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [4.8867, 5.0605, 0.0, 5.3203, 0.0, 0.0, 0.0, 5.9141]]], [[[1683.1016, 2649.9648, 3759.4368, 5990.5507, 10412.4832], [1.0, 1.5745, 2.2336, 3.5592, 6.1865], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [146.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 177.0624, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 212.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 282.9376, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 424.5312]], [[132.7582, 164.4444, 229.039, 357.4626], [1.0, 1.2387, 1.7252, 2.6926], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [5.4688, 5.6523, 0.0, 5.9746, 0.0, 0.0, 0.0, 6.6367]]], [[[1698.4456, 2669.4336, 3783.1248, 6024.6451, 10465.1088], [1.0, 1.5717, 2.2274, 3.5472, 6.1616], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [161.4064, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 196.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 236.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 317.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 477.1568]], [[133.3304, 165.0362, 229.6855, 358.1794], [1.0, 1.2378, 1.7227, 2.6864], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [6.041, 6.2441, 0.0, 6.6211, 0.0, 0.0, 0.0, 7.3535]]], [[[1713.476, 2688.9968, 3807.1568, 6057.4259, 10516.984], [1.0, 1.5693, 2.2219, 3.5352, 6.1378], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [176.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 216.0944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 260.688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 349.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 529.032]], [[133.9339, 165.6124, 230.3164, 358.9079], [1.0, 1.2365, 1.7196, 2.6797], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [6.6445, 6.8203, 0.0, 7.252, 0.0, 0.0, 0.0, 8.082]]], [[[1729.6952, 2708.9344, 3831.9376, 6091.7699, 10571.2016], [1.0, 1.5661, 2.2154, 3.5219, 6.1116], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [192.656, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 236.032, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 285.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 384.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 583.2496]], [[134.4925, 166.2023, 230.9511, 359.6443], [1.0, 1.2358, 1.7172, 2.6741], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [7.2031, 7.4102, 0.0, 7.8867, 0.0, 0.0, 0.0, 8.8184]]], [[[1744.852, 2727.3392, 3855.7504, 6125.1763, 10622.952], [1.0, 1.5631, 2.2098, 3.5104, 6.0882], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [207.8128, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 254.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 309.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 417.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 635.0]], [[135.0726, 166.8331, 231.5976, 360.3982], [1.0, 1.2351, 1.7146, 2.6682], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [7.7832, 8.041, 0.0, 8.5332, 0.0, 0.0, 0.0, 9.5723]]], [[[1760.0072, 2748.2768, 3879.9056, 6159.7699, 10673.4528], [1.0, 1.5615, 2.2045, 3.4999, 6.0644], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [222.968, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 275.3744, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 333.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 452.1568, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 685.5008]], [[135.639, 167.4093, 232.2519, 361.1032], [1.0, 1.2342, 1.7123, 2.6622], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [8.3496, 8.6172, 0.0, 9.1875, 0.0, 0.0, 0.0, 10.2773]]], [[[1775.476, 2766.2464, 3904.032, 6191.1139, 10726.5776], [1.0, 1.558, 2.1989, 3.487, 6.0415], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [238.4368, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 293.344, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 357.5632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 483.5008, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 738.6256]], [[136.2386, 168.0187, 232.8984, 361.8318], [1.0, 1.2333, 1.7095, 2.6559], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [8.9492, 9.2266, 0.0, 9.834, 0.0, 0.0, 0.0, 11.0059]]], [[[1790.54, 2786.496, 3928.344, 6226.0819, 10778.6704], [1.0, 1.5562, 2.1939, 3.4772, 6.0198], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [253.5008, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 313.5936, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 381.8752, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 518.4688, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 790.7184]], [[136.7699, 168.6144, 233.5292, 362.5505], [1.0, 1.2328, 1.7075, 2.6508], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [9.4805, 9.8223, 0.0, 10.4648, 0.0, 0.0, 0.0, 11.7246]]], [[[1805.7896, 2805.4336, 3952.7504, 6260.3939, 10832.1088], [1.0, 1.5536, 2.1889, 3.4668, 5.9985], [0, 7, 15, 31, 63], [1537.0392, 2472.9024, 3546.4688, 5707.6131, 9987.952], [268.7504, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 332.5312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 406.2816, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 552.7808, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 844.1568]], [[137.3714, 169.2198, 234.1757, 363.281], [1.0, 1.2318, 1.7047, 2.6445], [0, 1, 3, 7], [127.2894, 158.7921, 223.0644, 350.8259], [10.082, 10.4277, 0.0, 11.1113, 0.0, 0.0, 0.0, 12.4551]]]], {"batch_size": 8, "cache_length_start": 128, "cache_length_step": 128, "llm_max_qo_len_cache": 64, "llm_max_qo_len_query": 64, "max_interval_id": 14, "model_ratio_array": [12.306, 12.3707, 12.4314, 12.4976, 12.5548, 12.6217, 12.6779, 12.7386, 12.7934, 12.8609, 12.9179, 12.9757, 13.0321, 13.0916, 13.1453], "slm_max_qo_len": 8}]}, "low_rank_head": [{"down_proj": [[-0.5593227744102478, 0.1956692934036255, -0.1153489351272583, -0.08962439000606537, 0.3080690801143646, 0.36412614583969116, 0.031095460057258606, 0.023237895220518112, -0.14704087376594543, -0.19388963282108307, 0.17158442735671997, 0.3768133521080017, -0.04969757795333862, 0.10034674406051636, -0.33869898319244385, -0.201573446393013], [0.13158203661441803, 0.028243709355592728, -0.391096293926239, -0.4176257848739624, 0.24299941956996918, -0.0031352201476693153, -0.01754920743405819, -0.30439943075180054, 0.07597663998603821, 0.17473562061786652, -0.24108996987342834, 0.026003681123256683, 0.4694432318210602, 0.23800894618034363, -0.17474019527435303, 0.31595972180366516], [0.09653866291046143, 0.14140646159648895, 0.09113534539937973, 0.29158490896224976, 0.29822951555252075, 0.22876213490962982, -0.2015448808670044, -0.2621298134326935, -0.2410544902086258, -0.06241406500339508, 0.46320271492004395, -0.1492685079574585, 0.2818025052547455, 0.18085038661956787, 0.45186907052993774, 0.10773158073425293], [-0.3868020474910736, 0.13824301958084106, -0.13776445388793945, 0.2779211401939392, -0.46462762355804443, -0.21056236326694489, -0.4091559946537018, 0.2005285918712616, -0.18374395370483398, 0.03583168238401413, -0.18010057508945465, 0.1709589660167694, 0.33915555477142334, 0.14879387617111206, 0.07183977961540222, 0.16787585616111755]], "freq": null, "rank": 4, "scores": [[-0.3887757658958435, 3.120999336242676, -0.21347081661224365, -1.8488677740097046], [-2.771050453186035, 2.3347270488739014, 1.1037609577178955, -0.3712879717350006], [0.4079447388648987, -0.8381143808364868, 0.5629592537879944, -3.3919332027435303], [-0.7163304090499878, 0.21894966065883636, 3.5458197593688965, 0.8981190919876099], [0.029652776196599007, -2.1944363117218018, 1.6259790658950806, -0.15646903216838837], [0.20502685010433197, 1.4441142082214355, 0.5960188508033752, 0.5029221773147583], [-0.4531743824481964, -0.7993459105491638, 0.2143183797597885, -0.1886647641658783], [1.0430243015289307, 1.3163589239120483, -0.8969443440437317, 0.37937405705451965], [0.10188787430524826, 1.6526578664779663, 1.5903472900390625, -0.04462910816073418], [1.4376310110092163, -1.21103036403656, 1.0402356386184692, 1.1587421894073486], [-0.5011166930198669, -2.842438220977783, 0.1809379905462265, 0.3138481080532074], [-0.3816728889942169, -0.12078654766082764, 0.548208475112915, 0.25324398279190063], [-1.177127480506897, -0.2766287624835968, -1.4409751892089844, -1.846429467201233], [-0.4375855326652527, -1.8488869667053223, 0.007154414430260658, -1.603573203086853], [2.7494826316833496, -0.1401914358139038, 1.5302414894104004, -0.504623532295227], [0.7743794918060303, -0.5519365668296814, 0.4920752942562103, 2.511521100997925], [0.5197245478630066, 0.34057384729385376, 0.23898328840732574, 0.1742522120475769], [2.3438713550567627, -0.628865659236908, 0.537212610244751, -0.4936721622943878], [0.3714495897293091, 0.2719302773475647, -0.7750459313392639, 1.2234309911727905], [-3.583263397216797, 1.3153483867645264, 1.350372552871704, 1.9434773921966553], [-1.4117223024368286, -0.741706371307373, 1.1913341283798218, -1.7216213941574097], [-1.0667016506195068, -1.646582841873169, -0.09139968454837799, -0.06831718981266022], [0.9981721639633179, -0.41649505496025085, 2.301875114440918, -0.05269990488886833], [2.134267568588257, 1.7254118919372559, 0.08863048255443573, 0.5900000929832458], [1.0287134647369385, -1.4207050800323486, 1.3882383108139038, -1.20933997631073], [-0.13776548206806183, -0.5641103386878967, 1.0581836700439453, 0.5535125732421875], [1.2116576433181763, -0.7496299147605896, -2.2460618019104004, 2.1950571537017822], [2.136484146118164, -1.1852532625198364, 1.7818329334259033, -1.3540105819702148], [1.6697534322738647, -0.18658392131328583, 1.4930846691131592, 0.5552146434783936], [0.559196949005127, -1.069960594177246, 0.9737790822982788, 0.3445702791213989], [-0.7850346565246582, 0.6299260854721069, 1.7763811349868774, -0.34427958726882935], [2.2623093128204346, -0.3568551242351532, 2.0969085693359375, 3.0039985179901123], [-1.1295448541641235, -0.41042470932006836, 1.503164529800415, -1.3988406658172607], [-2.0809848308563232, -2.4258790016174316, 0.3539360463619232, 1.0774837732315063], [-1.6004515886306763, 0.3070348799228668, 1.0103200674057007, -0.05895421281456947], [-0.7548299431800842, -1.7264819145202637, -1.0197621583938599, -0.7849875092506409], [0.42785388231277466, -1.898903250694275, -0.2958116829395294, -0.8146345019340515], [0.5127329230308533, -1.2854045629501343, -1.8482928276062012, -1.3042000532150269], [-0.3791617155075073, 1.6264766454696655, -0.1306944340467453, 0.047963522374629974], [3.7916150093078613, 1.75826895236969, -2.2714056968688965, 0.08947642147541046], [0.3712863028049469, 1.7137470245361328, 0.6140860915184021, -0.6683494448661804], [0.848782479763031, 1.0581588745117188, 1.5606919527053833, -1.8311578035354614], [-3.1050734519958496, -0.12694013118743896, -0.7246836423873901, 2.5327508449554443], [0.23057803511619568, 0.0619954876601696, 2.021251916885376, 0.0832546129822731], [1.244077205657959, 1.5756498575210571, 1.682873010635376, 0.4657229781150818], [-0.8688503503799438, 1.5863628387451172, 0.19344201683998108, -1.9358347654342651], [-0.362383633852005, -0.027864467352628708, 1.5214430093765259, -0.008712904527783394], [0.6558743715286255, -0.8631780743598938, -0.19724220037460327, 0.2256147414445877]], "shard": null, "weight": [[1.8423298597335815, 0.5188871622085571, -1.7119213342666626, -1.7013792991638184, 2.0194194316864014, -0.26861444115638733, -0.13071750104427338, -1.4374138116836548, 0.39076822996139526, -0.0189677607268095, -1.3526873588562012, -0.7308177947998047, 0.9879222512245178, -0.4194079339504242, -0.5848958492279053, -0.782335102558136], [2.779863119125366, 1.2220252752304077, -0.33644935488700867, -0.9650601744651794, -0.1296626776456833, -0.6017656326293945, 0.14499856531620026, -0.14982716739177704, -0.43739840388298035, 0.7792337536811829, -0.05833946168422699, -2.0304951667785645, 1.4829323291778564, 0.49403807520866394, 0.24921877682209015, 1.7470314502716064], [-0.2616683542728424, -0.7323886752128601, 1.6980465650558472, -0.17916560173034668, 1.9230599403381348, 0.287949800491333, 0.9367964863777161, -2.403135061264038, -0.14789359271526337, 0.8967041373252869, 0.548134982585907, -1.6391186714172363, -1.8153051137924194, -0.20662859082221985, -0.5259512066841125, -1.697732925415039], [0.8167919516563416, 0.40964189171791077, 0.2162347286939621, 1.089808702468872, 0.1730271428823471, 0.16676710546016693, -1.1372435092926025, -0.8208335041999817, -1.7927260398864746, 0.8771882057189941, 2.164123296737671, -0.18553368747234344, 0.9906442165374756, 0.7425893545150757, 1.2701921463012695, 1.322719931602478], [-0.5181142091751099, 1.5632743835449219, 1.2357580661773682, 1.4962135553359985, 0.47312209010124207, 0.6070178747177124, -0.8779260516166687, -0.7425919771194458, 0.28316107392311096, -1.49812912940979, -0.30913057923316956, -0.6040987968444824, -1.9672434329986572, -0.13675560057163239, 1.8703440427780151, 0.15049874782562256], [-0.8156453967094421, -0.38386741280555725, 0.4020611345767975, -1.4338090419769287, -0.07257876545190811, -0.547050416469574, 0.4878222942352295, -0.6519467234611511, -0.3642081618309021, 1.0474227666854858, 0.9975668787956238, 0.9267182350158691, 1.9251810312271118, -0.047434043139219284, 0.5186306834220886, 0.6518765091896057], [-0.8323342800140381, -0.1855580061674118, 1.2361489534378052, -1.4389079809188843, -0.8908401131629944, -0.2597385346889496, -0.2320173680782318, 0.44491949677467346, 0.25572171807289124, 1.0455061197280884, 1.7144187688827515, -1.2035179138183594, -0.18259234726428986, 0.1322581171989441, 0.5032901167869568, -0.22263535857200623], [-0.11185567826032639, -0.21018818020820618, 0.9292061924934387, -0.7494445443153381, 0.04423791170120239, 1.0022926330566406, -1.502030611038208, -1.3210585117340088, -0.15639768540859222, 1.1379916667938232, -1.3307616710662842, 1.809234619140625, 0.36398205161094666, -0.30124813318252563, -1.6497083902359009, 0.02865452691912651], [0.38647255301475525, 0.9696834683418274, 0.19005560874938965, 0.1848299205303192, 0.8837769627571106, 1.3211451768875122, -0.1316908746957779, -1.4731429815292358, -0.42345085740089417, 0.21470917761325836, -0.4585278630256653, 0.5684175491333008, 0.5809915065765381, -0.2655836045742035, 0.41468819975852966, 2.5219855308532715], [-1.2156933546066284, -0.017087213695049286, -0.4885116219520569, 0.9534348249435425, -0.8893361687660217, 0.738698422908783, -0.524882435798645, -0.05094030126929283, -0.41781672835350037, -1.7469474077224731, 1.143565058708191, 0.034803155809640884, 0.8789601922035217, 0.07542484998703003, 0.13254167139530182, -1.4095851182937622], [0.4758533239364624, 1.537859559059143, 0.7697533965110779, 1.576411247253418, -1.42877197265625, -1.1834704875946045, 1.2763484716415405, 0.8397301435470581, -1.1636297702789307, -0.8525593280792236, 1.0984735488891602, -0.14594732224941254, -1.9881901741027832, 0.5548825263977051, 0.34822800755500793, 0.0016953900922089815], [-0.45720961689949036, -0.3552713692188263, -0.4995167553424835, 0.3649224042892456, 0.06047575920820236, 0.07866015285253525, -0.5318078398704529, -0.4055193066596985, 0.13346894085407257, -0.2106434851884842, -0.3389572203159332, -0.8613721132278442, -0.4170466661453247, 0.40613070130348206, 0.9446803331375122, -0.029227877035737038], [0.7648072242736816, -1.6380397081375122, 0.3824180066585541, -0.6921724677085876, 0.5251877307891846, -1.4956529140472412, 0.06711041182279587, 0.2093774378299713, 2.1251397132873535, -0.1776224672794342, 0.5925997495651245, -0.827829897403717, -1.2284955978393555, 0.051335304975509644, -0.8659408688545227, -0.2872370481491089], [1.471832513809204, 0.10550840198993683, 1.700499176979065, -1.3799889087677002, -0.06268931180238724, -0.3130805194377899, 0.5684071779251099, 1.76461660861969, -1.1201353073120117, 0.19251851737499237, 1.797442078590393, -0.31002649664878845, 0.06885338574647903, -1.3640176057815552, 0.12411488592624664, -1.8626835346221924], [-0.9962897896766663, 0.2322450876235962, 0.5532547235488892, -0.4774419367313385, 1.5282607078552246, 2.8549177646636963, -0.2977646291255951, 0.259566068649292, -0.7626211047172546, -1.1713365316390991, 0.3056600093841553, 1.134310007095337, 1.1514252424240112, -0.7434212565422058, 0.5467193126678467, -0.7866395711898804], [-0.8203861117362976, 1.1981273889541626, -0.10109546780586243, 1.5047134160995483, -0.6186767220497131, -1.6641976833343506, -0.3320557177066803, 0.9640906453132629, -1.5128307342529297, 0.38008546829223633, 1.345370888710022, 1.1066919565200806, 0.8749836087226868, 0.333163321018219, -1.0130034685134888, 0.6989575624465942], [0.19493812322616577, 1.5407639741897583, -0.6603405475616455, 0.7535750269889832, 0.11950142681598663, 0.8875294327735901, 0.5327469706535339, -0.15943096578121185, 0.3634970188140869, -1.1752859354019165, -0.8515703678131104, 0.010821308009326458, 0.9781356453895569, -0.8415478467941284, -0.06878475844860077, -0.11494486033916473], [-1.6556191444396973, -0.3341541290283203, -1.6154296398162842, 0.4105648100376129, 0.963854193687439, 0.3282204270362854, 0.06049910932779312, -1.1918007135391235, -0.519070029258728, -1.278523325920105, 0.7221263647079468, 0.24975945055484772, -0.9084169268608093, 0.09510061889886856, 0.1133827418088913, -1.907651424407959], [-0.6358835697174072, -1.228570818901062, 0.1053849533200264, -0.26914721727371216, -0.5862342119216919, -0.27735331654548645, -1.078141689300537, 0.4135347902774811, 0.5919438004493713, 0.7107099294662476, -0.2621993124485016, 1.5015686750411987, -0.16780288517475128, 1.7114884853363037, -0.11778640002012253, -0.16749101877212524], [1.5553796291351318, -1.2570301294326782, -0.13364559412002563, 0.11172090470790863, -1.8765703439712524, -1.3434430360794067, -2.0549187660217285, -0.6548648476600647, -0.3038412034511566, 0.537597119808197, 0.2686021327972412, -1.7700008153915405, 2.1069438457489014, 0.4100417494773865, 0.8539451360702515, 1.4541032314300537], [1.212177038192749, 0.248897522687912, 0.6189541220664978, 1.5856945514678955, 0.12450158596038818, 0.7298774719238281, 2.3823165893554688, -0.6485226154327393, 0.5708996653556824, -0.9802722334861755, -0.05228327214717865, -1.9604300260543823, 0.18086792528629303, 0.059323087334632874, 0.8089112043380737, 0.06678680330514908], [1.2780805826187134, 0.5857242941856384, 1.3826525211334229, 0.6941290497779846, -1.1786468029022217, 0.27774423360824585, -0.8117172122001648, -0.2775658071041107, -0.5489655137062073, -1.00083327293396, -0.3259105980396271, -0.40876108407974243, -0.04072640836238861, -2.4221949577331543, -0.4039194583892822, -0.43812358379364014], [-0.9743454456329346, 0.963897705078125, -0.19118742644786835, 1.0727242231369019, 1.6018716096878052, 0.979602038860321, -1.0461935997009277, -0.5447999238967896, 0.7352514863014221, 1.4415884017944336, 0.913340151309967, 0.22623713314533234, -0.6470053791999817, 1.1707030534744263, 1.868058204650879, -0.8057765364646912], [-1.9958140850067139, 0.44372814893722534, -2.235931158065796, -1.1041157245635986, 0.7726891040802002, -0.10041210800409317, -0.8011403679847717, -0.6978350877761841, 0.33016833662986755, -1.7603164911270142, 0.8612862825393677, -0.2727513611316681, 0.2952006757259369, -0.0863696038722992, -1.077795386314392, 1.3174171447753906], [0.25975480675697327, -0.2267509251832962, 1.0719213485717773, 0.13768793642520905, 1.3734848499298096, 0.8900320529937744, 0.005205621011555195, 1.0246360301971436, -1.4376553297042847, 0.026752600446343422, 1.7635213136672974, 0.22781233489513397, -1.265060544013977, 0.2765822410583496, 0.14018741250038147, 0.27095043659210205], [0.050730787217617035, 1.7496167421340942, 0.3843174874782562, -0.41870418190956116, -0.6132577061653137, -0.20182815194129944, -0.9032129645347595, 0.14338162541389465, 0.18738064169883728, -1.9100512266159058, 0.7312764525413513, -1.0993099212646484, 0.8123900294303894, -0.3830788731575012, 0.6275108456611633, -0.39470601081848145], [-2.119702100753784, 1.6772722005844116, 0.28148481249809265, -0.6908485889434814, -1.6098593473434448, -0.4926079511642456, 0.23396609723567963, 1.7376254796981812, 1.0201282501220703, -1.6659587621688843, -2.033097505569458, 0.5242786407470703, 0.8123331069946289, 0.2906351387500763, 0.0948316752910614, -1.57606041431427], [-0.3695988953113556, 0.9212112426757812, 1.317896842956543, 0.28795596957206726, 0.673072338104248, 2.1550965309143066, 0.2843187153339386, -0.3221006989479065, -0.5894857048988342, -1.2183080911636353, 2.3109419345855713, -0.3402690291404724, -0.06387106329202652, -0.3724074959754944, -1.0716981887817383, -0.06900236010551453], [-1.1592929363250732, -0.8167169094085693, 0.3081871271133423, 0.2535775303840637, 1.611940622329712, -0.21664273738861084, -0.6799147129058838, 0.7301803231239319, -1.0188144445419312, -0.37104442715644836, 1.2735862731933594, 0.7205715775489807, 1.140811800956726, 0.8689939975738525, 0.2088829129934311, -0.765638530254364], [-0.6183924674987793, -0.39621734619140625, 0.49710652232170105, 0.7794858813285828, 0.11941751092672348, 0.013390456326305866, 0.06188749521970749, 0.11369651556015015, -0.4389849007129669, -1.0939189195632935, 0.5687056183815002, 0.06488490849733353, 0.7042430639266968, 0.10799430310726166, 0.6396369934082031, -1.061358094215393], [1.38083016872406, -1.0804533958435059, -0.26850929856300354, 0.6220055222511292, 1.0864269733428955, 0.3832469880580902, -0.12893709540367126, 0.24852176010608673, 0.027278050780296326, -0.4242528975009918, 0.48919910192489624, 0.10447167605161667, 2.0131266117095947, -0.1408180445432663, 1.152069091796875, -0.24954426288604736], [-2.1065971851348877, 0.6768315434455872, -0.30398795008659363, 2.1751644611358643, 0.10671831667423248, 0.4856099486351013, -2.605884313583374, -0.2176062911748886, -1.7428195476531982, -0.06100369617342949, 1.0243250131607056, 0.11079688370227814, 0.9098693132400513, 1.4345828294754028, -1.1414541006088257, -0.08397497981786728], [1.205458641052246, -1.3479984998703003, -0.09899350255727768, -0.039312295615673065, 0.41094034910202026, -0.029353270307183266, -0.9314888119697571, -0.629811704158783, 1.2316906452178955, -0.2713644206523895, 2.013180732727051, -0.5723325610160828, -1.0768368244171143, 0.8825520277023315, 1.1426159143447876, 0.17433680593967438], [0.140082448720932, 0.15563660860061646, -0.4301457703113556, 1.9001398086547852, -1.7925937175750732, -0.5465841889381409, -0.8343539834022522, 0.022525092586874962, 0.7801069021224976, 1.197023630142212, 0.1272577941417694, -0.4100155532360077, -0.9723393321037292, -1.3754216432571411, 2.4497153759002686, -1.3055230379104614], [2.866915225982666, -0.363059937953949, -0.23616409301757812, 0.6295525431632996, -0.2657562494277954, 0.2041296660900116, -1.396916389465332, 0.11987794190645218, -1.0041574239730835, 0.2126374989748001, 0.08954901248216629, -0.6534318327903748, 0.6537449955940247, 0.486194372177124, -0.3541038930416107, -0.6930254101753235], [0.5941326022148132, -0.22268348932266235, 0.007942559197545052, -0.24050520360469818, -0.9492929577827454, 0.19260776042938232, 1.052936315536499, 0.8952515125274658, -0.44802820682525635, -0.46179890632629395, -0.40740302205085754, -0.0805642381310463, -1.760446310043335, -0.9876477718353271, 1.0251185894012451, -0.36142459511756897], [0.21669910848140717, -0.11079169064760208, 0.27470269799232483, 1.579426646232605, 0.6898742914199829, 0.6697251796722412, -0.6257768273353577, 0.2680393159389496, 1.1770564317703247, -1.273383378982544, 0.14635291695594788, 0.6450676321983337, -0.7795016169548035, -2.904675006866455, -0.4085336923599243, -0.3630344271659851], [0.21513882279396057, -1.3511089086532593, 0.9236379265785217, 0.1474168449640274, -0.6270109415054321, -0.19522948563098907, 1.1718754768371582, -0.02134588547050953, -0.045449625700712204, 0.742267370223999, 0.7663171291351318, 0.8998587727546692, -1.6336925029754639, -0.20600971579551697, -2.124385118484497, -0.6554341316223145], [0.4958007037639618, -0.3300303518772125, -0.4273771047592163, -0.20484097301959991, 0.319632887840271, -0.35982972383499146, -0.31712576746940613, -1.113769769668579, 0.6343621015548706, 0.44533246755599976, -0.7282143235206604, 0.48689720034599304, 0.7151362299919128, 0.5626128315925598, -0.2979333698749542, 0.18530841171741486], [-1.363771915435791, 1.8500477075576782, -2.290601968765259, -2.0066475868225098, 0.09990976005792618, 1.1987971067428589, 0.5421940684318542, 0.5021786093711853, -1.2331643104553223, 0.18904206156730652, -0.2175028920173645, 1.0394315719604492, -0.9095672965049744, 0.43795135617256165, -3.3761961460113525, 0.0235418863594532], [0.34646448493003845, 0.840658962726593, -1.1280863285064697, -0.7279335856437683, 0.3668173849582672, 0.3785863518714905, 0.1091659888625145, -1.474294662475586, 0.8746855854988098, 0.4689382016658783, 0.12793229520320892, -0.45954740047454834, 0.632622241973877, 1.4910151958465576, 0.028784040361642838, -1.2280516624450684], [0.4561890959739685, 1.2795835733413696, -1.4428155422210693, -1.6033785343170166, 0.35817357897758484, 1.2277159690856934, 0.6140509843826294, -1.399146318435669, 1.776909351348877, -1.1343607902526855, 2.119511604309082, 0.14426149427890778, -0.6658602356910706, 1.206942081451416, 1.427699327468872, 0.23749661445617676], [-0.2771555781364441, -0.020601559430360794, -0.4007340967655182, 0.8894820809364319, -2.377859115600586, -1.5563793182373047, -0.8449994325637817, -0.35280755162239075, 0.23034897446632385, 0.5701674222946167, -2.276663303375244, -1.2979867458343506, 0.041942473500967026, -0.4781135022640228, 1.7564958333969116, 1.0898517370224], [-0.2256181389093399, 0.29574769735336304, 0.7685131430625916, 0.6776107549667358, 1.5335391759872437, -0.3287070095539093, -0.090177521109581, -0.6062294840812683, -1.6217414140701294, 0.4805349111557007, 0.26111218333244324, 0.026766343042254448, 0.4205162525177002, 0.5685045719146729, 1.011781096458435, 0.16668778657913208], [-0.7200111150741577, 1.6450759172439575, -0.4302474856376648, 0.2536938190460205, 0.8097054362297058, 0.7944768071174622, 1.3559576272964478, -1.0992704629898071, -0.3334032893180847, 0.08286789059638977, -0.28406399488449097, 0.8130898475646973, 1.9442614316940308, 1.0616463422775269, 1.072922706604004, -0.0005604370962828398], [1.698673963546753, 0.17500245571136475, -0.13634495437145233, -0.5419949889183044, 1.6474183797836304, -0.33179616928100586, 1.67753005027771, -0.646321177482605, -0.49563226103782654, -0.046433113515377045, -0.7666882872581482, -0.6432552337646484, 0.6549248099327087, -0.5725983381271362, -0.17497019469738007, 0.5870482325553894], [0.45596691966056824, 0.6367679834365845, 0.7445272207260132, -0.21229064464569092, -0.10094104707241058, 0.5471881628036499, 0.010591469705104828, -0.6199851632118225, -1.1590813398361206, -0.3586774170398712, 0.1963585615158081, -0.26464760303497314, 0.6789929866790771, -0.2287890762090683, 1.1464834213256836, 0.23859141767024994], [0.840617835521698, 1.0135596990585327, -0.0005046415608376265, 0.008507587015628815, -0.6819575428962708, 1.410760521888733, -0.0704582929611206, 1.324288010597229, -2.0739495754241943, 1.3763922452926636, -0.07164192199707031, 0.41126883029937744, -0.4745229482650757, -0.18654122948646545, -0.5283731818199158, -1.1492352485656738]]}, {"down_proj": [[-0.5496290922164917, 0.18048834800720215, -0.1333560049533844, -0.1163061112165451, 0.3028717041015625, 0.3472074270248413, 0.01348799467086792, 0.026011303067207336, -0.15873406827449799, -0.17113657295703888, 0.16808369755744934, 0.3872634768486023, -0.03256863355636597, 0.11479930579662323, -0.3741881847381592, -0.18415316939353943], [0.24104250967502594, 0.026645377278327942, -0.36104950308799744, -0.4697984755039215, 0.30333372950553894, 0.02190658263862133, 0.06073886901140213, -0.32541829347610474, 0.10409048199653625, 0.15356963872909546, -0.21599756181240082, -0.03713271766901016, 0.400180459022522, 0.19091910123825073, -0.18257030844688416, 0.27507293224334717], [0.06620555371046066, 0.16436783969402313, 0.06922000646591187, 0.29862475395202637, 0.2807481288909912, 0.2224959135055542, -0.20919926464557648, -0.25394171476364136, -0.24760538339614868, -0.07722986489534378, 0.4471823275089264, -0.14145341515541077, 0.31741827726364136, 0.19710315763950348, 0.4458145797252655, 0.11157269030809402], [0.3389126658439636, -0.12481482326984406, 0.19690915942192078, -0.1724357008934021, 0.4318457245826721, 0.22541742026805878, 0.4062921404838562, -0.15390700101852417, 0.17682932317256927, -0.10285323858261108, 0.2506147027015686, -0.17078223824501038, -0.3991386890411377, -0.17084947228431702, -0.008914362639188766, -0.2293146550655365]], "freq": [956.0, 998.0, 240.0, 165.0, 110.0, 56.0, 50.0, 601.0, 137.0, 24.0, 453.0, 595.0, 949.0, 53.0, 167.0, 309.0, 525.0, 418.0, 18.0, 240.0, 938.0, 272.0, 95.0, 697.0, 125.0, 899.0, 420.0, 297.0, 863.0, 123.0, 170.0, 718.0, 198.0, 723.0, 174.0, 195.0, 385.0, 256.0, 423.0, 794.0, 920.0, 515.0, 921.0, 315.0, 425.0, 478.0, 104.0, 442.0], "rank": 4, "scores": [[-0.3001192510128021, 3.505727529525757, -0.2337014526128769, 1.2143642902374268], [-2.666997194290161, 2.567492723464966, 1.0942113399505615, -0.12438999116420746], [0.31079912185668945, -0.25502869486808777, 0.34807878732681274, 3.4666178226470947], [-0.6965046525001526, 0.029615767300128937, 3.538665294647217, -0.8131579756736755], [-0.20266428589820862, -2.1120028495788574, 1.5871448516845703, 0.7005982398986816], [0.2927243411540985, 1.2484374046325684, 0.6339536905288696, -0.7530454993247986], [-0.4486846625804901, -0.7500655651092529, 0.15841200947761536, 0.2963356077671051], [1.1662038564682007, 1.1340301036834717, -0.8926024436950684, -0.7342517971992493], [0.10655960440635681, 1.5985958576202393, 1.5981758832931519, -0.20930901169776917], [1.3590710163116455, -1.439782977104187, 1.14553964138031, -0.7486441731452942], [-0.6179957985877991, -2.7545998096466064, 0.1631632149219513, 0.2320258915424347], [-0.4243370294570923, -0.17415587604045868, 0.5534961223602295, -0.17892605066299438], [-1.1454787254333496, 0.08423224091529846, -1.5796786546707153, 1.7821112871170044], [-0.4656524956226349, -1.405307412147522, -0.12324818223714828, 1.8372952938079834], [2.657714366912842, -0.15060892701148987, 1.5590202808380127, 0.6786736845970154], [0.8509233593940735, -1.0340840816497803, 0.6257284879684448, -2.3484110832214355], [0.4416810870170593, 0.3649479150772095, 0.3250843584537506, -0.14332106709480286], [2.2617149353027344, -0.6329837441444397, 0.562828004360199, 0.7507498860359192], [0.4660707712173462, -0.07489937543869019, -0.7411090731620789, -1.288922667503357], [-3.4494385719299316, 1.0509790182113647, 1.387643575668335, -2.2003796100616455], [-1.5868170261383057, -0.3127483129501343, 1.1266471147537231, 1.932852864265442], [-1.1401581764221191, -1.4628232717514038, -0.13893257081508636, 0.307306170463562], [0.8897990584373474, -0.5288772583007812, 2.2772490978240967, 0.29657596349716187], [2.202989339828491, 1.5162824392318726, 0.2168102115392685, -0.782419741153717], [0.987950325012207, -1.231553077697754, 1.2735735177993774, 1.4822282791137695], [-0.2171458899974823, -0.5372931361198425, 1.1296783685684204, -0.3259625732898712], [1.1464663743972778, -1.0939332246780396, -2.0289218425750732, -1.9924592971801758], [2.0395238399505615, -0.957145094871521, 1.7373831272125244, 1.6839921474456787], [1.6857736110687256, -0.4174850285053253, 1.5368373394012451, -0.39132481813430786], [0.4792105555534363, -1.1472421884536743, 1.005684733390808, -0.029945313930511475], [-0.7995570302009583, 0.6859123706817627, 1.7621413469314575, 0.32834774255752563], [2.3074848651885986, -1.039182424545288, 2.270665168762207, -2.746021032333374], [-1.1583569049835205, -0.1688975989818573, 1.3614833354949951, 1.5302497148513794], [-2.2244551181793213, -2.5184974670410156, 0.31247779726982117, -0.6067230701446533], [-1.5286802053451538, 0.4323890209197998, 0.9672229290008545, -0.04019032418727875], [-0.845586895942688, -1.4699052572250366, -1.1007771492004395, 1.0207462310791016], [0.2977263927459717, -1.7135823965072632, -0.3691405653953552, 1.1823019981384277], [0.557788074016571, -1.078446388244629, -1.9691383838653564, 1.3731268644332886], [-0.3047275245189667, 1.5661019086837769, -0.11356506496667862, -0.3607991933822632], [3.9574623107910156, 1.6679339408874512, -2.14864182472229, -0.4983707368373871], [0.39245855808258057, 1.8084030151367188, 0.6443394422531128, 0.4219847023487091], [0.7722225189208984, 1.3626210689544678, 1.5269635915756226, 1.8133232593536377], [-3.116229772567749, -0.4763440787792206, -0.6431591510772705, -2.557803153991699], [0.20115849375724792, -0.006996253505349159, 2.012052536010742, -0.021620485931634903], [1.1943632364273071, 1.4034249782562256, 1.8070510625839233, -0.5733368992805481], [-0.8523211479187012, 1.9995957612991333, 0.12877847254276276, 1.5763591527938843], [-0.41227975487709045, 0.017600899562239647, 1.5197319984436035, 0.06722616404294968], [0.6810309886932373, -0.8348362445831299, -0.2085251361131668, -0.15908727049827576]], "shard": null, "weight": [[1.8423298597335815, 0.5188871622085571, -1.7119213342666626, -1.7013792991638184, 2.0194194316864014, -0.26861444115638733, -0.13071750104427338, -1.4374138116836548, 0.39076822996139526, -0.0189677607268095, -1.3526873588562012, -0.7308177947998047, 0.9879222512245178, -0.4194079339504242, -0.5848958492279053, -0.782335102558136], [2.779863119125366, 1.2220252752304077, -0.33644935488700867, -0.9650601744651794, -0.1296626776456833, -0.6017656326293945, 0.14499856531620026, -0.14982716739177704, -0.43739840388298035, 0.7792337536811829, -0.05833946168422699, -2.0304951667785645, 1.4829323291778564, 0.49403807520866394, 0.24921877682209015, 1.7470314502716064], [-0.2616683542728424, -0.7323886752128601, 1.6980465650558472, -0.17916560173034668, 1.9230599403381348, 0.287949800491333, 0.9367964863777161, -2.403135061264038, -0.14789359271526337, 0.8967041373252869, 0.548134982585907, -1.6391186714172363, -1.8153051137924194, -0.20662859082221985, -0.5259512066841125, -1.697732925415039], [0.8167919516563416, 0.40964189171791077, 0.2162347286939621, 1.089808702468872, 0.1730271428823471, 0.16676710546016693, -1.1372435092926025, -0.8208335041999817, -1.7927260398864746, 0.8771882057189941, 2.164123296737671, -0.18553368747234344, 0.9906442165374756, 0.7425893545150757, 1.2701921463012695, 1.322719931602478], [-0.5181142091751099, 1.5632743835449219, 1.2357580661773682, 1.4962135553359985, 0.47312209010124207, 0.6070178747177124, -0.8779260516166687, -0.7425919771194458, 0.28316107392311096, -1.49812912940979, -0.30913057923316956, -0.6040987968444824, -1.9672434329986572, -0.13675560057163239, 1.8703440427780151, 0.15049874782562256], [-0.8156453967094421, -0.38386741280555725, 0.4020611345767975, -1.4338090419769287, -0.07257876545190811, -0.547050416469574, 0.4878222942352295, -0.6519467234611511, -0.3642081618309021, 1.0474227666854858, 0.9975668787956238, 0.9267182350158691, 1.9251810312271118, -0.047434043139219284, 0.5186306834220886, 0.6518765091896057], [-0.8323342800140381, -0.1855580061674118, 1.2361489534378052, -1.4389079809188843, -0.8908401131629944, -0.2597385346889496, -0.2320173680782318, 0.44491949677467346, 0.25572171807289124, 1.0455061197280884, 1.7144187688827515, -1.2035179138183594, -0.18259234726428986, 0.1322581171989441, 0.5032901167869568, -0.22263535857200623], [-0.11185567826032639, -0.21018818020820618, 0.9292061924934387, -0.7494445443153381, 0.04423791170120239, 1.0022926330566406, -1.502030611038208, -1.3210585117340088, -0.15639768540859222, 1.1379916667938232, -1.3307616710662842, 1.809234619140625, 0.36398205161094666, -0.30124813318252563, -1.6497083902359009, 0.02865452691912651], [0.38647255301475525, 0.9696834683418274, 0.19005560874938965, 0.1848299205303192, 0.8837769627571106, 1.3211451768875122, -0.1316908746957779, -1.4731429815292358, -0.42345085740089417, 0.21470917761325836, -0.4585278630256653, 0.5684175491333008, 0.5809915065765381, -0.2655836045742035, 0.41468819975852966, 2.5219855308532715], [-1.2156933546066284, -0.017087213695049286, -0.4885116219520569, 0.9534348249435425, -0.8893361687660217, 0.738698422908783, -0.524882435798645, -0.05094030126929283, -0.41781672835350037, -1.7469474077224731, 1.143565058708191, 0.034803155809640884, 0.8789601922035217, 0.07542484998703003, 0.13254167139530182, -1.4095851182937622], [0.4758533239364624, 1.537859559059143, 0.7697533965110779, 1.576411247253418, -1.42877197265625, -1.1834704875946045, 1.2763484716415405, 0.8397301435470581, -1.1636297702789307, -0.8525593280792236, 1.0984735488891602, -0.14594732224941254, -1.9881901741027832, 0.5548825263977051, 0.34822800755500793, 0.0016953900922089815], [-0.45720961689949036, -0.3552713692188263, -0.4995167553424835, 0.3649224042892456, 0.06047575920820236, 0.07866015285253525, -0.5318078398704529, -0.4055193066596985, 0.13346894085407257, -0.2106434851884842, -0.3389572203159332, -0.8613721132278442, -0.4170466661453247, 0.40613070130348206, 0.9446803331375122, -0.029227877035737038], [0.7648072242736816, -1.6380397081375122, 0.3824180066585541, -0.6921724677085876, 0.5251877307891846, -1.4956529140472412, 0.06711041182279587, 0.2093774378299713, 2.1251397132873535, -0.1776224672794342, 0.5925997495651245, -0.827829897403717, -1.2284955978393555, 0.051335304975509644, -0.8659408688545227, -0.2872370481491089], [1.471832513809204, 0.10550840198993683, 1.700499176979065, -1.3799889087677002, -0.06268931180238724, -0.3130805194377899, 0.5684071779251099, 1.76461660861969, -1.1201353073120117, 0.19251851737499237, 1.797442078590393, -0.31002649664878845, 0.06885338574647903, -1.3640176057815552, 0.12411488592624664, -1.8626835346221924], [-0.9962897896766663, 0.2322450876235962, 0.5532547235488892, -0.4774419367313385, 1.5282607078552246, 2.8549177646636963, -0.2977646291255951, 0.259566068649292, -0.7626211047172546, -1.1713365316390991, 0.3056600093841553, 1.134310007095337, 1.1514252424240112, -0.7434212565422058, 0.5467193126678467, -0.7866395711898804], [-0.8203861117362976, 1.1981273889541626, -0.10109546780586243, 1.5047134160995483, -0.6186767220497131, -1.6641976833343506, -0.3320557177066803, 0.9640906453132629, -1.5128307342529297, 0.38008546829223633, 1.345370888710022, 1.1066919565200806, 0.8749836087226868, 0.333163321018219, -1.0130034685134888, 0.6989575624465942], [0.19493812322616577, 1.5407639741897583, -0.6603405475616455, 0.7535750269889832, 0.11950142681598663, 0.8875294327735901, 0.5327469706535339, -0.15943096578121185, 0.3634970188140869, -1.1752859354019165, -0.8515703678131104, 0.010821308009326458, 0.9781356453895569, -0.8415478467941284, -0.06878475844860077, -0.11494486033916473], [-1.6556191444396973, -0.3341541290283203, -1.6154296398162842, 0.4105648100376129, 0.963854193687439, 0.3282204270362854, 0.06049910932779312, -1.1918007135391235, -0.519070029258728, -1.278523325920105, 0.7221263647079468, 0.24975945055484772, -0.9084169268608093, 0.09510061889886856, 0.1133827418088913, -1.907651424407959], [-0.6358835697174072, -1.228570818901062, 0.1053849533200264, -0.26914721727371216, -0.5862342119216919, -0.27735331654548645, -1.078141689300537, 0.4135347902774811, 0.5919438004493713, 0.7107099294662476, -0.2621993124485016, 1.5015686750411987, -0.16780288517475128, 1.7114884853363037, -0.11778640002012253, -0.16749101877212524], [1.5553796291351318, -1.2570301294326782, -0.13364559412002563, 0.11172090470790863, -1.8765703439712524, -1.3434430360794067, -2.0549187660217285, -0.6548648476600647, -0.3038412034511566, 0.537597119808197, 0.2686021327972412, -1.7700008153915405, 2.1069438457489014, 0.4100417494773865, 0.8539451360702515, 1.4541032314300537], [1.212177038192749, 0.248897522687912, 0.6189541220664978, 1.5856945514678955, 0.12450158596038818, 0.7298774719238281, 2.3823165893554688, -0.6485226154327393, 0.5708996653556824, -0.9802722334861755, -0.05228327214717865, -1.9604300260543823, 0.18086792528629303, 0.059323087334632874, 0.8089112043380737, 0.06678680330514908], [1.2780805826187134, 0.5857242941856384, 1.3826525211334229, 0.6941290497779846, -1.1786468029022217, 0.27774423360824585, -0.8117172122001648, -0.2775658071041107, -0.5489655137062073, -1.00083327293396, -0.3259105980396271, -0.40876108407974243, -0.04072640836238861, -2.4221949577331543, -0.4039194583892822, -0.43812358379364014], [-0.9743454456329346, 0.963897705078125, -0.19118742644786835, 1.0727242231369019, 1.6018716096878052, 0.979602038860321, -1.0461935997009277, -0.5447999238967896, 0.7352514863014221, 1.4415884017944336, 0.913340151309967, 0.22623713314533234, -0.6470053791999817, 1.1707030534744263, 1.868058204650879, -0.8057765364646912], [-1.9958140850067139, 0.44372814893722534, -2.235931158065796, -1.1041157245635986, 0.7726891040802002, -0.10041210800409317, -0.8011403679847717, -0.6978350877761841, 0.33016833662986755, -1.7603164911270142, 0.8612862825393677, -0.2727513611316681, 0.2952006757259369, -0.0863696038722992, -1.077795386314392, 1.3174171447753906], [0.25975480675697327, -0.2267509251832962, 1.0719213485717773, 0.13768793642520905, 1.3734848499298096, 0.8900320529937744, 0.005205621011555195, 1.0246360301971436, -1.4376553297042847, 0.026752600446343422, 1.7635213136672974, 0.22781233489513397, -1.265060544013977, 0.2765822410583496, 0.14018741250038147, 0.27095043659210205], [0.050730787217617035, 1.7496167421340942, 0.3843174874782562, -0.41870418190956116, -0.6132577061653137, -0.20182815194129944, -0.9032129645347595, 0.14338162541389465, 0.18738064169883728, -1.9100512266159058, 0.7312764525413513, -1.0993099212646484, 0.8123900294303894, -0.3830788731575012, 0.6275108456611633, -0.39470601081848145], [-2.119702100753784, 1.6772722005844116, 0.28148481249809265, -0.6908485889434814, -1.6098593473434448, -0.4926079511642456, 0.23396609723567963, 1.7376254796981812, 1.0201282501220703, -1.6659587621688843, -2.033097505569458, 0.5242786407470703, 0.8123331069946289, 0.2906351387500763, 0.0948316752910614, -1.57606041431427], [-0.3695988953113556, 0.9212112426757812, 1.317896842956543, 0.28795596957206726, 0.673072338104248, 2.1550965309143066, 0.2843187153339386, -0.3221006989479065, -0.5894857048988342, -1.2183080911636353, 2.3109419345855713, -0.3402690291404724, -0.06387106329202652, -0.3724074959754944, -1.0716981887817383, -0.06900236010551453], [-1.1592929363250732, -0.8167169094085693, 0.3081871271133423, 0.2535775303840637, 1.611940622329712, -0.21664273738861084, -0.6799147129058838, 0.7301803231239319, -1.0188144445419312, -0.37104442715644836, 1.2735862731933594, 0.7205715775489807, 1.140811800956726, 0.8689939975738525, 0.2088829129934311, -0.765638530254364], [-0.6183924674987793, -0.39621734619140625, 0.49710652232170105, 0.7794858813285828, 0.11941751092672348, 0.013390456326305866, 0.06188749521970749, 0.11369651556015015, -0.4389849007129669, -1.0939189195632935, 0.5687056183815002, 0.06488490849733353, 0.7042430639266968, 0.10799430310726166, 0.6396369934082031, -1.061358094215393], [1.38083016872406, -1.0804533958435059, -0.26850929856300354, 0.6220055222511292, 1.0864269733428955, 0.3832469880580902, -0.12893709540367126, 0.24852176010608673, 0.027278050780296326, -0.4242528975009918, 0.48919910192489624, 0.10447167605161667, 2.0131266117095947, -0.1408180445432663, 1.152069091796875, -0.24954426288604736], [-2.1065971851348877, 0.6768315434455872, -0.30398795008659363, 2.1751644611358643, 0.10671831667423248, 0.4856099486351013, -2.605884313583374, -0.2176062911748886, -1.7428195476531982, -0.06100369617342949, 1.0243250131607056, 0.11079688370227814, 0.9098693132400513, 1.4345828294754028, -1.1414541006088257, -0.08397497981786728], [1.205458641052246, -1.3479984998703003, -0.09899350255727768, -0.039312295615673065, 0.41094034910202026, -0.029353270307183266, -0.9314888119697571, -0.629811704158783, 1.2316906452178955, -0.2713644206523895, 2.013180732727051, -0.5723325610160828, -1.0768368244171143, 0.8825520277023315, 1.1426159143447876, 0.17433680593967438], [0.140082448720932, 0.15563660860061646, -0.4301457703113556, 1.9001398086547852, -1.7925937175750732, -0.5465841889381409, -0.8343539834022522, 0.022525092586874962, 0.7801069021224976, 1.197023630142212, 0.1272577941417694, -0.4100155532360077, -0.9723393321037292, -1.3754216432571411, 2.4497153759002686, -1.3055230379104614], [2.866915225982666, -0.363059937953949, -0.23616409301757812, 0.6295525431632996, -0.2657562494277954, 0.2041296660900116, -1.396916389465332, 0.11987794190645218, -1.0041574239730835, 0.2126374989748001, 0.08954901248216629, -0.6534318327903748, 0.6537449955940247, 0.486194372177124, -0.3541038930416107, -0.6930254101753235], [0.5941326022148132, -0.22268348932266235, 0.007942559197545052, -0.24050520360469818, -0.9492929577827454, 0.19260776042938232, 1.052936315536499, 0.8952515125274658, -0.44802820682525635, -0.46179890632629395, -0.40740302205085754, -0.0805642381310463, -1.760446310043335, -0.9876477718353271, 1.0251185894012451, -0.36142459511756897], [0.21669910848140717, -0.11079169064760208, 0.27470269799232483, 1.579426646232605, 0.6898742914199829, 0.6697251796722412, -0.6257768273353577, 0.2680393159389496, 1.1770564317703247, -1.273383378982544, 0.14635291695594788, 0.6450676321983337, -0.7795016169548035, -2.904675006866455, -0.4085336923599243, -0.3630344271659851], [0.21513882279396057, -1.3511089086532593, 0.9236379265785217, 0.1474168449640274, -0.6270109415054321, -0.19522948563098907, 1.1718754768371582, -0.02134588547050953, -0.045449625700712204, 0.742267370223999, 0.7663171291351318, 0.8998587727546692, -1.6336925029754639, -0.20600971579551697, -2.124385118484497, -0.6554341316223145], [0.4958007037639618, -0.3300303518772125, -0.4273771047592163, -0.20484097301959991, 0.319632887840271, -0.35982972383499146, -0.31712576746940613, -1.113769769668579, 0.6343621015548706, 0.44533246755599976, -0.7282143235206604, 0.48689720034599304, 0.7151362299919128, 0.5626128315925598, -0.2979333698749542, 0.18530841171741486], [-1.363771915435791, 1.8500477075576782, -2.290601968765259, -2.0066475868225098, 0.09990976005792618, 1.1987971067428589, 0.5421940684318542, 0.5021786093711853, -1.2331643104553223, 0.18904206156730652, -0.2175028920173645, 1.0394315719604492, -0.9095672965049744, 0.43795135617256165, -3.3761961460113525, 0.0235418863594532], [0.34646448493003845, 0.840658962726593, -1.1280863285064697, -0.7279335856437683, 0.3668173849582672, 0.3785863518714905, 0.1091659888625145, -1.474294662475586, 0.8746855854988098, 0.4689382016658783, 0.12793229520320892, -0.45954740047454834, 0.632622241973877, 1.4910151958465576, 0.028784040361642838, -1.2280516624450684], [0.4561890959739685, 1.2795835733413696, -1.4428155422210693, -1.6033785343170166, 0.35817357897758484, 1.2277159690856934, 0.6140509843826294, -1.399146318435669, 1.776909351348877, -1.1343607902526855, 2.119511604309082, 0.14426149427890778, -0.6658602356910706, 1.206942081451416, 1.427699327468872, 0.23749661445617676], [-0.2771555781364441, -0.020601559430360794, -0.4007340967655182, 0.8894820809364319, -2.377859115600586, -1.5563793182373047, -0.8449994325637817, -0.35280755162239075, 0.23034897446632385, 0.5701674222946167, -2.276663303375244, -1.2979867458343506, 0.041942473500967026, -0.4781135022640228, 1.7564958333969116, 1.0898517370224], [-0.2256181389093399, 0.29574769735336304, 0.7685131430625916, 0.6776107549667358, 1.5335391759872437, -0.3287070095539093, -0.090177521109581, -0.6062294840812683, -1.6217414140701294, 0.4805349111557007, 0.26111218333244324, 0.026766343042254448, 0.4205162525177002, 0.5685045719146729, 1.011781096458435, 0.16668778657913208], [-0.7200111150741577, 1.6450759172439575, -0.4302474856376648, 0.2536938190460205, 0.8097054362297058, 0.7944768071174622, 1.3559576272964478, -1.0992704629898071, -0.3334032893180847, 0.08286789059638977, -0.28406399488449097, 0.8130898475646973, 1.9442614316940308, 1.0616463422775269, 1.072922706604004, -0.0005604370962828398], [1.698673963546753, 0.17500245571136475, -0.13634495437145233, -0.5419949889183044, 1.6474183797836304, -0.33179616928100586, 1.67753005027771, -0.646321177482605, -0.49563226103782654, -0.046433113515377045, -0.7666882872581482, -0.6432552337646484, 0.6549248099327087, -0.5725983381271362, -0.17497019469738007, 0.5870482325553894], [0.45596691966056824, 0.6367679834365845, 0.7445272207260132, -0.21229064464569092, -0.10094104707241058, 0.5471881628036499, 0.010591469705104828, -0.6199851632118225, -1.1590813398361206, -0.3586774170398712, 0.1963585615158081, -0.26464760303497314, 0.6789929866790771, -0.2287890762090683, 1.1464834213256836, 0.23859141767024994], [0.840617835521698, 1.0135596990585327, -0.0005046415608376265, 0.008507587015628815, -0.6819575428962708, 1.410760521888733, -0.0704582929611206, 1.324288010597229, -2.0739495754241943, 1.3763922452926636, -0.07164192199707031, 0.41126883029937744, -0.4745229482650757, -0.18654122948646545, -0.5283731818199158, -1.1492352485656738]]}, {"down_proj": [[-0.1320899873971939, 0.2594401240348816, -0.20743849873542786, -0.42506489157676697, 0.29525184631347656, 0.27515000104904175, 0.2524474859237671, -0.024958781898021698, -0.16349272429943085, -0.046530209481716156, 0.11892448365688324, 0.21762092411518097, 0.05441563203930855, 0.27235671877861023, -0.544754683971405, -0.0021415501832962036], [0.10305415093898773, 0.13055485486984253, -0.13513994216918945, -0.13367147743701935, 0.23705990612506866, 0.023235462605953217, 0.02779243141412735, -0.4432123899459839, 0.3162485361099243, -0.13097159564495087, 0.22536346316337585, -0.12255243211984634, 0.28139159083366394, 0.39394691586494446, 0.5076043605804443, 0.08511889725923538], [-0.1477673351764679, 0.27228689193725586, -0.003912143409252167, 0.05274783819913864, -0.05590325966477394, -0.1457841396331787, 0.0468241348862648, -0.039154794067144394, -0.4476737976074219, 0.23534151911735535, -0.5525294542312622, -0.1002214252948761, 0.5003529191017151, 0.14255376160144806, 0.11973389983177185, 0.1303141713142395], [0.38851842284202576, -0.35021957755088806, 0.4708307385444641, 0.1464449018239975, 0.5398319959640503, -0.07064009457826614, 0.03911551833152771, -0.017474930733442307, -0.23720122873783112, -0.0881100594997406, 0.09194561839103699, -0.011512234807014465, 0.2831767797470093, -0.01699099689722061, -0.16501453518867493, 0.06860333681106567]], "freq": [956.0, 998.0, 240.0, 165.0, 110.0, 56.0, 50.0, 601.0, 137.0, 24.0, 453.0, 595.0, 949.0, 53.0, 167.0, 309.0, 525.0, 418.0, 18.0, 240.0, 938.0, 272.0, 95.0, 697.0, 125.0, 899.0, 420.0, 297.0, 863.0, 123.0, 170.0, 718.0, 198.0, 723.0, 174.0, 195.0, 385.0, 256.0, 423.0, 794.0, 920.0, 515.0, 921.0, 315.0, 425.0, 478.0, 104.0, 442.0], "rank": 4, "scores": [[-1.0928148031234741, 1.9052612781524658, -2.5082035064697266, 0.5134777426719666], [-3.6039774417877197, -0.14616365730762482, -0.3926100730895996, -1.9063270092010498], [-0.6843295693397522, -0.06279480457305908, 0.2059224545955658, 1.4303418397903442], [-0.9131848812103271, -1.0828664302825928, -0.7428328394889832, -0.7884445786476135], [-1.1480154991149902, -1.3064275979995728, -2.028400421142578, 0.4897306561470032], [0.697837233543396, -2.1340644359588623, -1.7814221382141113, 0.5867033004760742], [0.21668893098831177, 0.851298987865448, 0.4919682443141937, 0.274570494890213], [4.7740068435668945, -1.8635201454162598, 0.2524513006210327, -2.0308237075805664], [1.1704354286193848, 2.1232500076293945, 0.19751450419425964, -0.7631680369377136], [1.4460041522979736, 3.577514886856079, -2.1205997467041016, -1.5866082906723022], [-3.303050994873047, -0.1109788715839386, 2.1421384811401367, -1.8538118600845337], [-0.08036454766988754, 0.792829692363739, 1.2547684907913208, 1.447914481163025], [1.3350131511688232, 2.130056381225586, 2.0116095542907715, -0.1763174682855606], [0.7401950359344482, 0.67994225025177, 0.8293742537498474, 1.7676891088485718], [-0.2988060712814331, 0.782053530216217, 0.8705323934555054, 0.5426868200302124], [0.854071319103241, -1.9756380319595337, 0.7032142281532288, -0.284570574760437], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], "shard": [32, 48], "weight": [[1.205458641052246, -1.3479984998703003, -0.09899350255727768, -0.039312295615673065, 0.41094034910202026, -0.029353270307183266, -0.9314888119697571, -0.629811704158783, 1.2316906452178955, -0.2713644206523895, 2.013180732727051, -0.5723325610160828, -1.0768368244171143, 0.8825520277023315, 1.1426159143447876, 0.17433680593967438], [0.140082448720932, 0.15563660860061646, -0.4301457703113556, 1.9001398086547852, -1.7925937175750732, -0.5465841889381409, -0.8343539834022522, 0.022525092586874962, 0.7801069021224976, 1.197023630142212, 0.1272577941417694, -0.4100155532360077, -0.9723393321037292, -1.3754216432571411, 2.4497153759002686, -1.3055230379104614], [2.866915225982666, -0.363059937953949, -0.23616409301757812, 0.6295525431632996, -0.2657562494277954, 0.2041296660900116, -1.396916389465332, 0.11987794190645218, -1.0041574239730835, 0.2126374989748001, 0.08954901248216629, -0.6534318327903748, 0.6537449955940247, 0.486194372177124, -0.3541038930416107, -0.6930254101753235], [0.5941326022148132, -0.22268348932266235, 0.007942559197545052, -0.24050520360469818, -0.9492929577827454, 0.19260776042938232, 1.052936315536499, 0.8952515125274658, -0.44802820682525635, -0.46179890632629395, -0.40740302205085754, -0.0805642381310463, -1.760446310043335, -0.9876477718353271, 1.0251185894012451, -0.36142459511756897], [0.21669910848140717, -0.11079169064760208, 0.27470269799232483, 1.579426646232605, 0.6898742914199829, 0.6697251796722412, -0.6257768273353577, 0.2680393159389496, 1.1770564317703247, -1.273383378982544, 0.14635291695594788, 0.6450676321983337, -0.7795016169548035, -2.904675006866455, -0.4085336923599243, -0.3630344271659851], [0.21513882279396057, -1.3511089086532593, 0.9236379265785217, 0.1474168449640274, -0.6270109415054321, -0.19522948563098907, 1.1718754768371582, -0.02134588547050953, -0.045449625700712204, 0.742267370223999, 0.7663171291351318, 0.8998587727546692, -1.6336925029754639, -0.20600971579551697, -2.124385118484497, -0.6554341316223145], [0.4958007037639618, -0.3300303518772125, -0.4273771047592163, -0.20484097301959991, 0.319632887840271, -0.35982972383499146, -0.31712576746940613, -1.113769769668579, 0.6343621015548706, 0.44533246755599976, -0.7282143235206604, 0.48689720034599304, 0.7151362299919128, 0.5626128315925598, -0.2979333698749542, 0.18530841171741486], [-1.363771915435791, 1.8500477075576782, -2.290601968765259, -2.0066475868225098, 0.09990976005792618, 1.1987971067428589, 0.5421940684318542, 0.5021786093711853, -1.2331643104553223, 0.18904206156730652, -0.2175028920173645, 1.0394315719604492, -0.9095672965049744, 0.43795135617256165, -3.3761961460113525, 0.0235418863594532], [0.34646448493003845, 0.840658962726593, -1.1280863285064697, -0.7279335856437683, 0.3668173849582672, 0.3785863518714905, 0.1091659888625145, -1.474294662475586, 0.8746855854988098, 0.4689382016658783, 0.12793229520320892, -0.45954740047454834, 0.632622241973877, 1.4910151958465576, 0.028784040361642838, -1.2280516624450684], [0.4561890959739685, 1.2795835733413696, -1.4428155422210693, -1.6033785343170166, 0.35817357897758484, 1.2277159690856934, 0.6140509843826294, -1.399146318435669, 1.776909351348877, -1.1343607902526855, 2.119511604309082, 0.14426149427890778, -0.6658602356910706, 1.206942081451416, 1.427699327468872, 0.23749661445617676], [-0.2771555781364441, -0.020601559430360794, -0.4007340967655182, 0.8894820809364319, -2.377859115600586, -1.5563793182373047, -0.8449994325637817, -0.35280755162239075, 0.23034897446632385, 0.5701674222946167, -2.276663303375244, -1.2979867458343506, 0.041942473500967026, -0.4781135022640228, 1.7564958333969116, 1.0898517370224], [-0.2256181389093399, 0.29574769735336304, 0.7685131430625916, 0.6776107549667358, 1.5335391759872437, -0.3287070095539093, -0.090177521109581, -0.6062294840812683, -1.6217414140701294, 0.4805349111557007, 0.26111218333244324, 0.026766343042254448, 0.4205162525177002, 0.5685045719146729, 1.011781096458435, 0.16668778657913208], [-0.7200111150741577, 1.6450759172439575, -0.4302474856376648, 0.2536938190460205, 0.8097054362297058, 0.7944768071174622, 1.3559576272964478, -1.0992704629898071, -0.3334032893180847, 0.08286789059638977, -0.28406399488449097, 0.8130898475646973, 1.9442614316940308, 1.0616463422775269, 1.072922706604004, -0.0005604370962828398], [1.698673963546753, 0.17500245571136475, -0.13634495437145233, -0.5419949889183044, 1.6474183797836304, -0.33179616928100586, 1.67753005027771, -0.646321177482605, -0.49563226103782654, -0.046433113515377045, -0.7666882872581482, -0.6432552337646484, 0.6549248099327087, -0.5725983381271362, -0.17497019469738007, 0.5870482325553894], [0.45596691966056824, 0.6367679834365845, 0.7445272207260132, -0.21229064464569092, -0.10094104707241058, 0.5471881628036499, 0.010591469705104828, -0.6199851632118225, -1.1590813398361206, -0.3586774170398712, 0.1963585615158081, -0.26464760303497314, 0.6789929866790771, -0.2287890762090683, 1.1464834213256836, 0.23859141767024994], [0.840617835521698, 1.0135596990585327, -0.0005046415608376265, 0.008507587015628815, -0.6819575428962708, 1.410760521888733, -0.0704582929611206, 1.324288010597229, -2.0739495754241943, 1.3763922452926636, -0.07164192199707031, 0.41126883029937744, -0.4745229482650757, -0.18654122948646545, -0.5283731818199158, -1.1492352485656738], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]}], "verify_buckets": {"chain_intensity": {"1": [16, 14, 12, 10, 8, 6, 4, 2, 1], "10": [16, 14, 12, 10, 8, 6, 4, 2, 1], "100": [16, 14, 12, 10, 8, 6, 4, 2, 1], "101": [16, 14, 12, 10, 8, 6, 4, 2, 1], "102": [16, 14, 12, 10, 8, 6, 4, 2, 1], "103": [16, 14, 12, 10, 8, 6, 4, 2, 1], "104": [16, 14, 12, 10, 8, 6, 4, 2, 1], "105": [16, 14, 12, 10, 8, 6, 4, 2, 1], "106": [16, 14, 12, 10, 8, 6, 4, 2, 1], "107": [16, 14, 12, 10, 8, 6, 4, 2, 1], "108": [16, 14, 12, 10, 8, 6, 4, 2, 1], "109": [16, 14, 12, 10, 8, 6, 4, 2, 1], "11": [16, 14, 12, 10, 8, 6, 4, 2, 1], "110": [16, 14, 12, 10, 8, 6, 4, 2, 1], "111": [16, 14, 12, 10, 8, 6, 4, 2, 1], "112": [16, 14, 12, 10, 8, 6, 4, 2, 1], "113": [16, 14, 12, 10, 8, 6, 4, 2, 1], "114": [16, 14, 12, 10, 8, 6, 4, 2, 1], "115": [16, 14, 12, 10, 8, 6, 4, 2, 1], "116": [16, 14, 12, 10, 8, 6, 4, 2, 1], "117": [16, 14, 12, 10, 8, 6, 4, 2, 1], "118": [16, 14, 12, 10, 8, 6, 4, 2, 1], "119": [16, 14, 12, 10, 8, 6, 4, 2, 1], "12": [16, 14, 12, 10, 8, 6, 4, 2, 1], "120": [16, 14, 12, 10, 8, 6, 4, 2, 1], "121": [16, 14, 12, 10, 8, 6, 4, 2, 1], "122": [16, 14, 12, 10, 8, 6, 4, 2, 1], "123": [16, 14, 12, 10, 8, 6, 4, 2, 1], "124": [16, 14, 12, 10, 8, 6, 4, 2, 1], "125": [16, 14, 12, 10, 8, 6, 4, 2, 1], "126": [16, 14, 12, 10, 8, 6, 4, 2, 1], "127": [16, 14, 12, 10, 8, 6, 4, 2, 1], "128": [16, 14, 12, 10, 8, 6, 4, 2, 1], "129": [16, 14, 12, 10, 8, 6, 4, 2, 1], "13": [16, 14, 12, 10, 8, 6, 4, 2, 1], "130": [16, 14, 12, 10, 8, 6, 4, 2, 1], "131": [16, 14, 12, 10, 8, 6, 4, 2, 1], "132": [16, 14, 12, 10, 8, 6, 4, 2, 1], "133": [16, 14, 12, 10, 8, 6, 4, 2, 1], "134": [16, 14, 12, 10, 8, 6, 4, 2, 1], "135": [16, 14, 12, 10, 8, 6, 4, 2, 1], "136": [16, 14, 12, 10, 8, 6, 4, 2, 1], "137": [16, 14, 12, 10, 8, 6, 4, 2, 1], "138": [16, 14, 12, 10, 8, 6, 4, 2, 1], "139": [16, 14, 12, 10, 8, 6, 4, 2, 1], "14": [16, 14, 12, 10, 8, 6, 4, 2, 1], "140": [16, 14, 12, 10, 8, 6, 4, 2, 1], "141": [16, 14, 12, 10, 8, 6, 4, 2, 1], "142": [16, 14, 12, 10, 8, 6, 4, 2, 1], "143": [16, 14, 12, 10, 8, 6, 4, 2, 1], "144": [16, 14, 12, 10, 8, 6, 4, 2, 1], "145": [16, 14, 12, 10, 8, 6, 4, 2, 1], "146": [16, 14, 12, 10, 8, 6, 4, 2, 1], "147": [16, 14, 12, 10, 8, 6, 4, 2, 1], "148": [16, 14, 12, 10, 8, 6, 4, 2, 1], "149": [16, 14, 12, 10, 8, 6, 4, 2, 1], "15": [16, 14, 12, 10, 8, 6, 4, 2, 1], "150": [16, 14, 12, 10, 8, 6, 4, 2, 1], "151": [16, 14, 12, 10, 8, 6, 4, 2, 1], "152": [16, 14, 12, 10, 8, 6, 4, 2, 1], "153": [16, 14, 12, 10, 8, 6, 4, 2, 1], "154": [16, 14, 12, 10, 8, 6, 4, 2, 1], "155": [16, 14, 12, 10, 8, 6, 4, 2, 1], "156": [16, 14, 12, 10, 8, 6, 4, 2, 1], "157": [16, 14, 12, 10, 8, 6, 4, 2, 1], "158": [16, 14, 12, 10, 8, 6, 4, 2, 1], "159": [16, 14, 12, 10, 8, 6, 4, 2, 1], "16": [16, 14, 12, 10, 8, 6, 4, 2, 1], "160": [16, 14, 12, 10, 8, 6, 4, 2, 1], "161": [16, 14, 12, 10, 8, 6, 4, 2, 1], "162": [16, 14, 12, 10, 8, 6, 4, 2, 1], "163": [16, 14, 12, 10, 8, 6, 4, 2, 1], "164": [16, 14, 12, 10, 8, 6, 4, 2, 1], "165": [16, 14, 12, 10, 8, 6, 4, 2, 1], "166": [16, 14, 12, 10, 8, 6, 4, 2, 1], "167": [16, 14, 12, 10, 8, 6, 4, 2, 1], "168": [16, 14, 12, 10, 8, 6, 4, 2, 1], "169": [16, 14, 12, 10, 8, 6, 4, 2, 1], "17": [16, 14, 12, 10, 8, 6, 4, 2, 1], "170": [16, 14, 12, 10, 8, 6, 4, 2, 1], "171": [16, 14, 12, 10, 8, 6, 4, 2, 1], "172": [16, 14, 12, 10, 8, 6, 4, 2, 1], "173": [16, 14, 12, 10, 8, 6, 4, 2, 1], "174": [16, 14, 12, 10, 8, 6, 4, 2, 1], "175": [16, 14, 12, 10, 8, 6, 4, 2, 1], "176": [16, 14, 12, 10, 8, 6, 4, 2, 1], "177": [16, 14, 12, 10, 8, 6, 4, 2, 1], "178": [16, 14, 12, 10, 8, 6, 4, 2, 1], "179": [16, 14, 12, 10, 8, 6, 4, 2, 1], "18": [16, 14, 12, 10, 8, 6, 4, 2, 1], "180": [16, 14, 12, 10, 8, 6, 4, 2, 1], "181": [16, 14, 12, 10, 8, 6, 4, 2, 1], "182": [16, 14, 12, 10, 8, 6, 4, 2, 1], "183": [16, 14, 12, 10, 8, 6, 4, 2, 1], "184": [16, 14, 12, 10, 8, 6, 4, 2, 1], "185": [16, 14, 12, 10, 8, 6, 4, 2, 1], "186": [16, 14, 12, 10, 8, 6, 4, 2, 1], "187": [16, 14, 12, 10, 8, 6, 4, 2, 1], "188": [16, 14, 12, 10, 8, 6, 4, 2, 1], "189": [16, 14, 12, 10, 8, 6, 4, 2, 1], "19": [16, 14, 12, 10, 8, 6, 4, 2, 1], "190": [16, 14, 12, 10, 8, 6, 4, 2, 1], "191": [16, 14, 12, 10, 8, 6, 4, 2, 1], "192": [16, 14, 12, 10, 8, 6, 4, 2, 1], "193": [16, 14, 12, 10, 8, 6, 4, 2, 1], "194": [16, 14, 12, 10, 8, 6, 4, 2, 1], "195": [16, 14, 12, 10, 8, 6, 4, 2, 1], "196": [16, 14, 12, 10, 8, 6, 4, 2, 1], "197": [16, 14, 12, 10, 8, 6, 4, 2, 1], "198": [16, 14, 12, 10, 8, 6, 4, 2, 1], "199": [16, 14, 12, 10, 8, 6, 4, 2, 1], "2": [16, 14, 12, 10, 8, 6, 4, 2, 1], "20": [16, 14, 12, 10, 8, 6, 4, 2, 1], "200": [16, 14, 12, 10, 8, 6, 4, 2, 1], "201": [16, 14, 12, 10, 8, 6, 4, 2, 1], "202": [16, 14, 12, 10, 8, 6, 4, 2, 1], "203": [16, 14, 12, 10, 8, 6, 4, 2, 1], "204": [16, 14, 12, 10, 8, 6, 4, 2, 1], "205": [16, 14, 12, 10, 8, 6, 4, 2, 1], "206": [16, 14, 12, 10, 8, 6, 4, 2, 1], "207": [16, 14, 12, 10, 8, 6, 4, 2, 1], "208": [16, 14, 12, 10, 8, 6, 4, 2, 1], "209": [16, 14, 12, 10, 8, 6, 4, 2, 1], "21": [16, 14, 12, 10, 8, 6, 4, 2, 1], "210": [16, 14, 12, 10, 8, 6, 4, 2, 1], "211": [16, 14, 12, 10, 8, 6, 4, 2, 1], "212": [16, 14, 12, 10, 8, 6, 4, 2, 1], "213": [16, 14, 12, 10, 8, 6, 4, 2, 1], "214": [16, 14, 12, 10, 8, 6, 4, 2, 1], "215": [16, 14, 12, 10, 8, 6, 4, 2, 1], "216": [16, 14, 12, 10, 8, 6, 4, 2, 1], "217": [16, 14, 12, 10, 8, 6, 4, 2, 1], "218": [16, 14, 12, 10, 8, 6, 4, 2, 1], "219": [16, 14, 12, 10, 8, 6, 4, 2, 1], "22": [16, 14, 12, 10, 8, 6, 4, 2, 1], "220": [16, 14, 12, 10, 8, 6, 4, 2, 1], "221": [16, 14, 12, 10, 8, 6, 4, 2, 1], "222": [16, 14, 12, 10, 8, 6, 4, 2, 1], "223": [16, 14, 12, 10, 8, 6, 4, 2, 1], "224": [16, 14, 12, 10, 8, 6, 4, 2, 1], "225": [16, 14, 12, 10, 8, 6, 4, 2, 1], "226": [16, 14, 12, 10, 8, 6, 4, 2, 1], "227": [16, 14, 12, 10, 8, 6, 4, 2, 1], "228": [16, 14, 12, 10, 8, 6, 4, 2, 1], "229": [16, 14, 12, 10, 8, 6, 4, 2, 1], "23": [16, 14, 12, 10, 8, 6, 4, 2, 1], "230": [16, 14, 12, 10, 8, 6, 4, 2, 1], "231": [16, 14, 12, 10, 8, 6, 4, 2, 1], "232": [16, 14, 12, 10, 8, 6, 4, 2, 1], "233": [16, 14, 12, 10, 8, 6, 4, 2, 1], "234": [16, 14, 12, 10, 8, 6, 4, 2, 1], "235": [16, 14, 12, 10, 8, 6, 4, 2, 1], "236": [16, 14, 12, 10, 8, 6, 4, 2, 1], "237": [16, 14, 12, 10, 8, 6, 4, 2, 1], "238": [16, 14, 12, 10, 8, 6, 4, 2, 1], "239": [16, 14, 12, 10, 8, 6, 4, 2, 1], "24": [16, 14, 12, 10, 8, 6, 4, 2, 1], "240": [16, 14, 12, 10, 8, 6, 4, 2, 1], "241": [16, 14, 12, 10, 8, 6, 4, 2, 1], "242": [16, 14, 12, 10, 8, 6, 4, 2, 1], "243": [16, 14, 12, 10, 8, 6, 4, 2, 1], "244": [16, 14, 12, 10, 8, 6, 4, 2, 1], "245": [16, 14, 12, 10, 8, 6, 4, 2, 1], "246": [16, 14, 12, 10, 8, 6, 4, 2, 1], "247": [16, 14, 12, 10, 8, 6, 4, 2, 1], "248": [16, 14, 12, 10, 8, 6, 4, 2, 1], "249": [16, 14, 12, 10, 8, 6, 4, 2, 1], "25": [16, 14, 12, 10, 8, 6, 4, 2, 1], "250": [16, 14, 12, 10, 8, 6, 4, 2, 1], "251": [16, 14, 12, 10, 8, 6, 4, 2, 1], "252": [16, 14, 12, 10, 8, 6, 4, 2, 1], "253": [16, 14, 12, 10, 8, 6, 4, 2, 1], "254": [16, 14, 12, 10, 8, 6, 4, 2, 1], "255": [16, 14, 12, 10, 8, 6, 4, 2, 1], "256": [16, 14, 12, 10, 8, 6, 4, 2, 1], "26": [16, 14, 12, 10, 8, 6, 4, 2, 1], "27": [16, 14, 12, 10, 8, 6, 4, 2, 1], "28": [16, 14, 12, 10, 8, 6, 4, 2, 1], "29": [16, 14, 12, 10, 8, 6, 4, 2, 1], "3": [16, 14, 12, 10, 8, 6, 4, 2, 1], "30": [16, 14, 12, 10, 8, 6, 4, 2, 1], "31": [16, 14, 12, 10, 8, 6, 4, 2, 1], "32": [16, 14, 12, 10, 8, 6, 4, 2, 1], "33": [16, 14, 12, 10, 8, 6, 4, 2, 1], "34": [16, 14, 12, 10, 8, 6, 4, 2, 1], "35": [16, 14, 12, 10, 8, 6, 4, 2, 1], "36": [16, 14, 12, 10, 8, 6, 4, 2, 1], "37": [16, 14, 12, 10, 8, 6, 4, 2, 1], "38": [16, 14, 12, 10, 8, 6, 4, 2, 1], "39": [16, 14, 12, 10, 8, 6, 4, 2, 1], "4": [16, 14, 12, 10, 8, 6, 4, 2, 1], "40": [16, 14, 12, 10, 8, 6, 4, 2, 1], "41": [16, 14, 12, 10, 8, 6, 4, 2, 1], "42": [16, 14, 12, 10, 8, 6, 4, 2, 1], "43": [16, 14, 12, 10, 8, 6, 4, 2, 1], "44": [16, 14, 12, 10, 8, 6, 4, 2, 1], "45": [16, 14, 12, 10, 8, 6, 4, 2, 1], "46": [16, 14, 12, 10, 8, 6, 4, 2, 1], "47": [16, 14, 12, 10, 8, 6, 4, 2, 1], "48": [16, 14, 12, 10, 8, 6, 4, 2, 1], "49": [16, 14, 12, 10, 8, 6, 4, 2, 1], "5": [16, 14, 12, 10, 8, 6, 4, 2, 1], "50": [16, 14, 12, 10, 8, 6, 4, 2, 1], "51": [16, 14, 12, 10, 8, 6, 4, 2, 1], "52": [16, 14, 12, 10, 8, 6, 4, 2, 1], "53": [16, 14, 12, 10, 8, 6, 4, 2, 1], "54": [16, 14, 12, 10, 8, 6, 4, 2, 1], "55": [16, 14, 12, 10, 8, 6, 4, 2, 1], "56": [16, 14, 12, 10, 8, 6, 4, 2, 1], "57": [16, 14, 12, 10, 8, 6, 4, 2, 1], "58": [16, 14, 12, 10, 8, 6, 4, 2, 1], "59": [16, 14, 12, 10, 8, 6, 4, 2, 1], "6": [16, 14, 12, 10, 8, 6, 4, 2, 1], "60": [16, 14, 12, 10, 8, 6, 4, 2, 1], "61": [16, 14, 12, 10, 8, 6, 4, 2, 1], "62": [16, 14, 12, 10, 8, 6, 4, 2, 1], "63": [16, 14, 12, 10, 8, 6, 4, 2, 1], "64": [16, 14, 12, 10, 8, 6, 4, 2, 1], "65": [16, 14, 12, 10, 8, 6, 4, 2, 1], "66": [16, 14, 12, 10, 8, 6, 4, 2, 1], "67": [16, 14, 12, 10, 8, 6, 4, 2, 1], "68": [16, 14, 12, 10, 8, 6, 4, 2, 1], "69": [16, 14, 12, 10, 8, 6, 4, 2, 1], "7": [16, 14, 12, 10, 8, 6, 4, 2, 1], "70": [16, 14, 12, 10, 8, 6, 4, 2, 1], "71": [16, 14, 12, 10, 8, 6, 4, 2, 1], "72": [16, 14, 12, 10, 8, 6, 4, 2, 1], "73": [16, 14, 12, 10, 8, 6, 4, 2, 1], "74": [16, 14, 12, 10, 8, 6, 4, 2, 1], "75": [16, 14, 12, 10, 8, 6, 4, 2, 1], "76": [16, 14, 12, 10, 8, 6, 4, 2, 1], "77": [16, 14, 12, 10, 8, 6, 4, 2, 1], "78": [16, 14, 12, 10, 8, 6, 4, 2, 1], "79": [16, 14, 12, 10, 8, 6, 4, 2, 1], "8": [16, 14, 12, 10, 8, 6, 4, 2, 1], "80": [16, 14, 12, 10, 8, 6, 4, 2, 1], "81": [16, 14, 12, 10, 8, 6, 4, 2, 1], "82": [16, 14, 12, 10, 8, 6, 4, 2, 1], "83": [16, 14, 12, 10, 8, 6, 4, 2, 1], "84": [16, 14, 12, 10, 8, 6, 4, 2, 1], "85": [16, 14, 12, 10, 8, 6, 4, 2, 1], "86": [16, 14, 12, 10, 8, 6, 4, 2, 1], "87": [16, 14, 12, 10, 8, 6, 4, 2, 1], "88": [16, 14, 12, 10, 8, 6, 4, 2, 1], "89": [16, 14, 12, 10, 8, 6, 4, 2, 1], "9": [16, 14, 12, 10, 8, 6, 4, 2, 1], "90": [16, 14, 12, 10, 8, 6, 4, 2, 1], "91": [16, 14, 12, 10, 8, 6, 4, 2, 1], "92": [16, 14, 12, 10, 8, 6, 4, 2, 1], "93": [16, 14, 12, 10, 8, 6, 4, 2, 1], "94": [16, 14, 12, 10, 8, 6, 4, 2, 1], "95": [16, 14, 12, 10, 8, 6, 4, 2, 1], "96": [16, 14, 12, 10, 8, 6, 4, 2, 1], "97": [16, 14, 12, 10, 8, 6, 4, 2, 1], "98": [16, 14, 12, 10, 8, 6, 4, 2, 1], "99": [16, 14, 12, 10, 8, 6, 4, 2, 1]}, "high_intensity": {"1": [64, 32, 16, 8, 1], "10": [32, 16, 8, 4, 1], "11": [32, 16, 8, 4, 1], "12": [32, 16, 8, 4, 1], "13": [32, 16, 8, 4, 1], "14": [32, 16, 8, 4, 1], "15": [32, 16, 8, 4, 1], "16": [32, 16, 8, 4, 1], "17": [32, 16, 8, 4, 1], "18": [32, 16, 8, 4, 1], "19": [32, 16, 8, 4, 1], "2": [64, 32, 16, 8, 1], "20": [32, 16, 8, 4, 1], "21": [32, 16, 8, 4, 1], "22": [32, 16, 8, 4, 1], "23": [32, 16, 8, 4, 1], "24": [32, 16, 8, 4, 1], "25": [32, 16, 8, 4, 1], "26": [32, 16, 8, 4, 1], "27": [32, 16, 8, 4, 1], "28": [32, 16, 8, 4, 1], "29": [32, 16, 8, 4, 1], "3": [64, 32, 16, 8, 1], "30": [32, 16, 8, 4, 1], "31": [32, 16, 8, 4, 1], "32": [32, 16, 8, 4, 1], "4": [64, 32, 16, 8, 1], "5": [64, 32, 16, 8, 1], "6": [64, 32, 16, 8, 1], "7": [64, 32, 16, 8, 1], "8": [64, 32, 16, 8, 1], "9": [32, 16, 8, 4, 1]}}, "zscore": [{"conv": 0.35, "data": [72.26998743700265, 92.08911259651657, 98.70422731153283, 99.86924450800942, 99.78537873103878, 121.88495459306827, 93.89272393478704, 98.39202014367851, 113.9992321407676, 99.72162341086916, 95.96272798042777, 100.0557104421539, 100.03456382235753, 93.32207249214653, 100.17668851142717, 78.72346988523883], "kept": [92.08911259651657, 98.70422731153283, 99.86924450800942, 99.78537873103878, 93.89272393478704, 98.39202014367851, 99.72162341086916, 95.96272798042777, 100.0557104421539, 100.03456382235753, 93.32207249214653, 100.17668851142717], "mean": 97.6671744904121, "ok": true}, {"conv": 0.2, "data": [99.10150114140004, 99.35037566243773, 102.21207347931707, 100.15537227525397, 105.22710656148699, 93.08889509189925, 91.67098198544033, 127.00572405407141, 95.00069743066122, 99.89120677244703, 95.23412832661079, 89.53568239472499, 91.50133445376831, 97.37393877129406, 132.1550004513997, 78.05757733566759, 113.69454616736849, 154.94622727331642, 99.60550750398814, 110.60245800779609, 107.62561799052504, 104.7403478926999, 100.52357239636628, 100.66561575831001, 100.6639563533756, 100.18923846235869, 99.11690813628063, 95.60508444148425], "kept": [99.10150114140004, 99.35037566243773, 102.21207347931707, 100.15537227525397, 105.22710656148699, 93.08889509189925, 91.67098198544033, 95.00069743066122, 99.89120677244703, 95.23412832661079, 89.53568239472499, 91.50133445376831, 97.37393877129406, 99.60550750398814, 107.62561799052504, 104.7403478926999, 100.52357239636628, 100.66561575831001, 100.6639563533756, 100.18923846235869, 99.11690813628063, 95.60508444148425], "mean": 98.54905196736955, "ok": true}, {"conv": 0.3, "data": [100.59904559723425, 100.31463206644918, 100.40851682037379, 99.25865357041441, 99.48334492039892, 87.01445410446286, 98.25828624444053, 102.10008321000785, 94.12792928396124, 108.94955341826876, 94.13448102735998, 87.33518118016245, 92.75290827463328, 100.33441825563042, 96.42997620384013, 101.48017789652152, 71.97658117494497, 144.8348254875568, 106.86105329619535, 105.21441487530922, 676.4046654065736, 579.7502578180247, 707.5688388228652], "kept": [100.59904559723425, 100.31463206644918, 100.40851682037379, 99.25865357041441, 99.48334492039892, 87.01445410446286, 98.25828624444053, 102.10008321000785, 94.12792928396124, 108.94955341826876, 94.13448102735998, 87.33518118016245, 92.75290827463328, 100.33441825563042, 96.42997620384013, 101.48017789652152, 106.86105329619535, 105.21441487530922], "mean": 98.6142839025369, "ok": true}, {"conv": 0.25, "data": [93.7123034371178, 134.21595161492695, 100.09949396442485, 99.70986538666914, 97.07811931891608, 81.80204050511745, 101.40946894890445, 102.8734739685494, 95.31749126884206, 100.87627065298489, 100.74643428369944, 99.86428019201824, 92.71811473914677, 99.99950972482003, 99.64654790606068, 139.8795708641037, 133.32941637112387, 103.87919978352784, 116.14997438611928, 99.53517787180076, 99.62439718057618, 137.18865927163284, 98.86501362601152, 100.87198962280867, 125.18151684150529, 93.12489464629051, 100.2987456008857, 79.3376972757334, 100.15930129818243, 99.56826044160547, 97.68524863641716, 108.57918290900804, 97.04449175282033, 104.27027966929951, 43.092424492522, 100.60591323033617, 101.19727875384045, 102.10476568438088, 32.69006951079575], "kept": [93.7123034371178, 100.09949396442485, 99.70986538666914, 97.07811931891608, 101.40946894890445, 102.8734739685494, 95.31749126884206, 100.87627065298489, 100.74643428369944, 99.86428019201824, 92.71811473914677, 99.99950972482003, 99.64654790606068, 103.87919978352784, 116.14997438611928, 99.53517787180076, 99.62439718057618, 98.86501362601152, 100.87198962280867, 93.12489464629051, 100.2987456008857, 100.15930129818243, 99.56826044160547, 97.68524863641716, 108.57918290900804, 97.04449175282033, 104.27027966929951, 100.60591323033617, 101.19727875384045, 102.10476568438088], "mean": 100.25384962953548, "ok": true}, {"conv": 0.5, "data": [129.4533989672534, 103.82140505854683, 62.15784169304595], "kept": [129.4533989672534, 103.82140505854683], "mean": 116.63740201290011, "ok": false}, {"conv": 0.5, "data": [100.6369888670928, 92.44922030104097, 100.05607446382015, 91.53216531297299, 156.72988932741828, 95.0964334917003, 132.7221721304414, 100.17476798437804, 99.63049147295254, 99.99259941274393, 90.3427126591446, 97.71378802506143, 99.79288645331958, 119.21851975562699, 100.67117179624407, 99.8351933181229, 100.75205552766664, 100.72624066494367, 100.02647382840729, 100.39904349380703, 99.35159916047371, 100.51024748266823, 448.95518691205723, 670.8534592118838], "kept": [100.6369888670928, 92.44922030104097, 100.05607446382015, 91.53216531297299, 95.0964334917003, 132.7221721304414, 100.17476798437804, 99.63049147295254, 99.99259941274393, 90.3427126591446, 97.71378802506143, 99.79288645331958, 119.21851975562699, 100.67117179624407, 99.8351933181229, 100.75205552766664, 100.72624066494367, 100.02647382840729, 100.39904349380703, 99.35159916047371, 100.51024748266823], "mean": 101.03004026679186, "ok": true}, {"conv": 0.3, "data": [99.14697304755862, 100.14666873428861, 100.02428789748754, 99.84816853207121, 99.87120110445066, 100.83779403848246, 99.42248820516005, 99.94392763628497, 104.4431829760188, 102.15165581907523, 92.1497157943976, 103.69833056021295, 104.53747974864672, 126.8022472214827, 91.06263314574909, 100.13946040327531, 99.52373002713945, 129.20261230573658, 99.0263729635964, 98.87190244049573, 99.59279584821371, 125.23745114429758, 93.24399442868597, 103.68578814461415, 100.01913439595113, 137.151292450033, 128.41732592745086, 102.28643432066129, 861.890442634664], "kept": [99.14697304755862, 100.14666873428861, 100.02428789748754, 99.84816853207121, 99.87120110445066, 100.83779403848246, 99.42248820516005, 99.94392763628497, 104.4431829760188, 102.15165581907523, 92.1497157943976, 103.69833056021295, 104.53747974864672, 91.06263314574909, 100.13946040327531, 99.52373002713945, 99.0263729635964, 98.87190244049573, 99.59279584821371, 93.24399442868597, 103.68578814461415, 100.01913439595113, 102.28643432066129], "mean": 99.72496174837032, "ok": true}, {"conv": 0.25, "data": [105.5345995511784, 131.75866131772935, 121.63523643439386, 95.0232622912212, 120.38221450532434, 116.56807449250796, 100.2997890065304, 92.64783851605081, 100.04367054668573, 129.64722339816052, 99.32545506552707, 97.11505496579342, 100.19315761345136, 99.58578590453511, 100.41640025197925, 62.706886993906195, 92.12935860604594, 99.57323673002831, 52.57586096819493, 99.94365845636938, 99.54438115028472, 98.83240801495205, 82.61475084526292, 100.57538949550444, 100.72051027484463, 99.92528548358412, 77.88403402368513, 88.62812163215744, 90.41570528075141, 58.52053898454492, 104.74214062619194, 99.89810504688722, 107.2486098334472, 89.12992693831231, 64.0868037845562, 83.53811394854644], "kept": [105.5345995511784, 95.0232622912212, 100.2997890065304, 92.64783851605081, 100.04367054668573, 99.32545506552707, 97.11505496579342, 100.19315761345136, 99.58578590453511, 100.41640025197925, 92.12935860604594, 99.57323673002831, 99.94365845636938, 99.54438115028472, 98.83240801495205, 82.61475084526292, 100.57538949550444, 100.72051027484463, 99.92528548358412, 88.62812163215744, 90.41570528075141, 104.74214062619194, 99.89810504688722, 107.2486098334472, 89.12992693831231, 83.53811394854644], "mean": 97.21710446446629, "ok": false}, {"conv": 0.2, "data": [100.30642979560567, 105.00636475330765, 67.7326487772093, 96.48814908602672, 100.5471384805246, 100.6307997278828, 30.235670355485524, 93.13178664016615, 124.05960381494937, 92.75118668425033, 94.52387248527457, 96.26709769222691, 99.86099896981392, 103.69770277368934, 100.22188497583356, 104.17466417570033, 100.42178752981505, 83.48792494741593, 98.98147661068549, 80.5754644751229, 67.8162360482549, 87.9262164982457, 100.31400824870603, 76.22377291536364, 99.64640961642013, 100.0734678792957], "kept": [100.30642979560567, 105.00636475330765, 96.48814908602672, 100.5471384805246, 100.6307997278828, 93.13178664016615, 92.75118668425033, 94.52387248527457, 96.26709769222691, 99.86099896981392, 103.69770277368934, 100.22188497583356, 104.17466417570033, 100.42178752981505, 98.98147661068549, 100.31400824870603, 99.64640961642013, 100.0734678792957], "mean": 99.28029034029028, "ok": false}, {"conv": 0.25, "data": [100.16104145505321, 103.23834238243222, 100.30029468030948, 100.7209458761317, 100.7335755586632, 100.13286179739193, 107.5321697934087, 100.48439092015005, 99.90153831299922, 101.10252631319558, 92.2237015318525, 102.39995540124809, 100.44107982888494, 100.82372960050884], "kept": [100.16104145505321, 103.23834238243222, 100.30029468030948, 100.7209458761317, 100.7335755586632, 100.13286179739193, 107.5321697934087, 100.48439092015005, 99.90153831299922, 101.10252631319558, 92.2237015318525, 102.39995540124809, 100.44107982888494, 100.82372960050884], "mean": 100.72829667515926, "ok": true}, {"conv": 0.3, "data": [128.70532139317797, 91.72626420325412, 102.93573694453036, 116.37040011306574, 107.94135137578743, 106.78505822318495, 99.23509050425127, 91.93408391071895, 100.19250836933965, 74.91547675965246, 69.19930759721144, 92.53965567124189, 100.03356695502933, 23.510663679457622, 85.6663538270652, 99.44758099430706, 71.418002682104, 138.23861772422072, 82.61576165024947, 92.2960349904538, 87.17421178332866, 86.18891704131181, 108.29011666731542, 100.80976434910613, 95.56112500900451, 94.27909152195743, 93.97119450916423, 103.05542377872474, 101.57147115128305, 99.2341755324901, 115.95755257751398, 134.6071270056915, 89.2956893925788, 101.44121834420825, 102.55766730700893, 100.89318838315307, 93.83653843229935, 145.84805629802634], "kept": [91.72626420325412, 102.93573694453036, 107.94135137578743, 106.78505822318495, 99.23509050425127, 91.93408391071895, 100.19250836933965, 92.53965567124189, 100.03356695502933, 85.6663538270652, 99.44758099430706, 92.2960349904538, 87.17421178332866, 86.18891704131181, 108.29011666731542, 100.80976434910613, 95.56112500900451, 94.27909152195743, 93.97119450916423, 103.05542377872474, 101.57147115128305, 99.2341755324901, 89.2956893925788, 101.44121834420825, 102.55766730700893, 100.89318838315307, 93.83653843229935], "mean": 97.36641033970734, "ok": false}, {"conv": 0.25, "data": [91.69647282330588, 97.78449861495126, 101.39444502405327, 97.99948259929353, 111.88700857714973, 108.59639378090628, 100.12888514566939, 102.9704672579127, 97.68388291954585, 44.870616347770834, 99.76423578482512, 98.46366649497817, 99.70642701195975, 99.91526916401052, 100.32563437070162, 96.46924237660863, 100.29723654063368, 95.462414334551, 95.62085024131304, 109.95657011209433, 63.186152143977004, 100.50501152610524, 105.88405695866143, 99.54772865880224, 115.53832836403033, 100.65996136875411], "kept": [91.69647282330588, 97.78449861495126, 101.39444502405327, 97.99948259929353, 111.88700857714973, 108.59639378090628, 100.12888514566939, 102.9704672579127, 97.68388291954585, 99.76423578482512, 98.46366649497817, 99.70642701195975, 99.91526916401052, 100.32563437070162, 96.46924237660863, 100.29723654063368, 95.462414334551, 95.62085024131304, 109.95657011209433, 100.50501152610524, 105.88405695866143, 99.54772865880224, 115.53832836403033, 100.65996136875411], "mean": 101.17742375211738, "ok": true}, {"conv": 0.35, "data": [99.45061021160458, 99.91779228410822, 113.02327137355168, 153.34502699524623, 103.11831631314118, 115.79234417587722, 100.58384147827677, 140.03135872763795, 100.68508528744944, 106.64738845290654, 99.90232824525863, 100.00860283599206, 97.83081090333826, 124.26802240290347, 100.83604024789769, 100.46314465952523, 184.28957269007634, 100.77199431755407, 100.34541162845883, 99.59018225432813, 96.46730504208412, 108.05089676299345, 100.44067988191131, 93.53772722745828, 98.15013238678704, 100.31352582181114, 99.74783088428636, 96.56371340939259, 100.22587647834922, 99.49391803979857, 106.43415728615207, 95.28884972623567], "kept": [99.45061021160458, 99.91779228410822, 113.02327137355168, 103.11831631314118, 115.79234417587722, 100.58384147827677, 100.68508528744944, 106.64738845290654, 99.90232824525863, 100.00860283599206, 97.83081090333826, 124.26802240290347, 100.83604024789769, 100.46314465952523, 100.77199431755407, 100.34541162845883, 99.59018225432813, 96.46730504208412, 108.05089676299345, 100.44067988191131, 93.53772722745828, 98.15013238678704, 100.31352582181114, 99.74783088428636, 96.56371340939259, 100.22587647834922, 99.49391803979857, 106.43415728615207, 95.28884972623567], "mean": 101.9982689661873, "ok": true}, {"conv": 0.3, "data": [97.07463698658623, 99.79720623666132, 99.97383636124647, 104.79624524416866, 106.92773483226324, 100.32261252232503, 85.01867892886932, 100.17257682899165, 100.23375269613318, 101.93548682096304, 100.09908950435585, 100.39029172647058, 93.47761466593124, 100.42701669672502, 99.58735444429574, 100.28691190466797, 100.02630239488441, 100.49568800117517, 99.87624945362998, 100.21545175054418, 145.83856278402175, 102.58306864296976, 103.11858667636295, 87.61681126612697, 99.88536205749861, 99.53673795825524, 126.17215055691209, 99.9802513486671, 88.07268718916546, 105.12652892105147, 100.59770399536836, 100.46235217922829, 99.42674460338716, 99.98907383906548], "kept": [97.07463698658623, 99.79720623666132, 99.97383636124647, 104.79624524416866, 106.92773483226324, 100.32261252232503, 85.01867892886932, 100.17257682899165, 100.23375269613318, 101.93548682096304, 100.09908950435585, 100.39029172647058, 93.47761466593124, 100.42701669672502, 99.58735444429574, 100.28691190466797, 100.02630239488441, 100.49568800117517, 99.87624945362998, 100.21545175054418, 102.58306864296976, 103.11858667636295, 87.61681126612697, 99.88536205749861, 99.53673795825524, 99.9802513486671, 88.07268718916546, 105.12652892105147, 100.59770399536836, 100.46235217922829, 99.42674460338716, 99.98907383906548], "mean": 99.2978327086886, "ok": true}, {"conv": 0.35, "data": [96.94276403550293, 104.81856363500704, 124.98869239176193, 105.45584132499845, 112.14102848136851, 99.29352710414125, 100.14493417404289, 98.00266254279072, 77.145798677384, 106.5169349532103, 100.52216321395474, 91.4750254520078, 87.87860916102638], "kept": [96.94276403550293, 104.81856363500704, 105.45584132499845, 112.14102848136851, 99.29352710414125, 100.14493417404289, 98.00266254279072, 106.5169349532103, 100.52216321395474, 91.4750254520078, 87.87860916102638], "mean": 100.29018673436826, "ok": true}, {"conv": 0.3, "data": [102.46603557202228, 76.4034007513259, 100.04813922324689, 92.48964437543802, 59.766014627227946, 73.73767248689191, 100.37717992656265, 99.97366054695668, 98.95516397801025, 100.03991605427045, 99.24902010983479, 100.77560754162204, 157.60716398423688, 100.7329888553028, 92.98858976301437], "kept": [102.46603557202228, 76.4034007513259, 100.04813922324689, 92.48964437543802, 100.37717992656265, 99.97366054695668, 98.95516397801025, 100.03991605427045, 99.24902010983479, 100.77560754162204, 100.7329888553028, 92.98858976301437], "mean": 97.04161222480059, "ok": true}, {"conv": 0.3, "data": [100.45397150475779, 100.22083293182376, 97.80740050848485, 99.89867828634064, 111.27886422412097, 100.73983046491196, 154.24673610012366, 101.13716272723444, 99.92011875212297, 119.96261541378583, 54.23289404720033, 125.30258343631905, 101.48801990026473, 99.39920600984678, 100.89190692784464, 100.18237921845122, 177.27116816725146, 100.19564386548906, 104.80138611046992, 100.28710725172881, 67.82914007423693, 71.48582833166776, 76.85408852047101, 105.59668669887786], "kept": [100.45397150475779, 100.22083293182376, 97.80740050848485, 99.89867828634064, 111.27886422412097, 100.73983046491196, 101.13716272723444, 99.92011875212297, 119.96261541378583, 101.48801990026473, 99.39920600984678, 100.89190692784464, 100.18237921845122, 100.19564386548906, 104.80138611046992, 100.28710725172881, 105.59668669887786], "mean": 102.60363592920919, "ok": false}, {"conv": 0.25, "data": [101.34482728340933, 81.28976774572948, 99.21351413572638, 100.18009056457554, 96.73018922307793, 100.47374297930072, 88.87440337571203, 73.68160564827406, 99.72687255609347, 97.85741027097899, 99.72919852189226, 100.45656798974461, 100.60232748658485, 100.29445425738058, 111.95292187189398, 160.06065315337554, 53.947236983933045, 101.78855994936775, 110.23245793207676, 96.53640023372905, 111.21203660840523, 91.15665734953114, 121.87221801457935, 99.8005024930325, 100.09341929723048, 99.92508876375602, 98.22096835643885, 99.96062656708797, 100.11583152256802, 103.20565079036824, 105.4627579393984, 100.13160237896763, 103.32845950071844, 97.27867027042674, 104.54495086835391, 99.70539828249437, 99.09167168337174, 100.72584648832242, 110.13576741883118], "kept": [101.34482728340933, 99.21351413572638, 100.18009056457554, 96.73018922307793, 100.47374297930072, 88.87440337571203, 99.72687255609347, 97.85741027097899, 99.72919852189226, 100.45656798974461, 100.60232748658485, 100.29445425738058, 111.95292187189398, 101.78855994936775, 110.23245793207676, 96.53640023372905, 111.21203660840523, 91.15665734953114, 99.8005024930325, 100.09341929723048, 99.92508876375602, 98.22096835643885, 99.96062656708797, 100.11583152256802, 103.20565079036824, 105.4627579393984, 100.13160237896763, 103.32845950071844, 97.27867027042674, 104.54495086835391, 99.70539828249437, 99.09167168337174, 100.72584648832242, 110.13576741883118], "mean": 100.88499544737788, "ok": true}, {"conv": 0.35, "data": [98.69695732812757, 82.13551252630191, 100.29329150201346, 103.97169505837756, 99.88874365402673, 96.69566822212455, 103.36764489175053, 102.52677369977069, 100.9054862216794, 100.41692368250807, 127.13997647353386, 100.08110356055867, 100.13858428046203, 92.04998559961018, 110.26311992408054, 118.72589740758632, 100.07001685096377, 95.86057674664457, 100.18734943438992, 87.23631588296715, 99.36721875984253, 100.15648240376927, 108.9990004186285, 99.41481899306767, 101.4969131422779, 99.47809836939096, 67.69278723752507, 100.79007944802125], "kept": [98.69695732812757, 100.29329150201346, 103.97169505837756, 99.88874365402673, 96.69566822212455, 103.36764489175053, 102.52677369977069, 100.9054862216794, 100.41692368250807, 100.08110356055867, 100.13858428046203, 92.04998559961018, 110.26311992408054, 100.07001685096377, 95.86057674664457, 100.18734943438992, 87.23631588296715, 99.36721875984253, 100.15648240376927, 108.9990004186285, 99.41481899306767, 101.4969131422779, 99.47809836939096, 100.79007944802125], "mean": 100.09803533646057, "ok": true}, {"conv": 0.3, "data": [97.62520357171708, 103.66499094865704, 100.06817496150153, 99.82416663095616, 100.1570642123281, 91.692036593377, 93.34094051588728, 68.85131476695871, 100.3095469743442, 103.10274650018468, 141.54328407247846, 99.60974887836966, 102.54086934004395, 101.79229653318666, 68.87579479612505, 99.75741059534027, 99.87209773915991, 96.39533763535798, 100.32767474733056, 94.31193705503145, 95.14418499390034, 66.98915895692515, 98.22197881368363, 100.55791022893581, 96.05466331415712, 106.97480176038366, 100.60013926710657, 75.4655343180914, 101.39012891618907, 99.32333069726457, 90.1933670886357, 103.30663956269241, 100.10583171841596], "kept": [97.62520357171708, 103.66499094865704, 100.06817496150153, 99.82416663095616, 100.1570642123281, 91.692036593377, 93.34094051588728, 100.3095469743442, 103.10274650018468, 99.60974887836966, 102.54086934004395, 101.79229653318666, 99.75741059534027, 99.87209773915991, 96.39533763535798, 100.32767474733056, 94.31193705503145, 95.14418499390034, 98.22197881368363, 100.55791022893581, 96.05466331415712, 106.97480176038366, 100.60013926710657, 101.39012891618907, 99.32333069726457, 90.1933670886357, 103.30663956269241, 100.10583171841596], "mean": 99.15232927836209, "ok": true}, {"conv": 0.35, "data": [98.73470318650338, 99.54287286552713, 90.83411754736707, 105.54988633906693, 100.78777989664259, 86.84186809652245, 131.80807200307368, 100.46816947193415, 132.68928568510353, 91.24906192495452, 121.46325930536634, 101.66630064903772, 99.29610426388265, 100.62451265253488, 100.11086609087762, 101.25204548757291, 100.25939864545614, 98.24882733942776, 96.85860491833775, 100.39255476726183, 100.29763775137823, 106.35587613112814, 99.84259809725124, 99.7871823305032, 99.71612982674543, 99.95678912755334, 100.95837696941061, 99.47582606760828, 99.94903046975672, 100.26036226335343, 103.2561383257113, 120.010791689676, 100.05595306204056, 99.75598624654934, 100.37270945049981, 99.52734177928284, 132.9288345408088, 89.49204364418569, 91.91976071775017, 108.39235331716272], "kept": [98.73470318650338, 99.54287286552713, 90.83411754736707, 105.54988633906693, 100.78777989664259, 86.84186809652245, 100.46816947193415, 91.24906192495452, 121.46325930536634, 101.66630064903772, 99.29610426388265, 100.62451265253488, 100.11086609087762, 101.25204548757291, 100.25939864545614, 98.24882733942776, 96.85860491833775, 100.39255476726183, 100.29763775137823, 106.35587613112814, 99.84259809725124, 99.7871823305032, 99.71612982674543, 99.95678912755334, 100.95837696941061, 99.47582606760828, 99.94903046975672, 100.26036226335343, 103.2561383257113, 120.010791689676, 100.05595306204056, 99.75598624654934, 100.37270945049981, 99.52734177928284, 89.49204364418569, 91.91976071775017, 108.39235331716272], "mean": 100.36658974907625, "ok": true}, {"conv": 0.3, "data": [93.94291486720124, 101.39120340514884, 99.0761119626342, 99.79692189317616, 85.8966621659196, 147.89380963213026, 99.68994715164084, 100.93944825974188, 99.66483857488033, 100.33455061469164, 130.4989888393071, 99.93049533212819, 99.73743706688596, 99.86952403268967, 107.59418437744587, 97.58148412700922, 101.32982167005818, 86.84706568379403, 84.26313897150511, 106.09484136419582, 99.73638931874757, 105.32458431021756, 88.26678112541613, 125.71508705581888, 154.98499112070178, 96.11276064559964, 104.15542663578319, 99.93717134456156, 99.71661900797116, 97.88427633580797, 85.05444066898113, 96.77712793603065, 103.09166531629498, 100.32869835065743, 68.13375158473538, 94.23616227350094, 100.47732284941986], "kept": [93.94291486720124, 101.39120340514884, 99.0761119626342, 99.79692189317616, 85.8966621659196, 99.68994715164084, 100.93944825974188, 99.66483857488033, 100.33455061469164, 99.93049533212819, 99.73743706688596, 99.86952403268967, 107.59418437744587, 97.58148412700922, 101.32982167005818, 86.84706568379403, 84.26313897150511, 106.09484136419582, 99.73638931874757, 105.32458431021756, 88.26678112541613, 96.11276064559964, 104.15542663578319, 99.93717134456156, 99.71661900797116, 97.88427633580797, 85.05444066898113, 96.77712793603065, 103.09166531629498, 100.32869835065743, 94.23616227350094, 100.47732284941986], "mean": 97.97125055124175, "ok": true}, {"conv": 0.35, "data": [100.2219744396182, 89.47872359112755, 109.39098016638641, 108.33646106137998], "kept": [100.2219744396182, 89.47872359112755, 109.39098016638641, 108.33646106137998], "mean": 101.85703481462804, "ok": true}, {"conv": 0.35, "data": [136.91399406173076, 83.64347025657112, 119.39158618624468, 96.11221723478612, 117.16996115919835, 128.13434202677266, 99.53185214441228, 100.90465938943443, 128.3696250618448, 100.1319408264335, 101.58509593570659, 99.7483022161257, 107.18335952805619, 132.65061050642873, 82.40003428409828, 104.50985994304405, 99.15990692582537, 96.47783903514929, 133.66091015994772, 100.43022241684145, 102.70058119744996, 97.63779970859387, 99.91874455299879, 123.56034658293098, 96.42903415909248], "kept": [119.39158618624468, 96.11221723478612, 117.16996115919835, 128.13434202677266, 99.53185214441228, 100.90465938943443, 128.3696250618448, 100.1319408264335, 101.58509593570659, 99.7483022161257, 107.18335952805619, 104.50985994304405, 99.15990692582537, 96.47783903514929, 100.43022241684145, 102.70058119744996, 97.63779970859387, 99.91874455299879, 123.56034658293098, 96.42903415909248], "mean": 105.9543638115471, "ok": true}, {"conv": 0.35, "data": [99.24938746387713, 129.42511705742834, 61.53043535740472, 117.41368443906924, 97.91989634942512, 105.28862693907834, 107.86879414801372, 92.3943917103019, 100.63201928643323, 100.27826103616924, 98.49158943362785, 90.19574243340091], "kept": [99.24938746387713, 117.41368443906924, 97.91989634942512, 105.28862693907834, 107.86879414801372, 92.3943917103019, 100.63201928643323, 100.27826103616924, 98.49158943362785, 90.19574243340091], "mean": 100.97323932393968, "ok": true}, {"conv": 0.3, "data": [100.25074109856095, 97.76592274584463, 100.57227525624226, 111.6099523464902, 103.74711765494692, 100.93766810054024, 100.40156813793422, 49.50483565196526, 96.9398209239091, 183.07640516116248, 105.7368327502288, 106.45316573720126, 124.79806854876519, 127.3891222748603, 68.57208032755749, 140.59065405969483, 98.4748218134565, 99.66359500102084, 76.32758663426318, 100.17716295958918, 102.41015414615407, 99.74775033424449, 108.07855820125444, 107.56057151247647, 99.665081294177, 107.68514605014884, 100.20075561175679, 161.77410095715697, 128.46047481416662, 101.77512222984662, 100.16684188354381, 103.4128459043174, 99.84318677137863, 99.5718361611737, 100.09984288247587, 131.8558371287755, 100.02196459031168, 100.77515891319851], "kept": [100.25074109856095, 97.76592274584463, 100.57227525624226, 111.6099523464902, 103.74711765494692, 100.93766810054024, 100.40156813793422, 96.9398209239091, 105.7368327502288, 106.45316573720126, 98.4748218134565, 99.66359500102084, 100.17716295958918, 102.41015414615407, 99.74775033424449, 108.07855820125444, 107.56057151247647, 99.665081294177, 107.68514605014884, 100.20075561175679, 101.77512222984662, 100.16684188354381, 103.4128459043174, 99.84318677137863, 99.5718361611737, 100.09984288247587, 100.02196459031168, 100.77515891319851], "mean": 101.9194807504437, "ok": false}, {"conv": 0.25, "data": [100.37499319092113, 107.44742921259582, 60.75426630584158, 90.0455150287746, 98.41292411432586, 103.60913746890397, 93.43568249544802, 100.40620765989657, 136.69995431518305, 99.54776668742053, 106.01488383321941, 86.6700375435563, 105.74212055395827, 99.9838587352288, 99.90602424190594, 73.29679781352743, 99.79341581916081, 92.83201471034663, 100.3374340275973, 72.43986412525413, 100.35492693923732, 95.87795048410578, 99.19151993352001, 99.53676199177113, 142.24919978505582, 128.15636989817776, 79.39810298987197, 109.97810672912347, 86.27497183906601, 127.6015850990812, 98.86501924691133, 104.27712469176498, 97.39661933853273, 95.37374839615221, 96.54150983189523, 90.68201406233256, 99.54411996166496, 99.81113637999937, 95.86115739411161], "kept": [100.37499319092113, 107.44742921259582, 90.0455150287746, 98.41292411432586, 103.60913746890397, 93.43568249544802, 100.40620765989657, 99.54776668742053, 106.01488383321941, 86.6700375435563, 105.74212055395827, 99.9838587352288, 99.90602424190594, 99.79341581916081, 92.83201471034663, 100.3374340275973, 100.35492693923732, 95.87795048410578, 99.19151993352001, 99.53676199177113, 109.97810672912347, 86.27497183906601, 98.86501924691133, 104.27712469176498, 97.39661933853273, 95.37374839615221, 96.54150983189523, 90.68201406233256, 99.54411996166496, 99.81113637999937, 95.86115739411161], "mean": 98.52019782398222, "ok": true}, {"conv": 0.25, "data": [98.54078062084199, 101.69816301173854, 128.99420860779117, 101.31403073997188, 101.04469839367543, 110.66662290793465, 100.56576697603701, 100.5005355318897, 103.67471702242867, 69.95359211166851, 99.95099233901938, 99.28406243821684, 104.28358708754392, 100.05747902211421, 102.34533236727754, 102.88325690535068, 123.0316793553594, 99.91976316237925, 100.86669204283803, 114.75179256514848, 114.3305973911429, 92.11167977717818, 111.89293617349679, 100.00116276655196, 96.42672077348578, 104.39050475992903, 99.9288133140093, 100.56026842345591, 109.22527844454405, 99.29724681101955, 143.5774056535036, 92.37923081720406, 99.80117211358849, 99.70637332478745, 137.56269481119386], "kept": [98.54078062084199, 101.69816301173854, 101.31403073997188, 101.04469839367543, 110.66662290793465, 100.56576697603701, 100.5005355318897, 103.67471702242867, 99.95099233901938, 99.28406243821684, 104.28358708754392, 100.05747902211421, 102.34533236727754, 102.88325690535068, 99.91976316237925, 100.86669204283803, 114.75179256514848, 114.3305973911429, 92.11167977717818, 111.89293617349679, 100.00116276655196, 96.42672077348578, 104.39050475992903, 99.9288133140093, 100.56026842345591, 109.22527844454405, 99.29724681101955, 92.37923081720406, 99.80117211358849, 99.70637332478745], "mean": 102.08000860082667, "ok": true}, {"conv": 0.3, "data": [100.34470547810241, 100.626623706581, 98.76356656767976], "kept": [100.34470547810241, 100.626623706581, 98.76356656767976], "mean": 99.91163191745439, "ok": true}, {"conv": 0.25, "data": [99.96190701154148, 53.468033109395854, 97.11707144059561, 100.25825700992314, 114.18609217564186, 99.18490884480889, 100.07907657360313, 99.28512916909496, 87.81718843166595, 108.61816537111103, 113.80195652503163, 100.203752365994, 99.8188853886501, 145.65451446725845, 104.35973699177477, 7.680618095631118, 126.33024527686833], "kept": [99.96190701154148, 97.11707144059561, 100.25825700992314, 114.18609217564186, 99.18490884480889, 100.07907657360313, 99.28512916909496, 108.61816537111103, 113.80195652503163, 100.203752365994, 99.8188853886501, 104.35973699177477], "mean": 103.07291157231423, "ok": false}, {"conv": 0.3, "data": [99.84757020382439, 501.9473814289541], "kept": [], "mean": 300.89747581638926, "ok": false}, {"conv": 0.35, "data": [100.75925894270557, 100.15967106042176, 71.83143816500301, 107.34613198454961, 81.10875953674685, 99.6574652711252, 100.13287877820797, 100.64120551285681, 102.85844363391827, 98.88386821072804, 100.86060508827198, 88.76197283278535, 99.67654987491522, 99.44645228223061, 100.3707826499355, 99.42694220467095, 110.1954538416224, 52.90668346389123, 100.72509779229166, 63.41569507392543, 99.63306450449423, 100.16223773540354, 99.43399999052997, 105.91461585590368], "kept": [100.75925894270557, 100.15967106042176, 107.34613198454961, 81.10875953674685, 99.6574652711252, 100.13287877820797, 100.64120551285681, 102.85844363391827, 98.88386821072804, 100.86060508827198, 88.76197283278535, 99.67654987491522, 99.44645228223061, 100.3707826499355, 99.42694220467095, 110.1954538416224, 100.72509779229166, 99.63306450449423, 100.16223773540354, 99.43399999052997, 105.91461585590368], "mean": 99.81692655163408, "ok": true}, {"conv": 0.35, "data": [99.70620933942223, 103.03424983407385, 99.9910829845378, 115.31022845629046, 99.98933894978238, 99.62588991292185, 100.48078234792459, 100.5648912104634, 100.04120180362507, 99.74006880928223, 99.02590933027321, 99.76559845865883, 103.4754353146372, 98.67058530702336, 100.40528661220192, 98.48432647813452, 90.82248301590772, 100.57103576115401, 100.4950371403414, 100.27089776906533, 125.09832633921074, 57.724337026882786, 99.9625221886991, 81.47216046903023, 155.9032453429439, 99.52587705909282, 100.12215706851607, 99.30564502404886, 122.32349651528156, 95.80328238945499, 100.18491689395904, 97.19775850280905, 107.68960925794534, 99.95238696558991, 746.218699867535, 874.0949724053083], "kept": [99.70620933942223, 103.03424983407385, 99.9910829845378, 115.31022845629046, 99.98933894978238, 99.62588991292185, 100.48078234792459, 100.5648912104634, 100.04120180362507, 99.74006880928223, 99.02590933027321, 99.76559845865883, 103.4754353146372, 98.67058530702336, 100.40528661220192, 98.48432647813452, 90.82248301590772, 100.57103576115401, 100.4950371403414, 100.27089776906533, 99.9625221886991, 99.52587705909282, 100.12215706851607, 99.30564502404886, 95.80328238945499, 100.18491689395904, 97.19775850280905, 107.68960925794534, 99.95238696558991], "mean": 100.35223083399435, "ok": true}, {"conv": 0.35, "data": [79.64862530553582, 94.03152005547487, 73.98330150313423, 99.7152060728265, 99.7610765566978, 102.56012384202852, 110.87571843315912, 99.66275997280088, 162.19972068095663, 82.89890359952521, 100.4480721670894, 99.10515659593125, 91.70952274880293], "kept": [79.64862530553582, 94.03152005547487, 99.7152060728265, 99.7610765566978, 102.56012384202852, 110.87571843315912, 99.66275997280088, 82.89890359952521, 100.4480721670894, 99.10515659593125, 91.70952274880293], "mean": 96.4015168499884, "ok": true}, {"conv": 0.35, "data": [104.1130912758823, 100.35332479746071, 130.3959489087699, 100.09988707557387, 103.49144666961512, 94.32620366097655, 68.05958938184175, 99.98971266086436, 94.30529606584773, 126.49753637438509, 100.28298315809583, 89.96104257657605, 145.22353794971394, 105.28935177591168, 112.34892006704214, 90.95709034541997, 100.39351362002091, 99.8639027588325], "kept": [104.1130912758823, 100.35332479746071, 100.09988707557387, 103.49144666961512, 94.32620366097655, 99.98971266086436, 94.30529606584773, 100.28298315809583, 89.96104257657605, 105.28935177591168, 112.34892006704214, 90.95709034541997, 100.39351362002091, 99.8639027588325], "mean": 99.69826903629426, "ok": true}, {"conv": 0.3, "data": [100.20211461604475, 109.19033825965339, 97.83107440316738, 100.49545196888342, 93.64262853964004, 97.93975144032281, 96.71434904420197, 99.88777115557939, 101.07686736724398, 103.22850829012033, 823.2007649734272], "kept": [100.20211461604475, 109.19033825965339, 97.83107440316738, 100.49545196888342, 93.64262853964004, 97.93975144032281, 96.71434904420197, 99.88777115557939, 101.07686736724398, 103.22850829012033], "mean": 100.02088550848575, "ok": true}, {"conv": 0.25, "data": [121.95911174365745, 97.3804276023625, 100.16997582093386, 82.26870612765036, 107.19047594216886, 100.00751037276203, 100.01788629937826, 99.07455374547632, 97.69412576126471, 103.44376796518945, 100.91742365185831, 62.72440134177134, 99.63537944691937, 106.46558906389157, 99.59899101276191], "kept": [97.3804276023625, 100.16997582093386, 107.19047594216886, 100.00751037276203, 100.01788629937826, 99.07455374547632, 97.69412576126471, 103.44376796518945, 100.91742365185831, 99.63537944691937, 106.46558906389157, 99.59899101276191], "mean": 100.96634222374728, "ok": true}, {"conv": 0.3, "data": [100.4102806371431, 98.74075635003788, 101.74808796916737, 98.08372441412324, 47.84677722584257, 99.99842134829848, 115.44867211156429, 101.00064997299775, 101.56376870165867, 112.94401481398891, 100.390033322085, 98.53362437930727, 98.82679431092616, 91.219623767744, 133.5056743138167, 103.03631665863685, 99.9966565667526, 100.09830731211446, 95.29997108489485, 95.54873397486169, 104.0538191715733, 92.38265235140028, 107.77122817507352, 100.40945345972877, 89.17728886433683, 99.29797100648736, 99.98410310120352, 92.5956052322668, 120.5981233973603, 405.0344097773652], "kept": [100.4102806371431, 98.74075635003788, 101.74808796916737, 98.08372441412324, 99.99842134829848, 115.44867211156429, 101.00064997299775, 101.56376870165867, 112.94401481398891, 100.390033322085, 98.53362437930727, 98.82679431092616, 91.219623767744, 103.03631665863685, 99.9966565667526, 100.09830731211446, 95.29997108489485, 95.54873397486169, 104.0538191715733, 92.38265235140028, 107.77122817507352, 100.40945345972877, 89.17728886433683, 99.29797100648736, 99.98410310120352, 92.5956052322668], "mean": 99.9446368868605, "ok": true}, {"conv": 0.25, "data": [99.96938301806661, 100.03575234838229, 109.99304350582429, 99.02524159574713, 103.6394568292381, 136.96101949569652, 96.65922531436, 100.46896682922389, 95.47505579554092, 45.14661172524715, 155.23014133390626, 100.51118222099683, 148.49826798723353, 104.83306360362957, 99.93697920176741, 99.89730284905231, 99.97035905421345, 91.88045556962652, 110.41867153784001, 145.68944324191847, 91.24313455003875], "kept": [99.96938301806661, 100.03575234838229, 109.99304350582429, 99.02524159574713, 103.6394568292381, 96.65922531436, 100.46896682922389, 95.47505579554092, 100.51118222099683, 104.83306360362957, 99.93697920176741, 99.89730284905231, 99.97035905421345, 91.88045556962652, 110.41867153784001, 91.24313455003875], "mean": 100.24732961397176, "ok": true}, {"conv": 0.5, "data": [124.93977873695822, 100.13703101601095, 100.65054120961241, 118.61138864579769, 73.28109854164018, 98.68505633103618, 85.7880976459725, 102.58259864470867, 99.6860819067455, 99.56714958287384, 98.74813207890988, 99.23209620340873, 99.00731576974066, 95.60055553057218, 100.73015725322747, 97.77569085135801, 102.28745068688394, 89.13756575810777, 131.24783564266193, 104.8572207271185, 38.928646700697335, 108.13019986191773, 100.38685795673138, 99.67411199648835, 73.15280001639505, 99.29957280725702, 162.94579228470312, 98.17583841991552, 48.05459333136487, 101.03477536899113, 98.5251253101659, 131.00801533054556, 102.54373820900872, 99.19571219258638, 96.73489649113013], "kept": [100.13703101601095, 100.65054120961241, 118.61138864579769, 98.68505633103618, 85.7880976459725, 102.58259864470867, 99.6860819067455, 99.56714958287384, 98.74813207890988, 99.23209620340873, 99.00731576974066, 95.60055553057218, 100.73015725322747, 97.77569085135801, 102.28745068688394, 89.13756575810777, 104.8572207271185, 108.13019986191773, 100.38685795673138, 99.67411199648835, 99.29957280725702, 98.17583841991552, 101.03477536899113, 98.5251253101659, 102.54373820900872, 99.19571219258638, 96.73489649113013], "mean": 99.88092438726953, "ok": true}]}
\ No newline at end of file
diff --git a/tests/golden/nemotron35_super_eagle4_draft_config.json b/tests/golden/nemotron35_super_eagle4_draft_config.json
new file mode 100644
index 0000000..a2004fd
--- /dev/null
+++ b/tests/golden/nemotron35_super_eagle4_draft_config.json
@@ -0,0 +1,76 @@
+{
+ "_torchspec_version": "0.1.0",
+ "architectures": [
+ "LlamaForCausalLMEagle4"
+ ],
+ "attention_bias": false,
+ "attention_dropout": 0.0,
+ "attn_norm": true,
+ "bos_token_id": 1,
+ "draft_vocab_size": 131072,
+ "dtype": "bfloat16",
+ "eagle_config": {
+ "eagle_aux_hidden_state_layer_ids": [
+ 7,
+ 47,
+ 78
+ ]
+ },
+ "efficient_lm_head_config": {
+ "num_candidates": 128,
+ "rank": 128,
+ "type": "low_rank"
+ },
+ "enable_moe": true,
+ "eos_token_id": 11,
+ "expert_bias_update_rate": 0.0001,
+ "expert_parallel_size": 1,
+ "fc_norm": true,
+ "head_dim": 128,
+ "hidden_act": "relu2",
+ "hidden_size": 4096,
+ "initializer_range": 0.02,
+ "intermediate_size": 11008,
+ "layer_types": [
+ "sliding_attention"
+ ],
+ "load_balance_loss_alpha": 0.0,
+ "max_position_embeddings": 1048576,
+ "mlp_bias": false,
+ "model_type": "llama",
+ "moe_architecture": "nemotron_latent_relu2",
+ "moe_expert_parallel_size": 1,
+ "moe_intermediate_size": 2688,
+ "moe_latent_size": 1024,
+ "moe_router_dtype": "float32",
+ "moe_shared_expert_intermediate_size": 5376,
+ "n_group": 1,
+ "n_routed_experts": 512,
+ "n_shared_experts": 1,
+ "norm_output": true,
+ "norm_topk_prob": true,
+ "num_attention_heads": 32,
+ "num_experts_per_tok": 22,
+ "num_hidden_layers": 1,
+ "num_key_value_heads": 32,
+ "pad_token_id": 0,
+ "pretraining_tp": 1,
+ "rms_norm_eps": 1e-05,
+ "rope_parameters": {
+ "rope_theta": 10000.0,
+ "rope_type": "default"
+ },
+ "routed_scaling_factor": 5.0,
+ "scoring_func": "sigmoid",
+ "seq_aux_loss_alpha": 0.0,
+ "sliding_window": 4096,
+ "target_hidden_size": 4096,
+ "tie_word_embeddings": false,
+ "topk_group": 1,
+ "topk_method": "noaux_tc",
+ "torch_dtype": "bfloat16",
+ "transformers_version": "5.8.1",
+ "use_cache": true,
+ "use_rope": false,
+ "vocab_size": 131072
+}
diff --git a/tests/synthetic.py b/tests/synthetic.py
new file mode 100644
index 0000000..d302970
--- /dev/null
+++ b/tests/synthetic.py
@@ -0,0 +1,100 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Deterministic synthetic calibration data shared by the golden generator and the tests.
+
+Timings follow a simple model (fixed cost + per-token cost + attention that grows
+with batch and context) with seeded +-1.5% noise, so the fits are stable and the
+fitted tables pass the cost model's sanity checks.
+"""
+
+from __future__ import annotations
+
+import os
+import random
+from typing import Dict, List
+
+from eagle_harness.core.calibration import CacheSweepPlan, CalibrationPaths, MeasureParams, MeasureRecord, save_jsonl
+from eagle_harness.core.limits import ComputeIntensity, draft_query_lens, verify_buckets
+
+CONTEXT_STEP = 128
+CONTEXT_STOP = 2048
+TARGET_LAYERS = 16
+DRAFT_TREE_DEPTH = 9
+
+
+def measure_params(batch_size: int, intensity: ComputeIntensity) -> MeasureParams:
+ chain = intensity is ComputeIntensity.CHAIN
+ verify_num = 16 if chain else (64 if batch_size <= 8 else 32)
+ return MeasureParams(
+ context_step=CONTEXT_STEP,
+ context_stop=CONTEXT_STOP,
+ batch_size=batch_size,
+ verify_num=verify_num,
+ node_top_k=1 if chain else 8,
+ loop_top_m=verify_num,
+ repeat_cnt=16,
+ cache_len=CONTEXT_STEP,
+ )
+
+
+def _attention_us(q: int, kv: int, bs: int, scale: float) -> float:
+ return scale * (2.0 + 0.0009 * kv * bs * (1.0 + 0.04 * q))
+
+
+def _noise(rng: random.Random) -> float:
+ return 1.0 + rng.uniform(-0.015, 0.015)
+
+
+def write_raw_measurements(data_path: str, batch_size: int, intensity: ComputeIntensity, seed: int) -> MeasureParams:
+ """Write raw cache and model timings for one batch size; return its params."""
+ rng = random.Random(seed * 1000 + batch_size)
+ params = measure_params(batch_size, intensity)
+ paths = CalibrationPaths(data_path)
+ plan = CacheSweepPlan.from_params(params)
+ sweeps: Dict[str, List[int]] = {
+ "slm": draft_query_lens(batch_size, intensity),
+ "llm": sorted(verify_buckets(batch_size, intensity)),
+ }
+ for model, lens in sweeps.items():
+ scale = 0.6 if model == "slm" else 1.0
+ for q in lens:
+ records = [
+ MeasureRecord(
+ time_us=int(_attention_us(q, kv, batch_size, scale) * plan.num_layers * _noise(rng)),
+ measure_count=plan.num_layers,
+ query_length=q,
+ cache_length=kv,
+ task_category=f"cache_{model}",
+ batch_size=batch_size,
+ )
+ for kv in plan.cache_lengths()
+ if kv >= plan.kv_step
+ ]
+ save_jsonl(os.path.join(paths.raw(batch_size, "cache", model), f"cache_qo_len_{q}.jsonl"), records)
+ contexts = list(range(CONTEXT_STEP + 7, CONTEXT_STOP, 61))
+ for model, lens in sweeps.items():
+ for q in lens:
+ records = []
+ for _ in range(2):
+ for kv in contexts:
+ if model == "slm":
+ count = DRAFT_TREE_DEPTH - 1
+ step = 95.0 + 4.0 * q * batch_size + _attention_us(q, kv, batch_size, 0.6)
+ else:
+ count = 1
+ step = 1400.0 * (1.0 + 0.012 * q * batch_size) + TARGET_LAYERS * _attention_us(
+ q, kv, batch_size, 1.0
+ )
+ records.append(
+ MeasureRecord(
+ time_us=int(step * count * _noise(rng)),
+ measure_count=count,
+ query_length=q,
+ cache_length=kv,
+ task_category=f"model_{model}",
+ batch_size=batch_size,
+ )
+ )
+ save_jsonl(os.path.join(paths.raw(batch_size, "model", model), f"model_qo_len_{q}.jsonl"), records)
+ return params
diff --git a/tests/test_accept_tail_gpu.py b/tests/test_accept_tail_gpu.py
new file mode 100644
index 0000000..ac654ff
--- /dev/null
+++ b/tests/test_accept_tail_gpu.py
@@ -0,0 +1,139 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The fused greedy accept tail against sglang's own kernels on random trees (GPU)."""
+
+import random
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+if not torch.cuda.is_available():
+ pytest.skip("needs a CUDA device", allow_module_level=True)
+
+from sglang.kernels.ops.speculative.eagle import fill_accept_out_cache_loc_func, fill_bonus_tokens_func # noqa: E402
+from sglang.srt.speculative.eagle_utils import verify_tree_greedy_func # noqa: E402
+from sglang.srt.speculative.eagle_worker_common import _compact_accept_to_front # noqa: E402
+from sglang.srt.speculative.spec_utils import assign_extend_cache_locs # noqa: E402
+
+from eagle_harness.kernels.accept_tail import accept_tail, compact_rows # noqa: E402
+
+
+def _tree(width, rng):
+ """Random tree tables (first child / next sibling), draft tokens and a target that often agrees."""
+ parent = [-1] + [rng.randrange(0, i) if rng.random() < 0.5 else i - 1 for i in range(1, width)]
+ children = [[j for j in range(width) if parent[j] == i] for i in range(width)]
+ next_token = [c[0] if c else -1 for c in children]
+ next_sibling = [-1] * width
+ for c in children:
+ for a, b in zip(c, c[1:]):
+ next_sibling[a] = b
+ candidates = [rng.randrange(0, 6) for _ in range(width)]
+ target = [
+ candidates[rng.choice(children[i])] if children[i] and rng.random() < 0.8 else rng.randrange(0, 6)
+ for i in range(width)
+ ]
+ return candidates, next_token, next_sibling, target
+
+
+def _reference(target, candidates, index, next_token, next_sibling, seq_lens, out_cache_loc, req_to_token, req, depth):
+ width = target.numel()
+ predict = torch.zeros(width, dtype=torch.int32, device="cuda")
+ accept_index = torch.full((1, depth), -1, dtype=torch.int32, device="cuda")
+ correct = torch.empty(1, dtype=torch.int32, device="cuda")
+ predict, accept_index, correct = verify_tree_greedy_func(
+ predicts=predict,
+ accept_index=accept_index,
+ accept_token_num=correct,
+ candidates=candidates.reshape(1, width),
+ retrieve_index=index,
+ retrieve_next_token=next_token,
+ retrieve_next_sibling=next_sibling,
+ target_predict=target.reshape(1, width),
+ topk=4,
+ )
+ lens = correct + 1
+ bonus = torch.empty(1, dtype=torch.int32, device="cuda")
+ fill_bonus_tokens_func(predict[accept_index], lens, bonus, depth, 1)
+ committed = torch.zeros(depth, dtype=torch.int64, device="cuda")
+ assign_extend_cache_locs[(1,)](req, req_to_token, seq_lens, seq_lens + lens, committed, req_to_token.shape[1], 1)
+ accepted = torch.zeros(depth, dtype=torch.int64, device="cuda")
+ fill_accept_out_cache_loc_func(accept_index, out_cache_loc, accepted, depth)
+ compact = _compact_accept_to_front(predict, accept_index, 1, num_draft_tokens=width)
+ return compact, accept_index, lens, seq_lens + lens, bonus, committed, accepted
+
+
[email protected]("width,depth", [(16, 12), (9, 8), (4, 4), (31, 12)])
+def test_matches_sglang(width, depth):
+ rng = random.Random(width * 100 + depth)
+ deepest = 0
+ for _ in range(40):
+ candidates, next_token, next_sibling, target = _tree(width, rng)
+ seq_len = rng.randrange(1, 150)
+ long = dict(dtype=torch.int64, device="cuda")
+ tensors = dict(
+ target=torch.tensor(target, **long),
+ candidates=torch.tensor(candidates, **long),
+ index=torch.arange(width, **long).reshape(1, width),
+ next_token=torch.tensor(next_token, **long).reshape(1, width),
+ next_sibling=torch.tensor(next_sibling, **long).reshape(1, width),
+ seq_lens=torch.tensor([seq_len], **long),
+ out_cache_loc=torch.randint(1, 1 << 20, (width,), **long),
+ req_to_token=torch.randint(1, 1 << 20, (3, 200 + width), dtype=torch.int32, device="cuda"),
+ req=torch.tensor([1], **long),
+ )
+ expected = _reference(**tensors, depth=depth)
+ got = accept_tail(
+ tensors["target"],
+ tensors["candidates"],
+ tensors["index"],
+ tensors["next_token"],
+ tensors["next_sibling"],
+ tensors["seq_lens"],
+ tensors["out_cache_loc"],
+ tensors["req_to_token"],
+ tensors["req"],
+ depth,
+ )
+ names = (
+ "predict",
+ "accept_index",
+ "accept_lens",
+ "new_seq_lens",
+ "bonus_tokens",
+ "committed_slots",
+ "accepted_slots",
+ )
+ for name, want, have in zip(names, expected, got):
+ assert have.dtype == want.dtype, name
+ assert torch.equal(have, want), (name, have.tolist(), want.tolist(), target, candidates, next_token)
+ deepest = max(deepest, int(got.accept_lens))
+ assert deepest > 2 # the random trees do accept more than the root
+
+
[email protected]("cols", [7, 5000])
+def test_compact_rows_matches_sglang(cols):
+ rows = torch.randn(16, cols, device="cuda").to(torch.bfloat16)
+ accept_index = torch.tensor([[0, 3, 7, 8, -1, -1, -1, -1]], dtype=torch.int32, device="cuda")
+ expected = _compact_accept_to_front(rows, accept_index, 1, num_draft_tokens=16)
+ assert torch.equal(compact_rows(rows, accept_index), expected)
+
+
+def test_tail_graphs_run_a_non_idempotent_body_once_per_round():
+ """First round eager, second captured and replayed, later ones replayed: each round runs the body once."""
+ from eagle_harness.sglang.verify_step import AcceptTailGraphs
+
+ graphs = AcceptTailGraphs()
+ counter = torch.zeros(1, dtype=torch.int64, device="cuda")
+ source = torch.arange(4, device="cuda")
+
+ def body():
+ counter.add_(1)
+ return source * 2
+
+ for _ in range(4):
+ out = graphs.run(("key",), body)
+ assert out.tolist() == [0, 2, 4, 6]
+ torch.cuda.synchronize()
+ assert counter.item() == 4
diff --git a/tests/test_accept_tail_graphs.py b/tests/test_accept_tail_graphs.py
new file mode 100644
index 0000000..550101a
--- /dev/null
+++ b/tests/test_accept_tail_graphs.py
@@ -0,0 +1,27 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""AcceptTailGraphs on CPU: a key's first round and keys past the cap run eagerly."""
+
+from unittest import mock
+
+import pytest
+
+pytest.importorskip("sglang")
+from eagle_harness.sglang import verify_step # noqa: E402
+
+
+def test_a_new_key_runs_eagerly_once():
+ graphs = verify_step.AcceptTailGraphs()
+ body = mock.Mock(return_value="out")
+ assert graphs.run(("k",), body) == "out"
+ body.assert_called_once_with()
+
+
+def test_keys_past_the_cap_stay_eager():
+ graphs = verify_step.AcceptTailGraphs()
+ body = mock.Mock(return_value="out")
+ with mock.patch.object(verify_step, "MAX_TAIL_GRAPHS", 0):
+ for _ in range(3):
+ assert graphs.run(("k",), body) == "out"
+ assert body.call_count == 3
diff --git a/tests/test_attention_sweeps.py b/tests/test_attention_sweeps.py
new file mode 100644
index 0000000..527d1ba
--- /dev/null
+++ b/tests/test_attention_sweeps.py
@@ -0,0 +1,65 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The calibration sweep loop and head layout, with a fake timer (the real timers need a GPU)."""
+
+from __future__ import annotations
+
+import json
+import os
+
+import pytest
+
+from eagle_harness.core.attention_sweeps import HeadLayout, sweep
+from eagle_harness.core.calibration import CacheSweepPlan, MeasureParams, fit_cache_costs, load_jsonl
+from eagle_harness.core.limits import ComputeIntensity
+
+
+class LinearTimer:
+ def time_us(self, batch_size, qo_len, kv_len, num_layers):
+ return int((10 + 0.01 * kv_len * qo_len) * num_layers)
+
+
+def test_head_layout():
+ assert HeadLayout.for_rank(24, 4, 256, 4) == HeadLayout(6, 1, 256)
+ assert HeadLayout.for_rank(24, 2, 256, 4) == HeadLayout(6, 1, 256) # replicated KV heads
+ with pytest.raises(ValueError):
+ HeadLayout.for_rank(24, 2, 256, 4, replicate_kv=False)
+ with pytest.raises(ValueError):
+ HeadLayout.for_rank(30, 4, 128, 4)
+
+
+def test_sweep_writes_records_the_fit_reads(tmp_path):
+ params = MeasureParams(
+ context_step=64, context_stop=2048, batch_size=2, verify_num=64, node_top_k=8, loop_top_m=64, repeat_cnt=16
+ )
+ plan = CacheSweepPlan.from_params(params)
+ assert (plan.kv_start, plan.kv_step, plan.interval_step, plan.num_layers) == (32, 64, 2, 16)
+ raw, fitted = str(tmp_path / "raw"), str(tmp_path / "fit")
+ files = sweep(LinearTimer(), category="cache_slm", batch_size=2, qo_lens=[1, 2, 4, 8], plan=plan, save_dir=raw)
+ assert len(files) == 4
+ rows = load_jsonl(files[0])
+ assert min(r["cache_length"] for r in rows) == 64 # warm-up lengths dropped
+ assert rows[0] == {
+ "time_intervals": int((10 + 0.64) * 16),
+ "measure_count": 16,
+ "query_length": 1,
+ "cache_length": 64,
+ "task_category": "cache_slm",
+ "batch_size": 2,
+ }
+ instability = fit_cache_costs(
+ "cache_all_slm",
+ raw,
+ fitted,
+ max_query_length=8,
+ cache_length_start=64,
+ cache_length_step=64,
+ cache_length_stop=2048,
+ batch_size=2,
+ intensity=ComputeIntensity.HIGH,
+ )
+ assert instability == 0.0
+ first = json.load(open(os.path.join(fitted, "cache_interval_0.json")))
+ last = json.load(open(os.path.join(fitted, "cache_interval_30.json")))
+ assert first["array"][0] < last["array"][0] and first["array"][7] > first["array"][0]
diff --git a/tests/test_calibration_step_timings.py b/tests/test_calibration_step_timings.py
new file mode 100644
index 0000000..8a56be4
--- /dev/null
+++ b/tests/test_calibration_step_timings.py
@@ -0,0 +1,121 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Cost tables from whole-step timings (an engine without an attention-only timing, e.g. vLLM)."""
+
+from __future__ import annotations
+
+import pytest
+
+from eagle_harness.core.calibration import (
+ AttentionShape,
+ CalibrationPaths,
+ MeasureParams,
+ StepTiming,
+ attention_growth_records,
+ fit_step_timings,
+)
+from eagle_harness.core.cost_table import load_cost_tables
+from eagle_harness.core.limits import ComputeIntensity, draft_query_lens, verify_buckets
+
+LAYERS = 16
+STEP, STOP = 256, 4096
+
+
+def timings(widths, fixed_us, per_token_us, per_layer_per_key_ns):
+ """Step time = fixed + per-token + attention growing linearly with the cache length (per layer, per query token)."""
+ lengths = [STEP * (1 + i) + off for i in range((STOP - STEP) // STEP) for off in (STEP // 4, 3 * STEP // 4)]
+ return [
+ StepTiming(q, length, fixed_us + per_token_us * q + LAYERS * per_layer_per_key_ns * length * q / 1000)
+ for q in widths
+ for length in lengths
+ ]
+
+
+def test_cache_cost_is_the_growth_over_the_shortest_cache_per_layer():
+ rows = [StepTiming(4, 100, 500.0), StepTiming(4, 300, 580.0), StepTiming(4, 500, 660.0)]
+ records = attention_growth_records(rows, attention_layers=8, category="cache_llm")
+ per_layer_us = {r.cache_length: r.time_us / r.measure_count for r in records}
+ assert per_layer_us[300] == pytest.approx(10.0, abs=0.01)
+ assert per_layer_us[500] == pytest.approx(20.0, abs=0.01)
+ assert per_layer_us[100] == pytest.approx(0.001, abs=0.001) # floor of one record unit, never zero
+
+
+def test_fits_write_tables_the_cost_model_loads(tmp_path):
+ paths = CalibrationPaths(str(tmp_path))
+ params = MeasureParams(
+ context_step=STEP, context_stop=STOP, batch_size=1, verify_num=64, node_top_k=8, loop_top_m=64, repeat_cnt=1
+ )
+ draft = (AttentionShape(1, 1, 4096), timings(draft_query_lens(1, ComputeIntensity.HIGH), 300.0, 15.0, 2.0))
+ target = (AttentionShape(LAYERS), timings(sorted(verify_buckets(1, ComputeIntensity.HIGH)), 4500.0, 20.0, 1.0))
+ fit_step_timings(paths, params, ComputeIntensity.HIGH, draft, target, tp_size=4)
+ assert paths.task_normal()
+ table = load_cost_tables(paths.cost)[1]
+ short, long = table.interval_index(300), table.interval_index(3900)
+ verify = table.intervals[long].target
+ assert verify.value[verify.index.index(63)] > verify.value[verify.index.index(0)] # a wider verify costs more
+ assert table.intervals[long].target.value[0] > table.intervals[short].target.value[0] # a longer cache costs more
+ assert (
+ table.intervals[long].draft.value[0] < table.intervals[long].target.value[0]
+ ) # a draft step is cheaper than a verify
+
+
+ "intensity,verify_width,draft_width",
+ [(ComputeIntensity.HIGH, 16, 4), (ComputeIntensity.LOW, 32, 8), (ComputeIntensity.CHAIN, 8, 1)],
+)
+def test_fits_respect_measured_width_limits(tmp_path, intensity, verify_width, draft_width):
+ paths = CalibrationPaths(str(tmp_path))
+ params = MeasureParams(
+ context_step=STEP,
+ context_stop=STOP,
+ batch_size=1,
+ verify_num=verify_width,
+ node_top_k=draft_width,
+ loop_top_m=verify_width,
+ repeat_cnt=1,
+ )
+ draft_widths = [q for q in draft_query_lens(1, intensity) if q <= draft_width]
+ target_widths = sorted(q for q in verify_buckets(1, intensity) if q <= verify_width)
+ fit_step_timings(
+ paths,
+ params,
+ intensity,
+ (AttentionShape(1), timings(draft_widths, 300.0, 15.0, 2.0)),
+ (AttentionShape(LAYERS), timings(target_widths, 4500.0, 20.0, 1.0)),
+ )
+ table = load_cost_tables(paths.cost)[1]
+ for interval in table.intervals:
+ assert interval.draft.index == tuple(q - 1 for q in draft_widths)
+ assert interval.target.index == tuple(q - 1 for q in target_widths)
+ assert all(value > 0 for value in (*interval.draft.value, *interval.target.value))
+
+
+def test_chain_fits_price_a_chain_width_per_batch_size(tmp_path):
+ """Chain tables at a weight-bound and a compute-bound batch size, fitted from whole-step timings (what the vLLM
+ driver measures), give the widest chain at batch size 1 and a narrower one at 512."""
+ from eagle_harness.core.chain_width import AcceptProfile, chain_width_schedule
+
+ paths = CalibrationPaths(str(tmp_path))
+ for bs, per_token_us in ((1, 2.0), (512, 900.0)): # per request-token: weight reads dominate at 1, compute at 512
+ params = MeasureParams(
+ context_step=STEP,
+ context_stop=STOP,
+ batch_size=bs,
+ verify_num=16,
+ node_top_k=1,
+ loop_top_m=16,
+ repeat_cnt=1,
+ )
+ draft = (
+ AttentionShape(1, 1, 4096),
+ timings(draft_query_lens(bs, ComputeIntensity.CHAIN), 150.0, 0.1 * bs, 0.5),
+ )
+ widths = sorted(verify_buckets(bs, ComputeIntensity.CHAIN))
+ target = (AttentionShape(LAYERS), timings(widths, 4500.0, per_token_us, 1.0))
+ fit_step_timings(paths, params, ComputeIntensity.CHAIN, draft, target, tp_size=4)
+ tables = load_cost_tables(paths.cost)
+ profile = AcceptProfile.from_counts(1000, [900 - 50 * d for d in range(15)])
+ schedule = chain_width_schedule(tables, profile, 16, 512)
+ assert schedule[0][:2] == (1, 256) and schedule[0][2] >= 8
+ assert schedule[-1][1] == 512 and schedule[-1][2] < schedule[0][2]
diff --git a/tests/test_candidate_calibration.py b/tests/test_candidate_calibration.py
new file mode 100644
index 0000000..08ac176
--- /dev/null
+++ b/tests/test_candidate_calibration.py
@@ -0,0 +1,61 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Offline crossover files cannot silently select tactics on another stack."""
+
+import json
+
+import pytest
+
+from eagle_harness.core.candidate_calibration import load_candidate_crossover
+
+
+def test_candidate_topk_preserves_the_calibrated_crossover(monkeypatch):
+ pytest.importorskip("triton")
+ from eagle_harness.kernels import candidate_ops
+
+ seen = []
+ expected = (object(), object())
+
+ def head(*args, max_triton_elements=None, **kwargs):
+ seen.append(max_triton_elements)
+ return object(), object(), expected
+
+ monkeypatch.setattr(candidate_ops, "candidate_head", head)
+ result = candidate_ops.candidate_topk(
+ None, None, None, num_candidates=128, vocab_start=0, top_k=4,
+ max_triton_elements=32768,
+ )
+ assert seen == [32768]
+ assert result is expected
+
+
+def test_missing_or_other_device_keeps_default(tmp_path):
+ assert load_candidate_crossover(None, {}) is None
+ assert load_candidate_crossover(tmp_path, {}) is None
+ (tmp_path / "candidate_topk.json").write_text(
+ json.dumps({"identity": {"device": "other"}, "max_triton_elements": 42})
+ )
+ assert load_candidate_crossover(tmp_path, {"device": "this"}) is None
+
+
+def test_exact_saved_identity_is_required(tmp_path):
+ identity = {
+ "device": "gpu",
+ "torch": "version",
+ "triton": "compiler",
+ "dtype": "bf16",
+ "vocab_size": 4096,
+ "num_candidates": 128,
+ }
+ (tmp_path / "candidate_topk.json").write_text(json.dumps({"identity": identity, "max_triton_elements": 32768}))
+ assert load_candidate_crossover(tmp_path, identity) == 32768
+ for key in identity:
+ assert load_candidate_crossover(tmp_path, {**identity, key: "different"}) is None
+
+
[email protected]("value", [-1, 1.5, True, "32000000"])
+def test_malformed_matching_profile_fails_closed(tmp_path, value):
+ (tmp_path / "candidate_topk.json").write_text(json.dumps({"identity": {}, "max_triton_elements": value}))
+ with pytest.raises(ValueError, match="crossover"):
+ load_candidate_crossover(tmp_path, {})
diff --git a/tests/test_candidate_gather.py b/tests/test_candidate_gather.py
new file mode 100644
index 0000000..52219ac
--- /dev/null
+++ b/tests/test_candidate_gather.py
@@ -0,0 +1,117 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft candidates' all-gather (:mod:`eagle_harness.vllm.candidate_gather`): fallback and one-rank identity."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+
+class _Group:
+ world_size = 2
+
+ def __init__(self):
+ self.calls = []
+
+ def all_gather(self, x, dim):
+ self.calls.append((tuple(x.shape), dim))
+ return torch.cat([x, x], dim)
+
+
+def test_candidate_gather_falls_back_to_the_group_all_gather():
+ from eagle_harness.vllm.candidate_gather import CandidateGather
+
+ group = _Group()
+ gather = CandidateGather(group, max_rows=4)
+ gather._tried = True # no symmetric memory here
+ x = torch.arange(12, dtype=torch.int64).view(3, 4)
+ out = gather(x)
+ assert torch.equal(out, torch.cat([x, x])) and group.calls == [((3, 4), 0)]
+ # a symmetric buffer that is too small or of another dtype is not used either
+ gather.out = torch.zeros(2 * 4 * 4, dtype=torch.int64)
+ assert torch.equal(gather(torch.zeros(5, 4, dtype=torch.int64)), torch.zeros(10, 4, dtype=torch.int64))
+ assert torch.equal(gather(torch.zeros(2, 4, dtype=torch.int32)), torch.zeros(4, 4, dtype=torch.int32))
+ assert len(group.calls) == 3
+
+
+def test_candidate_gather_hands_the_op_a_rank_major_output_of_the_input_rank(monkeypatch):
+ """The multicast op checks ``out.dim() == x.dim()`` and ``out.shape[0] == world * rows`` (a flat output failed at TP4)."""
+ from eagle_harness.vllm import candidate_gather as module
+
+ def fake_op(x, group_name, out):
+ assert out.dim() == x.dim() and out.shape == (2 * x.shape[0], x.shape[1]) and out.is_contiguous()
+ assert group_name == "tp"
+ out.copy_(torch.cat([x, x + 100]))
+
+ monkeypatch.setattr(module, "_multimem_all_gather_out", fake_op)
+ group = _Group()
+ group.device_group = SimpleNamespace(group_name="tp")
+ gather = module.CandidateGather(group, max_rows=4)
+ gather._tried = True
+ gather.out = torch.zeros(2 * 4 * 3, dtype=torch.int64)
+ x = torch.arange(6, dtype=torch.int64).view(2, 3)
+ out = gather(x)
+ assert torch.equal(out, torch.cat([x, x + 100])) and group.calls == []
+ assert out.data_ptr() == gather.out.data_ptr() # the result lives in the symmetric buffer
+
+
+def _two_rank_gather(rank: int, port: int, results) -> None:
+ import torch.distributed as dist
+
+ from eagle_harness.vllm.candidate_gather import CandidateGather
+
+ torch.cuda.set_device(rank)
+ dist.init_process_group("nccl", init_method=f"tcp://127.0.0.1:{port}", rank=rank, world_size=2)
+ try:
+ group = SimpleNamespace(
+ world_size=2,
+ device_group=dist.group.WORLD,
+ all_gather=lambda x, dim: _nccl_all_gather(x),
+ )
+ gather = CandidateGather(group, max_rows=64)
+ for rows in (16, 4, 16): # the buffer is sized once; smaller gathers use its prefix
+ x = torch.arange(rows * 24, dtype=torch.int64, device="cuda").view(rows, 24) + 1000 * rank
+ want = torch.cat([x - 1000 * rank, x - 1000 * rank + 1000])
+ got = gather(x)
+ assert got.shape == want.shape and torch.equal(got, want), rows
+ results.put((rank, "multicast" if gather.out is not None else "fallback"))
+ finally:
+ dist.destroy_process_group()
+
+
+def _nccl_all_gather(x: torch.Tensor) -> torch.Tensor:
+ import torch.distributed as dist
+
+ out = x.new_empty(2 * x.shape[0], *x.shape[1:])
+ dist.all_gather_into_tensor(out, x)
+ return out
+
+
[email protected](torch.cuda.device_count() < 2, reason="needs two GPUs")
+def test_candidate_gather_two_ranks_is_the_rank_major_concat():
+ """Two ranks: the multicast path (or the NCCL fallback) returns both ranks' rows, rank-major, for any row count."""
+ import torch.multiprocessing as mp
+
+ ctx = mp.get_context("spawn")
+ results = ctx.Queue()
+ mp.start_processes(_two_rank_gather, args=(29541, results), nprocs=2, start_method="spawn")
+ print(sorted(results.get() for _ in range(2)))
+
+
[email protected](torch.cuda.device_count() < 1, reason="needs a GPU")
+def test_candidate_gather_single_rank_is_the_input():
+ """One rank: the multicast path (when the host has it) returns the input itself."""
+ pytest.importorskip("vllm")
+ import torch.distributed as dist
+
+ from eagle_harness.vllm.candidate_gather import CandidateGather
+
+ if not dist.is_initialized():
+ dist.init_process_group("nccl", init_method="tcp://127.0.0.1:29533", rank=0, world_size=1)
+ group = SimpleNamespace(world_size=1, device_group=dist.group.WORLD, all_gather=lambda x, dim: x.clone())
+ gather = CandidateGather(group, max_rows=64)
+ x = torch.randint(0, 1 << 40, (16, 32), dtype=torch.int64, device="cuda")
+ assert torch.equal(gather(x), x)
+ print("multicast" if gather.out is not None else "fallback")
diff --git a/tests/test_candidate_head.py b/tests/test_candidate_head.py
new file mode 100644
index 0000000..3fff473
--- /dev/null
+++ b/tests/test_candidate_head.py
@@ -0,0 +1,109 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 candidate LM head: shard top-k, exact re-scoring, TP merge, full-vocab logits (CPU)."""
+
+from __future__ import annotations
+
+import torch
+
+from eagle_harness.kernels.gather_dot import gather_dot, gather_dot_packed, gather_dot_reference
+from eagle_harness.sglang.candidate_logits import (
+ Candidates,
+ merge_candidates,
+ scatter_to_vocab,
+ shard_candidates,
+)
+
+VOCAB, HIDDEN, RANK, C = 512, 64, 8, 16
+
+
+def _weights(seed: int = 0):
+ g = torch.Generator().manual_seed(seed)
+ lm_head = torch.randn(VOCAB, HIDDEN, generator=g)
+ down = torch.randn(RANK, HIDDEN, generator=g)
+ score = torch.randn(VOCAB, RANK, generator=g)
+ hidden = torch.randn(3, HIDDEN, generator=g)
+ return hidden, down, score, lm_head
+
+
+def test_gather_dot_matches_rows_times_hidden():
+ hidden, _, _, lm_head = _weights()
+ ids = torch.tensor([[0, 5, 7], [511, 1, 2], [3, 3, 4]])
+ expect = torch.stack([lm_head[ids[b]] @ hidden[b] for b in range(3)])
+ torch.testing.assert_close(gather_dot(lm_head, ids, hidden), expect, rtol=1e-5, atol=1e-5)
+ out = torch.empty(3, 3)
+ assert gather_dot(lm_head, ids, hidden, out=out) is out
+ torch.testing.assert_close(out, gather_dot_reference(lm_head, ids, hidden))
+
+
+def test_single_shard_candidates_are_the_low_rank_top_c_rescored_exactly():
+ hidden, down, score, lm_head = _weights()
+ cand = shard_candidates(hidden, down, score, lm_head, num_candidates=C, vocab_start=0, vocab_rows=VOCAB)
+ merged = merge_candidates(cand, C, None)
+ approx = (hidden @ down.t()) @ score.t()
+ for b in range(3):
+ assert set(merged.token_ids[b].tolist()) == set(approx[b].topk(C).indices.tolist())
+ exact = lm_head[merged.token_ids[b]] @ hidden[b]
+ torch.testing.assert_close(merged.logits[b], exact, rtol=1e-5, atol=1e-5)
+ assert merged.logits.dtype == torch.float32
+
+
+def test_padding_rows_of_a_shard_are_never_candidates():
+ hidden, down, score, lm_head = _weights()
+ score = score.clone()
+ score[VOCAB - 40 :] = 1e4 # padding rows with huge scores
+ cand = shard_candidates(hidden, down, score, lm_head, num_candidates=C, vocab_start=0, vocab_rows=VOCAB - 40)
+ assert int(cand.token_ids.max()) < VOCAB - 40
+
+
+def test_tp_merge_keeps_the_best_exact_logits_over_every_rank():
+ hidden, down, score, lm_head = _weights(1)
+ tp, rows = 4, VOCAB // 4
+ shards = [
+ shard_candidates(
+ hidden,
+ down,
+ score[r * rows : (r + 1) * rows],
+ lm_head[r * rows : (r + 1) * rows],
+ num_candidates=C,
+ vocab_start=r * rows,
+ vocab_rows=rows,
+ )
+ for r in range(tp)
+ ]
+
+ def all_gather(t: torch.Tensor) -> torch.Tensor: # rank-major concat, as tensor_model_parallel_all_gather
+ field = "logits" if t.is_floating_point() else "token_ids"
+ return torch.cat([getattr(s, field) for s in shards], dim=-1)
+
+ merged = merge_candidates(shards[0], C, all_gather)
+ pool_ids = torch.cat([s.token_ids for s in shards], dim=-1)
+ pool_logits = torch.cat([s.logits for s in shards], dim=-1)
+ for b in range(3):
+ best = pool_ids[b][pool_logits[b].topk(C).indices]
+ assert set(merged.token_ids[b].tolist()) == set(best.tolist())
+ torch.testing.assert_close(merged.logits[b], lm_head[merged.token_ids[b]] @ hidden[b], rtol=1e-5, atol=1e-5)
+
+
+def test_full_vocab_row_softmax_equals_the_candidate_softmax():
+ logits = torch.tensor([[2.0, -1.0, 0.5], [0.0, 0.0, 3.0]])
+ ids = torch.tensor([[10, 3, 7], [0, 11, 5]])
+ full = scatter_to_vocab(Candidates(logits, ids), 12)
+ assert full.shape == (2, 12) and torch.isinf(full).sum() == 2 * 9
+ probs = torch.softmax(full, -1)
+ torch.testing.assert_close(probs.gather(1, ids), torch.softmax(logits, -1))
+ assert probs.argmax(-1).tolist() == [10, 5]
+
+
+def test_packed_gather_dot_is_the_gathered_candidate_block():
+ """[logits as fp32 bits | ids + vocab_start] int32: what the rank-major all-gather moves and the tail reads."""
+ hidden, _, _, lm_head = _weights()
+ hidden, lm_head = hidden.to(torch.bfloat16), lm_head.to(torch.bfloat16)
+ ids = torch.tensor([[0, 5, 7, 9], [511, 1, 2, 3], [3, 3, 4, 8]])
+ packed = gather_dot_packed(lm_head, ids, hidden, 1000)
+ assert packed.dtype == torch.int32 and packed.shape == (3, 8)
+ logits, tokens = packed[:, :4].view(torch.float32), packed[:, 4:]
+ assert torch.equal(logits, gather_dot_reference(lm_head, ids, hidden).float())
+ assert torch.equal(tokens, (ids + 1000).to(torch.int32))
+ assert logits.stride(-1) == 1 and tokens.stride(-1) == 1
diff --git a/tests/test_candidate_ops_gpu.py b/tests/test_candidate_ops_gpu.py
new file mode 100644
index 0000000..2775d08
--- /dev/null
+++ b/tests/test_candidate_ops_gpu.py
@@ -0,0 +1,138 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""GPU checks of the candidate top-k launchers against their torch references (skipped without CUDA).
+
+Run in a GPU job: ``pytest -q tests/test_candidate_ops_gpu.py``.
+"""
+
+import pytest
+import torch
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a CUDA device")
+
+
[email protected]("cuda_kernels", [True, False])
[email protected]("rows,vocab,k", [(1, 62080, 128), (16, 62080, 128), (64, 248320, 64)])
+def test_shard_topk_matches_torch(cuda_kernels, rows, vocab, k):
+ from eagle_harness.kernels.candidate_ops import shard_topk
+
+ gen = torch.Generator(device="cuda").manual_seed(rows + vocab)
+ scores = torch.randn(rows, vocab, device="cuda", dtype=torch.bfloat16, generator=gen)
+ scores[:, 7] = scores[:, 9] # ties keep torch's order
+ local, global_ids = shard_topk(scores, k, 1000, cuda_kernels=cuda_kernels)
+ ref = torch.topk(scores, k, dim=-1, sorted=False).indices
+ assert torch.equal(global_ids, local + 1000)
+ if torch.version.hip:
+ # ROCm topk uses a different unsorted order and tie break than CUDA.
+ values = torch.gather(scores, -1, local)
+ assert torch.equal(values.sort().values, torch.gather(scores, -1, ref).sort().values)
+ assert torch.all(local.sort().values[:, 1:] != local.sort().values[:, :-1])
+ else:
+ assert torch.equal(local, ref)
+
+
[email protected]("cuda_kernels", [True, False])
[email protected]("dtype", [torch.bfloat16, torch.float32]) # fp32: the packed TP gather
[email protected]("ranks,rows,nc,top_k", [(1, 4, 128, 4), (4, 1, 128, 4), (4, 16, 128, 8)])
+def test_candidate_tail_matches_torch(cuda_kernels, dtype, ranks, rows, nc, top_k):
+ from eagle_harness.kernels.candidate_ops import candidate_tail
+
+ gen = torch.Generator(device="cuda").manual_seed(ranks * 100 + rows)
+ logits = torch.randn(ranks * rows, nc, device="cuda", dtype=torch.bfloat16, generator=gen).to(dtype)
+ tokens = torch.randperm(ranks * rows * nc, device="cuda", generator=gen).view(ranks * rows, nc)
+ out_logits, out_tokens, (probs, topk_tokens) = candidate_tail(
+ logits, tokens, rows, top_k, cuda_kernels=cuda_kernels
+ )
+ # The same candidates as [R, M, NC] views of a last-dim gather ([M, R * NC]) give the same result.
+ by_row = (
+ logits.view(ranks, rows, nc).transpose(0, 1).contiguous(),
+ tokens.view(ranks, rows, nc).transpose(0, 1).contiguous(),
+ )
+ views = candidate_tail(by_row[0].transpose(0, 1), by_row[1].transpose(0, 1), rows, top_k, cuda_kernels=cuda_kernels)
+ assert all(torch.equal(a, b) for a, b in zip((*views[:2], *views[2]), (out_logits, out_tokens, probs, topk_tokens)))
+ gathered = logits.view(ranks, rows, nc).permute(1, 0, 2).reshape(rows, ranks * nc)
+ gathered_tokens = tokens.view(ranks, rows, nc).permute(1, 0, 2).reshape(rows, ranks * nc)
+ if ranks > 1:
+ ref_logits, pos = torch.topk(gathered, nc, dim=-1, sorted=False)
+ ref_tokens = torch.gather(gathered_tokens, -1, pos)
+ else:
+ ref_logits, ref_tokens = gathered, gathered_tokens
+ ref_logits = ref_logits.float()
+ if torch.version.hip:
+ assert torch.equal(out_logits.sort().values, ref_logits.sort().values)
+ # Check each selected token keeps its exact logit, independent of ties/order.
+ source = torch.empty_like(logits.flatten()).scatter_(0, tokens.flatten(), logits.flatten())
+ assert torch.equal(out_logits, source[out_tokens].float())
+ for row in range(rows):
+ assert torch.all(torch.isin(out_tokens[row], gathered_tokens[row]))
+ ordered = out_tokens.sort().values
+ assert torch.all(ordered[:, 1:] != ordered[:, :-1])
+ ordered_topk = topk_tokens.sort().values
+ assert torch.all(ordered_topk[:, 1:] != ordered_topk[:, :-1])
+ exact = out_logits.double().softmax(-1)
+ torch.testing.assert_close(probs.double(), exact.topk(top_k).values, rtol=1e-6, atol=1e-8)
+ matches = out_tokens[:, :, None] == topk_tokens[:, None, :]
+ assert torch.all(matches.sum(1) == 1)
+ picked = (exact[:, :, None] * matches).sum(1)
+ torch.testing.assert_close(probs.double(), picked, rtol=1e-6, atol=1e-8)
+ return
+ ref_probs, pick = torch.topk(torch.softmax(ref_logits, -1), top_k)
+ assert torch.equal(out_logits, ref_logits)
+ assert torch.equal(out_tokens, ref_tokens)
+ assert torch.equal(probs, ref_probs)
+ assert torch.equal(topk_tokens, torch.gather(ref_tokens, -1, pick))
+
+
+def test_native_library_is_used_where_the_gpu_has_it():
+ from eagle_harness.kernels import arch, native
+
+ if not arch.native_candidate_tail("cuda"):
+ pytest.skip("native kernels are NVIDIA sm_80+ only")
+ assert native.library() is not None
+
+
[email protected]("rows,k,h,vocab", [(1, 128, 5120, 62080), (4, 128, 5120, 62080), (64, 64, 640, 4096)])
+def test_gather_dot_matches_reference_and_packed_layout(rows, k, h, vocab):
+ from eagle_harness.kernels.gather_dot import gather_dot, gather_dot_packed, pack_reference
+
+ gen = torch.Generator(device="cuda").manual_seed(rows + k)
+ weight = torch.randn(vocab, h, device="cuda", dtype=torch.bfloat16, generator=gen)
+ hidden = torch.randn(rows, h, device="cuda", dtype=torch.bfloat16, generator=gen)
+ ids = torch.randint(0, vocab, (rows, k), device="cuda", generator=gen)
+ got = gather_dot(weight, ids, hidden)
+ exact = torch.einsum("bkh,bh->bk", weight[ids].double(), hidden.double())
+ torch.testing.assert_close(got.double(), exact, rtol=2**-7, atol=2**-6) # one bf16 rounding of the exact sum
+ packed = gather_dot_packed(weight, ids, hidden, 4096)
+ assert torch.equal(packed, pack_reference(got, ids + 4096))
+
+
[email protected]("cuda_kernels", [True, False])
[email protected]("ranks,rows,nc,top_k", [(4, 1, 128, 4), (4, 16, 128, 8), (2, 4, 64, 4)])
+def test_candidate_topk_packed_gather_matches_the_unfused_path(cuda_kernels, ranks, rows, nc, top_k):
+ from eagle_harness.kernels.candidate_ops import candidate_tail, candidate_topk, shard_topk
+ from eagle_harness.kernels.gather_dot import gather_dot, gather_dot_packed
+
+ gen = torch.Generator(device="cuda").manual_seed(ranks * 31 + rows)
+ shard, h = 4096, 256
+ scores = [torch.randn(rows, shard, device="cuda", dtype=torch.bfloat16, generator=gen) for _ in range(ranks)]
+ weights = [torch.randn(shard, h, device="cuda", dtype=torch.bfloat16, generator=gen) for _ in range(ranks)]
+ hidden = torch.randn(rows, h, device="cuda", dtype=torch.bfloat16, generator=gen)
+ local = [shard_topk(scores[r], nc, r * shard, cuda_kernels=cuda_kernels) for r in range(ranks)]
+ # Unfused: per-rank gather-dot, rank-major concatenation, the tail on fp32 logits and int64 ids.
+ logits = torch.cat([gather_dot(weights[r], local[r][0], hidden) for r in range(ranks)]).float()
+ ids = torch.cat([local[r][1] for r in range(ranks)])
+ _, _, (want_probs, want_tokens) = candidate_tail(logits, ids, rows, top_k, cuda_kernels=cuda_kernels)
+ # Fused: rank 0 calls candidate_topk; the all-gather delivers every rank's packed block as [R, M, n], here as the
+ # views of a last-dim gather (sglang) and of a dim-0 gather (vLLM).
+ blocks = [gather_dot_packed(weights[r], local[r][0], hidden, r * shard) for r in range(ranks)]
+ gathers = {
+ "last dim": lambda own: torch.cat([own, *blocks[1:]], dim=-1).view(rows, ranks, -1).transpose(0, 1),
+ "dim 0": lambda own: torch.cat([own, *blocks[1:]]).view(ranks, rows, -1),
+ }
+ for name, gather in gathers.items():
+ probs, tokens = candidate_topk(
+ scores[0], weights[0], hidden, num_candidates=nc, vocab_start=0, top_k=top_k,
+ all_gather=gather, cuda_kernels=cuda_kernels,
+ ) # fmt: skip
+ assert torch.equal(probs, want_probs) and torch.equal(tokens, want_tokens), name
diff --git a/tests/test_chain_no_spec.py b/tests/test_chain_no_spec.py
new file mode 100644
index 0000000..746bebf
--- /dev/null
+++ b/tests/test_chain_no_spec.py
@@ -0,0 +1,86 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Native OFF is distinct from root-only speculative verification."""
+
+from types import SimpleNamespace
+
+import pytest
+
+from eagle_harness.core.chain_width import chain_widths, save_accept_profile, save_round_times, served_chain_width
+from eagle_harness.vllm.config import verify_width_schedule
+from eagle_harness.core.limits import ComputeIntensity
+from tests.test_chain_width import PROFILE
+
+
+def test_native_decode_is_a_distinct_opt_in_action(tmp_path):
+ save_accept_profile(str(tmp_path), 100, [90, 80, 70])
+ save_round_times(
+ str(tmp_path),
+ [
+ {"batch_size": 1, "width": 0, "round_us": 100, "count": 10},
+ {"batch_size": 1, "width": 1, "round_us": 200, "count": 10},
+ {"batch_size": 1, "width": 4, "round_us": 1000, "count": 10},
+ ],
+ )
+ assert chain_widths(str(tmp_path), 4, 4) == [(1, 4, 1)]
+ assert chain_widths(str(tmp_path), 4, 4, allow_no_spec=True) == [(1, 4, 0)]
+ # K=0 still runs draft extend on vLLM: never silently claim it is native OFF.
+ with pytest.raises(ValueError, match="native.*decode"):
+ verify_width_schedule(ComputeIntensity.CHAIN, 4, str(tmp_path))
+
+
+def _native_schedule_config(tmp_path, *, capable=True, schedule=None, mode="serve"):
+ from eagle_harness.vllm.config import configure_speculative_config
+
+ save_accept_profile(str(tmp_path), 100, [90, 80, 70])
+ save_round_times(
+ str(tmp_path),
+ [
+ {"batch_size": batch, "width": width, "round_us": us, "count": 10}
+ for batch, times in [(1, {0: 1000, 1: 100, 4: 1000}), (8, {0: 100, 1: 200, 4: 1000})]
+ for width, us in times.items()
+ ],
+ )
+ config = SimpleNamespace(
+ method_config={"mode": mode, "intensity": "chain_intensity", "max_verify_width": 4, "data_path": str(tmp_path)},
+ draft_model_config=None,
+ num_speculative_tokens=None,
+ num_speculative_tokens_per_batch_size=schedule,
+ )
+ if capable:
+ config.native_decode_batch_sizes = None
+ configure_speculative_config(config)
+ return config
+
+
+def test_canonical_schedule_keeps_native_off_distinct_from_root_only(tmp_path):
+ config = _native_schedule_config(tmp_path)
+ expected = chain_widths(str(tmp_path), 4, 512, allow_no_spec=True)
+ assert expected is not None
+ assert {width for _, _, width in expected} == {0, 1}
+ assert config.native_decode_batch_sizes == [(first, last) for first, last, width in expected if width == 0]
+ assert all(k == 0 for _, _, k in config.num_speculative_tokens_per_batch_size)
+ assert config.num_speculative_tokens == 1
+ # Reconstructing an already configured object must keep its OFF metadata.
+ from eagle_harness.vllm.config import configure_speculative_config
+
+ configure_speculative_config(config)
+ assert config.native_decode_batch_sizes == [(first, last) for first, last, width in expected if width == 0]
+
+
+def test_native_off_requires_an_explicit_host_capability(tmp_path):
+ with pytest.raises(ValueError, match="native.*decode"):
+ _native_schedule_config(tmp_path, capable=False)
+
+
[email protected]("mode,schedule", [("static", None), ("serve", [(1, 65536, 0)])])
+def test_static_and_explicit_k_zero_do_not_opt_into_native_off(tmp_path, mode, schedule):
+ config = _native_schedule_config(tmp_path, schedule=schedule, mode=mode)
+ assert config.native_decode_batch_sizes is None
+ assert config.num_speculative_tokens_per_batch_size == schedule
+
+
+def test_native_decode_wins_ties_without_changing_existing_widths():
+ assert served_chain_width({0: 100, 1: 100, 2: 190}, PROFILE, 2, allow_no_spec=True) == 0
+ assert served_chain_width({0: 100, 1: 100, 2: 190}, PROFILE, 2) == 1
diff --git a/tests/test_chain_policy_costs.py b/tests/test_chain_policy_costs.py
new file mode 100644
index 0000000..c8524fd
--- /dev/null
+++ b/tests/test_chain_policy_costs.py
@@ -0,0 +1,421 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Chain exports use Eagle's host decisions, including live batch classification."""
+
+import copy
+import json
+import math
+from dataclasses import FrozenInstanceError, replace
+from pathlib import Path
+
+import pytest
+
+from eagle_harness.core import cost_model
+from eagle_harness.core.cost_model import ChainCoef, CostModel, CostModelParams, SizeClass
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, IntervalCost, load_cost_tables
+from eagle_harness.core.limits import ComputeIntensity
+
+CHAIN_INDEX = (0, 1, 3, 5, 7, 9, 11, 13, 15)
+
+
+def _curve(ratios, indices=CHAIN_INDEX):
+ return CostCurve(tuple(10 * r for r in ratios), tuple(ratios), tuple(indices), (), ())
+
+
+def _table(batch_size=4, *, step=128, model_ratio=20.0):
+ # Includes every tier, a cliff, and decreasing measured costs.
+ ratios = (
+ (1.0, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40),
+ (1.0, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55),
+ (1.0, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10),
+ (1.0, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 5.50),
+ (1.0, 1.10, 1.20, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25),
+ (1.0, 1.30, 1.20, 1.10, 1.00, 0.90, 0.80, 0.70, 0.60),
+ )
+ return BatchCostTable(
+ batch_size,
+ step,
+ step,
+ 16,
+ 4096,
+ 1,
+ tuple(IntervalCost(_curve(values), _curve((1.0,), (0,))) for values in ratios),
+ (model_ratio,) * len(ratios),
+ )
+
+
+def _model(**changes):
+ args = {
+ "tables": {4: _table()},
+ "params": CostModelParams(),
+ "intensity": ComputeIntensity.CHAIN,
+ "node_top_k": 1,
+ "tree_depth": 15,
+ "verify_num": 16,
+ }
+ args.update(changes)
+ return CostModel(**args)
+
+
+def _stop_from_terms(terms, deltas):
+ if terms.cost == 0.0:
+ return False
+ gain = deltas[1] - deltas[0]
+ current = gain * 2.0 / terms.gain_scale
+ stop = current / terms.cost < terms.threshold
+ if stop and terms.cliff_cost > 0.0:
+ lookahead = current + gain * 2.0 / terms.cliff_gain_scale
+ stop = lookahead / terms.cliff_cost < terms.threshold
+ return stop
+
+
+def test_chain_export_is_available():
+ assert callable(getattr(CostModel, "chain_policy_costs", None))
+ assert callable(getattr(CostModel, "chain_stop_terms", None))
+
+
[email protected]("depth", [2, 3, 8, 14, 15])
+def test_export_shape_immutable_records_and_no_decision_slots(depth):
+ model = _model(tree_depth=depth)
+ costs = model.chain_policy_costs()
+ assert isinstance(costs, cost_model.ChainPolicyCosts)
+ assert isinstance(costs.batches, tuple)
+ assert len(costs.batches) == 512
+ zero = cost_model.ChainStopTerms(0.0, 0.0, 0.0, 0.0, 0.0)
+ for batch in costs.batches:
+ assert isinstance(batch, cost_model.ChainPolicyBatch)
+ assert batch.cache_length_step == 128
+ assert isinstance(batch.intervals, tuple)
+ assert len(batch.intervals) == 6
+ for interval in batch.intervals:
+ assert isinstance(interval, tuple)
+ assert len(interval) == depth
+ for d, terms in enumerate(interval):
+ if d == 0 or d == depth - 1 or d % 2:
+ assert terms == zero
+ assert model.chain_stop(d, 1) is False
+ else:
+ assert terms.cost > 0.0
+ assert terms.threshold > 0.0
+ for obj, name in (
+ (costs, "batches"),
+ (costs.batches[0], "cache_length_step"),
+ (costs.batches[0].intervals[0][0], "cost"),
+ ):
+ with pytest.raises(FrozenInstanceError):
+ setattr(obj, name, None)
+
+
+def test_live_batch_tiers_and_nearest_table_ties():
+ model = _model(tables={4: _table(), 8: _table(8, step=256, model_ratio=10)})
+ costs = model.chain_policy_costs()
+ # All three live batches select measured batch 4; only 1 and 2 are tiny.
+ for bs, threshold in ((1, 2.60), (2, 2.60), (3, 2.85)):
+ assert costs.batches[bs - 1].intervals[1][2].threshold == threshold
+ for bs, step, draft_cost in ((5, 128, 0.1), (6, 256, 0.2), (512, 256, 0.2)):
+ batch = costs.batches[bs - 1]
+ assert batch.cache_length_step == step
+ # The decreasing curve contributes zero extra verify cost.
+ assert batch.intervals[5][2].cost == draft_cost
+
+
[email protected](scope="module")
+def golden(tmp_path_factory):
+ data = json.loads((Path(__file__).parent / "golden" / "fork_golden.json").read_text())
+ root = tmp_path_factory.mktemp("chain-costs")
+ for name, contents in data["cost_files_chain_intensity"].items():
+ path = root / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(contents)
+ return data, load_cost_tables(str(root))
+
+
+def test_golden_chain_decisions(golden):
+ data, tables = golden
+ decisions = set()
+ count = 0
+ for case in data["decisions_chain_intensity"]:
+ config = case["case"]
+ model = _model(
+ tables=tables,
+ tree_depth=config["tree_depth"],
+ verify_num=config["verify_num"],
+ ragged=True,
+ eval_batch_size=config["eval_batch_size"],
+ )
+ costs = model.chain_policy_costs()
+ for step in case["script"]:
+ if step["op"] == "update_interval":
+ model.update_interval(*step["args"])
+ elif step["op"] == "chain":
+ depth, bs, *deltas = step["args"]
+ assert model.chain_stop(*step["args"]) == step["out"]
+ terms = costs.batches[bs - 1].intervals[model.interval_index][depth]
+ assert terms == model.chain_stop_terms(depth, bs)
+ assert _stop_from_terms(terms, deltas[0] if deltas else None) == step["out"]
+ decisions.add(step["out"])
+ count += 1
+ assert count > 100
+ assert decisions == {False, True}
+
+
+def test_custom_parameters_and_ragged_thresholds():
+ params = CostModelParams(
+ chain_coef=tuple(ChainCoef(t, 0.125, 0.5) for t in (1.0, 2.0, 3.0, 4.0)),
+ chain_ref_cost=3.0,
+ chain_cliff_min_cost=0.25,
+ chain_cliff_ratio=2.0,
+ chain_scale_tiny=1.1,
+ chain_tiny_max_bs=1,
+ chain_scale_small=1.3,
+ chain_scale_medium=1.6,
+ ragged_draft_relax=(0.5, 0.6, 0.7),
+ )
+ model = _model(params=params, ragged=True)
+ costs = model.chain_policy_costs()
+ model.interval_index = 4
+ terms = costs.batches[2].intervals[4][2]
+ assert terms == model.chain_stop_terms(2, 3)
+ assert terms.cost == 0.1 + (2.0 - 1.2)
+ assert terms.cliff_cost == 0.2 + (2.05 - 1.2)
+ ref_cost = sum(c + 0.05 * (2 * i + 1) for i, c in enumerate((1.1, 1.2, 2, 2.05, 2.1, 2.15, 2.2, 2.25))) / 8
+ assert terms.threshold == (4.0 * 0.7) * (3.0 / ref_cost) ** 0.5
+ paged = replace(model, ragged=False).chain_stop_terms(2, 3)
+ assert paged.threshold == 4.0 * (3.0 / ref_cost) ** 0.5
+ tiny = costs.batches[0].intervals[4][2]
+ assert tiny.threshold == (3.0 / ref_cost) ** 0.5
+
+
+ "interval,depth,gain,expected",
+ [
+ (0, 8, 0.5694000000000001, False),
+ (0, 10, 0.6630000000000001, True),
+ (0, 12, 0.756599999999999, True),
+ (1, 2, 0.2886000000000001, False),
+ ],
+)
+def test_preserves_original_eagle_rounding_at_stop_boundary(interval, depth, gain, expected):
+ # Original Eagle decisions differ if 2 / gain_scale is precomputed.
+ model = _model()
+ model.interval_index = interval
+ terms = model.chain_stop_terms(depth, 1)
+ assert model.chain_stop(depth, 1, [0.0, gain]) is expected
+ assert _stop_from_terms(terms, [0.0, gain]) is expected
+
+
[email protected]("gain,expected", [(0.5, True), (1.5, False), (2.0, False)])
+def test_cliff_can_rescue_a_stop(gain, expected):
+ model = _model()
+ model.interval_index = 4
+ terms = model.chain_stop_terms(2, 1)
+ assert terms.gain_scale == 1.48
+ assert terms.cliff_gain_scale == 1.96
+ assert terms.cliff_cost == 0.2 + (2.05 - 1.2)
+ assert model.chain_stop(2, 1, [0.0, gain]) is expected
+ assert _stop_from_terms(terms, [0.0, gain]) is expected
+ if gain == 1.5:
+ assert gain * 2 / terms.gain_scale / terms.cost < terms.threshold
+
+
+def test_cliff_preserves_separate_gain_rounding():
+ model = _model()
+ model.interval_index = 4
+ terms = model.chain_stop_terms(2, 3)
+ gain = 1.1753189500071877
+ assert model.chain_stop(2, 3, [0.0, gain]) is True
+ assert _stop_from_terms(terms, [0.0, gain]) is True
+ folded_gain = gain * (2.0 / terms.gain_scale + 2.0 / terms.cliff_gain_scale)
+ assert folded_gain / terms.cliff_cost >= terms.threshold
+
+
+ "minimum,ratio,enabled",
+ [
+ (0.5, 1.5, False),
+ (math.nextafter(0.5, 0.0), 1.5, True),
+ (0.15, 2.0, False),
+ (0.15, math.nextafter(2.0, 0.0), True),
+ ],
+)
+def test_cliff_cutoffs_are_strict(minimum, ratio, enabled):
+ table = _table()
+ target = _curve((1.0, 1.0, 1.0, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75))
+ table = replace(table, intervals=(replace(table.intervals[0], target=target),), model_ratio=(20.0,))
+ params = CostModelParams(chain_cliff_min_cost=minimum, chain_cliff_ratio=ratio)
+ model = _model(tables={4: table}, params=params)
+ terms = model.chain_stop_terms(2, 1)
+ assert (terms.cliff_cost > 0.0) is enabled
+ assert (terms.cliff_gain_scale > 0.0) is enabled
+ if not enabled:
+ assert terms.cliff_cost == terms.cliff_gain_scale == 0.0
+ last = model.chain_stop_terms(12, 1)
+ assert last.cliff_cost == last.cliff_gain_scale == 0.0
+
+
[email protected]("ragged", [False, True])
+def test_exported_terms_match_host_across_all_live_batches_and_intervals(ragged):
+ model = _model(
+ tables={4: _table(), 32: _table(32, step=256, model_ratio=10)},
+ ragged=ragged,
+ )
+ costs = model.chain_policy_costs()
+ for bs, batch in enumerate(costs.batches, 1):
+ for interval_id, interval in enumerate(batch.intervals):
+ model.update_interval(bs, (interval_id + 1) * batch.cache_length_step)
+ for depth, terms in enumerate(interval):
+ assert model.chain_stop_terms(depth, bs) == terms
+ for gain in (0.0, 0.3, 1.5, 10.0):
+ assert model.chain_stop(depth, bs, [0.1, gain]) == _stop_from_terms(terms, [0.1, gain])
+
+
+def test_export_preserves_values_and_mutable_object_identities():
+ model = _model(eval_batch_size=512, ragged=True)
+ model.tier.size = SizeClass.HUGE
+ model.tier.tiny = True
+ model.interval_index = 4
+ model.recent_verify_nums[:] = [6] * 5
+ for bs in range(1, 513):
+ model.record_verify_num(bs, 2 + bs % 15)
+ before = copy.deepcopy(model.__dict__)
+ objects = dict(model.__dict__)
+ histories = tuple(model._history)
+ costs = model.chain_policy_costs()
+ assert model.__dict__ == before
+ assert all(model.__dict__[name] is value for name, value in objects.items())
+ assert all(a is b for a, b in zip(histories, model._history))
+ model.interval_index = 0
+ model.record_verify_num(1, 16)
+ assert model.chain_policy_costs() == costs
+
+
[email protected]("model_ratio", [0.5, 4.99, 100.01])
+def test_chain_accepts_positive_ratios_outside_tree_adjustment_domain(model_ratio):
+ model = _model(tables={4: _table(model_ratio=model_ratio)})
+ costs = model.chain_policy_costs()
+ assert costs.batches[3].intervals[5][2].cost == 2 / model_ratio
+
+
+ "change",
+ [
+ {"intensity": ComputeIntensity.HIGH},
+ {"intensity": ComputeIntensity.LOW},
+ {"node_top_k": 0},
+ {"node_top_k": 2},
+ {"node_top_k": True},
+ {"tree_depth": 1},
+ {"tree_depth": 16},
+ {"tree_depth": 2.0},
+ {"verify_num": 1},
+ {"verify_num": 17},
+ {"verify_num": 2.0},
+ {"tables": {}},
+ ],
+)
+def test_invalid_model_shape(change):
+ with pytest.raises((ValueError, NotImplementedError)):
+ _model(**change).chain_policy_costs()
+
+
+ "change",
+ [
+ {"intervals": ()},
+ {"model_ratio": ()},
+ {"model_ratio": (math.nan,) * 6},
+ {"model_ratio": (math.inf,) * 6},
+ {"model_ratio": (0.0,) * 6},
+ {"model_ratio": (-1.0,) * 6},
+ {"cache_length_step": 0},
+ {"cache_length_step": -1},
+ {"cache_length_step": 1.5},
+ {"batch_size": 8},
+ {"batch_size": 4.0},
+ ],
+)
+def test_invalid_table_metadata_leaves_state_unchanged(change):
+ model = _model(tables={4: replace(_table(), **change)})
+ before = copy.deepcopy(model.__dict__)
+ with pytest.raises(ValueError):
+ model.chain_policy_costs()
+ assert model.__dict__ == before
+
+
[email protected]("batch_size", [0, -1, 513, 4.0, True])
+def test_invalid_measured_batch_domain(batch_size):
+ with pytest.raises(ValueError, match="batch_size"):
+ _model(tables={batch_size: _table(batch_size)}).chain_policy_costs()
+
+
+def test_invalid_unselected_table_rejected():
+ model = _model()
+ model.tables[512] = replace(_table(512), model_ratio=(math.inf,) * 6)
+ with pytest.raises(ValueError, match="cost ratio"):
+ model.chain_policy_costs()
+
+
[email protected]("curve_name", ["target", "draft"])
+ "change",
+ [
+ {"index": ()},
+ {"value": ()},
+ {"ratio": ()},
+ {"index": (0, 1, 2, 5, 7, 9, 11, 13, 15)},
+ {"index": (0, 1, 3, 5, 7, 9, 11, 13, 15.0)},
+ {"ratio": (1.0, math.nan, 1, 1, 1, 1, 1, 1, 1)},
+ {"ratio": (1.0, math.inf, 1, 1, 1, 1, 1, 1, 1)},
+ {"ratio": (1.0, 0.0, 1, 1, 1, 1, 1, 1, 1)},
+ {"value": (1.0, -1.0, 1, 1, 1, 1, 1, 1, 1)},
+ ],
+)
+def test_invalid_cost_curves(curve_name, change):
+ table = _table()
+ interval = table.intervals[0]
+ curve = replace(getattr(interval, curve_name), **change)
+ interval = replace(interval, **{curve_name: curve})
+ model = _model(tables={4: replace(table, intervals=(interval,), model_ratio=(20.0,))})
+ with pytest.raises(ValueError):
+ model.chain_policy_costs()
+
+
+ "change",
+ [
+ {"chain_coef": ()},
+ {"chain_coef": (ChainCoef(0, 0.2, 0),) * 4},
+ {"chain_coef": (ChainCoef(2, -0.2, 0),) * 4},
+ {"chain_coef": (ChainCoef(2, 0.2, math.nan),) * 4},
+ {"chain_ref_cost": 0.0},
+ {"chain_ref_cost": math.inf},
+ {"chain_cliff_min_cost": -0.1},
+ {"chain_cliff_ratio": 0.0},
+ {"chain_scale_tiny": math.nan},
+ {"chain_scale_small": 1.0},
+ {"chain_scale_medium": 1.4},
+ {"chain_tiny_max_bs": -1},
+ {"chain_tiny_max_bs": 1.5},
+ {"ragged_draft_relax": ()},
+ {"ragged_draft_relax": (0.75, math.inf, 0.75)},
+ ],
+)
+def test_invalid_chain_parameters(change):
+ with pytest.raises(ValueError):
+ _model(params=replace(CostModelParams(), **change)).chain_policy_costs()
+
+
+ "change",
+ [
+ {"chain_coef": (ChainCoef(2, 1e308, 0),) * 4},
+ {"chain_coef": (ChainCoef(1e308, 0.24, 1000),) * 4, "chain_ref_cost": 1e308},
+ ],
+)
+def test_nonfinite_derived_terms_rejected_without_state_changes(change):
+ model = _model(params=replace(CostModelParams(), **change))
+ before = copy.deepcopy(model.__dict__)
+ with pytest.raises(ValueError, match="chain stop terms"):
+ model.chain_policy_costs()
+ assert model.__dict__ == before
diff --git a/tests/test_chain_rounds.py b/tests/test_chain_rounds.py
new file mode 100644
index 0000000..a9f8750
--- /dev/null
+++ b/tests/test_chain_rounds.py
@@ -0,0 +1,87 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Chain calibration's round recorder (:mod:`eagle_harness.sglang.chain_rounds`) and the driver's fits, on CPU."""
+
+from __future__ import annotations
+
+import json
+
+import pytest
+import torch
+
+from eagle_harness.core.chain_width import load_accept_profile, load_round_times
+from eagle_harness.sglang import calibrate as sglang_calibrate
+from eagle_harness.sglang import chain_rounds
+from eagle_harness.sglang.chain_rounds import BLOCK_ROUNDS, MIN_ROUNDS, RAW_FILE, ChainCalibration, accept_counts
+
+
+def _calibration(tmp_path, widths=(1, 2, 4)):
+ return ChainCalibration(str(tmp_path), widths, torch.device("cpu"), writer=True)
+
+
+def test_widths_cycle_in_blocks():
+ cal = ChainCalibration("/unused", (4, 1, 2), torch.device("cpu"), writer=False)
+ plan = [cal.width(1) for _ in range(3 * BLOCK_ROUNDS + 1)]
+ assert plan == [1] * BLOCK_ROUNDS + [2] * BLOCK_ROUNDS + [4] * BLOCK_ROUNDS + [1]
+
+
+def test_only_rounds_between_two_like_rounds_are_recorded(tmp_path, monkeypatch):
+ clock = iter(range(0, 10**9, 1000)) # every round_start 1 us after the previous one
+ monkeypatch.setattr(chain_rounds.time, "perf_counter_ns", lambda: next(clock))
+ cal = _calibration(tmp_path)
+ for width in (1, 1, 1, 1, 2, 2, 2):
+ cal.round_start(8, width, 100)
+ # Width 1: rounds 2 and 3 are recorded (round 4 ends a block); width 2: round 6 needs round 7's start.
+ assert cal.rounds == [(8, 1, 1.0, 100), (8, 1, 1.0, 100), (8, 2, 1.0, 100)]
+ cal.interrupt() # a prefill: the period in progress is not a decode round's
+ cal.round_start(8, 2, 100)
+ cal.round_start(8, 2, 100)
+ assert len(cal.rounds) == 3
+ cal.round_start(4, 2, 100) # another batch size
+ cal.round_start(4, 2, 100)
+ assert len(cal.rounds) == 3
+
+
+def test_interrupt_writes_the_rounds_and_the_widest_accept_lengths(tmp_path):
+ cal = _calibration(tmp_path)
+ cal.accepted(4, torch.tensor([1, 4, 4, 2], dtype=torch.int32))
+ cal.accepted(2, torch.tensor([2, 2])) # not the widest: not counted
+ for _ in range(4):
+ cal.round_start(1, 4, 50)
+ cal.interrupt()
+ with open(tmp_path / RAW_FILE, encoding="utf-8") as f:
+ raw = json.load(f)
+ assert raw["accept_lens"] == [0, 1, 1, 0, 2] and raw["max_width"] == 4 and len(raw["rounds"]) == 2
+
+
+def test_flush_writes_the_round_times_of_complete_batch_sizes_and_the_profile(tmp_path):
+ cal = _calibration(tmp_path, widths=(1, 2, 4))
+ cal.rounds = [(1, w, us, 300) for w, us in ((1, 10000.0), (2, 12000.0), (4, 15000.0)) for _ in range(MIN_ROUNDS)]
+ cal.rounds += [(256, w, us, 300) for w, us in ((1, 40000.0), (2, 90000.0), (4, 170000.0)) for _ in range(8)]
+ cal.rounds += [(255, 1, 39000.0, 300)] * 20 # a tail batch size that did not time every width
+ cal.rounds += [(64, w, 1.0, 300) for w in (1, 2, 4) for _ in range(MIN_ROUNDS - 1)] # too few rounds
+ cal.accepted(4, torch.tensor([1] * 10 + [2] * 20 + [3] * 30 + [4] * 40))
+ cal.flush()
+ assert load_round_times(str(tmp_path)) == {
+ 1: {1: 10000.0, 2: 12000.0, 4: 15000.0},
+ 256: {1: 40000.0, 2: 90000.0, 4: 170000.0},
+ }
+ # 100 request-rounds; accepting drafted token 1: accept length >= 2 (90), token 2: >= 3 (70), token 3: 4 (40).
+ assert load_accept_profile(str(tmp_path)).rates == pytest.approx((0.9, 0.7, 0.4))
+ with open(tmp_path / "rounds" / "chain.json", encoding="utf-8") as f:
+ assert {r["count"] for r in json.load(f)["rounds"]} == {MIN_ROUNDS}
+
+
+def test_accept_counts_from_the_histogram():
+ assert accept_counts([0, 10, 20, 30, 40]) == (100, [90, 70, 40])
+ assert accept_counts([0, 5, 0]) == (5, [0])
+
+
+def test_report_prints_the_widths(tmp_path, capsys):
+ cal = _calibration(tmp_path, widths=(1, 2))
+ cal.rounds = [(8, 1, 10000.0, 9)] * MIN_ROUNDS + [(8, 2, 11000.0, 9)] * MIN_ROUNDS
+ cal.accepted(2, torch.tensor([2, 2, 2, 1]))
+ cal.flush()
+ sglang_calibrate.report(str(tmp_path), 2, 16)
+ assert "chain widths per batch size: [(1, 16, 2)]" in capsys.readouterr().out
diff --git a/tests/test_chain_width.py b/tests/test_chain_width.py
new file mode 100644
index 0000000..8f8441f
--- /dev/null
+++ b/tests/test_chain_width.py
@@ -0,0 +1,165 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Chain width per batch size from cost tables and an acceptance profile (:mod:`eagle_harness.core.chain_width`)."""
+
+from __future__ import annotations
+
+import json
+import os
+
+import pytest
+
+from eagle_harness.core.chain_width import (
+ AcceptProfile,
+ chain_width,
+ chain_width_schedule,
+ chain_widths,
+ load_accept_profile,
+ load_round_times,
+ save_accept_profile,
+ save_round_times,
+ served_chain_width,
+ served_width_schedule,
+ width_at,
+)
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, IntervalCost, load_cost_tables
+
+WIDTHS = (1, 2, 4, 8, 16)
+
+
+def _curve(index, value):
+ return CostCurve(
+ value=tuple(value), ratio=tuple(v / value[0] for v in value), index=tuple(index), array_query=(), array_cache=()
+ )
+
+
+def _table(bs: int, verify_us, draft_us: float | None, widths=WIDTHS) -> BatchCostTable:
+ """Two context intervals with the same costs: ``verify_us(width)`` for the target, ``draft_us`` per draft step."""
+ target = _curve([w - 1 for w in widths], [verify_us(w) for w in widths])
+ draft = _curve([0], [draft_us]) if draft_us is not None else _curve([1], [1.0])
+ rows = tuple(IntervalCost(target=target, draft=draft) for _ in range(2))
+ return BatchCostTable(bs, 256, 256, 16, 16, 1, rows, tuple(2.0 for _ in rows))
+
+
+PROFILE = AcceptProfile.from_counts(1000, [900 - 50 * d for d in range(15)]) # a_d = 0.90, 0.85, ..., 0.20
+
+
+def test_profile_counts_and_expected_tokens():
+ assert PROFILE.rates[:2] == (0.9, 0.85)
+ assert PROFILE.expected_tokens(1) == 1.0
+ assert PROFILE.expected_tokens(3) == pytest.approx(1.0 + 0.9 + 0.85)
+ with pytest.raises(ValueError):
+ PROFILE.expected_tokens(17) # 15 measured positions cover widths 1..16
+ with pytest.raises(ValueError):
+ AcceptProfile.from_counts(10, [5, 7]) # a later position cannot accept more often
+
+
+def test_weight_bound_batch_takes_the_widest_chain():
+ # Verify cost flat in the width (weight reads), cheap draft steps: every drafted token pays.
+ assert chain_width(_table(1, lambda w: 5000.0 + w, 20.0), PROFILE, 16) == 16
+
+
+def test_compute_bound_batch_falls_back_to_plain_decoding():
+ # Verify cost proportional to the tokens verified: a drafted token costs a full token and is accepted < 1.
+ assert chain_width(_table(512, lambda w: 3000.0 * w, 300.0), PROFILE, 16) == 1
+
+
+def test_width_balances_draft_cost_and_acceptance():
+ # 5000 us verify, 600 us per draft step; tokens / ms: width 1 0.20, 2 0.34, 4 0.52, 8 0.68 (6.25 / 9.2), 16 0.66.
+ assert chain_width(_table(64, lambda w: 5000.0, 600.0), PROFILE, 16) == 8
+
+
+def test_only_timed_and_profiled_widths_are_candidates():
+ short = AcceptProfile.from_counts(10, [9, 8, 7]) # widths 1..4
+ assert chain_width(_table(1, lambda w: 5000.0, 1.0), short, 16) == 4
+ assert chain_width(_table(1, lambda w: 5000.0, 1.0), PROFILE, 8) == 8 # max_width caps
+ assert chain_width(_table(1, lambda w: 5000.0, None), PROFILE, 16) is None # no draft step timed
+
+
+def test_schedule_uses_the_nearest_calibrated_batch_size():
+ tables = {1: _table(1, lambda w: 5000.0 + w, 20.0), 512: _table(512, lambda w: 3000.0 * w, 300.0)}
+ assert chain_width_schedule(tables, PROFILE, 16, 512) == [(1, 256, 16), (257, 512, 1)]
+ assert chain_width_schedule({}, PROFILE, 16, 512) is None
+
+
+def test_profile_and_tables_round_trip(tmp_path):
+ save_accept_profile(str(tmp_path), 1000, [900 - 50 * d for d in range(15)])
+ assert load_accept_profile(str(tmp_path)) == PROFILE
+ assert load_accept_profile(str(tmp_path / "missing")) is None
+ write_tables(str(tmp_path), {1: _table(1, lambda w: 5000.0 + w, 20.0)})
+ loaded = load_cost_tables(str(tmp_path / "cost"))
+ assert chain_width(loaded[1], PROFILE, 16) == 16
+
+
+def write_tables(data_path: str, tables) -> None:
+ """Write tables in the on-disk layout :func:`load_cost_tables` reads (``cost/bs_<N>/model_{llm,slm}/``)."""
+ for bs, table in tables.items():
+ for model, pick in (("llm", lambda i: i.target), ("slm", lambda i: i.draft)):
+ folder = os.path.join(data_path, "cost", f"bs_{bs}", f"model_{model}")
+ os.makedirs(folder, exist_ok=True)
+ for n, interval in enumerate(table.intervals):
+ curve = pick(interval)
+ data = {
+ "value": list(curve.value),
+ "ratio": list(curve.ratio),
+ "index": list(curve.index),
+ "array_query": [],
+ "array_cache": [],
+ "cache_length_start": table.cache_length_start,
+ "cache_length_step": table.cache_length_step,
+ "max_query_length_query": 16,
+ "max_query_length_cache": 16,
+ }
+ with open(os.path.join(folder, f"model_interval_{n}.json"), "w", encoding="utf-8") as f:
+ json.dump(data, f)
+
+
+# ------------------------------------------------------------------ served round times
+def test_served_width_takes_the_most_tokens_per_microsecond():
+ # tokens / ms: width 1 0.100 (10 ms), 2 0.158 (1.9 / 12 ms), 4 0.203 (3.65 / 18 ms), 8 0.196 (6.25 / 32 ms).
+ assert served_chain_width({1: 10000.0, 2: 12000.0, 4: 18000.0, 8: 32000.0}, PROFILE, 8) == 4
+ assert served_chain_width({1: 10000.0, 2: 12000.0, 4: 18000.0, 8: 32000.0}, PROFILE, 2) == 2 # max_width caps
+
+
+def test_served_width_stops_speculating_when_every_chain_loses():
+ # A compute-bound batch: each drafted token costs more than it gains, so plain decoding wins.
+ assert served_chain_width({1: 10000.0, 2: 21000.0, 4: 40000.0}, PROFILE, 8) == 1
+
+
+def test_served_width_needs_the_plain_decoding_round():
+ assert served_chain_width({2: 12000.0, 4: 18000.0}, PROFILE, 8) is None
+ assert served_width_schedule({1: {1: 10.0, 2: 9.0}, 64: {2: 9.0}}, PROFILE, 8, 64) is None
+
+
+def test_served_schedule_ranges_follow_the_nearest_measured_batch_size():
+ rounds = {1: {1: 10000.0, 4: 12000.0}, 64: {1: 20000.0, 4: 30000.0}, 256: {1: 40000.0, 4: 160000.0}}
+ schedule = served_width_schedule(rounds, PROFILE, 8, 256)
+ assert schedule == [(1, 159, 4), (160, 256, 1)] # 160 is a tie between 64 and 256: the larger wins
+ assert width_at(schedule, 1) == 4 and width_at(schedule, 200) == 1
+ with pytest.raises(ValueError):
+ width_at(schedule, 257)
+
+
+def test_round_times_round_trip_and_win_over_the_tables(tmp_path):
+ data = str(tmp_path)
+ assert load_round_times(data) is None
+ write_tables(str(tmp_path), {1: _table(1, lambda w: 5000.0 + w, 20.0)}) # the tables alone would pick width 8
+ save_accept_profile(data, 1000, [900 - 50 * d for d in range(15)])
+ assert chain_widths(data, 8, 4) == [(1, 4, 8)]
+ save_round_times(
+ data,
+ [
+ {"batch_size": 1, "width": 1, "round_us": 1000.0, "count": 9},
+ {"batch_size": 1, "width": 8, "round_us": 9000.0, "count": 9},
+ ],
+ )
+ assert load_round_times(data) == {1: {1: 1000.0, 8: 9000.0}}
+ assert chain_widths(data, 8, 4) == [(1, 4, 1)] # the served rounds price width 8 at a loss
+ with pytest.raises(ValueError):
+ save_round_times(data, [{"batch_size": 1, "width": 1, "round_us": 0.0, "count": 1}])
+
+
+def test_chain_widths_need_the_acceptance_profile(tmp_path):
+ save_round_times(str(tmp_path), [{"batch_size": 1, "width": 1, "round_us": 1000.0, "count": 9}])
+ assert chain_widths(str(tmp_path), 8, 4) is None
diff --git a/tests/test_check_headers.py b/tests/test_check_headers.py
new file mode 100644
index 0000000..a3a2982
--- /dev/null
+++ b/tests/test_check_headers.py
@@ -0,0 +1,227 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Exercise the header checker as a CLI in isolated Git repositories."""
+
+from pathlib import Path
+import subprocess
+import sys
+
+import pytest
+
+CHECKER = Path(__file__).resolve().parents[1] / "tools" / "check_headers.py"
+EAGLE = "# Copyright 2026 Eagle AI Corp.\n# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available\n"
+
+
+def repo(tmp_path):
+ subprocess.run(["git", "init", "-q", str(tmp_path)], check=True)
+ return tmp_path
+
+
+def run_checker(repo, *args):
+ return subprocess.run([sys.executable, str(CHECKER), *args], cwd=repo, capture_output=True, text=True)
+
+
+def test_check_fix_and_idempotence(repo):
+ source = repo / "example.py"
+ original = b'#!/usr/bin/env python3\n# coding: utf-8\n"""Module docstring."""\nfrom __future__ import annotations\n'
+ source.write_bytes(original)
+ source.chmod(0o755)
+ result = run_checker(repo)
+ assert result.returncode == 1
+ assert "example.py" in result.stdout
+ assert source.read_bytes() == original
+ result = run_checker(repo, "--fix")
+ assert result.returncode == 0, result.stderr + result.stdout
+ expected = original.replace(b"# coding: utf-8\n", b"# coding: utf-8\n" + EAGLE.encode() + b"\n")
+ assert source.read_bytes() == expected
+ assert source.stat().st_mode & 0o777 == 0o755
+ assert run_checker(repo).returncode == 0
+ assert run_checker(repo, "--fix").returncode == 0
+ assert source.read_bytes() == expected
+
+
+ "original",
+ [
+ "# SPDX-FileCopyrightText: Copyright SGLang Team\n# Derived from upstream. Modified by Eagle AI Corp.\n",
+ "# SPDX-FileCopyrightText: Copyright FlashInfer community\n# SPDX-License-Identifier: Apache-2.0\n",
+ "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n",
+ "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n"
+ "# Modified by Eagle AI Corp.\n",
+ ],
+)
+def test_preserves_upstream_notices(repo, original):
+ source = repo / "kernel.py"
+ original += '"""Kernel."""\n'
+ source.write_text(original)
+ for args in [(), ("--fix",), ("--fix",)]:
+ result = run_checker(repo, *args)
+ assert result.returncode == 0, result.stdout + result.stderr
+ assert source.read_text() == original
+
+
+ "notice",
+ [
+ "# Copyright LightSeek Foundation\n# SPDX-License-Identifier: MIT\n",
+ "# Derived from TokenSpeed\n",
+ "# Copyright Some Other Company\n",
+ "# SPDX-License-Identifier: Apache-2.0\n",
+ ],
+)
+def test_refuses_unapproved_provenance_without_writing(repo, notice):
+ source = repo / "eagle_harness" / "kernel.py"
+ source.parent.mkdir()
+ source.write_text(notice + "x = 1\n")
+ before = source.read_bytes()
+ for args in [(), ("--fix",)]:
+ result = run_checker(repo, *args)
+ assert result.returncode == 1
+ assert "eagle_harness/kernel.py" in result.stdout
+ assert source.read_bytes() == before
+
+
+ "notice",
+ [
+ EAGLE + "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n",
+ EAGLE + "# SPDX-FileCopyrightText: Copyright SGLang Team\n",
+ "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0-or-later\n",
+ "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# Copyright Someone Else\n"
+ "# SPDX-License-Identifier: Apache-2.0\n",
+ ],
+)
+def test_refuses_conflicting_upstream_headers(repo, notice):
+ path = repo / "upstream.py"
+ path.write_text(notice + "pass\n")
+ original = path.read_bytes()
+ for args in [(), ("--fix",)]:
+ result = run_checker(repo, *args)
+ assert result.returncode == 1
+ assert "upstream.py" in result.stdout
+ assert path.read_bytes() == original
+
+
+ "name,body",
+ [
+ ("docs/example.py", "x = 1\n"),
+ ("LICENSES/example.py", "# third-party text\n"),
+ ("scripts/data/example.py", "x = 1\n"),
+ ("test.json", "{}\n"),
+ ("scripts/notes.md", "notes\n"),
+ ("generated.py", "# Generated by a code generator. DO NOT EDIT.\nx = 1\n"),
+ ],
+)
+def test_skips_non_source_and_generated_files(repo, name, body):
+ path = repo / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(body)
+ assert run_checker(repo, "--fix").returncode == 0
+ assert path.read_text() == body
+ assert run_checker(repo).returncode == 0
+
+
+ "name,preamble,body",
+ [
+ ("kernel.cu", b"", b"int x;\n"),
+ ("kernel.hpp", b"", b"#pragma once\n"),
+ ("run.sh", b"#!/bin/sh\n", b"exit 0\n"),
+ ("plan.env", b"", b"export OMP_NUM_THREADS=4\n"),
+ ("run", b"#!/usr/bin/env python3\n", b"pass\n"),
+ ("rules.sky", b"", b"x = 1\n"),
+ ("docker/test.Dockerfile", b"", b"FROM scratch\n"),
+ ("Dockerfile", b"# syntax=docker/dockerfile:1\n", b"FROM scratch\n"),
+ (
+ "docker/directives.Dockerfile",
+ b"# syntax=docker/dockerfile:1\n# escape=`\n# check=error=true\n",
+ b"FROM scratch\n",
+ ),
+ ("Dockerfile", b"# SyNtAx = docker/dockerfile:1\n", b"FROM scratch\n"),
+ ("scripts/helper.py", b"", b"pass\n"),
+ ("latin.py", b"# coding: latin-1\n", b"# caf\xe9\npass\n"),
+ ("bom.py", b"\xef\xbb\xbf", b"pass\n"),
+ ("crlf.py", b"#!/usr/bin/env python3\r\n", b"pass\r\n"),
+ ("comment.py", b"", b"# default width: derived from the cost table\npass\n"),
+ ("empty.py", b"", b""),
+ ],
+)
+def test_source_forms_preserve_bytes(repo, name, preamble, body):
+ path = repo / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_bytes(preamble + body)
+ result = run_checker(repo, "--fix")
+ assert result.returncode == 0, result.stdout + result.stderr
+ header = EAGLE.replace("#", "//") if path.suffix in (".cu", ".hpp") else EAGLE
+ newline = b"\r\n" if b"\r\n" in preamble else b"\n"
+ separator = newline if body else b""
+ assert path.read_bytes() == preamble + header.encode().replace(b"\n", newline) + separator + body
+ assert run_checker(repo).returncode == 0
+
+
[email protected]("newline", [b"\n", b"\r\n", b"\r"])
+def test_preserves_newlines_and_unterminated_source(repo, newline):
+ path = repo / "unterminated.py"
+ preamble = b"#!/usr/bin/env python3" + newline + b"# coding: utf-8" + newline
+ body = b'"""Module docstring."""' + newline + b"pass"
+ path.write_bytes(preamble + body)
+ result = run_checker(repo, "--fix")
+ assert result.returncode == 0, result.stdout + result.stderr
+ assert path.read_bytes() == preamble + EAGLE.encode().replace(b"\n", newline) + newline + body
+ assert run_checker(repo).returncode == 0
+
+
[email protected]("tracked", [False, True])
+ "header",
+ [
+ "",
+ "# Copyright 2026 Eagle AI Corp.\n# SPDX-License-Identifier: MIT\n",
+ "# Copyright 2025 Eagle AI Corp.\n# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available\n",
+ "# Copyright 2026 Not Eagle Corp.\n# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available\n",
+ ],
+)
+def test_rejects_missing_or_incorrect_new_headers(repo, tracked, header):
+ path = repo / "new.py"
+ path.write_text(header + "pass\n")
+ if tracked:
+ subprocess.run(["git", "add", "new.py"], cwd=repo, check=True)
+ original = path.read_bytes()
+ result = run_checker(repo)
+ assert result.returncode == 1
+ assert "new.py" in result.stdout
+ assert path.read_bytes() == original
+ if header:
+ assert run_checker(repo, "--fix").returncode == 1
+ assert path.read_bytes() == original
+
+
+def test_skips_ignored_files_and_symlinks_but_checks_tracked(repo):
+ (repo / ".gitignore").write_text("ignored.py\ntracked.py\n")
+ ignored = repo / "ignored.py"
+ ignored.write_text("pass\n")
+ (repo / "link.py").symlink_to(ignored)
+ assert run_checker(repo, "--fix").returncode == 0
+ assert ignored.read_text() == "pass\n"
+ assert (repo / "link.py").is_symlink()
+ (repo / "tracked.py").write_text("pass\n")
+ subprocess.run(["git", "add", "-f", "tracked.py"], cwd=repo, check=True)
+ result = run_checker(repo)
+ assert result.returncode == 1
+ assert "tracked.py" in result.stdout
+
+
[email protected]("partial", EAGLE.splitlines(keepends=True))
+def test_repairs_partial_eagle_header_without_duplicate(repo, partial):
+ path = repo / "partial.py"
+ path.write_text(partial + "pass\n")
+ result = run_checker(repo)
+ assert result.returncode == 1
+ assert path.read_text() == partial + "pass\n"
+ result = run_checker(repo, "--fix")
+ assert result.returncode == 0, result.stdout + result.stderr
+ assert path.read_text() == EAGLE + "\npass\n"
+ assert run_checker(repo).returncode == 0
diff --git a/tests/test_cli.py b/tests/test_cli.py
new file mode 100644
index 0000000..cd70dc6
--- /dev/null
+++ b/tests/test_cli.py
@@ -0,0 +1,277 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The public command must work without importing an engine for help or planning."""
+
+import json
+import os
+import shlex
+import subprocess
+import sys
+import time
+
+import pytest
+
+from eagle_harness import cli
+
+
[email protected]("command", [[], ["calibrate"]])
+def test_help_without_engine_imports(command):
+ result = subprocess.run(
+ [sys.executable, "-m", "eagle_harness.cli", *command, "--help"], capture_output=True, text=True, check=False
+ )
+ assert result.returncode == 0
+ assert "calibrat" in result.stdout
+
+
[email protected]("engine", ["vllm", "sglang"])
+def test_dry_run_is_shell_safe_and_writes_nothing(engine, tmp_path, capsys):
+ output = tmp_path / "has spaces"
+ model = "model's directory; not a command"
+ assert (
+ cli.main(
+ [
+ "calibrate",
+ "--engine",
+ engine,
+ "--model",
+ model,
+ "--draft",
+ "draft with spaces",
+ "--output",
+ str(output),
+ "--dry-run",
+ ]
+ )
+ == 0
+ )
+ command = shlex.split(capsys.readouterr().out.splitlines()[-1])
+ assert model in command
+ assert not output.exists()
+ if engine == "vllm":
+ spec = json.loads(command[command.index("--speculative-config") + 1])
+ assert spec["model"] == "draft with spaces"
+ assert spec["method_config"]["data_path"] == str(output)
+ else:
+ config = json.loads(command[command.index("--speculative-algorithm-config") + 1])
+ assert config["mode"] == "serve"
+ assert config["intensity"] == "chain_intensity"
+ # The chain's GDN verify commits by replay (no per-draft state snapshots); an engine-args False drops it.
+ assert "--enable-linear-replayssm-spec" in command
+
+
+def test_sglang_engine_args_can_drop_the_replay_verify(capsys):
+ assert (
+ cli.main(
+ ["calibrate", "--engine", "sglang", "--model", "m", "--draft", "d", "--dry-run",
+ "--engine-args", '{"enable_linear_replayssm_spec": false}']
+ )
+ == 0
+ )
+ command = shlex.split(capsys.readouterr().out.splitlines()[-1])
+ assert "--enable-linear-replayssm-spec" not in command
+
+
+ "extra", [["--tp", "0"], ["--batch-sizes", "0,1"], ["--batch-sizes", "513"], ["--engine-args", "[]"]]
+)
+def test_invalid_arguments_fail_before_loading(extra, tmp_path):
+ with pytest.raises(SystemExit) as exc:
+ cli.main(["calibrate", "--model", "m", "--draft", "d", "--engine", "vllm", "--dry-run", *extra])
+ assert exc.value.code == 2
+
+
+ "extra",
+ [
+ ["--batch-sizes", "1,8"],
+ ["--data", "x.jsonl"],
+ ["--engine-args", '{"model":"other"}'],
+ ["--engine-args", '{"speculative_config":{}}'],
+ ],
+)
+def test_refuses_mismatched_calibration_settings(extra, capsys):
+ assert cli.main(["calibrate", "--model", "m", "--draft", "d", "--engine", "vllm", "--dry-run", *extra]) == 1
+ assert "eagle-harness:" in capsys.readouterr().err
+
+
+def test_auto_detection_requires_exactly_one_engine(monkeypatch):
+ monkeypatch.setattr(cli.importlib.util, "find_spec", lambda name: object() if name == "vllm" else None)
+ assert cli._engine(None) == "vllm"
+ monkeypatch.setattr(cli.importlib.util, "find_spec", lambda name: object())
+ with pytest.raises(ValueError, match="choose --engine"):
+ cli._engine(None)
+ assert cli._engine("sglang") == "sglang"
+ monkeypatch.setattr(cli.importlib.util, "find_spec", lambda name: None)
+ with pytest.raises(ValueError, match="not installed"):
+ cli._engine("vllm")
+
+
+def test_refuses_existing_output(monkeypatch, tmp_path):
+ monkeypatch.setattr(cli, "_engine", lambda name: "vllm")
+ sentinel = tmp_path / "keep"
+ sentinel.write_text("untouched")
+ assert cli.main(["calibrate", "--model", "m", "--draft", "d", "--output", str(tmp_path)]) == 1
+ assert sentinel.read_text() == "untouched"
+
+
+def test_failed_measurement_does_not_publish_serve_command(monkeypatch, tmp_path):
+ monkeypatch.setattr(cli, "_engine", lambda name: "vllm")
+ calls = []
+
+ def failed_run(command, log, timeout):
+ calls.append(command)
+ raise RuntimeError("worker failed")
+
+ monkeypatch.setattr(cli, "_run", failed_run)
+ output = tmp_path / "cal"
+ assert cli.main(["calibrate", "--model", "m", "--draft", "d", "--output", str(output)]) == 1
+ assert len(calls) == 1
+ assert not (output / "serve.sh").exists()
+ assert json.loads((output / "settings.json").read_text())["model"] == "m"
+
+
+def test_vllm_sweeps_every_required_width_before_fitting(monkeypatch, tmp_path):
+ monkeypatch.setattr(cli, "_engine", lambda name: "vllm")
+ calls = []
+
+ def collect(command, log, timeout):
+ calls.append(command)
+ if "fit" in command:
+ from eagle_harness.core.calibration import AttentionShape
+ from eagle_harness.vllm.calibrate import fit, sweep
+
+ def rows(widths):
+ return [
+ {"query_length": q, "cache_length": length, "time_us": 100 + 5 * q + length / 100}
+ for q in widths
+ for length in sweep(context_stop=4096)
+ ]
+
+ fit(
+ str(tmp_path / "cal"),
+ rows([1, 8, 16, 32, 64]),
+ rows([1, 2, 4, 8]),
+ AttentionShape(4),
+ AttentionShape(1),
+ 2,
+ context_stop=4096,
+ )
+
+ monkeypatch.setattr(cli, "_run", collect)
+ output = tmp_path / "cal"
+ assert cli.main(["calibrate", "--model", "m", "--draft", "d", "--tp", "2", "--output", str(output)]) == 0
+ assert [int(command[-1]) for command in calls[:-1]] == [8, 16, 32, 64]
+ assert calls[-1].count("fit") == 1
+ assert all(command[command.index("--tp") + 1] == "2" for command in calls)
+ assert "exec env VLLM_USE_V2_MODEL_RUNNER=1" in (output / "serve.sh").read_text()
+
+
[email protected](os.name != "posix", reason="GPU workers use POSIX process groups")
+def test_sigterm_stops_owned_worker(tmp_path):
+ pidfile = tmp_path / "worker.pid"
+ worker = f"import os,time; from pathlib import Path; Path({str(pidfile)!r}).write_text(str(os.getpid())); time.sleep(120)"
+ program = (
+ "from eagle_harness import cli; import sys; "
+ "cli._engine=lambda name: 'vllm'; "
+ f"cli._vllm=lambda args: cli._run([sys.executable, '-c', {worker!r}], args.output/'test.log', 120); "
+ f"raise SystemExit(cli.main(['calibrate','--model','m','--draft','d','--output',{str(tmp_path / 'cal')!r}]))"
+ )
+ parent = subprocess.Popen([sys.executable, "-c", program], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ try:
+ deadline = time.monotonic() + 10
+ while not pidfile.exists() and parent.poll() is None and time.monotonic() < deadline:
+ time.sleep(0.05)
+ assert pidfile.exists()
+ pid = int(pidfile.read_text())
+ parent.terminate()
+ parent.communicate(timeout=40)
+ assert parent.returncode != 0
+ with pytest.raises(ProcessLookupError):
+ os.kill(pid, 0)
+ assert not (tmp_path / "cal/serve.sh").exists()
+ finally:
+ if parent.poll() is None:
+ parent.kill()
+ parent.communicate(timeout=5)
+
+
+def test_process_failure_is_not_success(tmp_path):
+ with pytest.raises(RuntimeError, match="exited 7"):
+ cli._run([sys.executable, "-c", "raise SystemExit(7)"], tmp_path / "failure.log", 5)
+
+
[email protected](os.name != "posix", reason="GPU engine workers use POSIX process groups")
+def test_process_cleanup_on_exception(tmp_path):
+ with (
+ pytest.raises(RuntimeError, match="stop"),
+ cli._process([sys.executable, "-c", "import time; time.sleep(30)"], tmp_path / "process.log") as process,
+ ):
+ pid = process.pid
+ raise RuntimeError("stop")
+ with pytest.raises(ProcessLookupError):
+ os.kill(pid, 0)
+
+
+ "options,expected",
+ [
+ ({"enable_prefix_caching": False}, ["--no-enable-prefix-caching"]),
+ ({"hf_overrides": {"sliding_window": 2048}}, ["--hf-overrides", '{"sliding_window": 2048}']),
+ ],
+)
+def test_vllm_overrides_survive_command_rendering(options, expected, capsys):
+ assert (
+ cli.main(
+ [
+ "calibrate",
+ "--model",
+ "m",
+ "--draft",
+ "d",
+ "--engine",
+ "vllm",
+ "--engine-args",
+ json.dumps(options),
+ "--dry-run",
+ ]
+ )
+ == 0
+ )
+ command = shlex.split(capsys.readouterr().out.splitlines()[-1])
+ index = command.index(expected[0])
+ assert command[index : index + len(expected)] == expected
+
+
+def test_empty_cost_tables_do_not_publish_serve_command(monkeypatch, tmp_path):
+ monkeypatch.setattr(cli, "_engine", lambda name: "vllm")
+
+ def empty_fit(command, log, timeout):
+ if "fit" in command:
+ path = tmp_path / "cal/cost/bs_1/model_llm"
+ path.mkdir(parents=True)
+ (path / "model_interval_0.json").write_text("{}")
+
+ monkeypatch.setattr(cli, "_run", empty_fit)
+ assert cli.main(["calibrate", "--model", "m", "--draft", "d", "--output", str(tmp_path / "cal")]) == 1
+ assert not (tmp_path / "cal/serve.sh").exists()
+
+
+def test_engine_option_spelling_cannot_override_reserved_controls(capsys):
+ assert (
+ cli.main(
+ [
+ "calibrate",
+ "--model",
+ "m",
+ "--draft",
+ "d",
+ "--engine",
+ "sglang",
+ "--dry-run",
+ "--engine-args",
+ '{"model-path":"other"}',
+ ]
+ )
+ == 1
+ )
diff --git a/tests/test_compat.py b/tests/test_compat.py
new file mode 100644
index 0000000..0f2305c
--- /dev/null
+++ b/tests/test_compat.py
@@ -0,0 +1,98 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The load-time host check (eagle_harness/compat.py) against fake hosts: runs without sglang or vLLM."""
+
+from __future__ import annotations
+
+import logging
+import sys
+import types
+
+import pytest
+from packaging.specifiers import SpecifierSet
+
+from eagle_harness import __version__, compat
+
+FAKE = compat.Host("fakehost", SpecifierSet(">=1.2.dev0"), "fakehost main abc123", "fakehost_hooks:problems")
+
+
+def fake_host(monkeypatch):
+ """Installs a host module ``fakehost`` and its hook check; returns a setter for (version, problems)."""
+ host_module, hooks_module = types.ModuleType("fakehost"), types.ModuleType("fakehost_hooks")
+ monkeypatch.setitem(sys.modules, "fakehost", host_module)
+ monkeypatch.setitem(sys.modules, "fakehost_hooks", hooks_module)
+ monkeypatch.setattr(compat, "HOSTS", (FAKE,))
+
+ def install(version, problems):
+ host_module.__version__ = version
+ hooks_module.problems = lambda: list(problems)
+
+ return install
+
+
+def test_matching_host_registers_quietly(fake_host, caplog):
+ fake_host("1.3.0", [])
+ report = compat.check("fakehost")
+ assert report.ok and report.tested_version
+ with caplog.at_level(logging.WARNING):
+ assert compat.check_for_registration("fakehost") is True
+ assert caplog.text == ""
+
+
+def test_missing_hook_refuses_with_version_problems_and_fix(fake_host, caplog):
+ fake_host("1.1.0", ["fakehost:Worker.step is missing"])
+ assert compat.check_for_registration("fakehost") is False
+ message = caplog.text
+ assert f"eagle-harness {__version__} is disabled" in message
+ assert "fakehost 1.1.0 lacks 1 of the hooks" in message and "fakehost:Worker.step is missing" in message
+ assert "fakehost>=1.2.dev0" in message and "tested: fakehost main abc123" in message
+
+
+def test_untested_version_with_matching_hooks_warns_and_registers(fake_host, caplog):
+ fake_host("0.0.0.dev0", []) # a source checkout without git tags
+ assert compat.check_for_registration("fakehost") is True
+ assert "fakehost 0.0.0.dev0 is outside the tested versions" in caplog.text
+
+
[email protected]("version", ["dev", "unknown"])
+def test_unparsable_version_is_untested_not_an_error(fake_host, version):
+ fake_host(version, [])
+ report = compat.check("fakehost")
+ assert report.ok and not report.tested_version
+
+
+def test_cli_exit_codes(fake_host, capsys):
+ fake_host("1.3.0", [])
+ assert compat.main([]) == 0
+ assert "fakehost 1.3.0: ok, every hook matches" in capsys.readouterr().out
+ fake_host("1.3.0", ["fakehost:Worker.step is missing"])
+ assert compat.main([]) == 1
+ assert "fakehost 1.3.0: FAILED" in capsys.readouterr().out
+
+
+def test_cli_fails_without_any_host(monkeypatch, capsys):
+ monkeypatch.setattr(compat, "HOSTS", (compat.Host("nosuchhost", SpecifierSet(">=1"), "-", "nosuchhost:x"),))
+ assert compat.main([]) == 1
+ out = capsys.readouterr().out
+ assert "nosuchhost: not installed" in out and "no supported host installed" in out
+
+
+def test_every_host_check_resolves():
+ for host in compat.HOSTS:
+ assert callable(compat._resolve(host.problems))
+
+
[email protected]("name", [h.name for h in compat.HOSTS])
+def test_host_range_matches_its_extra(name):
+ from importlib.metadata import PackageNotFoundError, requires
+
+ from packaging.requirements import Requirement
+
+ try:
+ declared = requires("eagle-harness") or []
+ except PackageNotFoundError:
+ pytest.skip("eagle-harness is not installed")
+ (extra,) = [r for r in map(Requirement, declared) if r.name == name and r.marker is not None]
+ assert extra.specifier == compat.host(name).versions
diff --git a/tests/test_config.py b/tests/test_config.py
new file mode 100644
index 0000000..8d2cce6
--- /dev/null
+++ b/tests/test_config.py
@@ -0,0 +1,110 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""HarnessConfig parsing and cost-model construction."""
+
+from __future__ import annotations
+
+import dataclasses
+import json
+
+import pytest
+
+from eagle_harness.core.config import (
+ HarnessConfig,
+ Mode,
+ build_cost_model,
+ config_to_dict,
+ harness_config_from_dict,
+ parse_harness_config,
+)
+from eagle_harness.core.cost_model import CostModelParams
+from eagle_harness.core.limits import ComputeIntensity
+
+
+def test_inline_json_and_file(tmp_path):
+ raw = {
+ "data_path": "/cost/qwen",
+ "intensity": "chain_intensity",
+ "mode": "eval",
+ "cost_model": {"threshold": 3, "chain_tiny": [2.7, 0.2, 0.0]},
+ "draft_model": {"embed_full": False},
+ }
+ cfg = parse_harness_config(json.dumps(raw))
+ assert cfg.intensity is ComputeIntensity.CHAIN and cfg.mode is Mode.EVAL
+ assert cfg.cost_model.threshold == 3.0 and cfg.cost_model.chain_tiny == (2.7, 0.2, 0.0)
+ assert cfg.draft_model.embed_full is False
+ path = tmp_path / "harness.json"
+ path.write_text(json.dumps(raw))
+ assert parse_harness_config(str(path)) == cfg
+ assert harness_config_from_dict(config_to_dict(cfg)) == cfg
+
+
+ "raw, message",
+ [
+ ({"data_path": "/x", "thresold": 1}, "unknown keys"),
+ ({"data_path": "/x", "cost_model": {"chain_tiny": [1, 2]}}, "list of 3"),
+ ({"data_path": "/x", "intensity": "mid"}, "not one of"),
+ ({"data_path": "/x", "ragged": {"enabled": "yes"}}, "true/false"),
+ ({"data_path": "/x", "cost_model": {"chain_tiny_max_bs": 2.5}}, "integer"),
+ ({"data_path": "/x", "draft_model": {"moe_gate_acc": "fp16"}}, "moe_gate_acc"),
+ ({"data_path": "/x", "fast_paths": {"verify_argmax": False}}, "unknown keys"),
+ ],
+)
+def test_rejects_bad_config(raw, message):
+ with pytest.raises(ValueError, match=message):
+ parse_harness_config(json.dumps(raw))
+
+
+def test_rejects_missing_and_non_object():
+ with pytest.raises(ValueError, match="needs --speculative-algorithm-config"):
+ parse_harness_config(None)
+ with pytest.raises(ValueError, match="JSON object"):
+ parse_harness_config("[1, 2]")
+ with pytest.raises(ValueError, match="not valid JSON"):
+ parse_harness_config("{nope")
+
+
+def test_cost_model_params_defaults_match_fork_constants():
+ cfg = HarnessConfig(data_path="/x")
+ assert cfg.cost_model.params(0.04) == CostModelParams(depth_loss_ratio=0.04)
+
+
+def test_build_cost_model(tmp_path):
+ cfg = HarnessConfig(data_path=str(tmp_path), mode=Mode.EVAL, intensity=ComputeIntensity.CHAIN)
+ cm = build_cost_model(
+ cfg,
+ node_top_k=1,
+ tree_depth=15,
+ verify_num=16,
+ target_is_moe=True,
+ ragged_attention_supported=True,
+ eval_batch_size=8,
+ )
+ assert cm.tables == {} and cm.table(1) is None
+ assert cm.ragged and cm.eval_batch_size == 8
+ # chain: 0.04 doubled for chain / MoE then halved for chain
+ assert cm.params.depth_loss_ratio == pytest.approx(0.04)
+ serve = build_cost_model(
+ dataclasses.replace(cfg, mode=Mode.SERVE),
+ node_top_k=1,
+ tree_depth=15,
+ verify_num=16,
+ target_is_moe=False,
+ ragged_attention_supported=True,
+ eval_batch_size=8,
+ )
+ assert not serve.ragged and serve.eval_batch_size is None
+
+
+def test_l2_warm_plan_parses_and_defaults_to_the_fork_gate_up_warm_ahead():
+ default = parse_harness_config(json.dumps({"data_path": "/x"})).l2_warm
+ assert default.gate_up_gdn == (0.42, 16) and default.gate_up_attention == (0.3, 74)
+ assert default.down_proj is None and default.next_input is None
+ plan = parse_harness_config(
+ json.dumps({"data_path": "/x", "l2_warm": {"down_proj": [0.5, 8], "gate_up_gdn": None}})
+ ).l2_warm
+ assert plan.down_proj == (0.5, 8) and plan.gate_up_gdn is None
+ with pytest.raises(ValueError, match="list of 2"):
+ parse_harness_config(json.dumps({"data_path": "/x", "l2_warm": {"down_proj": [0.5]}}))
diff --git a/tests/test_config_cleanup.py b/tests/test_config_cleanup.py
new file mode 100644
index 0000000..b8e592a
--- /dev/null
+++ b/tests/test_config_cleanup.py
@@ -0,0 +1,38 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Removed options fail clearly; context extrapolation is visible."""
+
+import dataclasses
+
+import pytest
+
+from eagle_harness.core.config import harness_config_from_dict
+from eagle_harness.core.cost_model import CostModel
+from tests.test_chain_width import _table
+
+
[email protected]("key,value", [("moe_top_k", 6), ("packed_candidate_gather", False)])
+def test_removed_draft_options_are_unknown(key, value):
+ with pytest.raises(ValueError, match="unknown keys"):
+ harness_config_from_dict({"mode": "static", "draft_model": {key: value}})
+
+
+def test_unused_ragged_history_is_not_model_state():
+ assert "ragged_recent_verify_nums" not in {field.name for field in dataclasses.fields(CostModel)}
+
+
+def test_tail_word_covers_the_verify_limit():
+ from eagle_harness.core.limits import MAX_VERIFY_NUM, TAIL_MASK_BITS
+
+ assert MAX_VERIFY_NUM <= TAIL_MASK_BITS == 64
+
+
+def test_context_clamp_warns_once_per_table(caplog):
+ table = _table(1, lambda w: 100.0, 10.0)
+ assert table.interval_index(511) == 0
+ assert not caplog.records
+ assert table.interval_index(768) == 1
+ assert table.interval_index(1024) == 1
+ assert len(caplog.records) == 1
+ assert "clamp" in caplog.text and "768" in caplog.text
diff --git a/tests/test_cost_golden.py b/tests/test_cost_golden.py
new file mode 100644
index 0000000..7f99fe4
--- /dev/null
+++ b/tests/test_cost_golden.py
@@ -0,0 +1,178 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Cost model and calibration against golden fixtures.
+
+``tests/golden/fork_golden.json`` holds the expected outputs on the data in ``tests/synthetic.py``.
+"""
+
+from __future__ import annotations
+
+import json
+import os
+
+import pytest
+
+from eagle_harness.core.calibration import AttentionShape, CalibrationPaths, fit_batch, remove_outliers
+from eagle_harness.core.cost_model import CostModel, CostModelParams, ragged_verify_budget
+from eagle_harness.core.cost_table import load_cost_tables
+from eagle_harness.core.limits import ComputeIntensity, verify_buckets
+from tests import synthetic
+
+GOLDEN_PATH = os.path.join(os.path.dirname(__file__), "golden", "fork_golden.json")
+INTENSITIES = {
+ ComputeIntensity.HIGH: [1, 2, 4, 8, 16, 32],
+ ComputeIntensity.CHAIN: [1, 4, 16, 64],
+}
+
+
[email protected](scope="module")
+def golden():
+ with open(GOLDEN_PATH, encoding="utf-8") as f:
+ return json.load(f)
+
+
+def _calibrate(tmp_path, intensity: ComputeIntensity) -> str:
+ root = str(tmp_path / intensity.value)
+ paths = CalibrationPaths(root)
+ for bs in INTENSITIES[intensity]:
+ params = synthetic.write_raw_measurements(root, bs, intensity, seed=7)
+ fit_batch(paths, params, intensity, AttentionShape(1), AttentionShape(synthetic.TARGET_LAYERS))
+ return root
+
+
+def _tree(root: str) -> dict:
+ files = {}
+ for dirpath, _, names in os.walk(root):
+ for name in names:
+ full = os.path.join(dirpath, name)
+ with open(full, encoding="utf-8") as f:
+ files[os.path.relpath(full, root)] = f.read()
+ return files
+
+
[email protected](scope="module", params=list(INTENSITIES), ids=lambda i: i.value)
+def calibrated(request, tmp_path_factory):
+ intensity = request.param
+ return intensity, _calibrate(tmp_path_factory.mktemp("cal"), intensity)
+
+
+def test_fitted_cost_files_are_byte_identical(golden, calibrated):
+ intensity, root = calibrated
+ mine = _tree(os.path.join(root, "cost"))
+ expected = golden[f"cost_files_{intensity.value}"]
+ assert sorted(mine) == sorted(expected)
+ for name in expected:
+ assert mine[name] == expected[name], name
+
+
+def test_loaded_tables_match_fork_loader(golden, calibrated):
+ intensity, root = calibrated
+ tables = load_cost_tables(os.path.join(root, "cost"))
+ expected = golden[f"loaded_{intensity.value}"]
+ assert sorted(map(str, tables)) == sorted(expected)
+ for bs, table in tables.items():
+ data, config = expected[str(bs)]
+ assert config["max_interval_id"] == table.max_interval_id
+ assert config["model_ratio_array"] == list(table.model_ratio)
+ assert config["cache_length_step"] == table.cache_length_step
+ assert config["cache_length_start"] == table.cache_length_start
+ assert config["slm_max_qo_len"] == table.draft_max_qo_len
+ assert config["llm_max_qo_len_query"] == table.target_max_qo_len_query
+ assert config["llm_max_qo_len_cache"] == table.target_max_qo_len_cache
+ for (llm, slm), interval in zip(data, table.intervals):
+ for fork_curve, curve in ((llm, interval.target), (slm, interval.draft)):
+ assert fork_curve == [
+ list(curve.value),
+ list(curve.ratio),
+ list(curve.index),
+ list(curve.array_query),
+ list(curve.array_cache),
+ ]
+
+
+def _model(root: str, intensity: ComputeIntensity, case: dict) -> CostModel:
+ return CostModel(
+ tables=load_cost_tables(os.path.join(root, "cost")),
+ params=CostModelParams(depth_loss_ratio=0.04),
+ intensity=intensity,
+ node_top_k=case["node_top_k"],
+ tree_depth=case["tree_depth"],
+ verify_num=case["verify_num"],
+ ragged=intensity is ComputeIntensity.CHAIN,
+ eval_batch_size=case["eval_batch_size"],
+ )
+
+
+def test_decisions_match_fork(golden, calibrated):
+ intensity, root = calibrated
+ cases = golden[f"decisions_{intensity.value}"]
+ assert len(cases) >= 2
+ for case in cases:
+ _replay(_model(root, intensity, case["case"]), case["script"])
+
+
+def _replay(cm: CostModel, script: list) -> None:
+ row = None
+ assert len(script) > 100
+ for step in script:
+ op, args, out = step["op"], step["args"], step["out"]
+ if op == "update_interval":
+ cm.update_interval(*args)
+ got = cm.interval_index
+ elif op == "chain":
+ got = cm.chain_stop(*args)
+ elif op == "classify_chain":
+ tier, scale = cm.classify_chain(*args)
+ got = [int(tier), scale]
+ elif op == "ragged_active":
+ got = cm.ragged_active(*args)
+ elif op == "history":
+ got = cm.history_verify_num(*args)
+ elif op == "draft_cost_row":
+ row = cm.draft_cost_row(*args)
+ got = [
+ list(row.cost_values),
+ list(row.cost_index),
+ row.cost_state,
+ row.adjust_cost_ratio,
+ row.model_cost_ratio,
+ row.batch_size_ratio,
+ ]
+ elif op == "tree_width":
+ depth, bs, past, deltas = args
+ d = cm.tree_width(depth, bs, past, row, deltas)
+ got = [d.width, d.verify_num, d.stop]
+ elif op == "verify_count":
+ got = cm.verify_count(*args)
+ elif op == "verify_paged":
+ scores, requested, bs, avg, lagged = args
+ try:
+ got = list(cm.verify_num_paged(scores, requested, bs, avg, lagged=lagged))
+ except ValueError as e:
+ got = ["error", type(e).__name__]
+ elif op == "record":
+ cm.record_verify_num(*args)
+ got = None
+ else:
+ raise AssertionError(op)
+ assert got == out, (op, args)
+
+
+def test_outlier_filter_matches_fork(golden):
+ for case in golden["zscore"]:
+ mean, kept, ok = remove_outliers(case["data"], convergence_threshold=case["conv"])
+ assert float(mean) == case["mean"]
+ assert kept == case["kept"]
+ assert ok == case["ok"]
+
+
+def test_ragged_budget_matches_fork(golden):
+ for case in golden["budget"]:
+ assert ragged_verify_budget(*case["args"]) == case["out"]
+
+
+def test_verify_buckets_match_fork(golden):
+ for intensity in (ComputeIntensity.HIGH, ComputeIntensity.CHAIN):
+ for bs, buckets in golden["verify_buckets"][intensity.value].items():
+ assert verify_buckets(int(bs), intensity) == buckets
diff --git a/tests/test_cost_policy_tables.py b/tests/test_cost_policy_tables.py
new file mode 100644
index 0000000..a92e3cf
--- /dev/null
+++ b/tests/test_cost_policy_tables.py
@@ -0,0 +1,439 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree-policy export must describe the existing host cost decisions exactly."""
+
+import copy
+import json
+import math
+import random
+import subprocess
+import sys
+from dataclasses import FrozenInstanceError, replace
+from pathlib import Path
+
+import pytest
+
+from eagle_harness.core.cost_model import (
+ CostModel,
+ CostModelParams,
+ SizeClass,
+ depth_loss_ratio,
+ ragged_verify_budget,
+ stable_verify_thresholds,
+ verify_cost_delta,
+)
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, IntervalCost, load_cost_tables
+from eagle_harness.core.limits import MAX_BATCH_SIZE_TREE, ComputeIntensity
+from eagle_harness.tokenspeed.costs import TREE_POLICY_BATCH_CAPACITY, tree_policy_costs
+
+
+def _curve(ratios, indices):
+ return CostCurve(tuple(10 * r for r in ratios), tuple(ratios), tuple(indices), (), ())
+
+
+def _table(batch_size, states=(1.2, 1.4, 1.8, 2.4)):
+ return BatchCostTable(
+ batch_size=batch_size,
+ cache_length_start=128,
+ cache_length_step=128,
+ target_max_qo_len_query=64,
+ target_max_qo_len_cache=64,
+ draft_max_qo_len=8,
+ intervals=tuple(
+ IntervalCost(
+ target=_curve((1.0, state, state + 0.03, state + 0.2, state + 0.6), (0, 7, 15, 31, 63)),
+ draft=_curve((1.0, 1.1, 1.3, 1.7), (0, 1, 3, 7)),
+ )
+ for state in states
+ ),
+ model_ratio=tuple(8.0 + 6.0 * i for i in range(len(states))),
+ )
+
+
+def _model(**kwargs):
+ args = {
+ "tables": {bs: _table(bs) for bs in (1, 4, 8, 16, 32)},
+ "params": CostModelParams(),
+ "intensity": ComputeIntensity.HIGH,
+ "node_top_k": 8,
+ "tree_depth": 9,
+ "verify_num": 64,
+ }
+ args.update(kwargs)
+ return CostModel(**args)
+
+
[email protected]("intensity", [ComputeIntensity.HIGH, ComputeIntensity.LOW])
[email protected]("target_is_moe", [False, True])
+def test_tokenspeed_boundary_preserves_host_rows_within_its_capacity(intensity, target_is_moe):
+ model = _model(intensity=intensity, target_is_moe=target_is_moe)
+ before = copy.deepcopy(model.__dict__)
+ shared = model.tree_policy_costs()
+ adapted = tree_policy_costs(model)
+ assert len(shared.batches) == MAX_BATCH_SIZE_TREE
+ assert len(adapted.batches) == TREE_POLICY_BATCH_CAPACITY
+ assert adapted.batches == shared.batches[:TREE_POLICY_BATCH_CAPACITY]
+ assert replace(adapted, batches=shared.batches) == shared
+ assert model.__dict__ == before
+
+
[email protected]("intensity", list(ComputeIntensity))
[email protected]("target_is_moe", [False, True])
+def test_export_matches_host_cost_rows_exactly(intensity, target_is_moe):
+ chain = intensity is ComputeIntensity.CHAIN
+ model = _model(
+ intensity=intensity,
+ node_top_k=1 if chain else 8,
+ verify_num=16 if chain else 64,
+ target_is_moe=target_is_moe,
+ params=CostModelParams(
+ depth_loss_ratio=depth_loss_ratio("eagle3", target_is_moe=target_is_moe, intensity=intensity)
+ ),
+ )
+ costs = model.tree_policy_costs()
+ assert isinstance(costs.batches, tuple)
+ assert len(costs.batches) == MAX_BATCH_SIZE_TREE
+ assert costs.history_floors == ((1,) * 5 if chain else (16, 8, 4, 2, 32))
+ assert costs.initial_widths == ((1,) * 4 if chain else (8, 8, 4, 4))
+ assert costs.async_layer_ratio == model.params.async_layer_ratio
+ for bs, batch in enumerate(costs.batches, 1):
+ table = model.table(bs)
+ assert batch.cost_batch_size == table.batch_size
+ assert batch.cache_length_step == table.cache_length_step
+ assert len(batch.intervals) == len(table.intervals)
+ for interval_id, interval in enumerate(batch.intervals):
+ context = (interval_id + 1) * table.cache_length_step
+ verify = model.verify_cost(bs, context)
+ assert interval.verify_tier == int(model.tier.size)
+ assert interval.verify_widths == verify.index
+ assert interval.verify_thresholds == (verify.threshold * 0.95, verify.threshold * 1.05)
+ assert interval.verify_cost_deltas == tuple(
+ tuple(b - a if b - a > 0.04 else 0.0 for b in verify.value) for a in verify.value
+ )
+ assert len(interval.depth_thresholds) == 5
+ for variant in range(5):
+ model.tier.size = SizeClass(variant % 4)
+ model.tier.tiny = variant == 4
+ row = model.draft_cost_row(bs, context)
+ assert interval.draft_cost == row.cost_values[-1]
+ assert interval.model_cost_ratio == row.model_cost_ratio
+ assert interval.depth_thresholds[variant] == tuple(
+ model.tree_depth_threshold(depth, row) for depth in range(model.tree_depth)
+ )
+ with pytest.raises(FrozenInstanceError):
+ costs.async_layer_ratio = 0.0
+ with pytest.raises(FrozenInstanceError):
+ costs.batches[0].cache_length_step = 0
+ with pytest.raises(FrozenInstanceError):
+ costs.batches[0].intervals[0].draft_cost = 0.0
+
+
[email protected]("top_k,expected", [(1, (1, 1, 1, 1)), (3, (3, 3, 3, 3)), (8, (8, 8, 4, 4))])
+def test_initial_widths_use_host_depth_zero_decision(top_k, expected):
+ assert _model(node_top_k=top_k).tree_policy_costs().initial_widths == expected
+
+
[email protected]("intensity", [ComputeIntensity.HIGH, ComputeIntensity.CHAIN])
+def test_export_accepts_existing_golden_calibration_tables(tmp_path, intensity):
+ golden = json.loads((Path(__file__).parent / "golden" / "fork_golden.json").read_text())
+ for name, contents in golden[f"cost_files_{intensity.value}"].items():
+ path = tmp_path / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(contents)
+ model = _model(
+ tables=load_cost_tables(str(tmp_path)),
+ intensity=intensity,
+ node_top_k=1 if intensity is ComputeIntensity.CHAIN else 8,
+ verify_num=16 if intensity is ComputeIntensity.CHAIN else 64,
+ )
+ costs = model.tree_policy_costs()
+ for bs, batch in enumerate(costs.batches, 1):
+ assert batch.cost_batch_size == model.table(bs).batch_size
+ for interval_id, interval in enumerate(batch.intervals):
+ context = (interval_id + 1) * batch.cache_length_step
+ row = model.draft_cost_row(bs, context)
+ assert interval.draft_cost == row.cost_values[-1]
+ assert interval.model_cost_ratio == row.model_cost_ratio
+ verify = model.verify_cost(bs, context)
+ assert interval.verify_widths == verify.index
+ assert interval.verify_tier == int(model.tier.size)
+
+
+def test_nearest_batch_ties_and_cache_interval_boundaries():
+ model = _model(tables={bs: _table(bs) for bs in (4, 8, 16, 32)})
+ costs = model.tree_policy_costs()
+ for bs, measured in ((1, 4), (4, 4), (5, 4), (6, 8), (11, 8), (12, 16), (23, 16), (24, 32), (32, 32)):
+ assert costs.batches[bs - 1].cost_batch_size == measured
+ # The same measured table must retain live batch 1's special SMALL class.
+ assert costs.batches[0].intervals[3].verify_tier == int(SizeClass.SMALL)
+ assert costs.batches[1].intervals[3].verify_tier == int(SizeClass.HUGE)
+ for bs in (1, 6, 12, 24, 32):
+ for context, expected_interval in ((0, 0), (255, 0), (256, 1), (383, 1), (384, 2), (512, 3), (10000, 3)):
+ row = model.draft_cost_row(bs, context)
+ interval = costs.batches[bs - 1].intervals[expected_interval]
+ assert model.interval_index == expected_interval
+ assert interval.model_cost_ratio == row.model_cost_ratio
+ verify = model.verify_cost(bs, context)
+ assert interval.verify_thresholds == (verify.threshold * 0.95, verify.threshold * 1.05)
+
+
[email protected]("target_is_moe", [False, True])
[email protected]("state", [0.69, 0.70, 0.84, 0.85, 1.25, 1.60, 2.20, 4.0, 4.01])
+def test_export_preserves_host_cost_state_checks(target_is_moe, state):
+ model = _model(tables={1: _table(1, (state,)), 4: _table(4, (state,))}, target_is_moe=target_is_moe)
+ invalid = state < (0.70 if target_is_moe else 0.85) or state > 4.0
+ if invalid:
+ with pytest.raises(ValueError, match="cost_state"):
+ model.tree_policy_costs()
+ else:
+ costs = model.tree_policy_costs()
+ for bs in (1, 4):
+ verify = model.verify_cost(bs, 128)
+ interval = costs.batches[bs - 1].intervals[0]
+ assert interval.verify_tier == int(model.tier.size)
+ assert interval.verify_thresholds == (verify.threshold * 0.95, verify.threshold * 1.05)
+
+
[email protected]("intensity", [ComputeIntensity.HIGH, ComputeIntensity.LOW])
[email protected]("last_budget", [-1, 8, 64])
[email protected]("lagged", [False, True])
+def test_exported_costs_reproduce_paged_verify_decisions(intensity, last_budget, lagged):
+ model = _model(intensity=intensity)
+ costs = model.tree_policy_costs()
+ rng = random.Random(62)
+ decisions = set()
+ for bs in (1, 3, 8, 17, 32):
+ for interval_id, interval in enumerate(costs.batches[bs - 1].intervals):
+ for requested in (1, 8, 16, 32, 64):
+ scores = [rng.uniform(0.0, 0.1)]
+ for _ in range(63):
+ scores.append(scores[-1] + rng.uniform(0.0, 0.12))
+ if lagged:
+ scores = scores[:32]
+ selected = [i for i, width in enumerate(interval.verify_widths) if width < min(len(scores), requested)]
+ mask = [interval.verify_widths[i] for i in selected]
+ if len(mask) > 1:
+ reset = mask[1]
+ for i in selected:
+ for j in selected:
+ if j <= i:
+ continue
+ delta = interval.verify_cost_deltas[i][j]
+ threshold = interval.verify_thresholds[0 if last_budget <= mask[j] + 1 else 1]
+ gain = scores[interval.verify_widths[j]] - scores[interval.verify_widths[i]]
+ if delta > 0.0 and gain / delta < threshold:
+ mask[j] = reset
+ expected = max(mask) + 1
+ model.recent_verify_nums[:] = [last_budget] * 5
+ context = (interval_id + 1) * costs.batches[bs - 1].cache_length_step
+ assert model.verify_num_paged(scores, requested, bs, context, lagged=lagged) == (expected, False)
+ assert model.recent_verify_nums[-1] == expected
+ decisions.add(expected)
+ assert len(decisions) >= 3
+
+
[email protected]("top_k", [3, 8])
+def test_exported_depth_thresholds_reproduce_host_stop_decisions(top_k):
+ model = _model(node_top_k=top_k, tree_depth=31)
+ costs = model.tree_policy_costs()
+ for bs in (1, 6, 32):
+ for interval_id, interval in enumerate(costs.batches[bs - 1].intervals):
+ context = (interval_id + 1) * costs.batches[bs - 1].cache_length_step
+ for variant, thresholds in enumerate(interval.depth_thresholds):
+ for depth in (3, 5, 7, 29):
+ for factor in (0.999999999, 1.0, 1.000000001):
+ model.tier.size = SizeClass(variant % 4)
+ model.tier.tiny = variant == 4
+ row = model.draft_cost_row(bs, context)
+ gain = thresholds[depth] * interval.draft_cost / interval.model_cost_ratio
+ gain = gain / costs.async_layer_ratio * factor
+ expected_stop = (
+ gain / interval.draft_cost * interval.model_cost_ratio * costs.async_layer_ratio
+ < thresholds[depth]
+ )
+ result = model.tree_width(depth, bs, 32, row, [0.0] + [gain] * 8)
+ assert result.stop is expected_stop
+
+
[email protected]("delta", [math.nextafter(0.04, 0.0), 0.04, math.nextafter(0.04, math.inf)])
+def test_verify_cost_cutoff_is_strict(delta):
+ assert verify_cost_delta(0.0, delta) == (delta if delta > 0.04 else 0.0)
+ assert verify_cost_delta(delta, 0.0) == 0.0
+
+
[email protected]("last_budget", [1, 64])
[email protected]("direction", [0.0, math.inf])
+def test_verify_stability_boundary_matches_paged_and_ragged(last_budget, direction):
+ table = _table(1)
+ target = _curve((1.0, 1.2, 1.6), (0, 1, 3))
+ table = replace(table, intervals=(replace(table.intervals[0], target=target),), model_ratio=(20.0,))
+ model = _model(tables={1: table})
+ interval = model.tree_policy_costs().batches[0].intervals[0]
+ threshold = interval.verify_thresholds[0 if last_budget <= 4 else 1]
+ # A large initial gain prevents root comparisons from hiding the last pair.
+ last_score = math.nextafter(10.0 + threshold * (1.6 - 1.2), direction)
+ scores = [0.0, 10.0, 10.0, last_score]
+ expected = 2 if (scores[3] - scores[1]) / (1.6 - 1.2) < threshold else 4
+ assert expected == (2 if direction == 0.0 else 4)
+ model.recent_verify_nums[:] = [last_budget] * 5
+ assert model.verify_num_paged(scores, 4, 1, 128, lagged=False) == (expected, False)
+ assert (
+ ragged_verify_budget([scores[1], scores[3]], 4, target.ratio, target.index, 2.4, [last_budget] * 5) == expected
+ )
+ assert stable_verify_thresholds(2.4) == (2.4 * 0.95, 2.4 * 1.05)
+
+
[email protected]("direction,expected", [(0.0, 4), (math.inf, 2)])
+def test_cost_cutoff_matches_export_paged_and_ragged(direction, expected):
+ table = _table(1)
+ last_cost = math.nextafter(1.06, direction)
+ target = _curve((1.0, 1.02, last_cost), (0, 1, 3))
+ table = replace(table, intervals=(replace(table.intervals[0], target=target),), model_ratio=(20.0,))
+ model = _model(tables={1: table})
+ interval = model.tree_policy_costs().batches[0].intervals[0]
+ delta = last_cost - 1.02
+ assert interval.verify_cost_deltas[1][2] == (delta if delta > 0.04 else 0.0)
+ assert model.verify_num_paged([0.0, 10.0, 10.0, 10.001], 4, 1, 128, lagged=False) == (expected, False)
+ assert ragged_verify_budget([10.0, 10.001], 4, target.ratio, target.index, 2.4, [-1] * 5) == expected
+
+
+def test_core_import_does_not_load_engine_dependencies():
+ script = """
+import importlib.abc
+import sys
+
+class RejectEngines(importlib.abc.MetaPathFinder):
+ def find_spec(self, fullname, path=None, target=None):
+ if fullname.split(".")[0] in {"torch", "tokenspeed"}:
+ raise AssertionError(f"Unexpected engine import: {fullname}")
+
+sys.meta_path.insert(0, RejectEngines())
+from eagle_harness.core.cost_model import CostModel
+assert callable(CostModel.tree_policy_costs)
+"""
+ subprocess.run([sys.executable, "-c", script], check=True)
+
+
+def test_export_preserves_all_caller_state_and_returns_detached_records():
+ model = _model(eval_batch_size=32)
+ model.tier.size = SizeClass.HUGE
+ model.tier.tiny = True
+ model.interval_index = 3
+ model.recent_verify_nums[:] = [8] * 5
+ for bs in range(1, 33):
+ model.record_verify_num(bs, bs)
+ before = copy.deepcopy(model.__dict__)
+ tier = model.tier
+ histories = (model.recent_verify_nums, model._history)
+ costs = model.tree_policy_costs()
+ assert model.__dict__ == before
+ assert model.tier is tier
+ assert all(
+ a is b for a, b in zip(histories, (model.recent_verify_nums, model._history))
+ )
+ assert costs == model.tree_policy_costs()
+ model.tier.size = SizeClass.SMALL
+ model.interval_index = 0
+ model.record_verify_num(1, 64)
+ assert costs == model.tree_policy_costs()
+
+
+ "table_change",
+ [
+ {"intervals": ()},
+ {"model_ratio": ()},
+ {"model_ratio": (math.nan,) * 4},
+ {"model_ratio": (math.inf,) * 4},
+ {"model_ratio": (4.99,) * 4},
+ {"model_ratio": (100.01,) * 4},
+ {"cache_length_step": 0},
+ {"cache_length_step": -1},
+ {"cache_length_step": 0.5},
+ {"batch_size": 2},
+ {"batch_size": 1.0},
+ ],
+)
+def test_export_rejects_invalid_table_metadata(table_change):
+ table = replace(_table(1), **table_change)
+ model = _model(tables={1: table})
+ before = copy.deepcopy(model.__dict__)
+ with pytest.raises(ValueError):
+ model.tree_policy_costs()
+ assert model.__dict__ == before
+
+
[email protected]("curve_name", ["target", "draft"])
+ "curve_change",
+ [
+ {"ratio": ()},
+ {"value": ()},
+ {"index": ()},
+ {"index": (0, 7, 7, 31, 63)},
+ {"index": (-1, 7, 15, 31, 63)},
+ {"index": (1, 7, 15, 31, 63)},
+ {"index": (0, 7, 15, 31, 64)},
+ {"index": (0, 7, 15.5, 31, 63)},
+ {"ratio": (1.0, math.nan, 1.3, 1.4, 1.5)},
+ {"ratio": (1.0, math.inf, 1.3, 1.4, 1.5)},
+ {"ratio": (1.0, 0.0, 1.3, 1.4, 1.5)},
+ {"value": (1.0, -1.0, 1.3, 1.4, 1.5)},
+ ],
+)
+def test_export_rejects_invalid_cost_curves(curve_name, curve_change):
+ indices = (0, 7, 15, 31, 63) if curve_name == "target" else (0, 1, 3, 5, 7)
+ curve = replace(_curve((1.0, 1.1, 1.2, 1.3, 1.4), indices), **curve_change)
+ table = _table(1)
+ interval = replace(table.intervals[0], **{curve_name: curve})
+ with pytest.raises(ValueError):
+ _model(tables={1: replace(table, intervals=(interval,), model_ratio=(20.0,))}).tree_policy_costs()
+
+
[email protected]("width_count", [1, 33])
+def test_export_rejects_unsupported_target_width_count(width_count):
+ table = _table(1)
+ target = _curve((1.0,) * width_count, range(width_count))
+ interval = replace(table.intervals[0], target=target)
+ with pytest.raises(ValueError, match="target"):
+ _model(tables={1: replace(table, intervals=(interval,), model_ratio=(20.0,))}).tree_policy_costs()
+
+
+def test_export_accepts_32_target_widths():
+ table = _table(1)
+ target = _curve(tuple(1.0 + i * 0.01 for i in range(32)), range(32))
+ interval = replace(table.intervals[0], target=target)
+ costs = _model(tables={1: replace(table, intervals=(interval,), model_ratio=(20.0,))}).tree_policy_costs()
+ assert len(costs.batches[0].intervals[0].verify_widths) == 32
+
+
+def test_export_rejects_invalid_ratio_even_in_an_unselected_table():
+ model = _model()
+ model.tables[512] = replace(_table(512), model_ratio=(4.99,) * 4)
+ with pytest.raises(ValueError, match="model_cost_ratio"):
+ model.tree_policy_costs()
+
+
+ "model_change",
+ [
+ {"tables": {}},
+ {"tree_depth": 0},
+ {"tree_depth": 1},
+ {"tree_depth": 32},
+ {"node_top_k": 0},
+ {"node_top_k": 9},
+ {"verify_num": 1},
+ {"verify_num": 65},
+ {"params": CostModelParams(threshold=math.nan)},
+ {"params": CostModelParams(async_layer_ratio=math.inf)},
+ {"params": CostModelParams(async_layer_ratio=0.0)},
+ {"params": CostModelParams(depth_loss_ratio=-0.01)},
+ {"params": CostModelParams(depth_loss_ratio=math.inf)},
+ {"params": CostModelParams(threshold=1e308)},
+ ],
+)
+def test_export_rejects_invalid_model_bounds(model_change):
+ with pytest.raises((ValueError, NotImplementedError)):
+ _model(**model_change).tree_policy_costs()
diff --git a/tests/test_cost_profiles.py b/tests/test_cost_profiles.py
new file mode 100644
index 0000000..c9fd16e
--- /dev/null
+++ b/tests/test_cost_profiles.py
@@ -0,0 +1,80 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+"""CPU regressions for the device-selected MI355X serving profile."""
+
+import json
+from pathlib import Path
+
+import pytest
+
+from eagle_harness.core.config import parse_harness_config
+from eagle_harness.core.cost_profiles import MI355X_PROFILE, packaged_cost_profile
+from eagle_harness.core.cost_table import load_cost_tables
+
+
+def model_paths(tmp_path):
+ paths = []
+ for name in ("target", "draft"):
+ path = tmp_path / name
+ path.mkdir()
+ (path / "config.json").write_bytes((MI355X_PROFILE / f"{name}_config.json").read_bytes())
+ paths.append(str(path))
+ return paths
+
+
+def select(paths, **overrides):
+ args = dict(device_name="AMD Instinct MI355X VF", model_path=paths[0], draft_model_path=paths[1],
+ tp_size=1, dtype="bfloat16", quantization=None)
+ args.update(overrides)
+ return packaged_cost_profile(**args)
+
+
+def test_mi355x_default_has_measured_per_batch_rows(model_paths):
+ path = select(model_paths)
+ assert path == str(MI355X_PROFILE)
+ config = parse_harness_config(None, default_data_path=path)
+ tables = load_cost_tables(config.cost_dir)
+ assert set(tables) == {1, 8, 32}
+ for batch in (1, 8, 32):
+ assert tables[batch].batch_size == batch
+ assert tables[batch].intervals
+ assert (Path(path) / "gemm_solutions.csv").is_file()
+ assert (Path(path) / "candidate_topk.json").is_file()
+
+
[email protected]("raw", [None, "{}", '{"mode":"serve"}'])
+def test_default_is_resolved_without_an_env_overlay(model_paths, raw, monkeypatch):
+ monkeypatch.setenv("AMD_COST_PROFILE", "/not/a/serving/config")
+ path = select(model_paths)
+ assert parse_harness_config(raw, default_data_path=path).data_path == path
+ assert select(model_paths, device_name="AMD Instinct MI355X") == path
+
+
+def test_explicit_profile_and_static_mode_win(model_paths):
+ path = select(model_paths)
+ assert parse_harness_config('{"data_path":"/custom"}', default_data_path=path).data_path == "/custom"
+ assert parse_harness_config('{"mode":"static"}', default_data_path=path).data_path is None
+ with pytest.raises(ValueError, match="needs data_path"):
+ parse_harness_config('{"mode":"calibrate"}', default_data_path=path)
+
+
[email protected]("override", [
+ {"device_name": "AMD Instinct MI300X"}, {"device_name": "NVIDIA B300"}, {"tp_size": 2},
+ {"dtype": "float16"}, {"quantization": "fp8"}, {"model_path": "missing/checkpoint"},
+])
+def test_unmeasured_setups_do_not_select_mi355x_rows(model_paths, override):
+ assert select(model_paths, **override) is None
+
+
[email protected]("index", [0, 1])
+def test_changed_model_config_does_not_select_profile(model_paths, index):
+ path = Path(model_paths[index]) / "config.json"
+ data = json.loads(path.read_text())
+ data["hidden_size"] = 1
+ path.write_text(json.dumps(data))
+ assert select(model_paths) is None
+
+
+def test_profile_does_not_depend_on_model_directory_name(model_paths):
+ assert select(model_paths, dtype="auto") == str(MI355X_PROFILE)
diff --git a/tests/test_dense_target_commit.py b/tests/test_dense_target_commit.py
new file mode 100644
index 0000000..fb3e450
--- /dev/null
+++ b/tests/test_dense_target_commit.py
@@ -0,0 +1,21 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Dense targets have no recurrent state to commit after tree verification."""
+
+import pytest
+import torch
+
+pytest.importorskip("vllm")
+
+
+def test_empty_linear_state_commit_is_noop():
+ # Let kernel tests select their Triton execution mode during collection first.
+ from eagle_harness.vllm.gdn_tree_verify import LinearStateCommit
+
+ commit = LinearStateCommit([], [], torch.device("cpu"))
+ mapping = torch.tensor([0], dtype=torch.int32)
+ path = torch.tensor([[0, 2, 3]], dtype=torch.int32)
+ length = torch.tensor([2], dtype=torch.int32)
+ commit.commit(mapping, path, length)
+ assert path.tolist() == [[0, 2, 3]]
diff --git a/tests/test_depth_stop.py b/tests/test_depth_stop.py
new file mode 100644
index 0000000..0bcdce5
--- /dev/null
+++ b/tests/test_depth_stop.py
@@ -0,0 +1,467 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft tree's stop rule (:mod:`eagle_harness.vllm.depth_stop`): exact for ``min_gain = 0``, a step priced by the
+cost tables, kernel == reference, and a captured growth with conditional steps == the full-depth growth (GPU)."""
+
+import contextlib
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+from eagle_harness.core.calibration import AttentionShape, CalibrationPaths, MeasureParams, StepTiming, fit_step_timings
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, IntervalCost, load_cost_tables
+from eagle_harness.core.draft_tree import DEPTH_DECAY, DraftTree, TreeShape
+from eagle_harness.core.limits import ComputeIntensity, verify_buckets
+from tests.triton_probe import needs_triton
+
+K, DEPTH, H = 4, 8, 8
+
+
+class _Draft(torch.nn.Module):
+ """The slice of the EAGLE-4 draft model TreeDrafter reads at construction."""
+
+ def __init__(self, hidden=8):
+ super().__init__()
+ self.config = SimpleNamespace(hidden_size=hidden)
+ self.model = SimpleNamespace(
+ layers=[SimpleNamespace(self_attn=SimpleNamespace(qkv_proj=torch.nn.Linear(hidden, hidden)))]
+ )
+
+
+def _decay(d: int) -> float:
+ return float(torch.tensor(DEPTH_DECAY**d, dtype=torch.float32))
+
+
+def _tree(bs: int) -> DraftTree:
+ return DraftTree(TreeShape(top_k=K, max_depth=DEPTH), bs, H, torch.float32, torch.device("cpu"), max_verify=1)
+
+
+def _probs(gen: torch.Generator, rows: int, sharpness: torch.Tensor) -> torch.Tensor:
+ """Top-``K`` probabilities of a random vocabulary of 50 per row (``sharpness``: per row, high = confident)."""
+ logits = torch.randn(rows, 50, generator=gen) * sharpness[:, None]
+ return torch.topk(logits.softmax(-1), K, dim=-1).values
+
+
+def _grow(bs: int, count: int, seed: int, min_gain: float | None):
+ """Grow a tree on CPU with the reference step; with ``min_gain`` stop as the rule says. Returns
+ ``(verify node set per request, steps run)``."""
+ from eagle_harness.vllm.depth_stop import keep_growing_reference
+
+ gen = torch.Generator().manual_seed(seed)
+ sharp = torch.rand(bs, generator=gen) * 6 # some requests confident, some not
+ tree = _tree(bs)
+ tree.root_probs[:bs] = _probs(gen, bs, sharp)
+ tree.root_tokens[:bs] = torch.randint(0, 1000, (bs, K), generator=gen)
+ tree.begin_reference(bs)
+ tree.scores[:bs, tree.shape.layer_start(3) :] = 0
+ steps = 0
+ for step in range(1, DEPTH):
+ # the draws do not depend on whether an earlier step was skipped: same tree up to where it stops
+ probs = _probs(gen, bs * K, sharp.repeat_interleave(K))
+ tokens = torch.randint(0, 1000, (bs * K, K), generator=gen)
+ if step > 1 and min_gain is not None:
+ front = tree.front_scores[:bs]
+ parent = (tree.shape.layer_start(step - 1), tree.shape.layer_start(step))
+ if not keep_growing_reference(
+ tree.scores[:bs], tree.decay, front, count, _decay(step + 1), min_gain, parent
+ ):
+ break
+ tree.step_reference(bs, step, probs, tokens, torch.zeros(bs * K, H))
+ steps += 1
+ ranked, _ = tree.rank(bs, DEPTH, count)
+ return [set(row.tolist()) for row in ranked], steps
+
+
[email protected]("bs, count", [(1, 15), (1, 7), (3, 15), (2, 20)])
+def test_zero_gain_stop_keeps_the_full_depth_verify_set(bs, count):
+ stopped = 0
+ for seed in range(40):
+ full, full_steps = _grow(bs, count, seed, None)
+ early, steps = _grow(bs, count, seed, 0.0)
+ assert early == full, f"seed {seed}: the early stop changed the verify set"
+ assert full_steps == DEPTH - 1
+ stopped += steps < full_steps
+ assert stopped > 0 # the rule does fire on these trees
+
+
+def test_a_positive_gain_stops_no_later():
+ for seed in range(20):
+ _, exact = _grow(1, 15, seed, 0.0)
+ _, lossy = _grow(1, 15, seed, 0.05)
+ assert lossy <= exact
+
+
+def test_reference_rule_on_a_hand_made_tree():
+ from eagle_harness.vllm.depth_stop import keep_growing_reference
+
+ def keep(front, gain, parent=(1, 2), scores=torch.tensor([[0.9, 0.5, 0.2, 0.1, 0.0]])):
+ return bool(keep_growing_reference(scores, torch.ones(5), torch.tensor(front), 3, 1.0, gain, parent))
+
+ # 3rd best is 0.2: a frontier at 0.25 can still place a child, one at 0.15 cannot (whatever the ratio)
+ assert keep([[0.25, 0.1]], 0.0) and keep([[0.25, 0.1]], 0.0, parent=(0, 1))
+ assert not keep([[0.15, 0.1]], 0.0)
+ # gain: the children are expected at their parent's score x the last step's best ratio. Layer above at 0.5 and a
+ # frontier at 0.5: ratio 1, excess 0.3 + 0.25. Layer above at 0.9: ratio 0.5 / 0.9, excess 0.078 + 0.05.
+ assert keep([[0.5, 0.45]], 0.5)
+ assert not keep([[0.5, 0.45]], 0.5, parent=(0, 1))
+ assert keep([[0.5, 0.45]], 0.1, parent=(0, 1))
+ # a batch keeps growing if any request wants to
+ two = torch.tensor([[0.9, 0.5, 0.2, 0.1, 0.0]] * 2)
+ assert keep([[0.15, 0.1], [0.3, 0.0]], 0.0, scores=two)
+
+
+def test_reference_prices_a_step_by_the_expected_accept():
+ from eagle_harness.vllm.depth_stop import keep_growing_reference
+
+ scores = torch.tensor([[0.9, 0.5, 0.2, 0.1, 0.0]])
+
+ def keep(share, gain=0.0):
+ front = torch.tensor([[0.5, 0.45]]) # ratio 1 (layer above at 0.5): excess 0.3 + 0.25 = 0.55
+ return bool(keep_growing_reference(scores, torch.ones(5), front, 3, 1.0, gain, (1, 2), share))
+
+ # expected accept of the verify set (0.9, 0.5, 0.2) plus the root's token: 2.6; 0.55 / 2.6 = 0.2115
+ assert keep(0.21) and not keep(0.212)
+ assert keep(0.0, 0.55) and not keep(0.0, 0.551)
+ assert not keep(0.1, 0.3) # the fixed gain and the priced step add up: 0.3 + 0.26 > 0.55
+
+
+@needs_triton
[email protected]("share, keeps", [(0.21, True), (0.212, False)])
+def test_kernel_prices_a_step_by_the_expected_accept(share, keeps):
+ """The hand-made case above through the kernel: the expected accept counts the root and exactly ``count`` rows."""
+ from eagle_harness.vllm.depth_stop import keep_growing
+
+ device = "cuda" if torch.cuda.is_available() else "cpu"
+ go = torch.zeros((), dtype=torch.bool, device=device)
+ stats = torch.zeros(2, dtype=torch.int64, device=device)
+ scores = torch.tensor([[0.9, 0.5, 0.2, 0.1, 0.0]], device=device)
+ front = torch.tensor([[0.5, 0.45]], device=device)
+ keep_growing(
+ go, stats, scores, torch.ones(5, device=device), front, 3, 1.0, 0.0, (1, 2), steps_before=0, step_share=share
+ )
+ assert bool(go) is keeps
+
+
+@needs_triton
+ "bs, count, gain, share",
+ [
+ (1, 15, 0.0, 0.0),
+ (3, 15, 0.0, 0.0),
+ (2, 7, 0.02, 0.0),
+ (1, 20, 0.1, 0.0),
+ (1, 15, 0.0, 0.04),
+ (3, 7, 0.01, 0.02),
+ ],
+)
+def test_kernel_matches_the_reference(bs, count, gain, share):
+ from eagle_harness.vllm.depth_stop import keep_growing, keep_growing_reference
+
+ device = "cuda" if torch.cuda.is_available() else "cpu"
+ shape = TreeShape(top_k=K, max_depth=DEPTH)
+ decay = shape.decay(torch.device(device))
+ stats = torch.zeros(2, dtype=torch.int64, device=device)
+ go = torch.zeros((), dtype=torch.bool, device=device)
+ gen = torch.Generator().manual_seed(bs * 100 + count)
+ agree, ran = set(), 0
+ for trial in range(12):
+ scores = torch.rand(bs, shape.capacity, generator=gen) ** 3
+ scores[:, shape.layer_start(3 + trial % 4) :] = 0
+ front = torch.rand(bs, K, generator=gen) * scores[:, :count].mean() * 2
+ parent = (shape.layer_start(2), shape.layer_start(3))
+ scores[:, parent[1]] = 1.0 # the next layer's first node: a parent range one too wide changes the ratio
+ scores, front = scores.to(device), front.to(device)
+ want = keep_growing_reference(scores, decay, front, count, _decay(4), gain, parent, share)
+ keep_growing(
+ go,
+ stats,
+ scores,
+ decay,
+ front,
+ count,
+ _decay(4),
+ gain,
+ parent,
+ steps_before=2 if trial % 2 == 0 else 0,
+ step_share=share,
+ )
+ ran += (2 if trial % 2 == 0 else 0) + int(want)
+ assert bool(go) == bool(want), trial
+ agree.add(bool(want))
+ assert agree == {True, False}
+ assert stats.tolist() == [6, ran]
+
+
+@needs_triton
[email protected]("gain, keeps", [(1.0, True), (6.8, False)])
+def test_decision_scales_by_the_layer_above_the_newest(gain, keeps):
+ """After step 2 (layers 1-3) the ratio is the frontier's best over layer 2's best: 0.6 / 0.2. Layer 1 (0.9) or
+ layer 3 (0.18) in its place gives an expected gain of 0.8 or 7.2 instead of 6.4."""
+ pytest.importorskip("vllm")
+ from eagle_harness.vllm.tree_drafter import TreeDrafter
+
+ attn = SimpleNamespace(
+ impl=SimpleNamespace(scale=1.0), sliding_window=None, num_heads=2, num_kv_heads=2, head_size=4
+ )
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # the kernel runs where the tree lives
+ drafter = TreeDrafter(_Draft(), attn, top_k=4, depth=6, max_reqs=1, device=device, min_gain=gain)
+ tree, shape = drafter.tree, drafter.tree.shape
+ tree.scores.zero_()
+ tree.scores[0, : shape.layer_start(2)] = 0.9
+ tree.scores[0, shape.layer_start(2) : shape.layer_start(3)] = 0.2
+ tree.scores[0, shape.layer_start(3) : shape.layer_start(4)] = 0.18
+ tree.front_scores[0] = 0.6
+ drafter._decide(1, 2, 15, 1)
+ assert bool(drafter._go) is keeps
+
+
+def _table(draft_us: float, verify_us: float) -> dict[int, BatchCostTable]:
+ """bs-1 cost tables: a draft step of 1, 2, 4 or 8 rows and a target forward of 1 or 16 tokens, the same in two
+ context intervals and 1.5x in a third (the median, not the mean)."""
+
+ def curve(index, value):
+ return CostCurve(
+ value=value, ratio=tuple(v / value[0] for v in value), index=index, array_query=(), array_cache=()
+ )
+
+ rows = tuple(
+ IntervalCost(
+ target=curve((0, 15), (verify_us * s / 2, verify_us * s)),
+ draft=curve((0, 1, 3, 7), (draft_us * s / 2, draft_us * s * 0.8, draft_us * s, draft_us * s * 1.4)),
+ )
+ for s in (1.0, 1.0, 1.5)
+ )
+ return {1: BatchCostTable(1, 256, 256, 64, 16, 8, rows, tuple(2.0 for _ in rows))}
+
+
+def test_round_costs_read_the_tables_at_the_round_shape():
+ from eagle_harness.vllm.depth_stop import RoundCosts, round_costs
+
+ costs = round_costs(_table(100.0, 1300.0), batch_size=1, top_k=4, count=15)
+ assert costs == RoundCosts(draft_step=100.0, rest=1300.0) # 4 rows: index 3; 15 drafts + root: index 15
+ assert round_costs(_table(100.0, 1300.0), batch_size=3, top_k=4, count=15) == costs # nearest measured batch size
+ assert costs.step_share(2) == pytest.approx(100 / 1500)
+ assert costs.step_share(5) < costs.step_share(2) # deeper rounds price a step lower
+ # fallback: shapes the tables did not time, or no tables
+ assert round_costs(_table(100.0, 1300.0), 1, 3, 15) is None
+ assert round_costs(_table(100.0, 1300.0), 1, 4, 23) is None
+ assert round_costs({}, 1, 4, 15) is None
+
+
+def test_round_costs_from_the_calibration_fits(tmp_path):
+ """Tables written by the core's fits from whole-step timings (what a vLLM calibration run writes)."""
+ from eagle_harness.vllm.depth_stop import round_costs
+
+ lengths = [256 * (1 + i) + off for i in range(15) for off in (64, 192)]
+ draft = [StepTiming(q, n, 90.0 + 8.0 * q + 0.002 * n * q) for q in (1, 2, 4, 8) for n in lengths]
+ widths = sorted(verify_buckets(1, ComputeIntensity.HIGH)) # the fits read every bucket
+ target = [StepTiming(q, n, 4400.0 + 20.0 * q + 0.02 * n * q) for q in widths for n in lengths]
+ params = MeasureParams(
+ context_step=256, context_stop=4096, batch_size=1, verify_num=64, node_top_k=8, loop_top_m=64, repeat_cnt=1
+ )
+ paths = CalibrationPaths(str(tmp_path))
+ fit_step_timings(
+ paths, params, ComputeIntensity.HIGH, (AttentionShape(1, 1, 4096), draft), (AttentionShape(16), target)
+ )
+ costs = round_costs(load_cost_tables(paths.cost), 1, top_k=4, count=15)
+ middle = lengths[len(lengths) // 2]
+ assert costs.draft_step == pytest.approx(90.0 + 32.0 + 0.008 * middle, rel=0.05)
+ assert costs.rest == pytest.approx(4400.0 + 320.0 + 0.32 * middle, rel=0.05)
+
+
+def test_derived_cost_tables_fall_back_to_lossless(tmp_path, caplog):
+ from eagle_harness.vllm.config import parse_method_config
+ from eagle_harness.vllm.depth_stop import derived_cost_tables
+
+ shape = {"mode": "static", "node_top_k": 4, "tree_depth": 14, "max_verify_width": 16}
+ assert derived_cost_tables(parse_method_config(shape)) is None # no data_path
+ assert derived_cost_tables(parse_method_config({**shape, "data_path": str(tmp_path)})) is None # no tables there
+ assert "lossless" in caplog.text
+
+
+def test_derived_serving_refuses_missing_prices(tmp_path):
+ from eagle_harness.vllm.config import parse_method_config
+ from eagle_harness.vllm.depth_stop import derived_cost_tables
+
+ config = parse_method_config({"data_path": str(tmp_path)})
+ with pytest.raises(ValueError, match="calibrate.*depth_stop_gain"):
+ derived_cost_tables(config)
+
+
+def test_derived_serving_checks_every_scheduled_shape(tmp_path):
+ from eagle_harness.vllm.config import parse_method_config
+ from eagle_harness.vllm.depth_stop import derived_cost_tables
+ from tests.test_chain_width import write_tables
+
+ # Batch one is priced, but the larger batch is missing the required draft width.
+ tables = _table(100.0, 1300.0)
+ from dataclasses import replace
+
+ tables[64] = replace(
+ tables[1],
+ batch_size=64,
+ intervals=tuple(replace(i, draft=replace(i.draft, index=(0, 1, 2, 3))) for i in tables[1].intervals),
+ )
+ write_tables(str(tmp_path), tables)
+ config = parse_method_config({"data_path": str(tmp_path), "max_verify_width": 16})
+ with pytest.raises(ValueError, match="batch size"):
+ derived_cost_tables(config)
+
+
+def test_derived_serving_prices_only_the_active_user_schedule(tmp_path):
+ from eagle_harness.vllm.config import parse_method_config
+ from eagle_harness.vllm.depth_stop import derived_cost_tables, round_costs
+ from tests.test_chain_width import write_tables
+
+ write_tables(str(tmp_path), _table(100.0, 1300.0))
+ config = parse_method_config({"data_path": str(tmp_path)}) # reserve width 32, serve width 16
+ tables = derived_cost_tables(config, schedule=[(1, 8, 15), (9, 512, 31)], max_batch_size=8)
+ assert round_costs(tables, 8, 8, 15).rest == 1300.0
+ with pytest.raises(ValueError, match="batch size 9"):
+ derived_cost_tables(config, schedule=[(1, 8, 15), (9, 512, 31)], max_batch_size=9)
+
+
+def _decide_after_step_2(cost_tables, min_gain=0.0) -> bool:
+ """One decision after step 2 on a hand-made tree: layer 1 at 0.9, layer 2 at 0.2, a frontier at 0.25.
+ Expected accept 1 + 4 x 0.9 + 11 x 0.2 = 6.8; the step's estimated gain 4 x (0.25 x 0.25 / 0.2 - 0.2) = 0.45."""
+ pytest.importorskip("vllm")
+ from eagle_harness.vllm.tree_drafter import TreeDrafter
+
+ attn = SimpleNamespace(
+ impl=SimpleNamespace(scale=1.0), sliding_window=None, num_heads=2, num_kv_heads=2, head_size=4
+ )
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+ drafter = TreeDrafter(
+ _Draft(), attn, top_k=4, depth=6, max_reqs=1, device=device, min_gain=min_gain, cost_tables=cost_tables
+ )
+ tree, shape = drafter.tree, drafter.tree.shape
+ tree.scores.zero_()
+ tree.scores[0, : shape.layer_start(2)] = 0.9
+ tree.scores[0, shape.layer_start(2) : shape.layer_start(3)] = 0.2
+ tree.front_scores[0] = 0.25
+ drafter._decide(1, 2, 15, 1)
+ return bool(drafter._go)
+
+
+@needs_triton
+def test_drafter_prices_a_step_by_the_steps_run():
+ # 2 steps run: 6.8 x 100 / (1300 + 2 x 100) = 0.453 > 0.45 stops; priced as after 3 steps (0.425) it would grow
+ assert not _decide_after_step_2(_table(100.0, 1300.0))
+ assert _decide_after_step_2(_table(100.0, 1600.0)) # 6.8 x 100 / 1800 = 0.378
+ assert _decide_after_step_2(None) # no tables: lossless
+ assert not _decide_after_step_2(None, min_gain=0.46) # a fixed gain (the config override)
+
+
+def test_drafter_stops_early_only_with_a_gain_and_enough_nodes():
+ pytest.importorskip("vllm")
+ from eagle_harness.vllm.tree_drafter import TreeDrafter
+
+ attn = SimpleNamespace(
+ impl=SimpleNamespace(scale=1.0), sliding_window=None, num_heads=2, num_kv_heads=2, head_size=4
+ )
+
+ def drafter(**kw):
+ return TreeDrafter(_Draft(), attn, top_k=4, max_reqs=1, device=torch.device("cpu"), **kw)
+
+ assert drafter(depth=6, min_gain=0.0).stops_early(15)
+ assert drafter(depth=6, min_gain=0.0)._first_decision(20) == 1 # 4 + 16 nodes after the first step
+ assert drafter(depth=6, min_gain=0.0)._first_decision(21) == 2
+ assert drafter(depth=6, min_gain=0.0).stops_early(31)
+ assert not drafter(depth=3, min_gain=0.0).stops_early(21) # no step left after the tree holds 21 nodes
+ assert not drafter(depth=6).stops_early(15)
+ assert not drafter(depth=2, min_gain=0.0).stops_early(3)
+
+
+# ---------------------------------------------------------------------------------------------- GPU: captured growth
+class _Model:
+ """A tiny draft with the interface TreeDrafter drives: rows attend through ``attend``; ``temp`` (a device tensor)
+ sets how confident the candidates are, so a replayed graph sees it change."""
+
+ def __init__(self, heads: int, dim: int, vocab: int, device: str):
+ gen = torch.Generator().manual_seed(0)
+ hd = heads * dim
+
+ def w(*shape):
+ return (torch.randn(*shape, generator=gen) * 0.3).to(device, torch.bfloat16)
+
+ self.config = SimpleNamespace(hidden_size=hd)
+ self.model = SimpleNamespace(
+ layers=[SimpleNamespace(self_attn=SimpleNamespace(qkv_proj=SimpleNamespace(weight=w(1))))]
+ )
+ self.wq, self.wk, self.wv, self.wo, self.emb, self.head = (
+ w(hd, hd),
+ w(hd, hd),
+ w(hd, hd),
+ w(hd, hd),
+ w(vocab, hd),
+ w(hd, vocab),
+ )
+ self.temp = torch.ones((), device=device)
+
+ def forward_rows(self, ids, positions, hidden, attend):
+ x = hidden + self.emb[ids]
+ h = x + attend(x @ self.wq, x @ self.wk, x @ self.wv) @ self.wo
+ return h, h
+
+ def candidate_topk(self, normed, k):
+ probs = ((normed.float() @ self.head.float()) * self.temp).softmax(-1)
+ values, ids = torch.topk(probs, k, dim=-1)
+ return values, ids
+
+
[email protected](not torch.cuda.is_available(), reason="CUDA graph conditional nodes need a GPU")
[email protected]("bs, count", [(1, 15), (2, 15), (1, 23), (64, 15), (128, 15), (256, 15), (512, 15)])
+def test_captured_growth_with_conditional_steps_equals_the_full_depth(bs, count, monkeypatch):
+ pytest.importorskip("vllm")
+ import vllm.distributed.parallel_state as ps
+
+ from eagle_harness.vllm.tree_drafter import TreeDrafter
+
+ @contextlib.contextmanager
+ def graph_capture(device): # no TP group in a unit test
+ yield SimpleNamespace(stream=torch.cuda.Stream())
+
+ monkeypatch.setattr(ps, "graph_capture", graph_capture)
+ dev, heads, dim, block, depth = "cuda", 2, 64, 16, 8
+ model = _Model(heads, dim, 300, dev)
+ attn = SimpleNamespace(
+ impl=SimpleNamespace(scale=dim**-0.5), sliding_window=None, num_heads=heads, num_kv_heads=heads, head_size=dim
+ )
+ kv = torch.randn(max(64, bs * 16), heads, block, 2 * dim, generator=torch.Generator().manual_seed(1)).to(
+ dev, torch.bfloat16
+ )
+ table = torch.arange(bs * 16, dtype=torch.int32, device=dev).view(bs, 16)
+ committed = torch.full((bs,), 40, dtype=torch.int64, device=dev)
+ committed[1::2] = 77
+
+ def rounds(graphs: bool, min_gain):
+ drafter = TreeDrafter(
+ model, attn, top_k=K, depth=depth, max_reqs=bs, device=torch.device(dev), min_gain=min_gain
+ )
+ drafter.bind_cache(kv, block)
+ drafter.graphs = graphs
+ out = []
+ # temp 0: every candidate has the same probability, so no child can outrank the verify set: a round that must stop
+ for r, temp in enumerate([1.0, 30.0, 1.0, 0.3, 30.0, 0.0]):
+ model.temp.fill_(temp)
+ gen = torch.Generator().manual_seed(r)
+ hidden = (torch.randn(bs, heads * dim, generator=gen) * 0.5).to(dev, torch.bfloat16)
+ probs, tokens = model.candidate_topk(hidden, K)
+ drafter.seed(bs, probs, tokens, hidden)
+ tokens, parents = drafter.grow_and_select(bs, count, committed, table)
+ out.append((tokens.clone(), parents.clone()))
+ torch.cuda.synchronize()
+ return out, drafter
+
+ full, _ = rounds(False, None)
+ early, drafter = rounds(True, 0.0)
+ for r, ((t0, p0), (t1, p1)) in enumerate(zip(full, early)):
+ assert torch.equal(t0, t1) and torch.equal(p0, p1), f"round {r}"
+ steps = drafter.mean_steps()
+ assert steps is not None and steps <= depth - 1
+ if count == 15: # the temp-0 round stops at the first decision (at count 23 the other trees need every step)
+ assert steps < depth - 1
+ lossy, drafter = rounds(True, 0.2)
+ assert drafter.mean_steps() <= steps
diff --git a/tests/test_draft_extend.py b/tests/test_draft_extend.py
new file mode 100644
index 0000000..b0adb2d
--- /dev/null
+++ b/tests/test_draft_extend.py
@@ -0,0 +1,123 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""DraftExtend on CPU: staging, rows per verify width, the next round's lengths and tree begin in the same body."""
+
+from types import SimpleNamespace
+from unittest import mock
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+from eagle_harness.sglang import draft_extend # noqa: E402
+
+K, H, IN, W, MAX_BS = 2, 4, 6, 4, 2
+
+
+class _Model:
+ def candidate_topk(self, normed, k):
+ return normed[:, :k].float(), normed[:, :k].long()
+
+
+def _extend():
+ tree = SimpleNamespace(
+ max_bs=MAX_BS,
+ shape=SimpleNamespace(top_k=K),
+ root_probs=torch.zeros(MAX_BS, K),
+ root_tokens=torch.zeros(MAX_BS, K, dtype=torch.long),
+ root_hidden=torch.zeros(MAX_BS, H),
+ )
+ began = []
+ steps = SimpleNamespace(
+ tree=tree,
+ seq_lens=torch.zeros(MAX_BS, dtype=torch.long),
+ req_pool_indices=torch.zeros(MAX_BS, dtype=torch.long),
+ begin_body=began.append,
+ )
+ runner = SimpleNamespace(
+ model=_Model(),
+ req_to_token_pool=SimpleNamespace(req_to_token=torch.arange(4 * 64).view(4, 64)),
+ dtype=torch.float32,
+ )
+ attention = mock.Mock()
+
+ def extend_rows(seq_lens, req, accept_lens, slots, positions, last, *, bs, width): # the kernel, in torch
+ table = runner.req_to_token_pool.req_to_token
+ pos = seq_lens[:, None] + torch.arange(width)
+ positions.copy_(pos.reshape(-1))
+ slots.copy_(table[req[:, None], pos].reshape(-1))
+ last.copy_(torch.arange(bs) * width + accept_lens - 1)
+
+ attention.build_extend_rows.side_effect = extend_rows
+ extend = draft_extend.DraftExtend(
+ runner, attention, steps, width=W, input_hidden_size=IN, widths=lambda bs: [W, 2, 1]
+ )
+ return extend, steps, began, attention
+
+
+def test_stage_copies_the_results_and_skips_hidden_already_in_place():
+ extend, *_ = _extend()
+ hidden = extend.hidden_rows(2)
+ hidden.copy_(torch.full((2, IN), 7.0))
+ extend.stage(torch.tensor([5, 6], dtype=torch.int32), hidden, torch.tensor([2]))
+ assert extend.accept_lens[0] == 2
+ assert extend.tokens[:2].tolist() == [5, 6] and torch.equal(extend.input_hidden[:2], torch.full((2, IN), 7.0))
+ extend.stage(torch.tensor([1, 2]), torch.ones(2, IN), torch.tensor([1]))
+ assert torch.equal(extend.input_hidden[:2], torch.ones(2, IN))
+
+
+def test_the_body_runs_the_verify_width_and_begins_the_next_round():
+ extend, steps, began, attention = _extend()
+ steps.seq_lens[0], steps.req_pool_indices[0] = 10, 3 # the round's batch, staged by the draft
+ extend.stage(torch.tensor([5, 6]), torch.arange(2 * IN).view(2, IN).float(), torch.tensor([2]))
+ calls = {}
+
+ def fake_rows(model, attn, *, input_ids, positions, out_cache_loc, hidden_states):
+ calls.update(input_ids=input_ids, positions=positions, slots=out_cache_loc, hidden=hidden_states)
+ rows = input_ids.shape[0]
+ normed = torch.arange(rows * H).view(rows, H).float()
+ return normed, normed + 100
+
+ with mock.patch.object(draft_extend, "forward_draft_rows", fake_rows):
+ probs, tokens, hidden = extend.run(1, 2)
+ assert calls["input_ids"].tolist() == [5, 6] and calls["positions"].tolist() == [10, 11]
+ assert calls["slots"].tolist() == [3 * 64 + 10, 3 * 64 + 11] and calls["hidden"].shape == (2, IN)
+ attention.build_extend_rows.assert_called_once()
+ assert attention.build_extend_rows.call_args.kwargs == {"bs": 1, "width": 2}
+ assert tokens[0].tolist() == [4, 5] and hidden[0].tolist() == [104.0, 105.0, 106.0, 107.0] # row accept_len - 1
+ assert steps.seq_lens[0] == 12 and steps.req_pool_indices[0] == 3 # committed: 10 + 2 accepted
+ assert began == [1]
+
+
+def test_the_fused_tail_compacts_into_the_extend_and_stages_it():
+ from eagle_harness.sglang import verify_step
+
+ extend, *_ = _extend()
+ accepted = SimpleNamespace(
+ accept_index=torch.tensor([[0, 2]]),
+ accept_lens=torch.tensor([2], dtype=torch.int32),
+ predict=torch.tensor([8, 9, 1, 1], dtype=torch.int32),
+ committed_slots=None,
+ accepted_slots=None,
+ )
+ compacted = {}
+
+ def fake_compact(rows, accept_index, out=None):
+ compacted["out"] = out
+ out.copy_(rows.flip(0))
+ return out
+
+ spec = SimpleNamespace(
+ draft_token=None, retrieve_index=None, retrieve_next_token=None, retrieve_next_sibling=None, max_tree_depth=2
+ )
+ rows = torch.arange(W * IN).view(W, IN).float()
+ with (
+ mock.patch.object(verify_step, "accept_tail", return_value=accepted),
+ mock.patch.object(verify_step, "compact_rows", fake_compact),
+ ):
+ _, out = verify_step._accept(spec, torch.zeros(W, 3), rows, None, None, None, None, mock.Mock(), extend)
+ assert out.data_ptr() == extend.input_hidden.data_ptr() and compacted["out"].shape == (W, IN)
+ assert torch.equal(extend.input_hidden[:W], rows.flip(0))
+ assert extend.accept_lens[0] == 2
+ assert extend.tokens[:W].tolist() == [8, 9, 1, 1]
diff --git a/tests/test_draft_input_gpu.py b/tests/test_draft_input_gpu.py
new file mode 100644
index 0000000..5ca0ece
--- /dev/null
+++ b/tests/test_draft_input_gpu.py
@@ -0,0 +1,23 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft embedding on CUDA: sglang's Triton lookup gives the same bits as ``F.embedding`` (GPU)."""
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ pytest.skip("needs a CUDA device", allow_module_level=True)
+
+from types import SimpleNamespace # noqa: E402
+
+from eagle_harness.sglang.models.llama_eagle4 import Eagle4Model # noqa: E402
+
+
[email protected]("rows", [1, 4, 16, 300])
+def test_triton_embedding_is_the_table_rows(rows):
+ g = torch.Generator(device="cuda").manual_seed(rows)
+ table = torch.randn(1000, 5120, device="cuda", generator=g).bfloat16()
+ ids = torch.randint(0, 1000, (rows,), device="cuda", generator=g)
+ model = SimpleNamespace(embed_full=table, embed_tokens=None, triton_embed=True)
+ assert torch.equal(Eagle4Model._embed(model, ids), torch.nn.functional.embedding(ids, table))
diff --git a/tests/test_draft_layer_input.py b/tests/test_draft_layer_input.py
new file mode 100644
index 0000000..ee337b0
--- /dev/null
+++ b/tests/test_draft_layer_input.py
@@ -0,0 +1,87 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft steps' layer input (:meth:`LlamaForCausalLMEagle4._layer_input`, :func:`stack_layer_input`): the two-launch
+path gives the same bits as the embedding + two norms + cat it replaces."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+from tests.triton_probe import needs_triton
+
+DEV = "cuda" if torch.cuda.is_available() else "cpu"
+
+
+@needs_triton
[email protected]("rows, hidden", [(4, 5120), (3, 1000)])
+def test_stack_layer_input_puts_the_token_row_beside_the_hidden_row(rows, hidden):
+ from eagle_harness.vllm.draft_rows import stack_layer_input
+
+ gen = torch.Generator().manual_seed(rows)
+ table = torch.randn(50, hidden, generator=gen).to(torch.bfloat16).to(DEV)
+ ids = torch.randint(0, 50, (rows,), generator=gen).to(DEV)
+ states = torch.randn(rows, 2 * hidden, generator=gen).to(torch.bfloat16).to(DEV)[:, :hidden] # a strided view
+ got = stack_layer_input(table, ids, states)
+ assert got.shape == (rows, 2, hidden) and got.is_contiguous()
+ assert torch.equal(got, torch.stack([table[ids], states], dim=1))
+
+
+def _draft(hidden: int, vocab: int, *, rank_start: int = 0):
+ """A ``LlamaForCausalLMEagle4`` shell with the parts ``_layer_input`` touches (TP 1)."""
+ pytest.importorskip("vllm")
+ from vllm.config import VllmConfig, set_current_vllm_config
+ from vllm.model_executor.layers.layernorm import RMSNorm
+
+ from eagle_harness.vllm import models
+
+ torch.manual_seed(0)
+ with set_current_vllm_config(VllmConfig()):
+ norms = [RMSNorm(hidden, eps=1e-6).to(DEV, torch.bfloat16) for _ in range(2)]
+ for norm in norms:
+ norm.weight.data.normal_(1.0, 0.1)
+ layer = SimpleNamespace(input_layernorm=norms[0], hidden_norm=norms[1])
+ weight = torch.randn(vocab, hidden, device=DEV, dtype=torch.bfloat16)
+ shard = SimpleNamespace(num_added_elements=0, num_org_vocab_padding=0, org_vocab_start_index=rank_start)
+ embed = SimpleNamespace(weight=weight, shard_indices=shard)
+ model = SimpleNamespace(layers=[layer], embed_tokens=embed, embed_input_ids=lambda ids: weight[ids])
+ draft = object.__new__(models.LlamaForCausalLMEagle4)
+ draft.__dict__.update(
+ model=model,
+ tp_size=1,
+ _max_rows=8,
+ _full_embed=None,
+ _input_norm_weights=None,
+ _norm_before_residual=False,
+ _modules={},
+ _parameters={},
+ )
+ from eagle_harness.vllm import model_rows
+
+ return model_rows, draft
+
+
+def test_layer_input_falls_back_off_cuda_or_with_a_padded_vocab(monkeypatch):
+ models, draft = _draft(64, 32, rank_start=7)
+ monkeypatch.setattr(models, "get_tensor_model_parallel_rank", lambda: 0)
+ states = torch.randn(4, 64, device=DEV, dtype=torch.bfloat16)
+ assert not draft._fused_layer_input(draft.model.layers[0], states)
+ assert draft._full_embed is None # nothing was built
+ out, residual = draft._layer_input(torch.tensor([1, 2, 3, 4], device=DEV), states)
+ assert out.shape == (4, 128) and residual is states
+
+
[email protected](not torch.cuda.is_available(), reason="vLLM's RMSNorm kernel needs a GPU")
[email protected]("rows", [1, 4, 8])
+def test_two_launch_layer_input_is_bit_identical(rows, monkeypatch):
+ models, draft = _draft(5120, 1000)
+ monkeypatch.setattr(models, "get_tensor_model_parallel_rank", lambda: 0)
+ ids = torch.randint(0, 1000, (rows,), device=DEV)
+ states = torch.randn(rows, 5120, device=DEV, dtype=torch.bfloat16)
+ with models._kernel_ops():
+ layer = draft.model.layers[0]
+ want = torch.cat([layer.input_layernorm(draft.model.embed_input_ids(ids)), layer.hidden_norm(states)], dim=-1)
+ got, residual = draft._layer_input(ids, states)
+ assert draft._full_embed is not None # the two-launch path ran
+ assert residual is states and torch.equal(got, want)
diff --git a/tests/test_draft_rows.py b/tests/test_draft_rows.py
new file mode 100644
index 0000000..bc0acba
--- /dev/null
+++ b/tests/test_draft_rows.py
@@ -0,0 +1,54 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Draft-step index math and KV writes (:mod:`eagle_harness.vllm.draft_rows`) against the torch code they replace."""
+
+import pytest
+import torch
+
+from tests.triton_probe import needs_triton
+
+DEV = "cuda" if torch.cuda.is_available() else "cpu"
+
+
+@needs_triton
+ "bs, steps, k, table_block, cache_block", [(1, 9, 4, 896, 16), (3, 5, 8, 32, 16), (2, 1, 2, 16, 16)]
+)
+def test_step_slots_match_the_torch_index_math(bs, steps, k, table_block, cache_block):
+ from eagle_harness.vllm.draft_rows import draft_step_slots
+
+ gen = torch.Generator().manual_seed(bs + steps)
+ blocks_per_req = 8
+ table = torch.randperm(100, generator=gen)[: bs * blocks_per_req].view(bs, blocks_per_req).int()
+ committed = torch.randint(0, blocks_per_req * table_block - steps * k, (bs,), generator=gen)
+ table, committed = table.to(DEV), committed.to(DEV)
+ # the code this replaces (TreeDrafter.grow before)
+ scratch = committed[:, None] + torch.arange(steps * k, device=DEV)
+ slots = (table.gather(1, scratch // table_block).long() * table_block + scratch % table_block).view(bs, steps, k)
+ rows = slots.transpose(0, 1).reshape(steps, bs * k)
+ positions = (committed[None, :] + torch.arange(steps, device=DEV)[:, None]).repeat_interleave(k, dim=1)
+ got = draft_step_slots(table, committed, steps=steps, top_k=k, table_block=table_block, cache_block=cache_block)
+ want = (slots, rows // cache_block, rows % cache_block, positions)
+ for g, w in zip(got, want):
+ assert g.dtype == torch.int64 and torch.equal(g, w)
+
+
+@needs_triton
[email protected]("heads, dim", [(2, 64), (10, 128)])
+def test_store_rows_kv_matches_the_indexed_store(heads, dim):
+ from eagle_harness.vllm.draft_rows import store_rows_kv
+
+ gen = torch.Generator().manual_seed(heads)
+ rows, nblocks, block = 8, 6, 16
+ # the draft layer's cache [blocks, heads, slots, 2D], viewed [blocks, slots, heads, 2D] (TreeDrafter.bind_cache)
+ cache = torch.randn(nblocks, heads, block, 2 * dim, generator=gen).to(DEV, torch.bfloat16)
+ view = cache.transpose(1, 2)
+ qkv = torch.randn(rows, 3 * heads * dim, generator=gen).to(DEV, torch.bfloat16)
+ _, key, value = qkv.split([heads * dim] * 3, dim=-1) # strided rows, as the draft layer's split gives them
+ flat = torch.randperm(nblocks * block, generator=gen)[:rows].to(DEV)
+ blocks, offsets = flat // block, flat % block
+ want = view.clone()
+ want[blocks, offsets] = torch.cat((key.reshape(rows, heads, dim), value.reshape(rows, heads, dim)), -1)
+ store_rows_kv(view, key, value, blocks, offsets)
+ assert torch.equal(view, want)
diff --git a/tests/test_draft_tree.py b/tests/test_draft_tree.py
new file mode 100644
index 0000000..7f432a9
--- /dev/null
+++ b/tests/test_draft_tree.py
@@ -0,0 +1,312 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""DraftTree bookkeeping on synthetic tensors (CPU), against direct re-implementations of
+sglang's beam layout (select_top_k_tokens / organize_draft_results) and a work-delta
+calculation over sorted scores."""
+
+import pytest
+import torch
+
+from eagle_harness.core.cost_model import CostModel, CostModelParams, SizeClass, WidthStep
+from eagle_harness.core.draft_tree import DEPTH_DECAY, ROOT_SCORE, DraftTree, TreeShape
+from eagle_harness.core.limits import ComputeIntensity
+
+K, DEPTH, H = 4, 6, 8
+
+
+def _random_round(bs, steps, seed=0):
+ gen = torch.Generator().manual_seed(seed)
+ root_p = torch.rand(bs, K, generator=gen).softmax(-1)
+ root_ids = torch.randint(0, 1000, (bs, K), generator=gen)
+ rounds = []
+ for _ in range(steps):
+ p = torch.rand(bs * K, K, generator=gen).softmax(-1)
+ p, _ = torch.sort(p, dim=-1, descending=True)
+ ids = torch.randint(0, 1000, (bs * K, K), generator=gen)
+ hidden = torch.randn(bs * K, H, generator=gen)
+ rounds.append((p, ids, hidden))
+ return root_p, root_ids, torch.randn(bs, H, generator=gen), rounds
+
+
+def _begin(tree, bs, root_p, root_ids, root_h):
+ tree.stage_root(bs, root_p, root_ids, root_h)
+ tree.begin(bs)
+
+
+def _sglang_reference(root_p, root_ids, rounds):
+ """sglang EAGLE beam: score_list / token_list / parents_list per step."""
+ bs = root_p.shape[0]
+ order = torch.argsort(root_p, dim=-1, descending=True)
+ scores = torch.gather(root_p, 1, order)
+ score_list, token_list, parents_list = (
+ [scores],
+ [torch.gather(root_ids, 1, order)],
+ [torch.arange(-1, K).expand(bs, -1)],
+ )
+ frontier_scores = scores
+ for i, (p, ids, _) in enumerate(rounds, start=1):
+ expand = (frontier_scores[:, :, None] * p.view(bs, K, K)).flatten(1)
+ top, pick = torch.topk(expand, K, dim=-1)
+ score_list.append(expand)
+ token_list.append(ids.view(bs, K * K))
+ parents_list.append(pick + K * K * (i - 1) + K)
+ frontier_scores = top
+ return torch.cat(score_list, 1), torch.cat(token_list, 1), parents_list
+
+
+def test_layout_matches_sglang_beam():
+ bs, steps = 2, DEPTH - 1
+ root_p, root_ids, root_h, rounds = _random_round(bs, steps)
+ tree = DraftTree(TreeShape(K, DEPTH), bs, H, torch.float32, torch.device("cpu"), max_verify=32)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ tree.set_step_slots(bs, step, torch.full((bs, K), step))
+ tree.step(bs, step, p, ids, hidden)
+ ref_scores, ref_tokens, ref_parents = _sglang_reference(root_p, root_ids, rounds)
+ n = tree.shape.num_nodes(DEPTH)
+ assert torch.allclose(tree.scores[:, :n], ref_scores)
+ assert torch.equal(tree.tokens[:, :n], ref_tokens)
+ for depth in range(2, DEPTH + 1):
+ expected = torch.cat(ref_parents[: depth - 1], dim=1)
+ assert torch.equal(tree.parents[:, : tree.shape.num_parents(depth)], expected)
+
+
+def test_frontier_hidden_and_ancestors_follow_parents():
+ bs = 1
+ root_p, root_ids, root_h, rounds = _random_round(bs, 2, seed=3)
+ tree = DraftTree(TreeShape(K, DEPTH), bs, H, torch.float32, torch.device("cpu"), max_verify=32)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ assert torch.equal(tree.front_hidden[:K], root_h.expand(K, -1))
+ tree.set_step_slots(bs, 1, torch.arange(10, 10 + K).view(1, K))
+ p, ids, hidden = rounds[0]
+ tree.step(bs, 1, p, ids, hidden)
+ expand = tree.scores[0, K : K + K * K]
+ pick = torch.topk(expand, K).indices
+ lanes = pick // K
+ assert torch.equal(tree.front_hidden[:K], hidden[lanes])
+ assert torch.equal(tree.ancestors[0, :, 0], (10 + lanes).to(torch.int32))
+ assert torch.equal(tree.front_tokens[:K], ids.view(-1)[pick])
+
+
+def _fork_work_deltas(work_scores, node_count, top_k, verify_num):
+ """calculate_work_deltas_kernel, one row."""
+ out = []
+ for j in range(top_k + 1):
+ k = min(node_count + j, verify_num)
+ a = work_scores[:node_count]
+ b = work_scores[node_count : node_count + j]
+ pa = pb = 0
+ total = 0.0
+ for _ in range(k):
+ va = a[pa] if pa < node_count else 0.0
+ vb = b[pb] if pb < j else 0.0
+ if va >= vb:
+ total += va
+ pa += 1
+ else:
+ total += vb
+ pb += 1
+ out.append(total)
+ return out
+
+
+def test_work_deltas_match_fork_kernel():
+ bs = 1
+ root_p, root_ids, root_h, rounds = _random_round(bs, 4, seed=7)
+ shape = TreeShape(K, DEPTH)
+ tree = DraftTree(shape, bs, H, torch.float32, torch.device("cpu"), max_verify=32)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ seg = [ROOT_SCORE] + torch.sort(root_p[0], descending=True).values.tolist()
+ for verify_num in (1, 2, 16, 32):
+ ref = torch.tensor(_fork_work_deltas(seg, 1, K, verify_num))
+ assert torch.allclose(tree.deltas[0, verify_num - 1], ref)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ best_before = tree.best[0].clone()
+ tree.set_step_slots(bs, step, torch.zeros(bs, K))
+ tree.step(bs, step, p, ids, hidden)
+ count = shape.count_before_step(step)
+ for verify_num in (1, 5, 16, 32):
+ n0 = min(verify_num, count)
+ seg = best_before[:n0].tolist() + tree.layer_top[0].tolist()
+ ref = torch.tensor(_fork_work_deltas(seg, n0, K, verify_num))
+ assert torch.allclose(tree.deltas[step, verify_num - 1], ref, atol=1e-6), (step, verify_num)
+
+
+def test_work_deltas_are_batch_means():
+ bs = 3
+ root_p, root_ids, root_h, rounds = _random_round(bs, 2, seed=21)
+ shape = TreeShape(K, DEPTH)
+ tree = DraftTree(shape, bs, H, torch.float32, torch.device("cpu"), max_verify=16)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ p, ids, hidden = rounds[0]
+ best_before = tree.best.clone()
+ tree.set_step_slots(bs, 1, torch.zeros(bs, K))
+ tree.step(bs, 1, p, ids, hidden)
+ n0 = min(16, shape.count_before_step(1))
+ rows = [_fork_work_deltas(best_before[b, :n0].tolist() + tree.layer_top[b].tolist(), n0, K, 16) for b in range(bs)]
+ assert torch.allclose(tree.deltas[1, 15], torch.tensor(rows).mean(dim=0), atol=1e-6)
+
+
+def test_best_set_is_top_of_all_scores():
+ bs = 1
+ root_p, root_ids, root_h, rounds = _random_round(bs, 3, seed=11)
+ shape = TreeShape(K, DEPTH, work_cap=20)
+ tree = DraftTree(shape, bs, H, torch.float32, torch.device("cpu"), max_verify=20)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ tree.set_step_slots(bs, step, torch.zeros(bs, K))
+ tree.step(bs, step, p, ids, hidden)
+ n = shape.num_nodes(step + 1)
+ every = torch.cat([torch.tensor([ROOT_SCORE]), tree.scores[0, :n]])
+ expected = torch.sort(every, descending=True).values[:20]
+ assert torch.allclose(tree.best[0, : expected.numel()], expected)
+
+
+def test_selection_ranks_by_decayed_score():
+ bs = 1
+ root_p, root_ids, root_h, rounds = _random_round(bs, 3, seed=5)
+ shape = TreeShape(K, DEPTH)
+ tree = DraftTree(shape, bs, H, torch.float32, torch.device("cpu"), max_verify=32)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ tree.set_step_slots(bs, step, torch.zeros(bs, K))
+ tree.step(bs, step, p, ids, hidden)
+ depth = 4
+ n = shape.num_nodes(depth)
+ decay = torch.ones(n)
+ for d in range(2, depth + 1):
+ decay[shape.layer_start(d) : shape.layer_start(d + 1)] = DEPTH_DECAY**d
+ ranked, scores = tree.rank(bs, depth, 15)
+ expected = torch.topk(tree.scores[0, :n] * decay, 15).indices
+ assert torch.equal(ranked[0], expected)
+ sel = tree.select(bs, depth, ranked, 8)
+ assert torch.equal(sel.top_scores_index[0], torch.sort(expected[:7]).values)
+ assert torch.equal(sel.draft_tokens[0], tree.tokens[0, sel.top_scores_index[0]])
+ scores = scores[0]
+ assert scores.shape == (16,)
+ assert abs(float(scores[0]) - ROOT_SCORE) < 1e-6
+ assert torch.allclose(scores[1:] - scores[:-1], (tree.scores[0, :n] * decay)[expected])
+
+
+def test_selection_parent_list_is_contiguous_for_a_batch():
+ # sglang's tree kernel reads parent_list as a dense [bs, parents] array (its JIT kernel checks the strides); a
+ # column slice of the [max_bs, parent_capacity] buffer has the capacity as row stride once bs > 1.
+ bs, depth = 3, 4
+ root_p, root_ids, root_h, rounds = _random_round(bs, 3, seed=7)
+ shape = TreeShape(K, DEPTH)
+ tree = DraftTree(shape, bs + 1, H, torch.float32, torch.device("cpu"), max_verify=32)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ tree.set_step_slots(bs, step, torch.zeros(bs, K))
+ tree.step(bs, step, p, ids, hidden)
+ ranked, _ = tree.rank(bs, depth, 15)
+ sel = tree.select(bs, depth, ranked, 8)
+ assert sel.parent_list.shape == (bs, shape.num_parents(depth)) and sel.parent_list.is_contiguous()
+ assert torch.equal(sel.parent_list, tree.parents[:bs, : shape.num_parents(depth)])
+
+
+def _node_depth(node: int) -> int:
+ return 1 if node < K else 2 + (node - K) // (K * K)
+
+
+def _node_parent(tree: DraftTree, b: int, node: int) -> int:
+ """Parent node index of ``node`` (-1: the root), from sglang's parent layout."""
+ if node < K:
+ return -1
+ depth = _node_depth(node)
+ lane = (node - tree.shape.layer_start(depth)) // K
+ return int(tree.parents[b, tree.shape.num_parents(depth) - K + lane])
+
+
+def test_verify_set_is_ancestor_closed():
+ bs = 2
+ root_p, root_ids, root_h, rounds = _random_round(bs, DEPTH - 1, seed=13)
+ tree = DraftTree(TreeShape(K, DEPTH), bs, H, torch.float32, torch.device("cpu"), max_verify=32)
+ _begin(tree, bs, root_p, root_ids, root_h)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ tree.set_step_slots(bs, step, torch.zeros(bs, K))
+ tree.step(bs, step, p, ids, hidden)
+ for width in (2, 4, 8, 16):
+ ranked, _ = tree.rank(bs, DEPTH, width - 1)
+ for b in range(bs):
+ chosen = set(ranked[b].tolist())
+ for node in chosen:
+ parent = _node_parent(tree, b, node)
+ assert parent == -1 or parent in chosen, (width, node, parent)
+ assert max(_node_depth(n) for n in chosen) <= width - 1
+
+
+def _cost_model(intensity, verify_num=16):
+ return CostModel(
+ tables={},
+ params=CostModelParams(),
+ intensity=intensity,
+ node_top_k=K,
+ tree_depth=DEPTH,
+ verify_num=verify_num,
+ )
+
+
+def test_history_budget_exceeds_verify_width_and_fits_the_deltas():
+ """Regression: at batch size 1 the history budget is floored to 32 while the verify width is 16, and
+ the work deltas were sized by the width (IndexError on the first decode round)."""
+ for intensity in (ComputeIntensity.HIGH, ComputeIntensity.CHAIN):
+ cost = _cost_model(intensity)
+ seen = set()
+ for tiny in (False, True):
+ cost.tier.tiny = tiny
+ for size in SizeClass:
+ cost.tier.size = size
+ for verify_num in (1, 4, 16):
+ for _ in range(16):
+ cost.record_verify_num(1, verify_num)
+ seen.add(cost.history_verify_num(1))
+ assert max(seen) <= cost.max_history_verify_num, intensity
+ if intensity is ComputeIntensity.HIGH:
+ assert max(seen) == 32 > cost.verify_num
+ cost = _cost_model(ComputeIntensity.HIGH)
+ cost.tier.tiny = True
+ past = cost.history_verify_num(1)
+ tree = DraftTree(
+ TreeShape(K, DEPTH),
+ 1,
+ H,
+ torch.float32,
+ torch.device("cpu"),
+ max_verify=cost.max_history_verify_num,
+ delta_slots=cost.launch_depths,
+ )
+ root_p, root_ids, root_h, rounds = _random_round(1, 2, seed=3)
+ _begin(tree, 1, root_p, root_ids, root_h)
+ for step, (p, ids, hidden) in enumerate(rounds, start=1):
+ best_before = tree.best[0].clone()
+ tree.set_step_slots(1, step, torch.zeros(1, K))
+ tree.step(1, step, p, ids, hidden)
+ # Step 2 is a launch depth: its row for budget ``past`` is the reference output with verify_num=past.
+ count = tree.shape.count_before_step(2)
+ n0 = min(past, count)
+ ref = _fork_work_deltas(best_before[:n0].tolist() + tree.layer_top[0].tolist(), n0, K, past)
+ assert torch.allclose(tree.deltas[2, past - 1], torch.tensor(ref), atol=1e-6)
+
+
+def test_deltas_only_at_launch_depths():
+ cost = _cost_model(ComputeIntensity.HIGH)
+ assert cost.launch_depths == tuple(d for d in range(DEPTH - 1) if d % 2 == 0)
+ for depth in range(DEPTH):
+ if cost.width_step(depth) is WidthStep.LAUNCH:
+ assert depth in cost.launch_depths
+ tree = DraftTree(
+ TreeShape(K, DEPTH), 1, H, torch.float32, torch.device("cpu"), max_verify=32, delta_slots=cost.launch_depths
+ )
+ root_p, root_ids, root_h, rounds = _random_round(1, 1, seed=5)
+ _begin(tree, 1, root_p, root_ids, root_h)
+ tree.set_step_slots(1, 1, torch.zeros(1, K))
+ tree.step(1, 1, *rounds[0])
+ assert tree.deltas[1].abs().sum() == 0 # odd depth: never read, never computed
+ assert tree.deltas[0].abs().sum() > 0
+
+
+def test_delta_budget_must_fit_the_best_set():
+ with pytest.raises(ValueError, match="work_cap"):
+ DraftTree(TreeShape(K, DEPTH, work_cap=16), 1, H, torch.float32, torch.device("cpu"), max_verify=32)
diff --git a/tests/test_draft_vocab.py b/tests/test_draft_vocab.py
new file mode 100644
index 0000000..088af55
--- /dev/null
+++ b/tests/test_draft_vocab.py
@@ -0,0 +1,35 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Both model ports apply the same full-vocabulary draft contract."""
+
+import importlib
+
+import pytest
+
+transformers = pytest.importorskip("transformers")
+
+
[email protected]("engine", ["sglang", "vllm"])
[email protected]("draft_vocab", ["omitted", None, 0, 1000, 320])
+def test_draft_vocabulary_admission(engine, draft_vocab):
+ pytest.importorskip(engine)
+ path = "sglang.models.llama_eagle4" if engine == "sglang" else "vllm.models"
+ check_supported = importlib.import_module(f"eagle_harness.{path}").check_supported
+ config = transformers.LlamaConfig(
+ architectures=["LlamaForCausalLMEagle4"],
+ num_hidden_layers=1,
+ hidden_size=256,
+ num_attention_heads=4,
+ num_key_value_heads=2,
+ intermediate_size=512,
+ vocab_size=1000,
+ efficient_lm_head_config={"type": "low_rank", "rank": 32, "num_candidates": 64},
+ )
+ if draft_vocab != "omitted":
+ config.draft_vocab_size = draft_vocab
+ if draft_vocab == 320:
+ with pytest.raises(NotImplementedError, match="reduced vocab"):
+ check_supported(config)
+ else:
+ check_supported(config)
diff --git a/tests/test_drafter.py b/tests/test_drafter.py
new file mode 100644
index 0000000..b0e64af
--- /dev/null
+++ b/tests/test_drafter.py
@@ -0,0 +1,321 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""DynamicDrafter wiring checks that run on CPU (the round itself needs CUDA graphs)."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+from eagle_harness.core.cost_model import CostModel, CostModelParams, FixedShapePolicy
+from eagle_harness.core.draft_tree import DraftTree, TreeShape
+from eagle_harness.core.limits import ComputeIntensity
+
+pytest.importorskip("sglang")
+from eagle_harness.sglang.drafter import DynamicDrafter # noqa: E402
+
+K, DEPTH, H, WIDTH = 4, 12, 8, 16
+
+
+def _drafter(tree: DraftTree, cost: CostModel) -> DynamicDrafter:
+ return DynamicDrafter(
+ SimpleNamespace(tree=tree),
+ cost,
+ fixed=FixedShapePolicy(ComputeIntensity.HIGH, K, DEPTH, WIDTH),
+ build_trivial_input=lambda batch: None,
+ target_worker=SimpleNamespace(
+ model_runner=SimpleNamespace(
+ model_config=SimpleNamespace(model_is_mrope=False),
+ kv_index_translator=SimpleNamespace(reads_are_translated=True),
+ )
+ ),
+ algorithm=SimpleNamespace(target_verify_graphs=None),
+ widths=lambda bs: [WIDTH, 8, 1],
+ tree_mask_mode=None,
+ device=torch.device("cpu"),
+ )
+
+
+def _cost() -> CostModel:
+ return CostModel(
+ tables={},
+ params=CostModelParams(),
+ intensity=ComputeIntensity.HIGH,
+ node_top_k=K,
+ tree_depth=DEPTH,
+ verify_num=WIDTH,
+ )
+
+
+def test_drafter_refuses_deltas_sized_by_the_verify_width():
+ """The configuration of that regression (deltas for budgets 1..16, history budget 32) fails at startup."""
+ cost = _cost()
+ tree = DraftTree(TreeShape(K, DEPTH), 1, H, torch.float32, torch.device("cpu"), max_verify=WIDTH)
+ with pytest.raises(ValueError, match="budgets up to 32"):
+ _drafter(tree, cost)
+
+
+def test_drafter_refuses_missing_launch_depths():
+ cost = _cost()
+ tree = DraftTree(TreeShape(K, DEPTH), 1, H, torch.float32, torch.device("cpu"), max_verify=32, delta_slots=(0, 2))
+ with pytest.raises(ValueError, match="at depths"):
+ _drafter(tree, cost)
+
+
+class _Event:
+ def __init__(self):
+ self.records = 0
+
+ def record(self):
+ self.records += 1
+
+ def synchronize(self):
+ pass
+
+ def query(self):
+ return True
+
+
+class _Steps(SimpleNamespace):
+ def run(self, bs, step):
+ self.ran.append(step)
+
+
+class _StopAt:
+ """The real cost model's step kinds; DECIDE stops at ``stop``."""
+
+ def __init__(self, cost: CostModel, stop: int):
+ self.cost, self.stop = cost, stop
+
+ def __getattr__(self, name):
+ return getattr(self.cost, name)
+
+ def tree_width(self, depth, bs, past, row, deltas):
+ return SimpleNamespace(stop=depth >= self.stop)
+
+
+def _sequenced(tiny: bool, stop: int, policy=None):
+ cost = _cost()
+ cost.tier.tiny = tiny
+ tree = DraftTree(
+ TreeShape(K, DEPTH), 1, H, torch.float32, torch.device("cpu"), max_verify=32, delta_slots=cost.launch_depths
+ )
+ steps = _Steps(tree=tree, ran=[], max_step=DEPTH - 1, host_deltas=torch.zeros(DEPTH, 32, K + 1))
+ drafter = DynamicDrafter.__new__(DynamicDrafter)
+ drafter.steps, drafter.tree, drafter.cost = steps, tree, _StopAt(cost, stop)
+ drafter.fixed = FixedShapePolicy(ComputeIntensity.HIGH, K, DEPTH, WIDTH)
+ drafter.live, drafter.timer, drafter._seeding = None, None, None
+ drafter._deltas_ready, drafter._deltas_slot = _Event(), 0
+ drafter._policy = drafter.fixed if policy == "fixed" else drafter.cost
+ drafter.policy = lambda bs: drafter._policy
+ return drafter, steps
+
+
[email protected]("tiny,first", [(True, 3), (False, 1)])
+def test_queue_runs_the_steps_before_the_first_decision(tiny, first):
+ """Batch size 1 (tiny): depths 0-1 keep, depth 2 launches, depth 3 decides; otherwise depth 1 decides."""
+ drafter, steps = _sequenced(tiny, stop=99)
+ assert drafter._queue_until_decision(1, drafter.cost) == first
+ assert steps.ran == list(range(1, first + 1))
+ assert drafter._deltas_slot == first - 1 and drafter._deltas_ready.records == 1
+
+
[email protected]("stop", [3, 5, 7])
+def test_prelaunched_and_direct_rounds_run_the_same_steps(stop):
+ direct, steps = _sequenced(True, stop)
+ policy = direct.cost
+ depth = direct._grow(1, direct._queue_until_decision(1, policy), None, 32, policy)
+ resumed, resumed_steps = _sequenced(True, stop)
+ policy = resumed.cost
+ first = resumed._queue_until_decision(1, policy) # at the end of the previous round
+ assert resumed._grow(1, first, None, 32, policy) == depth == stop + 1
+ assert steps.ran == resumed_steps.ran == list(range(1, stop + 1))
+
+
+def test_grow_stops_at_the_deepest_level():
+ drafter, steps = _sequenced(True, stop=99)
+ assert drafter._grow(1, drafter._queue_until_decision(1, drafter.cost), None, 32, drafter.cost) == DEPTH
+ assert steps.ran == list(range(1, DEPTH))
+
+
+def test_fixed_shape_runs_every_step_without_host_decisions():
+ """mode static / the live seed sweep: the whole tree is queued ahead, no work deltas are copied or waited on."""
+ drafter, steps = _sequenced(True, stop=0, policy="fixed")
+ fixed = drafter.fixed
+ first = drafter._queue_until_decision(1, fixed)
+ assert first == DEPTH - 1 and steps.ran == list(range(1, DEPTH))
+ assert drafter._deltas_ready.records == 0
+ assert drafter._grow(1, first, None, WIDTH, fixed) == DEPTH
+ assert steps.ran == list(range(1, DEPTH))
+ assert fixed.verify_num_paged([], 40, 1, 100, lagged=True) == (WIDTH, False)
+ fixed.force_width = 8
+ assert fixed.verify_num_paged([], 40, 1, 100, lagged=True) == (8, False)
+ assert fixed.verify_count(1, 5) == 5 and fixed.history_verify_num(1) == WIDTH
+
+
+def test_batch_key_is_the_block_table_rows():
+ from eagle_harness.sglang.drafter import batch_key
+
+ batch = SimpleNamespace(reqs=[SimpleNamespace(kv=SimpleNamespace(req_pool_idx=i)) for i in (3, 1)])
+ assert batch_key(batch) == (3, 1)
+
+
+class _ChainSteps(SimpleNamespace):
+ max_step = 6 # --speculative-num-steps 7: the widest chain verifies 8 tokens
+
+ def run(self, bs, step):
+ assert 1 <= step <= self.max_step # DraftTree.step's range
+ self.ran.append(step)
+
+ def load_batch(self, bs, seq_lens, req_pool_indices):
+ self.loaded.append(bs)
+
+ def begin(self, bs, probs, tokens, hidden):
+ self.begun.append(bs)
+
+
+class _Tail:
+ def __init__(self):
+ self.built = []
+
+ def ranked_verify_input(self, bs, depth, count, width, on_rank):
+ self.built.append((bs, depth, count, width))
+ return SimpleNamespace(prepared_mrope_positions=None)
+
+
+def _chain_drafter(widths):
+ """A drafter with a fixed width per round (``widths`` handed out in order) and recording fakes."""
+ drafter = DynamicDrafter.__new__(DynamicDrafter)
+ plan = iter(widths)
+ drafter._chain_width = lambda bs: next(plan)
+ drafter.steps = _ChainSteps(ran=[], loaded=[], begun=[])
+ drafter.tail = _Tail()
+ drafter._trivial = lambda batch: "trivial"
+ drafter._bonus = torch.zeros(4, dtype=torch.int64)
+ drafter._device = torch.device("cpu")
+ drafter._pending = None
+ return drafter
+
+
+def _chain_batch(bs):
+ return SimpleNamespace(
+ seq_lens=torch.full((bs,), 100),
+ req_pool_indices=torch.arange(bs),
+ reqs=[SimpleNamespace(kv=SimpleNamespace(req_pool_idx=i)) for i in range(bs)],
+ spec_info=SimpleNamespace(topk_p=None, topk_index=None, hidden_states=None, bonus_tokens=torch.ones(bs)),
+ multimodal_inputs=[None] * bs,
+ )
+
+
+def test_fixed_width_chain_drafts_width_minus_one_tokens_and_verifies_them():
+ """The begin drafts depth 1, so width 4 (3 drafted tokens) runs steps 1 and 2."""
+ drafter = _chain_drafter([4])
+ drafter.draft(_chain_batch(2))
+ assert drafter.steps.ran == [1, 2] and drafter.steps.begun == [2]
+ assert drafter.tail.built == [(2, 3, 3, 4)]
+ assert (drafter.last_depth, drafter.last_width) == (3, 4)
+
+
+def test_the_widest_chain_ends_at_the_last_draft_step():
+ """Width 8 with --speculative-num-steps 7: 7 drafted tokens, steps 1..6 (a step 7 was out of the tree's range)."""
+ drafter = _chain_drafter([8, 2])
+ drafter.draft(_chain_batch(4))
+ assert drafter.steps.ran == [1, 2, 3, 4, 5, 6]
+ assert drafter.tail.built == [(4, 7, 7, 8)]
+ drafter.draft(_chain_batch(4)) # width 2: the begin's token only
+ assert drafter.steps.ran == [1, 2, 3, 4, 5, 6] and drafter.steps.begun == [4, 4]
+ assert drafter.tail.built[-1] == (4, 1, 1, 2)
+
+
+def test_fixed_width_one_is_plain_decoding():
+ """Width 1 drafts nothing but still stages the batch: the draft extend after the verify reads it from the steps
+ (a stale batch there wrote the draft KV of other requests and broke acceptance)."""
+ drafter = _chain_drafter([1])
+ assert drafter.draft(_chain_batch(2)) == "trivial"
+ assert drafter.steps.loaded == [2]
+ assert drafter.steps.ran == [] and drafter.steps.begun == [] and drafter.tail.built == []
+ assert drafter.last_width == 1
+
+
+def test_prelaunched_chain_keeps_the_width_it_was_queued_with():
+ """The plan is asked once per round: by the prelaunch, which queues the whole chain, not again by the draft."""
+ drafter = _chain_drafter([6, 2])
+ batch = _chain_batch(1)
+ drafter._prelaunch_stream = None
+ drafter._take_pending = lambda: drafter.__dict__.pop("_pending_round", None)
+ width = drafter._chain_width(1)
+ from eagle_harness.sglang.drafter import Prelaunch, batch_key
+
+ drafter._pending_round = Prelaunch(batch_key(batch), drafter._queue_chain(1, width), width, stream=None)
+ drafter.draft(batch)
+ assert drafter.steps.ran == [1, 2, 3, 4] and drafter.steps.begun == []
+ assert drafter.tail.built == [(1, 5, 5, 6)]
+ drafter.draft(_chain_batch(3)) # no prelaunch for this batch: the plan's next width
+ assert drafter.tail.built[-1] == (3, 1, 1, 2)
+
+
[email protected]("cycles, offset, sampled", [(1, -1, False), (1, 0, True), (1, 1, False), (2, 0, True)])
+def test_live_draft_costs_continue_sampling_after_seeding(cycles, offset, sampled):
+ from eagle_harness.core.live_costs import LiveCosts
+ from eagle_harness.sglang.drafter import LIVE_REFRESH_ROUNDS
+
+ drafter, _ = _sequenced(True, stop=0)
+ drafter.live = LiveCosts(widths=lambda bs: [1, 8])
+ drafter._rounds = LIVE_REFRESH_ROUNDS * cycles + offset
+ drafter._bucket = lambda bs: bs
+ events = []
+ drafter.timer = SimpleNamespace(start=lambda: "start", stop=lambda *args: events.append(args))
+ assert drafter._timed_steps(4, lambda: 3) == 3
+ assert events == ([("start", 4, 0, 0, 3)] if sampled else [])
+
+
+def test_prelaunched_draft_timing_uses_the_incoming_batch_and_context():
+ from eagle_harness.core.live_costs import LiveCosts
+
+ drafter, _ = _sequenced(True, stop=0)
+ drafter.live = LiveCosts(widths=lambda bs: [1, 8])
+ drafter._seeding = (4, 100) # The previous batch is shrinking before its next prelaunch.
+ drafter._bucket = lambda bs: bs
+ events = []
+ drafter.timer = SimpleNamespace(start=lambda: "start", stop=lambda *args: events.append(args))
+ assert drafter._timed_steps(2, lambda: 3, context=2048) == 3
+ assert events == [("start", 2, 0, 2048, 3)]
+
+
+def test_cached_or_refreshed_unusable_live_costs_keep_fixed_shape():
+ from eagle_harness.core.live_costs import DRAFT_WIDTH, LiveCosts
+ from eagle_harness.sglang.drafter import LIVE_REFRESH_ROUNDS
+
+ drafter, _ = _sequenced(True, stop=0)
+ del drafter.policy # Exercise the production policy, not the step-order fixture's override.
+ drafter.cost = _cost()
+ drafter.live = LiveCosts(widths=lambda bs: [1, 8, 16], seed_samples=1)
+ for width in (1, 8, 16):
+ drafter.live.record(1, width, 100, 4000.0)
+ drafter.live.record(1, DRAFT_WIDTH, 100, 2000.0) # target/draft ratio 2: not priced by this model
+ drafter.cost.set_tables(drafter.live.tables())
+ drafter._bucket = lambda bs: bs
+ drafter.timer = SimpleNamespace(drain=lambda **kw: None)
+ drafter._sync_cells = drafter._save_cells = None
+ drafter._unpriced = set()
+ batch = SimpleNamespace(reqs=[None], seq_lens_cpu=torch.tensor([100]))
+ for previous_rounds in (0, LIVE_REFRESH_ROUNDS - 1):
+ drafter._rounds = previous_rounds
+ drafter._unpriced.clear()
+ drafter._begin_round(batch)
+ assert drafter.policy(1) is drafter.fixed
+ # A new measurement can recover the bucket on a later refresh.
+ drafter.live.cells[(1, DRAFT_WIDTH, 0)].us = 170.0
+ drafter._rounds = LIVE_REFRESH_ROUNDS - 1
+ drafter._begin_round(batch)
+ assert drafter.policy(1) is drafter.cost
+
+
+def test_a_bucket_the_cost_model_refuses_keeps_the_fixed_shape(caplog):
+ """Live costs outside the cost model's ratio checks must not raise mid-serving."""
+ drafter, _ = _sequenced(True, stop=0)
+ drafter._unpriced = set()
+ with caplog.at_level("WARNING"):
+ drafter._check_priced(1) # the model has no table for bucket 1
+ assert drafter._unpriced == {1} and "keeps the fixed draft shape" in caplog.text
diff --git a/tests/test_eagle3_attention.py b/tests/test_eagle3_attention.py
new file mode 100644
index 0000000..e91a002
--- /dev/null
+++ b/tests/test_eagle3_attention.py
@@ -0,0 +1,57 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Grouped-query EAGLE3 draft attention in the cost-model worker."""
+
+import pytest
+import torch
+from tests.triton_probe import needs_triton
+
+pytest.importorskip("sglang")
+
+
+@needs_triton
[email protected]("step", [0, 2])
[email protected]("window", [0, 8])
+def test_native_grouped_query_draft_rows(step, window):
+ from eagle_harness.sglang.row_attention import EXTEND_LAUNCH, MAX_SPLITS, STEP_LAUNCH, rows_attention
+
+ device = "cuda" if torch.cuda.is_available() else "cpu"
+ dtype = torch.bfloat16 if device == "cuda" else torch.float32
+ gen = torch.Generator().manual_seed(732)
+ q = torch.randn(4, 4, 64, generator=gen).to(device=device, dtype=dtype)
+ k, v = [torch.randn(64, 1, 64, generator=gen).to(device=device, dtype=dtype) for _ in range(2)]
+ table = torch.arange(64, dtype=torch.int32, device=device)[None]
+ req = torch.zeros(1, dtype=torch.int64, device=device)
+ lengths = torch.tensor([16], device=device)
+ ancestors = torch.arange(32, 40, device=device, dtype=torch.int32).view(1, 4, 2)
+ out = torch.empty_like(q)
+ parts = 4 * (MAX_SPLITS + 1) * 16
+ partial = torch.empty(parts, 64, dtype=torch.float32, device=device)
+ lse = torch.empty(parts, dtype=torch.float32, device=device)
+ rows_attention(
+ q,
+ k,
+ v,
+ out,
+ partial,
+ lse,
+ table,
+ lengths,
+ ancestors,
+ rows_per_request=4,
+ step=step,
+ window=window,
+ scale=0.125,
+ launch=EXTEND_LAUNCH if step == 0 else STEP_LAUNCH,
+ table_rows=req,
+ )
+ for row in range(4):
+ position = 16 + (row if step == 0 else step - 1)
+ start = max(0, position - window + 1) if window else 0
+ keys = list(range(start, position + 1 if step == 0 else 16))
+ if step:
+ keys += ancestors[0, row].tolist()
+ kr, vr = k[keys, 0].float(), v[keys, 0].float()
+ want = (q[row].float() @ kr.T * 0.125).softmax(-1) @ vr
+ torch.testing.assert_close(out[row].float(), want, atol=2e-2, rtol=2e-2)
diff --git a/tests/test_eagle3_config.py b/tests/test_eagle3_config.py
new file mode 100644
index 0000000..094511f
--- /dev/null
+++ b/tests/test_eagle3_config.py
@@ -0,0 +1,25 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Native EAGLE3 metadata must not be reinterpreted as EAGLE4 metadata."""
+
+from types import SimpleNamespace
+
+from eagle_harness.vllm.config import configure_speculative_config
+
+
+def test_native_eagle3_preserves_input_layer_ids():
+ draft = SimpleNamespace(
+ architectures=["Eagle3LlamaForCausalLM"],
+ eagle_aux_hidden_state_layer_ids=[1, 16, 31],
+ )
+ spec = SimpleNamespace(
+ method_config={"mode": "static", "node_top_k": 4, "tree_depth": 5, "max_verify_width": 8},
+ draft_model_config=SimpleNamespace(hf_config=draft),
+ num_speculative_tokens=None,
+ num_speculative_tokens_per_batch_size=None,
+ update_arch_=lambda: None,
+ )
+ configure_speculative_config(spec)
+ assert draft.eagle_aux_hidden_state_layer_ids == [1, 16, 31]
+ assert draft.architectures == ["Eagle3ForHarness"]
diff --git a/tests/test_eagle3_sglang.py b/tests/test_eagle3_sglang.py
new file mode 100644
index 0000000..c923b15
--- /dev/null
+++ b/tests/test_eagle3_sglang.py
@@ -0,0 +1,55 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The worker must retain the learned EAGLE3 head and map its tokens."""
+
+import pytest
+
+pytest.importorskip("sglang.srt.speculative.spec_registry")
+from eagle_harness.sglang.algorithm import EagleHarnessSpecAlgo
+
+
+def test_harness_uses_native_eagle3_head_initialization():
+ from types import SimpleNamespace
+
+ import torch
+ from sglang.srt.speculative.eagle_worker_v2 import EagleDraftWorker
+
+ from eagle_harness.sglang.models.llama_eagle3 import Eagle3LlamaForCausalLM
+
+ draft = object.__new__(Eagle3LlamaForCausalLM)
+ torch.nn.Module.__init__(draft)
+ draft.config = SimpleNamespace(hidden_size=4)
+ draft.model = torch.nn.Module()
+ draft.model.embed_tokens = torch.nn.Embedding(8, 4)
+ draft.model.fc = torch.nn.Linear(12, 4, bias=False)
+ draft.model.layers = torch.nn.ModuleList([torch.nn.Module()])
+ draft.model.layers[0].hidden_norm = torch.nn.LayerNorm(4, bias=False)
+ draft.lm_head = torch.nn.Linear(4, 3, bias=False)
+ head = torch.arange(12, dtype=torch.float32).view(3, 4)
+ fc = torch.arange(48, dtype=torch.float32).view(4, 12)
+ draft.load_weights(
+ [
+ ("d2t", torch.tensor([1, 2, 5])),
+ ("t2d", torch.zeros(8, dtype=torch.bool)),
+ ("lm_head.weight", head),
+ ("fc.weight", fc),
+ ("midlayer.hidden_norm.weight", torch.full((4,), 2.0)),
+ ]
+ )
+ draft.load_lm_head_from_target = False
+ embed = torch.nn.Parameter(torch.ones(8, 4))
+ target_head = torch.nn.Parameter(torch.ones(8, 4))
+ worker = SimpleNamespace(
+ speculative_algorithm=EagleHarnessSpecAlgo("EAGLE_HARNESS", False),
+ draft_runner=SimpleNamespace(model=draft),
+ target_worker=SimpleNamespace(model_runner=SimpleNamespace(model=torch.nn.Module())),
+ _resolve_shared_embed_and_head=lambda: (embed, target_head),
+ hot_token_id=None,
+ )
+ EagleDraftWorker.init_lm_head(worker)
+ assert draft.model.embed_tokens.weight is embed
+ torch.testing.assert_close(draft.lm_head.weight, head)
+ torch.testing.assert_close(worker.hot_token_id, torch.tensor([1, 3, 7]))
+ torch.testing.assert_close(draft.model.fc.weight, fc)
+ torch.testing.assert_close(draft.model.layers[0].hidden_norm.weight, torch.full((4,), 2.0))
diff --git a/tests/test_eagle3_vllm.py b/tests/test_eagle3_vllm.py
new file mode 100644
index 0000000..a14a197
--- /dev/null
+++ b/tests/test_eagle3_vllm.py
@@ -0,0 +1,24 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The harness tree uses native EAGLE3 draft-to-target logits mapping."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+pytest.importorskip("vllm")
+from eagle_harness.vllm.eagle3 import Eagle3ForHarness
+
+
+def test_candidates_are_target_ids_with_reduced_vocab_probabilities():
+ draft = object.__new__(Eagle3ForHarness)
+ torch.nn.Module.__init__(draft)
+ draft.config = SimpleNamespace(vocab_size=8, draft_vocab_size=3)
+ draft.lm_head = torch.nn.Linear(4, 3, bias=False)
+ draft.draft_id_to_target_id = torch.nn.Parameter(torch.tensor([1, 2, 5]), requires_grad=False)
+ draft.logits_processor = lambda head, hidden: torch.tensor([[1.0, 3.0, 2.0]])
+ probs, ids = draft.candidate_topk(torch.zeros(1, 4), 2)
+ assert ids.tolist() == [[3, 7]]
+ torch.testing.assert_close(probs, torch.tensor([[1.0, 3.0, 2.0]]).softmax(-1)[:, [1, 2]])
diff --git a/tests/test_eagle4_model.py b/tests/test_eagle4_model.py
new file mode 100644
index 0000000..6ce5c58
--- /dev/null
+++ b/tests/test_eagle4_model.py
@@ -0,0 +1,418 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 draft model port: supported structures and checkpoint names (CPU, no weights)."""
+
+from __future__ import annotations
+
+import logging
+import os
+import sys
+import types
+from types import SimpleNamespace
+
+import pytest
+
+pytest.importorskip("sglang.srt.models.llama")
+
+import torch # noqa: E402
+
+from eagle_harness.core.config import harness_config_from_dict # noqa: E402
+from eagle_harness.sglang.models import llama_eagle4 # noqa: E402
+from eagle_harness.sglang.models.llama_eagle4 import ( # noqa: E402
+ Eagle4DecoderLayer,
+ LlamaForCausalLMEagle4,
+ _base_layer_config,
+ _checkpoint_name,
+ _NoRotary,
+ build_latent_moe,
+ check_supported,
+ replicate_embedding,
+)
+
+transformers = pytest.importorskip("transformers")
+
+# config.json of the Nemotron 3.5 Super EAGLE-4 drafts (sep27-r128-k128-exported; oct08-r128-k128-iter1001 is identical).
+NEMOTRON_CONFIG_PATH = os.path.join(os.path.dirname(__file__), "golden", "nemotron35_super_eagle4_draft_config.json")
+
+# Tensor names of EAGLE4-Qwen3.8-27B-final-v3/model.safetensors.
+CHECKPOINT = {
+ "efficient_lm_head.weight": "efficient_lm_head.weight",
+ "efficient_lm_head_down_proj.weight": "efficient_lm_head_down_proj.weight",
+ "embed_tokens.weight": "model.embed_tokens.weight",
+ "fc.weight": "model.fc.weight",
+ "fc_norm.0.weight": "model.fc_norm.0.weight",
+ "fc_norm.2.weight": "model.fc_norm.2.weight",
+ "layers.0.hidden_norm.weight": "model.layers.0.hidden_norm.weight",
+ "layers.0.input_layernorm.weight": "model.layers.0.input_layernorm.weight",
+ "layers.0.mlp.down_proj.weight": "model.layers.0.mlp.down_proj.weight",
+ "layers.0.mlp.gate_proj.weight": "model.layers.0.mlp.gate_proj.weight",
+ "layers.0.post_attention_layernorm.weight": "model.layers.0.post_attention_layernorm.weight",
+ "layers.0.self_attn.q_proj.weight": "model.layers.0.self_attn.q_proj.weight",
+ "lm_head.weight": "lm_head.weight",
+ "norm.weight": "model.norm.weight",
+ # legacy spellings
+ "midlayer.mlp.up_proj.weight": "model.layers.0.mlp.up_proj.weight",
+ "model.layers.0.self_attn.o_proj.weight": "model.layers.0.self_attn.o_proj.weight",
+ "fc.linear.weight": "model.fc.weight",
+ # Nemotron 3.5 Super drafts (attn_norm, latent MoE)
+ "midlayer.eh_proj.weight": "model.layers.0.eh_proj.weight",
+ "midlayer.pre_attention_layernorm.weight": "model.layers.0.pre_attention_layernorm.weight",
+ "midlayer.mlp.experts.511.up_proj.weight": "model.layers.0.mlp.experts.511.up_proj.weight",
+ "midlayer.mlp.gate.e_score_correction_bias": "model.layers.0.mlp.gate.e_score_correction_bias",
+ "midlayer.mlp.fc1_latent_proj.weight": "model.layers.0.mlp.fc1_latent_proj.weight",
+ "midlayer.mlp.shared_experts.down_proj.weight": "model.layers.0.mlp.shared_experts.down_proj.weight",
+}
+
+
[email protected]("name, param", sorted(CHECKPOINT.items()))
+def test_checkpoint_names(name, param):
+ assert _checkpoint_name(name) == param
+
+
+def test_replicated_embedding_is_the_unpadded_table_of_the_gathered_shards():
+ vocab, hidden, tp = 100, 8, 4
+ table = torch.randn(104, hidden) # four shards of 26 rows; the last 4 rows pad the vocab
+ shards = table.chunk(tp)
+ full = replicate_embedding(shards[2], vocab, lambda shard: torch.cat(shards, dim=0))
+ assert full.shape == (vocab, hidden) and full.is_contiguous()
+ assert torch.equal(full, table[:vocab])
+ tokens = torch.tensor([0, 25, 26, 99])
+ assert torch.equal(torch.nn.functional.embedding(tokens, full), table[tokens])
+
+
+def test_the_draft_keeps_its_own_lm_head():
+ """sglang's EAGLE draft setup hands a draft the target's embedding and LM head; EAGLE-4 takes only the embedding."""
+ calls = []
+ draft = type("Draft", (), {"set_embed": lambda self, embed: calls.append(embed), "lm_head": "own head"})()
+ LlamaForCausalLMEagle4.set_embed_and_head(draft, "target embed", "target head")
+ assert calls == ["target embed"]
+ assert draft.lm_head == "own head"
+
+
+# The structure keys of the Nemotron 3.5 Super EAGLE-4 drafts (oct08-r128-k128-iter1001, sep27-r128-k128-exported).
+NEMOTRON_DRAFT = dict(
+ architectures=["LlamaForCausalLMEagle4"],
+ attn_norm=True,
+ draft_vocab_size=1000,
+ eagle_config={"eagle_aux_hidden_state_layer_ids": [7, 47, 78]},
+ efficient_lm_head_config={"num_candidates": 128, "rank": 128, "type": "low_rank"},
+ enable_moe=True,
+ fc_norm=True,
+ head_dim=64,
+ hidden_act="relu2",
+ hidden_size=256,
+ intermediate_size=512,
+ layer_types=["sliding_attention"],
+ max_position_embeddings=1048576,
+ moe_architecture="nemotron_latent_relu2",
+ moe_intermediate_size=96,
+ moe_latent_size=64,
+ moe_shared_expert_intermediate_size=192,
+ n_group=1,
+ n_routed_experts=16,
+ n_shared_experts=1,
+ norm_output=True,
+ norm_topk_prob=True,
+ num_attention_heads=4,
+ num_experts_per_tok=4,
+ num_hidden_layers=1,
+ num_key_value_heads=4,
+ routed_scaling_factor=5.0,
+ scoring_func="sigmoid",
+ sliding_window=4096,
+ target_hidden_size=256,
+ topk_group=1,
+ topk_method="noaux_tc",
+ use_rope=False,
+ vocab_size=1000,
+)
+
+
+def test_the_nemotron_draft_structures_are_supported():
+ check_supported(transformers.LlamaConfig(**NEMOTRON_DRAFT))
+
+
+ "extra",
+ [
+ {"moe_architecture": "sparse_swiglu", "hidden_act": "silu"},
+ {"enable_post_mlp_norm": True, "norm_output": False},
+ {"share_draft_embedding_from_target": False},
+ ],
+)
+def test_structures_sglang_does_not_build_are_refused(extra):
+ with pytest.raises(NotImplementedError):
+ check_supported(transformers.LlamaConfig(**{**NEMOTRON_DRAFT, **extra}))
+
+
+def test_the_base_layer_gets_a_silu_mlp_and_no_long_rope_table_for_a_nope_draft():
+ config = transformers.LlamaConfig(**NEMOTRON_DRAFT)
+ base = _base_layer_config(config)
+ assert (base.hidden_act, base.max_position_embeddings) == ("silu", 1)
+ assert (config.hidden_act, config.max_position_embeddings) == ("relu2", 1048576)
+ roped = _base_layer_config(transformers.LlamaConfig(**{**NEMOTRON_DRAFT, "use_rope": True}))
+ assert roped.max_position_embeddings == 1048576
+
+
+def test_nope_leaves_q_and_k_unchanged():
+ q, k = torch.randn(3, 8), torch.randn(3, 4)
+ out_q, out_k = _NoRotary()(torch.arange(3), q, k)
+ assert out_q is q and out_k is k
+
+
+class _Param:
+ def __init__(self):
+ self.calls = []
+
+ def weight_loader(self, param, weight, *args, **kwargs):
+ self.calls.append((args, kwargs))
+
+
+def test_latent_moe_experts_load_into_the_ungated_expert_banks():
+ params = {name: _Param() for name in ("m.mlp.experts.w13_weight", "m.mlp.experts.w2_weight", "m.mlp.gate.weight")}
+ load = LlamaForCausalLMEagle4._load_latent_moe_weight
+ w = torch.zeros(1)
+ assert load(params, "m.mlp.experts.7.up_proj.weight", w) == "m.mlp.experts.w13_weight"
+ assert load(params, "m.mlp.experts.7.down_proj.weight", w) == "m.mlp.experts.w2_weight"
+ assert load(params, "m.mlp.gate.weight", w) == "m.mlp.gate.weight"
+ assert params["m.mlp.experts.w13_weight"].calls == [
+ (("m.mlp.experts.w13_weight",), dict(shard_id="w1", expert_id=7))
+ ]
+ assert params["m.mlp.experts.w2_weight"].calls == [(("m.mlp.experts.w2_weight",), dict(shard_id="w2", expert_id=7))]
+ assert params["m.mlp.gate.weight"].calls == [((), {})]
+ with pytest.raises(KeyError):
+ load(params, "m.mlp.shared_experts.up_proj.weight", w)
+
+
[email protected]("duplicate", [False, True])
+def test_missing_latent_expert_is_rejected_even_when_another_is_repeated(duplicate):
+ draft = object.__new__(LlamaForCausalLMEagle4)
+ torch.nn.Module.__init__(draft)
+ draft.config = transformers.LlamaConfig(**{**NEMOTRON_DRAFT, "n_routed_experts": 2})
+ prefix = "model.layers.0.mlp.experts"
+ params = {f"{prefix}.{bank}_weight": _Param() for bank in ("w13", "w2")}
+ params.update({name: _Param() for name in ("efficient_lm_head.weight", "efficient_lm_head_down_proj.weight")})
+ draft.named_parameters = lambda: params.items()
+ names = [f"{prefix}.{expert}.{proj}_proj.weight" for expert in range(2) for proj in ("up", "down")]
+ weights = [(name, torch.zeros(1)) for name in params if name.startswith("efficient_")]
+ weights += [(name, torch.zeros(1)) for name in names[:-1]]
+ if duplicate:
+ weights.append((names[0], torch.zeros(1)))
+ with pytest.raises(RuntimeError, match="missing"):
+ draft.load_weights(weights)
+ # The complete stream must load both expert banks and the candidate head.
+ draft.load_weights(weights[:2] + [(name, torch.zeros(1)) for name in names])
+
+
+def _layer(attn_norm: bool, reduce_mlp: bool):
+ """An ``Eagle4DecoderLayer`` shell whose parts are affine maps, to follow the data through ``forward``."""
+ layer = object.__new__(Eagle4DecoderLayer)
+ torch.nn.Module.__init__(layer)
+ layer.attn_norm, layer.reduce_mlp = attn_norm, reduce_mlp
+ layer.input_layernorm = lambda x: x + 1
+ layer.hidden_norm = lambda x: x * 2
+ layer.eh_proj = lambda x: (x[:, :2] + x[:, 2:], None) # 2H -> H
+ layer.pre_attention_layernorm = lambda x: x * 10
+ # q/k/v of 2H or H inputs -> H outputs: the sum of the H-wide chunks, plus 100
+ layer.self_attn = lambda positions, hidden_states, forward_batch: hidden_states.view(1, -1, 2).sum(1) + 100
+ layer.post_attention_layernorm = lambda x, residual: (x - residual, x + residual)
+ layer.mlp = lambda x: x * 3
+ return layer
+
+
[email protected]("attn_norm", [True, False])
+def test_the_layer_attends_over_the_fused_input_and_reduces_a_moe_partial_sum(monkeypatch, attn_norm):
+ embeds, hidden = torch.tensor([[1.0, 2.0]]), torch.tensor([[3.0, 4.0]])
+ monkeypatch.setattr(llama_eagle4, "tensor_model_parallel_all_reduce", lambda x: x * 1000)
+ fused = (embeds + 1) + hidden * 2 # eh_proj(cat(input_layernorm(embeds), hidden_norm(hidden)))
+ # attn_norm: eh_proj's output is the residual and its norm feeds attention; else the cat feeds it, the raw
+ # hidden is the residual.
+ attn, res = (fused * 10 + 100, fused) if attn_norm else (fused + 100, hidden)
+ for reduce_mlp, scale in ((False, 1), (True, 1000)):
+ mlp, residual = _layer(attn_norm, reduce_mlp)(None, embeds, hidden, None)
+ assert torch.equal(residual, attn + res)
+ assert torch.equal(mlp, (attn - res) * 3 * scale)
+
+
+# --- The real Nemotron draft config, the latent MoE block and its checkpoint experts ---
+
+
+def nemotron_draft_config():
+ return transformers.LlamaConfig.from_json_file(NEMOTRON_CONFIG_PATH)
+
+
+def test_the_real_nemotron_draft_config_is_supported():
+ config = nemotron_draft_config()
+ check_supported(config)
+ assert (config.n_routed_experts, config.num_experts_per_tok, config.moe_latent_size) == (512, 22, 1024)
+ assert (config.attn_norm, config.use_rope, config.hidden_act, config.sliding_window) == (True, False, "relu2", 4096)
+
+
+ "field", ["n_routed_experts", "num_experts_per_tok", "moe_intermediate_size", "moe_latent_size"]
+)
+def test_a_latent_moe_draft_missing_an_expert_field_is_refused_by_name(field):
+ """The engine block reads these from the checkpoint; a config without them must fail here, not deep in sglang."""
+ config = nemotron_draft_config()
+ delattr(config, field)
+ with pytest.raises(ValueError, match=field):
+ check_supported(config)
+
+
+class _FakeNemotronHMoE(torch.nn.Module):
+ """Stands in for sglang's block, which needs a CUDA MoE runner: records what the port hands it."""
+
+ def __init__(self, config, layer_idx, quant_config, prefix):
+ super().__init__()
+ self.config, self.layer_idx, self.quant_config, self.prefix = config, layer_idx, quant_config, prefix
+
+
+def _latent_moe_host(monkeypatch, moe_gate_acc="fp32", ep_size=1, a2a_none=True):
+ """One TP rank with no expert parallelism, the cleaned harness config and the fake engine block."""
+ monkeypatch.setattr(
+ llama_eagle4, "get_parallel", lambda: SimpleNamespace(tp_size=1, moe_tp_size=1, moe_ep_size=ep_size)
+ )
+ monkeypatch.setattr(llama_eagle4, "get_moe_a2a_backend", lambda: SimpleNamespace(is_none=lambda: a2a_none))
+ options = {"mode": "static", "draft_model": {"moe_gate_acc": moe_gate_acc}}
+ monkeypatch.setattr(llama_eagle4, "harness_config", lambda: harness_config_from_dict(options))
+ module = types.ModuleType("sglang.srt.models.nemotron_h")
+ module.NemotronHMoE = _FakeNemotronHMoE
+ monkeypatch.setitem(sys.modules, "sglang.srt.models.nemotron_h", module)
+
+
+def test_the_latent_moe_is_the_engine_block_over_the_checkpoint_experts(monkeypatch, caplog):
+ """Expert count, top-k and widths come from the draft config; the harness has no MoE knob for them."""
+ _latent_moe_host(monkeypatch)
+ config = nemotron_draft_config()
+ with caplog.at_level(logging.WARNING, logger=llama_eagle4.logger.name):
+ moe = build_latent_moe(config, "model.layers.0.mlp")
+ assert isinstance(moe, _FakeNemotronHMoE)
+ assert (moe.layer_idx, moe.quant_config, moe.prefix) == (0, None, "model.layers.0.mlp")
+ assert (moe.config.n_routed_experts, moe.config.num_experts_per_tok, moe.config.moe_latent_size) == (512, 22, 1024)
+ assert moe.config.moe_intermediate_size == 2688
+ assert (moe.config.n_shared_experts, moe.config.routed_scaling_factor) == (1, 5.0)
+ assert (moe.config.mlp_hidden_act, moe.config.mlp_bias, moe.config.norm_topk_prob) == ("relu2", False, True)
+ assert moe.config is not config and not hasattr(config, "mlp_hidden_act")
+ assert caplog.text == ""
+
+
+def test_a_non_fp32_gate_accumulation_is_kept_as_a_knob_but_ignored_with_a_warning(monkeypatch, caplog):
+ _latent_moe_host(monkeypatch, moe_gate_acc="bf16")
+ with caplog.at_level(logging.WARNING, logger=llama_eagle4.logger.name):
+ build_latent_moe(nemotron_draft_config(), "m")
+ assert "moe_gate_acc" in caplog.text and "latent MoE ignores it" in caplog.text
+
+
[email protected]("host", [dict(ep_size=2), dict(a2a_none=False)])
+def test_expert_parallel_layouts_are_refused_before_the_block_is_built(monkeypatch, host):
+ _latent_moe_host(monkeypatch, **host)
+ with pytest.raises(ValueError, match="moe EP 1"):
+ build_latent_moe(nemotron_draft_config(), "m")
+
+
+class _ExpertBank:
+ """A FusedMoE expert bank as sglang loads an ungated expert (``w1`` fills the whole ``w13`` row)."""
+
+ def __init__(self, shape):
+ self.data = torch.zeros(shape, dtype=torch.float64)
+
+ def weight_loader(self, param, weight, name, shard_id, expert_id):
+ assert param is self and shard_id in ("w1", "w2")
+ self.data[expert_id] = weight
+
+
+def _reference_latent_moe(x, ckpt, top_k, scale):
+ """The block as sglang's ``NemotronHMoE`` computes it, expert by expert.
+
+ Sigmoid router; top-k over the bias-corrected scores; the unbiased scores, renormalized, weight the routed
+ ReLU^2 experts in the latent space; ``routed_scaling_factor`` scales the routed sum before ``fc2_latent_proj``;
+ a ReLU^2 shared expert is added after.
+ """
+ scores = torch.sigmoid(x @ ckpt["gate.weight"].T)
+ chosen = torch.topk(scores + ckpt["gate.e_score_correction_bias"], top_k, dim=-1).indices
+ weights = torch.gather(scores, -1, chosen)
+ weights = weights / weights.sum(-1, keepdim=True)
+ latent = x @ ckpt["fc1_latent_proj.weight"].T
+ routed = torch.zeros_like(latent)
+ for token in range(x.shape[0]):
+ for k in range(top_k):
+ expert = int(chosen[token, k])
+ up = torch.relu(latent[token] @ ckpt[f"experts.{expert}.up_proj.weight"].T) ** 2
+ routed[token] += weights[token, k] * (up @ ckpt[f"experts.{expert}.down_proj.weight"].T)
+ shared = torch.relu(x @ ckpt["shared_experts.up_proj.weight"].T) ** 2 @ ckpt["shared_experts.down_proj.weight"].T
+ return (scale * routed) @ ckpt["fc2_latent_proj.weight"].T + shared
+
+
+def test_the_packed_expert_banks_compute_the_reference_latent_moe():
+ """Tiny forward: the checkpoint's per-expert tensors, loaded through the port into packed ``w13``/``w2`` banks
+ and applied as the fused ungated kernel does, equal the expert-by-expert reference."""
+ experts, hidden, latent, inter, shared, top_k, scale = 6, 16, 8, 12, 20, 3, 5.0
+ g = torch.Generator().manual_seed(0)
+ rnd = lambda *shape: torch.randn(*shape, generator=g, dtype=torch.float64) # noqa: E731
+ ckpt = {
+ "gate.weight": rnd(experts, hidden),
+ "gate.e_score_correction_bias": rnd(experts),
+ "fc1_latent_proj.weight": rnd(latent, hidden),
+ "fc2_latent_proj.weight": rnd(hidden, latent),
+ "shared_experts.up_proj.weight": rnd(shared, hidden),
+ "shared_experts.down_proj.weight": rnd(hidden, shared),
+ }
+ for e in range(experts):
+ ckpt[f"experts.{e}.up_proj.weight"] = rnd(inter, latent)
+ ckpt[f"experts.{e}.down_proj.weight"] = rnd(latent, inter)
+
+ prefix = "model.layers.0.mlp"
+ w13, w2 = _ExpertBank((experts, inter, latent)), _ExpertBank((experts, latent, inter))
+ params = {f"{prefix}.experts.w13_weight": w13, f"{prefix}.experts.w2_weight": w2}
+ load = LlamaForCausalLMEagle4._load_latent_moe_weight
+ routed_tensors = {name: weight for name, weight in ckpt.items() if name.startswith("experts.")}
+ assert len(routed_tensors) == 2 * experts
+ loaded = {load(params, f"{prefix}.{name}", weight) for name, weight in routed_tensors.items()}
+ assert loaded == set(params)
+
+ x = rnd(5, hidden)
+ scores = torch.sigmoid(x @ ckpt["gate.weight"].T)
+ chosen = torch.topk(scores + ckpt["gate.e_score_correction_bias"], top_k, dim=-1).indices
+ weights = torch.gather(scores, -1, chosen)
+ weights = weights / weights.sum(-1, keepdim=True)
+ latent_x = x @ ckpt["fc1_latent_proj.weight"].T
+ shared_out = (
+ torch.relu(x @ ckpt["shared_experts.up_proj.weight"].T) ** 2 @ ckpt["shared_experts.down_proj.weight"].T
+ )
+
+ def packed_forward(w13_bank, w2_bank):
+ """The fused ungated kernel: every chosen expert's bank row on the token's latent input, weighted and summed."""
+ up = torch.relu(torch.einsum("tl,tkil->tki", latent_x, w13_bank[chosen])) ** 2
+ routed = (torch.einsum("tki,tkli->tkl", up, w2_bank[chosen]) * weights[..., None]).sum(1)
+ return (scale * routed) @ ckpt["fc2_latent_proj.weight"].T + shared_out
+
+ packed = packed_forward(w13.data, w2.data)
+ torch.testing.assert_close(packed, _reference_latent_moe(x, ckpt, top_k, scale))
+ # Shifting every expert's bank by one changes the function: the expert index mapping is load-bearing.
+ assert not torch.allclose(packed_forward(w13.data.roll(1, 0), w2.data), packed)
+
+
+def test_the_candidate_gather_skips_the_entry_barrier(monkeypatch):
+ """Consecutive candidate gathers are separated by the draft's all-reduces, so the gatherer drops its entry
+ barrier (sglang's ``skip_entry_sync``); the output stays the rank-major view of the last-dim gather."""
+ from eagle_harness.sglang.models import llama_eagle4 as module
+
+ built = []
+
+ class Gatherer:
+ def __init__(self, max_tokens, **kwargs):
+ built.append((max_tokens, kwargs))
+
+ def __call__(self, x):
+ return torch.cat([x, x + 1], dim=-1) # a two-rank gather along the last dim
+
+ monkeypatch.setattr(module, "MultimemAllGatherer", Gatherer)
+ monkeypatch.setattr(module, "recommended_max_tokens", lambda **kwargs: 128)
+ draft = type("Draft", (), {"_candidate_gatherer": None, "_tp_size": 2})()
+ packed = torch.arange(6, dtype=torch.int32).view(2, 3)
+ out = LlamaForCausalLMEagle4._gather_packed_candidates(draft, packed)
+ assert built == [(128, {"skip_entry_sync": True})]
+ want = torch.stack([packed, (packed.view(torch.bfloat16) + 1).view(torch.int32)])
+ assert out.shape == (2, 2, 3) and torch.equal(out, want)
+ assert LlamaForCausalLMEagle4._gather_packed_candidates(draft, packed).shape == (2, 2, 3) and len(built) == 1
diff --git a/tests/test_eagle4_port.py b/tests/test_eagle4_port.py
new file mode 100644
index 0000000..552dd43
--- /dev/null
+++ b/tests/test_eagle4_port.py
@@ -0,0 +1,64 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The EAGLE-4 structures both engine ports build (``eagle4_config.check_ported``), on synthetic configs."""
+
+from __future__ import annotations
+
+import pytest
+
+transformers = pytest.importorskip("transformers")
+
+from eagle_harness.models.eagle4_config import UNPORTED, check_ported # noqa: E402
+
+
+def _config(**extra):
+ base = dict(
+ architectures=["LlamaForCausalLMEagle4"],
+ num_hidden_layers=1,
+ hidden_size=256,
+ num_attention_heads=4,
+ num_key_value_heads=2,
+ intermediate_size=512,
+ vocab_size=1000,
+ efficient_lm_head_config={"type": "low_rank", "rank": 32, "num_candidates": 64},
+ )
+ base.update(extra)
+ return transformers.LlamaConfig(**base)
+
+
+def test_dense_one_layer_draft_with_the_low_rank_head_is_ported():
+ check_ported(_config())
+
+
[email protected]("draft_vocab", [None, 0, 1000])
+def test_full_draft_vocab_is_ported(draft_vocab):
+ check_ported(_config(draft_vocab_size=draft_vocab))
+
+
+def test_reduced_draft_vocab_is_refused():
+ with pytest.raises(NotImplementedError, match="reduced vocab"):
+ check_ported(_config(draft_vocab_size=320))
+
+
+ "extra",
+ [
+ {"attn_norm": True},
+ {"enable_post_mlp_norm": True},
+ {"use_rope": False},
+ {"num_hidden_layers": 2},
+ {"efficient_lm_head_config": None},
+ ],
+)
+def test_unported_structures_are_refused(extra):
+ with pytest.raises(NotImplementedError):
+ check_ported(_config(**extra))
+
+
+def test_an_engine_can_refuse_more():
+ # sglang's draft worker always shares the target embedding
+ config = _config(share_draft_embedding_from_target=False)
+ check_ported(config)
+ with pytest.raises(NotImplementedError, match="share_draft_embedding_from_target"):
+ check_ported(config, {**UNPORTED, "share_draft_embedding_from_target": False})
diff --git a/tests/test_eagle4_structure.py b/tests/test_eagle4_structure.py
new file mode 100644
index 0000000..bddad0c
--- /dev/null
+++ b/tests/test_eagle4_structure.py
@@ -0,0 +1,122 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Engine-independent draft structure decisions and config preparation."""
+
+from copy import deepcopy
+from types import SimpleNamespace
+
+import pytest
+
+from eagle_harness.models.eagle4_structure import (
+ LATENT_MOE_ARCHITECTURE,
+ base_layer_overrides,
+ draft_moe_architecture,
+ draft_uses_rope,
+ latent_moe_config,
+)
+
+
+ "fields, expected",
+ [
+ ({}, True),
+ ({"use_rope": True, "partial_rotary_factor": 1}, True),
+ ({"partial_rotary_factor": None}, True),
+ ({"use_rope": False}, False),
+ ({"use_rope": True, "position_embedding_type": "none"}, False),
+ ({"use_rope": True, "partial_rotary_factor": 0}, False),
+ ],
+)
+def test_rotary_selection(fields, expected):
+ assert draft_uses_rope(SimpleNamespace(**fields)) is expected
+
+
+ "fields, expected",
+ [
+ ({}, None),
+ ({"enable_moe": False, "moe_architecture": LATENT_MOE_ARCHITECTURE}, None),
+ ({"enable_moe": True}, "sparse_swiglu"),
+ ({"enable_moe": True, "moe_architecture": LATENT_MOE_ARCHITECTURE}, LATENT_MOE_ARCHITECTURE),
+ ],
+)
+def test_moe_selection(fields, expected):
+ assert draft_moe_architecture(SimpleNamespace(**fields)) == expected
+
+
[email protected]("moe", [False, True])
+ "rope", [{}, {"use_rope": False}, {"position_embedding_type": "none"}, {"partial_rotary_factor": 0}]
+)
+def test_base_layer_overrides_only_replace_temporary_parts(moe, rope):
+ config = SimpleNamespace(
+ enable_moe=moe,
+ moe_architecture=LATENT_MOE_ARCHITECTURE,
+ hidden_act="relu2" if moe else "silu",
+ max_position_embeddings=131072,
+ **rope,
+ )
+ before = deepcopy(vars(config))
+ expected = {"hidden_act": "silu"} if moe else {}
+ if rope:
+ expected["max_position_embeddings"] = 1
+ assert base_layer_overrides(config) == expected
+ assert vars(config) == before
+
+
+ "fields, expected",
+ [
+ ({}, (0, 1, 1, True, 1.0)),
+ ({"n_shared_experts": None, "n_group": 0, "topk_group": None}, (0, 1, 1, True, 1.0)),
+ ({"n_group": 4}, (0, 4, 4, True, 1.0)),
+ (
+ {
+ "n_shared_experts": 2,
+ "n_group": 4,
+ "topk_group": 2,
+ "norm_topk_prob": False,
+ "routed_scaling_factor": 2.5,
+ },
+ (2, 4, 2, False, 2.5),
+ ),
+ ],
+)
+def test_latent_moe_config_preserves_checkpoint_fields_and_normalizes_engine_defaults(fields, expected):
+ config = SimpleNamespace(
+ hidden_act="relu2",
+ hidden_size=256,
+ moe_latent_size=64,
+ n_routed_experts=8,
+ moe_intermediate_size=128,
+ num_experts_per_tok=2,
+ mlp_bias=True,
+ **fields,
+ )
+ before = deepcopy(vars(config))
+ prepared = latent_moe_config(config)
+ assert prepared is not config
+ assert vars(config) == before
+ assert prepared.mlp_hidden_act == "relu2"
+ assert prepared.mlp_bias is False
+ assert (
+ prepared.n_shared_experts,
+ prepared.n_group,
+ prepared.topk_group,
+ prepared.norm_topk_prob,
+ prepared.routed_scaling_factor,
+ ) == expected
+ for field in ("hidden_size", "moe_latent_size", "n_routed_experts", "moe_intermediate_size", "num_experts_per_tok"):
+ assert getattr(prepared, field) == getattr(config, field)
+
+
+def test_latent_moe_config_keeps_config_type_and_class_attributes():
+ class Config:
+ hidden_act = "relu2"
+ moe_latent_size = 64
+
+ prepared = latent_moe_config(Config())
+ assert isinstance(prepared, Config)
+ assert prepared.mlp_hidden_act == "relu2"
+ assert prepared.moe_latent_size == 64
diff --git a/tests/test_engine_release.py b/tests/test_engine_release.py
new file mode 100644
index 0000000..ff19ee2
--- /dev/null
+++ b/tests/test_engine_release.py
@@ -0,0 +1,281 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Exercise the real publisher CLI against an isolated, file-backed gh fake."""
+
+import hashlib
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+import zipfile
+
+import pytest
+
+REPO = Path(__file__).resolve().parents[1]
+TOOL = REPO / "tools/engine_release.py"
+TAG = "v0.1.0"
+
+
+def release(tmp_path, monkeypatch):
+ remote = tmp_path / "remote"
+ remote.mkdir()
+ log = tmp_path / "gh.jsonl"
+ fake = tmp_path / "bin/gh"
+ fake.parent.mkdir()
+ fake.write_text(
+ f"#!{sys.executable}\n"
+ + """
+import json
+import os
+from pathlib import Path
+import shutil
+import sys
+args = sys.argv[1:]
+with open(os.environ["GH_TEST_LOG"], "a") as log:
+ log.write(json.dumps(args) + "\\n")
+repository = os.environ.get("GH_TEST_REPOSITORY", "eagle-hq/EAGLE-4")
+if args[:2] == ["repo", "view"]:
+ assert args[2:] == [repository, "--json", "isPrivate"], args
+ print(json.dumps({"isPrivate": os.environ.get("GH_TEST_PRIVATE") == "true"}))
+ sys.exit(0)
+assert args[-2:] == ["--repo", repository], args
+args = args[:-2]
+assert args[0] == "release" and args[2] == "v0.1.0", args
+remote = Path(os.environ["GH_TEST_REMOTE"])
+if args[1] == "view":
+ print(json.dumps({"tagName": "v0.1.0", "isDraft": os.environ.get("GH_TEST_DRAFT") == "true",
+ "assets": [{"name": p.name} for p in remote.iterdir()]}))
+elif args[1] == "upload":
+ assert len(args) == 4, args
+ source = Path(args[3])
+ target = remote / source.name
+ assert not target.exists(), "no clobber"
+ shutil.copyfile(source, target)
+elif args[1] == "download":
+ name = args[args.index("--pattern") + 1]
+ if "--dir" in args:
+ target = Path(args[args.index("--dir") + 1]) / name
+ else:
+ target = Path(args[args.index("--output") + 1])
+ shutil.copyfile(remote / name, target)
+ if os.environ.get("GH_TEST_CORRUPT") == name:
+ target.write_bytes(b"corrupted transfer")
+else:
+ raise AssertionError(args)
+"""
+ )
+ fake.chmod(0o755)
+ monkeypatch.setenv("PATH", f"{fake.parent}{os.pathsep}{os.environ['PATH']}")
+ monkeypatch.setenv("GH_TEST_REMOTE", str(remote))
+ monkeypatch.setenv("GH_TEST_LOG", str(log))
+ return remote, log
+
+
+def wheels(tmp_path, channel):
+ versions = (
+ {"sglang": "0.5.23.dev252+eagle.4.rocm"}
+ if channel == "rocm"
+ else {
+ "sglang": "0.5.23.dev252+eagle.4",
+ "vllm": "0.32.0rc1.dev283+eagle.4",
+ "tokenspeed": "0.1.1+eagle.4",
+ "tokenspeed-kernel": "0.1.1+eagle.4",
+ "tokenspeed-scheduler": "0.1.1+eagle.4",
+ }
+ )
+ result = []
+ for name, version in versions.items():
+ path = tmp_path / f"{name.replace('-', '_')}-{version}-py3-none-any.whl"
+ with zipfile.ZipFile(path, "w") as archive:
+ archive.writestr(f"{name}.dist-info/METADATA", f"Name: {name}\nVersion: {version}\n")
+ result.append(path)
+ return result
+
+
+def command(*args):
+ return subprocess.run([sys.executable, str(TOOL), *(str(a) for a in args)], text=True, capture_output=True)
+
+
+def calls(log):
+ return [json.loads(line) for line in log.read_text().splitlines()]
+
+
+def test_upload_verify_rerun_and_pages_without_wheel_payloads(tmp_path, release):
+ remote, log = release
+ expected = set()
+ for channel in ("cu130", "rocm"):
+ artifacts = wheels(tmp_path, channel)
+ result = command("upload", TAG, channel, *artifacts)
+ assert result.returncode == 0, result.stderr
+ expected.update(p.name for p in artifacts)
+ expected.add(f"engine-{channel}-SHA256SUMS")
+ uploads = [args[3] for args in calls(log) if args[1] == "upload"]
+ assert Path(uploads[-1]).name == f"engine-{channel}-SHA256SUMS"
+ result = command("upload", TAG, channel, *artifacts)
+ assert result.returncode == 0, result.stderr
+ assert [args[3] for args in calls(log) if args[1] == "upload"] == uploads
+ assert {p.name for p in remote.iterdir()} == expected
+ site = tmp_path / "site"
+ result = command("pages", TAG, site)
+ assert result.returncode == 0, result.stderr
+ assert not list(site.rglob("*.whl"))
+ for channel in ("cu130", "rocm"):
+ assert (site / "whl" / channel / "SHA256SUMS").read_bytes() == (
+ remote / f"engine-{channel}-SHA256SUMS"
+ ).read_bytes()
+ page = (site / "whl" / channel / "sglang/index.html").read_text()
+ assert "https://github.com/eagle-hq/EAGLE-4/releases/download/v0.1.0/sglang-" in page
+ assert "#sha256=" in page
+ assert ("eagle.4.rocm" in page) == (channel == "rocm")
+
+
+def test_upload_conflict_preflight_has_no_write_side_effects(tmp_path, release):
+ remote, log = release
+ artifacts = wheels(tmp_path, "cu130")
+ (remote / artifacts[-1].name).write_bytes(b"other released bytes")
+ result = command("upload", TAG, "cu130", *artifacts)
+ assert result.returncode != 0
+ assert "SHA256 mismatch" in result.stderr
+ assert not any(args[1] == "upload" for args in calls(log))
+ assert len(list(remote.iterdir())) == 1
+
+
+def test_upload_verifies_download_before_finalizing_manifest(tmp_path, release, monkeypatch):
+ remote, _ = release
+ artifacts = wheels(tmp_path, "rocm")
+ monkeypatch.setenv("GH_TEST_CORRUPT", artifacts[0].name)
+ result = command("upload", TAG, "rocm", *artifacts)
+ assert result.returncode != 0
+ assert "SHA256 mismatch" in result.stderr
+ assert not (remote / "engine-rocm-SHA256SUMS").exists()
+
+
+def test_manifest_changes_are_refused_without_uploading(tmp_path, release):
+ remote, log = release
+ artifacts = wheels(tmp_path, "rocm")
+ (remote / "engine-rocm-SHA256SUMS").write_text("a different finalized channel\n")
+ result = command("upload", TAG, "rocm", *artifacts)
+ assert result.returncode != 0
+ assert "SHA256 mismatch" in result.stderr
+ assert not any(args[1] == "upload" for args in calls(log))
+
+
[email protected]("case", ["missing-companions", "wrong-channel", "harness", "duplicate", "upstream"])
+def test_invalid_upload_is_rejected_before_contacting_github(tmp_path, release, case):
+ _, log = release
+ artifacts = wheels(tmp_path, "cu130")
+ channel = "cu130"
+ if case == "missing-companions":
+ artifacts = artifacts[:1]
+ elif case == "wrong-channel":
+ channel = "rocm"
+ elif case == "duplicate":
+ artifacts.append(artifacts[0])
+ else:
+ name = "eagle-harness" if case == "harness" else "stock-engine"
+ version = "0.1.0" if case == "upstream" else "0.1.0+eagle.4"
+ with zipfile.ZipFile(artifacts[0], "w") as archive:
+ archive.writestr("test.dist-info/METADATA", f"Name: {name}\nVersion: {version}\n")
+ result = command("upload", TAG, channel, *artifacts)
+ assert result.returncode != 0
+ assert not log.exists()
+
+
[email protected]("entry", ["../escape.whl", "nested/file.whl", "-option.whl", "file[1].whl"])
+def test_pages_rejects_unsafe_manifest_paths(tmp_path, release, entry):
+ remote, log = release
+ (remote / "engine-cu130-SHA256SUMS").write_text(f"{'0' * 64} {entry}\n")
+ result = command("pages", TAG, tmp_path / "site")
+ assert result.returncode != 0
+ assert "invalid checksum entry" in result.stderr
+ assert not (tmp_path / "site").exists()
+ assert not any(entry in args for args in calls(log))
+
+
+def test_pages_checksum_mismatch_leaves_no_partial_site(tmp_path, release):
+ remote, _ = release
+ artifacts = wheels(tmp_path, "cu130")
+ assert command("upload", TAG, "cu130", *artifacts).returncode == 0
+ (remote / artifacts[0].name).write_bytes(b"wrong bytes")
+ result = command("pages", TAG, tmp_path / "site")
+ assert result.returncode != 0
+ assert "SHA256 mismatch" in result.stderr
+ assert not (tmp_path / "site").exists()
+
+
+def test_manifest_hash_is_of_uploaded_bytes(tmp_path, release):
+ remote, _ = release
+ artifacts = wheels(tmp_path, "rocm")
+ result = command("upload", TAG, "rocm", *artifacts)
+ assert result.returncode == 0, result.stderr
+ digest = hashlib.sha256((remote / artifacts[0].name).read_bytes()).hexdigest()
+ assert (remote / "engine-rocm-SHA256SUMS").read_text() == f"{digest} {artifacts[0].name}\n"
+
+
[email protected]("version,ok", [("0.1.0", True), ("0.2.0", False)])
+def test_private_harness_wheels_have_tag_version(tmp_path, release, monkeypatch, version, ok):
+ remote, _ = release
+ monkeypatch.setenv("GH_TEST_PRIVATE", "true")
+ monkeypatch.setenv("GH_TEST_DRAFT", "true")
+ artifacts = []
+ for platform in ("any", "manylinux_2_34_x86_64"):
+ wheel = tmp_path / f"eagle_harness-{version}-py3-none-{platform}.whl"
+ with zipfile.ZipFile(wheel, "w") as archive:
+ archive.writestr("eagle_harness.dist-info/METADATA", f"Name: eagle-harness\nVersion: {version}\n")
+ artifacts.append(wheel)
+ result = command("upload", "--draft", TAG, "harness", *artifacts)
+ assert (result.returncode == 0) == ok, result.stderr
+ if ok:
+ assert (remote / "harness-SHA256SUMS").exists()
+ assert len(list(remote.glob("*.whl"))) == 2
+ else:
+ assert "version must equal" in result.stderr
+ assert not list(remote.iterdir())
+
+
+def test_harness_channel_refuses_engines(tmp_path, release):
+ remote, _ = release
+ result = command("upload", TAG, "harness", *wheels(tmp_path, "rocm"))
+ assert result.returncode != 0
+ assert "not a harness wheel" in result.stderr
+ assert not list(remote.iterdir())
+
+
+def test_private_draft_upload_verifies_bytes_without_publishing(tmp_path, release, monkeypatch):
+ remote, log = release
+ monkeypatch.setenv("GH_TEST_REPOSITORY", "example/private-stage")
+ monkeypatch.setenv("GH_TEST_PRIVATE", "true")
+ monkeypatch.setenv("GH_TEST_DRAFT", "true")
+ artifacts = wheels(tmp_path, "rocm")
+ args = ("upload", "--repository", "example/private-stage", "--draft", TAG, "rocm", *artifacts)
+ result = command(*args)
+ assert result.returncode == 0, result.stderr
+ assert command(*args).returncode == 0
+ assert (remote / artifacts[0].name).read_bytes() == artifacts[0].read_bytes()
+ assert len([c for c in calls(log) if c[:2] == ["release", "upload"]]) == 2
+ assert not any(c[:2] in (["release", "create"], ["release", "edit"]) for c in calls(log))
+
+
[email protected]("private,draft", [(False, True), (True, False)])
+def test_draft_upload_refuses_public_repo_or_published_release(tmp_path, release, monkeypatch, private, draft):
+ remote, log = release
+ monkeypatch.setenv("GH_TEST_PRIVATE", str(private).lower())
+ monkeypatch.setenv("GH_TEST_DRAFT", str(draft).lower())
+ result = command("upload", "--draft", TAG, "rocm", *wheels(tmp_path, "rocm"))
+ assert result.returncode != 0
+ assert "private" in result.stderr or "draft" in result.stderr
+ assert not list(remote.iterdir())
+ assert not any(c[:2] == ["release", "upload"] for c in calls(log))
+
+
+def test_draft_requires_explicit_opt_in_and_cannot_make_pages(tmp_path, release, monkeypatch):
+ monkeypatch.setenv("GH_TEST_DRAFT", "true")
+ result = command("upload", TAG, "rocm", *wheels(tmp_path, "rocm"))
+ assert result.returncode != 0
+ assert "published" in result.stderr
+ result = command("pages", TAG, tmp_path / "site")
+ assert result.returncode != 0
+ assert not (tmp_path / "site").exists()
diff --git a/tests/test_fused_accept_step.py b/tests/test_fused_accept_step.py
new file mode 100644
index 0000000..052d4fe
--- /dev/null
+++ b/tests/test_fused_accept_step.py
@@ -0,0 +1,69 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The fused accept step plugged into sglang's ``run_eagle_verify(accept_step=...)``."""
+
+from types import SimpleNamespace
+from unittest import mock
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+from sglang.srt.speculative.eagle_worker_common import VerifyAcceptInput # noqa: E402
+
+from eagle_harness.sglang import verify_step # noqa: E402
+
+
+def _step_result(*, static: bool):
+ accepted = SimpleNamespace(
+ predict=torch.tensor([5, 6]),
+ accept_lens=torch.tensor([2]),
+ accept_index=torch.tensor([[0, 3]]),
+ new_seq_lens=torch.tensor([9]),
+ bonus_tokens=torch.tensor([6]),
+ )
+ compacted = torch.ones(16, 3)
+ graphs = SimpleNamespace(run=lambda key, body: body())
+ staged = (torch.tensor([7]), torch.tensor([0]))
+ step = verify_step.fused_accept_step(
+ req_to_token_pool=SimpleNamespace(req_to_token=None),
+ token_to_kv_pool_allocator=SimpleNamespace(get_kvcache=lambda: None),
+ num_draft_tokens=16,
+ tail_graphs=graphs if static else None,
+ staged=staged if static else None,
+ )
+ spec = SimpleNamespace(prepared_out_cache_loc=torch.zeros(16), max_tree_depth=4, draft_token=torch.zeros(16))
+ inp = VerifyAcceptInput(
+ verify_input=spec,
+ next_token_ids=torch.zeros(16),
+ next_token_logits=None,
+ hidden_states=torch.zeros(16, 3),
+ seq_lens=torch.tensor([7]),
+ req_pool_indices=torch.tensor([0]),
+ out_cache_loc=torch.arange(16),
+ can_run_cuda_graph=True,
+ )
+ with mock.patch.object(verify_step, "_accept", return_value=(accepted, compacted)) as accept:
+ result = step(inp)
+ return result, accepted, compacted, inp, staged, accept
+
+
[email protected]("static", [False, True])
+def test_step_returns_the_accepted_path_and_the_compacted_rows(static):
+ result, accepted, compacted, inp, staged, accept = _step_result(static=static)
+ accept.assert_called_once()
+ args = accept.call_args.args
+ # A replayed tail reads the draft's static lengths and slots; an eager one the batch's.
+ if static:
+ assert args[3] is staged[0] and args[4] is staged[1] and args[5] is inp.verify_input.prepared_out_cache_loc
+ else:
+ assert args[3] is inp.seq_lens and args[4] is inp.req_pool_indices and args[5] is inp.out_cache_loc
+ assert result.next_token_ids is accepted.predict
+ assert result.accept_lens is accepted.accept_lens
+ assert result.accept_index is accepted.accept_index # sglang commits the states of this path
+ assert result.bonus_tokens is accepted.bonus_tokens
+ assert result.hidden_states is compacted
+ assert torch.equal(result.new_seq_lens, accepted.new_seq_lens)
+ # A replayed tail's lengths are a static buffer: the scheduler gets a copy.
+ assert (result.new_seq_lens is accepted.new_seq_lens) is (not static)
diff --git a/tests/test_gdn_rounded_records_gpu.py b/tests/test_gdn_rounded_records_gpu.py
new file mode 100644
index 0000000..3350835
--- /dev/null
+++ b/tests/test_gdn_rounded_records_gpu.py
@@ -0,0 +1,234 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""ROCm replay records against independently rounded parent states."""
+
+import pytest
+import torch
+
+
[email protected](not torch.cuda.is_available() or torch.version.hip is None, reason="ROCm GPU required")
[email protected]("width,batch", [(1, 1), (8, 2), (16, 1), (32, 2)])
[email protected]("seed", [11, 41, 97])
[email protected]("state_dtype", [torch.bfloat16, torch.float16])
[email protected]("rounded", [True, False], ids=["path_replay", "chunk"])
+def test_rounded_records_and_commit(width, batch, seed, state_dtype, rounded):
+ """The rounded serving path and unrounded diagnostic chunk match their respective references.
+
+ The chunk is not a numerically equivalent substitute for low-precision parent rounding.
+ """
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_chunk_update
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_records_commit
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_records_update
+
+ device = "cuda"
+ gen = torch.Generator(device=device).manual_seed(seed)
+ h, hv, kdim, vdim = 4, 12, 128, 128
+
+ def rand(*shape, dtype=torch.bfloat16):
+ return torch.randn(*shape, generator=gen, device=device, dtype=dtype) * 0.2
+
+ q, k = rand(1, batch * width, h, kdim), rand(1, batch * width, h, kdim)
+ v = rand(1, batch * width, hv, vdim)
+ a, b = rand(batch * width, hv), rand(batch * width, hv)
+ A, bias = rand(hv, dtype=torch.float32), rand(hv, dtype=torch.float32)
+ state = rand(batch + 2, hv, vdim, kdim, dtype=state_dtype)
+ slots = torch.arange(1, batch + 1, dtype=torch.int32, device=device).flip(0)
+ rows = torch.arange(batch, dtype=torch.int32, device=device).flip(0)
+ qsl = torch.arange(batch + 1, dtype=torch.int32, device=device) * width
+ parent = torch.zeros(batch, width + 7, dtype=torch.int32, device=device)
+ for node in range(1, width):
+ parent[:, node] = torch.randint(node, (batch,), generator=gen, device=device, dtype=torch.int32)
+ rec = torch.full((batch + 1, width + 3, hv, vdim + kdim + 4), -999.0, device=device)
+ expected = torch.empty_like(v)
+ snapshots = []
+ for request in range(batch):
+ states = []
+ for node in range(width):
+ token = request * width + node
+ prior = state[slots[request]].float() if node == 0 else states[int(parent[request, node])]
+ if rounded and node > 0:
+ prior = prior.to(state.dtype).float()
+ key = k[0, token].float()
+ key = key / (key.square().sum(-1, keepdim=True) + 1e-6).sqrt()
+ query = q[0, token].float()
+ query = query / (query.square().sum(-1, keepdim=True) + 1e-6).sqrt() / kdim**0.5
+ key, query = key.repeat_interleave(hv // h, 0), query.repeat_interleave(hv // h, 0)
+ decay = (-A.exp() * torch.nn.functional.softplus(a[token].float() + bias)).exp()
+ beta = b[token].float().sigmoid().to(b.dtype).float()
+ decayed = prior * decay[:, None, None]
+ delta = (v[0, token].float() - (decayed * key[:, None, :]).sum(-1)) * beta[:, None]
+ current = decayed + delta[:, :, None] * key[:, None, :]
+ states.append(current)
+ expected[0, token] = (current * query[:, None, :]).sum(-1).to(v.dtype)
+ snapshots.append(states)
+ paths = torch.zeros(batch, width, width + 2, dtype=torch.int32, device=device)
+ for request in range(batch):
+ for node in range(width):
+ chain = [node]
+ while chain[-1] > 0:
+ chain.append(int(parent[request, chain[-1]]))
+ chain.reverse()
+ paths[request, node, 0] = len(chain)
+ paths[request, node, 1] = len(chain) - 1
+ paths[request, node, 2 : 2 + len(chain)] = torch.tensor(chain, device=device)
+ update = gdn_tree_records_update if rounded else gdn_tree_chunk_update
+ path_args = {"tree_paths": paths} if rounded else {}
+ out = update(
+ A,
+ bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ state=state,
+ state_indices=slots,
+ query_start_loc=qsl,
+ parent=parent,
+ records=rec,
+ record_indices=rows,
+ width=width,
+ **path_args,
+ )
+ torch.testing.assert_close(out.float(), expected.float(), atol=0.002, rtol=0.02)
+ assert bool((rec[-1] == -999.0).all()), "unused record row changed"
+ accepted = torch.full((batch,), width - 1, dtype=torch.int32, device=device)
+ committed = state.clone().unsqueeze(0)
+ gdn_tree_records_commit(committed, rec.unsqueeze(0), slots, rows, accepted, parent, rounded)
+ for request in range(batch):
+ torch.testing.assert_close(
+ committed[0, slots[request]].float(),
+ snapshots[request][-1].to(state.dtype).float(),
+ atol=0.002,
+ rtol=0.02,
+ )
+ assert torch.equal(committed[0, 0], state[0])
+ assert torch.equal(committed[0, -1], state[-1])
+ # A negative accepted step must not touch any persistent state.
+ before = committed.clone()
+ gdn_tree_records_commit(committed, rec.unsqueeze(0), slots, rows, -torch.ones_like(accepted), parent, rounded)
+ assert torch.equal(committed, before)
+ # sglang's eager verify (no decode graph, or a batch beyond the captured sizes) builds the parent table int64.
+ from_int64 = state.clone().unsqueeze(0)
+ gdn_tree_records_commit(from_int64, rec.unsqueeze(0), slots, rows, accepted, parent.to(torch.int64), rounded)
+ assert torch.equal(from_int64, committed)
+
+
[email protected](not torch.cuda.is_available() or torch.version.hip is None, reason="ROCm GPU required")
+def test_parent_rounding_does_not_accumulate_sub_ulp_decay():
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_records_commit, gdn_tree_records_update
+
+ device, width, dim = "cuda", 32, 128
+ state = torch.ones(1, 1, dim, dim, device=device, dtype=torch.bfloat16)
+ q = torch.zeros(1, width, 1, dim, device=device, dtype=torch.bfloat16)
+ q[..., 0] = 1
+ k, v = torch.zeros_like(q), torch.zeros_like(q)
+ a = torch.full((width, 1), -7.0, device=device, dtype=torch.bfloat16)
+ b = torch.zeros_like(a)
+ A = torch.zeros(1, device=device)
+ slot = torch.zeros(1, device=device, dtype=torch.int32)
+ qsl = torch.tensor([0, width], device=device, dtype=torch.int32)
+ parent = (torch.arange(width, device=device, dtype=torch.int32) - 1).view(1, width)
+ paths = torch.cat(
+ (
+ torch.tensor([width, 0], device=device, dtype=torch.int32),
+ torch.arange(width, device=device, dtype=torch.int32),
+ )
+ ).view(1, 1, width + 2)
+ records = torch.empty(1, width, 1, dim * 2 + 4, device=device)
+ out = gdn_tree_records_update(
+ A,
+ A,
+ q,
+ k,
+ v,
+ a,
+ b,
+ state=state,
+ state_indices=slot,
+ query_start_loc=qsl,
+ parent=parent,
+ tree_paths=paths,
+ records=records,
+ record_indices=slot,
+ width=width,
+ )
+ # The per-node decay is below half a BF16 ulp: every parent rounds back to one.
+ assert torch.equal(out, out[:, :1].expand_as(out))
+ committed = state.clone().unsqueeze(0)
+ steps = torch.full_like(slot, width - 1)
+ gdn_tree_records_commit(committed, records.unsqueeze(0), slot, slot, steps, parent, True)
+ assert torch.equal(committed[0], state)
+
+
[email protected](not torch.cuda.is_available() or torch.version.hip is None, reason="ROCm GPU required")
[email protected]("width,batch", [(16, 1), (32, 8)])
+def test_value_tile_does_not_change_results(monkeypatch, width, batch):
+ """The V block is a launch-geometry choice (one wave per program at every width): outputs and records are
+ bitwise equal for 8, 16 and 32 columns."""
+ from eagle_harness.kernels import gdn_tree_records as records_module
+
+ device = "cuda"
+ gen = torch.Generator(device=device).manual_seed(5)
+ h, hv, kdim, vdim = 4, 12, 128, 128
+
+ def rand(*shape, dtype=torch.bfloat16):
+ return torch.randn(*shape, generator=gen, device=device, dtype=dtype)
+
+ q, k, v = rand(1, batch * width, h, kdim), rand(1, batch * width, h, kdim), rand(1, batch * width, hv, vdim) * 0.2
+ a, b = rand(batch * width, hv), rand(batch * width, hv)
+ A, bias = rand(hv, dtype=torch.float32), rand(hv, dtype=torch.float32)
+ state = rand(batch, hv, vdim, kdim) * 0.2
+ slots = torch.arange(batch, dtype=torch.int32, device=device)
+ qsl = torch.arange(batch + 1, dtype=torch.int32, device=device) * width
+ parent = torch.zeros(batch, width, dtype=torch.int32, device=device)
+ for node in range(1, width):
+ parent[:, node] = torch.randint(node, (batch,), generator=gen, device=device, dtype=torch.int32)
+ paths = torch.zeros(batch, width, width + 2, dtype=torch.int32, device=device)
+ for request in range(batch):
+ for node in range(width):
+ chain = [node]
+ while chain[-1] > 0:
+ chain.append(int(parent[request, chain[-1]]))
+ chain.reverse()
+ paths[request, node, 0], paths[request, node, 1] = len(chain), len(chain) - 1
+ paths[request, node, 2 : 2 + len(chain)] = torch.tensor(chain, device=device)
+ results = {}
+ for tile in (8, 16, 32):
+ monkeypatch.setattr(records_module, "_records_value_tile", lambda *args, tile=tile: tile)
+ rec = torch.zeros((batch, width, hv, vdim + kdim + 4), device=device)
+ out = records_module.gdn_tree_records_update(
+ A,
+ bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ state=state,
+ state_indices=slots,
+ query_start_loc=qsl,
+ parent=parent,
+ tree_paths=paths,
+ records=rec,
+ record_indices=slots,
+ width=width,
+ )
+ results[tile] = (out.clone(), rec)
+ for tile in (16, 32):
+ assert torch.equal(results[tile][0], results[8][0]), f"outputs differ at V block {tile}"
+ assert torch.equal(results[tile][1], results[8][1]), f"records differ at V block {tile}"
+
+
+def test_value_tile_widens_with_the_program_count(monkeypatch):
+ """8 columns while the programs fit two rounds of the device's waves, wider (up to 32) beyond that."""
+ from eagle_harness.kernels import gdn_tree_records as records_module
+
+ monkeypatch.setattr(records_module, "_wave_slots", lambda device: 8192) # 256 CUs x 32 waves (MI355X)
+ tile = records_module._records_value_tile
+ assert tile(1 * 48 * 16, 128, "cuda") == 8 # batch 1, width 16: 12288 programs at 8 columns
+ assert tile(1 * 48 * 32, 128, "cuda") == 16 # batch 1, width 32: 24576 -> 12288
+ assert tile(8 * 48 * 16, 128, "cuda") == 32 # batch 8: 98304 -> 24576, capped at 32
+ assert tile(32 * 48 * 32, 128, "cuda") == 32
+ assert tile(1, 4, "cuda") == 4 # a value dim below 8 keeps one block
diff --git a/tests/test_gdn_tree_conv.py b/tests/test_gdn_tree_conv.py
new file mode 100644
index 0000000..d178a8f
--- /dev/null
+++ b/tests/test_gdn_tree_conv.py
@@ -0,0 +1,121 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The GDN tree conv in both engines' layouts against a torch reference (CPU through the Triton interpreter, or a GPU).
+
+sglang: fixed-width requests, history in conv-state columns 0-2, every node's window in the scratch, the state shifted
+to the last 3 inputs. vLLM: packed requests of any width, history at column ``num_accepted - 1``, the state rolled to
+``[history[1:], x_0, .., x_{n-1}]``. Both kernels (gather, serial).
+"""
+
+import os
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ["TRITON_INTERPRET"] = "1"
+
+from eagle_harness.kernels import gdn_tree_conv # noqa: E402
+from tests.triton_probe import needs_triton # noqa: E402
+
+pytestmark = needs_triton
+
+DEV = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+# serving's bf16 on a GPU; the Triton interpreter computes bf16 products wrongly, so fp16 there
+BF16 = torch.bfloat16 if torch.cuda.is_available() else torch.float16
+
+
+def _ancestor_codes(parents):
+ """Per node: parent, grandparent, great-grandparent; -1/-2/-3 = history columns 2/1/0."""
+ anc = [[-1, -2, -3]]
+ for node in range(1, len(parents)):
+ p = parents[node]
+ anc.append([p, anc[p][0], anc[p][1]])
+ return anc
+
+
+def _reference(x_nodes, history, weight, bias, parents):
+ """Node outputs ([nodes, dim], fp32) and windows ([nodes, dim, 3]: grandparent, parent, self)."""
+ outs, windows = [], []
+ for node, codes in enumerate(_ancestor_codes(parents)):
+ vals = [x_nodes[c] if c >= 0 else history[:, 3 + c] for c in codes] # parent, grandparent, great-grandparent
+ y = bias.float() + (x_nodes[node] * weight[:, 3]).float()
+ for v, w in zip(vals, (weight[:, 2], weight[:, 1], weight[:, 0])):
+ y = y + (v * w).float()
+ outs.append(y * torch.sigmoid(y))
+ windows.append(torch.stack([vals[1], vals[0], x_nodes[node]], dim=-1))
+ return torch.stack(outs), torch.stack(windows)
+
+
[email protected](params=["gather", "serial"])
+def kernel(request, monkeypatch):
+ if request.param == "serial":
+ monkeypatch.setattr(gdn_tree_conv, "CONV_SERIAL_MIN_BATCH_DIM", 0)
+ return request.param
+
+
[email protected]("width", [1, 2, 5])
+def test_sglang_layout_writes_windows_and_shifts_the_state(kernel, width):
+ torch.manual_seed(1)
+ batch, dim = 3, 24
+ trees = [[0] + [torch.randint(0, n, (1,)).item() for n in range(1, width)] for _ in range(batch)]
+ x = torch.randn(batch * width, dim, device=DEV, dtype=BF16) # token-major, viewed as (batch, dim, width)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=BF16), torch.randn(dim, device=DEV, dtype=BF16)
+ state0 = torch.randn(5, dim, 3, device=DEV, dtype=BF16)
+ idx = torch.tensor([3, -1, 1], dtype=torch.int32, device=DEV) # request 1 is padding
+ inter = torch.tensor([0, 1, 2], dtype=torch.int32, device=DEV)
+ anc = torch.tensor([list(zip(*_ancestor_codes(t))) for t in trees], dtype=torch.int32, device=DEV)
+ windows = torch.zeros(3, width, dim, 3, device=DEV, dtype=BF16)
+ state = state0.clone()
+ out = gdn_tree_conv.gdn_tree_conv1d_update(
+ x.view(batch, width, dim).transpose(1, 2), state, weight, bias, True, idx, windows, inter, anc.contiguous()
+ )
+ for n in (0, 2):
+ nodes = x[n * width : (n + 1) * width]
+ want, want_win = _reference(nodes, state0[idx[n]], weight, bias, trees[n])
+ torch.testing.assert_close(out[n].t().float(), want, atol=2e-2, rtol=2e-2)
+ assert torch.equal(windows[n], want_win)
+ assert torch.equal(state[idx[n]], torch.cat([state0[idx[n]], nodes.t()], dim=1)[:, -3:])
+ assert torch.equal(state[[0, 2, 4]], state0[[0, 2, 4]])
+
+
+def test_vllm_layout_reads_the_resume_column_and_rolls_the_state(kernel):
+ torch.manual_seed(2)
+ width, dim, state_len = 6, 24, 3 + 6
+ trees = [[-1, 0, 0, 1, 2, 4], [-1, 0, 1], [-1]]
+ qsl = torch.tensor([0, 6, 9, 10], dtype=torch.int32, device=DEV)
+ x = torch.randn(10, dim, device=DEV, dtype=BF16)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=BF16), torch.randn(dim, device=DEV, dtype=BF16)
+ state0 = torch.randn(6, state_len, dim, device=DEV, dtype=BF16).transpose(1, 2) # vLLM's other conv layout
+ slots = torch.tensor([4, 2, 0], dtype=torch.int32, device=DEV) # request 2 is padding (null block 0)
+ accepted = torch.tensor([1, 3, 1], dtype=torch.int32, device=DEV)
+ anc = torch.zeros(4, 3, width, dtype=torch.int32, device=DEV) # the stage is wider than the batch
+ for n, t in enumerate(trees):
+ anc[n, :, : len(t)] = torch.tensor(list(zip(*_ancestor_codes(t))), dtype=torch.int32)
+ state = state0.clone()
+ out = torch.zeros_like(x)
+ gdn_tree_conv.gdn_tree_conv1d_update(
+ x.t()[None],
+ state,
+ weight,
+ bias,
+ "silu",
+ slots,
+ None,
+ None,
+ anc,
+ pad_slot_id=0,
+ out=out.t()[None],
+ num_accepted_tokens=accepted,
+ query_start_loc=qsl,
+ )
+ for n in (0, 1):
+ lo, hi, s, a = int(qsl[n]), int(qsl[n + 1]), int(slots[n]), int(accepted[n])
+ history = state0[s, :, a - 1 : a + 2]
+ want, _ = _reference(x[lo:hi], history, weight, bias, trees[n])
+ torch.testing.assert_close(out[lo:hi].float(), want, atol=2e-2, rtol=2e-2)
+ rolled = torch.cat([history[:, 1:], x[lo:hi].t()], dim=1)
+ assert torch.equal(state[s, :, : rolled.shape[1]], rolled)
+ assert torch.equal(state[s, :, rolled.shape[1] :], state0[s, :, rolled.shape[1] :])
+ assert torch.equal(out[9], torch.zeros_like(out[9])) and torch.equal(state[0], state0[0])
diff --git a/tests/test_gdn_tree_gluon_gpu.py b/tests/test_gdn_tree_gluon_gpu.py
new file mode 100644
index 0000000..4dea40c
--- /dev/null
+++ b/tests/test_gdn_tree_gluon_gpu.py
@@ -0,0 +1,217 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The Gluon GDN tree verify against the Triton walk it replaces, bitwise, on the trees serving builds (GPU).
+
+The dispatcher's run-time self-check draws one random tree per launch signature, which misses a last-bit difference
+in one snapshot element in 10^7 (Triton 3.8 fusing other multiply-adds in the two kernels). This sweeps chains, stars,
+random trees and EAGLE-style top-k levels, with and without PDL, at the TP4 and TP1 shapes of Qwen3.8-27B
+(H 16 / HV 48, K = V = 128, split by TP 1 to 8), in both slot layouts: sglang's (one bf16 snapshot scratch row per request)
+and vLLM's (one state slot per verify row, bf16 or fp32 state, several requests with resume offsets, a padded
+request, token-strided views of one packed projection, a published slot table). Run it on every Triton version the
+package supports.
+
+Run in a GPU job: ``pytest -q tests/test_gdn_tree_gluon_gpu.py``.
+"""
+
+import random
+import zlib
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ pytest.skip("needs a CUDA device", allow_module_level=True)
+
+from eagle_harness.kernels import arch # noqa: E402
+from eagle_harness.kernels.gdn_tree_recurrence import gdn_tree_recurrent_update # noqa: E402
+
+if not arch.gluon_gdn():
+ pytest.skip("the Gluon GDN kernel does not serve this GPU", allow_module_level=True)
+
+from eagle_harness.kernels.gdn_tree_gluon import gluon_admits, gluon_recurrent_update # noqa: E402
+
+
+def _chain(n):
+ return [0] + list(range(n - 1))
+
+
+def _star(n):
+ return [0] * n
+
+
+def _random(n, seed):
+ rng = random.Random(seed)
+ return [0] + [rng.randrange(i) for i in range(1, n)]
+
+
+def _topk_levels(n, k=4):
+ """Root, then levels of k children hanging off the previous level's first node (EAGLE top-k expansion)."""
+ parents, prev_first = [0], 0
+ while len(parents) < n:
+ first = len(parents)
+ parents += [prev_first] * min(k, n - len(parents))
+ prev_first = first
+ return parents
+
+
+TREES = {
+ "chain": _chain,
+ "star": _star,
+ "random1": lambda n: _random(n, 1),
+ "random2": lambda n: _random(n, 2),
+ "topk4": _topk_levels,
+}
+
+
+def _activations(tp, tokens, g):
+ """q, k, v, a, b, A_log, dt_bias at a TP shape; q / k / v are token-strided views of one packed projection and
+ a / b column slices of another, as both engines hand them over."""
+ H, HV, d = 16 // tp, 48 // tp, 128
+ dev = "cuda"
+
+ def randn(*shape, scale=1.0):
+ return torch.randn(*shape, device=dev, generator=g) * scale
+
+ packed = torch.nn.functional.silu(randn(tokens, (2 * H + HV) * d + 16)).bfloat16()
+ q, k, v = packed[:, 16:].split([H * d, H * d, HV * d], dim=-1)
+ ab = randn(tokens, 2 * HV + 3).bfloat16()
+ return dict(
+ A_log=torch.log(torch.rand(HV, device=dev, generator=g) * 15 + 1),
+ dt_bias=randn(HV, scale=0.5).bfloat16(),
+ q=q.view(1, tokens, H, d),
+ k=k.view(1, tokens, H, d),
+ v=v.view(1, tokens, HV, d),
+ a=ab[:, 1 : 1 + HV],
+ b=ab[:, 2 + HV : 2 + 2 * HV],
+ )
+
+
+def _per_request_inputs(tp, width, parents, seed):
+ """sglang: one request, the pool's initial state, a bf16 scratch row of snapshots."""
+ g = torch.Generator(device="cuda").manual_seed(seed)
+ act = _activations(tp, width, g)
+ HV, d = act["v"].shape[2], 128
+ i32 = dict(dtype=torch.int32, device="cuda")
+ inputs = dict(
+ act,
+ initial_state_source=(torch.randn(2, HV, d, d, device="cuda", generator=g) * 0.05).bfloat16(),
+ initial_state_indices=torch.tensor([1], **i32),
+ cu_seqlens=torch.tensor([0, width], **i32),
+ intermediate_state_indices=torch.tensor([0], **i32),
+ retrieve_parent_token=torch.tensor([parents], **i32),
+ )
+ states = dict(intermediate_states_buffer=torch.randn(1, width, HV, d, d, device="cuda", generator=g).bfloat16())
+ return inputs, states
+
+
+def _per_row_inputs(tp, width, parents, seed, state_dtype):
+ """vLLM: the tree, a shorter chain resuming at row 2, and a padded request (null slot 0) of one row; one state
+ slot per row in a pool that is also the initial state, the output and the published table in caller buffers."""
+ g = torch.Generator(device="cuda").manual_seed(seed)
+ chain = [-1] + list(range(max(width - 3, 1) - 1))
+ rows = [[-1] + parents[1:], chain, [-1]]
+ tokens = sum(map(len, rows))
+ act = _activations(tp, tokens, g)
+ HV, d = act["v"].shape[2], 128
+ i32 = dict(dtype=torch.int32, device="cuda")
+ table = torch.full((len(rows), width), -1, **i32)
+ for r, plist in enumerate(rows):
+ table[r, : len(plist)] = torch.tensor(plist, **i32)
+ slots = torch.arange(1, 1 + len(rows) * (width + 1), **i32).view(len(rows), width + 1)
+ slots[2] = 0
+ qsl = torch.tensor([0, len(rows[0]), len(rows[0]) + len(rows[1]), tokens], **i32)
+ inputs = dict(
+ act,
+ initial_state_indices=slots,
+ num_accepted_tokens=torch.tensor([1, 2, 1], **i32),
+ cu_seqlens=qsl,
+ intermediate_state_indices=slots,
+ retrieve_parent_token=table,
+ pad_slot_id=0,
+ )
+ pool = (torch.randn(slots.numel() + 2, HV, d, d, device="cuda", generator=g) * 0.05).to(state_dtype)
+ states = dict(
+ pool=pool,
+ out=torch.zeros(1, tokens, HV, d, device="cuda", dtype=torch.bfloat16),
+ publish=torch.full((len(rows), width + 3), -7, **i32),
+ )
+ return inputs, states
+
+
+def _launch(fn, inputs, states, **kw):
+ states = {n: t.clone() for n, t in states.items()}
+ if "pool" in states:
+ kw.update(
+ initial_state_source=states["pool"],
+ intermediate_states_buffer=states["pool"],
+ out=states["out"],
+ publish=states["publish"],
+ )
+ else:
+ kw.update(intermediate_states_buffer=states["intermediate_states_buffer"])
+ o = fn(**inputs, **kw)
+ return o, states
+
+
+LAYOUTS = {
+ "per-request": lambda tp, width, parents, seed: _per_request_inputs(tp, width, parents, seed),
+ "per-row-bf16": lambda tp, width, parents, seed: _per_row_inputs(tp, width, parents, seed, torch.bfloat16),
+ "per-row-fp32": lambda tp, width, parents, seed: _per_row_inputs(tp, width, parents, seed, torch.float32),
+}
+
+
[email protected]("layout", sorted(LAYOUTS))
[email protected]("tp", [8, 4, 2, 1])
[email protected]("width", [4, 8, 16, 32])
[email protected]("tree", sorted(TREES))
+def test_gluon_equals_the_triton_walk_bitwise(layout, tp, width, tree):
+ parents = TREES[tree](width)
+ inputs, states = LAYOUTS[layout](tp, width, parents, seed=zlib.crc32(f"{layout}-{tp}-{width}-{tree}".encode()))
+ pool0 = inputs.get("initial_state_source", torch.empty(0)).clone()
+ o_ref, ref = _launch(gdn_tree_recurrent_update, inputs, states, gluon=False)
+ live, _ = _launch(lambda **kw: kw, inputs, states)
+ assert gluon_admits(**{n: t for n, t in live.items() if isinstance(t, torch.Tensor)})
+ bad = []
+ for use_pdl in (False, True):
+ o, got = _launch(gluon_recurrent_update, inputs, states, use_pdl=use_pdl)
+ diffs = {"o": int((o.view(torch.int16) != o_ref.view(torch.int16)).sum())}
+ for name in got:
+ x, y = got[name].contiguous(), ref[name].contiguous()
+ view = torch.int32 if x.element_size() == 4 else torch.int16
+ diffs[name] = int((x.view(view) != y.view(view)).sum())
+ if any(diffs.values()):
+ bad.append(f"pdl={use_pdl}: elements differ {diffs}")
+ if "pool" in states: # the null slot is never written, the table is published
+ assert torch.equal(ref["pool"][0], states["pool"][0])
+ assert torch.equal(ref["publish"][:, : width + 1], inputs["intermediate_state_indices"])
+ else: # the pool is only read
+ assert torch.equal(inputs["initial_state_source"], pool0)
+ assert not bad, f"tree {tree} {parents}: " + "; ".join(bad)
+
+
[email protected]("layout", sorted(LAYOUTS))
+def test_the_dispatcher_serves_gluon_after_its_self_check(layout):
+ """gdn_tree_recurrent_update(gluon=True) self-checks the launch signature (in the layout's slot tables) and serves
+ the Gluon kernel: same output and states as the walk, and the kernel stays enabled."""
+ from eagle_harness.kernels import gdn_tree_gluon
+
+ gdn_tree_gluon.reset_gdn_tree_gluon_state()
+ inputs, states = LAYOUTS[layout](4, 16, _topk_levels(16), seed=zlib.crc32(layout.encode()))
+ o_ref, ref = _launch(gdn_tree_recurrent_update, inputs, states, gluon=False)
+ o, got = _launch(gdn_tree_recurrent_update, inputs, states, gluon=True)
+ assert not gdn_tree_gluon.gdn_tree_gluon_disabled()
+ assert len(gdn_tree_gluon._STATE.checked) == 1
+ assert torch.equal(o, o_ref) and all(torch.equal(got[n], ref[n]) for n in got)
+
+
+def test_rows_that_triton_cannot_vectorize_keep_the_walk():
+ """q / k rows at a token stride Triton does not know to be aligned reduce the norms in another order in the walk
+ (a last-bit difference in some snapshots), so the launcher does not admit them."""
+ inputs, states = _per_request_inputs(4, 16, _topk_levels(16), seed=3)
+ tokens, H, HV = 16, inputs["q"].shape[2], inputs["v"].shape[2]
+ packed = torch.zeros(tokens, (2 * H + HV) * 128 + 8, device="cuda", dtype=torch.bfloat16)[:, 8:]
+ q, k, v = packed.split([H * 128, H * 128, HV * 128], dim=-1)
+ live = dict(inputs, q=q.view(1, tokens, H, 128), k=k.view(1, tokens, H, 128), v=v.view(1, tokens, HV, 128))
+ assert not gluon_admits(**live, intermediate_states_buffer=states["intermediate_states_buffer"])
+ assert gluon_admits(**inputs, intermediate_states_buffer=states["intermediate_states_buffer"])
diff --git a/tests/test_gdn_tree_kernels.py b/tests/test_gdn_tree_kernels.py
new file mode 100644
index 0000000..41c0d84
--- /dev/null
+++ b/tests/test_gdn_tree_kernels.py
@@ -0,0 +1,699 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""GDN tree kernels against dense torch references (CPU through the Triton interpreter, or a GPU).
+
+Chain trees must reproduce vLLM's own chain kernels' semantics; a branched tree must make every row see
+only its ancestors, and the conv window must roll as the chain kernel rolls it.
+"""
+
+import os
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ["TRITON_INTERPRET"] = "1"
+
+from eagle_harness.kernels.gdn_tree_conv import gdn_tree_conv1d_update # noqa: E402
+from eagle_harness.kernels.gdn_tree_recurrence import gdn_tree_recurrent_update # noqa: E402
+from tests.triton_probe import needs_triton # noqa: E402
+
+pytestmark = needs_triton
+
+DEV = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+# the conv takes 16-bit inputs; the Triton interpreter computes bf16 products wrongly, so fp16 there
+HALF = torch.bfloat16 if torch.cuda.is_available() else torch.float16
+TREE = [-1, 0, 0, 1, 1, 2, 3]
+CHAIN = [-1, 0, 1, 2, 3]
+
+
+def tree_conv(x, conv_state, weight, bias, activation, *, slots, accepted, query_start_loc, ancestors):
+ """The shared tree conv in vLLM's layout (x [tokens, dim], the window in ``conv_state[slots[b]]`` from column
+ ``accepted - 1``), as the extension calls it."""
+ out = torch.empty(x.shape, dtype=x.dtype, device=x.device)
+ gdn_tree_conv1d_update(
+ x.t()[None],
+ conv_state,
+ weight,
+ bias,
+ activation,
+ conv_state_indices=slots,
+ intermediate_conv_window=None,
+ intermediate_state_indices=None,
+ tree_ancestors=ancestors,
+ pad_slot_id=0,
+ out=out.t()[None],
+ num_accepted_tokens=accepted,
+ query_start_loc=query_start_loc,
+ )
+ return out
+
+
+def tree_recurrence(
+ A_log, a, b, dt_bias, q, k, v, state, *, parents, slots, accepted, query_start_loc, kernel="triton", **kw
+):
+ """The shared tree recurrence in vLLM's layout (one state slot per row, resume at ``accepted - 1``), as the
+ extension calls it; ``kernel`` "gluon" launches the Gluon kernel directly (no dispatch checks)."""
+ args = dict(
+ initial_state_source=state,
+ initial_state_indices=slots,
+ num_accepted_tokens=accepted,
+ cu_seqlens=query_start_loc,
+ intermediate_states_buffer=state,
+ intermediate_state_indices=slots,
+ retrieve_parent_token=parents,
+ pad_slot_id=0,
+ **kw,
+ )
+ if kernel == "gluon":
+ from eagle_harness.kernels import arch
+
+ if not arch.gluon_gdn():
+ pytest.skip("the Gluon GDN kernel does not serve this GPU")
+ from eagle_harness.kernels.gdn_tree_gluon import gluon_recurrent_update
+
+ return gluon_recurrent_update(A_log, dt_bias, q, k, v, a, b, **args)
+ return gdn_tree_recurrent_update(A_log, dt_bias, q, k, v, a, b, **args)
+
+
+def random_tree(width, seed):
+ """A tree in node order (a parent before its children): row ``r`` hangs off a random earlier row."""
+ gen = torch.Generator().manual_seed(seed)
+ return [-1] + [int(torch.randint(0, r, (1,), generator=gen)) for r in range(1, width)]
+
+
+def deepest_path(parents):
+ """Rows from the root to a deepest row of the tree."""
+ best = []
+ for row in range(len(parents)):
+ path, node = [], row
+ while node >= 0:
+ path.append(node)
+ node = parents[node]
+ best = max(best, path[::-1], key=len)
+ return best
+
+
+def _ancestors(parents):
+ """Per row: parent, grandparent, great-grandparent; negative codes: the old window (-1 is its last input)."""
+ anc = [[-1, -2, -3]]
+ for row in range(1, len(parents)):
+ p = parents[row]
+ anc.append([p, anc[p][0], anc[p][1]])
+ return anc
+
+
+def _requests(parent_lists, width):
+ parents = torch.zeros(len(parent_lists), width, dtype=torch.int32)
+ ancestors = torch.zeros(len(parent_lists), 3, width, dtype=torch.int32)
+ qsl = [0]
+ for b, plist in enumerate(parent_lists):
+ parents[b, : len(plist)] = torch.tensor(plist)
+ ancestors[b, :, : len(plist)] = torch.tensor(_ancestors(plist), dtype=torch.int32).t()
+ qsl.append(qsl[-1] + len(plist))
+ return parents.to(DEV), ancestors.to(DEV), torch.tensor(qsl, dtype=torch.int32, device=DEV)
+
+
+ "parent_lists", [[TREE, CHAIN], [CHAIN, CHAIN], [TREE[:4], TREE], [random_tree(16, 0), random_tree(16, 1)]]
+)
+def test_conv_matches_reference_and_rolls_the_window(parent_lists):
+ torch.manual_seed(0)
+ width = max(map(len, parent_lists))
+ dim, state_len, num_slots = 40, 3 + width, 8
+ parents, ancestors, qsl = _requests(parent_lists, width)
+ tokens = int(qsl[-1])
+ bf16 = HALF
+ x = torch.randn(tokens, dim, device=DEV, dtype=bf16)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=bf16), torch.randn(dim, device=DEV, dtype=bf16)
+ state = torch.randn(num_slots, dim, state_len, device=DEV, dtype=bf16)
+ slots = torch.tensor([2, 5][: len(parent_lists)], dtype=torch.int32, device=DEV)
+ accepted = torch.tensor([1, 3][: len(parent_lists)], dtype=torch.int32, device=DEV)
+ old = state.clone()
+ out = tree_conv(
+ x, state, weight, bias, "silu", slots=slots, accepted=accepted, query_start_loc=qsl, ancestors=ancestors
+ )
+
+ for b, plist in enumerate(parent_lists):
+ window = old[int(slots[b]), :, int(accepted[b]) - 1 : int(accepted[b]) + 2] # [dim, 3]: oldest first
+ rows = x[int(qsl[b]) : int(qsl[b + 1])]
+ for row, codes in enumerate(_ancestors(plist)):
+ inputs = [(rows[c] if c >= 0 else window[:, 3 + c]) for c in reversed(codes)] + [rows[row]]
+ want = bias.float() + sum((w * v).float() for w, v in zip(weight.t(), inputs))
+ want = want * torch.sigmoid(want)
+ torch.testing.assert_close(out[int(qsl[b]) + row].float(), want, atol=2e-2, rtol=2e-2)
+ rolled = state[int(slots[b])]
+ torch.testing.assert_close(rolled[:, :2], old[int(slots[b]), :, int(accepted[b]) : int(accepted[b]) + 2])
+ torch.testing.assert_close(rolled[:, 2 : 2 + len(plist)], rows.t())
+
+
+def _gate(a, b, A_log, dt_bias):
+ g = -torch.exp(A_log) * torch.nn.functional.softplus(a + dt_bias)
+ return g, torch.sigmoid(b)
+
+
+def _reference(q, k, v, a, b, A_log, dt_bias, init, parents, heads, value_heads):
+ """Per row: ``(output [HV, V], state [HV, V, K])``, each row continuing from its parent's state."""
+ outs, states = [], []
+ for row, parent in enumerate(parents):
+ state = (init if parent < 0 else states[parent]).clone()
+ qn, kn = q[row], k[row]
+ qn = qn / torch.sqrt((qn * qn).sum(-1, keepdim=True) + 1e-6)
+ kn = kn / torch.sqrt((kn * kn).sum(-1, keepdim=True) + 1e-6)
+ qn, kn = qn * q.shape[-1] ** -0.5, kn
+ g, beta = _gate(a[row], b[row], A_log, dt_bias)
+ out = torch.zeros_like(v[row])
+ for hv in range(value_heads):
+ h = hv // (value_heads // heads)
+ s = state[hv] * torch.exp(g[hv])
+ delta = (v[row, hv] - s @ kn[h]) * beta[hv]
+ s = s + delta[:, None] * kn[h][None, :]
+ state[hv] = s
+ out[hv] = s @ qn[h]
+ outs.append(out)
+ states.append(state)
+ return torch.stack(outs), states
+
+
[email protected]("parent_lists", [[TREE, CHAIN], [TREE, TREE[:5]], [random_tree(16, 2), random_tree(16, 3)]])
[email protected]("dims", [(2, 4, 8, 8), (2, 6, 128, 128)]) # heads, value heads, key dim, value dim
+def test_recurrence_continues_each_row_from_its_parent(parent_lists, dims):
+ torch.manual_seed(1)
+ width = max(map(len, parent_lists))
+ (heads, value_heads, dk, dv), num_slots = dims, 40
+ parents, _, qsl = _requests(parent_lists, width)
+ tokens = int(qsl[-1])
+ q, k = torch.randn(1, tokens, heads, dk, device=DEV), torch.randn(1, tokens, heads, dk, device=DEV)
+ v = torch.randn(1, tokens, value_heads, dv, device=DEV)
+ a, b = torch.randn(tokens, value_heads, device=DEV), torch.randn(tokens, value_heads, device=DEV)
+ A_log, dt_bias = torch.randn(value_heads, device=DEV), torch.randn(value_heads, device=DEV)
+ state = torch.randn(num_slots, value_heads, dv, dk, device=DEV) * 0.1
+ slots = torch.arange(1, 1 + len(parent_lists) * (width + 1), dtype=torch.int32, device=DEV).view(
+ len(parent_lists), width + 1
+ )
+ accepted = torch.tensor([1, 2][: len(parent_lists)], dtype=torch.int32, device=DEV)
+ init = [state[int(slots[i, int(accepted[i]) - 1])].clone() for i in range(len(parent_lists))]
+
+ out = tree_recurrence(
+ A_log, a, b, dt_bias, q, k, v, state, parents=parents, slots=slots, accepted=accepted, query_start_loc=qsl
+ )
+
+ for i, plist in enumerate(parent_lists):
+ lo, hi = int(qsl[i]), int(qsl[i + 1])
+ want_out, want_states = _reference(
+ q[0, lo:hi],
+ k[0, lo:hi],
+ v[0, lo:hi],
+ a[lo:hi],
+ b[lo:hi],
+ A_log,
+ dt_bias,
+ init[i],
+ plist,
+ heads,
+ value_heads,
+ )
+ torch.testing.assert_close(out[0, lo:hi], want_out, atol=1e-4, rtol=1e-4)
+ for row, want in enumerate(want_states):
+ torch.testing.assert_close(state[int(slots[i, row])], want, atol=1e-4, rtol=1e-4)
+
+
+def test_spec_rows_read_the_packed_projection_in_place_and_write_the_layer_output():
+ """``TreeVerify.forward_spec_rows`` on strided views of the projections == tree_conv + contiguous
+ q/k/v/a/b + tree_recurrence, bit for bit; the output lands in the layer's buffer and the publishing layer's
+ slots are copied out."""
+ from types import SimpleNamespace
+
+ pytest.importorskip("vllm")
+ from vllm.model_executor.layers.mamba.gdn.verify_extension import GDNSpecRows
+
+ from eagle_harness.vllm.gdn_tree_verify import TreeVerify
+ from eagle_harness.vllm.verify_layout import set_stage
+
+ torch.manual_seed(3)
+ plists = [random_tree(8, 4), TREE]
+ width = max(map(len, plists))
+ heads, value_heads, dk, dv = 2, 4, 16, 16
+ key_dim, value_dim = heads * dk, value_heads * dv
+ dim = 2 * key_dim + value_dim
+ parents, ancestors, qsl = _requests(plists, width)
+ tokens = int(qsl[-1])
+ a_log, dt_bias = torch.randn(value_heads, device=DEV), torch.randn(value_heads, device=DEV)
+ published = torch.zeros(len(plists), width + 1, dtype=torch.int32, device=DEV)
+ set_stage(SimpleNamespace(ancestors=ancestors, parents=parents, state_slots={"layers.0": published}))
+ slots = torch.arange(1, 1 + len(plists) * (width + 1), dtype=torch.int32, device=DEV).view(len(plists), -1)
+ accepted = torch.tensor([1, 2], dtype=torch.int32, device=DEV)
+ bf16 = HALF
+ qkvz = torch.randn(tokens, dim + value_dim, device=DEV, dtype=bf16) # the projection: [q, k, v, z]
+ ba = torch.randn(tokens, 2 * value_heads, device=DEV, dtype=bf16)
+ b, a = ba.chunk(2, dim=-1)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=bf16), torch.randn(dim, device=DEV, dtype=bf16)
+ conv0 = torch.randn(slots.numel() + 1, dim, 3 + width, device=DEV, dtype=bf16)
+ ssm0 = torch.randn(slots.numel() + 1, value_heads, dv, dk, device=DEV) * 0.1
+ try:
+ conv_state, ssm_state = conv0.clone(), ssm0.clone()
+ conv = tree_conv(
+ qkvz[:, :dim].contiguous(),
+ conv_state,
+ weight,
+ bias,
+ "silu",
+ slots=slots[:, 0],
+ accepted=accepted,
+ query_start_loc=qsl,
+ ancestors=ancestors,
+ )
+ q, k, v = (t.contiguous() for t in conv.split([key_dim, key_dim, value_dim], dim=-1))
+ want = tree_recurrence(
+ a_log,
+ a.contiguous(),
+ b.contiguous(),
+ dt_bias,
+ q.view(1, tokens, heads, dk),
+ k.view(1, tokens, heads, dk),
+ v.view(1, tokens, value_heads, dv),
+ ssm_state,
+ parents=parents,
+ slots=slots,
+ accepted=accepted,
+ query_start_loc=qsl,
+ )
+ got_conv, got_ssm = conv0.clone(), ssm0.clone()
+ out = torch.zeros(tokens, value_heads, dv, device=DEV, dtype=bf16)
+ TreeVerify(None).forward_spec_rows(
+ GDNSpecRows(
+ layer_name="layers.0",
+ mixed_qkv=qkvz[:, :dim],
+ a=a,
+ b=b,
+ conv_state=got_conv,
+ conv_weight=weight,
+ conv_bias=bias,
+ activation="silu",
+ ssm_state=got_ssm,
+ A_log=a_log,
+ dt_bias=dt_bias,
+ num_k_heads=heads,
+ num_v_heads=value_heads,
+ head_k_dim=dk,
+ head_v_dim=dv,
+ state_indices=slots,
+ num_accepted_tokens=accepted,
+ query_start_loc=qsl,
+ out=out,
+ )
+ )
+ finally:
+ set_stage(None)
+ assert torch.equal(out, want.view(tokens, value_heads, dv))
+ assert torch.equal(got_ssm, ssm_state) and torch.equal(got_conv, conv_state)
+ assert torch.equal(published, slots)
+
+
[email protected](not torch.cuda.is_available(), reason="vLLM's own kernels need a GPU")
[email protected]("dim_first", [True, False])
+def test_a_chain_is_what_vllm_verifies(dim_first):
+ """On a chain the tree kernels must be vLLM's own chain kernels (outputs and the states they leave)."""
+ pytest.importorskip("vllm")
+ from vllm.model_executor.layers.mamba.ops.causal_conv1d import causal_conv1d_update
+ from vllm.model_executor.layers.mamba.gdn.qwen_gdn_linear_attn import fused_sigmoid_gating_delta_rule_update
+
+ torch.manual_seed(2)
+ width, dim, state_len, num_slots, reqs = 6, 64, 3 + 5, 40, 3
+ parents, ancestors, qsl = _requests([list(range(-1, width - 1))] * reqs, width)
+ tokens = reqs * width
+ accepted = torch.tensor([1, 3, 6][:reqs], dtype=torch.int32, device=DEV)
+ x = torch.randn(tokens, dim, device=DEV, dtype=torch.bfloat16)
+ weight, bias = (
+ torch.randn(dim, 4, device=DEV, dtype=torch.bfloat16),
+ torch.randn(dim, device=DEV, dtype=torch.bfloat16),
+ )
+ raw = torch.randn(
+ (num_slots, dim, state_len) if dim_first else (num_slots, state_len, dim), device=DEV, dtype=torch.bfloat16
+ )
+ view = raw if dim_first else raw.transpose(-1, -2)
+ slots = torch.arange(1, 1 + reqs * (width + 1), dtype=torch.int32, device=DEV).view(reqs, width + 1)
+ ours, theirs = view.clone(), view.clone()
+ got = tree_conv(
+ x,
+ ours,
+ weight,
+ bias,
+ "silu",
+ slots=slots[:, 0].contiguous(),
+ accepted=accepted,
+ query_start_loc=qsl,
+ ancestors=ancestors,
+ )
+ want = causal_conv1d_update(
+ x,
+ theirs,
+ weight,
+ bias,
+ "silu",
+ conv_state_indices=slots[:, 0].contiguous(),
+ num_accepted_tokens=accepted,
+ query_start_loc=qsl,
+ max_query_len=width + 1,
+ validate_data=False,
+ )
+ torch.testing.assert_close(got, want)
+ torch.testing.assert_close(ours[slots[:, 0].long()], theirs[slots[:, 0].long()])
+
+ heads, value_heads, dk, dv = 2, 4, 128, 128
+ q, k = (torch.randn(1, tokens, heads, dk, device=DEV, dtype=torch.bfloat16) for _ in range(2))
+ v = torch.randn(1, tokens, value_heads, dv, device=DEV, dtype=torch.bfloat16)
+ a, b = (torch.randn(tokens, value_heads, device=DEV, dtype=torch.bfloat16) for _ in range(2))
+ A_log, dt_bias = torch.randn(value_heads, device=DEV), torch.randn(value_heads, device=DEV, dtype=torch.bfloat16)
+ state = torch.randn(num_slots, value_heads, dv, dk, device=DEV) * 0.1
+ ours, theirs = state.clone(), state.clone()
+ got = tree_recurrence(
+ A_log, a, b, dt_bias, q, k, v, ours, parents=parents, slots=slots, accepted=accepted, query_start_loc=qsl
+ )
+ want, _ = fused_sigmoid_gating_delta_rule_update(
+ A_log=A_log,
+ a=a,
+ b=b,
+ dt_bias=dt_bias,
+ q=q,
+ k=k,
+ v=v,
+ initial_state=theirs,
+ inplace_final_state=True,
+ cu_seqlens=qsl,
+ ssm_state_indices=slots,
+ num_accepted_tokens=accepted,
+ use_qk_l2norm_in_kernel=True,
+ )
+ torch.testing.assert_close(got.float(), want.float(), atol=2e-2, rtol=2e-2)
+ torch.testing.assert_close(ours, theirs, atol=2e-2, rtol=2e-2)
+
+
[email protected](not torch.cuda.is_available(), reason="vLLM's own kernels need a GPU")
+ "parent_lists,paths",
+ [
+ ([TREE, TREE], [[0, 1, 4], [0, 2, 5]]), # accepted rows that are not a prefix of the verify rows
+ ([TREE, TREE], [[0], [0, 1, 3]]),
+ ([random_tree(16, 4), random_tree(16, 5)], [[0, 1], [0, 1, 2]]),
+ (
+ [random_tree(16, 8), random_tree(16, 9)],
+ [deepest_path(random_tree(16, 8)), deepest_path(random_tree(16, 9))],
+ ),
+ (
+ [[-1, 0, 1, 2, 3, 3, 4, 5], [-1, 0, 1, 2, 3, 3, 4, 5]],
+ [[0, 1, 2, 3, 5, 7], [0, 1, 2, 3, 4, 6]],
+ ), # long paths ending off the prefix
+ ],
+)
+def test_a_committed_tree_round_continues_like_the_accepted_chain(parent_lists, paths):
+ """After tree verify + commit, vLLM's own chain kernels resume exactly as if only the accepted path had been verified."""
+ pytest.importorskip("vllm")
+ from vllm.model_executor.layers.mamba.gdn.qwen_gdn_linear_attn import fused_sigmoid_gating_delta_rule_update
+ from vllm.model_executor.layers.mamba.mamba_utils import is_conv_state_dim_first
+ from vllm.model_executor.layers.mamba.ops.causal_conv1d import causal_conv1d_update
+
+ from eagle_harness.vllm.gdn_tree_verify import LinearStateCommit
+ from eagle_harness.vllm.verify_layout import TreeStore
+
+ torch.manual_seed(3)
+ reqs = len(parent_lists)
+ width = max(map(len, parent_lists))
+ dim, state_len, num_slots = 48, width + 2, 64
+ heads, value_heads, dk, dv = 2, 4, 64, 64
+ bf16 = torch.bfloat16
+ parents, ancestors, qsl = _requests(parent_lists, width)
+ tokens = int(qsl[-1])
+ slots = torch.arange(1, 1 + reqs * (width + 1), dtype=torch.int32, device=DEV).view(reqs, width + 1)
+ first = torch.tensor([1, 2][:reqs], dtype=torch.int32, device=DEV) # accepted before the round
+
+ x = torch.randn(tokens, dim, device=DEV, dtype=bf16)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=bf16), torch.randn(dim, device=DEV, dtype=bf16)
+ q, k = (torch.randn(1, tokens, heads, dk, device=DEV, dtype=bf16) for _ in range(2))
+ v = torch.randn(1, tokens, value_heads, dv, device=DEV, dtype=bf16)
+ a, b = (torch.randn(tokens, value_heads, device=DEV, dtype=bf16) for _ in range(2))
+ A_log, dt_bias = torch.randn(value_heads, device=DEV), torch.randn(value_heads, device=DEV, dtype=bf16)
+
+ dim_first = is_conv_state_dim_first()
+ conv_raw = torch.randn(
+ (num_slots, dim, state_len) if dim_first else (num_slots, state_len, dim), device=DEV, dtype=bf16
+ )
+ ssm0 = torch.randn(num_slots, value_heads, dv, dk, device=DEV) * 0.1
+ window = lambda raw: raw if dim_first else raw.transpose(-1, -2) # noqa: E731
+
+ # tree side: verify the whole tree, then commit the accepted path
+ tree_conv_raw, tree_ssm = conv_raw.clone(), ssm0.clone()
+ tree_conv(
+ x,
+ window(tree_conv_raw),
+ weight,
+ bias,
+ "silu",
+ slots=slots[:, 0].contiguous(),
+ accepted=first,
+ query_start_loc=qsl,
+ ancestors=ancestors,
+ )
+ tree_recurrence(
+ A_log, a, b, dt_bias, q, k, v, tree_ssm, parents=parents, slots=slots, accepted=first, query_start_loc=qsl
+ )
+ store = TreeStore(8, width, DEV)
+ for r, path in enumerate(paths):
+ store.path[r, : len(path)] = torch.tensor(path, dtype=torch.int32, device=DEV)
+ store.path_len[r] = len(path)
+
+ class Layer:
+ kv_cache = (tree_conv_raw, tree_ssm)
+
+ LinearStateCommit([Layer], [slots], DEV).commit(
+ torch.arange(reqs, dtype=torch.int64, device=DEV), store.path, store.path_len
+ )
+
+ # reference side: vLLM verifies a chain of `width` rows per request, the accepted path first; the rows after
+ # the accepted ones are never read again
+ ref_conv_raw, ref_ssm = conv_raw.clone(), ssm0.clone()
+ order = [path + [r for r in range(width) if r not in path] for path in paths]
+ rows = torch.cat([qsl[r] + torch.tensor(o, device=DEV) for r, o in enumerate(order)])
+ lens = qsl
+ causal_conv1d_update(
+ x[rows],
+ window(ref_conv_raw),
+ weight,
+ bias,
+ "silu",
+ conv_state_indices=slots[:, 0].contiguous(),
+ num_accepted_tokens=first,
+ query_start_loc=lens,
+ max_query_len=width + 1,
+ validate_data=False,
+ )
+ fused_sigmoid_gating_delta_rule_update(
+ A_log=A_log,
+ a=a[rows],
+ b=b[rows],
+ dt_bias=dt_bias,
+ q=q[:, rows],
+ k=k[:, rows],
+ v=v[:, rows],
+ initial_state=ref_ssm,
+ inplace_final_state=True,
+ cu_seqlens=lens,
+ ssm_state_indices=slots,
+ num_accepted_tokens=first,
+ use_qk_l2norm_in_kernel=True,
+ )
+
+ # the next step, a chain of 4 rows resuming after the accepted path, must agree
+ accepted = torch.tensor([len(p) for p in paths], dtype=torch.int32, device=DEV)
+ nxt = 4
+ nqsl = torch.arange(0, (reqs + 1) * nxt, nxt, dtype=torch.int32, device=DEV)
+ x2 = torch.randn(reqs * nxt, dim, device=DEV, dtype=bf16)
+ q2, k2 = (torch.randn(1, reqs * nxt, heads, dk, device=DEV, dtype=bf16) for _ in range(2))
+ v2 = torch.randn(1, reqs * nxt, value_heads, dv, device=DEV, dtype=bf16)
+ a2, b2 = (torch.randn(reqs * nxt, value_heads, device=DEV, dtype=bf16) for _ in range(2))
+ outs = []
+ for conv_raw_side, ssm_side in ((tree_conv_raw, tree_ssm), (ref_conv_raw, ref_ssm)):
+ y = causal_conv1d_update(
+ x2.clone(),
+ window(conv_raw_side),
+ weight,
+ bias,
+ "silu", # (vLLM's conv writes over its input)
+ conv_state_indices=slots[:, 0].contiguous(),
+ num_accepted_tokens=accepted,
+ query_start_loc=nqsl,
+ max_query_len=width + 1,
+ validate_data=False,
+ )
+ o, _ = fused_sigmoid_gating_delta_rule_update(
+ A_log=A_log,
+ a=a2,
+ b=b2,
+ dt_bias=dt_bias,
+ q=q2,
+ k=k2,
+ v=v2,
+ initial_state=ssm_side,
+ inplace_final_state=True,
+ cu_seqlens=nqsl,
+ ssm_state_indices=slots,
+ num_accepted_tokens=accepted,
+ use_qk_l2norm_in_kernel=True,
+ )
+ outs.append((y.float(), o.float()))
+ torch.testing.assert_close(outs[0][0], outs[1][0], atol=3e-2, rtol=3e-2)
+ torch.testing.assert_close(outs[0][1], outs[1][1], atol=3e-2, rtol=3e-2)
+
+
[email protected](not torch.cuda.is_available(), reason="vLLM's own kernels need a GPU")
[email protected]("accepted", [[1, 1], [2, 5], [4, 9], [16, 7]])
[email protected]("kernel", ["triton", "gluon"])
+def test_every_row_equals_vllm_verifying_its_path_as_a_chain(accepted, kernel):
+ """A tree row computes what vLLM's chain kernels compute for the chain root -> .. -> row (any resume offset)."""
+ pytest.importorskip("vllm")
+ from vllm.model_executor.layers.mamba.gdn.qwen_gdn_linear_attn import fused_sigmoid_gating_delta_rule_update
+ from vllm.model_executor.layers.mamba.mamba_utils import is_conv_state_dim_first
+ from vllm.model_executor.layers.mamba.ops.causal_conv1d import causal_conv1d_update
+
+ torch.manual_seed(5)
+ parent_lists = [random_tree(16, 6), random_tree(16, 7)]
+ reqs, width = 2, 16
+ dim, state_len, num_slots = 96, width + 2, 80
+ heads, value_heads, dk, dv = 4, 12, 128, 128
+ bf16 = torch.bfloat16
+ parents, ancestors, qsl = _requests(parent_lists, width)
+ tokens = int(qsl[-1])
+ slots = torch.arange(1, 1 + reqs * width, dtype=torch.int32, device=DEV).view(reqs, width)
+ slots = torch.cat([slots, slots[:, -1:] + 1], dim=1)
+ acc = torch.tensor(accepted, dtype=torch.int32, device=DEV)
+ x = torch.randn(tokens, dim, device=DEV, dtype=bf16)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=bf16), torch.randn(dim, device=DEV, dtype=bf16)
+ q, k = (torch.randn(1, tokens, heads, dk, device=DEV, dtype=bf16) for _ in range(2))
+ v = torch.randn(1, tokens, value_heads, dv, device=DEV, dtype=bf16)
+ a, b = (torch.randn(tokens, value_heads, device=DEV, dtype=bf16) for _ in range(2))
+ A_log, dt_bias = torch.randn(value_heads, device=DEV), torch.randn(value_heads, device=DEV, dtype=bf16)
+ dim_first = is_conv_state_dim_first()
+ conv_raw = torch.randn(
+ (num_slots, dim, state_len) if dim_first else (num_slots, state_len, dim), device=DEV, dtype=bf16
+ )
+ ssm0 = torch.randn(num_slots, value_heads, dv, dk, device=DEV, dtype=bf16) * 0.1
+ window = lambda raw: raw if dim_first else raw.transpose(-1, -2) # noqa: E731
+
+ tree_raw, tree_ssm = conv_raw.clone(), ssm0.clone()
+ got_conv = tree_conv(
+ x,
+ window(tree_raw),
+ weight,
+ bias,
+ "silu",
+ slots=slots[:, 0].contiguous(),
+ accepted=acc,
+ query_start_loc=qsl,
+ ancestors=ancestors,
+ )
+ got_rec = tree_recurrence(
+ A_log,
+ a,
+ b,
+ dt_bias,
+ q,
+ k,
+ v,
+ tree_ssm,
+ parents=parents,
+ slots=slots,
+ accepted=acc,
+ query_start_loc=qsl,
+ kernel=kernel,
+ )
+
+ for r, plist in enumerate(parent_lists):
+ for row in range(width):
+ chain, node = [], row
+ while node >= 0:
+ chain.append(node)
+ node = plist[node]
+ chain = chain[::-1]
+ idx = qsl[r] + torch.tensor(chain, device=DEV)
+ n = len(chain)
+ one = torch.tensor([0, n], dtype=torch.int32, device=DEV)
+ raw, ssm = conv_raw.clone(), ssm0.clone()
+ y = causal_conv1d_update(
+ x[idx].clone(),
+ window(raw),
+ weight,
+ bias,
+ "silu",
+ conv_state_indices=slots[r : r + 1, 0].contiguous(),
+ num_accepted_tokens=acc[r : r + 1],
+ query_start_loc=one,
+ max_query_len=width + 1,
+ validate_data=False,
+ )
+ o, _ = fused_sigmoid_gating_delta_rule_update(
+ A_log=A_log,
+ a=a[idx],
+ b=b[idx],
+ dt_bias=dt_bias,
+ q=q[:, idx],
+ k=k[:, idx],
+ v=v[:, idx],
+ initial_state=ssm,
+ inplace_final_state=True,
+ cu_seqlens=one,
+ ssm_state_indices=slots[r : r + 1],
+ num_accepted_tokens=acc[r : r + 1],
+ use_qk_l2norm_in_kernel=True,
+ )
+ torch.testing.assert_close(got_conv[int(qsl[r]) + row].float(), y[-1].float(), atol=3e-2, rtol=3e-2)
+ torch.testing.assert_close(got_rec[0, int(qsl[r]) + row].float(), o[0, -1].float(), atol=3e-2, rtol=3e-2)
+ torch.testing.assert_close(
+ tree_ssm[int(slots[r, row])].float(), ssm[int(slots[r, n - 1])].float(), atol=3e-2, rtol=3e-2
+ )
+
+
+ "kernel",
+ ["triton", pytest.param("gluon", marks=pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a GPU"))],
+)
+def test_recurrence_publishes_every_requests_slots(kernel):
+ """``publish`` receives each request's state slots from the kernel, a padded request's too (no rows, so its
+ programs do no recurrence), and leaves the columns past the slots alone; the outputs do not change."""
+ torch.manual_seed(5)
+ heads, value_heads, d, width, bf16 = 1, 2, 128, 4, torch.bfloat16
+ parents = torch.tensor([[-1, 0, 0, 1], [-1, 0, 1, 2], [0, 0, 0, 0]], dtype=torch.int32, device=DEV)
+ qsl = torch.tensor([0, 4, 8, 8], dtype=torch.int32, device=DEV) # request 2 is padding: no rows
+ tokens = 8
+ q, k = (torch.randn(1, tokens, heads, d, device=DEV, dtype=bf16) for _ in range(2))
+ v = torch.randn(1, tokens, value_heads, d, device=DEV, dtype=bf16)
+ a, b = (torch.randn(tokens, value_heads, device=DEV, dtype=bf16) for _ in range(2))
+ A_log, dt_bias = torch.zeros(value_heads, device=DEV), torch.zeros(value_heads, device=DEV, dtype=bf16)
+ slots = torch.arange(1, 1 + 3 * (width + 1), dtype=torch.int32, device=DEV).view(3, width + 1)
+ slots[2] = 0
+ accepted = torch.tensor([1, 2, 1], dtype=torch.int32, device=DEV)
+ state0 = torch.randn(slots.numel() + 1, value_heads, d, d, device=DEV) * 0.05
+ results = []
+ for publish in (None, torch.full((3, width + 3), -7, dtype=torch.int32, device=DEV)):
+ state = state0.clone()
+ out = tree_recurrence(
+ A_log,
+ a,
+ b,
+ dt_bias,
+ q,
+ k,
+ v,
+ state,
+ parents=parents,
+ slots=slots,
+ accepted=accepted,
+ query_start_loc=qsl,
+ publish=publish,
+ kernel=kernel,
+ )
+ results.append((out, state, publish))
+ (out0, state0_after, _), (out1, state1_after, published) = results
+ assert torch.equal(published[:, : width + 1], slots)
+ assert torch.all(published[:, width + 1 :] == -7)
+ assert torch.equal(out1, out0) and torch.equal(state1_after, state0_after)
diff --git a/tests/test_gdn_tree_records_gpu.py b/tests/test_gdn_tree_records_gpu.py
new file mode 100644
index 0000000..97e7a2f
--- /dev/null
+++ b/tests/test_gdn_tree_records_gpu.py
@@ -0,0 +1,90 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""ROCm chunk records against an independent fp32 tree recurrence."""
+
+import pytest
+import torch
+
+
[email protected](not torch.cuda.is_available() or torch.version.hip is None, reason="ROCm GPU required")
[email protected]("width,batch", [(1, 1), (8, 2), (16, 1), (32, 2)])
[email protected]("seed", [11, 41, 97])
+def test_chunk_records_and_commit(width, batch, seed):
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_chunk_update, gdn_tree_records_commit
+
+ device = "cuda"
+ gen = torch.Generator(device=device).manual_seed(seed)
+ h, hv, kdim, vdim = 4, 12, 128, 128
+
+ def rand(*shape, dtype=torch.bfloat16):
+ return torch.randn(*shape, generator=gen, device=device, dtype=dtype) * 0.2
+
+ q, k = rand(1, batch * width, h, kdim), rand(1, batch * width, h, kdim)
+ v = rand(1, batch * width, hv, vdim)
+ a, b = rand(batch * width, hv), rand(batch * width, hv)
+ A, bias = rand(hv, dtype=torch.float32), rand(hv, dtype=torch.float32)
+ state = rand(batch + 2, hv, vdim, kdim)
+ slots = torch.arange(1, batch + 1, dtype=torch.int32, device=device).flip(0)
+ rows = torch.arange(batch, dtype=torch.int32, device=device).flip(0)
+ qsl = torch.arange(batch + 1, dtype=torch.int32, device=device) * width
+ parent = torch.zeros(batch, width + 7, dtype=torch.int32, device=device)
+ for node in range(1, width):
+ parent[:, node] = torch.randint(node, (batch,), generator=gen, device=device, dtype=torch.int32)
+ rec = torch.full((batch + 1, width + 3, hv, vdim + kdim + 4), -999.0, device=device)
+ expected = torch.empty_like(v)
+ snapshots = []
+ for request in range(batch):
+ states = []
+ for node in range(width):
+ token = request * width + node
+ prior = state[slots[request]].float() if node == 0 else states[int(parent[request, node])]
+ key = k[0, token].float()
+ key = key / (key.square().sum(-1, keepdim=True) + 1e-6).sqrt()
+ query = q[0, token].float()
+ query = query / (query.square().sum(-1, keepdim=True) + 1e-6).sqrt() / kdim**0.5
+ key, query = key.repeat_interleave(hv // h, 0), query.repeat_interleave(hv // h, 0)
+ decay = (-A.exp() * torch.nn.functional.softplus(a[token].float() + bias)).exp()
+ beta = b[token].float().sigmoid().to(b.dtype).float()
+ decayed = prior * decay[:, None, None]
+ delta = (v[0, token].float() - (decayed * key[:, None, :]).sum(-1)) * beta[:, None]
+ current = decayed + delta[:, :, None] * key[:, None, :]
+ states.append(current)
+ expected[0, token] = (current * query[:, None, :]).sum(-1).to(v.dtype)
+ snapshots.append(states)
+ for fly in [False, True]:
+ out = gdn_tree_chunk_update(
+ A,
+ bias,
+ q,
+ k,
+ v,
+ a,
+ b,
+ state=state,
+ state_indices=slots,
+ query_start_loc=qsl,
+ parent=parent,
+ records=rec,
+ record_indices=rows,
+ width=width,
+ use_flydsl=fly,
+ )
+ torch.testing.assert_close(out.float(), expected.float(), atol=0.002, rtol=0.02)
+ assert bool((rec[-1] == -999.0).all()), "unused record row changed"
+ accepted = torch.full((batch,), width - 1, dtype=torch.int32, device=device)
+ committed = state.clone().unsqueeze(0)
+ gdn_tree_records_commit(committed, rec.unsqueeze(0), slots, rows, accepted, parent, False)
+ for request in range(batch):
+ torch.testing.assert_close(
+ committed[0, slots[request]].float(),
+ snapshots[request][-1].to(state.dtype).float(),
+ atol=0.002,
+ rtol=0.02,
+ )
+ assert torch.equal(committed[0, 0], state[0])
+ assert torch.equal(committed[0, -1], state[-1])
+ # A negative accepted step must not touch any persistent state.
+ before = committed.clone()
+ gdn_tree_records_commit(committed, rec.unsqueeze(0), slots, rows, -torch.ones_like(accepted), parent, False)
+ assert torch.equal(committed, before)
diff --git a/tests/test_gemm_solutions.py b/tests/test_gemm_solutions.py
new file mode 100644
index 0000000..8a85cda
--- /dev/null
+++ b/tests/test_gemm_solutions.py
@@ -0,0 +1,172 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Saved GEMM solutions (``<data_path>/gemm_solutions.csv``) are served with tuning off, or left alone."""
+
+import importlib.util
+import os
+from pathlib import Path
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+from eagle_harness.core.gemm_solutions import (
+ AITER_GEMM_TABLE,
+ AITER_GEMM_TABLE_ENV,
+ GEMM_SOLUTIONS_FILE,
+ gemm_solutions_path,
+ load_gemm_solutions,
+ serve_bf16_gemms_through_torch,
+)
+
+TOOL = Path(__file__).resolve().parents[1] / "tools" / "tune_gemm_solutions.py"
+
+
+def tool():
+ spec = importlib.util.spec_from_file_location("tune_gemm_solutions", TOOL)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+class FakeTunable:
+ """Records the TunableOp calls; ``read_file`` loads ``results`` when the file validates."""
+
+ def __init__(self, results=(), validates=True):
+ self.calls = []
+ self._results, self._validates = tuple(results), validates
+ self.enabled = self.tuning = None
+
+ def enable(self, val=True):
+ self.calls.append(("enable", val))
+ self.enabled = val
+
+ def tuning_enable(self, val=True):
+ self.calls.append(("tuning_enable", val))
+ self.tuning = val
+
+ def read_file(self, filename):
+ self.calls.append(("read_file", filename))
+ return self._validates
+
+ def get_results(self):
+ return self._results if self._validates else ()
+
+
+def tunable(monkeypatch):
+ fake = FakeTunable(
+ results=[("GemmTunableOp_BFloat16_TN", "tn_34816_32_5120_ld_5120_5120_34816", "Gemm_Hipblaslt_1", 0.06)]
+ )
+ monkeypatch.setattr(torch.cuda, "tunable", fake, raising=False)
+ return fake
+
+
+def test_no_file_changes_nothing(tmp_path, tunable):
+ assert gemm_solutions_path(str(tmp_path)) is None
+ assert gemm_solutions_path(None) is None
+ assert load_gemm_solutions(str(tmp_path)) == 0
+ assert load_gemm_solutions(None) == 0
+ assert tunable.calls == []
+
+
+def test_file_is_served_with_tuning_off(tmp_path, tunable):
+ path = tmp_path / GEMM_SOLUTIONS_FILE
+ path.write_text("Validator,PT_VERSION,2.9.1\n")
+ assert gemm_solutions_path(str(tmp_path)) == str(path)
+ assert load_gemm_solutions(str(tmp_path)) == 1
+ assert tunable.calls == [("enable", True), ("tuning_enable", False), ("read_file", str(path))]
+ assert tunable.enabled is True and tunable.tuning is False
+
+
+def test_unvalidated_file_leaves_tunableop_off(tmp_path, monkeypatch, caplog):
+ fake = FakeTunable(validates=False)
+ monkeypatch.setattr(torch.cuda, "tunable", fake, raising=False)
+ (tmp_path / GEMM_SOLUTIONS_FILE).write_text("Validator,PT_VERSION,0.0.0\n")
+ with caplog.at_level("WARNING"):
+ assert load_gemm_solutions(str(tmp_path)) == 0
+ assert fake.enabled is False
+ assert "tune_gemm_solutions.py" in caplog.text
+
+
+def test_rocm_serves_bf16_gemms_through_torch(monkeypatch):
+ """On ROCm aiter's bf16 dispatch is pointed at the harness's empty table (its split-K picks are not
+ repeatable); a table the caller set stays; CUDA is left alone."""
+ monkeypatch.delenv(AITER_GEMM_TABLE_ENV, raising=False)
+ monkeypatch.setattr(torch.version, "hip", None)
+ assert serve_bf16_gemms_through_torch() is False
+ assert AITER_GEMM_TABLE_ENV not in os.environ
+ monkeypatch.setattr(torch.version, "hip", "7.2.0")
+ assert serve_bf16_gemms_through_torch() is True
+ assert os.environ[AITER_GEMM_TABLE_ENV] == AITER_GEMM_TABLE
+ assert Path(AITER_GEMM_TABLE).read_text().splitlines() == [
+ "gfx,cu_num,M,N,K,bias,dtype,outdtype,scaleAB,bpreshuffle,libtype,solidx,splitK,us,kernelName,err_ratio,tflops,bw"
+ ]
+ monkeypatch.setenv(AITER_GEMM_TABLE_ENV, "/tuned/by/the/user.csv")
+ assert serve_bf16_gemms_through_torch() is False
+ assert os.environ[AITER_GEMM_TABLE_ENV] == "/tuned/by/the/user.csv"
+
+
+def test_tune_tool_replays_linear_lines(monkeypatch, tool):
+ linears, offline = [], []
+ monkeypatch.setattr(
+ torch.nn.functional, "linear", lambda x, w: linears.append((tuple(x.shape), tuple(w.shape), x.dtype))
+ )
+ monkeypatch.setattr(
+ tool.tunable, "_process_single_offline_gemm", lambda line, dev: offline.append(line), raising=False
+ )
+ monkeypatch.setattr(torch, "randn", lambda *shape, dtype, device: SimpleNamespace(shape=shape, dtype=dtype))
+ cpu = torch.device("cpu")
+ tool.tune_line("GemmTunableOp_BFloat16_TN,tn_34816_1_5120_ld_5120_5120_34816", cpu)
+ tool.tune_line("GemmTunableOp_BFloat16_NN,nn_64_32_5120_ld_64_5120_64", cpu)
+ tool.tune_line("GemmTunableOp_BFloat16_TN,tn_34816_8_5120_ld_6144_5120_34816", cpu) # sub-matrix: offline helper
+ assert linears == [((1, 5120), (34816, 5120), torch.bfloat16)]
+ assert [line.split(",")[1] for line in offline] == [
+ "nn_64_32_5120_ld_64_5120_64",
+ "tn_34816_8_5120_ld_6144_5120_34816",
+ ]
+
+
+def test_untuned_lines_dedupe_in_order(tmp_path, tool):
+ a = tmp_path / "untuned0.csv"
+ b = tmp_path / "untuned1.csv"
+ a.write_text(
+ "Validator,PT_VERSION,2.9.1\nGemmTunableOp_BFloat16_TN,tn_1_2_3_ld_3_3_1\nGemmTunableOp_BFloat16_TN,tn_4_5_6_ld_6_6_4\n"
+ )
+ b.write_text(
+ "GemmTunableOp_BFloat16_TN,tn_4_5_6_ld_6_6_4\nScaledGemmTunableOp_x,y_9_300_7\nGemmTunableOp_BFloat16_TN,tn_4_65_6_ld_6_6_4\n"
+ )
+ assert tool.untuned_lines([a, b], 64) == [
+ "GemmTunableOp_BFloat16_TN,tn_1_2_3_ld_3_3_1",
+ "GemmTunableOp_BFloat16_TN,tn_4_5_6_ld_6_6_4",
+ ]
+ assert tool.untuned_lines([b], 300) == [
+ "GemmTunableOp_BFloat16_TN,tn_4_5_6_ld_6_6_4",
+ "ScaledGemmTunableOp_x,y_9_300_7",
+ "GemmTunableOp_BFloat16_TN,tn_4_65_6_ld_6_6_4",
+ ]
+
+
+def test_decode_rows_cover_the_served_batches(tmp_path, tool):
+ assert tool.decode_rows([1, 2], 4, [8, 16]) == {1, 2, 4, 8, 16, 32}
+ lines = [f"GemmTunableOp_BFloat16_TN,tn_5120_{rows}_5120_ld_5120_5120_5120" for rows in (1, 3, 8, 69, 256)]
+ path = tmp_path / "untuned.csv"
+ path.write_text("\n".join(lines))
+ selected = tool.untuned_lines([path], 64, tool.decode_rows([1, 8], 4, [8, 32]))
+ assert [tool.gemm_rows(line) for line in selected] == [1, 8, 256]
+
+
[email protected]("values", [("0", "4", "8"), ("8-1", "4", "8"), ("1-8", "0", "8"), ("1", "4", "0")])
+def test_decode_rows_reject_invalid_dimensions(tmp_path, monkeypatch, capsys, tool, values):
+ path = tmp_path / "untuned.csv"
+ path.write_text("GemmTunableOp_BFloat16_TN,tn_4_1_6_ld_6_6_4\n")
+ monkeypatch.setattr(
+ "sys.argv",
+ ["tune_gemm_solutions.py", "--data-path", str(tmp_path), "--untuned", str(path), "--decode-rows", *values],
+ )
+ with pytest.raises(SystemExit) as error:
+ tool.main()
+ assert error.value.code == 2
+ assert "--decode-rows" in capsys.readouterr().err
diff --git a/tests/test_gpu_kernels.py b/tests/test_gpu_kernels.py
new file mode 100644
index 0000000..c9a5b78
--- /dev/null
+++ b/tests/test_gpu_kernels.py
@@ -0,0 +1,157 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""GPU kernels of the vLLM adapter against dense torch references (needs a GPU and vLLM's GPU build)."""
+
+import pytest
+import torch
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a GPU")
+# a CPU-only vLLM build lacks the FlashAttention entry points the tree attention imports
+pytest.importorskip("eagle_harness.vllm.tree_attention", reason="needs vLLM's GPU build", exc_type=ImportError)
+
+from eagle_harness.vllm.draft_attention import build_tree_rows, row_attention # noqa: E402
+from eagle_harness.vllm.round_commit import KvCompactor # noqa: E402
+from eagle_harness.vllm.verify_layout import TreeStore, VerifyStage # noqa: E402
+
+DEV = torch.device("cuda")
+PARENTS = [-1, 0, 0, 1, 1, 2, 3] # width 7
+
+
+def _stage(num_reqs: int, width: int, parents: list[int]):
+ store = TreeStore(8, width, DEV)
+ store.parents[:] = torch.tensor(parents + [-1] * (width - len(parents)), dtype=torch.int32, device=DEV)
+ stage = VerifyStage(8, 8 * width, width, DEV)
+ qsl = torch.arange(0, (num_reqs + 1) * width, width, dtype=torch.int32, device=DEV)
+ positions = (100 + torch.arange(width, device=DEV)).repeat(num_reqs).to(torch.int64)
+ stage.stage(
+ store,
+ torch.arange(num_reqs, dtype=torch.int32, device=DEV),
+ qsl,
+ qsl,
+ positions,
+ num_reqs,
+ num_reqs * width,
+ tree=True,
+ )
+ return stage, qsl, positions
+
+
+def _random_parents(width: int, seed: int) -> list[int]:
+ gen = torch.Generator().manual_seed(seed)
+ return [-1] + [int(torch.randint(0, r, (1,), generator=gen)) for r in range(1, width)]
+
+
+ "parents", [PARENTS, _random_parents(16, 1), _random_parents(16, 2), _random_parents(64, 3), [-1, 0, 1, 2, 3]]
+)
+def test_stage_depths_masks_and_window_ancestors(parents):
+ width = len(parents)
+ stage, _, positions = _stage(2, width, parents)
+ depth, window, mask = [0], [[-1, -2, -3]], [1]
+ for row in range(1, width):
+ p = parents[row]
+ depth.append(depth[p] + 1)
+ window.append([p, window[p][0], window[p][1]])
+ mask.append(1 << row | mask[p])
+ mask = [m - (1 << 64) if m >= 1 << 63 else m for m in mask] # int64
+ for b in range(2):
+ assert (positions[b * width : (b + 1) * width] - 100).tolist() == depth
+ assert stage.ancestors[b].t().tolist() == window
+ assert stage.masks[b].tolist() == mask
+ assert stage.parents[b].tolist() == parents
+ assert stage.slot_parents[b].tolist() == parents # request b sits in state slot b
+ assert stage.slot_depths[b].tolist() == depth
+ assert int(stage.context_lens[b]) == 100 # the first query token's chain position
+
+
+def test_row_attention_matches_dense():
+ torch.manual_seed(0)
+ blocks, block_size, h, d, rows, n = 8, 16, 4, 128, 5, 100
+ stored = torch.randn(blocks, h, block_size, 2 * d, device=DEV, dtype=torch.bfloat16)
+ cache = stored.transpose(1, 2) # the backend's view: (blocks, slots, heads, 2 * head_dim)
+ q = torch.randn(rows, h, d, device=DEV, dtype=torch.bfloat16)
+ keys = torch.randint(0, blocks * block_size, (rows, n), device=DEV, dtype=torch.int32)
+ num_keys = torch.tensor([n, 1, 37, 64, 99], dtype=torch.int32, device=DEV)
+ out = row_attention(q, cache, keys, num_keys, d**-0.5)
+ flat = cache.reshape(-1, h, 2 * d)
+ for r in range(rows):
+ kv = flat[keys[r, : num_keys[r]].long()].float()
+ scores = torch.einsum("hd,khd->hk", q[r].float(), kv[..., :d]) * d**-0.5
+ want = torch.einsum("hk,khd->hd", scores.softmax(-1), kv[..., d:])
+ torch.testing.assert_close(out[r].float(), want, atol=2e-2, rtol=2e-2)
+
+
+def test_build_tree_rows_window():
+ block_size = 16
+ table = torch.arange(1, 9, dtype=torch.int32, device=DEV)[None].repeat(1, 1)
+ committed = torch.tensor([50], dtype=torch.int32, device=DEV)
+ ancestors = torch.tensor([[[900, 901], [900, 902]]], dtype=torch.int32, device=DEV) # bs=1, K=2, depth=2
+ keys = torch.zeros(2, 64, dtype=torch.int32, device=DEV)
+ num_keys = torch.zeros(2, dtype=torch.int32, device=DEV)
+ build_tree_rows(table, block_size, committed, ancestors, keys, num_keys, step=2, window=10)
+ # the query at position 51 sees positions 42..51: 8 committed keys (42..49) and its 2 ancestors (50, 51)
+ assert num_keys.tolist() == [10, 10]
+ want = [int(table[0, p // block_size]) * block_size + p % block_size for p in range(42, 50)]
+ assert keys[0, :10].tolist() == want + [900, 901]
+ assert keys[1, :10].tolist() == want + [900, 902]
+
+
[email protected]("slot_major", [False, True]) # the order of slots and heads in memory
+ "blocks_per_table_block", [1, 4]
+) # the block table's blocks are made of that many cache blocks
+def test_kv_compaction_moves_accepted_rows(slot_major, blocks_per_table_block):
+ block_size, heads, d, num_layers = 16, 4, 8, 2
+ table_block_size = block_size * blocks_per_table_block
+ num_cache_blocks = 12 * blocks_per_table_block
+ shape = (num_cache_blocks, block_size, heads, 2 * d) if slot_major else (num_cache_blocks, heads, block_size, 2 * d)
+ raw = [torch.randn(shape, device=DEV, dtype=torch.bfloat16) for _ in range(num_layers)]
+ # the backend's view of every cache: (blocks, heads, slots in a block, 2 * head_dim)
+ caches = [r.transpose(1, 2) if slot_major else r for r in raw]
+ before = [c.clone() for c in caches]
+ table = torch.tensor([[3, 1, 7, 2, 5, 9]], dtype=torch.int32, device=DEV) # shuffled blocks of the group
+ store = TreeStore(2, 7, DEV)
+ # the request lives in state slot 1 but is row 0 of the batch: the block table is the batch's, as the forward got it
+ store.path[1, :4] = torch.tensor([0, 2, 5, 6], dtype=torch.int32, device=DEV)
+ store.path_len[1] = 4
+ context, width = 20 * blocks_per_table_block + 9, 7
+ qsl = torch.tensor([0, width], dtype=torch.int32, device=DEV)
+ compactor = KvCompactor(caches, [table] * num_layers, [table_block_size] * num_layers, DEV)
+ compactor.compact(
+ torch.ones(1, dtype=torch.int32, device=DEV),
+ qsl,
+ qsl,
+ torch.tensor([context + width], dtype=torch.int32, device=DEV),
+ store.path,
+ store.path_len,
+ )
+
+ def where(token): # (cache block, slot) of a token of the request
+ block = (
+ int(table[0, token // table_block_size]) * blocks_per_table_block + token % table_block_size // block_size
+ )
+ return block, token % block_size
+
+ for layer in range(num_layers):
+ for j, row in enumerate([0, 2, 5, 6]):
+ (sb, ss), (db, ds) = where(context + row), where(context + j)
+ torch.testing.assert_close(caches[layer][db, :, ds], before[layer][sb, :, ss])
+ untouched = torch.ones(num_cache_blocks, block_size, dtype=torch.bool)
+ for j in range(1, 4):
+ untouched[where(context + j)] = False
+ torch.testing.assert_close(caches[layer].transpose(1, 2)[untouched], before[layer].transpose(1, 2)[untouched])
+
+
+def test_a_graph_capture_takes_the_tree_path_whatever_was_staged_last():
+ stage = VerifyStage(2, 16, 8, DEV)
+ stage.active = False # what the last dummy or chain batch left
+ assert not stage.verifying
+ seen = []
+ torch.zeros(1, device=DEV) # initialize the context before capturing
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph):
+ seen.append(stage.verifying)
+ assert seen == [True]
+ stage.active = True
+ assert stage.verifying
diff --git a/tests/test_image_tag.py b/tests/test_image_tag.py
new file mode 100644
index 0000000..c09fc24
--- /dev/null
+++ b/tests/test_image_tag.py
@@ -0,0 +1,56 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+"""Exercise the publication guard with registry responses, without a Docker daemon."""
+
+import os
+import subprocess
+from pathlib import Path
+
+import pytest
+
+ROOT = Path(__file__).resolve().parents[1]
+IMAGE = "ghcr.io/eagle-hq/eagle-4-sglang:0.1.0"
+
+
+ ("status", "message", "absent"),
+ [
+ (0, "Name: " + IMAGE, False),
+ (1, "ERROR: " + IMAGE + ": not found", True),
+ (1, "ERROR: unexpected status: 401 Unauthorized", False),
+ (1, "ERROR: unexpected status: 403 Forbidden", False),
+ (1, "ERROR: unexpected status: 429 Too Many Requests", False),
+ (1, "ERROR: unexpected status: 500 Internal Server Error", False),
+ (1, "ERROR: unexpected status: 503 Service Unavailable", False),
+ (1, "ERROR: failed to fetch oauth token: 404 Not Found", False),
+ (1, "ERROR: dial tcp: network is unreachable", False),
+ (1, "ERROR: context deadline exceeded", False),
+ (1, "ERROR: TLS handshake timeout", False),
+ (1, "ERROR: another/image:0.1.0: not found", False),
+ (1, "ERROR: " + IMAGE + ": not found\nERROR: authentication failed", False),
+ (1, "", False),
+ (127, "docker: command not found", False),
+ ],
+)
+def test_only_confirmed_tag_absence_allows_publication(tmp_path, status, message, absent):
+ docker = tmp_path / "docker"
+ docker.write_text(
+ '#!/bin/sh\n'
+ 'test "$1 $2 $3 $4" = "buildx imagetools inspect $EXPECTED_IMAGE" || exit 98\n'
+ 'printf "%s\\n" "$RESPONSE" >&2\n'
+ 'exit "$STATUS"\n'
+ )
+ docker.chmod(0o755)
+ result = subprocess.run(
+ ["bash", str(ROOT / "tools/check_image_tag.sh"), IMAGE],
+ env={
+ **os.environ,
+ "PATH": str(tmp_path) + os.pathsep + os.environ["PATH"],
+ "EXPECTED_IMAGE": IMAGE,
+ "RESPONSE": message,
+ "STATUS": str(status),
+ },
+ capture_output=True,
+ text=True,
+ )
+ assert (result.returncode == 0) is absent, result.stdout + result.stderr
diff --git a/tests/test_kernels.py b/tests/test_kernels.py
new file mode 100644
index 0000000..6fcf805
--- /dev/null
+++ b/tests/test_kernels.py
@@ -0,0 +1,151 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Kernel packaging and hardware dispatch (CPU): no engine imports, the native C ABI, the arch table, the nvcc check."""
+
+from __future__ import annotations
+
+import ast
+import os
+import re
+import shutil
+from pathlib import Path
+
+import pytest
+import torch
+
+from eagle_harness.kernels import arch, build, native
+
+KERNELS = Path(build.PACKAGE)
+
+
+def test_kernels_import_no_engine():
+ for path in KERNELS.glob("*.py"):
+ tree = ast.parse(path.read_text(encoding="utf-8"))
+ modules = {
+ alias.name.split(".")[0] for n in ast.walk(tree) if isinstance(n, ast.Import) for alias in n.names
+ } | {n.module.split(".")[0] for n in ast.walk(tree) if isinstance(n, ast.ImportFrom) and n.module}
+ assert not {"sglang", "vllm"} & modules, path.name
+
+
+def test_native_abi_matches_the_source():
+ source = build.SOURCE.read_text(encoding="utf-8")
+ assert re.findall(r"^int (eagle4_\w+)\(", source, re.M) == list(native.SIGNATURES)
+ assert len(re.findall(r"__global__", source)) == 2
+ for name, signature in native.SIGNATURES.items():
+ params = re.search(rf"^int {name}\((.*?)\) {{", source, re.M | re.S).group(1).split(",")
+ kinds = ["P" if "*" in p or "cudaStream_t" in p else "q" if "int64_t" in p else "i" for p in params]
+ assert "".join(kinds) == signature, name
+
+
+def test_nothing_is_built_at_import():
+ native.library.cache_clear()
+ import importlib
+
+ from eagle_harness.kernels import candidate, candidate_ops
+
+ importlib.reload(candidate)
+ importlib.reload(candidate_ops)
+ assert native.library.cache_info().currsize == 0
+
+
+def test_cuda_12_8_has_no_sm103_and_13_has_it():
+ assert 103 not in build.supported_sass((12, 8)) and 100 in build.supported_sass((12, 8))
+ assert build.supported_sass((13, 0)) == build.SASS_ARCHS
+
+
+def fake_gpu(monkeypatch):
+ """Make ``arch`` see one GPU of the given kind (nothing else in torch changes)."""
+
+ def install(vendor: str, arch_name: str, sm: int = 0):
+ monkeypatch.setattr(torch.cuda, "is_available", lambda: True)
+ monkeypatch.setattr(torch.cuda, "current_device", lambda: 0)
+ monkeypatch.setattr(arch, "_probe", lambda index: arch.Gpu(index, "fake", vendor, arch_name, sm))
+
+ return install
+
+
+ "vendor,name,sm,expected",
+ [
+ ("nvidia", "sm_80", 80, dict(tail=True, clusters=False, pdl=False, gluon=False, records=False, prelaunch=True)),
+ ("nvidia", "sm_89", 89, dict(tail=True, clusters=False, pdl=False, gluon=False, records=False, prelaunch=True)),
+ ("nvidia", "sm_90", 90, dict(tail=True, clusters=True, pdl=True, gluon=False, records=False, prelaunch=True)),
+ ("nvidia", "sm_100", 100, dict(tail=True, clusters=True, pdl=True, gluon=False, records=False, prelaunch=True)),
+ ("nvidia", "sm_103", 103, dict(tail=True, clusters=True, pdl=True, gluon=True, records=False, prelaunch=True)),
+ ("nvidia", "sm_120", 120, dict(tail=True, clusters=True, pdl=True, gluon=False, records=False, prelaunch=True)),
+ ("amd", "gfx942", 0, dict(tail=False, clusters=False, pdl=False, gluon=False, records=True, prelaunch=False)),
+ ("amd", "gfx950", 0, dict(tail=False, clusters=False, pdl=False, gluon=False, records=True, prelaunch=False)),
+ ],
+)
+def test_arch_feature_table(fake_gpu, vendor, name, sm, expected):
+ fake_gpu(vendor, name, sm)
+ assert arch.unsupported_reason() is None
+ got = dict(
+ tail=arch.native_candidate_tail(),
+ clusters=arch.clusters(),
+ pdl=arch.pdl(),
+ gluon=arch.gluon_gdn(),
+ records=arch.gdn_records_replay(),
+ prelaunch=arch.side_stream_prelaunch(),
+ )
+ assert got == expected
+
+
[email protected]("version", ["3.7.1", "3.8.0"])
+def test_gluon_gdn_is_not_gated_on_the_triton_version(fake_gpu, monkeypatch, version):
+ # gluon_dispatch's bitwise self-check is the guard; a version list silently turned the kernel off.
+ import triton
+
+ fake_gpu("nvidia", "sm_103", 103)
+ monkeypatch.setattr(triton, "__version__", version)
+ assert arch.gluon_gdn()
+
+
[email protected]("vendor,name,sm", [("nvidia", "sm_75", 75), ("nvidia", "sm_70", 70), ("amd", "gfx1100", 0)])
+def test_unsupported_hardware_is_switched_off_with_a_reason(fake_gpu, vendor, name, sm):
+ fake_gpu(vendor, name, sm)
+ reason = arch.unsupported_reason()
+ assert reason and name in reason
+ assert not (arch.native_candidate_tail() or arch.clusters() or arch.pdl() or arch.gluon_gdn())
+ assert not arch.gdn_records_replay()
+ with pytest.raises(arch.UnsupportedHardware, match=name):
+ arch.require_supported()
+
+
+def test_no_gpu_is_a_reason_not_an_error(monkeypatch):
+ monkeypatch.setattr(torch.cuda, "is_available", lambda: False)
+ assert "no CUDA or ROCm device" in arch.unsupported_reason()
+ assert arch.gpu() is None and not arch.clusters()
+
+
+def _nvcc():
+ for home in (os.environ.get("CUDA_HOME"), "/usr/local/cuda-13.0", "/usr/local/cuda"):
+ if home and os.path.exists(os.path.join(home, "bin", "nvcc")):
+ return home
+ return shutil.which("nvcc") and os.path.dirname(os.path.dirname(os.path.realpath(shutil.which("nvcc"))))
+
+
+def test_native_library_compiles_for_every_architecture():
+ home = _nvcc()
+ if home is None:
+ pytest.skip("nvcc not found")
+ if shutil.which("g++") is None and shutil.which("c++") is None:
+ pytest.skip("no host C++ compiler for nvcc")
+ try:
+ build.check(home)
+ except RuntimeError as err:
+ if "unsupported GNU version" in str(err) or "host compiler" in str(err):
+ pytest.skip(f"nvcc rejects this host compiler: {err}")
+ raise
+
+
+def test_gluon_gdn_admits_whole_gqa_groups_at_head_dim_128():
+ """Every per-rank split of a 128-wide GDN layer is admitted (TP1 to TP8 of Qwen3.8-27B), other shapes are not."""
+ pytest.importorskip("triton.experimental.gluon")
+ from eagle_harness.kernels.gdn_tree_gluon import admits_shape
+
+ assert all(admits_shape(16 // tp, 48 // tp, 128, 128) for tp in (1, 2, 4, 8))
+ assert not admits_shape(4, 12, 64, 64) and not admits_shape(4, 10, 128, 128) and not admits_shape(0, 0, 128, 128)
diff --git a/tests/test_l2_warm_gpu.py b/tests/test_l2_warm_gpu.py
new file mode 100644
index 0000000..d1f4607
--- /dev/null
+++ b/tests/test_l2_warm_gpu.py
@@ -0,0 +1,116 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""L2 warm-ahead: hooks fork the prefetches only while a small verify is captured, results unchanged.
+
+Run in a GPU job: ``pytest -q tests/test_l2_warm_gpu.py``.
+"""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+from torch import nn
+
+from eagle_harness.core.config import L2Warm
+from eagle_harness.kernels.l2_prefetch import l2_prefetch
+from eagle_harness.sglang.l2_warm import MAX_TOKENS, MlpL2WarmAhead
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a CUDA device")
+
+HIDDEN = 256
+EVERYTHING = L2Warm(down_proj=(0.5, 8), next_input=(0.5, 8))
+
+
+class Core(nn.Module):
+ """The mixer's attention / recurrence (sglang's ``attn``): the GDN one takes the batch, then keyword tensors."""
+
+ def forward(self, *args, **kwargs):
+ x = next(a for a in (*args, *kwargs.values()) if isinstance(a, torch.Tensor))
+ return 2 * x
+
+
+class Layer(nn.Module):
+ """A decoder layer in the shape the hooks look for: a mixer (input projection, core, output projection), then an
+ MLP."""
+
+ def __init__(self, mixer: str | None, in_proj: str, out_proj: str, packed: bool = False):
+ """``mixer``: the submodule holding the projections (a GDN layer), None: the layer itself (attention).
+ ``packed``: the input projection runs on its weight without calling the module (sglang's packed GDN GEMM)."""
+ super().__init__()
+ holder = self if mixer is None else nn.Module()
+ setattr(holder, in_proj, nn.Linear(HIDDEN, HIDDEN, bias=False))
+ holder.attn = Core()
+ setattr(holder, out_proj, nn.Linear(HIDDEN, HIDDEN, bias=False))
+ if mixer is not None:
+ setattr(self, mixer, holder)
+ self.mlp = nn.Module()
+ self.mlp.gate_up_proj = nn.Linear(HIDDEN, 4 * HIDDEN, bias=False)
+ self.mlp.down_proj = nn.Linear(4 * HIDDEN, HIDDEN, bias=False)
+ self.mixer, self.names, self.packed = mixer, (in_proj, out_proj), packed
+
+ def forward(self, x):
+ in_proj, out_proj = self.names
+ holder = self if self.mixer is None else getattr(self, self.mixer)
+ proj = getattr(holder, in_proj)
+ x = nn.functional.linear(x, proj.weight) if self.packed else proj(x)
+ x = holder.attn(x) if self.mixer is None else holder.attn(None, mixed_qkv=x)
+ x = getattr(holder, out_proj)(x)
+ return self.mlp.down_proj(self.mlp.gate_up_proj(x))
+
+
+def _model(device) -> nn.Module:
+ kinds = [
+ ("linear_attn", "in_proj_qkvz", "out_proj"),
+ ("linear_attn", "in_proj_qkvz", "out_proj", True),
+ (None, "qkv_proj", "o_proj"),
+ ("linear_attn", "in_proj_qkvz", "out_proj"),
+ ]
+ return nn.Sequential(*(Layer(*kind) for kind in kinds)).to(device, torch.bfloat16)
+
+
+def _replay_prefetch_kernels(model: nn.Module, x: torch.Tensor) -> tuple[int, torch.Tensor]:
+ """Capture ``model(x)``; the number of prefetch kernels in one replay and the graph's output."""
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph):
+ out = model(x)
+ with torch.profiler.profile(activities=[torch.profiler.ProfilerActivity.CUDA]) as prof:
+ graph.replay()
+ torch.cuda.synchronize()
+ return sum("_l2_prefetch_kernel" in event.name for event in prof.events()), out
+
+
+def test_prefetch_leaves_data_unchanged():
+ weight = torch.randn(1 << 20, device="cuda").to(torch.bfloat16)
+ before = weight.clone()
+ l2_prefetch(weight, 4096, weight.numel(), 16)
+ torch.cuda.synchronize()
+ assert torch.equal(weight, before)
+
+
[email protected]("plan,kernels", [(L2Warm(), 4), (EVERYTHING, 11)])
+def test_only_a_captured_small_verify_forks_the_prefetches(plan, kernels):
+ device = torch.device("cuda")
+ model = _model(device)
+ x = torch.randn(MAX_TOKENS, HIDDEN, device=device, dtype=torch.bfloat16)
+ reference = model(x)
+ warm = MlpL2WarmAhead.install(model, plan, device)
+ assert warm is not None
+ assert torch.equal(model(x), reference) # eager: the hooks do nothing
+
+ count, out = _replay_prefetch_kernels(model, x)
+ # gate_up per layer (the packed one too); with EVERYTHING also down per layer and next_input between layers
+ assert count == kernels
+ assert torch.equal(out, reference)
+
+ wide = torch.randn(MAX_TOKENS + 1, HIDDEN, device=device, dtype=torch.bfloat16)
+ count, out = _replay_prefetch_kernels(model, wide)
+ assert count == 0 # wider verifies are not warmed
+ assert torch.equal(out, model(wide))
+ warm.remove()
+
+
+def test_models_without_plain_bf16_weights_are_not_hooked():
+ device = torch.device("cuda")
+ assert MlpL2WarmAhead.install(_model(device).float(), L2Warm(), device) is None
+ assert MlpL2WarmAhead.install(SimpleNamespace(modules=list), L2Warm(), device) is None
diff --git a/tests/test_limits.py b/tests/test_limits.py
new file mode 100644
index 0000000..831e575
--- /dev/null
+++ b/tests/test_limits.py
@@ -0,0 +1,32 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Batch admission is independent of the draft shape; widths remain per-request."""
+
+import pytest
+
+from eagle_harness.core.limits import ComputeIntensity, check_shape, cost_batch_sizes, max_batch_size, verify_buckets
+from eagle_harness.vllm.config import verify_width_schedule
+
+
[email protected]("intensity", [ComputeIntensity.HIGH, ComputeIntensity.LOW])
[email protected]("batch_size", [33, 64, 128, 256, 512])
+def test_tree_admission_and_schedule_reach_the_shared_batch_limit(intensity, batch_size):
+ check_shape(intensity, node_top_k=4, tree_depth=12, verify_num=16, max_running_requests=batch_size)
+ assert max_batch_size(intensity) >= batch_size
+ assert 1 in verify_buckets(batch_size, intensity)
+ schedule = verify_width_schedule(intensity, 16)
+ assert next(k for first, last, k in schedule if first <= batch_size <= last) == 15
+
+
[email protected]("intensity", list(ComputeIntensity))
+def test_batches_above_the_supported_range_are_rejected(intensity):
+ with pytest.raises(ValueError, match="batch limit"):
+ check_shape(intensity, node_top_k=1, tree_depth=12, verify_num=16, max_running_requests=513)
+ with pytest.raises(NotImplementedError, match="batch limit"):
+ verify_buckets(513, intensity)
+
+
+def test_tree_calibration_covers_large_batches():
+ buckets = cost_batch_sizes(max_batch_size(ComputeIntensity.HIGH))
+ assert {64, 128, 256, 512}.issubset(buckets)
diff --git a/tests/test_live_costs.py b/tests/test_live_costs.py
new file mode 100644
index 0000000..33575e2
--- /dev/null
+++ b/tests/test_live_costs.py
@@ -0,0 +1,173 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Live costs: served-round timings become the cost model's tables; keys bind costs to a setup."""
+
+import json
+
+import pytest
+
+from eagle_harness.core.cost_model import CostModel, CostModelParams
+from eagle_harness.core.limits import ComputeIntensity
+from eagle_harness.core.live_costs import DRAFT_WIDTH, CostKey, LiveCosts, check_key, read_key, write_key
+
+WIDTHS = {1: [64, 32, 16, 8, 1], 4: [32, 16, 8, 4, 1]}
+KEY = CostKey("NVIDIA B300", 4, "qwen:abc", "eagle4:def", "sglang 0.5.23", "torch.bfloat16")
+
+
+def _live(**kw) -> LiveCosts:
+ return LiveCosts(widths=lambda bs: WIDTHS[bs], key=KEY, seed_samples=2, **kw)
+
+
+def _seed(live: LiveCosts, bucket: int, verify_us, draft_us=170.0, context=500) -> None:
+ for width, us in verify_us.items():
+ for sample in (us * 1.1, us): # the seed keeps the fastest sample
+ live.record(bucket, width, context, sample)
+ live.record(bucket, DRAFT_WIDTH, context, draft_us)
+
+
+def test_seed_sweep_orders_width_one_first_then_widest_and_ends_when_sampled():
+ live = _live()
+ assert live.seed_width(1) == 1 and not live.ready(1)
+ live.record(1, 1, 500, 4000.0)
+ live.record(1, 1, 500, 4000.0)
+ assert live.seed_width(1) == 64
+ _seed(live, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0})
+ assert live.seed_width(1) is None and live.ready(1)
+ assert not live.ready(4) and live.seed_width(4) == 1
+
+
+def test_tables_hold_the_served_curve_and_fill_unmeasured_intervals():
+ live = _live()
+ _seed(live, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0}, context=3000)
+ tables = live.tables()
+ table = tables[1]
+ assert table.batch_size == 1 and len(table.intervals) == live.context_intervals
+ target = table.intervals[0].target
+ assert target.index == (0, 7, 15, 31, 63)
+ assert target.value == (4000.0, 4500.0, 4800.0, 5700.0, 7200.0)
+ assert target.ratio[0] == 1.0 and target.ratio[-1] == 1.8
+ # Interval 2 (context 3000) was measured; every other interval takes the nearest measured one.
+ assert table.intervals[live.interval(3000)].target.value == table.intervals[15].target.value
+ assert table.intervals[0].draft.value == (170.0,) and table.model_ratio[0] == round(4000.0 / 170.0, 4)
+ # The cost model consumes the live table like an offline one.
+ cost = CostModel(tables=tables, params=CostModelParams(), intensity=ComputeIntensity.HIGH, node_top_k=8, tree_depth=12, verify_num=64)
+ assert cost.verify_cost(1, 3000) is not None
+ row = cost.draft_cost_row(1, 3000)
+ assert row.model_cost_ratio == table.model_ratio[0]
+
+
+def test_refinement_is_an_ema_after_the_seed():
+ live = _live(alpha=0.5)
+ live.record(1, 8, 100, 4000.0)
+ live.record(1, 8, 100, 5000.0) # still seeding: min wins
+ cell = live.cells[(1, 8, 0)]
+ assert cell.us == 4000.0 and cell.samples == 2
+ live.record(1, 8, 100, 6000.0)
+ assert cell.us == 5000.0 and cell.samples == 3
+
+
+def test_set_tables_refreshes_the_cost_model_in_place():
+ live = _live()
+ cost = CostModel(tables={}, params=CostModelParams(), intensity=ComputeIntensity.HIGH, node_top_k=8, tree_depth=12, verify_num=64)
+ assert cost.table(1) is None
+ _seed(live, 4, {1: 4300.0, 32: 6000.0, 16: 5100.0, 8: 4700.0, 4: 4500.0})
+ cost.set_tables(live.tables())
+ assert cost.table(1).batch_size == 4 and cost.table(32).batch_size == 4
+
+
+def test_cache_round_trips_and_rejects_another_setup(tmp_path):
+ live = _live()
+ _seed(live, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0})
+ path = str(tmp_path / "costs.json")
+ live.save(path)
+ again = _live()
+ assert again.load(path) and again.cells == live.cells and again.ready(1)
+ other = LiveCosts(widths=lambda bs: WIDTHS[bs], key=CostKey("NVIDIA H100", 4, "qwen:abc", "eagle4:def", "sglang 0.5.23", "torch.bfloat16"))
+ assert not other.load(path) and not other.cells
+ assert not _live().load(str(tmp_path / "missing.json"))
+
+
[email protected]("broken", [None, [], {}, {"key": {}}, {"cells": [[1, 8, 0, 0.0, 3]]},
+ {"cells": [[1, 8, 0, float("nan"), 3]]},
+ {"cells": [[1, 8, 0, 4000.0, -1]]},
+ {"cells": [[1, 8, 16, 4000.0, 3]]},
+ {"cells": [[1, 8, 0, "bad", 3]]},
+ {"cells": [[1, 8, 0, 4000.0]]}])
+def test_invalid_cache_is_a_miss_without_partially_replacing_cells(tmp_path, broken):
+ live = _live()
+ _seed(live, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0})
+ before = live.cells.copy()
+ data = live.to_dict() | broken if isinstance(broken, dict) and broken else broken
+ path = tmp_path / "costs.json"
+ path.write_text(json.dumps(data))
+ assert not live.load(str(path))
+ assert live.cells == before
+
+
+def test_cache_reseeds_when_the_draft_step_shape_changes(tmp_path):
+ live = _live(draft_shape=(4, 12))
+ _seed(live, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0})
+ path = str(tmp_path / "costs.json")
+ live.save(path)
+ assert _live(draft_shape=(4, 12)).load(path)
+ for shape in ((8, 12), (4, 6)):
+ changed = _live(draft_shape=shape)
+ assert not changed.load(path) and not changed.cells
+
+
[email protected]("us", [float("nan"), float("inf"), -1.0, 0.0])
+def test_nonfinite_or_nonpositive_timings_do_not_seed_a_bucket(us):
+ live = _live()
+ live.record(1, 8, 100, us)
+ assert live.cells == {}
+
+
+def test_offline_tables_are_refused_on_another_setup(tmp_path, caplog):
+ data_path = str(tmp_path)
+ with caplog.at_level("WARNING"):
+ check_key(data_path, KEY) # unkeyed: accepted with a warning
+ assert "carry no key.json" in caplog.text
+ write_key(data_path, KEY)
+ assert read_key(data_path) == KEY
+ check_key(data_path, KEY)
+ with pytest.raises(ValueError, match="gpu_count"):
+ check_key(data_path, CostKey("NVIDIA B300", 1, "qwen:abc", "eagle4:def", "sglang 0.5.23", "torch.bfloat16"))
+ assert json.load(open(tmp_path / "key.json"))["gpu"] == "NVIDIA B300"
+
+
+def test_offline_tables_are_validated_and_keyed_at_load(tmp_path):
+ """A table the cost model could not decide from fails at load with the directory, not in a decode round."""
+ from eagle_harness.core.config import HarnessConfig, build_cost_model
+ from eagle_harness.core.cost_table import cost_model_problem, load_cost_tables, table_problem
+
+ live = _live()
+ _seed(live, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0})
+ table = live.tables()[1]
+ assert table_problem(table) is None and cost_model_problem(table) is None
+ bad = _live()
+ _seed(bad, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 4500.0}, draft_us=2000.0) # ratio 2
+ assert table_problem(bad.tables()[1]) is None and "cost ratio" in cost_model_problem(bad.tables()[1])
+ bad = _live()
+ _seed(bad, 1, {1: 4000.0, 64: 7200.0, 32: 5700.0, 16: 4800.0, 8: 1000.0}) # width 8 cheaper than width 1
+ assert "8 tokens" in cost_model_problem(bad.tables()[1])
+ # On disk: a cost-table directory with a zero draft cost is refused at load, with the path.
+ for model, values in (("llm", [4000.0, 4500.0]), ("slm", [0.0])):
+ d = tmp_path / "cost" / "bs_1" / f"model_{model}"
+ d.mkdir(parents=True)
+ (d / "model_interval_0.json").write_text(json.dumps({
+ "value": values, "ratio": [1.0] * len(values), "index": list(range(0, 8 * len(values) - 7, 7)),
+ "array_query": [], "array_cache": [], "cache_length_start": 64, "cache_length_step": 64,
+ "max_query_length_query": 8, "max_query_length_cache": 8}))
+ with pytest.raises(RuntimeError, match="bs_1.*draft cost"):
+ load_cost_tables(str(tmp_path / "cost"))
+ (tmp_path / "cost/bs_1/model_slm/model_interval_0.json").write_text(json.dumps({
+ "value": [3000.0], "ratio": [1.0], "index": [0], "array_query": [], "array_cache": [],
+ "cache_length_start": 64, "cache_length_step": 64, "max_query_length_query": 8, "max_query_length_cache": 8}))
+ assert list(load_cost_tables(str(tmp_path / "cost"))) == [1] # a table; the depth stop can read it
+ with pytest.raises(ValueError, match="bs_1.*cost ratio"): # the cost model cannot decide from it
+ build_cost_model(HarnessConfig(data_path=str(tmp_path)), node_top_k=8, tree_depth=12, verify_num=64, target_is_moe=False)
+ write_key(str(tmp_path), KEY)
+ with pytest.raises(ValueError, match="another setup"):
+ load_cost_tables(str(tmp_path / "cost"), CostKey("H100", 4, "qwen:abc", "eagle4:def", "sglang 0.5.23", "torch.bfloat16"))
+ assert load_cost_tables(str(tmp_path / "missing"), KEY) == {}
diff --git a/tests/test_mamba2_tree_kernels.py b/tests/test_mamba2_tree_kernels.py
new file mode 100644
index 0000000..ec27a51
--- /dev/null
+++ b/tests/test_mamba2_tree_kernels.py
@@ -0,0 +1,426 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Mamba2 tree verify (kernel and vLLM extension) against dense references (CPU through the Triton interpreter, or a GPU).
+
+Every row must continue from its parent's state; on a chain the kernel must be vLLM's chain verify, and a committed
+tree round must leave vLLM's chain kernels resuming exactly as if only the accepted path had been verified.
+"""
+
+import math
+import os
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ["TRITON_INTERPRET"] = "1"
+
+from eagle_harness.kernels.mamba2_tree import mamba2_tree_state_update # noqa: E402
+from tests.test_gdn_tree_kernels import CHAIN, HALF, TREE, _requests, random_tree, tree_conv # noqa: E402
+from tests.triton_probe import needs_triton # noqa: E402
+
+pytestmark = needs_triton
+
+DEV = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+needs_gpu = pytest.mark.skipif(not torch.cuda.is_available(), reason="vLLM's own kernels need a GPU")
+
+
+def _params(heads, groups, head_dim, dstate, tokens, seed):
+ gen = torch.Generator().manual_seed(seed)
+
+ def rand(*shape, scale=1.0):
+ return (torch.randn(*shape, generator=gen) * scale).to(DEV)
+
+ return SimpleNamespace(
+ x=rand(tokens, heads, head_dim),
+ dt=rand(tokens, heads, scale=0.5),
+ A=-torch.exp(rand(heads, scale=0.5)),
+ B=rand(tokens, groups, dstate),
+ C=rand(tokens, groups, dstate),
+ D=rand(heads),
+ dt_bias=rand(heads, scale=0.5),
+ )
+
+
+def _reference(p, state, *, slots, parents, qsl, accepted):
+ """Row by row: a row whose parent is the previous row continues in fp32, any other row from the parent's stored
+ state; every row stores its state in its slot (in the state's dtype)."""
+ state, out = state.clone(), torch.empty_like(p.x)
+ heads_per_group = p.x.shape[1] // p.B.shape[1]
+ for b in range(qsl.shape[0] - 1):
+ bos, eos = int(qsl[b]), int(qsl[b + 1])
+ carried = state[slots[b, int(accepted[b]) - 1]].float()
+ for t in range(eos - bos):
+ parent = int(parents[b, t])
+ if t > 0 and parent != t - 1:
+ carried = state[slots[b, parent]].float()
+ tok = bos + t
+ dt = p.dt[tok].float() + p.dt_bias # [heads]; softplus and exp as the kernel writes them
+ dt = torch.where(dt <= 20.0, torch.log(torch.exp(dt) + 1), dt)
+ dA = torch.exp2(1.4426950408889634 * (p.A * dt))
+ Bh = p.B[tok].repeat_interleave(heads_per_group, 0) # [heads, dstate]
+ Ch = p.C[tok].repeat_interleave(heads_per_group, 0)
+ carried = carried * dA[:, None, None] + (Bh * dt[:, None])[:, None, :] * p.x[tok][:, :, None]
+ state[slots[b, t]] = carried.to(state.dtype)
+ out[tok] = (carried * Ch[:, None, :]).sum(-1) + p.x[tok] * p.D[:, None]
+ return out, state
+
+
+ "parent_lists", [[TREE, CHAIN], [CHAIN, CHAIN], [TREE[:3], TREE], [random_tree(16, 5), random_tree(16, 6)]]
+)
[email protected]("state_dtype", [torch.float32, HALF])
[email protected]("dims", [(4, 2, 8, 16), (8, 1, 64, 128)]) # heads, groups, head_dim, dstate
+def test_every_row_continues_from_its_parent(parent_lists, state_dtype, dims):
+ heads, groups, head_dim, dstate = dims
+ width = max(map(len, parent_lists))
+ parents, _, qsl = _requests(parent_lists, width)
+ tokens = int(qsl[-1])
+ p = _params(heads, groups, head_dim, dstate, tokens, seed=len(parent_lists[0]) + heads)
+ slots = torch.arange(1, 1 + 2 * width, dtype=torch.int32, device=DEV).view(2, width)
+ accepted = torch.tensor([1, 3], dtype=torch.int32, device=DEV)
+ gen = torch.Generator().manual_seed(heads * 100 + width)
+ state0 = (torch.randn(2 * width + 1, heads, head_dim, dstate, generator=gen) * 0.3).to(DEV, state_dtype)
+ want_out, want_state = _reference(p, state0, slots=slots, parents=parents, qsl=qsl, accepted=accepted)
+ state, out = state0.clone(), torch.empty_like(p.x)
+ mamba2_tree_state_update(
+ state,
+ p.x,
+ p.dt,
+ p.A,
+ p.B,
+ p.C,
+ p.D,
+ p.dt_bias,
+ out,
+ state_indices=slots,
+ parents=parents,
+ query_start_loc=qsl,
+ num_accepted_tokens=accepted,
+ )
+ # A 16-bit state's last bit can round either way where the kernel and the reference differ in the last fp32 bit
+ # (fused multiply-adds, exp2); one ulp of state, and the outputs' dstate sums of such flips.
+ state_tol, out_tol = {torch.float32: (1e-4, 1e-4), torch.float16: (2e-3, 1e-2), torch.bfloat16: (2e-2, 1e-1)}[
+ state_dtype
+ ]
+ torch.testing.assert_close(out, want_out, rtol=out_tol, atol=out_tol)
+ torch.testing.assert_close(state.float(), want_state.float(), rtol=state_tol, atol=state_tol)
+ assert torch.equal(state[0], state0[0]) # the null slot is never written
+
+
+def test_padded_requests_are_skipped():
+ """A request whose slots are the pad slot (a CUDA graph's padding) reads zeros and writes no state."""
+ heads, groups, head_dim, dstate, width = 2, 1, 8, 16, 4
+ parents, _, qsl = _requests([CHAIN[:width], CHAIN[:width]], width)
+ p = _params(heads, groups, head_dim, dstate, int(qsl[-1]), seed=9)
+ slots = torch.tensor([[1, 2, 3, 4], [0, 0, 0, 0]], dtype=torch.int32, device=DEV)
+ state0 = torch.randn(5, heads, head_dim, dstate, generator=torch.Generator().manual_seed(1)).to(DEV)
+ state, out = state0.clone(), torch.empty_like(p.x)
+ mamba2_tree_state_update(
+ state,
+ p.x,
+ p.dt,
+ p.A,
+ p.B,
+ p.C,
+ p.D,
+ p.dt_bias,
+ out,
+ state_indices=slots,
+ parents=parents,
+ query_start_loc=qsl,
+ pad_slot_id=0,
+ )
+ assert torch.equal(state[0], state0[0])
+ want_out, _ = _reference(
+ p,
+ torch.cat([torch.zeros_like(state0[:1]), state0[1:]]),
+ slots=slots,
+ parents=parents,
+ qsl=qsl,
+ accepted=torch.ones(2, dtype=torch.int32),
+ )
+ torch.testing.assert_close(out, want_out, rtol=1e-4, atol=1e-4)
+
+
+def _mamba2_rows(
+ p, xbc, conv_state, weight, bias, ssm_state, slots, accepted, qsl, out, heads, head_dim, groups, dstate
+):
+ return SimpleNamespace(
+ layer_name="layers.0",
+ hidden_states_B_C=xbc,
+ dt=p.dt,
+ conv_state=conv_state,
+ conv_weight=weight,
+ conv_bias=bias,
+ activation="silu",
+ ssm_state=ssm_state,
+ A=p.A,
+ D=p.D,
+ dt_bias=p.dt_bias,
+ num_heads=heads,
+ head_dim=head_dim,
+ n_groups=groups,
+ ssm_state_size=dstate,
+ state_indices=slots,
+ num_accepted_tokens=accepted,
+ query_start_loc=qsl,
+ out=out,
+ )
+
+
+def test_spec_rows_read_the_projection_in_place_and_write_the_layer_output():
+ """``TreeVerify.forward_mamba2_spec_rows`` on strided views of the projection == tree conv + the tree SSU on
+ contiguous inputs, bit for bit; the output lands in the layer's buffer and the publishing layer's slots are
+ copied out."""
+ from eagle_harness.vllm.gdn_tree_verify import TreeVerify
+ from eagle_harness.vllm.verify_layout import set_stage
+
+ heads, groups, head_dim, dstate = 4, 2, 8, 16
+ inner, dim = heads * head_dim, heads * head_dim + 2 * groups * dstate
+ plists = [random_tree(8, 7), TREE]
+ width = max(map(len, plists))
+ parents, ancestors, qsl = _requests(plists, width)
+ tokens = int(qsl[-1])
+ torch.manual_seed(4)
+ proj = torch.randn(tokens, inner + dim + heads, device=DEV, dtype=HALF) # [gate, xBC, dt]
+ xbc, dt = proj[:, inner : inner + dim], proj[:, inner + dim :]
+ p = _params(heads, groups, head_dim, dstate, tokens, seed=1)
+ p.dt = dt
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=HALF), torch.randn(dim, device=DEV, dtype=HALF)
+ slots = torch.arange(1, 1 + 2 * width, dtype=torch.int32, device=DEV).view(2, width)
+ accepted = torch.tensor([1, 2], dtype=torch.int32, device=DEV)
+ conv0 = torch.randn(2 * width + 1, dim, 3 + width - 1, device=DEV, dtype=HALF)
+ ssm0 = torch.randn(2 * width + 1, heads, head_dim, dstate, device=DEV) * 0.1
+ published = torch.zeros(2, width, dtype=torch.int32, device=DEV)
+
+ conv_state, ssm_state = conv0.clone(), ssm0.clone()
+ conv = tree_conv(
+ xbc.contiguous(),
+ conv_state,
+ weight,
+ bias,
+ "silu",
+ slots=slots[:, 0],
+ accepted=accepted,
+ query_start_loc=qsl,
+ ancestors=ancestors,
+ )
+ x, B, C = (t.contiguous() for t in conv.split([inner, groups * dstate, groups * dstate], dim=-1))
+ want = torch.empty(tokens, heads, head_dim, device=DEV, dtype=HALF)
+ mamba2_tree_state_update(
+ ssm_state,
+ x.view(tokens, heads, head_dim),
+ dt.contiguous(),
+ p.A,
+ B.view(tokens, groups, dstate),
+ C.view(tokens, groups, dstate),
+ p.D,
+ p.dt_bias,
+ want,
+ state_indices=slots,
+ parents=parents,
+ query_start_loc=qsl,
+ num_accepted_tokens=accepted,
+ )
+
+ set_stage(SimpleNamespace(ancestors=ancestors, parents=parents, state_slots={"layers.0": published}))
+ try:
+ got_conv, got_ssm = conv0.clone(), ssm0.clone()
+ out = torch.zeros(tokens + 2, inner, device=DEV, dtype=HALF)[:tokens] # the layer's buffer, cut to the rows
+ TreeVerify(None).forward_mamba2_spec_rows(
+ _mamba2_rows(
+ p, xbc, got_conv, weight, bias, got_ssm, slots, accepted, qsl, out, heads, head_dim, groups, dstate
+ )
+ )
+ finally:
+ set_stage(None)
+ assert torch.equal(out, want.view(tokens, inner))
+ assert torch.equal(got_ssm, ssm_state) and torch.equal(got_conv, conv_state)
+ assert torch.equal(published, slots)
+
+
+@needs_gpu
[email protected]("state_dtype", [torch.float32, torch.bfloat16])
[email protected]("accepted", [[1, 1], [2, 5], [8, 3]])
+def test_a_chain_is_what_vllm_verifies(state_dtype, accepted):
+ """On chain-shaped trees the tree SSU computes vLLM's chain ``selective_state_update`` (outputs and every row's
+ state)."""
+ from vllm.model_executor.layers.mamba.ops.mamba_ssm import selective_state_update
+
+ heads, groups, head_dim, dstate, width = 16, 2, 64, 128, 8
+ parents, _, qsl = _requests([CHAIN + [4, 5, 6], CHAIN + [4, 5, 6]], width)
+ tokens = int(qsl[-1])
+ p = _params(heads, groups, head_dim, dstate, tokens, seed=11)
+ p.x, p.B, p.C = p.x.to(HALF), p.B.to(HALF), p.C.to(HALF)
+ p.dt, p.D, p.dt_bias = p.dt.to(HALF), p.D, p.dt_bias
+ slots = torch.arange(1, 1 + 2 * width, dtype=torch.int32, device=DEV).view(2, width)
+ acc = torch.tensor(accepted, dtype=torch.int32, device=DEV)
+ state0 = (torch.randn(2 * width + 1, heads, head_dim, dstate, device=DEV) * 0.3).to(state_dtype)
+ ours_state, ours = state0.clone(), torch.empty_like(p.x)
+ mamba2_tree_state_update(
+ ours_state,
+ p.x,
+ p.dt,
+ p.A,
+ p.B,
+ p.C,
+ p.D,
+ p.dt_bias,
+ ours,
+ state_indices=slots,
+ parents=parents,
+ query_start_loc=qsl,
+ num_accepted_tokens=acc,
+ )
+ theirs_state, theirs = state0.clone(), torch.empty_like(p.x)
+ selective_state_update(
+ theirs_state,
+ p.x,
+ p.dt[:, :, None].expand(-1, -1, head_dim),
+ p.A[:, None, None].expand(-1, head_dim, dstate),
+ p.B,
+ p.C,
+ p.D[:, None].expand(-1, head_dim),
+ p.dt_bias[:, None].expand(-1, head_dim),
+ dt_softplus=True,
+ state_batch_indices=slots,
+ dst_state_batch_indices=slots,
+ out=theirs,
+ num_accepted_tokens=acc,
+ cu_seqlens=qsl,
+ )
+ torch.testing.assert_close(ours.float(), theirs.float(), rtol=1e-2, atol=1e-2)
+ torch.testing.assert_close(ours_state.float(), theirs_state.float(), rtol=1e-5, atol=1e-5)
+
+
+@needs_gpu
+ "parent_lists, paths",
+ [
+ ([TREE, TREE], [[0, 2, 5], [0]]),
+ ([random_tree(16, 8), CHAIN], [None, [0, 1, 2]]),
+ ],
+)
+def test_a_committed_tree_round_continues_like_the_accepted_chain(parent_lists, paths):
+ """Tree verify through the extension + ``LinearStateCommit``, then vLLM's own chain kernels resume exactly as
+ after verifying only the accepted path as a chain."""
+ from tests.test_gdn_tree_kernels import deepest_path
+ from vllm.model_executor.layers.mamba.mamba_utils import is_conv_state_dim_first
+ from vllm.model_executor.layers.mamba.ops.causal_conv1d import causal_conv1d_update
+ from vllm.model_executor.layers.mamba.ops.mamba_ssm import selective_state_update
+
+ from eagle_harness.vllm.gdn_tree_verify import LinearStateCommit, TreeVerify
+ from eagle_harness.vllm.verify_layout import TreeStore, set_stage
+
+ paths = [path or deepest_path(plist) for path, plist in zip(paths, parent_lists)]
+ heads, groups, head_dim, dstate = 8, 2, 64, 128
+ inner, dim = heads * head_dim, heads * head_dim + 2 * groups * dstate
+ reqs, width = len(parent_lists), max(map(len, parent_lists))
+ parents, ancestors, qsl = _requests(parent_lists, width)
+ tokens = int(qsl[-1])
+ torch.manual_seed(5)
+ bf16 = torch.bfloat16
+ p = _params(heads, groups, head_dim, dstate, tokens, seed=13)
+ p.dt = p.dt.to(bf16)
+ xbc = torch.randn(tokens, dim, device=DEV, dtype=bf16)
+ weight, bias = torch.randn(dim, 4, device=DEV, dtype=bf16) * 0.5, torch.randn(dim, device=DEV, dtype=bf16)
+ slots = torch.arange(1, 1 + reqs * width, dtype=torch.int32, device=DEV).view(reqs, width)
+ first = torch.tensor([1, 2][:reqs], dtype=torch.int32, device=DEV) # accepted before the round
+ dim_first = is_conv_state_dim_first()
+ state_len = 3 + width - 1
+ conv_raw = torch.randn(
+ (reqs * width + 1, dim, state_len) if dim_first else (reqs * width + 1, state_len, dim), device=DEV, dtype=bf16
+ )
+ window = lambda raw: raw if dim_first else raw.transpose(-1, -2) # noqa: E731
+ ssm0 = torch.randn(reqs * width + 1, heads, head_dim, dstate, device=DEV) * 0.1
+
+ # tree side
+ tree_conv_raw, tree_ssm = conv_raw.clone(), ssm0.clone()
+ published = torch.zeros(reqs, width, dtype=torch.int32, device=DEV)
+ set_stage(SimpleNamespace(ancestors=ancestors, parents=parents, state_slots={"layers.0": published}))
+ try:
+ TreeVerify(None).forward_mamba2_spec_rows(
+ _mamba2_rows(
+ p,
+ xbc,
+ window(tree_conv_raw),
+ weight,
+ bias,
+ tree_ssm,
+ slots,
+ first,
+ qsl,
+ torch.empty(tokens, inner, device=DEV, dtype=bf16),
+ heads,
+ head_dim,
+ groups,
+ dstate,
+ )
+ )
+ finally:
+ set_stage(None)
+ store = TreeStore(8, width, DEV)
+ for r, path in enumerate(paths):
+ store.path[r, : len(path)] = torch.tensor(path, dtype=torch.int32, device=DEV)
+ store.path_len[r] = len(path)
+
+ class Layer:
+ kv_cache = (tree_conv_raw, tree_ssm)
+
+ LinearStateCommit([Layer], [published], DEV).commit(
+ torch.arange(reqs, dtype=torch.int64, device=DEV), store.path, store.path_len
+ )
+
+ # reference side: vLLM verifies a chain of `width` rows per request, the accepted path first
+ def chain_step(conv_raw_side, ssm_side, xbc_rows, dt_rows, lens, accepted, p_rows):
+ y = causal_conv1d_update(
+ xbc_rows.clone(),
+ window(conv_raw_side),
+ weight,
+ bias,
+ "silu",
+ conv_state_indices=slots[:, 0].contiguous(),
+ num_accepted_tokens=accepted,
+ query_start_loc=lens,
+ max_query_len=width,
+ validate_data=False,
+ )
+ x, B, C = y.split([inner, groups * dstate, groups * dstate], dim=-1)
+ out = torch.empty(y.shape[0], heads, head_dim, device=DEV, dtype=bf16)
+ selective_state_update(
+ ssm_side,
+ x.reshape(-1, heads, head_dim),
+ dt_rows[:, :, None].expand(-1, -1, head_dim),
+ p_rows.A[:, None, None].expand(-1, head_dim, dstate),
+ B.reshape(-1, groups, dstate),
+ C.reshape(-1, groups, dstate),
+ p_rows.D[:, None].expand(-1, head_dim),
+ p_rows.dt_bias[:, None].expand(-1, head_dim),
+ dt_softplus=True,
+ state_batch_indices=slots,
+ dst_state_batch_indices=slots,
+ out=out,
+ num_accepted_tokens=accepted,
+ cu_seqlens=lens,
+ )
+ return out
+
+ ref_conv_raw, ref_ssm = conv_raw.clone(), ssm0.clone()
+ order = [path + [r for r in range(len(pl)) if r not in path] for path, pl in zip(paths, parent_lists)]
+ rows = torch.cat([qsl[r] + torch.tensor(o, device=DEV) for r, o in enumerate(order)])
+ chain_step(ref_conv_raw, ref_ssm, xbc[rows], p.dt[rows], qsl, first, p)
+
+ # the next step, a chain of 4 rows resuming after the accepted path, must agree
+ accepted = torch.tensor([len(path) for path in paths], dtype=torch.int32, device=DEV)
+ nxt = 4
+ nqsl = torch.arange(0, (reqs + 1) * nxt, nxt, dtype=torch.int32, device=DEV)
+ xbc2 = torch.randn(reqs * nxt, dim, device=DEV, dtype=bf16)
+ dt2 = torch.randn(reqs * nxt, heads, device=DEV, dtype=bf16) * 0.5
+ outs = [
+ chain_step(c, s, xbc2, dt2, nqsl, accepted, p) for c, s in ((tree_conv_raw, tree_ssm), (ref_conv_raw, ref_ssm))
+ ]
+ assert torch.equal(outs[0], outs[1])
+ assert not math.isnan(outs[0].float().sum().item())
diff --git a/tests/test_mamba2_tree_verify_gpu.py b/tests/test_mamba2_tree_verify_gpu.py
new file mode 100644
index 0000000..24b9d0d
--- /dev/null
+++ b/tests/test_mamba2_tree_verify_gpu.py
@@ -0,0 +1,180 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The Mamba2 tree verify extension against sglang's own Mamba2 verify kernels, on the shapes it serves (GPU).
+
+For a batch of draft trees (chains, stars, random trees, a padded request) at the per-rank Mamba2 shapes of Nemotron 3
+Nano (TP1, TP4) and Nemotron 3.5 Super (TP4, bf16 SSM state), one Mamba2 layer's verify runs twice on
+the same inputs: sglang's ``causal_conv1d_update`` following the tree links, and the extension (tables built in
+``begin_forward``, then ``conv_update``); then sglang's ``selective_state_update`` on each path's parent table.
+Parent table, conv windows, conv state, conv output, SSM outputs and per-step SSM snapshots must be identical.
+
+Run in a GPU job: ``pytest -q tests/test_mamba2_tree_verify_gpu.py``.
+"""
+
+import random
+import types
+import zlib
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ pytest.skip("needs a CUDA device", allow_module_level=True)
+
+conv_triton = pytest.importorskip("sglang.kernels.ops.mamba.causal_conv1d_triton")
+mamba_ssm = pytest.importorskip("sglang.kernels.ops.mamba.triton_ops.mamba_ssm")
+verify_extension = pytest.importorskip("sglang.srt.layers.attention.linear.verify_extension")
+
+from eagle_harness.sglang.mamba2_tree_verify import Mamba2TreeVerify # noqa: E402
+
+DEV = torch.device("cuda")
+PAD = -1
+# (heads, head_dim, groups, state, SSM state dtype) per rank: Nemotron 3 Nano at TP1 and TP4, and Nemotron 3.5 Super
+# at TP4 with the bf16 SSM state it is served with (--mamba-ssm-dtype bfloat16).
+SHAPES = {
+ "tp1": (64, 64, 8, 128, torch.float32),
+ "tp4": (16, 64, 2, 128, torch.float32),
+ "super-tp4": (32, 64, 2, 128, torch.bfloat16),
+}
+
+
+def _tree(kind: str, width: int, rng: random.Random) -> list[int]:
+ """Parents in node order (-1 for the root)."""
+ if kind == "chain":
+ return [-1] + list(range(width - 1))
+ if kind == "star":
+ return [-1] + [0] * (width - 1)
+ return [-1] + [rng.randrange(r) for r in range(1, width)]
+
+
+def _links(parent_lists, width):
+ """sglang's first-child / next-sibling links, [bs, width], -1 where absent."""
+ nxt = torch.full((len(parent_lists), width), -1, dtype=torch.int64)
+ sib = torch.full_like(nxt, -1)
+ for b, parents in enumerate(parent_lists):
+ last_child = {}
+ for node, p in enumerate(parents[1:], start=1):
+ if p in last_child:
+ sib[b, last_child[p]] = node
+ else:
+ nxt[b, p] = node
+ last_child[p] = node
+ return nxt.to(DEV), sib.to(DEV)
+
+
+def _verify(case, use_extension):
+ """One Mamba2 layer verify; returns every tensor the commit or the next layer reads."""
+ heads, head_dim, groups, dstate, ssm_dtype = SHAPES[case["shape"]]
+ bs, width = len(case["trees"]), case["width"]
+ dim = heads * head_dim + 2 * groups * dstate
+ g = torch.Generator(device=DEV).manual_seed(case["seed"])
+
+ def rnd(*shape, dtype=torch.bfloat16):
+ return torch.randn(*shape, generator=g, device=DEV, dtype=torch.float32).to(dtype)
+
+ x = rnd(bs * width, dim)
+ weight, bias = rnd(dim, 1, 4), rnd(dim)
+ conv_state = rnd(bs + 2, dim, 3)
+ slots = torch.arange(1, bs + 1, dtype=torch.int32, device=DEV)
+ if case["pad"]:
+ slots[-1] = PAD
+ inter_idx = torch.arange(bs, dtype=torch.int32, device=DEV)
+ windows = torch.zeros(bs, width, dim, 3, device=DEV, dtype=torch.bfloat16)
+ nxt, sib = _links(case["trees"], width)
+ parents = torch.full((bs, width), -7, dtype=torch.int64, device=DEV)
+ x_view = x.view(bs, width, dim).transpose(1, 2)
+
+ if use_extension:
+ ext = Mamba2TreeVerify.create(
+ verify_extension.LinearAttnStateLayout(
+ conv_state_len=3,
+ conv_dtype=torch.bfloat16,
+ ssm_dtype=ssm_dtype,
+ num_v_heads=heads,
+ has_state_snapshots=True,
+ device=DEV,
+ )
+ )
+ qsl = torch.arange(0, bs * width + 1, width, dtype=torch.int32, device=DEV)
+ ext.begin_forward(verify_extension.LinearAttnVerifyLayout(nxt, sib, parents, slots, qsl, width), in_graph=False)
+ mixer = types.SimpleNamespace(conv1d=types.SimpleNamespace(weight=weight, bias=bias), activation="silu")
+ conv_out = ext.conv_update(
+ mixer,
+ x_view,
+ conv_states=conv_state,
+ cache_indices=slots,
+ intermediate_conv_window=windows,
+ intermediate_state_indices=inter_idx,
+ )
+ else:
+ conv_out = conv_triton.causal_conv1d_update(
+ x_view,
+ conv_state,
+ weight.view(dim, 4),
+ bias,
+ "silu",
+ conv_state_indices=slots,
+ intermediate_conv_window=windows,
+ intermediate_state_indices=inter_idx,
+ retrieve_next_token=nxt,
+ retrieve_next_sibling=sib,
+ retrieve_parent_token=parents,
+ )
+ tokens = conv_out.transpose(1, 2).reshape(bs * width, dim)
+ xs, B, C = torch.split(tokens, [heads * head_dim, groups * dstate, groups * dstate], dim=-1)
+ ssm_state = rnd(bs + 2, heads, head_dim, dstate, dtype=ssm_dtype)
+ snapshots = torch.zeros(bs, width, heads, head_dim, dstate, device=DEV, dtype=ssm_dtype)
+ out = torch.empty(bs, width, heads, head_dim, device=DEV, dtype=torch.bfloat16)
+ A = -torch.rand(heads, generator=g, device=DEV)
+ dt = rnd(bs * width, heads)
+ dt_bias, D = rnd(heads, dtype=torch.float32), rnd(heads, dtype=torch.float32)
+ mamba_ssm.selective_state_update(
+ ssm_state,
+ xs.reshape(bs, width, heads, head_dim),
+ dt[:, :, None].expand(-1, -1, head_dim).reshape(bs, width, heads, head_dim),
+ A[:, None, None].expand(-1, head_dim, dstate),
+ B.reshape(bs, width, groups, dstate),
+ C.reshape(bs, width, groups, dstate),
+ D[:, None].expand(-1, head_dim),
+ z=None,
+ dt_bias=dt_bias[:, None].expand(-1, head_dim),
+ dt_softplus=True,
+ state_batch_indices=slots,
+ out=out,
+ disable_state_update=True,
+ intermediate_states_buffer=snapshots,
+ cache_steps=width,
+ retrieve_parent_token=parents,
+ intermediate_state_indices=inter_idx,
+ )
+ real = slice(0, bs - 1) if case["pad"] else slice(0, bs)
+ return {
+ "parents": parents[real],
+ "windows": windows[real],
+ "conv_state": conv_state,
+ "conv_out": conv_out[real],
+ "ssm_out": out[real],
+ "snapshots": snapshots[real],
+ "ssm_state": ssm_state,
+ }
+
+
+def _cases():
+ cases = []
+ for shape in SHAPES:
+ for width in (2, 5, 16):
+ for kinds, pad in ((("chain",), False), (("star", "random"), False), (("random",) * 4, True)):
+ rng = random.Random(zlib.crc32(f"{shape}-{width}-{kinds}".encode()))
+ trees = [_tree(k, width, rng) for k in kinds]
+ cases.append(
+ dict(shape=shape, width=width, trees=trees, pad=pad, seed=zlib.crc32(repr(trees).encode()))
+ )
+ return cases
+
+
[email protected]("case", _cases(), ids=lambda c: f"{c['shape']}-w{c['width']}-bs{len(c['trees'])}")
+def test_extension_matches_sglangs_mamba2_tree_verify(case):
+ want, got = _verify(case, use_extension=False), _verify(case, use_extension=True)
+ for name in want:
+ assert torch.equal(got[name], want[name]), f"{name} differs"
diff --git a/tests/test_models.py b/tests/test_models.py
new file mode 100644
index 0000000..176fe49
--- /dev/null
+++ b/tests/test_models.py
@@ -0,0 +1,87 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""EAGLE-4 draft config validation and the low-rank head (checked against golden fixtures)."""
+
+from __future__ import annotations
+
+import json
+import os
+
+import pytest
+import torch
+
+transformers = pytest.importorskip("transformers")
+
+from eagle_harness.models.eagle4_config import resolve_draft_sliding_window, validate_eagle4_draft_config # noqa: E402
+from eagle_harness.models.low_rank_head import low_rank_factors # noqa: E402
+
+GOLDEN_PATH = os.path.join(os.path.dirname(__file__), "golden", "fork_golden.json")
+
+
+def _config(**extra):
+ base = dict(
+ architectures=["LlamaForCausalLMEagle4"],
+ num_hidden_layers=1,
+ hidden_size=256,
+ num_attention_heads=4,
+ num_key_value_heads=2,
+ intermediate_size=512,
+ vocab_size=1000,
+ )
+ base.update(extra)
+ return transformers.LlamaConfig(**base)
+
+
+def test_plain_draft_config_passes():
+ validate_eagle4_draft_config(_config(target_hidden_size=512, draft_vocab_size=1000))
+
+
+ "extra, message",
+ [
+ ({"mystery_key": 1}, "keys this model does not implement"),
+ ({"bias": True}, "bias=True"),
+ ({"num_aux_hidden_states": 2}, "num_aux_hidden_states"),
+ ({"eagle_config": {"eagle_aux_hidden_state_layer_ids": [1, 2]}}, "three aux hidden states"),
+ ({"efficient_lm_head_config": {"type": "pca"}}, "efficient_lm_head_config"),
+ ({"sliding_window": 4096, "num_hidden_layers": 2}, "num_hidden_layers=1"),
+ ],
+)
+def test_bad_draft_configs_rejected(extra, message):
+ with pytest.raises(ValueError, match=message):
+ validate_eagle4_draft_config(_config(**extra))
+
+
+def test_sliding_window_resolution():
+ assert resolve_draft_sliding_window(_config()) is None
+ assert resolve_draft_sliding_window(_config(sliding_window=4096)) == 4096
+ assert resolve_draft_sliding_window(_config(sliding_window=4096, use_sliding_window=False)) is None
+ assert resolve_draft_sliding_window(_config(sliding_window=64, layer_types=["sliding_attention"])) == 64
+ assert resolve_draft_sliding_window(transformers.LlamaConfig(sliding_window=7)) is None # not EAGLE-4
+ with pytest.raises(ValueError, match="positive integer"):
+ resolve_draft_sliding_window(_config(sliding_window=0))
+ with pytest.raises(ValueError, match="requires a positive"):
+ resolve_draft_sliding_window(_config(use_sliding_window=True))
+
+
+def test_low_rank_head_matches_fork():
+ with open(GOLDEN_PATH, encoding="utf-8") as f:
+ cases = json.load(f)["low_rank_head"]
+ assert len(cases) == 3
+ for case in cases:
+ weight = torch.tensor(case["weight"])
+ freq = torch.tensor(case["freq"]) if case["freq"] is not None else None
+ factors = low_rank_factors(
+ weight,
+ case["rank"],
+ token_frequency=freq,
+ smooth_factor=10,
+ shard=tuple(case["shard"]) if case["shard"] else None,
+ )
+ # A backward-stable fp32 SVD is accurate to about rows * eps * ||W||_2. The CPU LAPACK of
+ # GitHub's runners and of the cluster differ within that bound (CI saw 1.7e-5 on scores).
+ atol = weight.shape[0] * torch.finfo(torch.float32).eps * torch.linalg.matrix_norm(weight, 2).item()
+ torch.testing.assert_close(factors.down_proj, torch.tensor(case["down_proj"]), rtol=0, atol=atol)
+ torch.testing.assert_close(factors.scores, torch.tensor(case["scores"]), rtol=0, atol=atol)
+ assert 0 < factors.energy_retention <= 1
diff --git a/tests/test_plain_decode.py b/tests/test_plain_decode.py
new file mode 100644
index 0000000..000ee93
--- /dev/null
+++ b/tests/test_plain_decode.py
@@ -0,0 +1,288 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""No-spec pricing and request-lifetime native decode contracts."""
+
+from types import SimpleNamespace
+
+import pytest
+
+from eagle_harness.core.chain_width import AcceptProfile, save_round_times, served_chain_width
+
+
+def test_real_no_spec_is_a_separate_price_from_width_one():
+ profile = AcceptProfile.from_counts(10, [8, 5, 2])
+ prices = {0: 100, 1: 150, 2: 300, 4: 400}
+ assert served_chain_width(prices, profile, 4, allow_no_spec=True) == 0
+ # Adapters without a native decode route retain their old action set.
+ assert served_chain_width(prices, profile, 4) == 1
+ assert served_chain_width({**prices, 4: 200}, profile, 4, allow_no_spec=True) == 4
+
+
+def test_no_spec_round_measurement_can_be_saved(tmp_path):
+ save_round_times(str(tmp_path), [{"batch_size": 64, "width": 0, "round_us": 100, "count": 20}])
+
+
+def test_calibration_times_off_last_and_never_resumes_stale_draft_kv(tmp_path):
+ from collections import Counter
+
+ import torch
+
+ from eagle_harness.sglang.chain_rounds import MIN_ROUNDS, ChainCalibration
+
+ calibration = ChainCalibration(str(tmp_path), [1, 2, 4], torch.device("cpu"), writer=False, native_decode=True)
+ choices = [calibration.width(8) for _ in range(100)]
+ assert set(choices) == {0, 1, 2, 4}
+ assert all(Counter(choices)[width] >= MIN_ROUNDS + 2 for width in (1, 2, 4))
+ assert set(choices[choices.index(0) :]) == {0}
+ calibration.interrupt()
+ assert calibration.width(8) == 1
+
+
+def test_native_decode_has_a_separate_graph_from_width_one():
+ pytest.importorskip("sglang")
+ from sglang.srt.model_executor.forward_batch_info import ForwardMode
+ from sglang.srt.model_executor.runner.decode_graph_variants import DecodeGraphVariant
+
+ from eagle_harness.core.limits import ComputeIntensity
+ from eagle_harness.sglang.verify_graphs import VerifyWidthGraphs
+
+ if not hasattr(DecodeGraphVariant, "forward_mode"):
+ pytest.skip("host has no per-variant forward mode")
+ graphs = VerifyWidthGraphs(ComputeIntensity.CHAIN, 8, None, plain_decode=True)
+ variants = list(graphs.capture_variants(8))
+ native = [v for v in variants if v.forward_mode is ForwardMode.DECODE]
+ assert len(native) == 1 and native[0].num_tokens_per_req == 1
+ assert any(v.num_tokens_per_req == 1 and v.forward_mode is None for v in variants)
+ batch = SimpleNamespace(forward_mode=ForwardMode.DECODE, spec_info=None)
+ assert graphs.replay_variant(batch) == native[0]
+
+
+def test_disabled_requests_never_resume_with_stale_draft_kv():
+ pytest.importorskip("sglang")
+ from eagle_harness.sglang.plain_decode import NoSpecRequests
+
+ class Request:
+ pass
+
+ a, b, fresh = Request(), Request(), Request()
+ policy = NoSpecRequests()
+ assert not policy.select([a], 8)
+ assert policy.select([a, b], 0)
+ assert policy.select([b], 8) # Shrinking the batch cannot revive stale KV.
+ assert policy.select([b, fresh], 8) # Mixed batches follow the same route.
+ assert policy.select([fresh], 8)
+ assert not policy.select([Request()], 8)
+
+
+def test_worker_off_dispatch_skips_draft_verify_and_prelaunch(monkeypatch):
+ pytest.importorskip("sglang")
+ from sglang.srt.model_executor.forward_batch_info import ForwardMode
+
+ from eagle_harness.sglang import plain_decode as plain_module
+ from eagle_harness.sglang import worker as module
+ from eagle_harness.sglang.chain_rounds import ChainRounds
+
+ class Request:
+ pass
+
+ calls = []
+ worker = module.EagleHarnessWorker.__new__(module.EagleHarnessWorker)
+ worker._chain_rounds = ChainRounds([(1, 256, 0)], None, lambda batch: 0)
+ worker._drafter = SimpleNamespace(cancel_prelaunch=lambda: calls.append("cancel"))
+ worker._verified = SimpleNamespace(record=lambda: calls.append("record"), query=lambda: True)
+ worker._target_worker = object()
+ worker.req_to_token_pool = SimpleNamespace(req_to_token=object())
+ worker._native_decode = plain_module.NativeDecode(
+ worker.target_worker, worker.req_to_token_pool.req_to_token, worker._chain_rounds, enabled=True
+ )
+ batch = SimpleNamespace(forward_mode=ForwardMode.DECODE, is_extend_in_batch=False, reqs=[Request()])
+ result = SimpleNamespace(new_seq_lens=[5], new_seq_lens_cpu=[5])
+ monkeypatch.setattr(plain_module, "plain_decode", lambda *args: calls.append("decode") or result)
+ worker._native_decode._requests.publishes_host_lengths = True
+ on_publish = lambda lengths, **host: calls.append(("publish", lengths, host)) # noqa: E731
+ assert worker.forward_batch_generation(batch, on_publish=on_publish) is result
+ assert calls == ["cancel", "decode", "record", ("publish", [5], {"new_seq_lens_cpu": [5]})]
+
+
+def test_off_publish_sends_host_lengths_only_to_a_host_that_reads_them():
+ pytest.importorskip("sglang")
+ from eagle_harness.sglang.plain_decode import NoSpecRequests
+
+ calls = []
+ policy = NoSpecRequests()
+ publish = lambda lengths, **host: calls.append((lengths, host)) # noqa: E731
+ policy.publishes_host_lengths = True
+ policy.publish(publish, SimpleNamespace(new_seq_lens=[5], new_seq_lens_cpu=[5]))
+ policy.publish(publish, SimpleNamespace(new_seq_lens=[6], new_seq_lens_cpu=None))
+ policy.publishes_host_lengths = False
+ policy.publish(publish, SimpleNamespace(new_seq_lens=[7], new_seq_lens_cpu=[7]))
+ assert calls == [([5], {"new_seq_lens_cpu": [5]}), ([6], {}), ([7], {})]
+
+
+def test_plain_decode_consumes_reserved_slot_once_and_preserves_roots():
+ pytest.importorskip("sglang")
+ import torch
+ from sglang.srt.model_executor.forward_batch_info import ForwardMode
+ from sglang.srt.speculative.spec_info import SpeculativeAlgorithm
+
+ from eagle_harness.sglang.plain_decode import plain_decode
+
+ draft = SimpleNamespace(bonus_tokens=torch.tensor([17, 19], dtype=torch.int32), hidden_states=object())
+ algorithm = object()
+ batch = SimpleNamespace(
+ spec_info=draft,
+ spec_algorithm=algorithm,
+ req_pool_indices=torch.tensor([3, 1]),
+ seq_lens=torch.tensor([5, 7]),
+ seq_lens_cpu=torch.tensor([5, 7]),
+ return_logprob=False,
+ )
+ slots = torch.arange(50).reshape(5, 10)
+ calls = []
+
+ def forward(actual, **kwargs):
+ calls.append(actual)
+ assert actual.forward_mode is ForwardMode.DECODE
+ assert actual.spec_algorithm is SpeculativeAlgorithm.NONE
+ assert actual.spec_info is None
+ assert actual.input_ids.tolist() == [17, 19]
+ assert actual.out_cache_loc.tolist() == [35, 17]
+ assert actual.seq_lens.tolist() == actual.seq_lens_cpu.tolist() == [6, 8]
+ return SimpleNamespace(next_token_ids=torch.tensor([23, 29]))
+
+ result = plain_decode(batch, SimpleNamespace(forward_batch_generation=forward), slots)
+ assert len(calls) == 1
+ assert result.new_seq_lens.tolist() == [6, 8]
+ assert result.new_seq_lens_cpu.tolist() == [6, 8] # Host-known: the relay needs no device pull.
+ assert result.accept_lens.tolist() == [1, 1]
+ assert result.accept_index.tolist() == [[0], [1]]
+ assert result.next_draft_input.bonus_tokens.tolist() == [23, 29]
+ assert result.next_draft_input.bonus_tokens is result.next_token_ids
+ assert result.next_draft_input.hidden_states is draft.hidden_states
+ assert draft.bonus_tokens.tolist() == [17, 19]
+ assert batch.spec_info is draft and batch.spec_algorithm is algorithm
+
+
+def test_plain_decode_logprobs_are_consumed_as_one_accepted_token():
+ pytest.importorskip("sglang")
+ import torch
+ from sglang.srt.managers.scheduler_components.batch_result_processor import SchedulerBatchResultProcessor
+
+ from eagle_harness.sglang.plain_decode import plain_decode
+
+ batch = SimpleNamespace(
+ spec_info=SimpleNamespace(bonus_tokens=torch.tensor([17, 19])),
+ spec_algorithm=SimpleNamespace(is_none=lambda: False),
+ req_pool_indices=torch.tensor([0, 1]),
+ seq_lens=torch.tensor([2, 3]),
+ seq_lens_cpu=None,
+ return_logprob=True,
+ )
+ logits = SimpleNamespace(
+ next_token_logprobs=torch.tensor([-0.25, -0.5]),
+ next_token_top_logprobs_val=[[-0.25, -1.0], [-0.5, -2.0]],
+ next_token_top_logprobs_idx=[[23, 7], [29, 11]],
+ next_token_token_ids_logprobs_val=[[-3.0], [-4.0]],
+ next_token_token_ids_logprobs_idx=[[13], [13]],
+ )
+ native = SimpleNamespace(next_token_ids=torch.tensor([23, 29]), logits_output=logits)
+ result = plain_decode(
+ batch,
+ SimpleNamespace(forward_batch_generation=lambda *args, **kwargs: native),
+ torch.arange(10).reshape(2, 5),
+ )
+ assert result.new_seq_lens_cpu is None # No host lengths without a host mirror to advance.
+ for i, token in enumerate(result.next_token_ids.tolist()):
+ logprob = SimpleNamespace(
+ top_logprobs_num=2,
+ token_ids_logprob=[13],
+ output_token_logprobs_val=[],
+ output_token_logprobs_idx=[],
+ output_top_logprobs_val=[],
+ output_top_logprobs_idx=[],
+ output_token_ids_logprobs_val=[],
+ output_token_ids_logprobs_idx=[],
+ )
+ SchedulerBatchResultProcessor._apply_decode_logprobs(
+ None,
+ req=SimpleNamespace(logprob=logprob),
+ i=i,
+ batch=batch,
+ next_token_id=[token],
+ next_token_logprobs=result.logits_output.next_token_logprobs.tolist(),
+ logits_output=result.logits_output,
+ )
+ assert logprob.output_token_logprobs_val == [[-0.25], [-0.5]][i]
+ assert logprob.output_token_logprobs_idx == [token]
+ assert logprob.output_top_logprobs_val == [logits.next_token_top_logprobs_val[i]]
+ assert logprob.output_top_logprobs_idx == [logits.next_token_top_logprobs_idx[i]]
+ assert logprob.output_token_ids_logprobs_val == [logits.next_token_token_ids_logprobs_val[i]]
+ assert logprob.output_token_ids_logprobs_idx == [[13]]
+
+
+def test_off_lifetime_survives_retraction_and_ignores_reused_pool_slot():
+ pytest.importorskip("sglang")
+ from eagle_harness.sglang.plain_decode import NoSpecRequests
+
+ class Request:
+ def __init__(self, slot):
+ self.req_pool_idx = slot
+
+ retracted, other = Request(3), Request(7)
+ policy = NoSpecRequests()
+ assert policy.select([retracted, other], 0)
+ assert policy.select([other], 8)
+ fresh = Request(3)
+ assert not policy.select([fresh], 8)
+ retracted.req_pool_idx = 9
+ assert policy.select([retracted], 8)
+ assert policy.select([fresh, retracted], 8)
+ assert policy.select([fresh], 8)
+
+
+def test_finished_off_requests_are_not_kept_alive():
+ import gc
+ import weakref
+
+ pytest.importorskip("sglang")
+ from eagle_harness.sglang.plain_decode import NoSpecRequests
+
+ class Request:
+ pass
+
+ request = Request()
+ reference = weakref.ref(request)
+ policy = NoSpecRequests()
+ assert policy.select([request], 0)
+ del request
+ gc.collect()
+ assert reference() is None
+ assert not policy.select([Request()], 8)
+
+
+def test_plain_decode_restores_spec_state_when_target_raises():
+ pytest.importorskip("sglang")
+ import torch
+
+ from eagle_harness.sglang.plain_decode import plain_decode
+
+ draft = SimpleNamespace(bonus_tokens=torch.tensor([17], dtype=torch.int32))
+ algorithm = object()
+ batch = SimpleNamespace(
+ spec_info=draft,
+ spec_algorithm=algorithm,
+ req_pool_indices=torch.tensor([0]),
+ seq_lens=torch.tensor([2]),
+ seq_lens_cpu=None,
+ )
+
+ def forward(actual, **kwargs):
+ assert actual.spec_info is None
+ assert actual.seq_lens_cpu is None
+ raise ValueError("target forward failed")
+
+ with pytest.raises(ValueError, match="target forward failed"):
+ plain_decode(batch, SimpleNamespace(forward_batch_generation=forward), torch.arange(4).reshape(1, 4))
+ assert batch.spec_info is draft and batch.spec_algorithm is algorithm
+ assert draft.bonus_tokens.tolist() == [17]
diff --git a/tests/test_prelaunch_gpu.py b/tests/test_prelaunch_gpu.py
new file mode 100644
index 0000000..e31112b
--- /dev/null
+++ b/tests/test_prelaunch_gpu.py
@@ -0,0 +1,169 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Scheduler compaction must not race a prelaunched draft's published roots."""
+
+import copy
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+if not torch.cuda.is_available():
+ pytest.skip("needs a CUDA device", allow_module_level=True)
+
+from sglang.srt.speculative.eagle_info import EagleDraftInput
+
+from eagle_harness.sglang.drafter import DynamicDrafter, PrelaunchResult
+
+
+def _copy_result(done):
+ result = PrelaunchResult(
+ next_token_ids=torch.zeros(1, dtype=torch.int64, device="cuda"),
+ copy_done=torch.cuda.Event(),
+ prelaunch_done=done,
+ )
+ result.copy_to_cpu(return_logprob=False, return_hidden_states=False)
+
+
[email protected](params=[None, 1, 2, 4, 8], ids=["tree", "w1", "w2", "w4", "w8"])
+def chain_width(request):
+ return request.param
+
+
[email protected](params=["default", "nondefault"])
+def caller_stream(request):
+ stream = torch.cuda.default_stream() if request.param == "default" else torch.cuda.Stream()
+ with torch.cuda.stream(stream):
+ yield stream
+ stream.synchronize()
+
+
[email protected]("consumer", ["filter", "merge_into", "merge_from"])
+def test_prelaunch_roots_are_ready_for_scheduler_compaction(consumer, caller_stream, chain_width):
+ pending = EagleDraftInput(
+ topk_p=torch.zeros(2, 2, device="cuda"),
+ topk_index=torch.zeros(2, 2, dtype=torch.int64, device="cuda"),
+ hidden_states=torch.zeros(2, 3, device="cuda"),
+ bonus_tokens=torch.zeros(2, dtype=torch.int64, device="cuda"),
+ )
+ other = EagleDraftInput(
+ topk_p=torch.zeros(1, 2, device="cuda"),
+ topk_index=torch.zeros(1, 2, dtype=torch.int64, device="cuda"),
+ hidden_states=torch.zeros(1, 3, device="cuda"),
+ bonus_tokens=torch.zeros(1, dtype=torch.int64, device="cuda"),
+ )
+ indices = torch.tensor([1], device="cuda")
+ batch = SimpleNamespace(
+ reqs=[SimpleNamespace(kv=SimpleNamespace(req_pool_idx=i)) for i in range(2)],
+ req_pool_indices=torch.arange(2, device="cuda"),
+ )
+ drafter = DynamicDrafter.__new__(DynamicDrafter)
+ drafter._prelaunch_stream = None
+ drafter._pending = None
+ drafter._chain_width = (lambda bs: chain_width) if chain_width is not None else None
+ drafter._queue_until_decision = lambda bs: 1
+ drafter._queue_chain = lambda bs, width: max(0, width - 1)
+
+ def compact():
+ result = copy.copy(pending)
+ if consumer == "filter":
+ result.filter_batch(indices, [1])
+ elif consumer == "merge_into":
+ result.merge_batch(copy.copy(other))
+ else:
+ incoming, result = result, copy.copy(other)
+ result.merge_batch(incoming)
+ return result
+
+ # Warm the indexing/concatenation and allocator before delaying the producer.
+ for _ in range(3):
+ compact()
+ torch.cuda.synchronize()
+
+ def extend():
+ torch.cuda._sleep(100_000_000)
+ pending.topk_p.fill_(1)
+ pending.topk_index.fill_(2)
+ pending.hidden_states.fill_(3)
+
+ done = drafter.prelaunch(batch, extend=extend, inputs=())
+ _copy_result(done)
+ result = compact() # The scheduler does this before calling draft() again.
+ drafter.cancel_prelaunch()
+ torch.cuda.synchronize()
+
+ for name, value in (("topk_p", 1), ("topk_index", 2), ("hidden_states", 3)):
+ actual = getattr(result, name)
+ if consumer == "merge_into":
+ actual = actual[:2]
+ elif consumer == "merge_from":
+ actual = actual[1:]
+ torch.testing.assert_close(actual, torch.full_like(actual, value), rtol=0, atol=0)
+
+
+def test_prelaunch_finishes_reading_slots_before_scheduler_reuses_them(caller_stream, chain_width):
+ slots = torch.ones(2, dtype=torch.int64, device="cuda")
+ observed = torch.zeros_like(slots)
+ batch = SimpleNamespace(
+ reqs=[SimpleNamespace(kv=SimpleNamespace(req_pool_idx=i)) for i in range(2)],
+ req_pool_indices=torch.arange(2, device="cuda"),
+ )
+ drafter = DynamicDrafter.__new__(DynamicDrafter)
+ drafter._prelaunch_stream = None
+ drafter._pending = None
+ drafter._chain_width = (lambda bs: chain_width) if chain_width is not None else None
+
+ def queue_steps(bs):
+ # A fence after extend alone is too early: draft steps still read slot mappings.
+ torch.cuda._sleep(100_000_000)
+ observed.copy_(slots)
+ return 1
+
+ drafter._queue_until_decision = queue_steps
+ drafter._queue_chain = lambda bs, width: queue_steps(bs)
+ torch.cuda.synchronize()
+ done = drafter.prelaunch(batch, extend=lambda: None, inputs=(slots,))
+ _copy_result(done)
+ slots.zero_() # A finished request's slots are reused before the next worker entry.
+ drafter.cancel_prelaunch()
+ caller_stream.synchronize()
+ torch.testing.assert_close(observed, torch.ones_like(observed), rtol=0, atol=0)
+
+
+def test_scheduler_result_copy_does_not_wait_for_prelaunch(caller_stream, chain_width):
+ from sglang.srt.managers.utils import GenerationBatchResult
+
+ batch = SimpleNamespace(
+ reqs=[SimpleNamespace(kv=SimpleNamespace(req_pool_idx=0))],
+ req_pool_indices=torch.zeros(1, dtype=torch.int64, device="cuda"),
+ )
+ result = GenerationBatchResult(
+ next_token_ids=torch.tensor([7], device="cuda"),
+ accept_lens=torch.ones(1, dtype=torch.int32, device="cuda"),
+ copy_done=torch.cuda.Event(),
+ )
+ drafter = DynamicDrafter.__new__(DynamicDrafter)
+ drafter._prelaunch_stream = None
+ drafter._pending = None
+ drafter._chain_width = (lambda bs: chain_width) if chain_width is not None else None
+ finished = torch.cuda.Event()
+
+ def queue_steps(bs):
+ torch.cuda._sleep(100_000_000)
+ finished.record()
+ return 1
+
+ drafter._queue_until_decision = queue_steps
+ drafter._queue_chain = lambda bs, width: queue_steps(bs)
+ torch.cuda.synchronize()
+ done = drafter.prelaunch(batch, extend=lambda: None, inputs=())
+ result = PrelaunchResult(**vars(result), prelaunch_done=done)
+ result.copy_to_cpu(return_logprob=False, return_hidden_states=False)
+ result.copy_done.synchronize()
+ still_running = not finished.query()
+ drafter.cancel_prelaunch()
+ caller_stream.synchronize()
+ assert still_running, "scheduler result copy serialized behind the next draft"
+ assert result.next_token_ids.tolist() == [7]
diff --git a/tests/test_rocm_dispatch.py b/tests/test_rocm_dispatch.py
new file mode 100644
index 0000000..6fdc096
--- /dev/null
+++ b/tests/test_rocm_dispatch.py
@@ -0,0 +1,77 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Replay records follow the arch predicate and the state layout; they are inert where the predicate is off."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+
[email protected]("ssm_dtype", [torch.float32, torch.bfloat16, torch.float16])
+ "replay,can_commit,steps,records",
+ [
+ (False, True, 16, False),
+ (True, False, 16, False),
+ (True, True, 128, False),
+ (True, True, 16, True),
+ ],
+)
+def test_record_dispatch_is_platform_and_state_gated(monkeypatch, replay, can_commit, steps, records, ssm_dtype):
+ # Import at execution, not collection: other CPU kernel suites configure
+ # Triton's interpreter before importing decorated kernels.
+ pytest.importorskip("sglang")
+ from eagle_harness.kernels import arch
+ from eagle_harness.sglang.gdn_tree_verify import GDNTreeVerify
+
+ monkeypatch.setattr(arch, "gdn_records_replay", lambda device=None: replay)
+ state = SimpleNamespace(
+ has_state_snapshots=True,
+ conv_state_len=3,
+ conv_dtype=torch.bfloat16,
+ ssm_dtype=ssm_dtype,
+ device=torch.device("cpu"),
+ num_v_heads=4,
+ snapshot_shape=(2, 3, steps, 4, 128, 128),
+ can_commit_state=can_commit,
+ )
+ from eagle_harness.kernels import gdn_tree_records as records_module
+
+ monkeypatch.setattr(records_module, "_wave_slots", lambda device: 8192)
+ extension = GDNTreeVerify.create(state)
+ assert extension is not None
+ assert (extension.records is not None) is records
+ assert extension._uses_path_replay(1, 16) is (ssm_dtype != torch.float32 if records else ssm_dtype == torch.float32)
+ if records:
+ # A busier GPU must not change the recurrence's rounding semantics.
+ for batch, width in ((1, 8), (8, 16), (32, 32), (64, 32)):
+ assert extension._uses_path_replay(batch, width) is (ssm_dtype != torch.float32)
+ assert extension.records.shape == (2, 3, steps, 4, 260)
+ else:
+ assert extension.commit_state(None, None, None, None, None) is False
+
+
[email protected]("dtype", [torch.bfloat16, torch.float16])
+def test_low_precision_records_require_rounded_paths(dtype):
+ from eagle_harness.kernels.gdn_tree_records import gdn_tree_records_update
+
+ with pytest.raises(ValueError, match="tree_paths.*low-precision"):
+ gdn_tree_records_update(
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ state=SimpleNamespace(dtype=dtype),
+ state_indices=None,
+ query_start_loc=None,
+ parent=None,
+ tree_paths=None,
+ records=None,
+ record_indices=None,
+ width=16,
+ )
diff --git a/tests/test_rocm_prelaunch.py b/tests/test_rocm_prelaunch.py
new file mode 100644
index 0000000..86c440b
--- /dev/null
+++ b/tests/test_rocm_prelaunch.py
@@ -0,0 +1,52 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Platform-specific draft prelaunch ordering."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+
[email protected]("side_stream", [True, False])
+def test_prelaunch_follows_the_side_stream_predicate(monkeypatch, side_stream):
+ from contextlib import nullcontext
+
+ pytest.importorskip("sglang")
+ from eagle_harness.kernels import arch
+ from eagle_harness.sglang.drafter import DynamicDrafter
+
+ class Stream:
+ def wait_stream(self, other):
+ pass
+
+ def record_event(self):
+ return self
+
+ caller, side = Stream(), Stream()
+ monkeypatch.setattr(arch, "side_stream_prelaunch", lambda device=None: side_stream)
+ monkeypatch.setattr(torch.cuda, "current_stream", lambda: caller)
+ monkeypatch.setattr(torch.cuda, "Stream", lambda: side)
+ monkeypatch.setattr(torch.cuda, "stream", lambda stream: nullcontext())
+ drafter = object.__new__(DynamicDrafter)
+ drafter._prelaunch_stream = drafter._pending = drafter._device = None
+ drafted, extended = [], []
+ drafter._chain_width = None
+ drafter.live = None
+ drafter.policy = lambda bs: "fixed"
+ drafter._queue_until_decision = lambda bs, policy, context: drafted.append(bs) or 2
+ batch = SimpleNamespace(
+ reqs=[SimpleNamespace(kv=SimpleNamespace(req_pool_idx=3))],
+ req_pool_indices=SimpleNamespace(record_stream=lambda stream: None),
+ )
+ fence = drafter.prelaunch(batch, extend=lambda: extended.append(True), inputs=())
+ assert extended == [True]
+ assert fence is (side if side_stream else caller)
+ assert drafted == ([1] if side_stream else [])
+ if not side_stream:
+ assert drafter._pending is None
+ assert drafter._prelaunch_stream is None
+ else:
+ assert drafter._pending.key == (3,)
+ assert drafter._pending.next_depth == 2
diff --git a/tests/test_row_attention_gpu.py b/tests/test_row_attention_gpu.py
new file mode 100644
index 0000000..2ff8b23
--- /dev/null
+++ b/tests/test_row_attention_gpu.py
@@ -0,0 +1,211 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft rows' attention kernels against a torch reference (skipped without CUDA).
+
+Run in a GPU job: ``pytest -q tests/test_row_attention_gpu.py``.
+"""
+
+import pytest
+import torch
+
+pytest.importorskip("sglang", reason="the sglang kernels need sglang installed")
+
+from eagle_harness.kernels.row_attention import rows_attention # noqa: E402
+from eagle_harness.sglang.row_attention import EXTEND_LAUNCH, MAX_SPLITS, STEP_LAUNCH, DraftRowAttention # noqa: E402
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a CUDA device")
+
+K, DEPTH, HEADS, HEAD_DIM, WIDTH = 4, 12, 3, 128, 16
+
+
+def _table(gen: torch.Generator) -> torch.Tensor:
+ return torch.randperm(8 * 4096, device="cuda", generator=gen).to(torch.int32).view(8, 4096)
+
+
+def _reference(q, k_buffer, v_buffer, keys, scale):
+ """One row: ``q`` ``[heads, dim]`` over the KV slots ``keys``, softmax in fp32."""
+ k = k_buffer[keys].float() # [n, heads, dim]
+ v = v_buffer[keys].float()
+ scores = torch.einsum("hd,nhd->hn", q.float(), k) * scale
+ return torch.einsum("hn,nhd->hd", scores.softmax(-1), v)
+
+
+def _run(q, k_buffer, v_buffer, req_to_token, req, seq_lens, ancestors, *, rows_per_request, step, window):
+ rows = q.shape[0]
+ bs = rows // rows_per_request
+ parts = bs * HEADS * (MAX_SPLITS + 1) * 16
+ out = torch.empty_like(q)
+ part_out = torch.empty(parts, HEAD_DIM, dtype=torch.float32, device="cuda")
+ part_lse = torch.empty(parts, dtype=torch.float32, device="cuda")
+ rows_attention(
+ q,
+ k_buffer,
+ v_buffer,
+ out,
+ part_out,
+ part_lse,
+ req_to_token,
+ seq_lens,
+ ancestors,
+ rows_per_request=rows_per_request,
+ step=step,
+ window=window,
+ scale=HEAD_DIM**-0.5,
+ launch=EXTEND_LAUNCH if step == 0 else STEP_LAUNCH,
+ table_rows=req,
+ )
+ return out
+
+
+def _inputs(gen, bs, rows_per_request, low, high):
+ req_to_token = _table(gen)
+ req = torch.tensor([5, 0, 3][:bs], dtype=torch.int64, device="cuda")
+ seq_lens = torch.randint(low, high, (bs,), device="cuda", generator=gen)
+ k_buffer = torch.randn(8 * 4096, HEADS, HEAD_DIM, device="cuda", generator=gen).bfloat16()
+ v_buffer = torch.randn(8 * 4096, HEADS, HEAD_DIM, device="cuda", generator=gen).bfloat16()
+ q = torch.randn(bs * rows_per_request, HEADS, HEAD_DIM, device="cuda", generator=gen).bfloat16()
+ return req_to_token, req, seq_lens, k_buffer, v_buffer, q
+
+
[email protected]("window", [0, 96])
[email protected]("bs,step", [(1, 1), (1, 5), (3, 7), (2, 11)])
+def test_tree_rows_allocate_the_step_slots(bs, step, window):
+ gen = torch.Generator(device="cuda").manual_seed(bs * 100 + step)
+ req_to_token = _table(gen)
+ req = torch.tensor([5, 0, 3][:bs], dtype=torch.int64, device="cuda")
+ seq_lens = torch.randint(40, 300, (bs,), device="cuda", generator=gen)
+ ancestors = torch.randint(0, 10**6, (bs, K, DEPTH), dtype=torch.int32, device="cuda", generator=gen)
+ attention = DraftRowAttention.__new__(DraftRowAttention) # no draft runner: only the build kernel
+ attention.req_to_token, attention.window = req_to_token, window
+ slots = torch.zeros(bs * K, dtype=torch.int64, device="cuda")
+ positions = torch.zeros(bs * K, dtype=torch.int64, device="cuda")
+ before = ancestors.clone()
+
+ attention.build_tree_rows(ancestors, seq_lens, req, slots, positions, bs=bs, step=step)
+
+ for b in range(bs):
+ length = int(seq_lens[b])
+ for lane in range(K):
+ row = b * K + lane
+ own = int(req_to_token[req[b], length + (step - 1) * K + lane])
+ assert int(slots[row]) == own and int(positions[row]) == length + step - 1
+ assert int(ancestors[b, lane, step - 1]) == own
+ assert torch.equal(ancestors[b, lane, : step - 1], before[b, lane, : step - 1])
+
+
[email protected]("window,low,high", [(0, 40, 300), (96, 40, 300), (2048, 2500, 3900)])
[email protected]("bs,step", [(1, 1), (1, 5), (3, 7), (2, 11)])
+def test_tree_rows_attend_window_and_ancestors(bs, step, window, low, high):
+ gen = torch.Generator(device="cuda").manual_seed(bs * 1000 + step + window)
+ req_to_token, req, seq_lens, k_buffer, v_buffer, q = _inputs(gen, bs, K, low, high)
+ ancestors = torch.randint(0, 8 * 4096, (bs, K, DEPTH), dtype=torch.int32, device="cuda", generator=gen)
+
+ out = _run(
+ q, k_buffer, v_buffer, req_to_token, req, seq_lens, ancestors, rows_per_request=K, step=step, window=window
+ )
+
+ for b in range(bs):
+ length = int(seq_lens[b])
+ start = max(length + step - 1 - window + 1, 0) if window > 0 else 0
+ for lane in range(K):
+ keys = torch.cat([req_to_token[req[b], start:length], ancestors[b, lane, :step]]).long()
+ want = _reference(q[b * K + lane], k_buffer, v_buffer, keys, HEAD_DIM**-0.5)
+ torch.testing.assert_close(out[b * K + lane].float(), want, atol=2e-2, rtol=2e-2)
+
+
[email protected]("width", [WIDTH, 8, 1])
[email protected]("bs", [1, 3])
+def test_extend_rows_take_the_block_table_after_the_committed_length(bs, width):
+ gen = torch.Generator(device="cuda").manual_seed(bs * 31 + width)
+ req_to_token = _table(gen)
+ req = torch.tensor([5, 0, 3][:bs], dtype=torch.int64, device="cuda")
+ seq_lens = torch.randint(40, 300, (bs,), device="cuda", generator=gen)
+ accept_lens = torch.randint(1, width + 1, (bs,), device="cuda", generator=gen)
+ attention = DraftRowAttention.__new__(DraftRowAttention) # no draft runner: only the build kernel
+ attention.req_to_token = req_to_token
+ slots = torch.zeros(bs * width, dtype=torch.int64, device="cuda")
+ positions = torch.zeros(bs * width, dtype=torch.int64, device="cuda")
+ last = torch.zeros(bs, dtype=torch.int64, device="cuda")
+
+ attention.build_extend_rows(seq_lens, req, accept_lens, slots, positions, last, bs=bs, width=width)
+
+ want_positions = seq_lens[:, None] + torch.arange(width, device="cuda")
+ assert torch.equal(positions, want_positions.reshape(-1))
+ assert torch.equal(slots, req_to_token[req[:, None], want_positions].long().reshape(-1))
+ assert torch.equal(last, torch.arange(bs, device="cuda") * width + accept_lens - 1)
+
+
[email protected]("window,low,high", [(0, 40, 300), (96, 40, 300), (2048, 2500, 3900)])
[email protected]("bs,width", [(1, WIDTH), (3, WIDTH), (1, 8), (2, 1)])
+def test_extend_rows_attend_their_causal_window(bs, width, window, low, high):
+ gen = torch.Generator(device="cuda").manual_seed(bs * 7 + window + width)
+ req_to_token, req, seq_lens, k_buffer, v_buffer, q = _inputs(gen, bs, width, low, high)
+
+ out = _run(q, k_buffer, v_buffer, req_to_token, req, seq_lens, None, rows_per_request=width, step=0, window=window)
+
+ for b in range(bs):
+ for j in range(width):
+ pos = int(seq_lens[b]) + j
+ start = max(pos - window + 1, 0) if window > 0 else 0
+ keys = req_to_token[req[b], start : pos + 1].long()
+ want = _reference(q[b * width + j], k_buffer, v_buffer, keys, HEAD_DIM**-0.5)
+ torch.testing.assert_close(out[b * width + j].float(), want, atol=2e-2, rtol=2e-2)
+
+
[email protected]("heads", [8, 32]) # Nemotron draft at TP4 and TP1
[email protected]("length", [4095, 4096, 4100, 8192])
[email protected]("step", [0, 7]) # extend rows and a branching draft
+def test_nemotron_window_boundary(heads, length, step):
+ window, dim = 4096, 128
+ rows = 4 if step else 16
+ gen = torch.Generator(device="cuda").manual_seed(length + heads + step)
+ slots = length + rows * max(step, 1)
+ table = torch.randperm(slots, device="cuda", generator=gen).to(torch.int32).unsqueeze(0)
+ req = torch.zeros(1, device="cuda", dtype=torch.int64)
+ seq = torch.tensor([length], device="cuda", dtype=torch.int64)
+ q = torch.randn(rows, heads, dim, device="cuda", generator=gen).bfloat16()
+ k = torch.randn(slots, heads, dim, device="cuda", generator=gen).bfloat16()
+ v = torch.randn(slots, heads, dim, device="cuda", generator=gen).bfloat16()
+ ancestors = table[:, length:].view(1, rows, step) if step else None
+ out = torch.empty_like(q)
+ parts = heads * (MAX_SPLITS + 1) * 16
+ partial = torch.empty(parts, dim, device="cuda", dtype=torch.float32)
+ lse = torch.empty(parts, device="cuda", dtype=torch.float32)
+
+ def run():
+ rows_attention(
+ q,
+ k,
+ v,
+ out,
+ partial,
+ lse,
+ table,
+ req,
+ seq,
+ ancestors,
+ rows_per_request=rows,
+ step=step,
+ window=window,
+ scale=dim**-0.5,
+ )
+ return out.clone()
+
+ got = run()
+ for row in range(rows):
+ pos = length + (step - 1 if step else row)
+ start = max(pos - window + 1, 0)
+ if step:
+ assert ancestors is not None
+ keys = torch.cat([table[0, start:length], ancestors[0, row]])
+ else:
+ keys = table[0, start : pos + 1]
+ want = _reference(q[row], k, v, keys.long(), dim**-0.5)
+ torch.testing.assert_close(got[row].float(), want, atol=2e-2, rtol=2e-2)
+
+ # Every row excludes this prefix. Poisoning it must not affect the result.
+ dropped = max(length + (step - 1 if step else 0) - window + 1, 0)
+ k[table[0, :dropped].long()] = 100
+ v[table[0, :dropped].long()] = -100
+ assert torch.equal(got, run())
diff --git a/tests/test_serving_choice.py b/tests/test_serving_choice.py
new file mode 100644
index 0000000..3fb515c
--- /dev/null
+++ b/tests/test_serving_choice.py
@@ -0,0 +1,36 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Synthetic costs exercise selection, not a hardware performance claim."""
+
+import pytest
+
+from tools.serving_choice import serving_choice
+
+
+def test_selects_tree_chain_and_true_no_spec_by_served_rate():
+ candidates = {"tree": (4.0, 8.0), "chain": (2.0, 5.0)}
+ assert serving_choice(3.0, candidates) == "tree"
+ candidates["tree"] = (4.0, 12.0)
+ assert serving_choice(3.0, candidates) == "chain"
+ assert serving_choice(2.0, candidates) is None
+
+
+def test_missing_candidates_and_ties_keep_no_spec():
+ assert serving_choice(1.0, {}) is None
+ assert serving_choice(1.0, {"zero-draft": (1.0, 2.0)}) is None
+ assert serving_choice(1.0, {"chain": (2.0, 2.0)}) is None
+
+
[email protected]("cost", [0, -1, float("nan"), float("inf")])
+def test_rejects_invalid_baseline_or_candidate_time(cost):
+ with pytest.raises(ValueError):
+ serving_choice(cost, {})
+ with pytest.raises(ValueError):
+ serving_choice(1, {"tree": (2, cost)})
+
+
[email protected]("tokens", [0, 0.5, float("nan"), float("inf")])
+def test_rejects_invalid_expected_tokens(tokens):
+ with pytest.raises(ValueError):
+ serving_choice(1, {"tree": (tokens, 1)})
diff --git a/tests/test_sglang_hooks.py b/tests/test_sglang_hooks.py
new file mode 100644
index 0000000..4dbd2e9
--- /dev/null
+++ b/tests/test_sglang_hooks.py
@@ -0,0 +1,106 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Contract of the sglang hooks the plugin uses (eagle_harness/sglang/hooks.py).
+
+Needs sglang importable. Fails when the installed sglang drops or changes a hook, or when a package override drifts
+from the signature the table pins.
+"""
+
+from __future__ import annotations
+
+import pytest
+
+pytest.importorskip("sglang.srt.speculative.spec_registry")
+
+from sglang.srt.speculative.spec_info import SpeculativeAlgorithm # noqa: E402
+from sglang.srt.speculative.spec_registry import _REGISTRY # noqa: E402
+
+from eagle_harness.sglang import hooks, plugin # noqa: E402
+from eagle_harness.sglang.algorithm import ALGORITHM_NAME # noqa: E402
+
+
+def clean_registry():
+ snapshot = _REGISTRY.copy()
+ _REGISTRY.pop(ALGORITHM_NAME, None)
+ yield
+ _REGISTRY.clear()
+ _REGISTRY.update(snapshot)
+
+
+def test_installed_sglang_has_every_hook():
+ assert hooks.hook_problems() == []
+
+
[email protected]("hook", [h for h in hooks.HOOKS if h.kind == hooks.OVERRIDE], ids=lambda h: h.path)
+def test_every_override_has_the_pinned_signature(hook):
+ owner = hooks.resolve(hook.owner)
+ name = hook.path.rpartition(".")[2]
+ assert name in vars(owner), f"{hook.owner} does not override {name}"
+ assert hooks.parameter_names(getattr(owner, name)) == hook.params
+
+
+def test_overrides_in_the_package_are_all_listed():
+ """A new override of an sglang method must be added to HOOKS (and so to the load-time check)."""
+ listed = {(h.owner, h.path.rpartition(".")[2]) for h in hooks.HOOKS if h.kind == hooks.OVERRIDE}
+ bases = {h.owner: hooks.resolve(h.path.rpartition(".")[0]) for h in hooks.HOOKS if h.kind == hooks.OVERRIDE}
+ for owner_path, base in bases.items():
+ owner = hooks.resolve(owner_path)
+ for name, value in vars(owner).items():
+ # Dunder methods (dataclass-generated __init__ / __repr__ / __eq__) are not hooks.
+ if callable(value) and not name.startswith("__") and hasattr(base, name):
+ assert (owner_path, name) in listed, f"{owner_path}.{name} overrides sglang but is not in HOOKS"
+
+
+def test_a_missing_or_changed_hook_is_reported(monkeypatch):
+ algo = "sglang.srt.speculative.spec_registry:CustomSpecAlgo"
+ monkeypatch.setattr(
+ hooks,
+ "HOOKS",
+ (
+ hooks.Hook(f"{algo}.no_such_hook", (), hooks.OVERRIDE),
+ hooks.Hook(f"{algo}.req_to_token_extra_len", ("page_size", "extra"), hooks.OVERRIDE),
+ hooks.Hook("sglang.srt.speculative.spec_info:SpeculativeAlgorithm.register", ("name", "x"), hooks.CALL),
+ hooks.Hook("sglang.srt.arg_groups.fields.spec:Spec.no_such_field", (), hooks.FIELD),
+ hooks.Hook("sglang.srt.speculative.spec_info:SpecInput.no_such_flag", (), hooks.FIELD),
+ ),
+ )
+ assert hooks.hook_problems() == [
+ f"{algo}.no_such_hook is missing",
+ f"{algo}.req_to_token_extra_len('page_size',) is not ('page_size', 'extra')",
+ "sglang.srt.speculative.spec_info:SpeculativeAlgorithm.register"
+ f"{hooks.parameter_names(SpeculativeAlgorithm.register)} lacks ('x',)",
+ "sglang.srt.arg_groups.fields.spec:Spec.no_such_field is missing",
+ "sglang.srt.speculative.spec_info:SpecInput.no_such_flag is missing",
+ ]
+
+
+def test_optional_hook_accepts_absence_but_not_signature_drift(monkeypatch):
+ algo = "sglang.srt.speculative.spec_registry:CustomSpecAlgo"
+ monkeypatch.setattr(
+ hooks,
+ "HOOKS",
+ (
+ hooks.Hook(f"{algo}.no_such_hook", (), hooks.OVERRIDE, optional=True),
+ hooks.Hook(f"{algo}.req_to_token_extra_len", ("wrong",), hooks.OVERRIDE, optional=True),
+ ),
+ )
+ assert hooks.hook_problems() == [f"{algo}.req_to_token_extra_len('page_size',) is not ('wrong',)"]
+
+
+def test_register_refuses_an_sglang_without_the_hooks(monkeypatch, clean_registry, caplog):
+ import sglang
+
+ monkeypatch.setattr(hooks, "hook_problems", lambda: ["X is missing"])
+ assert plugin.register() is False
+ assert f"sglang {sglang.__version__} lacks 1 of the hooks it needs (X is missing)" in caplog.text
+ assert "Fix: install sglang with the eagle-harness hooks" in caplog.text
+ with pytest.raises(ValueError):
+ SpeculativeAlgorithm.from_string(ALGORITHM_NAME)
+
+
+def test_register_on_a_matching_sglang(clean_registry):
+ assert plugin.register() is True
+ assert plugin.register() is True # idempotent
+ assert SpeculativeAlgorithm.from_string(ALGORITHM_NAME).is_eagle()
diff --git a/tests/test_sglang_logprobs.py b/tests/test_sglang_logprobs.py
new file mode 100644
index 0000000..e75c794
--- /dev/null
+++ b/tests/test_sglang_logprobs.py
@@ -0,0 +1,223 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Logprobs of an EAGLE_HARNESS tree round on sglang.
+
+The worker's verify (``EagleHarnessWorker._verify``) runs sglang's ``run_eagle_verify`` on the harness's tree, and
+the scheduler turns its result into each request's logprobs. Accepted token k of a request must carry the logprobs
+of the verify row at depth k of its ACCEPTED PATH. A tree's accepted path is not a prefix of its rows: here request 0
+accepts rows 0, 2, 5, 7 and request 1 rows 0, 1, 4, so row k would give request 0 the logprobs of nodes 1, 2, 3.
+The target forward, the KV moves and the state commit are stubbed; the tree walk is a stand-in for sglang's CUDA
+kernel (``verify_tree_greedy``) with the same contract.
+"""
+
+from __future__ import annotations
+
+import contextlib
+from types import SimpleNamespace
+from unittest import mock
+
+import pytest
+import torch
+
+pytest.importorskip("sglang.srt.speculative.eagle_worker_common")
+
+from sglang.srt.layers.logits_processor import LogitsProcessorOutput # noqa: E402
+from sglang.srt.managers.scheduler_components.batch_result_processor import ( # noqa: E402
+ SchedulerBatchResultProcessor,
+)
+from sglang.srt.model_executor.forward_batch_info import ForwardMode # noqa: E402
+from sglang.srt.runtime_context import get_context, get_parallel # noqa: E402
+from sglang.srt.speculative import eagle_utils, eagle_worker_common # noqa: E402
+
+from eagle_harness.sglang.worker import EagleHarnessWorker # noqa: E402
+
+W, VOCAB, TOP = 8, 64, 5
+PARENTS = [-1, 0, 0, 1, 1, 2, 3, 5] # one tree shape for both requests
+PATHS = [[0, 2, 5, 7], [0, 1, 4]] # the second child at depth 1: neither path is a prefix of the rows
+TOKEN_IDS = [None, [3, 40]] # request 1 also asks for the logprobs of two given tokens
+
+
+def _tables(bs):
+ """sglang's retrieve tables of ``bs`` trees (first child, next sibling; global row ids)."""
+ index = torch.arange(bs * W).view(bs, W)
+ first = torch.full((bs, W), -1, dtype=torch.int64)
+ sibling = torch.full((bs, W), -1, dtype=torch.int64)
+ for node in range(W - 1, 0, -1):
+ parent = PARENTS[node]
+ sibling[:, node] = first[:, parent]
+ first[:, parent] = node
+ return index, first, sibling
+
+
+def _round(paths):
+ """Draft tokens and target logits whose greedy walk accepts ``paths``."""
+ generator = torch.Generator().manual_seed(0)
+ bs = len(paths)
+ draft = torch.stack([10 + b * W + torch.arange(W) for b in range(bs)]) # unique per request, never a bonus
+ logits = torch.randn(bs * W, VOCAB, generator=generator)
+ for b, path in enumerate(paths):
+ for here, child in zip(path, path[1:]):
+ logits[b * W + here, draft[b, child]] += 8.0
+ logits[b * W + path[-1], 1 + b] += 8.0 # the bonus token: no child drafted it
+ return draft, logits
+
+
+def _walk(
+ predicts,
+ accept_index,
+ accept_token_num,
+ candidates,
+ retrieve_index,
+ retrieve_next_token,
+ retrieve_next_sibling,
+ target_predict,
+ topk=-1,
+):
+ """``verify_tree_greedy``: follow the child that drafted the target's token, down to the bonus token."""
+ for b in range(candidates.shape[0]):
+ node, depth = 0, 0
+ accept_index[b, 0] = retrieve_index[b, 0]
+ while True:
+ child = int(retrieve_next_token[b, node])
+ while child != -1 and int(candidates[b, child]) != int(target_predict[b, node]):
+ child = int(retrieve_next_sibling[b, child])
+ predicts[retrieve_index[b, node]] = target_predict[b, node]
+ if child == -1:
+ break
+ depth += 1
+ accept_index[b, depth] = retrieve_index[b, child]
+ node = child
+ accept_token_num[b] = depth
+ return predicts, accept_index, accept_token_num
+
+
+def _fill_bonus(accept_tokens, accept_lens, bonus_tokens, accept_stride, batch_size):
+ for b in range(batch_size):
+ bonus_tokens[b] = accept_tokens.reshape(-1)[b * accept_stride + int(accept_lens[b]) - 1]
+
+
+def _verify(paths, token_ids, logits, draft):
+ """``EagleHarnessWorker._verify`` of a logprob batch on CPU; returns the batch and the result."""
+ bs = len(paths)
+ index, first, sibling = _tables(bs)
+ verify_input = SimpleNamespace(
+ draft_token=draft.reshape(-1),
+ draft_token_num=W,
+ max_tree_depth=max(map(len, paths)), # spec_steps + 1
+ tree_topk=4,
+ retrieve_index=index,
+ retrieve_next_token=first,
+ retrieve_next_sibling=sibling,
+ )
+ sampling = SimpleNamespace(
+ is_all_greedy=True,
+ acc_additive_penalties=None,
+ acc_scaling_penalties=None,
+ logit_bias=None,
+ has_watermark_candidates=False,
+ )
+ batch = SimpleNamespace(
+ spec_info=verify_input,
+ seq_lens=torch.tensor([10, 20][:bs]),
+ req_pool_indices=torch.arange(bs),
+ input_ids=None,
+ out_cache_loc=torch.arange(bs * W),
+ forward_mode=ForwardMode.DECODE,
+ sampling_info=sampling,
+ has_grammar=False,
+ return_logprob=True,
+ top_logprobs_nums=[TOP] * bs,
+ token_ids_logprobs=token_ids,
+ hisparse_coordinator=None,
+ mamba_track_indices=None,
+ device="cpu",
+ )
+ forward = SimpleNamespace(
+ logits_output=LogitsProcessorOutput(next_token_logits=logits.clone(), hidden_states=None),
+ routed_experts_output=None,
+ indexer_topk_output=None,
+ )
+ runner = SimpleNamespace(watermark_state=None, attn_backend=SimpleNamespace(verify_mask=None))
+ worker = SimpleNamespace(
+ topk=4,
+ device="cpu",
+ plan_stream=None,
+ plan_stream_ctx=contextlib.nullcontext(),
+ req_to_token_pool=SimpleNamespace(req_to_token=None),
+ token_to_kv_pool_allocator=SimpleNamespace(get_kvcache=lambda: SimpleNamespace()),
+ target_worker=SimpleNamespace(model_runner=runner, forward_batch_generation=lambda **kw: forward),
+ _draft_worker=SimpleNamespace(
+ steps=SimpleNamespace(seq_lens=batch.seq_lens, req_pool_indices=batch.req_pool_indices), extend=None
+ ),
+ _tail_graphs=None,
+ )
+ with contextlib.ExitStack() as stack:
+ stack.enter_context(get_context().override_server_args(speculative_num_draft_tokens=W))
+ # ROCm's greedy verifier checks the TP group even for this single-rank CPU round.
+ stack.enter_context(get_parallel().override(tp_group=SimpleNamespace(world_size=1)))
+ for module, name, value in (
+ (eagle_worker_common, "eagle_prepare_for_verify", lambda *a, **k: (SimpleNamespace(), False)),
+ (eagle_worker_common, "commit_mamba_states_after_verify", lambda *a, **k: None),
+ (eagle_worker_common, "move_accept_tokens_to_target_kvcache", lambda *a, **k: None),
+ (eagle_worker_common, "fill_bonus_tokens_func", _fill_bonus),
+ (eagle_utils, "verify_tree_greedy_func", _walk),
+ ):
+ stack.enter_context(mock.patch.object(module, name, value))
+ result, staged = EagleHarnessWorker._verify(worker, batch, W, None)
+ assert not staged # a logprob batch runs sglang's accept code, not the fused accept step
+ return batch, result
+
+
+def _request_logprobs(token_ids, batch, result):
+ """The scheduler's per-request logprobs of the round (its decode-output path)."""
+ stride = result.speculative_num_draft_tokens
+ ids, lens = result.next_token_ids.tolist(), result.accept_lens.tolist()
+ tokens = [ids[i * stride : i * stride + n] for i, n in enumerate(lens)]
+ scheduler = SimpleNamespace(_resolve_spec_v2_tokens=lambda result, batch: tokens)
+ batch.spec_algorithm = SimpleNamespace(is_none=lambda: False)
+ output = result.logits_output
+ tokens, token_logprobs = SchedulerBatchResultProcessor._normalize_decode_outputs(
+ scheduler, batch=batch, result=result, logits_output=output, next_token_ids=result.next_token_ids
+ )
+ reqs = []
+ for i, ask in enumerate(token_ids):
+ lists = ("token_logprobs", "top_logprobs", "token_ids_logprobs")
+ state = {f"output_{name}_{part}": [] for name in lists for part in ("val", "idx")}
+ req = SimpleNamespace(logprob=SimpleNamespace(top_logprobs_num=TOP, token_ids_logprob=ask, **state))
+ SchedulerBatchResultProcessor._apply_decode_logprobs(
+ scheduler,
+ req=req,
+ i=i,
+ batch=batch,
+ next_token_id=tokens[i],
+ next_token_logprobs=token_logprobs,
+ logits_output=output,
+ )
+ reqs.append(req.logprob)
+ return reqs
+
+
[email protected]("hip", [False, True], ids=["non-hip", "hip"])
[email protected]("requests", [[0, 1], [0], [1]], ids=["bs2", "bs1-deep", "bs1-sibling"])
+def test_logprobs_come_from_the_accepted_path_rows_in_path_order(requests, hip, monkeypatch):
+ """Batch size 1 also checks the round leaves the fused accept step, which has no logprobs."""
+ monkeypatch.setattr(eagle_utils, "_is_hip", hip)
+ paths, token_ids = [PATHS[r] for r in requests], [TOKEN_IDS[r] for r in requests]
+ draft, logits = _round(paths)
+ batch, result = _verify(paths, token_ids, logits, draft)
+ reqs = _request_logprobs(token_ids, batch, result)
+ log_probs = torch.log_softmax(logits, dim=-1)
+ for b, (path, ask, lp) in enumerate(zip(paths, token_ids, reqs)):
+ rows = [b * W + node for node in path]
+ tokens = log_probs[rows].argmax(-1)
+ assert lp.output_token_logprobs_idx == tokens.tolist()
+ torch.testing.assert_close(torch.tensor(lp.output_token_logprobs_val), log_probs[rows, tokens])
+ top = log_probs[rows].topk(TOP, dim=-1)
+ assert [list(x) for x in lp.output_top_logprobs_idx] == top.indices.tolist()
+ assert [row[0] for row in lp.output_top_logprobs_idx] == tokens.tolist() # top-1 is the emitted token
+ torch.testing.assert_close(torch.tensor(lp.output_top_logprobs_val), top.values)
+ if ask is None:
+ assert lp.output_token_ids_logprobs_val == []
+ else:
+ torch.testing.assert_close(torch.tensor(lp.output_token_ids_logprobs_val), log_probs[rows][:, ask])
diff --git a/tests/test_sglang_overlap.py b/tests/test_sglang_overlap.py
new file mode 100644
index 0000000..3076bf1
--- /dev/null
+++ b/tests/test_sglang_overlap.py
@@ -0,0 +1,95 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Scheduler handoff and graph-output ownership on CPU."""
+
+from contextlib import nullcontext
+from types import SimpleNamespace
+from unittest.mock import Mock
+
+import pytest
+import torch
+
+pytest.importorskip("sglang.srt.speculative.eagle_worker_v2")
+from eagle_harness.sglang import worker as module # noqa: E402
+from eagle_harness.sglang.chain_rounds import ChainRounds # noqa: E402
+
+
[email protected]("overlap", [False, True])
+def test_decode_handoff_uses_the_scheduler_stream_contract(monkeypatch, overlap):
+ calls = []
+ batch = SimpleNamespace(
+ forward_mode=SimpleNamespace(is_extend=lambda: False, is_idle=lambda: False),
+ is_extend_in_batch=False,
+ seq_lens=torch.tensor([10]),
+ spec_info=None,
+ )
+ result = SimpleNamespace(
+ new_seq_lens=torch.tensor([12]),
+ next_token_ids=torch.tensor([1, 2]),
+ accept_lens=torch.tensor([2]),
+ logits_output=SimpleNamespace(hidden_states=torch.zeros(2, 4)),
+ )
+ drafter = SimpleNamespace(
+ draft=lambda b: calls.append("draft"),
+ last_width=4,
+ timer=None,
+ prelaunch=Mock(side_effect=lambda b, **kwargs: (calls.append("prelaunch"), "fence")[1]),
+ )
+ worker = SimpleNamespace(
+ _drafter=drafter,
+ _draft_worker=SimpleNamespace(extend_after_verify=lambda *args: calls.append("extend")),
+ _draft_context=nullcontext,
+ _verify=lambda *args: (result, True),
+ _verified=SimpleNamespace(record=lambda: calls.append("verified")),
+ _chain_rounds=ChainRounds(None, None, lambda batch: 10),
+ _native_decode=SimpleNamespace(select=lambda batch: False),
+ )
+ monkeypatch.setattr(module, "spec_stage_span", lambda name: nullcontext())
+ monkeypatch.setattr(module, "spin_wait", lambda event: calls.append("wait"))
+ monkeypatch.setattr(module.torch.cuda, "current_stream", lambda: "forward")
+ publish = (lambda lens: calls.append("publish")) if overlap else None
+ out = module.EagleHarnessWorker.forward_batch_generation(worker, batch, publish)
+ # The round's result, wrapped with the prelaunch fence the scheduler's copies wait on.
+ assert isinstance(out, module.PrelaunchResult) and out.prelaunch_done == "fence"
+ assert out.next_token_ids is result.next_token_ids and out.accept_lens is result.accept_lens
+ assert drafter.prelaunch.call_args.kwargs["stream"] == ("forward" if overlap else None)
+ assert calls == (
+ ["draft", "verified", "publish", "prelaunch"] if overlap else ["draft", "verified", "prelaunch", "wait"]
+ )
+
+
[email protected]("overlap", [False, True])
+def test_overlap_readback_owns_fused_tail_outputs(monkeypatch, overlap):
+ tokens, lengths, hidden = torch.tensor([11, 12]), torch.tensor([2]), torch.ones(2, 4)
+ result = SimpleNamespace(
+ next_token_ids=tokens,
+ accept_lens=lengths,
+ logits_output=SimpleNamespace(hidden_states=hidden),
+ )
+ batch = SimpleNamespace(spec_info=None, enable_overlap=overlap, return_hidden_states=True)
+ worker = SimpleNamespace(
+ topk=4,
+ token_to_kv_pool_allocator=SimpleNamespace(get_kvcache=lambda: None),
+ _draft_worker=SimpleNamespace(
+ steps=SimpleNamespace(seq_lens=torch.tensor([10]), req_pool_indices=torch.tensor([0])),
+ extend=None,
+ ),
+ req_to_token_pool=None,
+ _tail_graphs=None,
+ target_worker=None,
+ plan_stream=None,
+ plan_stream_ctx=None,
+ device="cpu",
+ )
+ monkeypatch.setattr(module, "fused_accept_supported", lambda *args: True)
+ monkeypatch.setattr(module, "fused_accept_step", lambda **kwargs: Mock())
+ monkeypatch.setattr(module, "run_eagle_verify", lambda *args, **kwargs: result)
+ output, staged = module.EagleHarnessWorker._verify(worker, batch, 4, None)
+ assert staged
+ tokens.zero_()
+ lengths.zero_()
+ hidden.zero_()
+ assert output.next_token_ids.tolist() == ([11, 12] if overlap else [0, 0])
+ assert output.accept_lens.tolist() == ([2] if overlap else [0])
+ assert output.logits_output.hidden_states.sum().item() == (8 if overlap else 0)
diff --git a/tests/test_sglang_plugin.py b/tests/test_sglang_plugin.py
new file mode 100644
index 0000000..455c34f
--- /dev/null
+++ b/tests/test_sglang_plugin.py
@@ -0,0 +1,477 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The sglang plugin on branch eagle-hooks: discovery, registration, hooks H2/H5/H7/H10/H11.
+
+Needs sglang importable (the eagle-hooks tree on PYTHONPATH) and, for the
+entry-point test, the package installed (``pip install -e .``).
+"""
+
+from __future__ import annotations
+
+import ast
+import json
+import os
+from importlib.metadata import PackageNotFoundError, distribution, entry_points
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+pytest.importorskip("sglang.srt.speculative.spec_registry")
+
+from sglang.srt.arg_groups.overrides import resolution_result # noqa: E402
+from sglang.srt.arg_groups.speculative_hook import handle_speculative_decoding # noqa: E402
+from sglang.srt.mem_cache.allocation_sizing import get_req_to_token_extra_context_len # noqa: E402
+from sglang.srt.model_executor.forward_batch_info import ForwardMode # noqa: E402
+from sglang.srt.model_executor.runner.decode_graph_variants import DecodeGraphRunnerInfo # noqa: E402
+from sglang.srt.runtime_context import get_context # noqa: E402
+from sglang.srt.server_args import ServerArgs # noqa: E402
+from sglang.srt.speculative.base_spec_worker import BaseSpecWorker # noqa: E402
+from sglang.srt.speculative.spec_info import SpeculativeAlgorithm # noqa: E402
+from sglang.srt.speculative.spec_registry import _REGISTRY # noqa: E402
+
+import eagle_harness # noqa: E402
+from eagle_harness.core.config import parse_harness_config # noqa: E402
+from eagle_harness.sglang import plugin # noqa: E402
+from eagle_harness.sglang.algorithm import ALGORITHM_NAME, EagleHarnessSpecAlgo # noqa: E402
+from eagle_harness.sglang.l2_warm import MlpL2WarmAhead # noqa: E402
+from eagle_harness.sglang.verify_graphs import VerifyWidthGraphs, round_up_width, verify_widths # noqa: E402
+from eagle_harness.sglang.worker import EagleHarnessWorker # noqa: E402
+
+CONFIG = json.dumps({"data_path": "/nonexistent/cost-data"})
+STATIC_CONFIG = json.dumps({"mode": "static"})
+
+
+def registered():
+ snapshot = _REGISTRY.copy()
+ _REGISTRY.pop(ALGORITHM_NAME, None)
+ plugin.register()
+ yield SpeculativeAlgorithm.from_string(ALGORITHM_NAME)
+ _REGISTRY.clear()
+ _REGISTRY.update(snapshot)
+
+
+def _server_args(**overrides) -> ServerArgs:
+ args = ServerArgs(model_path="dummy")
+ fields = dict(
+ speculative_algorithm=ALGORITHM_NAME,
+ speculative_algorithm_config=CONFIG,
+ speculative_num_steps=12,
+ speculative_eagle_topk=4,
+ speculative_num_draft_tokens=16,
+ )
+ fields.update(overrides)
+ for name, value in fields.items():
+ setattr(args, name, value)
+ return args
+
+
+# ------------------------------------------------------------------ discovery
+def test_entry_point_is_installed():
+ try:
+ dist = distribution("eagle-harness")
+ except PackageNotFoundError:
+ pytest.skip("eagle-harness is not installed (pip install -e .)")
+ eps = [ep for ep in entry_points(group="sglang.srt.plugins") if ep.name == "eagle_harness"]
+ assert len(eps) == 1 and eps[0].value == "eagle_harness.sglang.plugin:register"
+ assert dist.version == eagle_harness.__version__
+
+
+def test_load_plugins_registers_the_algorithm():
+ try:
+ distribution("eagle-harness")
+ except PackageNotFoundError:
+ pytest.skip("eagle-harness is not installed (pip install -e .)")
+ import sglang.srt.plugins as plugins
+
+ snapshot = _REGISTRY.copy()
+ _REGISTRY.pop(ALGORITHM_NAME, None)
+ plugins._plugins_loaded = False
+ try:
+ plugins.load_plugins()
+ algo = SpeculativeAlgorithm.from_string("eagle_harness")
+ assert isinstance(algo, EagleHarnessSpecAlgo)
+ assert algo.name == ALGORITHM_NAME and algo.supports_overlap is True
+ finally:
+ _REGISTRY.clear()
+ _REGISTRY.update(snapshot)
+
+
+def test_register_is_idempotent(registered):
+ plugin.register()
+ assert SpeculativeAlgorithm.from_string(ALGORITHM_NAME) is registered
+
+
+def _worker_args(config: str = CONFIG, overlap_off: bool = True) -> SimpleNamespace:
+ return SimpleNamespace(disable_overlap_schedule=overlap_off, speculative_algorithm_config=config)
+
+
[email protected]("overlap_off", [False, True])
+def test_worker_class_supports_both_schedulers(registered, overlap_off):
+ assert registered.create_worker(_worker_args(overlap_off=overlap_off)) is EagleHarnessWorker
+ assert issubclass(EagleHarnessWorker, BaseSpecWorker)
+
+
+def test_static_mode_serves_with_the_harness_worker(registered):
+ """A fixed shape runs the harness round (its graphs, kernels and prelaunch), not sglang's generic worker."""
+ assert registered.create_worker(_worker_args(STATIC_CONFIG)) is EagleHarnessWorker
+
+
[email protected]("batch_size", [64, 128, 256, 512])
+def test_explicit_tree_batch_limit_and_graph_variants(registered, batch_size):
+ args = _server_args(max_running_requests=batch_size)
+ handle_speculative_decoding(args)
+ assert args.max_running_requests == batch_size
+ assert verify_widths(batch_size, parse_harness_config(CONFIG).intensity, 16) == [16, 8, 4, 1]
+
+
+def test_algorithm_joins_the_eagle_family(registered):
+ assert registered.is_eagle() and registered.uses_aux_hidden_states()
+ # Native EAGLE3 initialization preserves the learned head and d2t token map.
+ assert registered.is_eagle3()
+ assert registered.need_topk() and registered.carries_draft_hidden_states()
+
+
+def test_plugin_registers_the_draft_model(registered):
+ from sglang.srt.models.registry import ModelRegistry
+
+ from eagle_harness.sglang.models.llama_eagle4 import LlamaForCausalLMEagle4
+
+ model_cls, arch = ModelRegistry.resolve_model_cls(["LlamaForCausalLMEagle4"])
+ assert model_cls is LlamaForCausalLMEagle4 and arch == plugin.DRAFT_ARCHITECTURE
+ plugin.register() # a second registration in the same process is a no-op
+
+
+# ------------------------------------------------------- H11 + server args
[email protected]("overlap_off", [False, True])
+def test_server_args_accept_eagle_harness_and_config(registered, overlap_off):
+ args = _server_args(disable_overlap_schedule=overlap_off)
+ handle_speculative_decoding(args)
+ assert resolution_result(args, "speculative_algorithm") == ALGORITHM_NAME
+ assert resolution_result(args, "disable_overlap_schedule") is overlap_off
+ assert resolution_result(args, "scheduler_recv_interval") == 4
+ assert resolution_result(args, "max_running_requests") == 32
+ assert resolution_result(args, "enable_mixed_chunk") is False
+
+
+ "overrides, error, message",
+ [
+ ({"speculative_algorithm_config": None}, ValueError, "needs --speculative-algorithm-config"),
+ ({"speculative_algorithm_config": '{"data_path": "/x", "bogus": 1}'}, ValueError, "unknown keys"),
+ ({"speculative_eagle_topk": 9}, NotImplementedError, "topk"),
+ ({"speculative_num_draft_tokens": 65}, NotImplementedError, "verify_num"),
+ ({"max_running_requests": 513}, ValueError, "batch limit 512"),
+ ({"speculative_num_steps": None, "speculative_eagle_topk": None}, ValueError, "num-steps"),
+ ({"speculative_token_map": "/x/map.pt"}, NotImplementedError, "token-map"),
+ ],
+)
+def test_server_args_rejections(registered, overrides, error, message):
+ with pytest.raises(error, match=message):
+ handle_speculative_decoding(_server_args(**overrides))
+
+
+ "vendor,backend,aiter_env,warns",
+ [
+ ("amd", "aiter", "1", False),
+ ("amd", "aiter", None, True),
+ ("amd", "triton", None, False),
+ ("nvidia", "aiter", None, False),
+ ],
+)
+def test_rocm_environment_is_logged_and_checked(registered, monkeypatch, caplog, vendor, backend, aiter_env, warns):
+ from eagle_harness.kernels import arch
+
+ monkeypatch.setattr(arch, "gpu", lambda device=None: arch.Gpu(0, "fake", vendor, "gfx950", 0))
+ monkeypatch.setattr(arch, "require_supported", lambda device=None: None)
+ for name in ("SGLANG_USE_AITER", "SGLANG_SPLITKV_VERIFY_FLYDSL", "SGLANG_SPLITKV_VERIFY_FLYDSL_COMBINE"):
+ monkeypatch.delenv(name, raising=False)
+ if aiter_env is not None:
+ monkeypatch.setenv("SGLANG_USE_AITER", aiter_env)
+ monkeypatch.setenv("SGLANG_SPLITKV_VERIFY_FLYDSL", "0")
+ with caplog.at_level("INFO", logger="eagle_harness.sglang.algorithm"):
+ handle_speculative_decoding(_server_args(attention_backend=backend))
+ logged = caplog.text
+ if vendor == "nvidia":
+ assert "SGLANG_USE_AITER" not in logged
+ else:
+ assert "SGLANG_USE_AITER=" + (aiter_env or "0") in logged and "SGLANG_SPLITKV_VERIFY_FLYDSL=0" in logged
+ assert ("without SGLANG_USE_AITER=1" in logged) is warns
+
+
+def test_config_still_rejected_for_builtins(registered):
+ with pytest.raises(ValueError, match="algorithm-config"):
+ handle_speculative_decoding(_server_args(speculative_algorithm="EAGLE"))
+
+
+# ------------------------------------------------------------ H2 admission
+def test_request_admission(registered):
+ def req(logprob):
+ return SimpleNamespace(return_logprob=logprob)
+
+ assert registered.supports_mm_inputs() is False
+ assert registered.validate_request(req(False), has_mm_inputs=False, enable_overlap=False) is None
+ assert "multimodal" in registered.validate_request(req(False), has_mm_inputs=True, enable_overlap=False)
+ # Logprob requests are served: sglang's verify returns the accepted path's logprobs (test_sglang_logprobs.py).
+ assert registered.validate_request(req(True), has_mm_inputs=False, enable_overlap=False) is None
+
+
+# ------------------------------------------------- H7 verify-width graphs
+def _runner_info(is_draft: bool) -> DecodeGraphRunnerInfo:
+ return DecodeGraphRunnerInfo(is_draft, ForwardMode.TARGET_VERIFY, 16, torch.device("cpu"))
+
+
+def test_verify_graph_variants_only_on_the_target_in_cost_model_modes(registered, monkeypatch):
+ hooked = []
+ monkeypatch.setattr(MlpL2WarmAhead, "install", classmethod(lambda cls, model, plan, device: hooked.append(model)))
+ monkeypatch.setattr(registered, "target_verify_graphs", None)
+ # Every mode gets the per-width verify graphs: static mode runs the harness round at a fixed shape too.
+ registered.__dict__["config"] = parse_harness_config(STATIC_CONFIG)
+ with get_context().override_server_args(speculative_num_draft_tokens=16):
+ assert registered.create_decode_graph_variants(_runner_info(True)) is None
+ assert registered.target_verify_graphs is None
+ provider = registered.create_decode_graph_variants(_runner_info(False))
+ assert isinstance(provider, VerifyWidthGraphs)
+ # The algorithm keeps the provider for the drafter, and installs nothing on the model (the worker does).
+ assert registered.target_verify_graphs is provider
+ assert hooked == []
+
+
+ "hf_config, expected_moe",
+ [
+ (SimpleNamespace(architectures=["MoEForCausalLM"]), False),
+ (SimpleNamespace(text_config=SimpleNamespace(n_routed_experts=8)), True),
+ ],
+)
+def test_worker_hooks_the_l2_warm_ahead_before_the_graphs(monkeypatch, hf_config, expected_moe):
+ """The cost-model worker hooks the warm-ahead onto the target model when it is built: sglang builds every
+ worker before it captures any CUDA graph, so the target's verify graphs record the prefetch."""
+ from sglang.srt.speculative.eagle_worker_v2 import EAGLEWorkerV2
+
+ from eagle_harness.sglang import worker as worker_mod
+
+ hooked = []
+ cost_inputs = []
+ built = []
+
+ def build_cost_model(*args, **kwargs):
+ cost_inputs.append(kwargs["target_is_moe"])
+ built.append(kwargs)
+ return SimpleNamespace(tables={"bs1": None})
+
+ monkeypatch.setattr(MlpL2WarmAhead, "install", classmethod(lambda cls, model, plan, device: hooked.append(model)))
+ monkeypatch.setattr(worker_mod, "build_cost_model", build_cost_model)
+ monkeypatch.setattr(worker_mod, "cost_key", lambda runner: "key")
+ monkeypatch.setattr(EAGLEWorkerV2, "__init__", lambda self, *a, **k: None)
+ monkeypatch.setattr(torch.cuda, "Event", lambda *a, **k: None) # CPU-only torch has no events
+ target = SimpleNamespace(
+ model_runner=SimpleNamespace(model="target", device="cpu", model_config=SimpleNamespace(hf_config=hf_config))
+ )
+ with get_context().override_server_args(
+ speculative_algorithm_config=CONFIG,
+ speculative_eagle_topk=4,
+ speculative_num_steps=12,
+ speculative_num_draft_tokens=16,
+ ):
+ EagleHarnessWorker(None, 0, 0, target)
+ assert hooked == ["target"]
+ assert cost_inputs == [expected_moe]
+ assert built[0]["key"] == "key" and built[0]["tables"] is None
+
+
+def test_live_chain_does_not_read_offline_round_files(registered):
+ from eagle_harness.core.config import HarnessConfig
+ from eagle_harness.core.limits import ComputeIntensity
+
+ config = HarnessConfig(intensity=ComputeIntensity.CHAIN)
+ worker = SimpleNamespace(config=config)
+ spec = SimpleNamespace(speculative_eagle_topk=1, speculative_num_draft_tokens=8)
+ registered.__dict__["config"] = config
+ with get_context().override_server_args(
+ speculative_num_draft_tokens=8, speculative_eagle_topk=1, max_running_requests=512
+ ):
+ assert EagleHarnessWorker._fixed_chain_widths(worker, spec) is None
+ provider = registered.create_decode_graph_variants(_runner_info(False))
+ assert isinstance(provider, VerifyWidthGraphs)
+
+
+def test_verify_widths_follow_the_cost_buckets():
+ from eagle_harness.core.limits import ComputeIntensity
+
+ assert verify_widths(1, ComputeIntensity.HIGH, 16) == [16, 8, 1]
+ assert verify_widths(1, ComputeIntensity.HIGH, 12) == [12, 8, 1]
+ assert round_up_width(2, [16, 8, 1]) == 8 and round_up_width(1, [16, 8, 1]) == 1
+ with pytest.raises(ValueError):
+ round_up_width(17, [16, 8, 1])
+
+
+def test_verify_graph_provider_pins_the_width():
+ from eagle_harness.core.limits import ComputeIntensity
+
+ from sglang.srt.speculative.eagle_info import EagleVerifyInput
+
+ tail_mask = object()
+ provider = VerifyWidthGraphs(ComputeIntensity.HIGH, 16, tail_mask)
+ variants = provider.capture_variants(1)
+ # The greedy graphs of the tree widths come last.
+ assert [(v.label, v.num_tokens_per_req) for v in variants] == [
+ ("w16", 16),
+ ("w8", 8),
+ ("w1", 1),
+ ("a16", 16),
+ ("a8", 8),
+ ]
+ assert [v.label for v in provider.capture_variants(2)] == ["w16", "w8", "w1"]
+ backend = object()
+ for variant, greedy in ((variants[1], False), (variants[4], True)):
+ idle = EagleVerifyInput.create_idle_input(topk=4, spec_steps=3, num_verify_tokens=16, device="cpu")
+ batch = SimpleNamespace(spec_info=idle)
+ assert provider.begin_capture(variant, batch, backend, None) is backend
+ spec = batch.spec_info # the harness's input, captured at the variant's width
+ assert (spec.draft_token_num, spec.num_tokens_per_req, spec.num_tokens_for_logprob_per_req) == (8, 8, 8)
+ assert spec.greedy_tokens_only is greedy and spec.tail_mask is tail_mask
+ assert provider.replay_variant(batch) is variant
+ spec.draft_token_num = 4 # no graph: eager
+ assert provider.replay_variant(batch) is None
+
+
+# ------------------------------------------------------ H10 GDN tree verify
+def test_gdn_tree_verify_follows_the_state_layout(registered):
+ from sglang.srt.layers.attention.linear.verify_extension import LinearAttnStateLayout
+
+ from eagle_harness.sglang.gdn_tree_verify import GDNTreeVerify
+
+ registered.__dict__["config"] = parse_harness_config(CONFIG)
+ state = dict(
+ conv_state_len=3,
+ conv_dtype=torch.bfloat16,
+ ssm_dtype=torch.float32,
+ num_v_heads=12,
+ has_state_snapshots=True,
+ device=torch.device("cpu"),
+ )
+ ext = registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**state))
+ assert isinstance(ext, GDNTreeVerify) and ext.fp32_state and ext.num_v_heads == 12
+ for change in ({"has_state_snapshots": False}, {"conv_state_len": 2}, {"conv_dtype": torch.float32}):
+ assert registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**{**state, **change})) is None
+
+
+def test_mamba2_tree_verify_follows_the_state_layout(registered):
+ from sglang.srt.layers.attention.linear.verify_extension import LinearAttnStateLayout
+
+ from eagle_harness.sglang.gdn_tree_verify import GDNTreeVerify
+ from eagle_harness.sglang.mamba2_tree_verify import Mamba2TreeVerify
+
+ if "kind" not in LinearAttnStateLayout.__dataclass_fields__:
+ pytest.skip("this sglang asks GDN backends only")
+ registered.__dict__["config"] = parse_harness_config(CONFIG)
+ state = dict(
+ conv_state_len=3,
+ conv_dtype=torch.bfloat16,
+ ssm_dtype=torch.float32,
+ num_v_heads=16,
+ has_state_snapshots=True,
+ device=torch.device("cpu"),
+ kind="mamba2",
+ head_dim=64,
+ ssm_state_size=128,
+ n_groups=2,
+ )
+ assert isinstance(registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**state)), Mamba2TreeVerify)
+ gdn = registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**{**state, "kind": "gdn"}))
+ assert isinstance(gdn, GDNTreeVerify)
+ for change in ({"has_state_snapshots": False}, {"conv_state_len": 2}, {"conv_dtype": torch.float32}):
+ assert registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**{**state, **change})) is None
+ registered.__dict__["config"] = parse_harness_config(STATIC_CONFIG) # static mode verifies with it too
+ assert isinstance(registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**state)), Mamba2TreeVerify)
+ state = {**state, "kind": "gdn"}
+ assert isinstance(registered.create_linear_attn_verify_extension(LinearAttnStateLayout(**state)), GDNTreeVerify)
+
+
+# ------------------------------------------------------------ H5 headroom
+def test_block_table_headroom(registered):
+ with get_context().override_server_args(
+ speculative_algorithm=ALGORITHM_NAME,
+ speculative_num_steps=12,
+ speculative_eagle_topk=4,
+ speculative_num_draft_tokens=16,
+ page_size=1,
+ ):
+ # draft span 4 * 12 = 48 > default 4 + 16
+ assert get_req_to_token_extra_context_len() == 48
+ with get_context().override_server_args(
+ speculative_algorithm=ALGORITHM_NAME,
+ speculative_num_steps=3,
+ speculative_eagle_topk=1,
+ speculative_num_draft_tokens=4,
+ page_size=1,
+ ):
+ assert get_req_to_token_extra_context_len() == 4 + 4 # the default wins
+
+
+# ------------------------------------------------------------- real hooks
+def test_no_monkeypatching_in_the_package():
+ """The package may register through sglang's APIs only: no HookRegistry, no
+ attribute writes onto sglang modules or classes."""
+ root = os.path.dirname(eagle_harness.__file__)
+ offenders = []
+ for dirpath, _, names in os.walk(root):
+ for name in names:
+ if not name.endswith(".py"):
+ continue
+ path = os.path.join(dirpath, name)
+ src = open(path, encoding="utf-8").read()
+ if "HookRegistry" in src or "hook_registry" in src or "monkey" in src.lower():
+ offenders.append(path)
+ for node in ast.walk(ast.parse(src)):
+ if isinstance(node, ast.Call) and getattr(node.func, "id", None) == "setattr":
+ offenders.append(f"{path}:{node.lineno}")
+ assert offenders == []
+
+
+# ------------------------------------------------------------- plain decoding
+def test_trivial_verify_input_hands_the_greedy_kernel_int64_tokens():
+ """Width 1 (plain decoding) verifies the root alone; sglang's greedy verify kernel takes int64 candidates, and
+ sglang's builder passes the int32 bonus tokens (the kernel rejected them and the scheduler died at batch size 8)."""
+ backend = SimpleNamespace(verify_mask=None, max_context_len=64)
+ worker = SimpleNamespace(
+ topk=1, device="cpu", _target_worker=SimpleNamespace(model_runner=SimpleNamespace(attn_backend=backend))
+ )
+ batch = SimpleNamespace(
+ forward_mode=ForwardMode.DECODE,
+ spec_info=SimpleNamespace(bonus_tokens=torch.tensor([5, 7, 9], dtype=torch.int32)),
+ seq_lens=torch.tensor([10, 11, 12]),
+ seq_lens_sum=33,
+ seq_lens_cpu=None,
+ )
+ verify_input = EagleHarnessWorker._build_trivial_verify_input(worker, batch)
+ assert verify_input.draft_token.dtype == torch.int64
+ assert verify_input.draft_token.tolist() == [5, 7, 9]
+ assert verify_input.retrieve_index.dtype == torch.int64 and verify_input.draft_token_num == 1
+
+
+def test_draft_attention_splits_keep_the_reference_waves(monkeypatch):
+ """The swept B300 TP4 launches (64 / 24 splits for 10 heads on 148 SMs) are reproduced exactly; fewer heads per
+ rank (TP8) or SMs get more splits, more heads (TP1) fewer, never above 128; CPU keeps the reference."""
+ import torch
+
+ from eagle_harness.sglang import row_attention as ra
+
+ class Props:
+ def __init__(self, sms):
+ self.multi_processor_count = sms
+
+ sms = {"b300": 148, "h100": 132}
+ monkeypatch.setattr(torch.cuda, "get_device_properties", lambda device: Props(sms[device.type if device.type != "cuda" else "b300"]))
+ cuda = torch.device("cuda")
+ step, extend = ra.draft_launches(10, cuda)
+ assert (step.splits, extend.splits) == (ra.STEP_LAUNCH.splits, ra.EXTEND_LAUNCH.splits) == (64, 24)
+ assert (step.block_n, extend.block_n) == (64, 128)
+ assert [ra.draft_launches(h, cuda)[0].splits for h in (40, 20, 5)] == [16, 32, 128] # TP1, TP2, TP8
+ assert [ra.draft_launches(h, cuda)[1].splits for h in (40, 20, 5)] == [8, 16, 48]
+ assert ra.draft_launches(1, cuda)[0].splits == ra.draft_launches(1, cuda)[1].splits == 128 # the cap
+ assert ra.draft_launches(10, torch.device("cpu")) == (ra.STEP_LAUNCH, ra.EXTEND_LAUNCH)
diff --git a/tests/test_target_models.py b/tests/test_target_models.py
new file mode 100644
index 0000000..2fd6a86
--- /dev/null
+++ b/tests/test_target_models.py
@@ -0,0 +1,36 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Target model properties used by the cost policy, without an engine."""
+
+from types import SimpleNamespace
+
+import pytest
+
+from eagle_harness.core.models import target_is_moe
+
+
[email protected]("field", ["num_experts", "num_local_experts", "n_routed_experts"])
[email protected]("count, expected", [(None, False), (0, False), (1, True), (8, True)])
[email protected]("wrapped", [False, True])
+def test_moe_comes_from_expert_counts(field, count, expected, wrapped):
+ config = SimpleNamespace(**{field: count})
+ if wrapped:
+ config = SimpleNamespace(text_config=config)
+ assert target_is_moe(config) is expected
+
+
+def test_dense_model_is_not_moe_because_of_its_name():
+ assert not target_is_moe(SimpleNamespace(architectures=["MoEForCausalLM"], is_moe=True))
+
+
+def test_all_expert_fields_are_considered():
+ assert target_is_moe(SimpleNamespace(num_experts=0, num_local_experts=None, n_routed_experts=8))
+
+
+def test_text_config_is_authoritative():
+ assert not target_is_moe(SimpleNamespace(num_experts=8, text_config=SimpleNamespace(num_experts=0)))
+
+
+def test_absent_text_config_uses_outer_fields():
+ assert target_is_moe(SimpleNamespace(text_config=None, num_experts=8))
diff --git a/tests/test_third_party_headers.py b/tests/test_third_party_headers.py
new file mode 100644
index 0000000..78f5d4b
--- /dev/null
+++ b/tests/test_third_party_headers.py
@@ -0,0 +1,143 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Manifest checks must reject deletion of known third-party headers."""
+
+import hashlib
+import json
+from pathlib import Path
+import runpy
+import subprocess
+import sys
+
+import pytest
+
+CHECKER = Path(__file__).resolve().parents[1] / "tools" / "check_headers.py"
+AMD = "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n"
+MODIFIED = "# Modified by Eagle AI Corp.\n"
+
+
+def run(tmp_path, text, *, notice=AMD, modified=True, path="derived.py", args=()):
+ subprocess.run(["git", "init", "-q", str(tmp_path)], check=True)
+ source = tmp_path / path
+ if text is not None:
+ source.write_text(text)
+ manifest = tmp_path / "third-party.json"
+ manifest.write_text(json.dumps({"files": [{"path": path, "notice": notice, "modified": modified}]}))
+ result = subprocess.run(
+ [sys.executable, str(CHECKER), "--manifest", str(manifest), "--third-party-only", *args],
+ cwd=tmp_path,
+ capture_output=True,
+ text=True,
+ )
+ return result, source
+
+
+def test_missing_amd_header_is_not_relicensed(tmp_path):
+ result, source = run(tmp_path, "answer = 42\n", args=("--fix",))
+ assert result.returncode == 1
+ assert "derived.py: missing original notice" in result.stdout
+ assert source.read_text() == "answer = 42\n"
+ result, _ = run(tmp_path, AMD + MODIFIED + "\nanswer = 42\n")
+ assert result.returncode == 0, result.stdout + result.stderr
+
+
+ "text,reason",
+ [
+ (AMD + "x = 1\n", "missing modification notice"),
+ (AMD.replace("Apache-2.0", "MIT") + MODIFIED, "missing original notice"),
+ (AMD + MODIFIED + "# SPDX-License-Identifier: MIT\n", "changed SPDX license"),
+ (AMD + MODIFIED + "# Copyright 2026 Eagle AI Corp.\n", "conflicting Eagle ownership"),
+ ("x = 1\n" + AMD + MODIFIED, "missing original notice"),
+ (None, "missing source"),
+ ],
+)
+def test_manifest_rejects_invalid_source(tmp_path, text, reason):
+ result, _ = run(tmp_path, text)
+ assert result.returncode == 1
+ assert reason in result.stdout
+
+
+def test_unchanged_upstream_does_not_require_modification_notice(tmp_path):
+ result, _ = run(tmp_path, AMD + "x = 1\n", modified=False)
+ assert result.returncode == 0, result.stdout
+
+
+def test_mit_notice_is_preserved_in_full(tmp_path):
+ notice = "# Copyright (c) 2026 LightSeek Foundation\n# Permission is hereby granted, free of charge\n"
+ result, _ = run(tmp_path, notice + MODIFIED, notice=notice)
+ assert result.returncode == 0, result.stdout
+ result, _ = run(tmp_path, notice.splitlines()[0] + "\n" + MODIFIED, notice=notice)
+ assert result.returncode == 1
+ assert "missing original notice" in result.stdout
+
+
+def test_c_preprocessor_does_not_hide_a_missing_preamble(tmp_path):
+ notice = AMD.replace("#", "//")
+ text = "#include <stdint.h>\n" + notice + MODIFIED.replace("#", "//")
+ result, _ = run(tmp_path, text, notice=notice, path="derived.cu")
+ assert result.returncode == 1
+ assert "missing original notice" in result.stdout
+
+
[email protected]("prefix", ["#!/usr/bin/env python3\n# coding: utf-8\n", "\ufeff", ""])
+def test_valid_preambles_are_read_only(tmp_path, prefix):
+ text = prefix + AMD + MODIFIED + "x = 1\n"
+ result, source = run(tmp_path, text)
+ assert result.returncode == 0, result.stdout
+ assert source.read_text() == text
+
+
+def test_symlink_is_rejected(tmp_path):
+ target = tmp_path / "target.py"
+ target.write_text(AMD + MODIFIED)
+ (tmp_path / "derived.py").symlink_to(target)
+ result, _ = run(tmp_path, None)
+ assert result.returncode == 1
+ assert "unsafe symlink" in result.stdout
+
+
+def test_exact_first_party_predecessor_is_not_relabelled(tmp_path):
+ original = b"answer = 42\n"
+ source = tmp_path / "derived.py"
+ source.write_bytes(original)
+ manifest = tmp_path / "manifest.json"
+ manifest.write_text(
+ json.dumps(
+ {
+ "files": [
+ {
+ "path": "derived.py",
+ "notice": AMD,
+ "modified": True,
+ "first_party_sha256": [hashlib.sha256(original).hexdigest()],
+ }
+ ]
+ }
+ )
+ )
+ check = runpy.run_path(str(CHECKER))["check_third_party"]
+ assert check(tmp_path, manifest) == (set(), 0)
+ source.write_bytes(original + b"adapted = True\n")
+ names, errors = check(tmp_path, manifest)
+ assert names == {"derived.py"}
+ assert errors > 0
+
+
+def test_missing_manifest_is_not_success(tmp_path):
+ result = subprocess.run(
+ [
+ sys.executable,
+ str(CHECKER),
+ "--root",
+ str(tmp_path),
+ "--manifest",
+ str(tmp_path / "absent.json"),
+ "--third-party-only",
+ ],
+ capture_output=True,
+ text=True,
+ )
+ assert result.returncode == 1
+ assert "missing provenance manifest" in result.stdout
diff --git a/tests/test_tokenspeed_adapter.py b/tests/test_tokenspeed_adapter.py
new file mode 100644
index 0000000..6bd181e
--- /dev/null
+++ b/tests/test_tokenspeed_adapter.py
@@ -0,0 +1,235 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The TokenSpeed adapter on CPU, without TokenSpeed: config, hook check, lane masks, and the verify window.
+
+The window TokenSpeed verifies must be the tree the sglang and vLLM adapters verify for the same draft outputs: the
+same nodes, tokens and parents (``test_window_verifies_what_sglang_and_vllm_verify``). The lane masks must give each
+draft row exactly its own and its ancestors' window slots.
+"""
+
+import dataclasses
+import sys
+import types
+
+import pytest
+import torch
+
+from eagle_harness.core.config import Mode
+from eagle_harness.core.draft_tree import DraftTree, TreeShape
+from eagle_harness.tokenspeed import hooks
+from eagle_harness.tokenspeed.config import parse_algorithm_config
+from eagle_harness.tokenspeed.tree_lanes import (
+ advance_lane_masks,
+ lane_bits,
+ parent_lanes,
+ seed_lane_masks,
+ verify_window,
+)
+
+K, STEPS, H, BS, WIDTH = 4, 5, 8, 3, 16
+
+
+# ------------------------------------------------------------------ config
+def test_no_config_is_a_static_tree():
+ assert parse_algorithm_config(None).mode is Mode.STATIC
+
+
+def test_static_config_parses_harness_keys():
+ config = parse_algorithm_config({"mode": "static", "draft_model": {"cuda_candidate_kernels": False}})
+ assert config.mode is Mode.STATIC and config.draft_model.cuda_candidate_kernels is False
+
+
+def test_serve_uses_device_policy_with_calibration():
+ config = parse_algorithm_config({"mode": "serve", "data_path": "/calibration"})
+ assert config.mode is Mode.SERVE and config.cost_dir == "/calibration/cost"
+
+
[email protected]("mode", ["eval", "calibrate"])
+def test_unsupported_cost_model_modes_are_refused(mode):
+ with pytest.raises(NotImplementedError, match="static and serve"):
+ parse_algorithm_config({"mode": mode, "data_path": "/nonexistent"})
+
+
+ "overrides",
+ [
+ {"intensity": "chain_intensity"},
+ {"draft_family": "eagle3"},
+ {"cost_model": {"threshold": 3.0}},
+ ],
+)
+def test_device_policy_preserves_chain_family_and_custom_cost_config(overrides):
+ config = parse_algorithm_config({"mode": "serve", "data_path": "/calibration", **overrides})
+ if "cost_model" in overrides:
+ assert config.cost_model.threshold == 3.0
+ else:
+ key, value = next(iter(overrides.items()))
+ assert getattr(config, key).value == value
+
+
+def test_chain_width_schedule_is_immutable_and_preserved():
+ table = [[1, 16], [64, 4]]
+ config = parse_algorithm_config({
+ "mode": "serve", "data_path": "/calibration", "intensity": "chain_intensity",
+ "chain_width_table": table,
+ })
+ table[0][1] = 2
+ assert config.chain_width_table == ((1, 16), (64, 4))
+
+
[email protected]("table", [None, "1:4", [[1, 1]], [[True, 4]], [[8, 4], [1, 8]], [[1, 4, 8]]])
+def test_invalid_chain_width_schedule_is_rejected(table):
+ with pytest.raises(ValueError, match="chain_width_table"):
+ parse_algorithm_config({
+ "mode": "serve", "data_path": "/calibration", "intensity": "chain_intensity",
+ "chain_width_table": table,
+ })
+
+
+def test_tree_mode_rejects_chain_width_schedule():
+ with pytest.raises(ValueError, match="chain_intensity"):
+ parse_algorithm_config({
+ "mode": "serve", "data_path": "/calibration", "chain_width_table": [[1, 4]],
+ })
+
+
+def test_complete_chain_schedule_needs_no_calibration():
+ config = parse_algorithm_config({
+ "mode": "serve", "intensity": "chain_intensity", "chain_width_table": [[1, 8], [64, 4]],
+ })
+ assert config.mode is Mode.SERVE
+ assert not config.data_path
+ assert config.chain_width_table == ((1, 8), (64, 4))
+ with pytest.raises(ValueError, match="data_path"):
+ parse_algorithm_config({
+ "mode": "serve", "intensity": "chain_intensity", "chain_width_table": [[64, 4]],
+ })
+
+
[email protected]("overrides", [{}, {"intensity": "chain_intensity"}])
+def test_serve_without_live_cost_capability_requires_calibration(overrides):
+ with pytest.raises(ValueError, match="data_path"):
+ parse_algorithm_config({"mode": "serve", **overrides})
+
+
+def test_unknown_keys_are_refused():
+ with pytest.raises(ValueError):
+ parse_algorithm_config({"mode": "static", "node_top_k": 4})
+
+
+# ------------------------------------------------------------------ hook check
+def fake_host(monkeypatch):
+ """A host module ``fakehost_api`` with a drafter registry and a dataclass field, checked through HOOKS."""
+ module = types.ModuleType("fakehost_api")
+
+ def register_drafter(algorithm, drafter_cls, *, model_cls=None, captures_aux_hidden_states=False):
+ pass
+
+ @dataclasses.dataclass
+ class Context:
+ gather_ids: object # a field without a class-level default
+
+ module.register_drafter, module.Context = register_drafter, Context
+ monkeypatch.setitem(sys.modules, "fakehost_api", module)
+ return module
+
+
+def test_hook_check_passes_a_host_with_every_hook(fake_host, monkeypatch):
+ monkeypatch.setattr(
+ hooks,
+ "HOOKS",
+ (
+ hooks.Hook("fakehost_api:register_drafter", ("algorithm", "captures_aux_hidden_states")),
+ hooks.Hook("fakehost_api:Context.gather_ids"),
+ ),
+ )
+ assert [hooks._problem(h) for h in hooks.HOOKS] == [None, None]
+
+
+def test_hook_check_names_what_is_missing(fake_host):
+ assert hooks._problem(hooks.Hook("fakehost_api:register_model")) == "fakehost_api:register_model"
+ assert "no parameter override" in hooks._problem(hooks.Hook("fakehost_api:register_drafter", ("override",)))
+ assert "not importable" in hooks._problem(hooks.Hook("nosuchhost.api:x"))
+
+
+# ------------------------------------------------------------------ the tree as TokenSpeed lanes
+def _drafted(seed=0):
+ """A tree grown as HarnessDrafter grows it, with TokenSpeed's lane masks, plus each node's parent node and the
+ window slot each node's draft row wrote (depth-1 lanes at step 1, ...; -1 for nodes never forwarded)."""
+ tree = DraftTree(TreeShape(top_k=K, max_depth=STEPS), BS, H, torch.float32, torch.device("cpu"), max_verify=1)
+ bits = lane_bits(K, STEPS, torch.device("cpu"))
+ lane_mask = torch.zeros(BS * K, dtype=torch.int64)
+ gen = torch.Generator().manual_seed(seed)
+ tree.stage_root(BS, torch.rand(BS, K, generator=gen).softmax(-1), torch.randint(0, 999, (BS, K), generator=gen),
+ torch.randn(BS, H, generator=gen)) # fmt: skip
+ tree.begin(BS)
+ seed_lane_masks(lane_mask, BS, bits)
+ parent_of = torch.full((BS, tree.shape.capacity), -1, dtype=torch.int64)
+ frontier = torch.arange(K).repeat(BS, 1) # node id of each lane
+ slot_of = {} # (b, node) -> window slot its row wrote
+ masks = [] # per step: (frontier nodes, lane masks) the step's rows ran with
+ for step in range(1, STEPS):
+ for b in range(BS):
+ for lane in range(K):
+ slot_of[b, int(frontier[b, lane])] = (step - 1) * K + lane
+ masks.append((frontier.clone(), lane_mask.view(BS, K).clone()))
+ probs = torch.rand(BS * K, K, generator=gen).softmax(-1)
+ tokens = torch.randint(0, 999, (BS * K, K), generator=gen)
+ tree.step(BS, step, probs, tokens, torch.randn(BS * K, H, generator=gen))
+ start = tree.shape.layer_start(step + 1)
+ parent_of[:, start : start + K * K] = frontier.repeat_interleave(K, dim=1)
+ first = tree.shape.num_parents(step + 1)
+ new_frontier = tree.parents[:BS, first : first + K].clone()
+ assert torch.equal(torch.gather(frontier, 1, parent_lanes(tree, BS, step)), parent_of.gather(1, new_frontier))
+ if step < STEPS - 1:
+ advance_lane_masks(tree, lane_mask, BS, step, bits)
+ frontier = new_frontier
+ return tree, parent_of, slot_of, masks
+
+
+def _ancestors(parent_of, b, node):
+ while node >= 0:
+ yield node
+ node = int(parent_of[b, node])
+
+
[email protected]("seed", [0, 1, 2])
+def test_lane_masks_show_a_row_its_ancestors_and_itself(seed):
+ _, parent_of, slot_of, masks = _drafted(seed)
+ for frontier, lane_mask in masks:
+ for b in range(BS):
+ for lane in range(K):
+ want = sum(1 << slot_of[b, n] for n in _ancestors(parent_of, b, int(frontier[b, lane])))
+ assert int(lane_mask[b, lane]) & ((1 << 64) - 1) == want
+
+
+def test_lane_bits_use_bit_63_as_the_sign():
+ bits = lane_bits(8, 9, torch.device("cpu")) # (9 - 1) * 8 = 64 window slots
+ assert int(bits[7, 7]) == -(1 << 63) and int(bits[0, 0]) == 1
+ with pytest.raises(ValueError, match="64-bit"):
+ lane_bits(8, 10, torch.device("cpu"))
+
+
[email protected]("seed", [0, 1, 2])
+def test_window_verifies_what_sglang_and_vllm_verify(seed):
+ tree, parent_of, _, _ = _drafted(seed)
+ roots = torch.tensor([11, 22, 33], dtype=torch.int32)
+ window = torch.zeros(BS, WIDTH, dtype=torch.int32)
+ parents = torch.zeros(BS, WIDTH, dtype=torch.int32)
+ verify_window(tree, BS, STEPS, roots, window, parents)
+ # sglang's verify input for the same tree: the ranked nodes, their tokens in node order (DraftTree.select)
+ ranked, _ = tree.rank(BS, STEPS, WIDTH - 1)
+ sglang = tree.select(BS, STEPS, ranked, WIDTH)
+ assert torch.equal(window[:, 0], roots)
+ assert torch.equal(window[:, 1:].long(), sglang.draft_tokens)
+ for b in range(BS):
+ nodes = sglang.top_scores_index[b].tolist()
+ assert parents[b, 0] == -1
+ for row, node in enumerate(nodes, start=1):
+ parent = int(parent_of[b, node])
+ assert int(parents[b, row]) == (0 if parent < 0 else 1 + nodes.index(parent)) < row
+ # vLLM's verify rows for the same tree (TreeDrafter.select = DraftTree.verify_rows)
+ tokens, parent_rows = tree.verify_rows_reference(BS, STEPS, WIDTH - 1)
+ assert torch.equal(window[:, 1:].long(), tokens) and torch.equal(parents, parent_rows)
diff --git a/tests/test_tokenspeed_nemotron.py b/tests/test_tokenspeed_nemotron.py
new file mode 100644
index 0000000..2782594
--- /dev/null
+++ b/tests/test_tokenspeed_nemotron.py
@@ -0,0 +1,111 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Adapter admission and engine-owned Nemotron draft structures."""
+
+import pytest
+import torch
+from transformers import LlamaConfig
+
+try:
+ from tokenspeed.runtime.distributed.mapping import Mapping
+ from tokenspeed.runtime.utils.env import global_server_args_dict
+ from eagle_harness.tokenspeed.models import LlamaForCausalLMEagle4
+except ImportError as exc:
+ pytest.skip(f"TokenSpeed runtime unavailable: {exc}", allow_module_level=True)
+except RuntimeError as exc:
+ if torch.cuda.is_available():
+ raise
+ pytest.skip(f"TokenSpeed needs GPU platform discovery: {exc}", allow_module_level=True)
+
+
+def config():
+ return LlamaConfig(
+ architectures=["LlamaForCausalLMEagle4"],
+ hidden_size=128, vocab_size=512, draft_vocab_size=512,
+ intermediate_size=256, num_hidden_layers=1,
+ num_attention_heads=4, num_key_value_heads=4, head_dim=32,
+ max_position_embeddings=512, attn_norm=True, use_rope=False,
+ layer_types=["sliding_attention"], sliding_window=64,
+ enable_moe=True, moe_architecture="nemotron_latent_relu2",
+ hidden_act="relu2", n_routed_experts=8, num_experts_per_tok=2,
+ moe_latent_size=64, moe_intermediate_size=128,
+ n_shared_experts=1, moe_shared_expert_intermediate_size=256,
+ n_group=1, topk_group=1, norm_topk_prob=True,
+ routed_scaling_factor=5.0, scoring_func="sigmoid", topk_method="noaux_tc",
+ moe_router_dtype="float32", norm_output=True, fc_norm=True,
+ efficient_lm_head_config={"type": "low_rank", "rank": 16, "num_candidates": 32},
+ )
+
+
+def mapping():
+ original = global_server_args_dict.copy()
+ original_dtype = torch.get_default_dtype()
+ torch.set_default_dtype(torch.bfloat16)
+ mapping = Mapping(rank=0, world_size=1)
+ global_server_args_dict.update(mapping=mapping, max_model_len=512)
+ yield mapping
+ torch.set_default_dtype(original_dtype)
+ global_server_args_dict.clear()
+ global_server_args_dict.update(original)
+
+
+def test_latent_draft_retains_the_adapter_candidate_head(config, mapping):
+ with torch.device("cpu"):
+ model = LlamaForCausalLMEagle4(config, mapping)
+ block = model.model.midlayer
+ assert block.self_attn.qkv_proj.weight.shape[1] == config.hidden_size
+ assert block.self_attn.rotary_emb is None
+ assert block.eh_proj.weight.shape == (128, 256)
+ assert block.mlp.__class__.__module__ == "tokenspeed.runtime.models.nemotron_h"
+ assert model.efficient_lm_head_down_proj.weight.shape == (16, 128)
+ assert model.efficient_lm_head.weight.shape == (512, 16)
+ assert model.num_candidates == 32
+
+
[email protected](not torch.cuda.is_available(), reason="CUDA required")
[email protected]("rows", [1, 8, 16])
+def test_normalized_attention_input_on_gpu(config, mapping, rows):
+ generator = torch.Generator(device="cuda").manual_seed(781)
+ with torch.device("cuda"), torch.inference_mode():
+ model = LlamaForCausalLMEagle4(config, mapping)
+ block = model.model.midlayer
+ for parameter in block.parameters():
+ parameter.normal_(mean=0, std=0.1, generator=generator)
+ embeds = torch.randn(rows, config.hidden_size, generator=generator)
+ hidden = torch.randn(rows, config.hidden_size, generator=generator)
+
+ def norm(x, weight):
+ normalized = x.float() * torch.rsqrt(x.float().square().mean(-1, keepdim=True) + config.rms_norm_eps)
+ return (normalized * weight.float()).to(x.dtype)
+
+ joined = torch.cat((norm(embeds, block.input_layernorm.weight), norm(hidden, block.hidden_norm.weight)), dim=-1)
+ residual = torch.nn.functional.linear(joined, block.eh_proj.weight)
+ expected = norm(residual, block.pre_attention_layernorm.weight)
+ actual, actual_residual = block.prepare_attention_input(embeds, hidden, fuse_embed_reduce=False)
+ torch.testing.assert_close(actual_residual, residual, atol=0.002, rtol=0.02)
+ torch.testing.assert_close(actual, expected, atol=0.002, rtol=0.02)
+
+
+def test_extended_draft_refuses_an_older_engine(config, mapping, monkeypatch):
+ from eagle_harness.tokenspeed.models import Eagle3DecoderLayer
+
+ monkeypatch.delattr(Eagle3DecoderLayer, "prepare_attention_input")
+ with pytest.raises(RuntimeError, match="requires TokenSpeed"):
+ LlamaForCausalLMEagle4(config, mapping)
+
+
+def test_post_mlp_norm_is_still_refused(config, mapping):
+ config.enable_post_mlp_norm = True
+ with pytest.raises(NotImplementedError, match="enable_post_mlp_norm"):
+ LlamaForCausalLMEagle4(config, mapping)
+
+
+def test_sparse_swiglu_is_not_silently_loaded_as_latent_moe(config, mapping):
+ config.moe_architecture = "sparse_swiglu"
+ config.hidden_act = "silu"
+ with pytest.raises((ValueError, NotImplementedError), match="nemotron_latent_relu2|moe_architecture"):
+ with torch.device("cpu"):
+ LlamaForCausalLMEagle4(config, mapping)
diff --git a/tests/test_tokenspeed_ownership.py b/tests/test_tokenspeed_ownership.py
new file mode 100644
index 0000000..0dbe919
--- /dev/null
+++ b/tests/test_tokenspeed_ownership.py
@@ -0,0 +1,17 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Partner runtime code is an installed engine dependency, not vendored here."""
+
+import re
+from pathlib import Path
+
+
+def test_no_tokenspeed_copyright_code_in_harness():
+ package = Path(__file__).resolve().parents[1] / "eagle_harness"
+ copied = [
+ str(path.relative_to(package))
+ for path in package.rglob("*")
+ if path.suffix in {".py", ".cu", ".h"} and re.search(r"Copyright[^\n]*LightSeek", path.read_text())
+ ]
+ assert not copied, f"TokenSpeed-owned sources belong in the engine: {copied}"
diff --git a/tests/test_tokenspeed_plugin.py b/tests/test_tokenspeed_plugin.py
new file mode 100755
index 0000000..607216f
--- /dev/null
+++ b/tests/test_tokenspeed_plugin.py
@@ -0,0 +1,118 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The TokenSpeed plugin against the installed TokenSpeed: hook check, registration, the draft model's profile.
+
+No GPU work, but TokenSpeed imports only on a host with a GPU (its kernel package refuses otherwise), so this runs in
+the GPU test jobs and is skipped elsewhere. On a TokenSpeed without the ``pr-spec-plugin-hooks`` hooks the registration tests
+check that the plugin switches itself off instead.
+"""
+
+from __future__ import annotations
+
+import sys
+from importlib.metadata import entry_points
+
+import pytest
+
+try:
+ import tokenspeed.runtime.plugins.registry # noqa: F401
+except (ImportError, RuntimeError) as exc: # RuntimeError: tokenspeed-kernel on a host without a GPU
+ pytest.skip(f"TokenSpeed is not importable here: {exc}", allow_module_level=True)
+
+from tokenspeed.runtime.configs.model_profile import ModelProfile # noqa: E402
+from tokenspeed.runtime.execution import drafter as drafter_registry # noqa: E402
+from tokenspeed.runtime.plugins import registry # noqa: E402
+
+from eagle_harness import compat # noqa: E402
+from eagle_harness.models.eagle4_config import EAGLE4_ARCH # noqa: E402
+from eagle_harness.tokenspeed import plugin # noqa: E402
+from eagle_harness.tokenspeed.config import ALGORITHM_NAME # noqa: E402
+from eagle_harness.tokenspeed.hooks import hook_problems # noqa: E402
+
+HAS_HOOKS = not hook_problems()
+needs_hooks = pytest.mark.skipif(
+ not HAS_HOOKS, reason=f"TokenSpeed without the pr-spec-plugin-hooks hooks: {hook_problems()}"
+)
+
+
+def registered():
+ drafters, models = dict(drafter_registry._PLUGIN_DRAFTERS), dict(registry._MODELS)
+ assert plugin.register() is True
+ yield
+ drafter_registry._PLUGIN_DRAFTERS.clear()
+ drafter_registry._PLUGIN_DRAFTERS.update(drafters)
+ registry._MODELS.clear()
+ registry._MODELS.update(models)
+
+
+def test_entry_point_targets_register():
+ (ep,) = [ep for ep in entry_points(group="tokenspeed.plugins") if ep.name == "eagle_harness"] or [None]
+ if ep is None:
+ pytest.skip("eagle-harness is not installed with its entry points here")
+ assert ep.value == "eagle_harness.tokenspeed.plugin:register"
+
+
+@needs_hooks
+def test_register_adds_the_drafter_and_the_draft_model(registered):
+ from eagle_harness.tokenspeed.drafter import HarnessDrafter
+ from eagle_harness.tokenspeed.models import LlamaForCausalLMEagle4
+
+ assert drafter_registry.get_drafter_impl(ALGORITHM_NAME, None) is HarnessDrafter
+ assert drafter_registry.drafter_captures_aux_hidden_states(ALGORITHM_NAME)
+ assert registry.registered_model(EAGLE4_ARCH).cls is LlamaForCausalLMEagle4
+
+
+@needs_hooks
+def test_draft_profile_is_a_valid_mha_profile():
+ from eagle_harness.tokenspeed.models import LlamaForCausalLMEagle4
+
+ profile = LlamaForCausalLMEagle4.model_profile(None)
+ assert isinstance(profile, ModelProfile) and profile.cache_family == "mha" and profile.linear_attention is None
+
+
+@needs_hooks
+def test_compat_reports_the_hooks_ok():
+ assert compat.check("tokenspeed").ok
+
+
+def test_register_is_off_without_the_hooks(monkeypatch):
+ # The registry module fails to import, as on a TokenSpeed without plugins: hook_problems names it.
+ monkeypatch.setitem(sys.modules, "tokenspeed.runtime.plugins.registry", None)
+ assert any("registry" in p for p in hook_problems())
+ assert plugin.register() is False
+
+
+def test_hook_problems_name_a_missing_parameter(monkeypatch):
+ def register_drafter(algorithm, drafter_cls, *, model_cls=None): # main's signature without H2
+ raise AssertionError("never called")
+
+ monkeypatch.setattr(registry, "register_drafter", register_drafter)
+ assert any("captures_aux_hidden_states" in p for p in hook_problems())
+
+
+@needs_hooks
+def test_candidate_gather_rides_the_last_dim_as_16_bit_words(monkeypatch):
+ """The TP candidate exchange asks the engine for a last-dim gather of 16-bit rows (its barrier-free Lamport
+ path, which keeps the draft's device-launched round graphs free of NCCL) and unpacks rank-major columns."""
+ import torch
+
+ from eagle_harness.tokenspeed import models
+
+ tp, rows, n = 4, 6, 8
+ g = torch.Generator().manual_seed(7)
+ shards = [torch.randint(-(2**31), 2**31 - 1, (rows, n), dtype=torch.int32, generator=g) for _ in range(tp)]
+ calls = []
+
+ def all_gather(tensor, group, dim):
+ calls.append((tensor.dtype, tensor.shape, group, dim))
+ return torch.cat([s.view(tensor.dtype) for s in shards], dim=-1)
+
+ monkeypatch.setattr(models, "all_gather", all_gather)
+ head = models.LlamaForCausalLMEagle4.__new__(models.LlamaForCausalLMEagle4)
+ head.tp_size, head.tp_group = tp, "tp"
+ out = head._gather_candidates(shards[0])
+ assert calls == [(torch.int16, (rows, 2 * n), "tp", -1)]
+ assert out.shape == (tp, rows, n) and out.dtype == torch.int32
+ assert all(torch.equal(out[r], shards[r]) for r in range(tp))
diff --git a/tests/test_tokenspeed_policy_cost.py b/tests/test_tokenspeed_policy_cost.py
new file mode 100644
index 0000000..ef5e407
--- /dev/null
+++ b/tests/test_tokenspeed_policy_cost.py
@@ -0,0 +1,199 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""CPU parity of the packed device policy with the shared core cost model."""
+
+import json
+from dataclasses import replace
+from pathlib import Path
+
+import pytest
+import torch
+
+from eagle_harness.core.cost_model import CostModel, CostModelParams, SizeClass
+from eagle_harness.core.cost_table import BatchCostTable, CostCurve, IntervalCost, load_cost_tables
+from eagle_harness.core.limits import ComputeIntensity
+from eagle_harness.tokenspeed.costs import tree_policy_costs
+
+pytest.importorskip("tokenspeed.runtime.execution.drafter.tree_round.device_policy")
+from tokenspeed.runtime.execution.drafter.tree_round.device_policy import DevicePolicy, write_round_slots
+from tokenspeed.runtime.execution.drafter.tree_round.policy_cost import build_tables
+
+
+def cost_fixture():
+ """Different measured tiers, context intervals and model ratios."""
+ tables = {}
+ for bs, slope in ((1, 0.03), (4, 0.07), (8, 0.13), (32, 0.2)):
+ intervals = []
+ ratios = []
+ for interval in range(2):
+ index = (0, 1, 3, 7, 15, 31, 63)
+ target = CostCurve(
+ (100.0,) * len(index),
+ tuple(1 + i * slope * (1 + 0.1 * interval) for i in index),
+ index,
+ (),
+ (),
+ )
+ draft = CostCurve((10.0,) * 4, (1.0, 1.1, 1.2, 1.4), (0, 1, 3, 7), (), ())
+ intervals.append(IntervalCost(target, draft))
+ ratios.append(10.0 + interval * 10)
+ tables[bs] = BatchCostTable(bs, 1024, 1024, 64, 64, 8, tuple(intervals), tuple(ratios))
+ return tables
+
+
+def pack(costs, k=4, depth=8, moe=False, intensity="high_intensity"):
+ model = CostModel(
+ costs,
+ CostModelParams(depth_loss_ratio=0.08 if moe else 0.04),
+ ComputeIntensity(intensity),
+ k,
+ depth,
+ 32,
+ moe,
+ )
+ return build_tables(tree_policy_costs(model), device=torch.device("cpu"))
+
+
[email protected]("intensity", ["high_intensity", "low_intensity"])
[email protected]("moe", [False, True])
[email protected]("k", [2, 4, 8])
+def test_table_decisions_match_core(k, moe, intensity):
+ costs = cost_fixture()
+ depth = 8
+ packed = pack(costs, k, depth, moe, intensity)
+ params = CostModelParams(depth_loss_ratio=0.08 if moe else 0.04)
+ model = CostModel(costs, params, ComputeIntensity(intensity), k, depth, 32, moe)
+ assert packed.tier_table.tolist() == [16, 8, 4, 2, 32, k, k, min(k, 4), min(k, 4)]
+
+ for bs in (1, 2, 3, 4, 6, 8, 20, 32):
+ cost_id = packed.batch_table[bs - 1, 0].item()
+ table = model.table(bs)
+ for interval in range(2):
+ context = (interval + 1) * table.cache_length_step
+ verify = model.verify_cost(bs, context)
+ assert packed.verify_i32[bs - 1, interval].item() == int(model.tier.size)
+ assert packed.verify_f64[bs - 1, interval].tolist() == [verify.threshold * 0.95, verify.threshold * 1.05]
+ data = packed.interval_f64[cost_id, interval]
+ index = table.intervals[interval].target.index
+ assert packed.interval_i32[cost_id, interval].tolist() == [len(index), *index]
+ for variant in range(5):
+ model.tier.size = SizeClass(variant % 4)
+ model.tier.tiny = variant == 4
+ row = model.draft_cost_row(bs, context)
+ assert data[:2].tolist() == [row.cost_state, row.model_cost_ratio]
+ width = packed.tier_table[5 + int(model.tier.size)].item()
+ for d in (3, 5):
+ threshold = data[2 + variant * depth + d].item()
+ boundary_gain = threshold / params.async_layer_ratio / row.model_cost_ratio * row.cost_state
+ for factor in (0.9, 1.1):
+ deltas = [1.0] + [1.0 + boundary_gain * factor] * k
+ model.tier.tiny = variant == 4
+ decision = model.tree_width(d, bs, 32, row, deltas)
+ gain = (deltas[width] - deltas[0]) / data[0].item() * data[1].item() * 0.9
+ assert (gain < threshold) == decision.stop
+ delta = data[2 + 5 * depth :].view(len(index), len(index))
+ values = table.intervals[interval].target.ratio
+ for a in range(len(index)):
+ for b in range(len(index)):
+ expected = values[b] - values[a] if b > a and values[b] - values[a] > 0.04 else 0.0
+ assert delta[a, b].item() == expected
+
+
+def test_shared_loader_on_existing_golden_files(tmp_path):
+ golden = json.loads((Path(__file__).parent / "golden/fork_golden.json").read_text())
+ for name, content in golden["cost_files_high_intensity"].items():
+ path = tmp_path / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(content)
+ costs = load_cost_tables(str(tmp_path))
+ assert costs
+ assert all(isinstance(table, BatchCostTable) for table in costs.values())
+ packed = pack(costs)
+ assert torch.isfinite(packed.interval_f64).all()
+
+
+ "change",
+ [
+ {"cache_length_step": 0},
+ {"cache_length_step": -1},
+ {"model_ratio": (float("nan"), 10.0)},
+ {"model_ratio": (4.9, 10.0)},
+ {"model_ratio": (101.0, 10.0)},
+ {"model_ratio": ()},
+ {"intervals": ()},
+ ],
+)
+def test_bad_cost_data_rejected_before_cuda(change):
+ table = cost_fixture()[1]
+ with pytest.raises(ValueError):
+ pack({1: replace(table, **change)})
+
+
+ "index,error",
+ [
+ ((1, 3), "Invalid target cost indices"),
+ ((0, 3, 1), "Invalid target cost indices"),
+ ((0, 1, 1), "Invalid target cost indices"),
+ ((0, 2**31), "Invalid target cost indices"),
+ (tuple(range(33)), "Invalid target width count 33"),
+ ],
+)
+def test_bad_widths_rejected(index, error):
+ table = cost_fixture()[1]
+ interval = table.intervals[0]
+ target = replace(interval.target, index=index, value=(100.0,) * len(index), ratio=(1.0,) * len(index))
+ with pytest.raises(ValueError, match=error):
+ pack({1: replace(table, intervals=(replace(interval, target=target),), model_ratio=(10.0,))})
+
+
+ "kwargs",
+ [
+ {"node_top_k": 1},
+ {"node_top_k": 3},
+ {"node_top_k": 16},
+ {"tree_depth": 1},
+ {"tree_depth": 33},
+ {"tree_depth": 18},
+ {"verify_num": 1},
+ {"verify_num": 65},
+ {"compute_intensity": "chain_intensity"},
+ {"exec_mode": 1},
+ {"exec_mode": 2},
+ {"chain_width_table": ((1, 4),)},
+ {"device": torch.device("cpu")},
+ ],
+)
+def test_unsupported_policy_rejected_without_build(kwargs):
+ config = {
+ "verify_num": 32,
+ "node_top_k": 4,
+ "tree_depth": 8,
+ "compute_intensity": "high_intensity",
+ "is_moe_target": False,
+ "exec_mode": 0,
+ "benchmark_config": "",
+ "chain_width_table": (),
+ "device": torch.device("cuda"),
+ }
+ config.update(kwargs)
+ with pytest.raises(ValueError):
+ DevicePolicy({}, **config)
+
+
+def test_warmup_slots_and_sequence_tagged_polling():
+ slots = torch.full((4, 5), -1, dtype=torch.int32)
+ count = write_round_slots(slots, 4, [4, 2, 2], lambda d, n: min(n, 16) if d % 2 == 0 else 0)
+ assert count == 37
+ assert slots.tolist() == [[0, 4, 2, 2, 0], [0, 5, 21, 29, 0], [0, 0, 16, 0, 0], [0, 1, 1, 1, 0]]
+ policy = object.__new__(DevicePolicy)
+ policy.chain = False
+ policy._go_host_view = torch.tensor([0, 15, 14]).numpy()
+ assert policy.go_ready(1, 7) is True
+ assert policy.go_ready(2, 7) is False
+ assert policy.go_ready(1, 8) is None
+ with pytest.raises(ValueError, match="live requests"):
+ policy.observe_batch_size(33)
diff --git a/tests/test_tokenspeed_policy_golden.py b/tests/test_tokenspeed_policy_golden.py
new file mode 100644
index 0000000..a566d52
--- /dev/null
+++ b/tests/test_tokenspeed_policy_golden.py
@@ -0,0 +1,205 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Golden contract for core costs and the installed engine's DevicePolicy.
+
+The fixture tests individual calls, not complete serving rounds: draft counts,
+verify contexts, and lagged scores are independent inputs. The CUDA replay seeds
+those inputs at the verify boundary, then runs the production decision kernels.
+Only the K=4 serving case is supported by DevicePolicy; K=6 and evaluation mode
+are checked as explicit rejections. CPU replay covers all three golden cases.
+"""
+
+import copy
+import json
+from pathlib import Path
+
+import pytest
+import torch
+
+from eagle_harness.core.cost_model import CostModel, CostModelParams
+from eagle_harness.core.cost_table import load_cost_tables
+from eagle_harness.core.limits import ComputeIntensity
+from eagle_harness.tokenspeed.costs import tree_policy_costs
+from tests.test_cost_golden import _replay
+
+
[email protected](scope="module")
+def golden():
+ return json.loads((Path(__file__).parent / "golden" / "fork_golden.json").read_text())
+
+
[email protected](scope="module")
+def golden_tables(golden, tmp_path_factory):
+ root = tmp_path_factory.mktemp("policy-golden")
+ for name, contents in golden["cost_files_high_intensity"].items():
+ path = root / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(contents)
+ return load_cost_tables(str(root))
+
+
[email protected](scope="module")
+def engine_policy():
+ pytest.importorskip("tokenspeed")
+ from tokenspeed.runtime.execution.drafter.tree_round import device_policy
+
+ return device_policy
+
+
+def _model(tables, case):
+ return CostModel(
+ tables=tables,
+ params=CostModelParams(depth_loss_ratio=0.04),
+ intensity=ComputeIntensity.HIGH,
+ **case["case"],
+ )
+
+
+def _device_script(case):
+ script = copy.deepcopy(case["script"])
+ delta_count = case["case"]["node_top_k"] + 1
+ for step in script:
+ if step["op"] == "tree_width":
+ step["args"][3] = torch.tensor(step["args"][3][:delta_count], dtype=torch.float32).tolist()
+ elif step["op"] == "verify_paged":
+ step["args"][0] = torch.tensor(step["args"][0], dtype=torch.float32).tolist()
+ return script
+
+
+def _top_scores(cumulative, requested, batch_size):
+ return torch.diff(cumulative, prepend=cumulative.new_zeros(1))[:requested].repeat(batch_size, 1)
+
+
+def _policy_kwargs(case):
+ config = case["case"]
+ return {
+ "verify_num": config["verify_num"],
+ "node_top_k": config["node_top_k"],
+ "tree_depth": config["tree_depth"],
+ "compute_intensity": ComputeIntensity.HIGH.value,
+ "is_moe_target": False,
+ "exec_mode": int(config["eval_batch_size"] is not None),
+ "device": torch.device("cuda"),
+ }
+
+
[email protected]("case_index", range(3), ids=["serving-k4", "serving-k6", "evaluation-k8"])
+def test_golden_decisions_survive_device_input_precision(golden, golden_tables, case_index):
+ case = golden["decisions_high_intensity"][case_index]
+ _replay(_model(golden_tables, case), case["script"])
+ _replay(_model(golden_tables, case), _device_script(case))
+
+
[email protected]("flat", [False, True], ids=["mean-ranking", "flat-ranking"])
+def test_golden_nonlagged_scores_round_trip(golden, golden_tables, flat):
+ case = golden["decisions_high_intensity"][0]
+ script = _device_script(case)
+ for step in script:
+ if step["op"] != "verify_paged" or step["args"][4]:
+ continue
+ scores, requested, batch_size, _, _ = step["args"]
+ top = _top_scores(torch.tensor(scores, dtype=torch.float32), requested, batch_size)
+ ranked = top.flatten() if flat else top.mean(dim=0)
+ step["args"][0] = ranked.cumsum(dim=0).tolist()
+ _replay(_model(golden_tables, case), script)
+
+
[email protected]("case_index", range(3), ids=["serving-k4", "serving-k6", "evaluation-k8"])
+def test_engine_packs_golden_costs_exactly(golden, golden_tables, engine_policy, case_index):
+ from tokenspeed.runtime.execution.drafter.tree_round.policy_cost import build_tables
+
+ case = golden["decisions_high_intensity"][case_index]
+ costs = tree_policy_costs(_model(golden_tables, case))
+ packed = build_tables(costs, device=torch.device("cpu"))
+ assert packed.tier_table.tolist() == [*costs.history_floors, *costs.initial_widths]
+ for live, batch in enumerate(costs.batches):
+ cost_id, reserved, intervals, step, chain = packed.batch_table[live].tolist()
+ assert [reserved, intervals, step, chain] == [0, len(batch.intervals), batch.cache_length_step, 0]
+ for interval_id, interval in enumerate(batch.intervals):
+ indices = packed.interval_i32[cost_id, interval_id]
+ count = len(interval.verify_widths)
+ assert indices[: count + 1].tolist() == [count, *interval.verify_widths]
+ thresholds = [value for variant in interval.depth_thresholds for value in variant]
+ values = packed.interval_f64[cost_id, interval_id]
+ assert values[: 2 + len(thresholds)].tolist() == [
+ interval.draft_cost,
+ interval.model_cost_ratio,
+ *thresholds,
+ ]
+ deltas = values[2 + len(thresholds) :].reshape(len(indices) - 1, len(indices) - 1)
+ assert deltas[:count, :count].tolist() == [list(row) for row in interval.verify_cost_deltas]
+ assert packed.verify_i32[live, interval_id].item() == interval.verify_tier
+ assert packed.verify_f64[live, interval_id].tolist() == list(interval.verify_thresholds)
+
+
[email protected]("case_index,error", [(1, "K=2/4/8"), (2, "serving only")])
+def test_unsupported_golden_cases_are_explicit(golden, golden_tables, engine_policy, case_index, error):
+ case = golden["decisions_high_intensity"][case_index]
+ with pytest.raises(ValueError, match=error):
+ engine_policy.DevicePolicy(tree_policy_costs(_model(golden_tables, case)), **_policy_kwargs(case))
+
+
[email protected](not torch.cuda.is_available(), reason="production DevicePolicy requires CUDA")
+def test_device_policy_matches_golden_depth_and_width(golden, golden_tables, engine_policy):
+ case = golden["decisions_high_intensity"][0]
+ assert case["case"] == {"eval_batch_size": None, "node_top_k": 4, "tree_depth": 12, "verify_num": 64}
+ script = _device_script(case)
+ model = _model(golden_tables, case)
+ _replay(model, script)
+ policy = engine_policy.DevicePolicy(tree_policy_costs(model), **_policy_kwargs(case))
+ live = torch.zeros(1, dtype=torch.int32, device="cuda")
+ frontier = torch.zeros(32, dtype=torch.int64, device="cuda")
+ sampled = torch.zeros(1, dtype=torch.bool, device="cuda")
+
+ for step_index, step in enumerate(script):
+ op, args, expected = step["op"], step["args"], step["out"]
+ where = (step_index, op, args)
+ if op == "history":
+ past = expected
+ elif op == "draft_cost_row":
+ batch_size, context = args
+ policy.observe_batch_size(batch_size)
+ live.fill_(batch_size)
+ frontier.fill_(context)
+ policy.begin_round(live, frontier, sampled)
+ assert policy.past_verify_num.item() == past, where
+ elif op == "tree_width":
+ depth, _, _, deltas = args
+ if depth:
+ policy.decide(depth, torch.tensor(deltas, dtype=torch.float32, device="cuda"))
+ width, _, stop = expected
+ assert bool(policy.go[depth + 1].item()) is not stop, where
+ if stop:
+ assert policy.last_depth.item() == depth, where
+ assert policy.stop_width.item() == width, where
+ else:
+ assert policy.widths[depth + 1].item() == width, where
+ elif op == "verify_count":
+ # Its arbitrary draft_count is covered by the core replay above;
+ # the next fixture call supplies an independent requested count.
+ continue
+ elif op == "verify_paged":
+ scores, requested, batch_size, context, lagged = args
+ flat = policy.flat.item()
+ frontier.fill_(context)
+ policy.begin_round(live, frontier, sampled)
+ policy.flat.fill_(flat)
+ policy.verify_count.fill_(requested)
+ cumulative = torch.tensor(scores, dtype=torch.float32, device="cuda")
+ # The fixture supplies arbitrary lagged scores rather than the
+ # previous round's output; use the engine's named state offset.
+ policy._state[engine_policy._RANKED_COUNT] = len(scores) if lagged else 0
+ if lagged:
+ policy._ranked[: len(scores)].copy_(cumulative)
+ top = torch.zeros((batch_size, requested), dtype=torch.float32, device="cuda")
+ else:
+ top = _top_scores(cumulative, requested, batch_size)
+ policy.select_verify(top)
+ assert expected[1] is False, where
+ assert policy.verify_num.item() == expected[0], where
+ elif op == "record":
+ # select_verify records the decision in the production history.
+ assert policy.verify_num.item() == args[1], where
+ else:
+ raise AssertionError(where)
diff --git a/tests/test_tree_graph_memory_gpu.py b/tests/test_tree_graph_memory_gpu.py
new file mode 100644
index 0000000..9669b86
--- /dev/null
+++ b/tests/test_tree_graph_memory_gpu.py
@@ -0,0 +1,76 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Serial tree-growth shapes must not retain one full workspace per graph."""
+
+import contextlib
+from types import MethodType, SimpleNamespace
+
+import pytest
+import torch
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA graph memory needs a GPU")
+
+
[email protected]("conditional", [False, True])
[email protected]("counts", [(7,), (3, 7, 15)])
+def test_growth_graphs_share_workspace_and_replay_in_any_shape_order(monkeypatch, conditional, counts):
+ pytest.importorskip("vllm")
+ import vllm.distributed.parallel_state as ps
+
+ from eagle_harness.vllm.tree_drafter import TreeDrafter
+ from tests.test_depth_stop import _Model
+
+ @contextlib.contextmanager
+ def graph_capture(device):
+ yield SimpleNamespace(stream=torch.cuda.Stream(device=device))
+
+ monkeypatch.setattr(ps, "graph_capture", graph_capture)
+ device = torch.device("cuda")
+ attn = SimpleNamespace(
+ impl=SimpleNamespace(scale=64**-0.5), sliding_window=None, num_heads=2, num_kv_heads=2, head_size=64
+ )
+ drafter = TreeDrafter(
+ _Model(2, 64, 300, "cuda"),
+ attn,
+ top_k=4,
+ depth=6,
+ max_reqs=512,
+ device=device,
+ min_gain=0.0 if conditional else None,
+ )
+ drafter.graphs = True
+ elements = 16 * 1024 * 1024 # a 64 MiB transient logits-like workspace
+
+ def growth(self, num_reqs, count, committed, block_table, stop=None):
+ self._go.fill_(True)
+ with self._capture_if(stop):
+ workspace = committed[0].float().expand(elements).clone()
+ result = workspace[:: elements // 16].clone(), torch.full((num_reqs, count), num_reqs, device=device)
+ return result
+
+ drafter._grow_and_select = MethodType(growth, drafter)
+ committed = torch.zeros(512, dtype=torch.int64, device=device)
+ table = torch.zeros((512, 1), dtype=torch.int32, device=device)
+ sizes = [1, 32, 33, 64, 128, 256, 512]
+ torch.cuda.synchronize()
+ torch.cuda.empty_cache()
+ before = torch.cuda.memory_reserved()
+ for count in counts:
+ for bs in sizes:
+ for value in (1, 2): # eager compile, then capture/replay
+ committed.fill_(value)
+ out, parents = drafter.grow_and_select(bs, count, committed[:bs], table[:bs])
+ assert out.tolist() == [float(value)] * 16
+ assert torch.all(parents == bs)
+ torch.cuda.synchronize()
+ torch.cuda.empty_cache()
+ retained = torch.cuda.memory_reserved() - before
+ assert retained < 2 * elements * 4, f"graphs retained {retained} bytes of workspace"
+ assert len(drafter._graphs) == len(sizes) * len(counts)
+ replay_shapes = [(bs, count) for count in reversed(counts) for bs in (512, 1, 128, 33, 64, 32, 256, 1)]
+ for value, (bs, count) in enumerate(replay_shapes, 3):
+ committed.fill_(value)
+ out, parents = drafter.grow_and_select(bs, count, committed[:bs], table[:bs])
+ assert out.tolist() == [float(value)] * 16
+ assert torch.all(parents == bs)
diff --git a/tests/test_tree_load_policy.py b/tests/test_tree_load_policy.py
new file mode 100644
index 0000000..9fd16c1
--- /dev/null
+++ b/tests/test_tree_load_policy.py
@@ -0,0 +1,119 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Tree verify width per batch size from served rounds: the high-load default of the vLLM tree."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+from importlib.resources import files
+
+import pytest
+
+from eagle_harness.core.chain_width import (
+ TREE_ROUNDS_FILE,
+ load_tree_rounds,
+ merge_tree_rounds,
+ served_tree_schedule,
+ width_at,
+)
+
+
+def _row(bs, width, round_us, accept, count=50):
+ return {"batch_size": bs, "width": width, "round_us": round_us, "accept": accept, "count": count}
+
+
+# The release numbers at TP4: the 16-wide tree wins at batch 8 and loses at 64 (served round times, ms).
+RELEASE = [
+ _row(8, 16, 12_500, 4.43),
+ _row(8, 4, 9_000, 2.9),
+ _row(8, 1, 6_000, 1.0),
+ _row(64, 16, 47_900, 3.96),
+ _row(64, 4, 20_000, 2.9),
+ _row(64, 1, 12_000, 1.0),
+]
+
+
+def _rounds(rows):
+ out = {}
+ for r in rows:
+ out.setdefault(r["batch_size"], {})[r["width"]] = (r["round_us"], r["accept"])
+ return out
+
+
+def test_packaged_tp4_rounds_preserve_low_batch_and_narrow_from_twenty():
+ profile = files("eagle_harness.core").joinpath("profiles/vllm-qwen38-tp4")
+ rounds = load_tree_rounds(str(profile))
+ assert rounds is not None, "shipped TP4 policy requires its measured rounds"
+ assert hashlib.sha256(profile.joinpath(TREE_ROUNDS_FILE).read_bytes()).hexdigest() == (
+ "589c4abcf7523bf1087390c8b32644e351010fc7b3c8d53d1a43c67d10d8043c"
+ )
+ schedule = served_tree_schedule(rounds, 16, 512)
+ assert schedule is not None
+ for batch in (1, 8, 19):
+ assert width_at(schedule, batch) == 16
+ for batch in (20, 64, 512):
+ assert width_at(schedule, batch) == 4
+
+
+def test_low_batch_keeps_the_configured_width_and_high_batch_narrows():
+ schedule = served_tree_schedule(_rounds(RELEASE), 16, 512)
+ assert width_at(schedule, 1) == 16
+ assert width_at(schedule, 8) == 16
+ # 64: 2.9 / 20 ms beats 3.96 / 47.9 ms and 1 / 12 ms.
+ assert width_at(schedule, 64) == 4
+ assert width_at(schedule, 512) == 4
+ assert schedule[0][0] == 1 and schedule[-1][1] == 512
+
+
+def test_batch_sizes_below_the_first_loss_keep_the_configured_width():
+ # Only batch 64 was measured: everything below it keeps 16, even batch sizes nearer to nothing else.
+ rows = [r for r in RELEASE if r["batch_size"] == 64]
+ schedule = served_tree_schedule(_rounds(rows), 16, 512)
+ assert width_at(schedule, 63) == 16
+ assert width_at(schedule, 64) == 4
+
+
+def test_off_wins_where_every_draft_loses():
+ rows = RELEASE[:3] + [_row(64, 16, 47_900, 3.96), _row(64, 4, 40_000, 2.9), _row(64, 1, 9_500, 1.0)]
+ assert width_at(served_tree_schedule(_rounds(rows), 16, 512), 64) == 1
+
+
+def test_no_change_without_a_loss_or_without_the_configured_width():
+ assert served_tree_schedule(_rounds([_row(8, 16, 12_500, 4.43), _row(8, 4, 9_000, 2.9)]), 16, 512) is None
+ # A batch size that did not time the configured width cannot show that it loses.
+ assert served_tree_schedule(_rounds([_row(64, 4, 20_000, 2.9)]), 16, 512) is None
+ assert served_tree_schedule({}, 16, 512) is None
+
+
+def test_wider_than_configured_is_never_chosen():
+ rows = RELEASE + [_row(64, 32, 1_000, 8.0)]
+ assert width_at(served_tree_schedule(_rounds(rows), 16, 512), 64) == 4
+
+
+def test_merge_keeps_other_widths_and_replaces_measured_cells(tmp_path):
+ merge_tree_rounds(str(tmp_path), [_row(8, 16, 12_000, 4.4), _row(64, 16, 48_000, 3.9)])
+ merge_tree_rounds(str(tmp_path), [_row(64, 16, 47_900, 3.96), _row(64, 4, 20_000, 2.9)])
+ rounds = load_tree_rounds(str(tmp_path))
+ assert rounds == {8: {16: (12_000.0, 4.4)}, 64: {16: (47_900.0, 3.96), 4: (20_000.0, 2.9)}}
+ data = json.loads((tmp_path / TREE_ROUNDS_FILE).read_text())
+ assert sorted((r["batch_size"], r["width"]) for r in data["rounds"]) == [(8, 16), (64, 4), (64, 16)]
+
+
+def test_load_is_none_without_measurements(tmp_path):
+ assert load_tree_rounds(str(tmp_path)) is None
+
+
+ "bad",
+ [
+ _row(0, 16, 1000, 2.0),
+ _row(8, 0, 1000, 2.0),
+ _row(8, 16, 0, 2.0),
+ _row(8, 16, 1000, 0.5), # a round commits at least the bonus token
+ ],
+)
+def test_merge_rejects_invalid_rows(tmp_path, bad):
+ with pytest.raises(ValueError):
+ merge_tree_rounds(str(tmp_path), [bad])
diff --git a/tests/test_tree_rejection_sampler.py b/tests/test_tree_rejection_sampler.py
new file mode 100644
index 0000000..80dc136
--- /dev/null
+++ b/tests/test_tree_rejection_sampler.py
@@ -0,0 +1,142 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree rejection sampler's output contract: vLLM reads the logprobs and the sampling mask of sampled token k of
+a request from logits row k of that request, so those rows must be the accepted path's rows, not the first rows of
+the tree (CPU through the Triton interpreter, or a GPU)."""
+
+import os
+from types import SimpleNamespace
+
+import numpy as np
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ["TRITON_INTERPRET"] = "1"
+
+pytest.importorskip("vllm")
+
+from eagle_harness.vllm.tree_accept import TreeRejectionSampler # noqa: E402
+from eagle_harness.vllm.verify_layout import TreeStore, VerifyStage # noqa: E402
+from tests.triton_probe import needs_triton # noqa: E402
+
+DEV = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+W, VOCAB, SLOTS, TOP_K, NUM_LOGPROBS = 8, 64, 4, 3, 3
+# Two requests (state slots 3 and 1). The first verifies 8 rows and accepts rows 0, 2, 5, 7; the second verifies
+# 5 rows and accepts rows 0, 1, 4. Neither path is a prefix of the rows.
+TREES = [([-1, 0, 0, 1, 1, 2, 3, 5], [0, 2, 5, 7], 3), ([-1, 0, 0, 1, 1], [0, 1, 4], 1)]
+
+
+class _Sampler:
+ """The parts of vLLM's ``Sampler`` the rejection sampler reads; ``top_k`` > 0 keeps only the top-k logits."""
+
+ def __init__(self, logprobs_mode: str, top_k: int):
+ self.compute_nans = False
+ self.use_fp64_gumbel = False
+ self.logprobs_mode = logprobs_mode
+ self.return_sampling_mask = top_k > 0
+ self.top_k = top_k
+ prefill_len = torch.zeros(SLOTS, dtype=torch.int32, device=DEV)
+ self.req_states = SimpleNamespace(prefill_len=SimpleNamespace(gpu=prefill_len))
+ self.sampling_states = SimpleNamespace(
+ max_num_logprobs=lambda idx_mapping_np: NUM_LOGPROBS,
+ top_k=SimpleNamespace(np=np.full(SLOTS, top_k)),
+ temperature=SimpleNamespace(gpu=torch.zeros(SLOTS, device=DEV)), # greedy
+ seeds=SimpleNamespace(gpu=torch.zeros(SLOTS, dtype=torch.int64, device=DEV)),
+ )
+
+ def apply_sampling_params(self, logits, *args):
+ if not self.top_k:
+ return logits # vLLM returns the raw logits themselves when no request needs processing
+ kth = logits.topk(self.top_k, dim=-1).values[:, -1:]
+ return logits.float().masked_fill(logits < kth, float("-inf"))
+
+
+def _batch():
+ """Seeded target logits, and draft tokens chosen so that the greedy walk accepts each request's path."""
+ gen = torch.Generator().manual_seed(7)
+ sizes = [len(parents) for parents, _, _ in TREES]
+ logits = torch.randn(sum(sizes), VOCAB, generator=gen)
+ drafted = torch.randint(0, VOCAB, (sum(sizes),), generator=gen)
+ start = 0
+ for (parents, path, _), size in zip(TREES, sizes):
+ argmax = logits[start : start + size].argmax(-1)
+ for row in range(1, size): # off-path rows never match their parent's argmax
+ if drafted[start + row] == argmax[parents[row]]:
+ drafted[start + row] = (argmax[parents[row]] + 1) % VOCAB
+ for parent, child in zip(path, path[1:]):
+ drafted[start + child] = argmax[parent]
+ start += size
+ return logits, drafted, sizes
+
+
+def _run(logprobs_mode: str, top_k: int, *, structured: bool = False):
+ logits, drafted, sizes = _batch()
+ num_reqs, num_logits = len(TREES), sum(sizes)
+ store, stage = TreeStore(SLOTS, W, DEV), VerifyStage(SLOTS, num_logits, W, DEV)
+ stage.active = False # positions are already chain positions
+ for parents, _, slot in TREES:
+ stage.slot_parents[slot, : len(parents)] = torch.tensor(parents, dtype=torch.int32)
+ slots = [slot for _, _, slot in TREES]
+ cu = np.concatenate([[0], np.cumsum(sizes)]).astype(np.int32)
+ batch = SimpleNamespace(
+ input_ids=drafted.to(DEV),
+ positions=torch.cat([torch.arange(size) + 40 for size in sizes]).to(DEV),
+ num_tokens=num_logits,
+ logits_indices=torch.arange(num_logits, device=DEV),
+ expanded_idx_mapping=torch.tensor(np.repeat(slots, sizes), dtype=torch.int32, device=DEV),
+ expanded_local_pos=torch.cat([torch.arange(size, dtype=torch.int32) for size in sizes]).to(DEV),
+ idx_mapping=torch.tensor(slots, dtype=torch.int32, device=DEV),
+ idx_mapping_np=np.array(slots),
+ cu_num_logits=torch.from_numpy(cu).to(DEV),
+ cu_num_logits_np=cu,
+ num_reqs=num_reqs,
+ has_structured_output_reqs=structured,
+ seq_lens=torch.tensor([40 + size for size in sizes], dtype=torch.int32, device=DEV),
+ seq_lens_cpu_upper_bound=torch.tensor([40 + size for size in sizes], dtype=torch.int32),
+ )
+ spec = SimpleNamespace(num_speculative_tokens=W - 1, enable_adaptive_verification=False, rejection_sample_method="")
+ sampler = _Sampler(logprobs_mode, top_k)
+ out = TreeRejectionSampler(sampler, spec, DEV, store, stage)(logits.clone().to(DEV), batch)
+ reference = sampler.apply_sampling_params(logits) if logprobs_mode.startswith("processed") else logits
+ return out, reference, cu
+
+
+@needs_triton
[email protected](("logprobs_mode", "top_k"), [("raw_logprobs", 0), ("processed_logprobs", TOP_K)])
+def test_logprobs_and_sampling_mask_come_from_the_accepted_path_rows(logprobs_mode, top_k):
+ out, reference, cu = _run(logprobs_mode, top_k)
+ lp = out.logprobs_tensors
+ for b, (_, path, _) in enumerate(TREES):
+ assert int(out.num_sampled[b]) == len(path)
+ tokens = out.sampled_token_ids[b, : len(path)].cpu()
+ assert tokens.tolist() == [int(reference[cu[b] + row].argmax()) for row in path]
+ rows = slice(cu[b], cu[b] + len(path))
+ top = reference[cu[b] + torch.tensor(path)].topk(NUM_LOGPROBS, dim=-1)
+ log_probs = reference[cu[b] + torch.tensor(path)].log_softmax(-1)
+ assert lp.logprob_token_ids[rows, 0].cpu().tolist() == tokens.tolist()
+ assert lp.logprob_token_ids[rows, 1:].cpu().tolist() == top.indices.tolist() # top-1 is the emitted token
+ torch.testing.assert_close(lp.logprobs[rows, 0].cpu(), log_probs.gather(-1, tokens[:, None])[:, 0])
+ torch.testing.assert_close(lp.logprobs[rows, 1:].cpu(), log_probs.gather(-1, top.indices))
+ if top_k:
+ mask = out.sampling_mask_tensors
+ for k, row in enumerate(path):
+ kept = torch.isfinite(reference[cu[b] + row]).nonzero()[:, 0]
+ assert mask.token_ids[b * W + k, :top_k].cpu().tolist() == kept.tolist()
+
+
+@needs_triton
[email protected](("logprobs_mode", "top_k"), [("raw_logprobs", 0), ("processed_logprobs", TOP_K)])
+def test_structured_output_never_accepts_a_row_with_a_chain_grammar_mask(logprobs_mode, top_k):
+ # vLLM supplies masks for a chain, not each tree node's ancestry. Only the root mask is valid;
+ # all other logits stand for arbitrary, potentially permissive masks after an invalid draft.
+ out, reference, cu = _run(logprobs_mode, top_k, structured=True)
+ assert out.num_sampled.cpu().tolist() == [1, 1]
+ for b in range(len(TREES)):
+ token = int(reference[cu[b]].argmax())
+ assert int(out.sampled_token_ids[b, 0]) == token
+ assert int(out.logprobs_tensors.logprob_token_ids[cu[b], 0]) == token
+ torch.testing.assert_close(
+ out.logprobs_tensors.logprobs[cu[b], 0].cpu(), reference[cu[b]].log_softmax(-1)[token]
+ )
diff --git a/tests/test_tree_round_kernels.py b/tests/test_tree_round_kernels.py
new file mode 100644
index 0000000..f772d03
--- /dev/null
+++ b/tests/test_tree_round_kernels.py
@@ -0,0 +1,154 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree round's small kernels against Python references (CPU through the Triton interpreter, or a GPU):
+the tree walk, the draft's re-ordering of the accepted rows, and the GDN state commit."""
+
+import os
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ["TRITON_INTERPRET"] = "1"
+
+pytest.importorskip("vllm")
+
+from vllm.model_executor.layers.mamba.mamba_utils import is_conv_state_dim_first # noqa: E402
+
+from eagle_harness.vllm.gdn_tree_verify import LinearStateCommit # noqa: E402
+from eagle_harness.vllm.round_commit import chainize # noqa: E402
+from eagle_harness.vllm.tree_accept import accept_tree # noqa: E402
+from eagle_harness.vllm.verify_layout import TreeStore # noqa: E402
+from tests.triton_probe import needs_triton # noqa: E402
+
+DEV = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+W = 8
+PARENTS = [-1, 0, 0, 1, 1, 2, 3, 5]
+
+
+def _walk(parents, drafted, target):
+ node, path, tokens = 0, [], []
+ while True:
+ path.append(node)
+ tokens.append(target[node])
+ children = [r for r in range(1, len(parents)) if parents[r] == node and drafted[r] == target[node]]
+ if not children:
+ return path, tokens
+ node = children[0]
+
+
+@needs_triton
+def test_walk_follows_the_matching_child_to_the_bonus_token():
+ torch.manual_seed(0)
+ store = TreeStore(4, W, DEV)
+ drafted = torch.randint(0, 3, (2, W)) # few distinct tokens: siblings and matches are common
+ target = torch.randint(0, 3, (2, W))
+ parents = torch.tensor([PARENTS, PARENTS[:5] + [-1] * 3], dtype=torch.int32, device=DEV)
+ cu = torch.tensor([0, W, W + 5], dtype=torch.int32, device=DEV)
+ slots = torch.tensor([3, 1], dtype=torch.int32, device=DEV) # request state slots
+ slot_parents = torch.full_like(store.path, -1)
+ slot_parents[slots.long()] = parents
+ sampled, num_sampled = accept_tree(
+ target.reshape(-1)[: W + 5].to(DEV), drafted.reshape(-1)[: W + 5].to(DEV), cu, slots, slot_parents, store
+ )
+ for b, (n, plist) in enumerate([(W, PARENTS), (5, PARENTS[:5])]):
+ path, tokens = _walk(plist, drafted[b, :n].tolist(), target[b, :n].tolist())
+ assert int(num_sampled[b]) == len(path)
+ assert sampled[b, : len(path)].tolist() == tokens
+ assert int(store.path_len[int(slots[b])]) == len(path)
+ assert store.path[int(slots[b]), : len(path)].tolist() == path
+
+
+@needs_triton
[email protected]("batch_size", [33, 64, 128, 256, 512])
+def test_large_batch_walk_keeps_request_paths_separate(batch_size):
+ gen = torch.Generator().manual_seed(batch_size)
+ store = TreeStore(batch_size, W, DEV)
+ drafted = torch.randint(0, 3, (batch_size, W), generator=gen)
+ target = torch.randint(0, 3, (batch_size, W), generator=gen)
+ widths = [W if b % 2 == 0 else 5 for b in range(batch_size)]
+ parents = torch.tensor([PARENTS[:n] + [-1] * (W - n) for n in widths], dtype=torch.int32, device=DEV)
+ cu = torch.tensor([0] + widths, dtype=torch.int32, device=DEV).cumsum(0).to(torch.int32)
+ slots = torch.randperm(batch_size, generator=gen).to(device=DEV, dtype=torch.int32)
+ sampled, num_sampled = accept_tree(
+ torch.cat([target[b, :n] for b, n in enumerate(widths)]).to(DEV),
+ torch.cat([drafted[b, :n] for b, n in enumerate(widths)]).to(DEV),
+ cu,
+ slots,
+ parents,
+ store,
+ )
+ sampled, num_sampled = sampled.cpu(), num_sampled.cpu()
+ paths, lengths, slots = store.path.cpu(), store.path_len.cpu(), slots.cpu()
+ for b, n in enumerate(widths):
+ path, tokens = _walk(PARENTS[:n], drafted[b, :n].tolist(), target[b, :n].tolist())
+ assert int(num_sampled[b]) == len(path)
+ assert sampled[b, : len(path)].tolist() == tokens
+ assert int(lengths[int(slots[b])]) == len(path)
+ assert paths[int(slots[b]), : len(path)].tolist() == path
+
+
+def test_chainize_puts_the_accepted_rows_in_path_order():
+ store = TreeStore(4, W, DEV)
+ store.path[2, :4] = torch.tensor([0, 2, 5, 7], dtype=torch.int32, device=DEV)
+ store.path_len[2] = 4
+ context = 30
+ qsl = torch.tensor([0, W, W + 1], dtype=torch.int32, device=DEV)
+ cu = torch.tensor([0, W, W + 1], dtype=torch.int32, device=DEV) # the second request is a plain decode
+ seq_lens = torch.tensor([context + W, 50], dtype=torch.int32, device=DEV)
+ input_ids = torch.arange(100, 100 + W + 1, dtype=torch.int64, device=DEV)
+ positions = torch.tensor([context + d for d in (0, 1, 1, 2, 2, 2, 3, 3)] + [49], dtype=torch.int64, device=DEV)
+ sampled = torch.tensor([[11, 12, 13, 14] + [0] * 4, [9] + [0] * 7], dtype=torch.int64, device=DEV)
+ src = torch.arange(W + 1, dtype=torch.int64, device=DEV)
+ chainize(
+ input_ids,
+ positions,
+ src,
+ idx_mapping=torch.tensor([2, 0], dtype=torch.int64, device=DEV),
+ query_start_loc=qsl,
+ cu_num_logits=cu,
+ seq_lens=seq_lens,
+ path=store.path,
+ path_len=store.path_len,
+ sampled=sampled,
+ width=W,
+ )
+ assert src[:W].tolist() == [0, 2, 5, 7, 4, 5, 6, 7] and src[W] == W
+ assert positions[:W].tolist() == [context + r for r in range(W)] and positions[W] == 49
+ # row j holds the token the draft is given with it: the sampled token j - 1 (row 0 keeps the root)
+ assert input_ids[:4].tolist() == [100, 11, 12, 13]
+ assert input_ids[4:W].tolist() == [104, 105, 106, 107]
+
+
+def test_commit_moves_the_accepted_rows_into_chain_order():
+ layers = 3
+ dim, state_len, slots_per_req, heads_state = 6, 3 + W, W + 1, 5
+
+ dim_first = is_conv_state_dim_first()
+
+ def window(raw): # the (slots, dim, state_len) view the kernels see
+ return raw if dim_first else raw.transpose(-1, -2)
+
+ class Layer:
+ def __init__(self):
+ shape = (20, dim, state_len) if dim_first else (20, state_len, dim)
+ self.kv_cache = (torch.randn(shape, device=DEV), torch.randn(20, heads_state, device=DEV))
+
+ modules = [Layer() for _ in range(layers)]
+ store = TreeStore(4, W, DEV)
+ store.path[1, :3] = torch.tensor([0, 3, 6], dtype=torch.int32, device=DEV)
+ store.path_len[1] = 3
+ slots = torch.arange(2, 2 + slots_per_req, dtype=torch.int32, device=DEV)[None]
+ before = [(window(c).clone(), s.clone()) for c, s in (m.kv_cache for m in modules)]
+ LinearStateCommit(modules, [slots] * len(modules), DEV).commit(
+ torch.tensor([1], dtype=torch.int64, device=DEV), store.path, store.path_len
+ )
+ for module, (conv0, ssm0) in zip(modules, before):
+ conv, ssm = window(module.kv_cache[0]), module.kv_cache[1]
+ at = int(slots[0, 0])
+ torch.testing.assert_close(conv[at, :, 2], conv0[at, :, 2]) # row 0 stays
+ torch.testing.assert_close(conv[at, :, 3], conv0[at, :, 2 + 3]) # path row 1 came from column 2 + 3
+ torch.testing.assert_close(conv[at, :, 4], conv0[at, :, 2 + 6])
+ torch.testing.assert_close(ssm[int(slots[0, 2])], ssm0[int(slots[0, 6])]) # the last accepted row's state
+ torch.testing.assert_close(ssm[int(slots[0, 6])], ssm0[int(slots[0, 6])])
diff --git a/tests/test_tree_sampling.py b/tests/test_tree_sampling.py
new file mode 100644
index 0000000..9eb16df
--- /dev/null
+++ b/tests/test_tree_sampling.py
@@ -0,0 +1,264 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree rejection sampler is lossless: decoded through draft trees over several rounds, seeded requests emit
+token sequences whose distribution is the target's (a chi-square goodness of fit against the exact sequence
+probabilities), and a request's seed fixes its text (CPU through the Triton interpreter, or a GPU).
+
+The target is a toy model: the logits after a context are a seeded function of the context. Each round, every
+request drafts a fixed-shape tree of its context's draft top tokens and is verified in one batch with the others.
+"""
+
+import os
+import zlib
+from types import SimpleNamespace
+
+import numpy as np
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ["TRITON_INTERPRET"] = "1"
+
+pytest.importorskip("vllm")
+
+from vllm.v1.worker.gpu.sample.bad_words import BadWordsState # noqa: E402
+from vllm.v1.worker.gpu.sample.gumbel import gumbel_sample # noqa: E402
+from vllm.v1.worker.gpu.sample.logit_bias import LogitBiasState # noqa: E402
+from vllm.v1.worker.gpu.sample.penalties import PenaltiesState # noqa: E402
+from vllm.v1.worker.gpu.sample.states import NO_LOGPROBS # noqa: E402
+
+from eagle_harness.vllm.tree_accept import TreeRejectionSampler # noqa: E402
+from eagle_harness.vllm.verify_layout import TreeStore, VerifyStage # noqa: E402
+from tests.triton_probe import needs_triton # noqa: E402
+
+DEV = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+VOCAB, TOP_K, TEMPERATURE = 4, 3, 0.8 # top-k 3 of 4 tokens: one token is never sampled
+PARENTS = [-1, 0, 0, 1, 3] # rows 1 and 2 are siblings, 1 -> 3 -> 4 a chain below them
+CHILD_RANK = [None, 0, 1, 0, 0] # each row's token: the draft's rank-th token after its parent's context
+PROMPT_LEN, LENGTH, ROUNDS = 40, 3, 3 # every round emits at least one token
+REQUESTS = 4096 if torch.cuda.is_available() else 512
+
+
+def _logits(context: tuple, salt: int) -> torch.Tensor:
+ gen = torch.Generator().manual_seed(zlib.crc32(repr((salt, context)).encode()))
+ return 1.5 * torch.randn(VOCAB, generator=gen)
+
+
+def target_logits(context: tuple) -> torch.Tensor:
+ return _logits(context, 0)
+
+
+def processed(logits: torch.Tensor) -> torch.Tensor:
+ """Temperature, then top-k: what vLLM's ``apply_sampling_params`` hands the sampler."""
+ logits = logits.float() / TEMPERATURE
+ kth = logits.topk(TOP_K, dim=-1).values[..., -1:]
+ return logits.masked_fill(logits < kth, float("-inf"))
+
+
+def draft_tree(context: tuple) -> list:
+ """The tree's tokens, row 0 (the context's last token) first; the draft ranks tokens by its own toy logits."""
+ contexts, tokens = [context], [context[-1]]
+ for parent, rank in zip(PARENTS[1:], CHILD_RANK[1:]):
+ draft = target_logits(contexts[parent]) + _logits(contexts[parent], 1) # a draft that is often right
+ token = int(draft.argsort(descending=True)[rank])
+ contexts.append(contexts[parent] + (token,))
+ tokens.append(token)
+ return tokens
+
+
+class _Sampler:
+ """The parts of vLLM's ``Sampler`` the rejection sampler reads: temperature and top-k, one seed per request."""
+
+ def __init__(self, seeds: torch.Tensor, temperature: float):
+ slots = seeds.shape[0]
+ self.compute_nans = False
+ self.use_fp64_gumbel = False
+ self.logprobs_mode = "raw_logprobs"
+ self.return_sampling_mask = False
+ prefill_len = torch.zeros(slots, dtype=torch.int32, device=DEV)
+ self.req_states = SimpleNamespace(prefill_len=SimpleNamespace(gpu=prefill_len))
+ self.sampling_states = SimpleNamespace(
+ max_num_logprobs=lambda idx_mapping_np: NO_LOGPROBS,
+ temperature=SimpleNamespace(gpu=torch.full((slots,), temperature, device=DEV)),
+ seeds=SimpleNamespace(gpu=seeds.to(DEV)),
+ )
+
+ def apply_sampling_params(self, logits, *args):
+ return processed(logits)
+
+
+def decode(seeds: list, temperature: float = TEMPERATURE, prompts: list | None = None) -> list:
+ """``ROUNDS`` tree rounds of every request (one per seed, prompt ``(seed % 2,)`` unless ``prompts`` gives each
+ request's prompt token); the emitted tokens of each."""
+ n = len(seeds)
+ store, stage = TreeStore(n, len(PARENTS), DEV), VerifyStage(n, n * len(PARENTS), len(PARENTS), DEV)
+ store.parents[:] = torch.tensor(PARENTS, dtype=torch.int32)
+ sampler = _Sampler(torch.tensor(seeds, dtype=torch.int64), temperature)
+ spec = SimpleNamespace(
+ num_speculative_tokens=len(PARENTS) - 1, enable_adaptive_verification=False, rejection_sample_method=""
+ )
+ rejection = TreeRejectionSampler(sampler, spec, DEV, store, stage)
+ width, slots = len(PARENTS), np.arange(n)
+ # the prompt's last token starts each context
+ emitted = [[seed % 2] for seed in seeds] if prompts is None else [[prompt] for prompt in prompts]
+ for _ in range(ROUNDS):
+ trees = [draft_tree(tuple(tokens)) for tokens in emitted]
+ contexts = []
+ for tokens, tree in zip(emitted, trees):
+ rows = [tuple(tokens)]
+ for parent, token in zip(PARENTS[1:], tree[1:]):
+ rows.append(rows[parent] + (token,))
+ contexts += rows
+ logits = torch.stack([target_logits(context) for context in contexts]).to(DEV)
+ lengths = torch.tensor([PROMPT_LEN + len(tokens) - 1 for tokens in emitted]) # the root's position
+ positions = (lengths[:, None] + torch.arange(width)).flatten().to(DEV)
+ qsl = torch.arange(0, (n + 1) * width, width, dtype=torch.int32, device=DEV)
+ idx_mapping = torch.from_numpy(slots).to(torch.int32).to(DEV)
+ stage.stage(store, idx_mapping, qsl, qsl, positions, n, n * width, tree=True)
+ batch = SimpleNamespace(
+ input_ids=torch.tensor(trees, dtype=torch.int64).flatten().to(DEV),
+ positions=positions,
+ num_tokens=n * width,
+ logits_indices=torch.arange(n * width, device=DEV),
+ expanded_idx_mapping=idx_mapping.repeat_interleave(width),
+ expanded_local_pos=torch.arange(width, dtype=torch.int32, device=DEV).repeat(n),
+ idx_mapping=idx_mapping,
+ idx_mapping_np=slots,
+ cu_num_logits=qsl,
+ cu_num_logits_np=qsl.cpu().numpy(),
+ num_reqs=n,
+ seq_lens=(lengths + width).to(torch.int32).to(DEV),
+ seq_lens_cpu_upper_bound=(lengths + width).to(torch.int32),
+ )
+ out = rejection(logits, batch)
+ sampled, count = out.sampled_token_ids.cpu().tolist(), out.num_sampled.cpu().tolist()
+ for tokens, row, k in zip(emitted, sampled, count):
+ tokens += row[:k]
+ return [tokens[1:] for tokens in emitted]
+
+
+def decode_without_speculation(seeds: list, steps: int) -> list:
+ """What vLLM's sampler emits one token at a time: Gumbel-max of the processed logits, keyed by seed and position."""
+ n = len(seeds)
+ slots = torch.arange(n, dtype=torch.int32, device=DEV)
+ temperature = torch.full((n,), TEMPERATURE, device=DEV)
+ emitted = [[seed % 2] for seed in seeds]
+ for step in range(steps):
+ logits = torch.stack([processed(target_logits(tuple(tokens))) for tokens in emitted]).to(DEV)
+ pos = torch.full((n,), PROMPT_LEN + step, dtype=torch.int64, device=DEV) # the last token's position
+ seed = torch.tensor(seeds, dtype=torch.int64, device=DEV)
+ tokens = gumbel_sample(logits, slots, temperature, seed, pos, apply_temperature=False, is_drafting=False)
+ for text, token in zip(emitted, tokens.tolist()):
+ text.append(token)
+ return [tokens[1:] for tokens in emitted]
+
+
+def exact_probability(prompt: int, sequence: tuple) -> float:
+ context, prob = (prompt,), 1.0
+ for token in sequence:
+ prob *= float(torch.softmax(processed(target_logits(context)), -1)[token])
+ context += (token,)
+ return prob
+
+
+def chi_square_p_value(observed: dict, expected: dict, count: int) -> float:
+ """Goodness of fit; cells expected fewer than 5 times are pooled into one, and an impossible cell fails outright."""
+ if any(expected.get(cell, 0.0) == 0.0 for cell in observed):
+ return 0.0
+ big = [cell for cell, p in expected.items() if count * p >= 5]
+ pairs = [(observed.get(cell, 0), count * expected[cell]) for cell in big]
+ rest = count - sum(count * expected[cell] for cell in big)
+ if rest > 1e-9:
+ pairs.append((count - sum(o for o, _ in pairs), rest))
+ stat = sum((o - e) ** 2 / e for o, e in pairs)
+ dof = torch.tensor((len(pairs) - 1) / 2.0, dtype=torch.float64)
+ return float(torch.special.gammaincc(dof, torch.tensor(stat / 2.0, dtype=torch.float64)))
+
+
+@needs_triton
+def test_emitted_sequences_follow_the_target_distribution():
+ seeds = list(range(1000, 1000 + REQUESTS))
+ texts = decode(seeds)
+ assert all(len(text) >= LENGTH for text in texts)
+ cells = [tuple(map(int, np.unravel_index(i, (VOCAB,) * LENGTH))) for i in range(VOCAB**LENGTH)]
+ for prompt in (0, 1):
+ prefixes = [tuple(text[:LENGTH]) for seed, text in zip(seeds, texts) if seed % 2 == prompt]
+ observed: dict = {}
+ for prefix in prefixes:
+ observed[prefix] = observed.get(prefix, 0) + 1
+ expected = {cell: exact_probability(prompt, cell) for cell in cells}
+ assert abs(sum(expected.values()) - 1.0) < 1e-5
+ assert chi_square_p_value(observed, expected, len(prefixes)) > 1e-4, (prompt, observed)
+ accepted = sum(len(text) for text in texts) / (REQUESTS * ROUNDS)
+ assert accepted > 1.2, accepted # the drafts are accepted, not only the bonus token
+
+
+@needs_triton
+def test_a_seed_fixes_the_text_and_greedy_is_the_argmax_path():
+ seeds = [7, 8, 7, 9, 8, 10, 11, 12]
+ texts = decode(seeds)
+ assert texts[0] == texts[2] and texts[1] == texts[4]
+ # Each emitted token takes the noise of its own position, as without speculation: the same text for a seed.
+ reference = decode_without_speculation(seeds, max(len(text) for text in texts))
+ assert [ref[: len(text)] for text, ref in zip(texts, reference)] == texts
+ greedy = decode([3, 4], temperature=0.0)
+ for prompt, text in zip((1, 0), greedy):
+ context = (prompt,)
+ for token in text:
+ assert token == int(processed(target_logits(context)).argmax())
+ context += (token,)
+
+
+@needs_triton
+def test_different_seeds_sample_different_text():
+ """The QA matrix's seed probe (resume/qa-matrix.md item 1): at temperature 1 the tree verify returned the same text
+ for seeds 1 and 2 on every prompt, because it walked the argmax. Each of 4 prompts with seeds 1 and 2 must give
+ two different texts but at most once by chance."""
+ prompts = [0, 1, 2, 3] * 2
+ texts = decode([1] * 4 + [2] * 4, temperature=1.0, prompts=prompts)
+ same = sum(texts[i] == texts[i + 4] for i in range(4))
+ assert same <= 1, texts
+
+
+def _processing_sampler(slots: int, custom: bool = False) -> SimpleNamespace:
+ """A sampler whose per-request processing flags a test sets: vLLM's three native logits processors (built
+ without their tensors), a thinking budget, and optionally a custom processor."""
+ penalties, bad_words, bias = (object.__new__(cls) for cls in (PenaltiesState, BadWordsState, LogitBiasState))
+ penalties.use_penalty = np.zeros(slots, dtype=bool)
+ bad_words.num_bad_words = SimpleNamespace(np=np.zeros(slots, dtype=np.int32))
+ processors = [bias, penalties, bad_words] + ([SimpleNamespace()] if custom else [])
+ return SimpleNamespace(
+ needs_logits_processing=np.zeros(slots, dtype=bool),
+ logits_processors=processors,
+ penalties=penalties,
+ bad_words=bad_words,
+ thinking_budget_state=SimpleNamespace(enabled=False), # no reasoning config: no per-request flags
+ )
+
+
+def test_prefix_reading_processing_is_verified_as_chains():
+ """Penalties, bad words, a thinking budget and custom processors read each row's prefix, which in a tree is not
+ the row's ancestors: such a batch must be verified as chains. Temperature, top-k/top-p and logit bias must not
+ cost the tree."""
+ rejection = object.__new__(TreeRejectionSampler)
+ batch, other = np.array([0, 1]), np.array([2, 3])
+ rejection.sampler = sampler = _processing_sampler(4)
+ assert not rejection.reads_draft_prefix(batch)
+ sampler.needs_logits_processing[:] = True # temperature, top-k/top-p, min-p or logit bias
+ assert not rejection.reads_draft_prefix(batch)
+ for flag in (
+ lambda s: s.penalties.use_penalty.__setitem__(2, True),
+ lambda s: s.bad_words.num_bad_words.np.__setitem__(3, 1),
+ lambda s: setattr(
+ s, "thinking_budget_state", SimpleNamespace(enabled=True, use_thinking_budget=np.eye(4)[2] > 0)
+ ),
+ ):
+ rejection.sampler = sampler = _processing_sampler(4)
+ sampler.needs_logits_processing[:] = True
+ flag(sampler)
+ assert rejection.reads_draft_prefix(other) and not rejection.reads_draft_prefix(batch)
+ rejection.sampler = sampler = _processing_sampler(4, custom=True)
+ assert not rejection.reads_draft_prefix(batch) # no request asks for processing
+ sampler.needs_logits_processing[1] = True
+ assert rejection.reads_draft_prefix(batch)
diff --git a/tests/test_tree_step_attention.py b/tests/test_tree_step_attention.py
new file mode 100644
index 0000000..5b0b4ea
--- /dev/null
+++ b/tests/test_tree_step_attention.py
@@ -0,0 +1,146 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""A draft step's shared-key attention (:func:`tree_step_attention`) against the per-row path it replaces
+(:func:`build_tree_rows` + :func:`row_attention`) and a dense torch reference."""
+
+import pytest
+import torch
+
+from tests.triton_probe import needs_triton
+
+DEV = "cuda" if torch.cuda.is_available() else "cpu"
+# The Triton interpreter's tl.dot mishandles bf16 operands (garbage values); on CPU the kernel runs on fp32 data.
+DTYPE = torch.bfloat16 if DEV == "cuda" else torch.float32
+
+
+def _case(bs, top_k, heads, d, step, committed, window, cache_block=16, per_table_block=4, depth=6, kv_heads=None):
+ gen = torch.Generator().manual_seed(bs * 100 + step)
+ table_block = cache_block * per_table_block
+ max_blocks = 8
+ num_cache_blocks = bs * max_blocks * per_table_block + 8
+ raw = torch.randn(num_cache_blocks, kv_heads or heads, cache_block, 2 * d, generator=gen).to(DTYPE)
+ kv = raw.to(DEV).transpose(1, 2) # the drafter's view: [blocks, slots, heads, 2 * D]
+ table = torch.randperm(bs * max_blocks, generator=gen).view(bs, max_blocks).int()
+ committed_t = torch.tensor(committed, dtype=torch.int64)
+ # ancestors: flat token slots past the committed length (the drafter's scratch slots)
+ ancestors = torch.zeros(bs, top_k, depth, dtype=torch.int32)
+ for b in range(bs):
+ for lane in range(top_k):
+ for s in range(step):
+ p = committed[b] + s * top_k + lane
+ ancestors[b, lane, s] = int(table[b, p // table_block]) * table_block + p % table_block
+ q = torch.randn(bs * top_k, heads, d, generator=gen).to(DTYPE)
+ return q.to(DEV), kv, table.to(DEV), table_block, committed_t.to(DEV), ancestors.to(DEV)
+
+
+@needs_triton
+ "bs, step, committed, window",
+ [(1, 1, [70], 0), (2, 3, [5, 200], 0), (1, 4, [300], 100), (2, 2, [129, 64], 64)],
+)
[email protected]("group_size", [1, 2, 4, 8])
+def test_tree_step_attention_matches_the_per_row_kernel(bs, step, committed, window, group_size):
+ from eagle_harness.vllm.draft_attention import build_tree_rows, row_attention, tree_step_attention
+
+ top_k, heads, d = 4, 8, 64
+ kv_heads = heads // group_size
+ q, kv, table, table_block, committed_t, ancestors = _case(
+ bs, top_k, heads, d, step, committed, window, kv_heads=kv_heads
+ )
+ keys = torch.zeros(bs * top_k, 512, dtype=torch.int32, device=DEV)
+ num_keys = torch.zeros(bs * top_k, dtype=torch.int32, device=DEV)
+ build_tree_rows(table, table_block, committed_t, ancestors, keys, num_keys, step=step, window=window)
+ want = row_attention(q, kv, keys, num_keys, d**-0.5)
+ got = tree_step_attention(q, kv, table, table_block, committed_t, ancestors, d**-0.5, step=step, window=window)
+ torch.testing.assert_close(got.float(), want.float(), atol=2e-2, rtol=2e-2)
+ # dense reference of one row: the last row of the last request
+ r = bs * top_k - 1
+ n = int(num_keys[r])
+ slots = keys[r, :n].long()
+ flat = kv.reshape(-1, kv_heads, 2 * d)[slots].repeat_interleave(group_size, dim=1)
+ scores = torch.einsum("hd,khd->hk", q[r].float(), flat[..., :d].float()) * d**-0.5
+ dense = torch.einsum("hk,khd->hd", scores.softmax(-1), flat[..., d:].float())
+ torch.testing.assert_close(got[r].float(), dense, atol=2e-2, rtol=2e-2)
+
+
+@needs_triton
[email protected]("group_size", [1, 2, 4, 8])
[email protected]("packed", [False, True])
[email protected]("step,window", [(0, 0), (0, 7), (3, 0), (3, 2)])
+def test_shared_rows_gqa_matches_torch_and_repeated_mha(group_size, packed, step, window):
+ from eagle_harness.kernels.row_attention import RowsLaunch, rows_attention, rows_padded
+
+ gen = torch.Generator().manual_seed(813 + group_size + step)
+ bs, rows, heads, dim, slots = 2, 3, 8, 64, 256
+ kv_heads = heads // group_size
+ q = torch.randn(bs * rows, heads, dim, generator=gen).to(device=DEV, dtype=DTYPE)
+ # Separate K/V have different strides; packed K/V preserves the one-pointer path.
+ keys = torch.randn(slots, kv_heads, 2 * dim, generator=gen).to(device=DEV, dtype=DTYPE)
+ values = (
+ None if packed else torch.randn(kv_heads, slots, dim, generator=gen).to(device=DEV, dtype=DTYPE).transpose(0, 1)
+ )
+ if not packed:
+ keys = keys[..., :dim]
+ table = torch.randperm(slots, generator=gen).int().reshape(4, 64).to(DEV)
+ table_rows = torch.tensor([3, 1], device=DEV)
+ lengths = torch.tensor([0, 43], device=DEV)
+ ancestors = torch.randint(slots, (bs, rows, 3), generator=gen).int().to(DEV)
+ launch = RowsLaunch(splits=4, block_n=32)
+ parts = torch.empty(bs, heads, launch.splits + 1, rows_padded(rows), dim, device=DEV)
+ lse = torch.empty(parts.shape[:-1], device=DEV)
+
+ def run(k, v):
+ out = torch.empty_like(q)
+ rows_attention(
+ q,
+ k,
+ v,
+ out,
+ parts,
+ lse,
+ table,
+ lengths,
+ ancestors,
+ rows_per_request=rows,
+ step=step,
+ window=window,
+ scale=dim**-0.5,
+ launch=launch,
+ table_rows=table_rows,
+ )
+ return out
+
+ got = run(keys, values)
+ repeated = run(
+ keys.repeat_interleave(group_size, dim=1), None if packed else values.repeat_interleave(group_size, dim=1)
+ )
+ assert torch.equal(got, repeated)
+ k = keys[..., :dim].repeat_interleave(group_size, dim=1).float()
+ v = (keys[..., dim:] if packed else values).repeat_interleave(group_size, dim=1).float()
+ for b in range(bs):
+ length = int(lengths[b])
+ for row in range(rows):
+ pos = length + (step - 1 if step else row)
+ start = max(0, pos - window + 1) if window else 0
+ end = length if step else pos + 1
+ selected = table[table_rows[b], min(start, end) : end]
+ if step:
+ selected = torch.cat((selected, ancestors[b, row, :step]))
+ selected = selected.long()
+ scores = torch.einsum("hd,nhd->hn", q[b * rows + row].float(), k[selected]) * dim**-0.5
+ want = torch.einsum("hn,nhd->hd", scores.softmax(-1), v[selected])
+ torch.testing.assert_close(got[b * rows + row].float(), want, atol=2e-2, rtol=2e-2)
+
+
+@needs_triton
[email protected]("kv_heads", [0, 3, 16])
+def test_rows_reject_nonintegral_query_groups(kv_heads):
+ from eagle_harness.vllm.draft_attention import row_attention, tree_step_attention
+
+ q, cache, table, table_block, lengths, ancestors = _case(1, 4, 8, 64, 1, [70], 0)
+ invalid = torch.empty(cache.shape[0], cache.shape[1], kv_heads, cache.shape[3], device=DEV)
+ with pytest.raises(ValueError, match="must be divisible"):
+ tree_step_attention(q, invalid, table, table_block, lengths, ancestors, 0.125, step=1, window=0)
+ with pytest.raises(ValueError, match="must be divisible"):
+ row_attention(q, invalid, table, lengths, 0.125)
diff --git a/tests/test_tree_step_gpu.py b/tests/test_tree_step_gpu.py
new file mode 100644
index 0000000..f3c5f53
--- /dev/null
+++ b/tests/test_tree_step_gpu.py
@@ -0,0 +1,107 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The Triton tree step, work deltas, ranking and selection against DraftTree's torch reference (skipped
+without CUDA).
+
+Run in a GPU job: ``pytest -q tests/test_tree_step_gpu.py``.
+"""
+
+import pytest
+import torch
+
+from eagle_harness.core.draft_tree import DraftTree, TreeShape
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a CUDA device")
+
+BUFFERS = (
+ "scores",
+ "tokens",
+ "parents",
+ "front_scores",
+ "front_tokens",
+ "front_hidden",
+ "ancestors",
+ "best",
+ "best_prev",
+ "layer_top",
+)
+
+
+def _tree(k, depth, bs, h, cap):
+ return DraftTree(TreeShape(k, depth, work_cap=cap), bs, h, torch.bfloat16, torch.device("cuda"), max_verify=cap)
+
+
+ "k,depth,bs,h,cap",
+ [(4, 12, 1, 5120, 64), (4, 12, 3, 5120, 64), (8, 6, 2, 256, 32), (1, 6, 1, 256, 8)]
+ + [(4, 6, bs, 256, 32) for bs in (33, 64, 128, 256, 512)],
+)
+def test_tree_step_kernel_matches_reference(k, depth, bs, h, cap):
+ gen = torch.Generator(device="cuda").manual_seed(k * 1000 + bs)
+ trees = [_tree(k, depth, bs, h, cap) for _ in range(2)]
+ root_p = torch.rand(bs, k, device="cuda", generator=gen).softmax(-1)
+ root_ids = torch.randint(0, 1000, (bs, k), device="cuda", generator=gen)
+ root_h = torch.randn(bs, h, device="cuda", generator=gen).to(torch.bfloat16)
+ for tree in trees:
+ tree.stage_root(bs, root_p, root_ids, root_h)
+ tree.begin(bs)
+ for step in range(1, depth):
+ p = torch.sort(torch.rand(bs * k, k, device="cuda", generator=gen).softmax(-1), dim=-1, descending=True).values
+ ids = torch.randint(0, 248320, (bs * k, k), device="cuda", generator=gen)
+ hidden = torch.randn(bs * k, h, device="cuda", generator=gen).to(torch.bfloat16)
+ slots = torch.randint(0, 10**6, (bs, k), device="cuda", generator=gen)
+ for tree in trees:
+ tree.set_step_slots(bs, step, slots)
+ trees[0].step(bs, step, p, ids, hidden) # CUDA: the Triton kernels
+ trees[1].step_reference(bs, step, p, ids, hidden)
+ trees[1]._store_deltas_reference(bs, step)
+ for name in BUFFERS:
+ got, want = getattr(trees[0], name)[:bs], getattr(trees[1], name)[:bs]
+ assert torch.equal(got, want), (step, name)
+ # the kernel sums in another order than torch.cumsum: equal to fp32 rounding
+ torch.testing.assert_close(trees[0].deltas[step], trees[1].deltas[step], rtol=1e-5, atol=1e-6)
+
+
+ "k,bs,h,cap",
+ [(4, 1, 5120, 64), (4, 5, 5120, 64), (8, 3, 256, 32)] + [(4, bs, 256, 32) for bs in (33, 64, 128, 256, 512)],
+)
+def test_tree_begin_kernel_matches_reference(k, bs, h, cap):
+ gen = torch.Generator(device="cuda").manual_seed(k * 100 + bs)
+ trees = [_tree(k, 12, bs, h, cap) for _ in range(2)]
+ root_p = torch.rand(bs, k, device="cuda", generator=gen).softmax(-1)
+ root_p[0, 1] = root_p[0, 2] # a tie
+ root_ids = torch.randint(0, 248320, (bs, k), device="cuda", generator=gen)
+ root_h = torch.randn(bs, h, device="cuda", generator=gen).to(torch.bfloat16)
+ for tree in trees:
+ tree.stage_root(bs, root_p, root_ids, root_h)
+ trees[0].begin(bs) # CUDA: the Triton kernels
+ trees[1].begin_reference(bs)
+ trees[1]._store_deltas_reference(bs, 0)
+ for name in BUFFERS:
+ got, want = getattr(trees[0], name)[:bs], getattr(trees[1], name)[:bs]
+ assert torch.equal(got, want), name
+ torch.testing.assert_close(trees[0].deltas[0], trees[1].deltas[0], rtol=1e-5, atol=1e-6)
+
+
+ "k,depth,bs,count,width",
+ [(4, 12, 1, 15, 16), (4, 4, 3, 63, 8), (8, 6, 2, 32, 2), (4, 2, 1, 1, 2)]
+ + [(4, 6, bs, 31, 16) for bs in (33, 64, 128, 256, 512)],
+)
+def test_rank_and_select_kernels_match_reference(k, depth, bs, count, width):
+ gen = torch.Generator(device="cuda").manual_seed(k * 10 + depth)
+ tree = _tree(k, 12, bs, 64, 64)
+ tree.scores.copy_(torch.rand(tree.scores.shape, device="cuda", generator=gen))
+ tree.scores[:, 1] = tree.scores[:, 2] # a tie: the lower node first
+ tree.tokens.copy_(torch.randint(0, 248320, tree.tokens.shape, device="cuda", generator=gen))
+ count = min(count, tree.shape.num_nodes(depth))
+ ranked, cum = tree.rank(bs, depth, count) # CUDA: the Triton kernel
+ want_ranked, want_cum = tree.rank_reference(bs, depth, count)
+ assert torch.equal(ranked, want_ranked)
+ torch.testing.assert_close(cum, want_cum, rtol=1e-6, atol=1e-6) # another summation order
+ got = tree.select(bs, depth, ranked, width)
+ index = torch.sort(want_ranked[:, : width - 1], dim=-1).values
+ assert torch.equal(got.top_scores_index, index)
+ assert torch.equal(got.draft_tokens, torch.gather(tree.tokens[:bs], 1, index))
diff --git a/tests/test_verify_attention.py b/tests/test_verify_attention.py
new file mode 100644
index 0000000..a435079
--- /dev/null
+++ b/tests/test_verify_attention.py
@@ -0,0 +1,92 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Tree verify attention (:func:`verify_attention`) against a dense torch reference: paged committed context plus each
+row's ancestors among the new tokens, several requests of different widths, grouped query heads."""
+
+import pytest
+import torch
+
+from tests.triton_probe import needs_triton
+
+DEV = "cuda" if torch.cuda.is_available() else "cpu"
+# The Triton interpreter's tl.dot mishandles bf16 operands (garbage values); on CPU the kernel runs on fp32 data.
+DTYPE = torch.bfloat16 if DEV == "cuda" else torch.float32
+
+
+def _masks(parents: list[int], width: int) -> list[int]:
+ masks = []
+ for r, parent in enumerate(parents):
+ masks.append((1 << r) | (masks[parent] if parent >= 0 else 0))
+ return masks + [0] * (width - len(masks))
+
+
+def _dense(q, k, v, scale):
+ """Scores ``[Hq, rows, keys]`` of ``q`` over ``k``, and ``v`` repeated for each query head."""
+ group = q.shape[1] // k.shape[1]
+ k, v = k.repeat_interleave(group, 1), v.repeat_interleave(group, 1)
+ return torch.einsum("qhd,khd->hqk", q, k) * scale, v
+
+
+@needs_triton
+ "contexts, parents, heads, kv_heads, d, page",
+ [
+ ([300], [[-1, 0, 0, 1, 1, 2, 3]], 6, 1, 64, 16),
+ ([5, 700, 0], [[-1, 0, 1], [-1, 0, 0, 1, 2, 2, 3, 4, 5], [-1, 0]], 4, 2, 32, 32),
+ ([129], [[-1] + [r - 1 for r in range(1, 24)]], 6, 1, 64, 16), # 24 rows: a row tile with padding
+ ],
+)
+def test_verify_attention_matches_dense(contexts, parents, heads, kv_heads, d, page):
+ from eagle_harness.vllm.verify_attention import verify_attention
+
+ gen = torch.Generator().manual_seed(len(contexts) * 100 + heads)
+ num_reqs = len(contexts)
+ widths = [len(p) for p in parents]
+ width = max(widths)
+ max_blocks = max(c // page + 1 for c in contexts) + 1
+ num_blocks = num_reqs * max_blocks + 3
+ kv = torch.randn(num_blocks, page, kv_heads, 2 * d, generator=gen).to(DTYPE)
+ key_cache, value_cache = kv[..., :d], kv[..., d:]
+ table = torch.randperm(num_blocks, generator=gen)[: num_reqs * max_blocks].view(num_reqs, max_blocks).int()
+ tokens = sum(widths)
+ q = torch.randn(tokens + 2, heads, d, generator=gen).to(DTYPE) # two rows past the last request
+ k_new = torch.randn(tokens + 2, kv_heads, d, generator=gen).to(DTYPE)
+ v_new = torch.randn(tokens + 2, kv_heads, d, generator=gen).to(DTYPE)
+ qsl = torch.tensor([0] + [sum(widths[: i + 1]) for i in range(num_reqs)], dtype=torch.int32)
+ masks = torch.tensor([_masks(p, width) for p in parents], dtype=torch.int64)
+ out = torch.full_like(q, 7.0)
+ scale = d**-0.5
+
+ to = lambda *ts: [t.to(DEV) for t in ts] # noqa: E731
+ q_d, kn_d, vn_d, kc_d, vc_d, out_d = to(q, k_new, v_new, key_cache, value_cache, out)
+ verify_attention(
+ q_d,
+ kn_d,
+ vn_d,
+ kc_d,
+ vc_d,
+ table.to(DEV),
+ torch.tensor(contexts, dtype=torch.int32, device=DEV),
+ qsl.to(DEV),
+ masks.to(DEV),
+ scale,
+ out_d,
+ max_query_len=width,
+ )
+ out_d = out_d.cpu().float()
+
+ for b in range(num_reqs):
+ c, start, w = contexts[b], int(qsl[b]), widths[b]
+ slots = [(int(table[b, p // page]), p % page) for p in range(c)]
+ ctx_k = torch.stack([key_cache[blk, s] for blk, s in slots]) if slots else key_cache[:0, 0]
+ ctx_v = torch.stack([value_cache[blk, s] for blk, s in slots]) if slots else value_cache[:0, 0]
+ keys = torch.cat([ctx_k, k_new[start : start + w]]).float()
+ values = torch.cat([ctx_v, v_new[start : start + w]]).float()
+ scores, values = _dense(q[start : start + w].float(), keys, values, scale)
+ tree_visible = torch.tensor([[bool(masks[b, r] >> j & 1) for j in range(w)] for r in range(w)])
+ visible = torch.cat([torch.ones(w, c, dtype=torch.bool), tree_visible], 1)
+ scores = scores.masked_fill(~visible, float("-inf"))
+ want = torch.einsum("hqk,khd->qhd", scores.softmax(-1), values)
+ torch.testing.assert_close(out_d[start : start + w], want, atol=2e-2, rtol=2e-2)
+ assert torch.equal(out_d[tokens:], torch.full_like(out_d[tokens:], 7.0)) # rows past the batch untouched
diff --git a/tests/test_verify_attn_args_gpu.py b/tests/test_verify_attn_args_gpu.py
new file mode 100644
index 0000000..8ca6fb8
--- /dev/null
+++ b/tests/test_verify_attn_args_gpu.py
@@ -0,0 +1,49 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The draft graph's CSR verify args equal sglang's per-replay build (GPU)."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+if not torch.cuda.is_available():
+ pytest.skip("needs CUDA (Triton kernel)", allow_module_level=True)
+
+from sglang.srt.mem_cache.kv_index_translator import KVIndexTranslator # noqa: E402
+from sglang.srt.speculative.eagle_info import EagleVerifyInput # noqa: E402
+
+from eagle_harness.sglang.verify_input import build_attn_args # noqa: E402
+
+
[email protected]("committed, width", [(1, 2), (37, 8), (3000, 16)])
+def test_built_args_equal_sglangs(committed, width):
+ gen = torch.Generator().manual_seed(committed + width)
+ rows, row_len, row = 4, 4096, 2
+ req_to_token = torch.randperm(rows * row_len, generator=gen).to(torch.int32).view(rows, row_len).cuda()
+ req_pool_indices = torch.tensor([row], device="cuda")
+ seq_lens = torch.tensor([committed], device="cuda")
+ translator = KVIndexTranslator(
+ req_to_token=req_to_token,
+ token_to_kv_pool_allocator=SimpleNamespace(),
+ token_to_kv_pool=SimpleNamespace(),
+ page_size=1,
+ device="cuda",
+ )
+ assert not translator.reads_are_translated
+ reference = EagleVerifyInput.create_idle_input(topk=4, spec_steps=3, num_verify_tokens=width, device="cuda")
+ ref_indices, ref_indptr, ref_qo_indptr, _ = reference.generate_attn_arg_prefill(
+ req_pool_indices=req_pool_indices,
+ paged_kernel_lens=seq_lens,
+ paged_kernel_lens_sum=committed,
+ translator=translator,
+ plan=None,
+ )
+ buffer = torch.full((row_len,), -1, dtype=torch.int32, device="cuda")
+ kv_indices, kv_indptr, qo_indptr = build_attn_args(req_to_token, req_pool_indices, seq_lens, width, buffer)
+ torch.testing.assert_close(kv_indices[: committed + width], ref_indices, rtol=0, atol=0)
+ torch.testing.assert_close(kv_indptr, ref_indptr, rtol=0, atol=0)
+ torch.testing.assert_close(qo_indptr, ref_qo_indptr, rtol=0, atol=0)
+ assert kv_indptr.dtype == ref_indptr.dtype and qo_indptr.dtype == ref_qo_indptr.dtype
diff --git a/tests/test_verify_input.py b/tests/test_verify_input.py
new file mode 100644
index 0000000..ea7dc93
--- /dev/null
+++ b/tests/test_verify_input.py
@@ -0,0 +1,92 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""HarnessVerifyInput: sglang's verify input plus the greedy flag and tail-mask variant (CPU)."""
+
+from types import SimpleNamespace
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+from sglang.srt.mem_cache.kv_loc_plan import IdSpaceKind # noqa: E402
+from sglang.srt.speculative.eagle_info import EagleVerifyInput # noqa: E402
+
+from eagle_harness.sglang.verify_input import HarnessVerifyInput # noqa: E402
+
+
+def _eagle():
+ return EagleVerifyInput.create_idle_input(topk=4, spec_steps=3, num_verify_tokens=8, device="cpu")
+
+
+def test_from_eagle_keeps_sglangs_fields():
+ eagle = _eagle()
+ verify = HarnessVerifyInput.from_eagle(eagle, greedy_tokens_only=True)
+ assert verify.custom_mask is eagle.custom_mask and verify.draft_token_num == 8
+ assert verify.greedy_tokens_only and verify.tail_mask is None
+ assert not HarnessVerifyInput.from_eagle(eagle).greedy_tokens_only # default: logits
+
+
+def test_variant_comes_from_the_tail_mask():
+ dims = dict(q_dtype=torch.bfloat16, kv_dtype=torch.bfloat16, head_dim=256)
+ assert HarnessVerifyInput.from_eagle(_eagle()).flashinfer_verify_variant(1, 8, **dims) is None
+ asked = []
+ tail_mask = SimpleNamespace(variant=lambda *args: asked.append(args) or "variant")
+ verify = HarnessVerifyInput.from_eagle(_eagle(), tail_mask=tail_mask)
+ assert verify.flashinfer_verify_variant(1, 8, **dims) == "variant"
+ assert asked == [(1, 8, torch.bfloat16, torch.bfloat16, 256)]
+
+
+class _Translator:
+ """Counts sglang's own CSR builds (``EagleVerifyInput.generate_attn_arg_prefill`` packs through it)."""
+
+ def __init__(self, reads_are_translated: bool):
+ self.reads_are_translated = reads_are_translated
+ self.packs = 0
+
+ def pack_read_stream(self, plan, **kwargs) -> bool:
+ self.packs += 1
+ return False
+
+
+def _args(verify, translator, bs=1, kind=IdSpaceKind.FULL, committed=37):
+ return verify.generate_attn_arg_prefill(
+ req_pool_indices=torch.arange(bs),
+ paged_kernel_lens=torch.full((bs,), committed),
+ paged_kernel_lens_sum=committed * bs,
+ translator=translator,
+ plan=None,
+ kind=kind,
+ )
+
+
+def _prepared(width=8, committed=37):
+ return (
+ torch.arange(64, dtype=torch.int32),
+ torch.tensor([0, committed + width], dtype=torch.int32),
+ torch.tensor([0, width], dtype=torch.int32),
+ )
+
+
+def test_prepared_attn_args_serve_a_one_request_untranslated_verify():
+ """The draft graph's CSR args replace sglang's per-replay build (no pack), kv_indices cut to kv_len."""
+ verify = HarnessVerifyInput.from_eagle(_eagle())
+ verify.prepared_attn_args = prepared = _prepared()
+ translator = _Translator(reads_are_translated=False)
+ kv_indices, kv_indptr, qo_indptr, mask = _args(verify, translator)
+ assert translator.packs == 0
+ assert kv_indices.data_ptr() == prepared[0].data_ptr() and kv_indices.numel() == 37 + 8
+ assert kv_indptr is prepared[1] and qo_indptr is prepared[2] and mask is verify.custom_mask
+
+
+ "translated, kind, bs",
+ [(True, IdSpaceKind.FULL, 1), (False, IdSpaceKind.SLIDING_WINDOW, 1), (False, IdSpaceKind.FULL, 2)],
+)
+def test_other_reads_build_sglangs_attn_args(translated, kind, bs):
+ """Translated ids, another id space or more requests than the prepared args cover: sglang builds them."""
+ verify = HarnessVerifyInput.from_eagle(_eagle())
+ verify.prepared_attn_args = _prepared()
+ translator = _Translator(reads_are_translated=translated)
+ _args(verify, translator, bs=bs, kind=kind)
+ assert translator.packs == 1
diff --git a/tests/test_verify_plan.py b/tests/test_verify_plan.py
new file mode 100644
index 0000000..9a1a371
--- /dev/null
+++ b/tests/test_verify_plan.py
@@ -0,0 +1,53 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tree-tail mask variant of the batch-size-1 verify graphs (public FlashInfer jit_args), CPU only."""
+
+import sys
+import types
+from unittest import mock
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+from eagle_harness.sglang import tail_mask, verify_plan # noqa: E402
+
+BF16 = torch.bfloat16
+
+
+def fake_uri(monkeypatch):
+ """flashinfer.jit.attention.get_batch_prefill_uri without FlashInfer installed."""
+ module = types.ModuleType("flashinfer.jit.attention")
+ module.get_batch_prefill_uri = lambda *args: "stock_uri"
+ for name in ("flashinfer", "flashinfer.jit"):
+ monkeypatch.setitem(sys.modules, name, sys.modules.get(name) or types.ModuleType(name))
+ monkeypatch.setitem(sys.modules, "flashinfer.jit.attention", module)
+ tail_mask.jit_args.cache_clear()
+ yield
+ tail_mask.jit_args.cache_clear()
+
+
+def test_variant_for_batch_size_1_trees_with_16_bit_dtypes(fake_uri):
+ mask = verify_plan.TreeTailMask(torch.device("cpu"))
+ variant = mask.variant(1, 16, BF16, BF16, 128)
+ assert variant.mask_buf.dtype == torch.uint8 and variant.mask_buf.data_ptr() == mask.tail_bits.data_ptr()
+ uri, *_, tensor_names, _, scalar_names, _, name, decl = variant.jit_args
+ assert uri == "tree_tail_mask_stock_uri" and name == tail_mask.VARIANT_NAME and name in decl
+ # FlashInfer reads the additional parameter names at jit_args[7] and [9] and fills them by name.
+ assert variant.jit_args[7] is tensor_names and "maybe_custom_mask" in tensor_names
+ assert variant.jit_args[9] is scalar_names and "sm_scale" in scalar_names
+ for args in ((2, 16, BF16, BF16), (1, 1, BF16, BF16), (1, 65, BF16, BF16), (1, 16, BF16, torch.float8_e4m3fn)):
+ assert mask.variant(*args, 128) is None
+ assert mask.widths == {16}
+
+
+def test_write_fills_only_the_variant_widths(fake_uri):
+ mask = verify_plan.TreeTailMask(torch.device("cpu"))
+ mask.variant(1, 8, BF16, BF16, 128)
+ custom_mask, committed = torch.ones(8 * 20, dtype=torch.bool), torch.tensor([12])
+ with mock.patch.object(verify_plan, "tree_tail_words") as words:
+ mask.write(custom_mask, committed, 8)
+ mask.write(custom_mask, committed, 4) # captured without the variant
+ words.assert_called_once_with(custom_mask, committed, mask.tail_bits, 8)
diff --git a/tests/test_verify_prep_gpu.py b/tests/test_verify_prep_gpu.py
new file mode 100644
index 0000000..1f4a8eb
--- /dev/null
+++ b/tests/test_verify_prep_gpu.py
@@ -0,0 +1,37 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The tail-mask word kernel against a torch reference (GPU)."""
+
+import pytest
+import torch
+
+pytest.importorskip("triton")
+if not torch.cuda.is_available():
+ pytest.skip("needs a CUDA device", allow_module_level=True)
+
+from eagle_harness.kernels.verify_prep import tree_tail_words # noqa: E402
+
+
+def _signed(word: int) -> int:
+ return word - (1 << 64) if word >= 1 << 63 else word
+
+
[email protected]("width,kv_len", [(1, 7), (5, 40), (16, 3000), (64, 5000), (16, 70000)])
+def test_matches_reference(width, kv_len):
+ torch.manual_seed(width)
+ mask = torch.randint(0, 2, (width * kv_len,), dtype=torch.uint8, device="cuda").bool()
+ committed_len = torch.tensor([kv_len - width], dtype=torch.int64, device="cuda")
+ tail_bits = torch.full((width + 1,), 7, dtype=torch.int64, device="cuda")
+
+ tree_tail_words(mask, committed_len, tail_bits, width)
+
+ rows = mask.view(width, kv_len)[:, kv_len - width :].int().cpu().tolist()
+ expected = [_signed(sum(bit << j for j, bit in enumerate(row))) for row in rows]
+ assert tail_bits[:width].tolist() == expected
+ assert tail_bits[width].item() == 7 # no word past the last row
+
+
+def test_width_over_a_word_is_rejected():
+ with pytest.raises(ValueError, match="verify width 65"):
+ tree_tail_words(None, None, None, width=65)
diff --git a/tests/test_verify_rows.py b/tests/test_verify_rows.py
new file mode 100644
index 0000000..6281c52
--- /dev/null
+++ b/tests/test_verify_rows.py
@@ -0,0 +1,101 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""DraftTree.verify_rows on a grown draft tree (CPU): verify rows, their tokens and the parent row of each."""
+
+import pytest
+import torch
+
+from tests.triton_probe import needs_triton # first: it picks Triton's interpreter on a host without a GPU
+
+from eagle_harness.core.draft_tree import DraftTree, TreeShape # noqa: E402
+
+K, DEPTH, H, BS = 4, 6, 8, 3
+DEV = "cuda" if torch.cuda.is_available() else "cpu" # the select kernel's device (the reference tree grows on CPU)
+
+
+def grown_tree(seed=0, device="cpu"):
+ """A ``DEPTH``-level tree of ``BS`` requests grown with random probabilities, and each node's parent node."""
+ tree = DraftTree(TreeShape(top_k=K, max_depth=DEPTH), BS, H, torch.float32, torch.device(device), max_verify=1)
+ gen = torch.Generator().manual_seed(seed)
+ tree.root_probs[:BS] = torch.rand(BS, K, generator=gen).softmax(-1)
+ tree.root_tokens[:BS] = torch.randint(0, 1000, (BS, K), generator=gen)
+ tree.root_hidden[:BS] = torch.randn(BS, H, generator=gen)
+ tree.begin_reference(BS)
+ frontier = torch.arange(K).repeat(BS, 1) # global node ids of the frontier, per request
+ parent_of = torch.full((BS, tree.shape.capacity), -2, dtype=torch.int64)
+ parent_of[:, :K] = -1
+ for step in range(1, DEPTH):
+ probs = torch.rand(BS * K, K, generator=gen).softmax(-1)
+ tokens = torch.randint(0, 1000, (BS * K, K), generator=gen)
+ tree.step_reference(BS, step, *(t.to(device) for t in (probs, tokens, torch.randn(BS * K, H, generator=gen))))
+ start = tree.shape.layer_start(step + 1)
+ parent_of[:, start : start + K * K] = frontier.repeat_interleave(K, dim=1)
+ # the next frontier: the nodes the step recorded
+ pstart = tree.shape.num_parents(step + 1)
+ frontier = tree.parents[:BS, pstart : pstart + K].cpu()
+ return tree, parent_of
+
+
[email protected]("count", [1, 5, 15, 31])
+def test_verify_rows_put_a_parent_first_with_the_right_parent_rows(count):
+ tree, parent_of = grown_tree()
+ tokens, parent_rows = tree.verify_rows(BS, DEPTH, count)
+ assert tokens.shape == (BS, count) and parent_rows.shape == (BS, count + 1)
+ ranked, _ = tree.rank(BS, DEPTH, count)
+ index = torch.sort(ranked, dim=-1).values
+ assert torch.equal(tokens, torch.gather(tree.tokens[:BS], 1, index))
+ for b in range(BS):
+ assert parent_rows[b, 0] == -1
+ for row in range(1, count + 1):
+ node = int(index[b, row - 1])
+ parent = int(parent_of[b, node])
+ expected = 0 if parent == -1 else 1 + index[b].tolist().index(parent)
+ assert int(parent_rows[b, row]) == expected
+ assert expected < row # a parent comes first, so any prefix of the rows is a tree
+
+
+def test_verify_rows_of_a_shallower_tree_use_its_nodes_only():
+ tree, _ = grown_tree()
+ tokens, parent_rows = tree.verify_rows(BS, 2, 8)
+ n = tree.shape.num_nodes(2)
+ ranked, _ = tree.rank_reference(BS, 2, 8)
+ assert int(ranked.max()) < n
+ assert torch.equal(tokens, torch.gather(tree.tokens[:BS], 1, torch.sort(ranked, dim=-1).values))
+
+
+@needs_triton
[email protected]("count", [1, 5, 15, 31])
[email protected]("seed", [0, 1])
[email protected]("depth", [3, DEPTH])
+def test_select_kernel_matches_the_torch_selection(count, seed, depth):
+ cpu, _ = grown_tree(seed)
+ want = cpu.verify_rows_reference(BS, depth, count)
+ gpu, _ = grown_tree(seed, DEV)
+ got = gpu.verify_rows(BS, depth, count) if DEV == "cuda" else _kernel_rows(gpu, depth, count)
+ assert torch.equal(got[0].cpu(), want[0]) and torch.equal(got[1].cpu(), want[1])
+
+
+def _kernel_rows(tree, depth, count):
+ """The select kernel on CPU tensors (Triton's interpreter), as verify_rows launches it on CUDA."""
+ from eagle_harness.kernels.tree_step import select_rows
+
+ n = tree.shape.num_nodes(depth)
+ n_block = 1 << (n - 1).bit_length()
+ row_of = torch.empty(BS, n_block, dtype=torch.int32)
+ return select_rows(tree.scores[:BS, :n], tree.decay[:n], tree.tokens[:BS, :n], tree.parents[:BS], count, K, row_of)
+
+
+@needs_triton
+def test_select_kernel_breaks_a_tie_at_the_last_row_by_node_number():
+ from eagle_harness.kernels.tree_step import select_rows
+
+ tree, _ = grown_tree(3)
+ n = tree.shape.num_nodes(DEPTH)
+ scores = torch.rand(1, n) * 0.01
+ scores[0, :K] = torch.tensor([0.3, 0.3, 0.5, 0.1]) # depth 1 (decay 1): nodes 0 and 1 tie for the second row
+ row_of = torch.empty(1, 1 << (n - 1).bit_length(), dtype=torch.int32, device=DEV)
+ args = (scores, tree.decay[:n], tree.tokens[:1, :n], tree.parents[:1])
+ tokens, parent_rows = select_rows(*(t.to(DEV) for t in args), 2, K, row_of)
+ assert tokens[0].tolist() == tree.tokens[0, [0, 2]].tolist()
+ assert parent_rows[0].tolist() == [-1, 0, 0]
diff --git a/tests/test_verify_tail_gpu.py b/tests/test_verify_tail_gpu.py
new file mode 100644
index 0000000..214ed0b
--- /dev/null
+++ b/tests/test_verify_tail_gpu.py
@@ -0,0 +1,67 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The graph-replayed ranking and selection of a drafted tree equal their eager versions (skipped without CUDA).
+
+Run in a GPU job: ``pytest -q tests/test_verify_tail_gpu.py``.
+"""
+
+import pytest
+import torch
+
+pytest.importorskip("sglang")
+
+from eagle_harness.core.draft_tree import DraftTree, TreeShape # noqa: E402
+from eagle_harness.sglang.verify_tail import VerifyTail # noqa: E402
+
+pytestmark = pytest.mark.skipif(not torch.cuda.is_available(), reason="needs a CUDA device")
+
+K, DEPTH, H = 4, 12, 64
+
+
+def _drafted_tree(bs: int, steps: int, seed: int) -> DraftTree:
+ gen = torch.Generator(device="cuda").manual_seed(seed)
+ tree = DraftTree(TreeShape(K, DEPTH), bs, H, torch.bfloat16, torch.device("cuda"), max_verify=32)
+ tree.stage_root(
+ bs,
+ torch.rand(bs, K, device="cuda", generator=gen).softmax(-1),
+ torch.randint(0, 1000, (bs, K), device="cuda", generator=gen),
+ torch.randn(bs, H, device="cuda", generator=gen).to(torch.bfloat16),
+ )
+ tree.begin(bs)
+ for step in range(1, steps + 1):
+ probs = torch.sort(
+ torch.rand(bs * K, K, device="cuda", generator=gen).softmax(-1), dim=-1, descending=True
+ ).values
+ ids = torch.randint(0, 1000, (bs * K, K), device="cuda", generator=gen)
+ hidden = torch.randn(bs * K, H, device="cuda", generator=gen).to(torch.bfloat16)
+ tree.step(bs, step, probs, ids, hidden)
+ return tree
+
+
+def _build(bs, selection, steps, width):
+ """Stands in for sglang's verify-input build: the selection's tensors, as new tensors."""
+ return selection.top_scores_index.clone(), selection.draft_tokens + 1, selection.parent_list.clone(), steps, width
+
+
[email protected]("bs,depth,width", [(1, 6, 16), (1, 4, 8), (3, 7, 16)])
+def test_replayed_ranking_and_selection_follow_the_trees_buffers(bs, depth, width):
+ tree = _drafted_tree(bs, depth, seed=1)
+ tail = VerifyTail(tree, _build)
+ count = min(tree.shape.num_nodes(depth), 15)
+ for seed in (1, 2): # the second round refills the same static buffers with another tree
+ if seed == 2:
+ other = _drafted_tree(bs, depth, seed=2)
+ for name in ("scores", "tokens", "parents"):
+ getattr(tree, name).copy_(getattr(other, name))
+ ranking = tail.rank(bs, depth, count)
+ want_ranked, want_scores = tree.rank(bs, depth, count)
+ want_scores = want_scores[0] if bs == 1 else want_scores.mean(dim=0)
+ assert torch.equal(ranking.ranked, want_ranked)
+ torch.testing.assert_close(ranking.scores, want_scores)
+ got_index, got_tokens, got_parents, steps, got_width = tail.verify_input(bs, depth, width, ranking)
+ want = tree.select(bs, min(depth, width - 1), want_ranked, width)
+ assert torch.equal(got_index, want.top_scores_index)
+ assert torch.equal(got_tokens, want.draft_tokens + 1)
+ assert torch.equal(got_parents, want.parent_list)
+ assert (steps, got_width) == (min(depth, width - 1), width)
diff --git a/tests/test_vllm_calibrate.py b/tests/test_vllm_calibrate.py
new file mode 100644
index 0000000..beac155
--- /dev/null
+++ b/tests/test_vllm_calibrate.py
@@ -0,0 +1,155 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Config-derived calibration geometry and real CPU fitting."""
+
+import json
+from dataclasses import asdict
+from types import SimpleNamespace
+
+import pytest
+
+from eagle_harness.core.calibration import AttentionShape
+from eagle_harness.vllm.calibrate import attention_shape, fit, main, merge, sweep, validate_tables
+
+
+def test_sweep_and_fit_cover_the_requested_context(tmp_path):
+ from eagle_harness.core.cost_table import load_cost_tables
+
+ lengths = sweep(context_stop=8192)
+ assert max(lengths) > 4096
+ assert max(lengths) + 64 <= 8192
+
+ def rows(widths):
+ return [{"query_length": q, "cache_length": n, "time_us": 100 + q + n / 100} for q in widths for n in lengths]
+
+ fit(
+ str(tmp_path),
+ rows([1, 8, 16, 32, 64]),
+ rows([1, 2, 4, 8]),
+ AttentionShape(4),
+ AttentionShape(1),
+ 1,
+ context_stop=8192,
+ )
+ table = load_cost_tables(str(tmp_path / "cost"))[1]
+ assert len(table.intervals) == 31
+ validate_tables(str(tmp_path), context_stop=8192)
+
+
+def test_hybrid_target_counts_only_attention_layers():
+ config = SimpleNamespace(
+ text_config=SimpleNamespace(num_hidden_layers=4, layer_types=["linear_attention"] * 3 + ["full_attention"])
+ )
+ assert attention_shape(config) == AttentionShape(1)
+
+
+def test_sliding_draft_reads_its_own_window():
+ assert attention_shape(
+ SimpleNamespace(num_hidden_layers=1, layer_types=["sliding_attention"], sliding_window=2048)
+ ) == AttentionShape(1, 1, 2048)
+
+
+ "config",
+ [
+ SimpleNamespace(num_hidden_layers=1, layer_types=["unknown"]),
+ SimpleNamespace(num_hidden_layers=2, layer_types=["full_attention"]),
+ SimpleNamespace(num_hidden_layers=4, full_attention_interval=4),
+ SimpleNamespace(num_hidden_layers=1, layer_types=["sliding_attention"]),
+ SimpleNamespace(num_hidden_layers=1, layer_types=["mamba"]),
+ ],
+)
+def test_ambiguous_attention_layout_is_not_a_guessed_qwen_shape(config):
+ with pytest.raises(ValueError):
+ attention_shape(config)
+
+
+def test_fitter_consumes_all_tree_widths(tmp_path):
+ # Synthetic timings test the file format, not hardware performance.
+ def rows(widths):
+ return [
+ {"batch_size": 1, "query_length": q, "cache_length": length, "time_us": 100 + 5 * q + length / 100}
+ for q in widths
+ for length in sweep(context_stop=4096)
+ ]
+
+ assert fit(
+ str(tmp_path),
+ rows([1, 8, 16, 32, 64]),
+ rows([1, 2, 4, 8]),
+ AttentionShape(4),
+ AttentionShape(1),
+ 1,
+ context_stop=4096,
+ ) == [1]
+ validate_tables(str(tmp_path))
+ for model in ("model_llm", "model_slm"):
+ files = list((tmp_path / "cost" / "bs_1" / model).glob("*.json"))
+ assert files
+ for file in files:
+ assert json.loads(file.read_text())
+
+
+def test_fit_uses_recorded_geometry_without_reloading_models(tmp_path):
+ def rows(widths):
+ return [
+ {"query_length": q, "cache_length": n, "time_us": 100 + q + n / 100}
+ for q in widths
+ for n in sweep(context_stop=4096)
+ ]
+
+ raw = tmp_path / "raw.json"
+ raw.write_text(
+ json.dumps(
+ {
+ "tp": 2,
+ "context_stop": 4096,
+ "target_shape": asdict(AttentionShape(4)),
+ "draft_shape": asdict(AttentionShape(1)),
+ "target": rows([1, 8, 16, 32, 64]),
+ "draft": rows([1, 2, 4, 8]),
+ }
+ )
+ )
+ main(["--model", "not-a-real-model", "--draft", "not-a-real-draft", "fit", str(tmp_path), str(raw)])
+ validate_tables(str(tmp_path))
+ (tmp_path / "cost/bs_1/model_slm/model_interval_0.json").write_text("{}")
+ with pytest.raises(RuntimeError, match="incomplete vLLM"):
+ validate_tables(str(tmp_path))
+
+
+def test_measure_records_resolved_model_limit(monkeypatch, tmp_path):
+ from eagle_harness.vllm import calibrate
+
+ geometry = SimpleNamespace(num_hidden_layers=2)
+ config = SimpleNamespace(
+ model_config=SimpleNamespace(hf_config=geometry, max_model_len=8192, dtype="bfloat16"),
+ speculative_config=SimpleNamespace(draft_model_config=SimpleNamespace(hf_config=geometry)),
+ )
+ measured = []
+
+ def rpc(name, args):
+ measured.extend(args[1])
+ return [[]]
+
+ llm = SimpleNamespace(llm_engine=SimpleNamespace(vllm_config=config), collective_rpc=rpc)
+ monkeypatch.setattr(calibrate, "engine", lambda *args, **kwargs: llm)
+ key = calibrate.CostKey(gpu="fixture", gpu_count=1, model="target", draft="draft", engine="vllm fixture", dtype="bfloat16")
+ monkeypatch.setattr(calibrate, "cost_key", lambda *args: key)
+ output = tmp_path / "raw.json"
+ calibrate.measure(str(output), 64, False, [1], 256, 1, model="target", draft="draft")
+ raw = json.loads(output.read_text())
+ assert raw["context_stop"] == 8192
+ assert raw["key"] == key.to_dict()
+ assert max(measured) > 4096 and max(measured) + 64 <= 8192
+
+
+def test_merge_rejects_different_tp(tmp_path):
+ paths = []
+ for tp in (1, 2):
+ path = tmp_path / f"{tp}.json"
+ path.write_text(json.dumps({"tp": tp, "target": [], "draft": []}))
+ paths.append(str(path))
+ with pytest.raises(ValueError, match="differ in tp"):
+ merge(paths)
diff --git a/tests/test_vllm_model_rows.py b/tests/test_vllm_model_rows.py
new file mode 100644
index 0000000..9f7f1af
--- /dev/null
+++ b/tests/test_vllm_model_rows.py
@@ -0,0 +1,97 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Release integration of Nemotron structures with the shared EAGLE3 row forward."""
+
+import contextlib
+from types import SimpleNamespace
+
+import pytest
+
+pytest.importorskip("vllm")
+import torch # noqa: E402
+
+from eagle_harness.vllm import model_rows, models # noqa: E402
+
+
[email protected]("draft_kind", ["native", "dense", "latent"])
[email protected]("attn_norm", [False, True])
[email protected]("norm_output", [False, True])
+def test_shared_rows_preserve_attention_projection_and_mlp(monkeypatch, draft_kind, attn_norm, norm_output):
+ monkeypatch.setattr(model_rows, "_kernel_ops", contextlib.nullcontext)
+ monkeypatch.setattr(model_rows, "_kernel", lambda op: op)
+ calls = []
+ x = torch.tensor([[1.0, 2.0, 3.0, 4.0]])
+ residual = torch.tensor([[5.0, 6.0]])
+
+ def qkv(value):
+ # Both the 2H dense input and H projected input reach a real numeric assertion.
+ value = value.reshape(1, -1, 2).sum(1)
+ return torch.cat([value, value * 2, value * 3], dim=-1), None
+
+ def dense(value):
+ calls.append("dense")
+ return value * 7, None
+
+ def latent(mlp, value):
+ calls.append("latent")
+ return value * 11
+
+ layer = SimpleNamespace(
+ self_attn=SimpleNamespace(
+ qkv_proj=qkv,
+ q_size=2,
+ kv_size=2,
+ rotary_emb=lambda positions, q, k: (q, k),
+ o_proj=lambda value: (value, None),
+ ),
+ post_attention_layernorm=lambda value, res: (value - res, value + res),
+ mlp=SimpleNamespace(gate_up_proj=dense, act_fn=lambda value: value, down_proj=lambda value: (value, None)),
+ )
+ if attn_norm:
+ layer.eh_proj = lambda value: value[:, :2] + value[:, 2:]
+ layer.pre_attention_layernorm = lambda value: value * 5
+ draft = SimpleNamespace(
+ model=SimpleNamespace(layers=[layer], norm=lambda value, res: (value - res, value + res), norm_output=norm_output),
+ _layer_input=lambda ids, hidden: (x, residual),
+ _moe_rows=latent,
+ )
+ if draft_kind != "native":
+ draft.latent_moe = draft_kind == "latent"
+ normed, hidden = model_rows.DraftRowsMixin.forward_rows(
+ draft, torch.tensor([0]), torch.tensor([0]), x, lambda q, k, v: q + k + v
+ )
+ projected = x[:, :2] + x[:, 2:]
+ attention_input = projected * 5 if attn_norm else projected
+ expected_residual = projected if attn_norm else residual
+ attention = attention_input + attention_input * 2 + attention_input * 3
+ mlp_output = (attention - expected_residual) * (11 if draft_kind == "latent" else 7)
+ summed_residual = attention + expected_residual
+ torch.testing.assert_close(normed, mlp_output - summed_residual)
+ torch.testing.assert_close(hidden, normed if norm_output else mlp_output + summed_residual)
+ assert calls == ["latent" if draft_kind == "latent" else "dense"]
+
+
[email protected]("context_exists", [False, True])
+def test_latent_rows_enter_engine_context_only_when_missing(monkeypatch, context_exists):
+ events = []
+ config = object()
+ monkeypatch.setattr(models, "is_forward_context_available", lambda: context_exists)
+
+ @contextlib.contextmanager
+ def context(attention_metadata, vllm_config):
+ assert attention_metadata is None and vllm_config is config
+ events.append("enter")
+ yield
+ events.append("exit")
+
+ monkeypatch.setattr(models, "set_forward_context", context)
+ x = torch.ones(1)
+
+ def mlp(value):
+ events.append("mlp")
+ return value * 2
+
+ out = models.LlamaForCausalLMEagle4._moe_rows(SimpleNamespace(vllm_config=config), mlp, x)
+ torch.testing.assert_close(out, x * 2)
+ assert events == (["mlp"] if context_exists else ["enter", "mlp", "exit"])
diff --git a/tests/test_vllm_plugin.py b/tests/test_vllm_plugin.py
new file mode 100644
index 0000000..606574a
--- /dev/null
+++ b/tests/test_vllm_plugin.py
@@ -0,0 +1,593 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The vLLM plugin: registration, method_config parsing, the verify schedule, hook map.
+
+CPU only. Needs vLLM with the speculative-method hooks (branch ``eagle-hooks``)
+importable; without them the module is skipped (the plugin itself then switches
+itself off, which ``test_register_is_off_without_the_vllm_hooks`` covers).
+"""
+
+from __future__ import annotations
+
+import inspect
+import logging
+import sys
+from importlib.metadata import PackageNotFoundError, distribution, entry_points
+from pathlib import Path
+from types import SimpleNamespace
+
+import pytest
+
+pytest.importorskip("vllm.v1.spec_decode.registry")
+
+import vllm # noqa: E402
+from vllm.config import SpeculativeConfig, VllmConfig # noqa: E402
+from vllm.model_executor.models.registry import ModelRegistry # noqa: E402
+from vllm.v1.spec_decode import registry as vllm_registry # noqa: E402
+from vllm.v1.spec_decode.dynamic.utils import validate_and_normalize_dynamic_sd_schedule # noqa: E402
+from vllm.v1.worker.gpu.spec_decode.speculator import BaseSpeculator, DraftModelSpeculator # noqa: E402
+
+from eagle_harness.core.limits import ComputeIntensity # noqa: E402
+from eagle_harness.vllm import plugin # noqa: E402
+from eagle_harness.vllm.adapter import HOOK_MAP # noqa: E402
+from eagle_harness.vllm.config import ( # noqa: E402
+ METHOD_NAME,
+ num_lookahead_tokens,
+ parse_method_config,
+ verify_width_schedule,
+)
+
+COST = {"data_path": "/nonexistent/cost-data"}
+STATIC = {"mode": "static"}
+CHAIN = {"mode": "static", "node_top_k": 1, "tree_depth": 5, "max_verify_width": 6}
+
+
+def registered():
+ snapshot = dict(vllm_registry._REGISTRY)
+ vllm_registry._REGISTRY.pop(METHOD_NAME, None)
+ assert plugin.register() is True
+ yield vllm_registry.get_speculative_method(METHOD_NAME)
+ vllm_registry._REGISTRY.clear()
+ vllm_registry._REGISTRY.update(snapshot)
+
+
+# ------------------------------------------------------------------ registration
+def test_register_adds_the_method(registered):
+ assert registered.speculator_cls == "eagle_harness.vllm.speculator:HarnessSpeculator"
+ assert registered.uses_target_hidden_states is True
+ assert registered.uses_aux_hidden_states is True
+ assert registered.supports_async_scheduling is True
+ assert registered.configure is not None
+ assert registered.num_lookahead_tokens is num_lookahead_tokens
+ assert registered.linear_attn_verify_extension == "eagle_harness.vllm.gdn_tree_verify:create_extension"
+
+
+def test_register_is_idempotent(registered):
+ assert plugin.register() is True
+ assert vllm_registry.get_speculative_method(METHOD_NAME) == registered
+
+
+def test_register_adds_the_draft_architecture(registered):
+ assert plugin.DRAFT_ARCHITECTURE in ModelRegistry.get_supported_archs()
+
+
+def test_register_is_off_without_the_vllm_hooks(monkeypatch):
+ # An import of the registry module fails, as on a vLLM without the hooks.
+ monkeypatch.setitem(sys.modules, "vllm.v1.spec_decode.registry", None)
+ assert plugin.register() is False
+
+
+def test_speculator_class_resolves(registered):
+ from eagle_harness.vllm.speculator import HarnessSpeculator
+
+ assert registered.resolve_speculator_cls() is HarnessSpeculator
+ assert issubclass(HarnessSpeculator, DraftModelSpeculator)
+
+
+def test_entry_point_is_declared():
+ tomllib = pytest.importorskip("tomllib")
+ root = Path(__file__).resolve().parents[1]
+ declared = tomllib.loads((root / "pyproject.toml").read_text())["project"]["entry-points"]
+ assert declared["vllm.general_plugins"] == {"eagle_harness": "eagle_harness.vllm.plugin:register"}
+ assert declared["sglang.srt.plugins"] == {"eagle_harness": "eagle_harness.sglang.plugin:register"}
+
+
+def test_installed_entry_point_is_found_by_vllm():
+ try:
+ distribution("eagle-harness")
+ except PackageNotFoundError:
+ pytest.skip("eagle-harness is not installed (pip install -e .)")
+ from vllm.plugins import load_plugins_by_group
+
+ found = [ep for ep in entry_points(group="vllm.general_plugins") if ep.name == "eagle_harness"]
+ assert len(found) == 1 and found[0].value == "eagle_harness.vllm.plugin:register"
+ assert load_plugins_by_group("vllm.general_plugins")["eagle_harness"] is plugin.register
+
+
+# ------------------------------------------------------------------ method_config
+def test_parse_defaults():
+ parsed = parse_method_config(COST)
+ assert parsed.harness.data_path == COST["data_path"]
+ assert parsed.max_verify_width == 32 and parsed.num_speculative_tokens == 31
+ assert (parsed.node_top_k, parsed.tree_depth) == (8, 12)
+ # The draft tree writes node_top_k * tree_depth KV slots, more than the verify does.
+ assert parsed.draft_kv_lookahead == 96
+
+
+def test_parse_chain_defaults():
+ parsed = parse_method_config({**COST, "intensity": "chain_intensity"})
+ assert (parsed.max_verify_width, parsed.node_top_k, parsed.tree_depth) == (16, 1, 15)
+ assert parsed.draft_kv_lookahead == 16 # a chain verifies its 15 drafts plus the root
+
+
+def test_parse_overrides():
+ parsed = parse_method_config({**COST, "max_verify_width": 64, "node_top_k": 4, "tree_depth": 10})
+ assert parsed.num_speculative_tokens == 63
+ assert parsed.draft_kv_lookahead == 64 # the 64 verify rows beat the 40 draft slots
+
+
+def test_parse_depth_stop_gain():
+ assert parse_method_config(COST).depth_stop_gain == "derived" # default: the measured cost of a step
+ assert parse_method_config({**COST, "depth_stop_gain": "derived"}).depth_stop_gain == "derived"
+ assert parse_method_config({**COST, "depth_stop_gain": 0}).depth_stop_gain == 0.0 # override: lossless
+ assert parse_method_config({**COST, "depth_stop_gain": 0.05}).depth_stop_gain == 0.05
+ assert parse_method_config({**COST, "depth_stop_gain": 1}).depth_stop_gain == 1.0
+ assert parse_method_config({**COST, "depth_stop_gain": None}).depth_stop_gain is None # always tree_depth
+
+
+ "bad, error",
+ [
+ ({**COST, "no_such_key": 1}, ValueError),
+ ({**COST, "max_verify_width": 65}, NotImplementedError),
+ ({**COST, "max_verify_width": 1}, ValueError),
+ ({**COST, "max_verify_width": "32"}, ValueError),
+ ({**COST, "node_top_k": 9}, NotImplementedError),
+ ({**COST, "depth_stop_gain": -0.1}, ValueError),
+ ({**COST, "depth_stop_gain": True}, ValueError),
+ ({**COST, "depth_stop_gain": "0"}, ValueError),
+ ({**COST, "intensity": "chain_intensity", "node_top_k": 2}, NotImplementedError),
+ ],
+)
+def test_parse_rejects(bad, error):
+ with pytest.raises(error):
+ parse_method_config(bad)
+
+
+# ------------------------------------------------------------------ schedule
+def test_schedule_is_valid_for_vllm_and_capped():
+ for intensity in ComputeIntensity:
+ for width in (4, 16, 32, 64):
+ if intensity is ComputeIntensity.CHAIN and width > 16:
+ continue
+ schedule = verify_width_schedule(intensity, width, allow_unpriced=True)
+ assert validate_and_normalize_dynamic_sd_schedule(schedule) == schedule
+ assert max(k for _, _, k in schedule) <= width - 1
+
+
+def test_schedule_follows_the_verify_buckets():
+ # high_intensity: 64 wide up to batch 8, 32 wide up to the shared batch limit.
+ schedule = verify_width_schedule(ComputeIntensity.HIGH, 64)
+ assert schedule[0] == (1, 8, 63)
+ assert schedule[1] == (9, 512, 31)
+ assert schedule[-1][2] == 0 and schedule[-1][0] == 513
+ assert verify_width_schedule(ComputeIntensity.LOW, 64)[:2] == [(1, 2, 63), (3, 8, 31)]
+ # Chains reach batch 512; without measured costs they verify the widest chain at every batch size.
+ chain = verify_width_schedule(ComputeIntensity.CHAIN, 16, allow_unpriced=True)
+ assert chain == [(1, 512, 15), (513, 1 << 16, 0)]
+
+
+def test_chain_schedule_is_derived_from_the_tables_and_the_profile(tmp_path):
+ from tests.test_chain_width import _table, write_tables
+
+ from eagle_harness.core.chain_width import save_accept_profile
+
+ write_tables(
+ str(tmp_path), {1: _table(1, lambda w: 5000.0 + w, 20.0), 512: _table(512, lambda w: 3000.0 * w, 300.0)}
+ )
+ # Tables alone do not price a chain: automatic serving refuses missing acceptance.
+ with pytest.raises(ValueError, match="acceptance profile"):
+ verify_width_schedule(ComputeIntensity.CHAIN, 16, str(tmp_path))
+ save_accept_profile(str(tmp_path), 1000, [900 - 50 * d for d in range(15)])
+ schedule = verify_width_schedule(ComputeIntensity.CHAIN, 16, str(tmp_path))
+ assert schedule == [(1, 256, 15), (257, 512, 0), (513, 1 << 16, 0)]
+ assert validate_and_normalize_dynamic_sd_schedule(schedule) is not None
+ # Trees keep the bucket ceilings whatever the data path holds.
+ assert verify_width_schedule(ComputeIntensity.HIGH, 64, str(tmp_path)) == verify_width_schedule(
+ ComputeIntensity.HIGH, 64
+ )
+
+
+# ------------------------------------------------------------------ SpeculativeConfig
+def test_speculative_config_is_configured_by_the_method(registered):
+ config = SpeculativeConfig(method=METHOD_NAME, method_config={**COST, "max_verify_width": 64})
+ assert config.num_speculative_tokens == 63
+ assert config.num_speculative_tokens_per_batch_size[0] == (1, 8, 63)
+ assert config.method_config["max_verify_width"] == 64
+ assert config.use_eagle() is True
+
+
+def test_num_speculative_tokens_is_the_widest_scheduled_verify(registered, tmp_path):
+ # vLLM reserves 1 + K state slots per request: K is the widest chain the measured costs ever pick, not 15.
+ from tests.test_chain_width import _table, write_tables
+
+ from eagle_harness.core.chain_width import save_accept_profile
+
+ write_tables(str(tmp_path), {1: _table(1, lambda w: 5000.0 + w, 20.0)})
+ save_accept_profile(str(tmp_path), 1000, [900 - 50 * d for d in range(7)]) # measured up to width 8
+ chain = {"mode": "serve", "intensity": "chain_intensity", "data_path": str(tmp_path)}
+ config = SpeculativeConfig(method=METHOD_NAME, method_config=chain)
+ assert config.num_speculative_tokens_per_batch_size[0] == (1, 512, 7)
+ assert config.num_speculative_tokens == 7
+ # A config re-created with the derived K (e.g. copied to another process) still validates.
+ again = SpeculativeConfig(
+ method=METHOD_NAME,
+ method_config=chain,
+ num_speculative_tokens=7,
+ num_speculative_tokens_per_batch_size=config.num_speculative_tokens_per_batch_size,
+ )
+ assert again.num_speculative_tokens == 7
+
+
+def test_served_costs_choose_no_drafts_without_overreserving(registered, tmp_path):
+ from eagle_harness.core.chain_width import save_accept_profile, save_round_times
+
+ save_accept_profile(str(tmp_path), 100, [90, 80, 70])
+ save_round_times(
+ str(tmp_path),
+ [
+ {"batch_size": 1, "width": 1, "round_us": 1000, "count": 10},
+ {"batch_size": 1, "width": 4, "round_us": 1200, "count": 10},
+ {"batch_size": 512, "width": 1, "round_us": 1000, "count": 10},
+ {"batch_size": 512, "width": 4, "round_us": 4000, "count": 10},
+ ],
+ )
+ config = SpeculativeConfig(
+ method=METHOD_NAME,
+ method_config={"mode": "serve", "intensity": "chain_intensity", "data_path": str(tmp_path)},
+ )
+ assert config.num_speculative_tokens == 3
+ schedule = config.num_speculative_tokens_per_batch_size
+ assert next(k for first, last, k in schedule if first <= 1 <= last) == 3
+ assert next(k for first, last, k in schedule if first <= 512 <= last) == 0
+
+
+def test_native_schedule_survives_real_speculative_config_serialization(registered, tmp_path):
+ import json
+ from tests.test_chain_no_spec import _native_schedule_config
+
+ if not hasattr(SpeculativeConfig, "native_decode_batch_sizes"):
+ pytest.skip("Host lacks the optional native-decode capability")
+ expected = _native_schedule_config(tmp_path)
+ config = SpeculativeConfig(method=METHOD_NAME, method_config=expected.method_config)
+ assert config.native_decode_batch_sizes == expected.native_decode_batch_sizes
+ fields = (
+ "method",
+ "method_config",
+ "num_speculative_tokens",
+ "num_speculative_tokens_per_batch_size",
+ "native_decode_batch_sizes",
+ )
+ again = SpeculativeConfig(**json.loads(json.dumps({name: getattr(config, name) for name in fields})))
+ assert again.native_decode_batch_sizes == config.native_decode_batch_sizes
+ assert again.num_speculative_tokens_per_batch_size == config.num_speculative_tokens_per_batch_size
+
+
+def test_trees_refuse_native_decode_ranges(registered):
+ if not hasattr(SpeculativeConfig, "native_decode_batch_sizes"):
+ pytest.skip("Host lacks the optional native-decode capability")
+ with pytest.raises(ValueError, match="native decode.*chain"):
+ SpeculativeConfig(method=METHOD_NAME, method_config=STATIC, native_decode_batch_sizes=[(1, 64)])
+
+
+def test_static_mode_has_no_batch_schedule(registered):
+ config = SpeculativeConfig(method=METHOD_NAME, method_config=STATIC)
+ assert config.num_speculative_tokens == 31
+ assert config.num_speculative_tokens_per_batch_size is None
+
+
+def test_measured_tree_rounds_narrow_only_the_losing_batch_sizes(registered, tmp_path):
+ from eagle_harness.core.chain_width import merge_tree_rounds
+
+ def row(bs, width, round_us, accept):
+ return {"batch_size": bs, "width": width, "round_us": round_us, "accept": accept, "count": 50}
+
+ merge_tree_rounds(
+ str(tmp_path),
+ [row(8, 16, 12_500, 4.43), row(8, 4, 9_000, 2.9), row(64, 16, 47_900, 3.96), row(64, 4, 20_000, 2.9)],
+ )
+ tree = {"mode": "static", "node_top_k": 4, "tree_depth": 14, "max_verify_width": 16, "data_path": str(tmp_path)}
+ config = SpeculativeConfig(method=METHOD_NAME, method_config=tree)
+ schedule = config.num_speculative_tokens_per_batch_size
+ assert schedule is not None, "measured rounds must give the tree a batch-size schedule"
+ assert validate_and_normalize_dynamic_sd_schedule(schedule) == schedule
+ k_at = lambda bs: next(k for first, last, k in schedule if first <= bs <= last) # noqa: E731
+ assert (k_at(1), k_at(8), k_at(64), k_at(512)) == (15, 15, 3, 3)
+ assert config.num_speculative_tokens == 15
+ # The same tree without measured rounds keeps one width (the release default).
+ plain = SpeculativeConfig(method=METHOD_NAME, method_config={**tree, "data_path": str(tmp_path / "none")})
+ assert plain.num_speculative_tokens_per_batch_size is None
+
+
+def test_record_rounds_needs_a_data_path():
+ assert parse_method_config({"mode": "static", "record_rounds": True, "data_path": "/x"}).record_rounds is True
+ assert parse_method_config({"mode": "static"}).record_rounds is False
+ with pytest.raises(ValueError, match="record_rounds"):
+ parse_method_config({"mode": "static", "record_rounds": True})
+ with pytest.raises(ValueError, match="record_rounds"):
+ parse_method_config({"mode": "static", "record_rounds": "yes", "data_path": "/x"})
+
+
+def test_user_schedule_wins(registered):
+ mine = [(1, 4, 7)]
+ config = SpeculativeConfig(method=METHOD_NAME, method_config=COST, num_speculative_tokens_per_batch_size=mine)
+ assert config.num_speculative_tokens_per_batch_size == mine
+
+
+def test_explicit_num_speculative_tokens_must_agree(registered):
+ ok = SpeculativeConfig(method=METHOD_NAME, method_config=COST, num_speculative_tokens=31)
+ assert ok.num_speculative_tokens == 31
+ with pytest.raises(ValueError, match="disagrees"):
+ SpeculativeConfig(method=METHOD_NAME, method_config=COST, num_speculative_tokens=8)
+
+
+def test_typo_in_method_config_fails_at_config_time(registered):
+ with pytest.raises(ValueError, match="tre_depth"):
+ SpeculativeConfig(method=METHOD_NAME, method_config={**COST, "tre_depth": 3})
+
+
+def test_lookahead_reaches_the_vllm_config(registered):
+ config = SpeculativeConfig(method=METHOD_NAME, method_config=COST)
+ fake = SimpleNamespace(speculative_config=config, num_speculative_tokens=config.num_speculative_tokens)
+ assert VllmConfig.num_lookahead_tokens.fget(fake) == 96
+
+
+def test_the_method_name_is_unknown_before_the_plugin_runs():
+ vllm_registry.unregister_speculative_method(METHOD_NAME)
+ with pytest.raises(ValueError, match="Unknown speculative method"):
+ SpeculativeConfig(method=METHOD_NAME, method_config=STATIC)
+
+
+# ------------------------------------------------------------------ hook map
+def test_every_mapped_hook_exists_in_vllm():
+ from eagle_harness.vllm.adapter import missing_hooks
+
+ assert missing_hooks() == []
+
+
+def test_register_refuses_a_vllm_without_a_mapped_hook(monkeypatch):
+ from eagle_harness.vllm import adapter
+
+ monkeypatch.setattr(
+ adapter, "HOOK_MAP", adapter.HOOK_MAP + (adapter.HookUse("x", "vllm.config:NoSuchHook", "gpu"),)
+ )
+ assert adapter.missing_hooks() == ["vllm.config:NoSuchHook"]
+ records = []
+ handler = logging.Handler()
+ handler.emit = records.append
+ logging.getLogger("eagle_harness.compat").addHandler(handler) # the plugin's loggers may not propagate to root
+ try:
+ assert plugin.register() is False
+ finally:
+ logging.getLogger("eagle_harness.compat").removeHandler(handler)
+ (message,) = [r.getMessage() for r in records if r.levelno == logging.ERROR]
+ assert f"vllm {vllm.__version__} lacks 1 of the hooks it needs (vllm.config:NoSuchHook)" in message
+ assert "Fix: install vllm with the eagle-harness hooks" in message
+
+
+def test_hook_map_statuses_are_known():
+ assert {use.status for use in HOOK_MAP} == {"cpu", "gpu", "none"}
+ assert all(not use.hook for use in HOOK_MAP if use.status == "none")
+
+
+# ------------------------------------------------------------------ skeleton honesty
+SPECULATOR_HOOKS = ("make_rejection_sampler", "prepare_verify_inputs", "post_accept")
+
+
[email protected]("name", SPECULATOR_HOOKS)
+def test_speculator_hooks_match_the_vllm_signatures(name):
+ from eagle_harness.vllm.speculator import HarnessSpeculator
+
+ ours = inspect.signature(getattr(HarnessSpeculator, name)).parameters
+ theirs = inspect.signature(getattr(BaseSpeculator, name)).parameters
+ assert list(ours) == list(theirs)
+
+
+def test_gdn_extension_factory_follows_the_mode():
+ from vllm.model_executor.layers.mamba.gdn.verify_extension import LinearAttnVerifyExtension
+
+ from eagle_harness.vllm.gdn_tree_verify import TreeVerify, create_extension
+
+ def config(method_config):
+ return SimpleNamespace(speculative_config=SimpleNamespace(method_config=method_config))
+
+ assert create_extension(config(CHAIN)) is None # a chain is verified by vLLM's own kernels
+ extension = create_extension(config(STATIC))
+ assert isinstance(extension, TreeVerify) and isinstance(extension, LinearAttnVerifyExtension)
+
+
+def test_tree_mode_refuses_linear_layers_the_extension_cannot_reach(monkeypatch):
+ """A Mamba2 layer reaches the tree verify only through vLLM's Mamba2 hook; without it (or for any other linear
+ layer) vLLM's kernels would verify every tree as a chain, so the speculator refuses the target."""
+ from vllm.model_executor.layers.mamba.gdn.qwen_gdn_linear_attn import QwenGatedDeltaNetAttention
+ from vllm.model_executor.layers.mamba.gdn.verify_extension import LinearAttnVerifyExtension
+ from vllm.model_executor.layers.mamba.mamba_mixer2 import MambaMixer2
+
+ from eagle_harness.vllm.gdn_tree_verify import check_tree_verifiable
+
+ gdn, mamba2 = object.__new__(QwenGatedDeltaNetAttention), object.__new__(MambaMixer2)
+ check_tree_verifiable([gdn, gdn])
+ with pytest.raises(RuntimeError, match="object layers"):
+ check_tree_verifiable([gdn, object()])
+
+ def mamba2_hook(self, rows):
+ raise AssertionError("not called")
+
+ monkeypatch.setattr(LinearAttnVerifyExtension, "forward_mamba2_spec_rows", mamba2_hook, raising=False)
+ check_tree_verifiable([gdn, mamba2])
+ monkeypatch.delattr(LinearAttnVerifyExtension, "forward_mamba2_spec_rows")
+ with pytest.raises(RuntimeError, match="MambaMixer2 layers.*forward_mamba2_spec_rows"):
+ check_tree_verifiable([gdn, mamba2])
+
+
+def test_draft_aux_norms_run_on_the_kernel_ops(monkeypatch):
+ """``combine_hidden_states`` (called eagerly by the draft prefill) runs inside ``_kernel_ops``, so the per-chunk
+ RMSNorms dispatch to vLLM's CUDA kernel rather than the native torch code."""
+ import contextlib
+
+ from eagle_harness.vllm import models
+
+ events = []
+
+ @contextlib.contextmanager
+ def record():
+ events.append("enter")
+ yield
+ events.append("exit")
+
+ monkeypatch.setattr(models, "_kernel_ops", record)
+ monkeypatch.setattr(
+ models.Eagle3LlamaForCausalLM, "combine_hidden_states", lambda self, h: events.append("combine") or h
+ )
+ model = object.__new__(models.LlamaForCausalLMEagle4)
+ hidden = object()
+ assert model.combine_hidden_states(hidden) is hidden
+ assert events == ["enter", "combine", "exit"]
+
+
+def test_package_logs_through_vllms_handler():
+ import logging
+
+ from eagle_harness.vllm.plugin import _log_through_vllm
+
+ ours, theirs = logging.getLogger("eagle_harness"), logging.getLogger("vllm")
+ saved = (list(ours.handlers), ours.level, ours.propagate, list(theirs.handlers))
+ try:
+ ours.handlers.clear()
+ handler = logging.StreamHandler()
+ theirs.addHandler(handler)
+ _log_through_vllm()
+ assert handler in ours.handlers and not ours.propagate
+ finally:
+ ours.handlers[:], ours.level, ours.propagate = saved[0], saved[1], saved[2]
+ theirs.handlers[:] = saved[3]
+
+
+# A reduced-size Nemotron EAGLE-4 draft configuration with the same layer structures.
+NEMOTRON35_DRAFT = dict(
+ architectures=["LlamaForCausalLMEagle4"],
+ num_hidden_layers=1,
+ hidden_size=256,
+ num_attention_heads=4,
+ num_key_value_heads=4,
+ intermediate_size=512,
+ vocab_size=1000,
+ efficient_lm_head_config={"type": "low_rank", "rank": 32, "num_candidates": 64},
+ attn_norm=True,
+ use_rope=False,
+ layer_types=["sliding_attention"],
+ sliding_window=64,
+ hidden_act="relu2",
+ enable_moe=True,
+ moe_architecture="nemotron_latent_relu2",
+ n_routed_experts=8,
+ num_experts_per_tok=2,
+ moe_intermediate_size=64,
+ moe_latent_size=32,
+ n_shared_experts=1,
+ moe_shared_expert_intermediate_size=128,
+ scoring_func="sigmoid",
+ topk_method="noaux_tc",
+ routed_scaling_factor=5.0,
+ norm_topk_prob=True,
+ fc_norm=True,
+ norm_output=True,
+ eagle_config={"eagle_aux_hidden_state_layer_ids": [7, 47, 78]},
+ max_position_embeddings=1048576,
+)
+NEMOTRON35_MAX_POSITIONS = 1048576
+
+
+def test_base_layer_config_restores_after_constructor_failure():
+ from eagle_harness.vllm.models import _base_layer_config
+
+ config = SimpleNamespace(
+ hidden_act="relu2",
+ max_position_embeddings=4096,
+ enable_moe=True,
+ moe_architecture="nemotron_latent_relu2",
+ use_rope=False,
+ )
+ original = vars(config).copy()
+ with pytest.raises(RuntimeError, match="layer init failed"):
+ with _base_layer_config(config):
+ assert (config.hidden_act, config.max_position_embeddings) == ("silu", 1)
+ raise RuntimeError("layer init failed")
+ assert vars(config) == original
+
+
+def test_vllm_builds_the_nemotron_draft_structures():
+ """NoPE, attn_norm and the latent ReLU^2 MoE are built on vLLM; a SwiGLU MoE and the sandwich norm are not."""
+ import transformers
+
+ from eagle_harness.vllm.models import _base_layer_config, check_supported, uses_rope
+
+ config = transformers.LlamaConfig(**NEMOTRON35_DRAFT)
+ check_supported(config)
+ assert not uses_rope(config) and uses_rope(transformers.LlamaConfig())
+ with _base_layer_config(config): # vLLM's EAGLE-3 layer builds a SiLU MLP and a 1-position rotary placeholder
+ assert (config.hidden_act, config.max_position_embeddings) == ("silu", 1)
+ assert config.hidden_act == "relu2" and config.max_position_embeddings == NEMOTRON35_MAX_POSITIONS
+ swiglu_moe = {**NEMOTRON35_DRAFT, "moe_architecture": "sparse_swiglu", "hidden_act": "silu"}
+ with pytest.raises(NotImplementedError, match="nemotron_latent_relu2"):
+ check_supported(transformers.LlamaConfig(**swiglu_moe))
+ with pytest.raises(NotImplementedError, match="enable_post_mlp_norm"):
+ check_supported(transformers.LlamaConfig(**{**NEMOTRON35_DRAFT, "enable_post_mlp_norm": True}))
+
+
+def test_attn_norm_modules_are_registered_on_the_draft_layer():
+ """``eh_proj`` / ``pre_attention_layernorm`` must resolve to the registered submodules (a class-level ``None``
+ default once shadowed them and the compiled prefill fed the 2H input to the H-wide qkv projection)."""
+ import torch
+
+ from eagle_harness.vllm.models import _Eagle4DecoderLayer
+
+ layer = _Eagle4DecoderLayer.__new__(_Eagle4DecoderLayer)
+ torch.nn.Module.__init__(layer)
+ layer.eh_proj = layer.pre_attention_layernorm = None # as _build_structures starts
+ assert layer.eh_proj is None
+ proj = torch.nn.Linear(4, 2)
+ layer.eh_proj = proj
+ assert layer.eh_proj is proj and dict(layer.named_children())["eh_proj"] is proj
+
+
[email protected]("host_supports_stream_control", [True, False])
+def test_nemotron_draft_uses_public_shared_expert_stream_control(monkeypatch, host_supports_stream_control):
+ from types import SimpleNamespace
+
+ import torch
+
+ from eagle_harness.vllm import models
+
+ calls = []
+ shared = SimpleNamespace()
+ if host_supports_stream_control:
+ shared.disable_aux_stream = lambda: calls.append("disabled")
+ mlp = torch.nn.Module()
+ mlp.experts = SimpleNamespace(shared_experts=shared)
+ monkeypatch.setattr(models, "_latent_moe", lambda *args: mlp)
+ model = models.LlamaForCausalLMEagle4.__new__(models.LlamaForCausalLMEagle4)
+ torch.nn.Module.__init__(model)
+ model.config = SimpleNamespace(hidden_size=4, enable_moe=True, moe_architecture=models.LATENT_MOE)
+ model.model = torch.nn.Module()
+ layer = torch.nn.Module()
+ layer.self_attn = SimpleNamespace(attn=SimpleNamespace(layer_name="model.layers.0.self_attn.attn"))
+ model.model.layers = torch.nn.ModuleList([layer])
+ if host_supports_stream_control:
+ model._build_structures(None)
+ assert calls == ["disabled"]
+ else:
+ with pytest.raises(NotImplementedError, match="SharedExperts.disable_aux_stream"):
+ model._build_structures(None)
diff --git a/tests/test_vllm_priced_serve.py b/tests/test_vllm_priced_serve.py
new file mode 100644
index 0000000..76168f3
--- /dev/null
+++ b/tests/test_vllm_priced_serve.py
@@ -0,0 +1,30 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Automatic serving must not turn missing prices into maximum speculation."""
+
+from types import SimpleNamespace
+
+import pytest
+
+from eagle_harness.vllm.config import configure_speculative_config
+
+
+def _spec(data_path, **overrides):
+ return SimpleNamespace(
+ method_config={"data_path": str(data_path), "intensity": "chain_intensity", **overrides},
+ draft_model_config=None,
+ num_speculative_tokens_per_batch_size=None,
+ num_speculative_tokens=None,
+ )
+
+
+def test_unpriced_automatic_chain_refuses_startup(tmp_path):
+ with pytest.raises(ValueError, match="acceptance profile"):
+ configure_speculative_config(_spec(tmp_path))
+
+
+def test_explicit_chain_width_preserves_unpriced_opt_in(tmp_path):
+ config = _spec(tmp_path, max_verify_width=8)
+ configure_speculative_config(config)
+ assert config.num_speculative_tokens_per_batch_size == [(1, 512, 7), (513, 1 << 16, 0)]
diff --git a/tests/test_vllm_round_recorder.py b/tests/test_vllm_round_recorder.py
new file mode 100644
index 0000000..a9d9b8d
--- /dev/null
+++ b/tests/test_vllm_round_recorder.py
@@ -0,0 +1,68 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The served-round recorder of the vLLM tree speculator (CPU tensors, a fake clock)."""
+
+from __future__ import annotations
+
+import torch
+
+from eagle_harness.core.chain_width import load_tree_rounds
+from eagle_harness.vllm.round_recorder import ServedRoundRecorder
+
+
+class Clock:
+ def __init__(self):
+ self.now = 0.0
+
+ def __call__(self):
+ return self.now
+
+
+def _feed(rec, clock, rounds, num_reqs, count, sampled, period_s, prefill=False):
+ for _ in range(rounds):
+ clock.now += period_s
+ rec.round(num_reqs, count, prefill, torch.full((num_reqs + 3,), sampled, dtype=torch.int32))
+
+
+def test_rows_are_the_median_period_and_mean_accept_of_steady_rounds(tmp_path):
+ clock = Clock()
+ rec = ServedRoundRecorder(str(tmp_path), writer=True, flush_rounds=10_000, min_rounds=4, clock=clock)
+ # The first call of a shape opens it; the next 5 rounds of 64 requests at count 3 are width-4 rounds of 20 ms.
+ _feed(rec, clock, 6, 64, 3, sampled=3, period_s=0.020)
+ rows = rec.rows()
+ assert rows == [{"batch_size": 64, "width": 4, "round_us": 20_000.0, "accept": 3.0, "count": 5}]
+
+
+def test_a_period_counts_only_between_two_decode_rounds_of_one_shape(tmp_path):
+ clock = Clock()
+ rec = ServedRoundRecorder(str(tmp_path), writer=True, flush_rounds=10_000, min_rounds=1, clock=clock)
+ _feed(rec, clock, 3, 8, 15, sampled=5, period_s=0.010) # 2 periods at (8, 16)
+ _feed(rec, clock, 1, 8, 15, sampled=5, period_s=0.500, prefill=True) # a prefill round: no period
+ _feed(rec, clock, 1, 8, 15, sampled=5, period_s=0.400) # follows a prefill: no period
+ _feed(rec, clock, 1, 9, 15, sampled=5, period_s=0.300) # batch size changed: no period
+ _feed(rec, clock, 1, 9, 3, sampled=5, period_s=0.011) # the previous round drafted 15: a width-16 round of 9
+ _feed(rec, clock, 1, 9, 3, sampled=2, period_s=0.007) # a width-4 round of 9
+ rows = {(r["batch_size"], r["width"]): r for r in rec.rows()}
+ assert set(rows) == {(8, 16), (9, 16), (9, 4)}
+ assert rows[(8, 16)]["round_us"] == 10_000.0 and rows[(8, 16)]["count"] == 2
+ assert rows[(9, 16)]["round_us"] == 11_000.0 and rows[(9, 16)]["accept"] == 5.0
+ assert rows[(9, 4)]["round_us"] == 7_000.0 and rows[(9, 4)]["accept"] == 2.0
+
+
+def test_cells_below_min_rounds_are_not_written(tmp_path):
+ clock = Clock()
+ rec = ServedRoundRecorder(str(tmp_path), writer=True, flush_rounds=10_000, min_rounds=8, clock=clock)
+ _feed(rec, clock, 5, 64, 3, sampled=3, period_s=0.020)
+ assert rec.rows() == []
+
+
+def test_flush_merges_into_the_data_path_and_only_the_writer_writes(tmp_path):
+ clock = Clock()
+ rec = ServedRoundRecorder(str(tmp_path), writer=True, flush_rounds=4, min_rounds=2, clock=clock)
+ _feed(rec, clock, 5, 64, 15, sampled=4, period_s=0.048) # the 4th recorded round flushes
+ assert load_tree_rounds(str(tmp_path)) == {64: {16: (48_000.0, 4.0)}}
+ other = tmp_path / "other"
+ quiet = ServedRoundRecorder(str(other), writer=False, flush_rounds=1, min_rounds=1, clock=clock)
+ _feed(quiet, clock, 3, 64, 15, sampled=4, period_s=0.048)
+ assert load_tree_rounds(str(other)) is None
diff --git a/tests/test_wheel_index.py b/tests/test_wheel_index.py
new file mode 100644
index 0000000..636cc80
--- /dev/null
+++ b/tests/test_wheel_index.py
@@ -0,0 +1,101 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The release index must work without hosting wheel bytes on Pages."""
+
+import hashlib
+from html.parser import HTMLParser
+from pathlib import Path
+import subprocess
+import sys
+from urllib.parse import quote
+import zipfile
+
+import pytest
+
+SCRIPT = Path(__file__).resolve().parents[1] / "tools/mk_index.py"
+BASE_URL = "https://github.com/eagle-hq/EAGLE-4/releases/download/v0.1.0"
+
+
+class Links(HTMLParser):
+ def __init__(self, text):
+ super().__init__()
+ self.links = []
+ self.feed(text)
+
+ def handle_starttag(self, tag, attrs):
+ if tag == "a":
+ self.links.append(dict(attrs))
+
+
+def wheel(directory, name="Example_Engine", version="0.1.0+eagle.4"):
+ path = directory / f"{name}-{version}-py3-none-any.whl"
+ with zipfile.ZipFile(path, "w") as archive:
+ archive.writestr(
+ f"{name}-{version}.dist-info/METADATA",
+ f"Name: {name}\nVersion: {version}\nRequires-Python: >=3.10\n",
+ )
+ return path
+
+
+def run_index(root, *artifacts, base_url=None, script=SCRIPT):
+ command = [sys.executable, str(script), str(root), *(str(p) for p in artifacts)]
+ if base_url is not None:
+ command += ["--base-url", base_url]
+ return subprocess.run(command, capture_output=True, text=True)
+
+
[email protected]("base_url", [None, BASE_URL, BASE_URL + "/"])
+def test_index_links_and_metadata(tmp_path, base_url):
+ artifact = wheel(tmp_path)
+ root = tmp_path / "index"
+ result = run_index(root, artifact, base_url=base_url)
+ assert result.returncode == 0, result.stderr
+ page = root / "simple/example-engine/index.html"
+ (link,) = Links(page.read_text()).links
+ prefix = BASE_URL if base_url else "../../files"
+ digest = hashlib.sha256(artifact.read_bytes()).hexdigest()
+ assert link == {
+ "href": f"{prefix}/{quote(artifact.name)}#sha256={digest}",
+ "data-requires-python": ">=3.10",
+ }
+ assert Links((root / "simple/index.html").read_text()).links == [{"href": "example-engine/"}]
+ assert (root / "SHA256SUMS").read_text() == f"{digest} files/{artifact.name}\n"
+
+
[email protected]("base_url", [None, BASE_URL])
+def test_released_bytes_are_immutable_and_reruns_add_versions(tmp_path, base_url):
+ artifact = wheel(tmp_path)
+ root = tmp_path / "index"
+ assert run_index(root, artifact, base_url=base_url).returncode == 0
+ first_page = (root / "simple/example-engine/index.html").read_bytes()
+ assert run_index(root, artifact, base_url=base_url).returncode == 0
+ assert (root / "simple/example-engine/index.html").read_bytes() == first_page
+ later = wheel(tmp_path, version="0.1.0+eagle.5")
+ assert run_index(root, later, base_url=base_url).returncode == 0
+ page = (root / "simple/example-engine/index.html").read_bytes()
+ assert len(Links(page.decode()).links) == 2
+ original = artifact.read_bytes()
+ artifact.write_bytes(b"different released bytes")
+ result = run_index(root, artifact, base_url=base_url)
+ assert result.returncode != 0
+ assert "a release artifact never changes" in result.stderr
+ assert (root / "files" / artifact.name).read_bytes() == original
+ assert (root / "simple/example-engine/index.html").read_bytes() == page
+
+
+ "base_url",
+ [
+ "/relative",
+ "http://example.org",
+ "https://user:[email protected]",
+ "https://example.org/?x=1",
+ "https://example.org/#frag",
+ ],
+)
+def test_reject_invalid_asset_base(tmp_path, base_url):
+ result = run_index(tmp_path / "index", wheel(tmp_path), base_url=base_url)
+ assert result.returncode != 0
+ assert "HTTPS URL without credentials, query or fragment" in result.stderr
+ assert not (tmp_path / "index").exists()
diff --git a/tests/test_worker_rounds.py b/tests/test_worker_rounds.py
new file mode 100644
index 0000000..9b78a29
--- /dev/null
+++ b/tests/test_worker_rounds.py
@@ -0,0 +1,419 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Worker round ordering on CPU, with only the engine/GPU boundary replaced."""
+
+import contextlib
+import importlib.util
+import sys
+from dataclasses import dataclass
+from enum import Enum
+from pathlib import Path
+from types import ModuleType, SimpleNamespace
+
+import pytest
+import torch
+
+from eagle_harness.sglang.chain_rounds import BLOCK_ROUNDS, MIN_ROUNDS, ChainCalibration, ChainRounds
+
+
+class Mode(Enum):
+ DECODE = 0
+ EXTEND = 1
+ IDLE = 2
+
+ def is_extend(self):
+ return self is Mode.EXTEND
+
+ def is_idle(self):
+ return self is Mode.IDLE
+
+
+class Request:
+ pass
+
+
+def modules(monkeypatch):
+ copies = []
+
+ def stub(name, **attrs):
+ if "." in name and name.rpartition(".")[0] not in sys.modules:
+ stub(name.rpartition(".")[0])
+ module = ModuleType(name)
+ module.__path__ = []
+ module.__dict__.update(attrs)
+ monkeypatch.setitem(sys.modules, name, module)
+
+ def load(name):
+ path = Path(__file__).parents[1] / (name.replace(".", "/") + ".py")
+ spec = importlib.util.spec_from_file_location(name, path)
+ module = importlib.util.module_from_spec(spec)
+ monkeypatch.setitem(sys.modules, name, module)
+ spec.loader.exec_module(module)
+ return module
+
+ @dataclass
+ class Result:
+ new_seq_lens: object
+ next_token_ids: object
+ accept_lens: object
+ logits_output: object
+ next_draft_input: object
+
+ def copy_to_cpu(self, return_logprob, return_hidden_states=True):
+ copies.append(("copy", return_logprob, return_hidden_states))
+
+ class BaseWorker:
+ @property
+ def target_worker(self):
+ return self._target_worker
+
+ stub("sglang")
+ stub("sglang.version", __version__="fixture")
+ stub("sglang.srt.distributed.parallel_state", get_tp_group=lambda: SimpleNamespace(
+ rank_in_group=0, broadcast_object=lambda cells, src: cells
+ ))
+ stub(
+ "sglang.srt.layers.moe.utils",
+ speculative_moe_a2a_backend_context=contextlib.nullcontext,
+ speculative_moe_backend_context=contextlib.nullcontext,
+ )
+ stub("sglang.srt.model_executor.cuda_graph_config", Backend=object, Phase=object, check_cuda_graph_backend=object)
+ stub("sglang.srt.model_executor.runner", get_batch_sizes_to_capture=lambda runner: ([1, 8], None))
+ stub(
+ "sglang.srt.runtime_context", **dict.fromkeys(("get_exec", "get_model", "get_parallel", "get_schedule", "get_spec"), object)
+ )
+ stub("sglang.srt.speculative.draft_utils", DraftBackendFactory=object)
+ stub("sglang.srt.speculative.eagle_utils", default_tree_mask_mode=object)
+ stub("sglang.srt.speculative.eagle_worker_common", run_eagle_verify=object, build_eagle_verify_input=object)
+ stub("sglang.srt.speculative.eagle_worker_v2", EagleDraftWorker=object, EAGLEWorkerV2=BaseWorker)
+ stub(
+ "sglang.srt.speculative.spec_utils",
+ draft_tp_context=contextlib.nullcontext,
+ spec_stage_span=lambda name: contextlib.nullcontext(),
+ )
+ stub(
+ "sglang.srt.model_executor.forward_batch_info", ForwardMode=Mode, CaptureHiddenMode=SimpleNamespace(FULL="full")
+ )
+ stub("sglang.srt.speculative.spec_info", SpeculativeAlgorithm=SimpleNamespace(NONE="none"))
+ stub("sglang.srt.managers.utils", GenerationBatchResult=Result)
+ stub("sglang.srt.managers.overlap_utils", FutureMap=SimpleNamespace(publish=lambda self, lengths: None))
+ for name, attrs in {
+ "draft_extend": ("DraftExtend",),
+ "draft_steps": ("DraftSteps",),
+ "l2_warm": ("MlpL2WarmAhead",),
+ "row_attention": ("DraftRowAttention",),
+ "verify_step": ("AcceptTailGraphs", "fused_accept_step", "fused_accept_supported"),
+ "verify_graphs": ("verify_widths", "round_up_width"),
+ "verify_input": ("HarnessVerifyInput", "build_attn_args"),
+ "verify_tail": ("VerifyTail",),
+ }.items():
+ stub(f"eagle_harness.sglang.{name}", **dict.fromkeys(attrs, object))
+ plain = load("eagle_harness.sglang.plain_decode")
+ drafter = load("eagle_harness.sglang.drafter")
+ worker = load("eagle_harness.sglang.worker")
+ return SimpleNamespace(worker=worker, plain=plain, drafter=drafter, base=BaseWorker, Result=Result, copies=copies)
+
+
+def make_batch(*requests, mode=Mode.DECODE, mixed=False):
+ return SimpleNamespace(
+ forward_mode=mode,
+ is_extend_in_batch=mixed,
+ return_logprob=False,
+ reqs=list(requests),
+ seq_lens=torch.tensor([5] * len(requests)),
+ seq_lens_cpu=torch.tensor([5] * len(requests)),
+ req_pool_indices=torch.arange(len(requests)),
+ spec_info=SimpleNamespace(bonus_tokens=torch.tensor([17] * len(requests)), hidden_states=object()),
+ spec_algorithm="eagle",
+ )
+
+
+def make_worker(modules, monkeypatch, *, calibration=None, schedule=None, native=True):
+ calls = []
+ worker = modules.worker.EagleHarnessWorker.__new__(modules.worker.EagleHarnessWorker)
+ worker._verified = SimpleNamespace(
+ record=lambda: calls.append("record"), query=lambda: calls.append("wait") or True
+ )
+ worker._draft_context = contextlib.nullcontext
+ worker.req_to_token_pool = SimpleNamespace(req_to_token=torch.arange(80).reshape(8, 10))
+
+ def draft(batch):
+ calls.append("draft")
+ if calibration is not None:
+ drafter.last_width = worker._chain_rounds.draft_width(len(batch.reqs))
+ return "verify-input"
+
+ fence = object()
+ scheduler_stream = object()
+ monkeypatch.setattr(torch.cuda, "current_stream", lambda: scheduler_stream)
+
+ def prelaunch(batch, *, extend, inputs, stream=None):
+ assert stream is None or stream is scheduler_stream
+ calls.append("prelaunch")
+ assert inputs[0] is batch.seq_lens
+ extend()
+ if calibration is not None:
+ worker._chain_rounds.draft_width(len(batch.reqs))
+ return fence
+
+ drafter = SimpleNamespace(
+ cancel_prelaunch=lambda: calls.append("cancel"),
+ average_context=lambda batch: calls.append("context") or 5,
+ draft=draft,
+ last_width=4,
+ timer=None,
+ prelaunch=prelaunch,
+ )
+ worker._drafter = drafter
+ worker._draft_worker = SimpleNamespace(extend_after_verify=lambda *args: calls.append("extend"))
+ worker._build_trivial_verify_input = lambda batch: calls.append("trivial") or "trivial"
+
+ def verify(batch, width, grammar_barrier):
+ calls.append(("verify", width))
+ if grammar_barrier:
+ grammar_barrier()
+ return modules.Result(
+ batch.seq_lens + 1,
+ torch.tensor([23] * len(batch.reqs)),
+ torch.tensor([width] * len(batch.reqs)),
+ SimpleNamespace(hidden_states=torch.zeros(1)),
+ object(),
+ ), True
+
+ worker._verify = verify
+
+ def target(batch, **kwargs):
+ calls.append("decode")
+ assert kwargs == {"capture_hidden_mode": "full"}
+ assert batch.spec_algorithm == "none" and batch.spec_info is None
+ assert batch.input_ids.tolist() == [17] * len(batch.reqs)
+ assert batch.out_cache_loc.tolist() == [i * 10 + 5 for i in range(len(batch.reqs))]
+ return SimpleNamespace(next_token_ids=torch.tensor([23] * len(batch.reqs)))
+
+ worker._target_worker = SimpleNamespace(forward_batch_generation=target)
+ worker._chain_rounds = ChainRounds(schedule, calibration, drafter.average_context)
+ worker._native_decode = modules.plain.NativeDecode(
+ worker.target_worker, worker.req_to_token_pool.req_to_token, worker._chain_rounds, enabled=native
+ )
+ if calibration is not None:
+ for name in ("interrupt", "round_start", "accepted"):
+ method = getattr(calibration, name)
+
+ def record(*args, _name=name, _method=method):
+ calls.append((_name, *args[:2]) if _name == "round_start" else _name)
+ return _method(*args)
+
+ monkeypatch.setattr(calibration, name, record)
+ return worker, calls, fence
+
+
[email protected]("overlap", [False, True])
[email protected]("calibrating", [False, True])
+def test_native_decode_orders_barrier_calibration_publication_and_wait(modules, monkeypatch, tmp_path, calibrating, overlap):
+ cal = (
+ ChainCalibration(str(tmp_path), [1, 4], torch.device("cpu"), writer=False, native_decode=True)
+ if calibrating
+ else None
+ )
+ if cal is not None:
+ cal.last_width = 0
+ worker, calls, _ = make_worker(modules, monkeypatch, calibration=cal, schedule=[(1, 8, 0)])
+ batch = make_batch(Request(), Request())
+ root = batch.spec_info
+ result = worker.forward_batch_generation(
+ batch,
+ on_publish=(lambda lengths: calls.append(("publish", lengths.tolist()))) if overlap else None,
+ grammar_barrier=lambda: calls.append("barrier"),
+ )
+ expected = ["cancel", "barrier"]
+ if calibrating:
+ expected += ["context", ("round_start", 2, 0)]
+ assert cal._planned == 0 # Dispatch reads the selected width without advancing calibration.
+ assert calls == expected + ["decode", "record"] + ([("publish", [6, 6])] if overlap else ["wait"])
+ assert result.accept_lens.tolist() == [1, 1]
+ assert result.accept_index.tolist() == [[0], [1]]
+ assert result.speculative_num_draft_tokens == 1
+ assert result.next_draft_input.bonus_tokens is result.next_token_ids
+ assert result.next_draft_input.hidden_states is root.hidden_states
+ assert batch.spec_info is root and batch.spec_algorithm == "eagle"
+ assert batch.seq_lens_cpu.tolist() == [6, 6] and batch.seq_lens_sum is None
+ assert not hasattr(result, "prelaunch_done")
+
+
[email protected]("overlap", [False, True])
[email protected]("calibrating", [False, True])
+def test_speculative_round_keeps_calibration_and_prelaunch_order(modules, monkeypatch, tmp_path, calibrating, overlap):
+ cal = (
+ ChainCalibration(str(tmp_path), [4], torch.device("cpu"), writer=False, native_decode=True)
+ if calibrating
+ else None
+ )
+ worker, calls, fence = make_worker(modules, monkeypatch, calibration=cal, schedule=[(1, 8, 4)], native=calibrating)
+ result = worker.forward_batch_generation(
+ make_batch(Request()),
+ on_publish=(lambda lengths: calls.append("publish")) if overlap else None,
+ grammar_barrier=lambda: calls.append("barrier"),
+ )
+ expected = ["draft"]
+ if calibrating:
+ expected += ["context", ("round_start", 1, 4)]
+ expected += [("verify", 4), "barrier", "record"]
+ if calibrating:
+ expected += ["accepted"]
+ assert cal._accept.tolist() == [0, 0, 0, 0, 1]
+ assert cal._planned == 2
+ assert calls == expected + (["publish"] if overlap else []) + ["prelaunch", "extend"] + ([] if overlap else ["wait"])
+ assert isinstance(result, modules.drafter.PrelaunchResult)
+ assert result.prelaunch_done is fence
+
+
[email protected]("mode,mixed", [(Mode.EXTEND, False), (Mode.DECODE, True)])
+def test_prefill_cancels_and_interrupts_before_delegating(modules, monkeypatch, tmp_path, mode, mixed):
+ cal = ChainCalibration(str(tmp_path), [1, 4], torch.device("cpu"), writer=False, native_decode=True)
+ cal.last_width, cal._planned = 0, 100
+ worker, calls, _ = make_worker(modules, monkeypatch, calibration=cal, schedule=[(1, 8, 0)])
+ batch = make_batch(Request(), mode=mode, mixed=mixed)
+ args = (object(), object(), object())
+ sentinel = object()
+
+ def prefill(self, actual, *actual_args):
+ assert actual is batch and actual_args == args
+ calls.append("prefill")
+ return sentinel
+
+ monkeypatch.setattr(modules.base, "forward_batch_generation", prefill, raising=False)
+ assert worker.forward_batch_generation(batch, *args) is sentinel
+ assert calls == ["cancel", "interrupt", "prefill"]
+ assert cal.last_width == 1 and cal._planned == 0
+
+
+def test_idle_cancels_and_interrupts_without_calibrating_or_prelaunching(modules, monkeypatch, tmp_path):
+ cal = ChainCalibration(str(tmp_path), [1, 4], torch.device("cpu"), writer=False, native_decode=True)
+ cal.last_width = 0
+ worker, calls, _ = make_worker(modules, monkeypatch, calibration=cal, schedule=[(1, 8, 0)])
+ result = worker.forward_batch_generation(
+ make_batch(mode=Mode.IDLE), on_publish=lambda lengths: calls.append("publish")
+ )
+ assert calls == ["cancel", "trivial", "interrupt", ("verify", 1), "record", "publish"]
+ assert not hasattr(result, "prelaunch_done")
+
+
+def test_sticky_off_survives_reset_shrinking_and_mixed_batches(modules, monkeypatch, tmp_path):
+ cal = ChainCalibration(str(tmp_path), [1, 4], torch.device("cpu"), writer=False, native_decode=True)
+ cal.last_width = 0
+ worker, calls, _ = make_worker(modules, monkeypatch, calibration=cal)
+ a, b, fresh = Request(), Request(), Request()
+ for requests in ([a, b], [b], [b, fresh], [fresh]):
+ worker.forward_batch_generation(make_batch(*requests))
+ cal.interrupt()
+ assert calls.count("decode") == 4
+ assert "draft" not in calls
+ calls.clear()
+ worker.forward_batch_generation(make_batch(Request()))
+ assert "draft" in calls and "decode" not in calls
+
+
+def test_native_decode_error_restores_spec_state_without_publishing(modules, monkeypatch):
+ worker, calls, _ = make_worker(modules, monkeypatch, schedule=[(1, 8, 0)])
+ batch = make_batch(Request())
+ root = batch.spec_info
+
+ def fail(*args, **kwargs):
+ raise RuntimeError("target failed")
+
+ worker._target_worker.forward_batch_generation = fail
+ with pytest.raises(RuntimeError, match="target failed"):
+ worker.forward_batch_generation(batch, on_publish=lambda lengths: calls.append("publish"))
+ assert batch.spec_info is root and batch.spec_algorithm == "eagle"
+ assert calls == ["cancel"]
+
+
+def test_prelaunch_off_choice_takes_effect_without_advancing_calibration(modules, monkeypatch, tmp_path):
+ cal = ChainCalibration(str(tmp_path), [1], torch.device("cpu"), writer=False, native_decode=True)
+ cal._planned = BLOCK_ROUNDS + MIN_ROUNDS - 1
+ worker, calls, _ = make_worker(modules, monkeypatch, calibration=cal)
+ request = Request()
+ worker.forward_batch_generation(make_batch(request))
+ assert ("verify", 1) in calls and cal.last_width == 0
+ planned = cal._planned
+ calls.clear()
+ worker.forward_batch_generation(make_batch(request))
+ assert calls == ["cancel", "context", ("round_start", 1, 0), "decode", "record", "wait"]
+ assert cal._planned == planned
+
+
+def test_result_copies_precede_scheduler_prelaunch_fence(modules, monkeypatch):
+ worker, _, fence = make_worker(modules, monkeypatch, native=False)
+ result = worker.forward_batch_generation(make_batch(Request()))
+ stream = SimpleNamespace(wait_event=lambda event: modules.copies.append(("fence", event)))
+ monkeypatch.setattr(torch.cuda, "current_stream", lambda: stream)
+ result.copy_to_cpu(True, False)
+ assert modules.copies == [("copy", True, False), ("fence", fence)]
+
+
[email protected]("kind", ["tree", "schedule", "calibrate"])
+def test_attention_initialization_wires_the_same_width_plan_into_both_routes(modules, monkeypatch, tmp_path, kind):
+ class Draft:
+ average_context = staticmethod(lambda batch: 5)
+
+ def __init__(self, *args, chain_width, **kwargs):
+ self.chain_width = chain_width
+
+ module = modules.worker
+ monkeypatch.setattr(modules.base, "init_attention_backends", lambda self: None, raising=False)
+ monkeypatch.setattr(module, "DynamicDrafter", Draft)
+ monkeypatch.setattr(module, "verify_widths", lambda *args: [4, 1])
+ worker = module.EagleHarnessWorker.__new__(module.EagleHarnessWorker)
+ worker.config = SimpleNamespace(
+ mode=module.Mode.CALIBRATE if kind == "calibrate" else module.Mode.SERVE,
+ intensity=module.ComputeIntensity.CHAIN,
+ data_path=str(tmp_path),
+ )
+ worker._chain_schedule = [(1, 1, 4), (2, 8, 0)] if kind == "schedule" else None
+ worker._native_decode_enabled = kind != "tree"
+ worker._target_worker = SimpleNamespace(model_runner=object())
+ worker.fixed = object()
+ worker.live = None
+ worker.req_to_token_pool = SimpleNamespace(req_to_token=torch.zeros(8, 10))
+ worker.speculative_num_draft_tokens = 4
+ worker.device = "cpu"
+ worker.cost_model = worker.speculative_algorithm = object()
+ worker._draft_worker = SimpleNamespace(steps=object(), tree_mask_mode=None)
+ worker.init_attention_backends()
+ one, two = make_batch(Request()), make_batch(Request(), Request())
+ assert not worker._native_decode.select(one)
+ width = worker._drafter.chain_width
+ if kind == "tree":
+ assert width is None and not worker._native_decode.select(two)
+ elif kind == "schedule":
+ assert width(1) == 4 and width(2) == 1
+ assert worker._native_decode.select(two)
+ else:
+ block = BLOCK_ROUNDS + MIN_ROUNDS
+ widths = [width(1) for _ in range(2 * block + 1)]
+ assert widths == [1] * block + [4] * block + [1]
+ assert worker._native_decode.select(one)
+
+
[email protected]("dp_size,tracking", [(2, False), (1, True), (2, True)])
+def test_native_decode_still_rejects_dp_and_mamba_tracking(modules, monkeypatch, dp_size, tracking):
+ module = modules.worker
+ spec = SimpleNamespace(
+ speculative_algorithm_config="{}",
+ speculative_eagle_topk=1,
+ speculative_num_steps=3,
+ speculative_num_draft_tokens=4,
+ )
+ monkeypatch.setattr(module, "get_spec", lambda: spec)
+ monkeypatch.setattr(module, "parse_harness_config", lambda value: SimpleNamespace(mode=module.Mode.CALIBRATE))
+ monkeypatch.setattr(module, "build_cost_model", lambda *args, **kwargs: object())
+ monkeypatch.setattr(module.EagleHarnessWorker, "_fixed_chain_widths", lambda *args: None)
+ monkeypatch.setattr(
+ module, "get_exec", lambda: SimpleNamespace(mamba=SimpleNamespace(enable_mamba_extra_buffer=tracking))
+ )
+ monkeypatch.setattr(module, "get_parallel", lambda: SimpleNamespace(dp_size=dp_size))
+ target = SimpleNamespace(model_runner=SimpleNamespace(model_config=object()))
+ with pytest.raises(ValueError, match="requires DP1 and disabled Mamba prefix-cache tracking"):
+ module.EagleHarnessWorker(None, 0, 0, target)
diff --git a/tests/triton_probe.py b/tests/triton_probe.py
new file mode 100644
index 0000000..7d4d2bc
--- /dev/null
+++ b/tests/triton_probe.py
@@ -0,0 +1,35 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Whether this host can run a Triton kernel at all (a GPU, or the CPU interpreter of a Triton that handles ``tl.zeros``)."""
+
+from __future__ import annotations
+
+import os
+
+import pytest
+import torch
+
+if not torch.cuda.is_available():
+ os.environ.setdefault("TRITON_INTERPRET", "1")
+
+import triton # noqa: E402
+import triton.language as tl # noqa: E402
+
+
+def _probe_kernel(out, N: tl.constexpr):
+ tl.store(out + tl.arange(0, N), tl.sum(tl.zeros((N, N), dtype=tl.float32), axis=0))
+
+
+def triton_runs() -> bool:
+ """Launch a minimal kernel; False where the interpreter cannot execute ``tl.zeros`` (older and newer Triton CPU builds)."""
+ out = torch.ones(4, device="cuda" if torch.cuda.is_available() else "cpu")
+ try:
+ _probe_kernel[(1,)](out, N=4)
+ except Exception:
+ return False
+ return bool(out.eq(0).all())
+
+
+needs_triton = pytest.mark.skipif(not triton_runs(), reason="this Triton cannot run kernels on this host")
diff --git a/tools/__init__.py b/tools/__init__.py
new file mode 100644
index 0000000..32e06db
--- /dev/null
+++ b/tools/__init__.py
@@ -0,0 +1,4 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Repository tools, separate from the installed serving package."""
diff --git a/tools/bench_kernels.py b/tools/bench_kernels.py
new file mode 100644
index 0000000..9e511e7
--- /dev/null
+++ b/tools/bench_kernels.py
@@ -0,0 +1,395 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Micro-benchmark of the kernels on one GPU: microseconds per call (CUDA-graph replay) and output hashes.
+
+ python tools/bench_kernels.py --out bench.json [--only candidate,gdn]
+
+Every case builds fixed inputs (seeded), captures ``REPEAT`` calls into one CUDA graph and times the replay, so launch
+overhead is excluded the way it is inside the serving graphs. ``hash`` is the md5 of the outputs: two revisions with the
+same hash produce bit-identical results for these inputs.
+"""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import platform
+from typing import Callable, Dict, Tuple
+
+import torch
+
+REPEAT = 20
+REPLAYS = 50
+
+
+def _hash(*tensors: torch.Tensor) -> str:
+ digest = hashlib.md5()
+ for t in tensors:
+ digest.update(t.detach().contiguous().view(torch.uint8).cpu().numpy().tobytes())
+ return digest.hexdigest()[:12]
+
+
+def _time(fn: Callable[[], object]) -> Tuple[float, object]:
+ """``(microseconds per call of fn inside a CUDA graph, fn's result)``."""
+ result = fn()
+ torch.cuda.synchronize()
+ side = torch.cuda.Stream()
+ side.wait_stream(torch.cuda.current_stream())
+ with torch.cuda.stream(side):
+ fn()
+ torch.cuda.current_stream().wait_stream(side)
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph):
+ for _ in range(REPEAT):
+ fn()
+ for _ in range(5):
+ graph.replay()
+ torch.cuda.synchronize()
+ start, end = torch.cuda.Event(enable_timing=True), torch.cuda.Event(enable_timing=True)
+ best = float("inf")
+ for _ in range(3):
+ start.record()
+ for _ in range(REPLAYS):
+ graph.replay()
+ end.record()
+ end.synchronize()
+ best = min(best, start.elapsed_time(end) * 1000 / (REPLAYS * REPEAT))
+ return best, result
+
+
+def _gen(seed: int) -> torch.Generator:
+ return torch.Generator(device="cuda").manual_seed(seed)
+
+
+# ---------------------------------------------------------------------------------------------------------------------
+# candidate head (Qwen3.8-27B draft: vocab 248320, TP4 shard 62080, C = 128 candidates, hidden 5120)
+# ---------------------------------------------------------------------------------------------------------------------
+
+
+def _record(results: Dict[str, dict], name: str, fn: Callable[[], object]) -> None:
+ us, out = _time(fn)
+ tensors = [t for t in (out if isinstance(out, (tuple, list)) else [out]) if isinstance(t, torch.Tensor)]
+ results[name] = {"us": us, "hash": _hash(*tensors) if tensors else ""}
+
+
+def candidate_cases(results: Dict[str, dict]) -> None:
+ from eagle_harness.kernels.candidate_ops import candidate_tail, shard_topk
+ from eagle_harness.kernels.gather_dot import gather_dot
+
+ for rows in (4, 16):
+ scores = torch.randn(rows, 62080, device="cuda", dtype=torch.bfloat16, generator=_gen(rows))
+ for cuda in (True, False):
+ _record(
+ results,
+ f"shard_topk rows={rows} {'cuda' if cuda else 'triton'}",
+ lambda: shard_topk(scores, 128, 1000, cuda_kernels=cuda),
+ )
+ _record(results, f"shard_topk rows={rows} torch", lambda: torch.topk(scores, 128, dim=-1, sorted=False))
+
+ weight = torch.randn(62080, 5120, device="cuda", dtype=torch.bfloat16, generator=_gen(1))
+ for rows in (4, 16):
+ hidden = torch.randn(rows, 5120, device="cuda", dtype=torch.bfloat16, generator=_gen(2))
+ ids = torch.randint(0, 62080, (rows, 128), device="cuda", generator=_gen(3))
+ _record(results, f"gather_dot rows={rows}", lambda: gather_dot(weight, ids, hidden))
+
+ for ranks, rows, dtype in ((1, 4, torch.bfloat16), (4, 4, torch.float32), (4, 16, torch.float32)):
+ logits = torch.randn(ranks * rows, 128, device="cuda", dtype=torch.bfloat16, generator=_gen(4)).to(dtype)
+ tokens = torch.randint(0, 248320, (ranks * rows, 128), device="cuda", generator=_gen(5))
+ for cuda in (True, False):
+ _record(
+ results,
+ f"candidate_tail ranks={ranks} rows={rows} {'cuda' if cuda else 'triton'}",
+ lambda: _flat(candidate_tail(logits, tokens, rows, 4, cuda_kernels=cuda)),
+ )
+
+
+def candidate_head_cases(results: Dict[str, dict]) -> None:
+ """The whole candidate head after the low-rank scores at TP4 (the all-gather is a local concatenation) and TP1."""
+ from eagle_harness.kernels.candidate_ops import candidate_tail, shard_topk
+ from eagle_harness.kernels.gather_dot import gather_dot
+
+ try:
+ from eagle_harness.kernels.candidate_ops import candidate_topk
+ except ImportError: # revisions before the fused head
+ candidate_topk = None
+ k, h, shard = 128, 5120, 62080
+ weight = torch.randn(shard, h, device="cuda", dtype=torch.bfloat16, generator=_gen(1))
+ for rows in (4, 16):
+ scores = torch.randn(rows, shard, device="cuda", dtype=torch.bfloat16, generator=_gen(rows))
+ hidden = torch.randn(rows, h, device="cuda", dtype=torch.bfloat16, generator=_gen(2))
+
+ def unfused(ranks):
+ local, global_ids = shard_topk(scores, k, 1000)
+ logits = gather_dot(weight, local, hidden)
+ if ranks == 1:
+ return candidate_tail(logits, global_ids, rows, 4)[2]
+ packed = torch.cat([logits.float().view(torch.int32), global_ids.to(torch.int32)], dim=-1)
+ packed = torch.cat([packed] * ranks) # the all-gather
+ return candidate_tail(packed[:, :k].view(torch.float32), packed[:, k:].long(), rows, 4)[2]
+
+ for ranks in (1, 4):
+ _record(results, f"candidate_head tp{ranks} rows={rows} unfused", lambda: unfused(ranks))
+ if candidate_topk is not None:
+ gather = (lambda own: torch.stack([own] * ranks)) if ranks > 1 else None
+ _record(
+ results,
+ f"candidate_head tp{ranks} rows={rows} fused",
+ lambda: candidate_topk(
+ scores, weight, hidden, num_candidates=k, vocab_start=1000, top_k=4, all_gather=gather
+ ),
+ )
+
+
+def _flat(result):
+ logits, tokens, topk = result
+ return (logits, tokens, *topk)
+
+
+def tree_step_case(results: Dict[str, dict]) -> None:
+ """A draft-tree step at a delta slot (bookkeeping and the cost model's work deltas), at batch size 1 and 4."""
+ from eagle_harness.core.draft_tree import DraftTree, TreeShape
+
+ k, depth, h, cap = 4, 12, 5120, 64
+ for bs in (1, 4):
+ tree = DraftTree(TreeShape(k, depth, work_cap=cap), bs, h, torch.bfloat16, torch.device("cuda"), max_verify=cap)
+ gen = _gen(7)
+ tree.stage_root(
+ bs,
+ torch.rand(bs, k, device="cuda", generator=gen).softmax(-1),
+ torch.randint(0, 1000, (bs, k), device="cuda", generator=gen),
+ torch.randn(bs, h, device="cuda", generator=gen).to(torch.bfloat16),
+ )
+ tree.begin(bs)
+ tree.set_step_slots(bs, 1, torch.randint(0, 10**6, (bs, k), device="cuda", generator=gen))
+ p = torch.sort(torch.rand(bs * k, k, device="cuda", generator=gen).softmax(-1), dim=-1, descending=True).values
+ ids = torch.randint(0, 248320, (bs * k, k), device="cuda", generator=gen)
+ hidden = torch.randn(bs * k, h, device="cuda", generator=gen).to(torch.bfloat16)
+ _record(results, f"tree_step bs={bs} k=4 with work deltas", lambda: tree.step(bs, 1, p, ids, hidden))
+
+
+# ---------------------------------------------------------------------------------------------------------------------
+# GDN tree verify (Qwen3.8-27B: K = V = 128; per rank H / HV = 16 / 48 at TP1, 4 / 12 at TP4)
+# ---------------------------------------------------------------------------------------------------------------------
+
+
+def _tree_links(width: int, seed: int):
+ gen = torch.Generator().manual_seed(seed)
+ parent = [-1] + [int(torch.randint(0, i, (1,), generator=gen)) for i in range(1, width)]
+ first = [-1] * width
+ sibling = [-1] * width
+ last: Dict[int, int] = {}
+ for node in range(1, width):
+ p = parent[node]
+ if p in last:
+ sibling[last[p]] = node
+ else:
+ first[p] = node
+ last[p] = node
+ t = lambda x: torch.tensor([x], dtype=torch.int32, device="cuda") # noqa: E731
+ return t(first), t(sibling)
+
+
+def gdn_cases(results: Dict[str, dict]) -> None:
+ from eagle_harness.kernels import gdn_tree, gdn_tree_conv, gdn_tree_recurrence
+
+ def ancestors(nxt, sib, parents, conv_idx, width, anc, qsl, paths):
+ gdn_tree.gdn_tree_ancestors(nxt, sib, parents, conv_idx, width, anc, qsl, paths)
+ return parents, anc, paths
+
+ for name, (h, hv) in {"tp1": (16, 48), "tp2": (8, 24), "tp4": (4, 12), "tp8": (2, 6)}.items():
+ kdim = vdim = 128
+ for width in (8, 16):
+ gen = _gen(width)
+ nxt, sib = _tree_links(width, width)
+ parents = torch.zeros(1, width, dtype=torch.int32, device="cuda")
+ anc = torch.zeros(1, 3, width, dtype=torch.int32, device="cuda")
+ paths = gdn_tree.gdn_tree_paths_buffer(1, width, "cuda")
+ idx = torch.zeros(1, dtype=torch.int32, device="cuda")
+ qsl = torch.tensor([0, width], dtype=torch.int32, device="cuda")
+ _record(
+ results,
+ f"gdn ancestors {name} w={width}",
+ lambda: ancestors(nxt, sib, parents, idx, width, anc, qsl, paths),
+ )
+
+ dim = 2 * h * kdim + hv * vdim
+ x = torch.randn(1, dim, width, device="cuda", dtype=torch.bfloat16, generator=gen)
+ conv_state = torch.randn(4, dim, 3, device="cuda", dtype=torch.bfloat16, generator=gen)
+ weight = torch.randn(dim, 4, device="cuda", dtype=torch.bfloat16, generator=gen)
+ window = torch.zeros(2, width, dim, 3, device="cuda", dtype=torch.bfloat16)
+ _record(
+ results,
+ f"gdn conv1d {name} w={width}",
+ lambda: (
+ gdn_tree_conv.gdn_tree_conv1d_update(x, conv_state, weight, None, True, idx, window, idx, anc),
+ window,
+ ),
+ )
+
+ q = torch.randn(1, width, h, kdim, device="cuda", dtype=torch.bfloat16, generator=gen)
+ k = torch.randn(1, width, h, kdim, device="cuda", dtype=torch.bfloat16, generator=gen)
+ v = torch.randn(1, width, hv, vdim, device="cuda", dtype=torch.bfloat16, generator=gen)
+ a = torch.randn(width, hv, device="cuda", dtype=torch.bfloat16, generator=gen)
+ b = torch.randn(width, hv, device="cuda", dtype=torch.bfloat16, generator=gen)
+ a_log = torch.randn(hv, device="cuda", dtype=torch.float32, generator=gen)
+ dt_bias = torch.randn(hv, device="cuda", dtype=torch.bfloat16, generator=gen)
+ for state_dtype in (torch.bfloat16, torch.float32):
+ pool = (torch.randn(2, hv, vdim, kdim, device="cuda", generator=gen) * 0.1).to(state_dtype)
+ scratch = torch.zeros(2, width, hv, vdim, kdim, device="cuda", dtype=state_dtype)
+ bf16 = state_dtype == torch.bfloat16
+ for variant, gluon, use_paths in (
+ [("triton", False, False), ("gluon", True, False)]
+ if bf16
+ else [("triton", False, False), ("triton paths", False, True)]
+ ):
+ kwargs = dict(
+ initial_state_source=pool,
+ initial_state_indices=idx,
+ cu_seqlens=qsl,
+ intermediate_states_buffer=scratch,
+ intermediate_state_indices=idx,
+ retrieve_parent_token=parents,
+ tree_paths=paths if use_paths else None,
+ gluon=gluon,
+ )
+ _record(
+ results,
+ f"gdn recurrent {name} w={width} {str(state_dtype)[6:]} {variant}",
+ lambda: (
+ gdn_tree_recurrence.gdn_tree_recurrent_update(a_log, dt_bias, q, k, v, a, b, **kwargs),
+ scratch,
+ ),
+ )
+
+
+# ---------------------------------------------------------------------------------------------------------------------
+# Mamba2 tree verify, one layer (Nemotron 3 Nano: 64 heads x 64, 8 groups, state 128; per rank / TP)
+# ---------------------------------------------------------------------------------------------------------------------
+
+
+def mamba2_cases(results: Dict[str, dict]) -> None:
+ """sglang's tree conv (links walked in the kernel) vs the harness tree conv (ancestor table built once per
+ forward, timed apart), and sglang's selective state update for scale."""
+ from sglang.kernels.ops.mamba.causal_conv1d_triton import causal_conv1d_update
+ from sglang.kernels.ops.mamba.triton_ops.mamba_ssm import selective_state_update
+
+ from eagle_harness.kernels import gdn_tree, gdn_tree_conv
+
+ for name, (heads, groups) in {"tp4": (16, 2), "tp1": (64, 8), "super-tp4": (32, 2)}.items():
+ head_dim, dstate = 64, 128
+ dim = heads * head_dim + 2 * groups * dstate
+ for width in (4, 8, 16):
+ gen = _gen(width)
+ nxt, sib = (t.long() for t in _tree_links(width, width))
+ parents = torch.zeros(1, width, dtype=torch.int64, device="cuda")
+ anc = torch.zeros(1, 3, width, dtype=torch.int32, device="cuda")
+ idx = torch.zeros(1, dtype=torch.int32, device="cuda")
+ x = torch.randn(1, width, dim, device="cuda", dtype=torch.bfloat16, generator=gen).transpose(1, 2)
+ conv_state = torch.randn(4, dim, 3, device="cuda", dtype=torch.bfloat16, generator=gen)
+ weight = torch.randn(dim, 4, device="cuda", dtype=torch.bfloat16, generator=gen)
+ bias = torch.randn(dim, device="cuda", dtype=torch.bfloat16, generator=gen)
+ window = torch.zeros(2, width, dim, 3, device="cuda", dtype=torch.bfloat16)
+ tag = f"{name} w={width}"
+ _record(
+ results,
+ f"mamba2 conv1d sglang {tag}",
+ lambda: causal_conv1d_update(
+ x,
+ conv_state,
+ weight,
+ bias,
+ "silu",
+ conv_state_indices=idx,
+ intermediate_conv_window=window,
+ intermediate_state_indices=idx,
+ retrieve_next_token=nxt,
+ retrieve_next_sibling=sib,
+ retrieve_parent_token=parents,
+ ),
+ )
+ _record(
+ results,
+ f"mamba2 ancestors harness {tag}",
+ lambda: gdn_tree.gdn_tree_ancestors(nxt, sib, parents, idx, width, anc) or anc,
+ )
+ _record(
+ results,
+ f"mamba2 conv1d harness {tag}",
+ lambda: gdn_tree_conv.gdn_tree_conv1d_update(
+ x, conv_state, weight, bias, "silu", idx, window, idx, anc
+ ),
+ )
+ xs = torch.randn(1, width, heads, head_dim, device="cuda", dtype=torch.bfloat16, generator=gen)
+ dt = torch.randn(1, width, heads, device="cuda", dtype=torch.bfloat16, generator=gen)
+ bc = torch.randn(2, 1, width, groups, dstate, device="cuda", dtype=torch.bfloat16, generator=gen)
+ a = -torch.rand(heads, device="cuda", generator=gen)
+ dt_bias = torch.randn(heads, device="cuda", generator=gen)
+ out = torch.empty_like(xs)
+ for state_dtype in (torch.bfloat16, torch.float32):
+ pool = torch.randn(2, heads, head_dim, dstate, device="cuda", generator=gen).to(state_dtype)
+ scratch = torch.zeros(1, width, heads, head_dim, dstate, device="cuda", dtype=state_dtype)
+ _record(
+ results,
+ f"mamba2 ssu sglang {tag} {str(state_dtype)[6:]}",
+ lambda: (
+ selective_state_update(
+ pool,
+ xs,
+ dt[..., None].expand(-1, -1, -1, head_dim),
+ a[:, None, None].expand(-1, head_dim, dstate),
+ bc[0],
+ bc[1],
+ dt_bias[:, None].expand(-1, head_dim),
+ z=None,
+ dt_bias=dt_bias[:, None].expand(-1, head_dim),
+ dt_softplus=True,
+ state_batch_indices=idx,
+ out=out,
+ disable_state_update=True,
+ intermediate_states_buffer=scratch,
+ cache_steps=width,
+ retrieve_parent_token=parents,
+ intermediate_state_indices=idx,
+ )
+ or out
+ ),
+ )
+
+
+GROUPS: Dict[str, Callable[[Dict[str, dict]], None]] = {
+ "candidate": candidate_cases,
+ "candidate_head": candidate_head_cases,
+ "tree_step": tree_step_case,
+ "gdn": gdn_cases,
+ "mamba2": mamba2_cases,
+}
+
+
+def main() -> None:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("--out", required=True)
+ ap.add_argument("--only", default=",".join(GROUPS))
+ args = ap.parse_args()
+ results: Dict[str, dict] = {}
+ for group in args.only.split(","):
+ GROUPS[group](results)
+ props = torch.cuda.get_device_properties(0)
+ import triton
+
+ meta = {
+ "device": props.name,
+ "capability": f"{props.major}.{props.minor}",
+ "torch": torch.__version__,
+ "triton": triton.__version__,
+ "python": platform.python_version(),
+ }
+ json.dump({"meta": meta, "results": results}, open(args.out, "w"), indent=1)
+ width = max(map(len, results))
+ for name, r in results.items():
+ print(f"{name:<{width}} {r['us']:9.2f} us {r.get('hash', '')}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/bench_table.py b/tools/bench_table.py
new file mode 100644
index 0000000..01785b5
--- /dev/null
+++ b/tools/bench_table.py
@@ -0,0 +1,49 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Table of SPEED-Bench results (``client_speedbench.py`` JSONs) with mean and spread per server.
+
+``python tools/bench_table.py <results dir> [...]``: one row per ``speedbench_<name>[_r<N>].json``
+(wall tok/s, accept length, tokens, turns, validity), then per server name the mean wall tok/s and
+the spread (max - min) over its repeats.
+"""
+
+from __future__ import annotations
+
+import argparse
+import collections
+import glob
+import json
+import os
+import re
+
+_NAME = re.compile(r"speedbench_(?P<name>.+?)(?:_r(?P<rep>\d+))?\.json$")
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument("dirs", nargs="+")
+ args = parser.parse_args()
+ by_name = collections.defaultdict(list)
+ print(f"{'file':60s} {'tok/s':>8} {'accept':>7} {'tokens':>8} {'turns':>6} valid")
+ for d in args.dirs:
+ for path in sorted(glob.glob(os.path.join(d, "speedbench_*.json"))):
+ match = _NAME.search(os.path.basename(path))
+ with open(path) as f:
+ summary = json.load(f)["summary"]
+ overall = summary["all"]
+ tput, accept = overall["wall_tput"], overall.get("accept_len")
+ by_name[match["name"]].append(tput)
+ print(
+ f"{os.path.relpath(path, d) if len(args.dirs) == 1 else path:60s} {tput:8.1f} "
+ f"{accept if accept is not None else float('nan'):7.3f} {overall['tokens']:8d} "
+ f"{summary['turns']:6d} {summary['valid']}"
+ )
+ print()
+ for name, values in sorted(by_name.items()):
+ mean = sum(values) / len(values)
+ print(f"{name:20s} n={len(values)} mean {mean:7.1f} tok/s spread {max(values) - min(values):6.1f}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/build_wheel.sh b/tools/build_wheel.sh
new file mode 100755
index 0000000..6d28ce3
--- /dev/null
+++ b/tools/build_wheel.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+# Build the eagle-harness sdist and wheels from a source tree; nothing is uploaded.
+# tools/build_wheel.sh <source tree> <out dir> <cuda home>...
+# One native library per CUDA major (each <cuda home> gives _native/cu<major>/, see eagle_harness/kernels/build.py)
+# goes into the binary wheel, which auditwheel retags manylinux. The sdist holds the CUDA source only; the pure wheel
+# built from it has no native library, so nvcc builds one on first use (the JIT fallback).
+# Out: <out>/eagle_harness-<v>.tar.gz, eagle_harness-<v>-py3-none-manylinux_*.whl, pure/eagle_harness-<v>-py3-none-any.whl,
+# SHA256SUMS, build.txt (toolkits, glibc symbols, wheel contents). Needs python with `build`, `auditwheel`, `patchelf`.
+set -euo pipefail
+SRC=$(realpath "$1"); OUT=$(realpath -m "$2"); shift 2
+[ $# -ge 1 ] || { echo "usage: $0 <source tree> <out dir> <cuda home>..." >&2; exit 2; }
+PY=${PYTHON:-python3}
+WORK=$(mktemp -d); trap 'rm -rf "$WORK"' EXIT
+mkdir -p "$OUT/pure"
+cp -r "$SRC/." "$WORK/src"; rm -rf "$WORK/src/eagle_harness/kernels/_native" "$WORK/src/build" "$WORK/src"/*.egg-info
+cd "$WORK/src"
+{
+ echo "source: $SRC $(cat REVISION 2>/dev/null || true)"
+ for cuda in "$@"; do
+ "$cuda/bin/nvcc" --version | tail -2
+ "$PY" -m eagle_harness.kernels.build prebuild --cuda-home "$cuda"
+ done
+ ls -l eagle_harness/kernels/_native/*/
+ for lib in eagle_harness/kernels/_native/*/*.so; do
+ echo "$lib: glibc $(objdump -T "$lib" | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -1)," \
+ "needs $(objdump -p "$lib" | awk '/NEEDED/ {print $2}' | tr '\n' ' ')"
+ done
+} > "$OUT/build.txt" 2>&1
+# The sdist and the binary wheel are both built from this tree (`build` alone would build the wheel from the sdist).
+"$PY" -m build --sdist --outdir "$WORK/dist" . >> "$OUT/build.txt" 2>&1
+"$PY" -m build --wheel --outdir "$WORK/dist" . >> "$OUT/build.txt" 2>&1
+"$PY" -m auditwheel show "$WORK"/dist/*.whl >> "$OUT/build.txt" 2>&1
+"$PY" -m auditwheel repair --wheel-dir "$OUT" "$WORK"/dist/*.whl >> "$OUT/build.txt" 2>&1
+cp "$WORK"/dist/*.tar.gz "$OUT/"
+mkdir "$WORK/sdist" && tar xzf "$OUT"/eagle_harness-*.tar.gz -C "$WORK/sdist"
+"$PY" -m build --wheel --outdir "$OUT/pure" "$WORK"/sdist/eagle_harness-* >> "$OUT/build.txt" 2>&1
+cd "$OUT"
+{
+ echo "== sdist: native libraries (expect none)"; tar tzf eagle_harness-*.tar.gz | grep '\.so$' || echo none
+ echo "== wheel contents"; "$PY" -m zipfile -l eagle_harness-*manylinux*.whl | grep -E '\.so|\.cu|entry_points|METADATA'
+ echo "== pure wheel: native libraries (expect none)"; "$PY" -m zipfile -l pure/*.whl | grep '\.so' || echo none
+ ls -l eagle_harness-* pure/
+} >> build.txt 2>&1
+sha256sum eagle_harness-* pure/* > SHA256SUMS
+cat SHA256SUMS
diff --git a/tools/calibrate_candidate_topk.py b/tools/calibrate_candidate_topk.py
new file mode 100644
index 0000000..55aba39
--- /dev/null
+++ b/tools/calibrate_candidate_topk.py
@@ -0,0 +1,86 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Measure and save the ROCm candidate top-k crossover offline.
+
+Example: python tools/calibrate_candidate_topk.py --data-path COST --vocab-size 248320 --candidates 128
+The saved policy is loaded only for the exact GPU/toolchain/shape identity, on any vendor. Nothing is timed at server startup.
+"""
+
+import argparse
+import json
+import statistics
+from pathlib import Path
+
+import torch
+import triton
+
+from eagle_harness.kernels.candidate_ops import shard_topk
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--data-path", type=Path, required=True)
+ parser.add_argument("--vocab-size", type=int, required=True)
+ parser.add_argument("--candidates", type=int, default=128)
+ args = parser.parse_args()
+ generator = torch.Generator(device="cuda").manual_seed(721)
+ flush = torch.empty(1024**3, device="cuda", dtype=torch.uint8)
+ measurements = []
+ for rows in (1, 4, 8, 16, 32, 64, 128, 256):
+ scores = torch.randn(rows, args.vocab_size, device="cuda", dtype=torch.bfloat16, generator=generator)
+ graphs = {}
+ for label, limit in (("torch", 0), ("triton", scores.numel())):
+
+ def run(scores=scores, limit=limit):
+ return shard_topk(scores, args.candidates, 0, cuda_kernels=False, max_triton_elements=limit)[0]
+
+ ids = run()
+ values = scores.gather(-1, ids).sort(dim=-1).values
+ torch.testing.assert_close(
+ values, scores.topk(args.candidates, sorted=True).values.flip(-1), rtol=0, atol=0
+ )
+ graph = torch.cuda.CUDAGraph()
+ with torch.cuda.graph(graph):
+ run()
+ graphs[label] = graph
+ times = {label: [] for label in graphs}
+ for label in ("torch", "triton", "triton", "torch") * 5:
+ flush.zero_()
+ start, end = torch.cuda.Event(enable_timing=True), torch.cuda.Event(enable_timing=True)
+ start.record()
+ graphs[label].replay()
+ end.record()
+ end.synchronize()
+ times[label].append(start.elapsed_time(end) * 1000)
+ row = {
+ "rows": rows,
+ "elements": scores.numel(),
+ **{label + "_us": statistics.median(values) for label, values in times.items()},
+ "samples_us": times,
+ }
+ measurements.append(row)
+ print(json.dumps(row), flush=True)
+ # A crossover must be monotone on the measured grid; noisy/nonmonotone data is not a routing policy.
+ winners = [row["triton_us"] <= row["torch_us"] for row in measurements]
+ if winners != sorted(winners, reverse=True):
+ raise RuntimeError("nonmonotone top-k crossover; raw timings printed, no profile promoted")
+ limit = max((r["elements"] for r, wins in zip(measurements, winners) if wins), default=0)
+ profile = {
+ "identity": {
+ "device": torch.cuda.get_device_name(),
+ "torch": torch.__version__,
+ "triton": triton.__version__,
+ "dtype": str(torch.bfloat16),
+ "vocab_size": args.vocab_size,
+ "num_candidates": args.candidates,
+ },
+ "max_triton_elements": limit,
+ "measurements": measurements,
+ }
+ args.data_path.mkdir(parents=True, exist_ok=True)
+ (args.data_path / "candidate_topk.json").write_text(json.dumps(profile, indent=2) + "\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/check_dist.py b/tools/check_dist.py
new file mode 100644
index 0000000..5f527d7
--- /dev/null
+++ b/tools/check_dist.py
@@ -0,0 +1,161 @@
+#!/usr/bin/env python3
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Check the eagle-harness release files before an upload: metadata, entry points, contents, and the license state.
+
+ python tools/check_dist.py <dist dir> # the out dir of tools/build_wheel.sh
+
+Checks every file ``build_wheel.sh`` writes (the sdist, the binary wheel, the pure wheel in ``pure/``):
+
+- name ``eagle-harness`` and one version across the files, equal to ``eagle_harness/__init__.py``'s ``__version__``;
+- the ``sglang``, ``vllm`` and ``test`` extras, the ``eagle-harness-check`` script and both engines' plugin entry points;
+- the binary wheel carries the native library for CUDA 12 and 13; the sdist and the pure wheel carry none;
+- the wheels hold only the package and its dist-info, the sdist only the package, tests and the build files.
+
+A placeholder LICENSE fails validation. Exit status: 0 the files are fine, 1 a check failed, 2 usage error.
+Standard library only.
+"""
+
+from __future__ import annotations
+
+import re
+import sys
+import tarfile
+import zipfile
+from email.parser import HeaderParser
+from pathlib import Path
+
+NAME = "eagle-harness"
+EXTRAS = {"sglang", "vllm", "test"}
+ENTRY_POINTS = {
+ "console_scripts": "eagle-harness-check = eagle_harness.compat:main",
+ "sglang.srt.plugins": "eagle_harness = eagle_harness.sglang.plugin:register",
+ "vllm.general_plugins": "eagle_harness = eagle_harness.vllm.plugin:register",
+}
+NATIVE = ("eagle_harness/kernels/_native/cu12/", "eagle_harness/kernels/_native/cu13/")
+# Top-level entries an sdist may hold; anything else (a private directory, CI files) must not ship.
+SDIST_TOP = {"eagle_harness", "eagle_harness.egg-info", "tests", "LICENSE", "NOTICE", "TRADEMARKS.md", "LICENSES",
+ "THIRD_PARTY_NOTICES.md", "MANIFEST.in", "PKG-INFO", "README.md", "pyproject.toml", "setup.cfg", "setup.py"}
+PLACEHOLDER_LICENSE = re.compile(r"not a license|\bplaceholder\b", re.I)
+SOURCE = Path(__file__).resolve().parents[1]
+LICENSE_FILES = ("LICENSE", "NOTICE", "TRADEMARKS.md", "THIRD_PARTY_NOTICES.md",
+ *(p.relative_to(SOURCE).as_posix() for p in sorted((SOURCE / "LICENSES").glob("*.txt"))))
+
+
+class Report:
+ def __init__(self) -> None:
+ self.failures: list[str] = []
+
+ def check(self, ok: bool, what: str) -> None:
+ print(("ok " if ok else "FAIL ") + what)
+ if not ok:
+ self.failures.append(what)
+
+
+def entry_points(text: str) -> dict[str, set[str]]:
+ groups: dict[str, set[str]] = {}
+ group = None
+ for line in text.splitlines():
+ line = line.strip()
+ if line.startswith("["):
+ group = line.strip("[]")
+ groups[group] = set()
+ elif line and group:
+ groups[group].add(re.sub(r"\s*=\s*", " = ", line))
+ return groups
+
+
+def check_metadata(report: Report, label: str, metadata: str, version: str) -> None:
+ headers = HeaderParser().parsestr(metadata)
+ report.check(headers["Name"] == NAME, f"{label}: Name is {headers['Name']!r}")
+ report.check(headers["Version"] == version, f"{label}: Version {headers['Version']} == __version__ {version}")
+ extras = set(headers.get_all("Provides-Extra") or [])
+ report.check(EXTRAS <= extras, f"{label}: extras {sorted(extras)} include {sorted(EXTRAS)}")
+ requires = headers.get_all("Requires-Dist") or []
+ for extra in ("sglang", "vllm"):
+ report.check(any(f'extra == "{extra}"' in r for r in requires), f"{label}: the {extra} extra pins its engine")
+ report.check(headers["License-Expression"] == "LicenseRef-Eagle-4-Source-Available",
+ f"{label}: License-Expression LicenseRef-Eagle-4-Source-Available")
+ for name in LICENSE_FILES:
+ report.check(name in (headers.get_all("License-File") or []), f"{label}: License-File {name}")
+
+
+def check_license(report: Report, label: str, data: bytes) -> None:
+ report.check(not PLACEHOLDER_LICENSE.search(data.decode(errors="replace")),
+ f"{label}: LICENSE is not a placeholder")
+
+
+def check_wheel(report: Report, path: Path, version: str, native: bool) -> None:
+ with zipfile.ZipFile(path) as whl:
+ names = whl.namelist()
+ dist_info = next(n.split("/")[0] for n in names if n.endswith(".dist-info/METADATA"))
+ check_metadata(report, path.name, whl.read(f"{dist_info}/METADATA").decode(), version)
+ groups = entry_points(whl.read(f"{dist_info}/entry_points.txt").decode())
+ for group, line in ENTRY_POINTS.items():
+ report.check(line in groups.get(group, set()), f"{path.name}: entry point [{group}] {line}")
+ libs = [n for n in names if n.endswith(".so")]
+ if native:
+ for prefix in NATIVE:
+ report.check(any(n.startswith(prefix) for n in libs), f"{path.name}: native library under {prefix}")
+ else:
+ report.check(not libs, f"{path.name}: no native library ({libs or 'none'})")
+ stray = [n for n in names if n.split("/")[0] not in ("eagle_harness", dist_info)]
+ report.check(not stray, f"{path.name}: only eagle_harness/ and {dist_info}/ ({stray[:3] or 'nothing else'})")
+ for name in LICENSE_FILES:
+ member = f"{dist_info}/licenses/{name}"
+ report.check(member in names, f"{path.name}: {name} in the dist-info")
+ if member in names:
+ data = whl.read(member)
+ report.check(data == (SOURCE / name).read_bytes(), f"{path.name}: {name} matches source")
+ if name == "LICENSE":
+ check_license(report, path.name, data)
+
+
+def check_sdist(report: Report, path: Path, version: str) -> None:
+ with tarfile.open(path) as sdist:
+ names = sdist.getnames()
+ root = names[0].split("/")[0]
+ check_metadata(report, path.name, sdist.extractfile(f"{root}/PKG-INFO").read().decode(), version)
+ rel = [n[len(root) + 1:] for n in names if n.startswith(root + "/")]
+ report.check(not [n for n in rel if n.endswith(".so")], f"{path.name}: no native library")
+ report.check(any(n.endswith("csrc/candidate.cu") for n in rel), f"{path.name}: the CUDA source for the JIT build")
+ stray = sorted({n.split("/")[0] for n in rel if n} - SDIST_TOP)
+ report.check(not stray, f"{path.name}: only the package, tests and build files ({stray or 'nothing else'})")
+ for name in LICENSE_FILES:
+ member = f"{root}/{name}"
+ report.check(member in names, f"{path.name}: {name} in the sdist")
+ if member in names:
+ data = sdist.extractfile(member).read()
+ report.check(data == (SOURCE / name).read_bytes(), f"{path.name}: {name} matches source")
+ if name == "LICENSE":
+ check_license(report, path.name, data)
+
+
+def main(argv: list[str]) -> int:
+ if len(argv) != 1:
+ print(__doc__, file=sys.stderr)
+ return 2
+ dist = Path(argv[0])
+ init = Path(__file__).resolve().parents[1] / "eagle_harness" / "__init__.py"
+ version = re.search(r'^__version__ = "([^"]+)"', init.read_text(), re.M).group(1)
+ sdists = sorted(dist.glob("eagle_harness-*.tar.gz"))
+ wheels = sorted(dist.glob("eagle_harness-*-manylinux*.whl"))
+ pure = sorted(dist.glob("pure/eagle_harness-*-py3-none-any.whl"))
+ report = Report()
+ report.check(len(sdists) == 1 and len(wheels) == 1 and len(pure) == 1,
+ f"one sdist, one binary wheel, one pure wheel in {dist} ({len(sdists)}, {len(wheels)}, {len(pure)})")
+ for path in sdists:
+ check_sdist(report, path, version)
+ for path in wheels:
+ check_wheel(report, path, version, native=True)
+ for path in pure:
+ check_wheel(report, path, version, native=False)
+ if report.failures:
+ print(f"{len(report.failures)} check(s) failed", file=sys.stderr)
+ return 1
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/tools/check_headers.py b/tools/check_headers.py
new file mode 100644
index 0000000..55db100
--- /dev/null
+++ b/tools/check_headers.py
@@ -0,0 +1,214 @@
+#!/usr/bin/env python3
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Check source headers, or add missing lines with ``--fix``.
+
+Run from a Git checkout. Include tracked and non-ignored untracked source files.
+Legal files, documentation, data and generated files are outside this check.
+Preserve recognized upstream notices. Refuse conflicting or unknown provenance
+without rewriting it; a maintainer must review it against THIRD_PARTY_NOTICES.md.
+"""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+from pathlib import Path
+import re
+import subprocess
+
+COPYRIGHT = "Copyright 2026 Eagle AI Corp."
+LICENSE = "SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available"
+SOURCE_SUFFIXES = {
+ ".py",
+ ".pyi",
+ ".sh",
+ ".bash",
+ ".env",
+ ".c",
+ ".cc",
+ ".cpp",
+ ".cxx",
+ ".h",
+ ".hpp",
+ ".cu",
+ ".cuh",
+ ".sky",
+}
+C_SUFFIXES = {".c", ".cc", ".cpp", ".cxx", ".h", ".hpp", ".cu", ".cuh"}
+ENCODING = re.compile(rb"^[ \t\f]*#.*?coding[:=][ \t]*[-\w.]+")
+
+
+def add_header(path: Path, data: bytes) -> bytes:
+ if data.startswith(b"\xef\xbb\xbf"):
+ return b"\xef\xbb\xbf" + add_header(path, data[3:])
+ lines = data.splitlines(keepends=True)
+ position = int(bool(lines and lines[0].startswith(b"#!")))
+ for index, line in enumerate(lines[:2]):
+ if ENCODING.match(line):
+ position = index + 1
+ if path.name == "Dockerfile" or path.suffix == ".Dockerfile":
+ # Docker stops reading parser directives at the first ordinary comment.
+ for index, line in enumerate(lines):
+ if not re.match(rb"(?i)^\s*#\s*(syntax|escape|check)\s*=", line):
+ break
+ position = index + 1
+ prefix = "//" if path.suffix in C_SUFFIXES else "#"
+ first_newline = re.search(rb"\r\n|\n|\r", data)
+ newline = first_newline.group() if first_newline else b"\n"
+ comments = []
+ for line in lines[position:]:
+ if line.strip() and not line.lstrip().startswith((b"#", b"//", b"/*", b"*")):
+ break
+ comments.append(line)
+ notice = b"".join(comments)
+ if re.search(rb"(?i)lightseek|(?:copyright|derived from)[^\n]*tokenspeed", notice):
+ raise ValueError("TokenSpeed/LightSeek provenance is not allowed here; left untouched")
+ if re.search(rb"(?im)^\s*(?:#|//|/\*|\*)\s*(?:code generated|generated by|@generated|auto-generated)\b", notice):
+ return data
+ if b"Advanced Micro Devices" in notice:
+ amd_header = {
+ f"{prefix} Copyright (c) 2026 Advanced Micro Devices, Inc.".encode(),
+ f"{prefix} SPDX-License-Identifier: Apache-2.0".encode(),
+ }
+ legal_lines = {line for line in notice.splitlines() if re.search(rb"(?i)copyright|SPDX-License", line)}
+ if legal_lines != amd_header:
+ raise ValueError("incorrect AMD copyright/license; review manually, left untouched")
+ return data
+ upstream = (b"SGLang Team", b"vLLM project", b"vLLM contributors", b"Tri Dao", b"FlashInfer", b"SafeAI Lab")
+ if b"SPDX-FileCopyrightText:" in notice and any(holder in notice for holder in upstream):
+ if re.search(rb"(?i)copyright[^\n]*Eagle AI Corp|LicenseRef-Eagle-", notice):
+ raise ValueError("conflicting Eagle header on derived source; review manually, left untouched")
+ return data
+ expected = [f"{prefix} {line}".encode() for line in (COPYRIGHT, LICENSE)]
+ for line in notice.splitlines():
+ if (
+ re.search(
+ rb"(?i)copyright|SPDX-License-Identifier|^\s*(?:#|//|/\*|\*)\s*(?:derived from|licensed under)", line
+ )
+ and line not in expected
+ ):
+ raise ValueError("unrecognized copyright/license/provenance; review manually, left untouched")
+ header = newline.join(expected) + newline
+ if b"".join(lines[position:]).startswith(header):
+ return data
+ remaining_comments = [line for line in comments if line.rstrip(b"\r\n") not in expected]
+ body = b"".join(remaining_comments + lines[position + len(comments) :])
+ preamble = b"".join(lines[:position])
+ if preamble and not preamble.endswith((b"\n", b"\r")):
+ preamble += newline
+ return preamble + header + (newline + body if body else b"")
+
+
+def check_third_party(root: Path, manifest: Path) -> tuple[set[str], int]:
+ """Validate known provenance before the generic Eagle-header fixer runs."""
+ records = json.loads(manifest.read_text())["files"]
+ names: set[str] = set()
+ seen: set[str] = set()
+ errors = 0
+ for record in records:
+ name = record["path"]
+ relative = Path(name)
+ if relative.is_absolute() or ".." in relative.parts or name in seen:
+ raise ValueError(f"invalid or duplicate manifest path: {name}")
+ seen.add(name)
+ names.add(name)
+ path = root / relative
+ if not path.exists() and record.get("absent_in_baseline", False):
+ continue
+ if path.is_symlink() or not path.is_file() or not path.resolve().is_relative_to(root.resolve()):
+ print(f"{name}: missing source or unsafe symlink")
+ errors += 1
+ continue
+ data = path.read_bytes()
+ eagle_header = f"# {COPYRIGHT}\n# {LICENSE}\n".encode()
+ first_party_body = data.removeprefix(eagle_header).lstrip(b"\r\n")
+ if hashlib.sha256(first_party_body).hexdigest() in record.get("first_party_sha256", []):
+ names.remove(name)
+ continue
+ lines = data.decode("utf-8-sig").splitlines()
+ comments = []
+ prefixes = ("//", "/*", "*") if path.suffix in C_SUFFIXES else ("#",)
+ for line in lines:
+ if line.strip() and not line.lstrip().startswith(prefixes):
+ break
+ comments.append(line)
+ header = "\n".join(comments) + "\n"
+ notice = record["notice"]
+ if not notice or notice not in header:
+ print(f"{name}: missing original notice")
+ errors += 1
+ if record["modified"] and not re.search(r"(?m)^(?:#|//) Modified by Eagle AI Corp\.$", header):
+ print(f"{name}: missing modification notice")
+ errors += 1
+ if re.search(r"(?i)copyright[^\n]*Eagle AI Corp|LicenseRef-Eagle-", header):
+ print(f"{name}: conflicting Eagle ownership on derived source")
+ errors += 1
+ expected_spdx = re.findall(r"SPDX-License-Identifier:[^\n]*", notice)
+ actual_spdx = re.findall(r"SPDX-License-Identifier:[^\n]*", header)
+ if actual_spdx != expected_spdx:
+ print(f"{name}: changed SPDX license")
+ errors += 1
+ return names, errors
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--fix", action="store_true", help="add missing Eagle headers; never repair derived source")
+ parser.add_argument("--manifest", type=Path, help="third-party provenance manifest")
+ parser.add_argument("--root", type=Path, help="source root (also accepts an extracted engine tree)")
+ parser.add_argument("--third-party-only", action="store_true", help="check only the manifest, not Eagle ownership")
+ args = parser.parse_args()
+ root = args.root or Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip())
+ manifest = args.manifest or root / "tools" / "third_party_headers.json"
+ derived: set[str] = set()
+ missing = 0
+ try:
+ if manifest.exists():
+ derived, missing = check_third_party(root, manifest)
+ elif args.manifest or args.third_party_only:
+ raise ValueError(f"missing provenance manifest: {manifest}")
+ except (OSError, ValueError, KeyError, TypeError) as error:
+ print(f"provenance manifest: {error}")
+ return 1
+ if args.third_party_only:
+ return int(missing > 0)
+ names = subprocess.check_output(["git", "ls-files", "-z", "--cached", "--others", "--exclude-standard"], cwd=root)
+ for name in sorted(set(names.decode().split("\0")) - {""}):
+ if name in derived:
+ continue
+ path = root / name
+ if {"docs", "LICENSES", "legal", "data", "generated"}.intersection(Path(name).parts):
+ continue
+ if not path.is_file() or path.is_symlink():
+ continue
+ data = path.read_bytes()
+ is_script = data.startswith(b"#!") and re.search(rb"(?:python[\d.]*|(?:ba|z|da|k)?sh)\b", data.splitlines()[0])
+ if (
+ path.suffix not in SOURCE_SUFFIXES
+ and path.name != "Dockerfile"
+ and path.suffix != ".Dockerfile"
+ and not is_script
+ ):
+ continue
+ try:
+ updated = add_header(path, data)
+ except ValueError as error:
+ missing += 1
+ print(f"{name}: {error}")
+ continue
+ if updated == data:
+ continue
+ if args.fix:
+ path.write_bytes(updated)
+ print(f"added: {name}")
+ else:
+ missing += 1
+ print(f"missing header: {name} (run python tools/check_headers.py --fix)")
+ return int(missing > 0)
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/tools/check_image_tag.sh b/tools/check_image_tag.sh
new file mode 100644
index 0000000..ee3478e
--- /dev/null
+++ b/tools/check_image_tag.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+set -euo pipefail
+
+image=${1:?usage: check_image_tag.sh IMAGE:TAG}
+if output=$(docker buildx imagetools inspect "$image" 2>&1); then
+ echo "Image tag already exists: $image; publish a new version instead of replacing it" >&2
+ exit 1
+else
+ status=$?
+fi
+
+# Buildx's resolver reports a manifest HTTP 404 with this exact image-scoped error.
+# Unknown formats fail closed; a token-endpoint 404 is not tag absence.
+if [[ "$status" == 1 && "$output" == "ERROR: $image: not found" ]]; then
+ printf 'Confirmed absent image tag: %s\n' "$image"
+ exit 0
+fi
+printf 'Cannot confirm image tag absence: %s\n%s\n' "$image" "$output" >&2
+exit 1
diff --git a/tools/check_targets.py b/tools/check_targets.py
new file mode 100644
index 0000000..581af70
--- /dev/null
+++ b/tools/check_targets.py
@@ -0,0 +1,112 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Compile the Triton kernels for every target architecture and report which fail: arch errors without that hardware.
+
+ python tools/check_targets.py [--targets sm_80,sm_90,gfx942]
+
+Runs the kernel benchmark cases (``tools/bench_kernels.py``) once per target in a fresh process with the dispatch
+(:mod:`eagle_harness.kernels.arch`) answering for the target GPU and Triton compiling for its ``GPUTarget``; kernels are
+compiled, never launched (inputs are real tensors on whatever NVIDIA GPU runs this, outputs are garbage). So every
+launcher takes the path the target takes: no PDL before sm_90, Gluon on sm_103 only. The native CUDA library is not
+loaded (the Triton fallbacks are what is checked); it has its own check: ``kernels.build check``.
+"""
+
+from __future__ import annotations
+
+import argparse
+import subprocess
+import sys
+import traceback
+from pathlib import Path
+from typing import Dict, List, Tuple
+
+sys.path.insert(0, str(Path(__file__).resolve().parent)) # bench_kernels
+
+# name -> (Triton backend, Triton arch, warp size, vendor, sm)
+TARGETS: Dict[str, Tuple[str, object, int, str, int]] = {
+ "sm_80": ("cuda", 80, 32, "nvidia", 80),
+ "sm_89": ("cuda", 89, 32, "nvidia", 89),
+ "sm_90": ("cuda", 90, 32, "nvidia", 90),
+ "sm_100": ("cuda", 100, 32, "nvidia", 100),
+ "sm_103": ("cuda", 103, 32, "nvidia", 103),
+ "sm_120": ("cuda", 120, 32, "nvidia", 120),
+ "gfx90a": ("hip", "gfx90a", 64, "amd", 0),
+ "gfx942": ("hip", "gfx942", 64, "amd", 0),
+ "gfx950": ("hip", "gfx950", 64, "amd", 0),
+}
+
+
+def _compile_only(name: str) -> Tuple[List[str], int]:
+ """Run every benchmark case for target ``name`` without launching: ``(failures, kernel launches compiled)``."""
+ import bench_kernels
+ import torch
+ from triton.backends.compiler import GPUTarget
+ from triton.runtime import driver
+ from triton.runtime.jit import JITFunction
+
+ from eagle_harness.kernels import arch, native
+
+ backend, triton_arch, warp, vendor, sm = TARGETS[name]
+ fake = arch.Gpu(0, name, vendor, name, sm)
+ arch._probe = lambda index: fake # type: ignore[assignment]
+ native.library = lambda: None # type: ignore[assignment]
+ driver.active.get_current_target = lambda: GPUTarget(backend, triton_arch, warp) # type: ignore[method-assign]
+ run = JITFunction.run
+ launches = []
+
+ def compile_only(self, *args, **kwargs):
+ launches.append(self.fn.__name__)
+ return run(self, *args, **{**kwargs, "warmup": True})
+
+ JITFunction.run = compile_only # type: ignore[method-assign]
+
+ failures: List[str] = []
+ case = {"name": ""}
+
+ def compile_case(fn):
+ try:
+ return 0.0, fn()
+ except Exception as e: # noqa: BLE001 - report every kernel that fails to compile
+ failures.append(
+ f"{case['name']}: {type(e).__name__}: {str(e).strip().splitlines()[-1] if str(e).strip() else ''}"
+ )
+ traceback.print_exc(file=sys.stderr)
+ return 0.0, None
+
+ record = bench_kernels._record
+
+ def labelled(results, label, fn):
+ case["name"] = label
+ record(results, label, fn)
+
+ bench_kernels._time = compile_case
+ bench_kernels._record = labelled
+ for group, run_group in bench_kernels.GROUPS.items():
+ try:
+ run_group({})
+ except Exception as e: # noqa: BLE001
+ failures.append(f"{group} setup: {type(e).__name__}: {e}")
+ torch.cuda.synchronize()
+ return failures, len(launches)
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser(description="Compile the Triton kernels for every target architecture.")
+ ap.add_argument("--targets", default=",".join(TARGETS))
+ ap.add_argument("--child", help=argparse.SUPPRESS)
+ args = ap.parse_args()
+ if args.child:
+ failures, compiled = _compile_only(args.child)
+ print("\n".join(f"FAIL {args.child} {f}" for f in failures) or f"OK {args.child}: {compiled} kernel launches")
+ return 1 if failures else 0
+ bad = 0
+ for name in args.targets.split(","):
+ proc = subprocess.run([sys.executable, __file__, "--child", name], capture_output=True, text=True)
+ print(proc.stdout.strip() or f"FAIL {name} no output: {proc.stderr.strip().splitlines()[-1:]}")
+ bad += proc.returncode != 0
+ return 1 if bad else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/engine_release.py b/tools/engine_release.py
new file mode 100644
index 0000000..7141a9b
--- /dev/null
+++ b/tools/engine_release.py
@@ -0,0 +1,192 @@
+#!/usr/bin/env python3
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Upload immutable engine assets or build a wheel-free Pages site from them.
+
+Uploads require a complete channel's wheels. The checksum manifest is uploaded
+last, so an interrupted upload cannot advertise an incomplete channel. Reruns
+verify existing bytes instead of replacing assets. Nothing creates a release.
+"""
+
+import argparse
+import json
+from pathlib import Path
+import re
+import shutil
+import subprocess
+import tempfile
+
+import mk_index
+
+REPOSITORY = "eagle-hq/EAGLE-4"
+CHANNELS = ("cu130", "rocm")
+UPLOAD_CHANNELS = (*CHANNELS, "harness")
+REQUIRED = {
+ "harness": {"eagle-harness"},
+ "cu130": {"sglang", "vllm", "tokenspeed", "tokenspeed-kernel", "tokenspeed-scheduler"},
+ "rocm": {"sglang"},
+}
+WHEEL_NAME = re.compile(r"[A-Za-z0-9_][A-Za-z0-9_.+\-]*\.whl")
+
+
+def validate_tag(tag: str) -> None:
+ if not re.fullmatch(r"v\d+\.\d+\.\d+", tag):
+ raise ValueError("release tag must have the form vX.Y.Z")
+
+
+def gh(*args: str, repository: str = REPOSITORY) -> str:
+ return subprocess.check_output(["gh", *args, "--repo", repository], text=True)
+
+
+def manifest_name(channel: str) -> str:
+ return "harness-SHA256SUMS" if channel == "harness" else f"engine-{channel}-SHA256SUMS"
+
+
+def validate_wheels(channel: str, wheels: list[Path]) -> None:
+ names = set()
+ projects = set()
+ for wheel in wheels:
+ if not WHEEL_NAME.fullmatch(wheel.name) or wheel.name in names:
+ raise ValueError(f"invalid or duplicate wheel filename: {wheel.name}")
+ names.add(wheel.name)
+ meta = mk_index.metadata(wheel)
+ project = mk_index.normalize(meta["name"])
+ version = meta["version"]
+ if channel == "harness":
+ if project != "eagle-harness":
+ raise ValueError(f"not a harness wheel: {wheel.name}")
+ projects.add(project)
+ continue
+ if project == "eagle-harness" or "+eagle." not in version:
+ raise ValueError(f"not an Eagle engine wheel: {wheel.name}")
+ if (".rocm" in version) != (channel == "rocm"):
+ raise ValueError(f"wheel belongs to the other platform channel: {wheel.name}")
+ projects.add(project)
+ missing = REQUIRED[channel] - projects
+ if missing:
+ raise ValueError(f"{channel}: missing engine wheels: {', '.join(sorted(missing))}")
+
+
+def read_manifest(path: Path) -> dict[str, str]:
+ entries = {}
+ for line in path.read_text().splitlines():
+ match = re.fullmatch(r"([a-f0-9]{64}) (.+)", line)
+ if not match or not WHEEL_NAME.fullmatch(match[2]):
+ raise ValueError(f"invalid checksum entry in {path.name}: {line!r}")
+ digest, name = match.groups()
+ if name in entries:
+ raise ValueError(f"duplicate checksum entry: {name}")
+ entries[name] = digest
+ if not entries:
+ raise ValueError(f"empty checksum manifest: {path.name}")
+ return entries
+
+
+def verify(path: Path, digest: str) -> None:
+ if mk_index.sha256(path) != digest:
+ raise ValueError(f"SHA256 mismatch: {path.name}; released assets must never change")
+
+
+def upload(tag: str, channel: str, wheels: list[Path], *, repository: str = REPOSITORY,
+ draft: bool = False) -> None:
+ validate_tag(tag)
+ validate_wheels(channel, wheels)
+ if channel == "harness" and any(mk_index.metadata(w)["version"] != tag.removeprefix("v") for w in wheels):
+ raise ValueError("harness wheel version must equal the release tag")
+ wheels = sorted(wheels, key=lambda p: p.name)
+ checksums = {p.name: mk_index.sha256(p) for p in wheels}
+ if draft:
+ repo = json.loads(subprocess.check_output(
+ ["gh", "repo", "view", repository, "--json", "isPrivate"], text=True))
+ if not repo["isPrivate"]:
+ raise ValueError("draft upload requires a private repository")
+ release = json.loads(gh("release", "view", tag, "--json", "tagName,isDraft,assets", repository=repository))
+ if release["tagName"] != tag or release["isDraft"] != draft:
+ state = "draft" if draft else "published"
+ raise ValueError(f"upload requires the existing, {state} release with the exact tag")
+ existing = {asset["name"] for asset in release["assets"]}
+ with tempfile.TemporaryDirectory(prefix="engine-upload-") as temporary:
+ work = Path(temporary)
+ manifest = work / manifest_name(channel)
+ manifest.write_text("".join(f"{digest} {name}\n" for name, digest in checksums.items()))
+ files = [*wheels, manifest]
+ checksums[manifest.name] = mk_index.sha256(manifest)
+ before = work / "before"
+ before.mkdir()
+ # Preflight every conflict before uploading anything; never use --clobber.
+ for path in files:
+ if path.name in existing:
+ gh("release", "download", tag, "--pattern", path.name, "--dir", str(before), repository=repository)
+ verify(before / path.name, checksums[path.name])
+ for path in files:
+ verify(path, checksums[path.name])
+ if path.name not in existing:
+ gh("release", "upload", tag, str(path), repository=repository)
+ after = work / "after" / path.name
+ after.parent.mkdir(exist_ok=True)
+ gh("release", "download", tag, "--pattern", path.name, "--output", str(after), repository=repository)
+ verify(after, checksums[path.name])
+ print(f"verified {tag}/{path.name} sha256={checksums[path.name]}")
+
+
+def pages(tag: str, output: Path) -> None:
+ validate_tag(tag)
+ if output.exists():
+ raise ValueError(f"output already exists: {output}; use a fresh staging directory")
+ release = json.loads(gh("release", "view", tag, "--json", "tagName,isDraft"))
+ if release["tagName"] != tag or release["isDraft"]:
+ raise ValueError("Pages requires an existing, published release with the exact tag")
+ with tempfile.TemporaryDirectory(prefix="engine-index-") as temporary:
+ work = Path(temporary)
+ site = work / "site"
+ for channel in CHANNELS:
+ assets = work / channel
+ assets.mkdir()
+ manifest = manifest_name(channel)
+ gh("release", "download", tag, "--pattern", manifest, "--dir", str(assets))
+ entries = read_manifest(assets / manifest)
+ wheels = []
+ for name, digest in entries.items():
+ gh("release", "download", tag, "--pattern", name, "--dir", str(assets))
+ wheel = assets / name
+ verify(wheel, digest)
+ wheels.append(wheel)
+ validate_wheels(channel, wheels)
+ index = work / f"index-{channel}"
+ mk_index.main(index, wheels, f"https://github.com/{REPOSITORY}/releases/download/{tag}")
+ destination = site / "whl" / channel
+ shutil.copytree(index / "simple", destination)
+ shutil.copyfile(assets / manifest, destination / "SHA256SUMS")
+ (site / "index.html").write_text(
+ '<!DOCTYPE html>\n<html><body><a href="whl/cu130/">CUDA 13.0</a>\n'
+ '<a href="whl/rocm/">ROCm</a></body></html>\n'
+ )
+ (site / ".nojekyll").touch()
+ shutil.copytree(site, output)
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(description=__doc__)
+ commands = parser.add_subparsers(dest="command", required=True)
+ upload_parser = commands.add_parser("upload", help="publish wheels to an existing GitHub Release")
+ upload_parser.add_argument("--repository", default=REPOSITORY)
+ upload_parser.add_argument("--draft", action="store_true", help="require a private repository and a draft release")
+ upload_parser.add_argument("tag")
+ upload_parser.add_argument("channel", choices=UPLOAD_CHANNELS)
+ upload_parser.add_argument("wheels", type=Path, nargs="+")
+ pages_parser = commands.add_parser("pages", help="download and verify assets, then generate Pages HTML")
+ pages_parser.add_argument("tag")
+ pages_parser.add_argument("output", type=Path)
+ args = parser.parse_args()
+ try:
+ if args.command == "upload":
+ upload(args.tag, args.channel, args.wheels, repository=args.repository, draft=args.draft)
+ else:
+ pages(args.tag, args.output)
+ except (ValueError, OSError, subprocess.CalledProcessError) as error:
+ parser.exit(1, f"{error}\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/gpu_smoke.py b/tools/gpu_smoke.py
new file mode 100644
index 0000000..a03c509
--- /dev/null
+++ b/tools/gpu_smoke.py
@@ -0,0 +1,93 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""GPU smoke test of the calibration timing sweep.
+
+Run on one GPU: ``python tools/gpu_smoke.py --out <dir>``. Prints a JSON summary:
+
+1. the kernel report of the device (``eagle_harness.kernels.arch``);
+2. a FlashInfer attention sweep at the Qwen3.8-27B TP4 shapes (draft and
+ target heads), fitted with fit_cache_costs into the calibrated cost-table layout.
+
+The kernels have their own GPU tests (``tests/test_*_gpu.py``).
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import sys
+import time
+
+import torch
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
+from eagle_harness.core.attention_sweeps import FlashInferTimer, HeadLayout, sweep # noqa: E402
+from eagle_harness.core.calibration import CalibrationPaths, CacheSweepPlan, MeasureParams, fit_cache_costs # noqa: E402
+from eagle_harness.core.limits import ComputeIntensity, draft_query_lens, verify_buckets # noqa: E402
+from eagle_harness.kernels import arch # noqa: E402
+
+
+def main() -> None:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("--out", required=True)
+ args = ap.parse_args()
+ out: dict = {"device": torch.cuda.get_device_name(), "capability": torch.cuda.get_device_capability()}
+
+ out["kernels"] = arch.report().splitlines()
+
+ paths = CalibrationPaths(os.path.join(args.out, "calib"))
+ params = MeasureParams(
+ context_step=64, context_stop=2048, batch_size=1, verify_num=64, node_top_k=8, loop_top_m=64, repeat_cnt=16
+ )
+ plan = CacheSweepPlan.from_params(params)
+ shapes = {
+ "slm": (HeadLayout.for_rank(40, 40, 128, 4), draft_query_lens(1, ComputeIntensity.HIGH), params.node_top_k),
+ "llm": (
+ HeadLayout.for_rank(24, 4, 256, 4),
+ sorted(verify_buckets(1, ComputeIntensity.HIGH)),
+ params.verify_num,
+ ),
+ }
+ sweep_seconds = {}
+ for model, (heads, lens, max_q) in shapes.items():
+ t0 = time.time()
+ sweep(
+ FlashInferTimer(heads, tp_size=4),
+ category=f"cache_{model}",
+ batch_size=1,
+ qo_lens=lens,
+ plan=plan,
+ save_dir=paths.raw(1, "cache", model),
+ )
+ sweep_seconds[model] = round(time.time() - t0, 1)
+ instability = fit_cache_costs(
+ f"cache_all_{model}",
+ paths.raw(1, "cache", model),
+ paths.fitted(1, "cache", model),
+ max_query_length=max_q,
+ cache_length_start=64,
+ cache_length_step=64,
+ cache_length_stop=2048,
+ batch_size=1,
+ intensity=ComputeIntensity.HIGH,
+ paths=paths,
+ )
+ fitted = [
+ json.load(open(os.path.join(paths.fitted(1, "cache", model), f"cache_interval_{i}.json")))
+ for i in (0, 15, 30)
+ ]
+ out[f"cache_{model}"] = {
+ "instability_rate": instability,
+ "us_per_layer_q1_at_intervals_0_15_30": [f["array"][0] for f in fitted],
+ f"us_per_layer_q{lens[-1]}_at_intervals_0_15_30": [f["array"][lens[-1] - 1] for f in fitted],
+ }
+ out["sweep_seconds"] = sweep_seconds
+ print(json.dumps(out, indent=2))
+ with open(os.path.join(args.out, "summary.json"), "w", encoding="utf-8") as f:
+ json.dump(out, f, indent=2)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/greedy_parity.py b/tools/greedy_parity.py
new file mode 100644
index 0000000..ab2608f
--- /dev/null
+++ b/tools/greedy_parity.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python3
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Greedy parity between a speculative server and a no-spec server, token for token.
+
+``run`` sends the first user turn of a stratified subset of the SPEED-Bench
+conversations to a running ``sglang.launch_server`` through ``/generate``
+(chat template applied client side, temperature 0) and saves the output token
+ids plus the server's ``spec_*`` meta info. With ``--top-logprobs`` (no-spec
+server only) it also saves the top-5 logprobs of every generated position, so
+``compare`` can say whether a divergence is a numerical near-tie: the
+candidate's token is in the reference's top 5 there and at most ``--tie-gap``
+below the reference's best (the reference logits are bf16, one ulp is 0.125 for
+logits in [16, 32)).
+
+``compare`` reports, per prompt, identical / diverged at token i with the
+reference's logprob gap to the candidate's token, plus the mean acceptance length.
+
+ python tools/greedy_parity.py run --port P --data question_multiturn.jsonl \
+ --tokenizer <model dir> --out nospec.json --top-logprobs
+ python tools/greedy_parity.py compare nospec.json static.json
+"""
+
+from __future__ import annotations
+
+import argparse
+import collections
+import json
+import logging
+import sys
+import time
+from typing import Dict, List
+
+import requests
+
+logger = logging.getLogger("greedy_parity")
+TOP_LOGPROBS = 5
+
+
+def load_prompts(path: str, count: int) -> List[dict]:
+ """``count`` conversations spread over the categories (round robin, file order)."""
+ by_category: Dict[str, List[dict]] = collections.defaultdict(list)
+ with open(path, encoding="utf-8") as f:
+ for line in f:
+ row = json.loads(line)
+ by_category[row["category"]].append(row)
+ picked: List[dict] = []
+ for i in range(max(len(v) for v in by_category.values())):
+ for category in sorted(by_category):
+ if i < len(by_category[category]) and len(picked) < count:
+ picked.append(by_category[category][i])
+ return picked
+
+
+def run(args: argparse.Namespace) -> None:
+ from transformers import AutoTokenizer
+
+ tokenizer = AutoTokenizer.from_pretrained(args.tokenizer)
+ base = f"http://127.0.0.1:{args.port}"
+ results = []
+ t0 = time.time()
+ for row in load_prompts(args.data, args.prompts):
+ messages = [
+ {"role": "system", "content": "You are a helpful assistant."},
+ {"role": "user", "content": row["turns"][0]},
+ ]
+ text = tokenizer.apply_chat_template(
+ messages, add_generation_prompt=True, tokenize=False, enable_thinking=True, reasoning_effort="xhigh"
+ )
+ input_ids = tokenizer.encode(text, add_special_tokens=False)
+ payload = {
+ "input_ids": list(input_ids),
+ "sampling_params": {"temperature": 0, "top_k": 1, "max_new_tokens": args.max_new_tokens},
+ }
+ if args.top_logprobs:
+ payload.update(return_logprob=True, top_logprobs_num=TOP_LOGPROBS)
+ start = time.time()
+ reply = requests.post(f"{base}/generate", json=payload, timeout=3600)
+ if not reply.ok:
+ raise RuntimeError(f"/generate {reply.status_code}: {reply.text[:2000]}")
+ data = reply.json()
+ meta = data["meta_info"]
+ entry = {
+ "question_id": row["question_id"],
+ "category": row["category"],
+ "prompt_tokens": len(input_ids),
+ "output_ids": data["output_ids"],
+ "latency": time.time() - start,
+ "spec_verify_ct": meta.get("spec_verify_ct"),
+ "spec_accept_length": meta.get("spec_accept_length"),
+ "finish_reason": meta.get("finish_reason"),
+ }
+ if args.top_logprobs:
+ entry["top"] = [[[lp, tok] for lp, tok, *_ in pos] for pos in meta["output_top_logprobs"]]
+ results.append(entry)
+ logger.info(
+ "%s %s: %d tokens, accept %s",
+ row["category"],
+ row["question_id"][:8],
+ len(entry["output_ids"]),
+ entry["spec_accept_length"],
+ )
+ with open(args.out, "w", encoding="utf-8") as f:
+ json.dump({"port": args.port, "wall": time.time() - t0, "results": results}, f)
+
+
+def compare(args: argparse.Namespace) -> int:
+ with open(args.reference, encoding="utf-8") as f:
+ ref = {r["question_id"]: r for r in json.load(f)["results"]}
+ with open(args.candidate, encoding="utf-8") as f:
+ cand = json.load(f)["results"]
+ identical, near_ties, real = 0, 0, 0
+ tokens = verify = 0
+ for r in cand:
+ base = ref[r["question_id"]]
+ a, b = base["output_ids"], r["output_ids"]
+ n = min(len(a), len(b))
+ first = next((i for i in range(n) if a[i] != b[i]), None)
+ if r.get("spec_verify_ct"):
+ tokens += len(b)
+ verify += r["spec_verify_ct"]
+ if first is None and len(a) == len(b):
+ identical += 1
+ print(f"{r['question_id'][:8]} {r['category']:<14} identical ({len(a)} tokens)")
+ continue
+ if first is None:
+ print(f"{r['question_id'][:8]} {r['category']:<14} prefix-equal, lengths {len(a)} vs {len(b)}")
+ real += 1
+ continue
+ gap = None
+ top = base.get("top", [])
+ if first < len(top):
+ ranked = {tok: lp for lp, tok in top[first]}
+ if b[first] in ranked:
+ gap = top[first][0][0] - ranked[b[first]]
+ tie = gap is not None and gap <= args.tie_gap
+ near_ties += tie
+ real += not tie
+ print(
+ f"{r['question_id'][:8]} {r['category']:<14} diverges at {first}/{n}: ref {a[first]} vs {b[first]}"
+ f", ref logprob gap to it {'not in ref top-5' if gap is None else round(gap, 4)}"
+ f"{' (near-tie)' if tie else ''}"
+ )
+ print(f"identical {identical}/{len(cand)}, near-tie divergences {near_ties}, other {real}")
+ if verify:
+ print(f"acceptance length (tokens / verify rounds) {tokens / verify:.3f} over {verify} rounds")
+ return 0 if real == 0 else 1
+
+
+def main() -> int:
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s")
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ sub = ap.add_subparsers(dest="cmd", required=True)
+ r = sub.add_parser("run")
+ r.add_argument("--port", type=int, required=True)
+ r.add_argument("--data", required=True)
+ r.add_argument("--tokenizer", required=True)
+ r.add_argument("--prompts", type=int, default=20)
+ r.add_argument("--max-new-tokens", type=int, default=512)
+ r.add_argument("--top-logprobs", action="store_true")
+ r.add_argument("--out", required=True)
+ c = sub.add_parser("compare")
+ c.add_argument("reference")
+ c.add_argument("candidate")
+ c.add_argument("--tie-gap", type=float, default=0.13, help="max ref logprob gap counted as a near-tie (1 bf16 ulp)")
+ args = ap.parse_args()
+ if args.cmd == "run":
+ run(args)
+ return 0
+ return compare(args)
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/mk_index.py b/tools/mk_index.py
new file mode 100644
index 0000000..a5ed2c1
--- /dev/null
+++ b/tools/mk_index.py
@@ -0,0 +1,103 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Write a static PEP 503 index: <root>/files/<artifact> and <root>/simple/<project>/index.html.
+
+ python mk_index.py <root> <artifact>...
+
+Links default to ../../files/<name>#sha256=<hex>. With --base-url, links instead
+point to that HTTPS release-asset directory. Only simple/ needs deploying in this
+mode; files/ is a local staging cache, not part of the Pages site.
+
+Each project page lists every staged artifact of that project. Requires-Python
+comes from the artifact metadata. Re-running adds artifacts; released filenames
+must stay byte-identical.
+"""
+
+import argparse
+import hashlib
+import html
+import re
+import shutil
+import sys
+import tarfile
+import zipfile
+from email.parser import Parser
+from pathlib import Path
+from urllib.parse import quote, urlsplit
+
+
+def normalize(name: str) -> str:
+ return re.sub(r"[-_.]+", "-", name).lower()
+
+
+def metadata(path: Path) -> dict:
+ if path.suffix == ".whl":
+ with zipfile.ZipFile(path) as z:
+ text = z.read(next(n for n in z.namelist() if n.endswith(".dist-info/METADATA"))).decode()
+ else:
+ with tarfile.open(path) as t:
+ member = next(m for m in t.getmembers() if m.name.count("/") == 1 and m.name.endswith("/PKG-INFO"))
+ text = t.extractfile(member).read().decode()
+ msg = Parser().parsestr(text, headersonly=True)
+ return {"name": msg["Name"], "version": msg["Version"], "requires_python": msg.get("Requires-Python")}
+
+
+def sha256(path: Path) -> str:
+ digest = hashlib.sha256()
+ with path.open("rb") as source:
+ for block in iter(lambda: source.read(1024 * 1024), b""):
+ digest.update(block)
+ return digest.hexdigest()
+
+
+def main(root: Path, artifacts: list[Path], base_url: str | None = None) -> None:
+ if base_url is not None:
+ url = urlsplit(base_url)
+ if (
+ url.scheme != "https"
+ or not url.netloc
+ or url.username is not None
+ or url.password is not None
+ or url.query
+ or url.fragment
+ ):
+ sys.exit("--base-url must be an HTTPS URL without credentials, query or fragment")
+ base_url = base_url.rstrip("/")
+ files = root / "files"
+ files.mkdir(parents=True, exist_ok=True)
+ for a in artifacts:
+ dst = files / a.name
+ if dst.exists() and sha256(dst) != sha256(a):
+ sys.exit(f"{dst} exists with other content: a release artifact never changes; bump the version")
+ if not dst.exists():
+ shutil.copyfile(a, dst)
+ projects: dict[str, list[tuple[Path, dict, str]]] = {}
+ for f in sorted(files.iterdir()):
+ meta = metadata(f)
+ projects.setdefault(normalize(meta["name"]), []).append((f, meta, sha256(f)))
+ simple = root / "simple"
+ for project, entries in projects.items():
+ lines = [
+ f"<!DOCTYPE html>\n<html><head><title>Links for {project}</title></head><body>",
+ f"<h1>Links for {project}</h1>",
+ ]
+ for f, meta, sha in entries:
+ rp = f' data-requires-python="{html.escape(meta["requires_python"])}"' if meta["requires_python"] else ""
+ href = f"{base_url or '../../files'}/{quote(f.name)}#sha256={sha}"
+ lines.append(f'<a href="{html.escape(href)}"{rp}>{html.escape(f.name)}</a><br/>')
+ print(f"{project} {meta['version']} {f.name} {f.stat().st_size} sha256={sha}")
+ (simple / project).mkdir(parents=True, exist_ok=True)
+ (simple / project / "index.html").write_text("\n".join(lines + ["</body></html>\n"]))
+ links = "\n".join(f'<a href="{p}/">{p}</a><br/>' for p in sorted(projects))
+ (simple / "index.html").write_text(f"<!DOCTYPE html>\n<html><body>\n{links}\n</body></html>\n")
+ (root / "SHA256SUMS").write_text("".join(f"{sha} files/{f.name}\n" for e in projects.values() for f, _, sha in e))
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("root", type=Path)
+ parser.add_argument("artifacts", type=Path, nargs="*")
+ parser.add_argument("--base-url", help="HTTPS directory containing the release assets")
+ args = parser.parse_args()
+ main(args.root, args.artifacts, args.base_url)
diff --git a/tools/profile_decode.py b/tools/profile_decode.py
new file mode 100644
index 0000000..5fdc1cd
--- /dev/null
+++ b/tools/profile_decode.py
@@ -0,0 +1,187 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Profile bs=1 decode rounds of a running sglang server and summarize the trace.
+
+``run``: one warm-up request, then ``/start_profile`` for ``--steps`` scheduler
+steps (CPU + GPU activities by default, rank 0's trace is what ``summarize`` reads) while a
+single greedy request decodes, from its start or ``--profile-after`` seconds into it.
+
+``summarize``: from a torch profiler chrome trace, the GPU time per scheduler
+step, the share of the step the GPU is busy, and the top kernels by total time
+(names truncated, grouped by prefix), so the gap to a reference is attributed
+to kernels vs host overhead.
+"""
+
+from __future__ import annotations
+
+import argparse
+import collections
+import concurrent.futures
+import glob
+import gzip
+import json
+import logging
+import os
+import time
+
+import requests
+
+logger = logging.getLogger("profile_decode")
+
+PROMPT = (
+ "Explain, step by step and with a worked numerical example, how a speculative decoding "
+ "system with a tree-shaped draft decides which drafted tokens to accept."
+)
+
+
+def run(args: argparse.Namespace) -> None:
+ base = f"http://127.0.0.1:{args.port}"
+ payload = {"text": PROMPT, "sampling_params": {"temperature": 0, "max_new_tokens": args.max_new_tokens}}
+ requests.post(f"{base}/generate", json=payload, timeout=600).raise_for_status()
+ os.makedirs(args.out_dir, exist_ok=True)
+ profile = {"output_dir": args.out_dir, "num_steps": args.steps, "activities": args.activities.split(",")}
+ if args.profile_after > 0:
+ # Profile the request's steps after ``profile_after`` seconds of decoding (a longer context).
+ with concurrent.futures.ThreadPoolExecutor(1) as pool:
+ pending = pool.submit(requests.post, f"{base}/generate", json=payload, timeout=600)
+ time.sleep(args.profile_after)
+ requests.post(f"{base}/start_profile", json=profile, timeout=60).raise_for_status()
+ reply = pending.result()
+ else:
+ requests.post(f"{base}/start_profile", json=profile, timeout=60).raise_for_status()
+ reply = requests.post(f"{base}/generate", json=payload, timeout=600)
+ reply.raise_for_status()
+ meta = reply.json()["meta_info"]
+ logger.info("profiled request: %d tokens, %s verify rounds", meta["completion_tokens"], meta.get("spec_verify_ct"))
+ deadline = time.time() + 300
+ while time.time() < deadline and not glob.glob(os.path.join(args.out_dir, "*TP-0*.trace.json.gz")):
+ time.sleep(5)
+
+
+def _events(path: str) -> list:
+ opener = gzip.open if path.endswith(".gz") else open
+ with opener(path, "rt") as f:
+ return json.load(f)["traceEvents"]
+
+
+def _kernel_group(name: str) -> str:
+ return name.split("<")[0].split("(")[0][:90]
+
+
+STAGES = ("draft", "verify", "draft_extend", "draft_prelaunch")
+
+
+def _stage_spans(events: list, stages) -> dict:
+ """CPU spans of the speculative stages (``spec_stage_span``), by name, sorted by start."""
+ spans: dict = {name: [] for name in stages}
+ for e in events:
+ if (
+ e.get("ph") == "X"
+ and e.get("name") in spans
+ and e.get("cat") in ("user_annotation", "cpu_op", "python_function")
+ ):
+ spans[e["name"]].append((e["ts"], e["ts"] + e["dur"]))
+ return {name: sorted(v) for name, v in spans.items()}
+
+
+def _covering(spans: list, t: float) -> bool:
+ lo, hi = 0, len(spans)
+ while lo < hi: # last span starting at or before t
+ mid = (lo + hi) // 2
+ if spans[mid][0] <= t:
+ lo = mid + 1
+ else:
+ hi = mid
+ return lo > 0 and spans[lo - 1][1] >= t
+
+
+def summarize(args: argparse.Namespace) -> None:
+ events = _events(args.trace)
+ kernels = sorted(
+ (e for e in events if e.get("cat") in ("kernel", "gpu_memcpy", "gpu_memset") and "dur" in e),
+ key=lambda e: e["ts"],
+ )
+ if not kernels:
+ raise SystemExit("no GPU kernels in the trace")
+ stages = tuple(args.stages.split(","))
+ spans = _stage_spans(events, stages)
+ rounds = spans["draft"] or spans["verify"]
+ busy = sum(k["dur"] for k in kernels)
+ span = kernels[-1]["ts"] + kernels[-1]["dur"] - kernels[0]["ts"]
+ n = max(len(rounds), 1)
+ print(f"rounds {len(rounds)} GPU busy {busy / 1e3:.2f} ms over {span / 1e3:.2f} ms ({100 * busy / span:.1f}%)")
+ if len(rounds) > 1:
+ walls = [b[0] - a[0] for a, b in zip(rounds, rounds[1:])]
+ walls.sort()
+ print(f"round wall mean {sum(walls) / len(walls) / 1e3:.3f} ms, median {walls[len(walls) // 2] / 1e3:.3f} ms")
+ print(f"GPU time per round {busy / n / 1e3:.3f} ms, kernels per round {len(kernels) / n:.0f}")
+ for name in stages:
+ if spans[name]:
+ host = sum(b - a for a, b in spans[name])
+ gpu = sum(k["dur"] for k in kernels if _covering(spans[name], k["ts"]))
+ print(
+ f" {name:13s} host {host / n / 1e3:7.3f} ms/round, GPU kernels running inside {gpu / n / 1e3:7.3f} ms/round"
+ )
+ # GPU idle gaps, attributed to the stage whose host span covers the gap's start.
+ idle: dict = collections.defaultdict(float)
+ end = kernels[0]["ts"] + kernels[0]["dur"]
+ for k in kernels[1:]:
+ gap = k["ts"] - end
+ if gap > 0:
+ owner = next((name for name in stages if _covering(spans[name], end)), "other (scheduler)")
+ idle[owner] += gap
+ end = max(end, k["ts"] + k["dur"])
+ print("GPU idle per round, by the stage the host is in:")
+ for name, t in sorted(idle.items(), key=lambda kv: -kv[1]):
+ print(f" {name:18s} {t / n / 1e3:7.3f} ms")
+ totals: dict = collections.defaultdict(lambda: [0.0, 0])
+ for k in kernels:
+ t = totals[_kernel_group(k["name"])]
+ t[0] += k["dur"]
+ t[1] += 1
+ print(f"{'us/round':>9} {'calls/rnd':>10} {'share':>6} kernel")
+ for name, (dur, calls) in sorted(totals.items(), key=lambda kv: -kv[1][0])[: args.top]:
+ print(f"{dur / n:9.1f} {calls / n:10.1f} {100 * dur / busy:5.1f}% {name}")
+ if args.host_ops:
+ ops: dict = collections.defaultdict(lambda: [0.0, 0])
+ for e in events:
+ if e.get("ph") == "X" and e.get("cat") == "cpu_op" and any(_covering(spans[s], e["ts"]) for s in stages):
+ o = ops[e["name"]]
+ o[0] += e["dur"]
+ o[1] += 1
+ print(f"{'host us/rnd':>11} {'calls/rnd':>10} cpu op inside the stages (inclusive time)")
+ for name, (dur, calls) in sorted(ops.items(), key=lambda kv: -kv[1][0])[: args.host_ops]:
+ print(f"{dur / n:11.1f} {calls / n:10.1f} {name[:90]}")
+
+
+def main() -> None:
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s")
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ sub = parser.add_subparsers(dest="cmd", required=True)
+ r = sub.add_parser("run")
+ r.add_argument("--port", type=int, required=True)
+ r.add_argument("--out-dir", required=True)
+ r.add_argument("--steps", type=int, default=40)
+ r.add_argument("--max-new-tokens", type=int, default=1024)
+ r.add_argument(
+ "--activities", default="CPU,GPU", help="profiler activities; GPU alone keeps the host timing unperturbed"
+ )
+ r.add_argument(
+ "--profile-after", type=float, default=0.0, help="seconds into the profiled request to start the profile"
+ )
+ r.set_defaults(fn=run)
+ s = sub.add_parser("summarize")
+ s.add_argument("trace")
+ s.add_argument("--top", type=int, default=30)
+ s.add_argument("--host-ops", type=int, default=25, help="top host ops inside the stages (0: off)")
+ s.add_argument(
+ "--stages", default=",".join(STAGES), help="stage span names, comma separated (the first counts rounds)"
+ )
+ s.set_defaults(fn=summarize)
+ args = parser.parse_args()
+ args.fn(args)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/sampling_check.py b/tools/sampling_check.py
new file mode 100644
index 0000000..2ebe65c
--- /dev/null
+++ b/tools/sampling_check.py
@@ -0,0 +1,339 @@
+#!/usr/bin/env python3
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Lossless sampling under speculation: a speculative server must sample what the no-spec server samples.
+
+``run`` sends ``--samples`` short completions of each of a few open-ended prompts to a running server under each
+sampling setting (temperature, top-k with top-p, min-p, a repetition penalty), ``--concurrency`` requests at a
+time so they share decode rounds, and saves the output token ids. The first token comes from the prefill sampler;
+every later one from a speculative verify round.
+
+``compare`` tests, per setting and prompt, that the speculative server's tokens come from the same distribution as
+the reference's: a two-sample chi-square test of homogeneity on the joint distribution of the first three tokens and
+on the marginal of every position (cells seen fewer than 10 times in both runs together are pooled), at a
+Bonferroni-corrected level ``--alpha / tests``. It also prints the total variation distance of each test. A server
+that ignores a sampling parameter (for example, verifies greedily at temperature > 0) fails it by a wide margin.
+The first token comes from the prefill, so a speculative server whose prefill runs other attention kernels can
+differ there where a top-k or top-p cut falls between near-tied tokens; tokens 2 and 3 are therefore also tested
+given the reference's most common prefix ("verify draws given the modal prefix"), which isolates the verify rounds.
+Run the no-spec server twice to see the engine's own run-to-run level.
+
+With ``--seeds S`` (``run``) every one of S seeds is sent twice, in batches of a different composition, at
+temperature 0.7 for ``--seed-tokens`` tokens; ``compare`` (and ``run`` itself) report how many seeds reproduced
+their text, and ``compare`` how many seeded texts equal the reference server's for the same seed. sglang honors
+seeds only with ``--enable-deterministic-inference``.
+
+With ``--speed-data`` (a SPEED-Bench jsonl) ``run`` also decodes the first user turn of ``--speed-prompts``
+conversations one at a time (batch size 1, chat template, thinking off) at temperature 0 and at temperature 1, and
+``compare`` prints both decode rates against the reference's and how many greedy outputs equal the reference's.
+
+ python tools/sampling_check.py run --api vllm --port P --tokenizer <model dir> --out nospec.json --seeds 32
+ python tools/sampling_check.py run --api vllm --port P --tokenizer <model dir> --out spec.json --seeds 32
+ python tools/sampling_check.py compare nospec.json spec.json
+
+Exit code 1 (``compare``) when a test rejects at the corrected level, or a seed did not reproduce.
+"""
+
+from __future__ import annotations
+
+import argparse
+import collections
+import concurrent.futures
+import json
+import math
+import sys
+import time
+from typing import Dict, List, Optional, Sequence, Tuple
+
+import requests
+
+PROMPTS = (
+ "Here is a list of ten random animals:",
+ "Once upon a time, in a",
+ "My favorite word is",
+ "The weather today is",
+)
+SETTINGS: Dict[str, dict] = {
+ "temperature": {"temperature": 0.7},
+ "top_k_top_p": {"temperature": 1.0, "top_k": 8, "top_p": 0.7},
+ "min_p": {"temperature": 1.0, "min_p": 0.05},
+ "penalty": {"temperature": 0.8, "repetition_penalty": 1.5},
+}
+SEED_SETTING = {"temperature": 0.7}
+JOINT = 3 # tokens in the joint test
+POOL = 10 # cells seen fewer times than this in both runs together are pooled
+
+
+def generate(api: str, base: str, model: Optional[str], prompt: List[int], params: dict, max_new: int, seed=None):
+ """One completion's output token ids (and sglang's ``spec_*`` meta info)."""
+ if api == "sglang":
+ sp = {"max_new_tokens": max_new, "ignore_eos": True, **params}
+ if seed is not None:
+ sp["sampling_seed"] = seed
+ r = requests.post(f"{base}/generate", json={"input_ids": prompt, "sampling_params": sp}, timeout=3600)
+ r.raise_for_status()
+ out = r.json()
+ return out["output_ids"], {k: v for k, v in out["meta_info"].items() if k.startswith("spec_")}
+ body = {"model": model, "prompt": prompt, "max_tokens": max_new, "ignore_eos": True, "return_token_ids": True}
+ body.update(params)
+ if seed is not None:
+ body["seed"] = seed
+ r = requests.post(f"{base}/v1/completions", json=body, timeout=3600)
+ r.raise_for_status()
+ return r.json()["choices"][0]["token_ids"], {}
+
+
+def vllm_spec_counters(base: str) -> Dict[str, float]:
+ """vLLM's speculative decoding counters (drafts, accepted tokens), from /metrics."""
+ counters: Dict[str, float] = collections.defaultdict(float)
+ for line in requests.get(f"{base}/metrics", timeout=60).text.splitlines():
+ if line.startswith("vllm:spec_decode_num_") and "_total" in line.split("{")[0]:
+ counters[line.split("{")[0]] += float(line.rsplit(" ", 1)[1])
+ return dict(counters)
+
+
+def run(args) -> int:
+ from transformers import AutoTokenizer
+
+ tokenizer = AutoTokenizer.from_pretrained(args.tokenizer)
+ base = f"http://127.0.0.1:{args.port}"
+ model = requests.get(f"{base}/v1/models", timeout=60).json()["data"][0]["id"] if args.api == "vllm" else None
+ prompts = [tokenizer.encode(p, add_special_tokens=False) for p in PROMPTS]
+ result: dict = {"api": args.api, "max_new_tokens": args.max_new_tokens, "settings": {}, "seeds": {}}
+ pool = concurrent.futures.ThreadPoolExecutor(args.concurrency)
+ for name in args.settings.split(","):
+ params = SETTINGS[name]
+ before = vllm_spec_counters(base) if args.api == "vllm" else {}
+ jobs = [(i, prompt) for _ in range(args.samples) for i, prompt in enumerate(prompts)]
+ t0 = time.time()
+ try:
+ outs = list(
+ pool.map(lambda job: generate(args.api, base, model, job[1], params, args.max_new_tokens), jobs)
+ )
+ except requests.HTTPError as error: # the server refuses the setting: nothing to compare
+ result["settings"][name] = {"params": params, "refused": f"{error}: {error.response.text[:300]}"}
+ print(f"{name}: refused: {result['settings'][name]['refused']}", flush=True)
+ continue
+ seconds = time.time() - t0
+ tokens: List[List[List[int]]] = [[] for _ in prompts]
+ accept = []
+ for (i, _), (ids, meta) in zip(jobs, outs):
+ tokens[i].append(ids[: args.max_new_tokens])
+ if meta.get("spec_verify_ct"):
+ accept.append(len(ids) / meta["spec_verify_ct"])
+ entry = {"params": params, "tokens": tokens, "seconds": round(seconds, 2)}
+ if accept:
+ entry["mean_tokens_per_verify"] = round(sum(accept) / len(accept), 3)
+ if args.api == "vllm":
+ after = vllm_spec_counters(base)
+ entry["spec_counters"] = {k: after[k] - before.get(k, 0.0) for k in after}
+ result["settings"][name] = entry
+ save(args.out, result)
+ print(
+ f"{name}: {len(jobs)} requests in {seconds:.1f} s {entry.get('mean_tokens_per_verify', '')} "
+ f"{entry.get('spec_counters', '')}",
+ flush=True,
+ )
+ if args.speed_data:
+ chats = []
+ with open(args.speed_data, encoding="utf-8") as f:
+ for line in f:
+ turn = [{"role": "user", "content": json.loads(line)["turns"][0]}]
+ text = tokenizer.apply_chat_template(
+ turn, tokenize=False, add_generation_prompt=True, enable_thinking=False
+ )
+ chats.append(tokenizer.encode(text, add_special_tokens=False))
+ if len(chats) == args.speed_prompts:
+ break
+ result["speed"] = {}
+ for temperature in (0.0, 1.0):
+ t0, outs = time.time(), []
+ for chat in chats:
+ outs.append(generate(args.api, base, model, chat, {"temperature": temperature}, args.speed_tokens)[0])
+ seconds = time.time() - t0
+ rate = sum(map(len, outs)) / seconds
+ result["speed"][str(temperature)] = {"tokens": outs, "seconds": round(seconds, 2), "tok_s": round(rate, 1)}
+ save(args.out, result)
+ print(f"speed at temperature {temperature}: {rate:.1f} tok/s (batch size 1)", flush=True)
+ if args.seeds:
+ seeds = list(range(9000, 9000 + args.seeds))
+ prompt = prompts[1]
+ passes = []
+ for order in (seeds, seeds[::-1]): # the same seeds in batches of another composition
+ outs = pool.map(lambda s: generate(args.api, base, model, prompt, SEED_SETTING, args.seed_tokens, s), order)
+ passes.append({s: ids for s, (ids, _) in zip(order, outs)})
+ result["seeds"] = {str(s): passes[0][s] for s in seeds}
+ same = sum(passes[0][s] == passes[1][s] for s in seeds)
+ result["seeds_reproduced"] = same
+ print(f"seeds: {same}/{len(seeds)} reproduced their text", flush=True)
+ save(args.out, result)
+ return 0
+
+
+def save(path: str, result: dict) -> None:
+ """Write what ``run`` has so far, so a failure in a later section keeps the earlier ones."""
+ with open(path, "w", encoding="utf-8") as f:
+ json.dump(result, f)
+
+
+def chi2_sf(stat: float, dof: int) -> float:
+ """P(X >= stat) for X chi-square with ``dof`` degrees of freedom (regularized upper incomplete gamma)."""
+ a, x = dof / 2.0, stat / 2.0
+ if x <= 0:
+ return 1.0
+ if x < a + 1: # series for the lower function
+ term = total = 1.0 / a
+ for n in range(1, 1000):
+ term *= x / (a + n)
+ total += term
+ if term < total * 1e-15:
+ break
+ return max(0.0, 1.0 - total * math.exp(-x + a * math.log(x) - math.lgamma(a)))
+ b, c, d = x + 1 - a, 1e300, 1 / (x + 1 - a) # continued fraction for the upper function
+ h = d
+ for n in range(1, 1000):
+ an = -n * (n - a)
+ b += 2
+ d = an * d + b
+ d = 1 / (d if abs(d) > 1e-300 else 1e-300)
+ c = b + an / c
+ c = c if abs(c) > 1e-300 else 1e-300
+ h *= d * c
+ if abs(d * c - 1) < 1e-15:
+ break
+ return h * math.exp(-x + a * math.log(x) - math.lgamma(a))
+
+
+def homogeneity(ref: Sequence, test: Sequence) -> Tuple[float, float, int]:
+ """Two-sample chi-square test of homogeneity: (p value, total variation distance, cells after pooling)."""
+ a, b = collections.Counter(ref), collections.Counter(test)
+ na, nb = len(ref), len(test)
+ tv = 0.5 * sum(abs(a[c] / na - b[c] / nb) for c in set(a) | set(b))
+ cells: List[Tuple[int, int]] = []
+ rest = [0, 0]
+ for c in set(a) | set(b):
+ if a[c] + b[c] >= POOL:
+ cells.append((a[c], b[c]))
+ else:
+ rest[0] += a[c]
+ rest[1] += b[c]
+ if sum(rest) > 0:
+ cells.append((rest[0], rest[1]))
+ if len(cells) < 2:
+ return 1.0, tv, len(cells)
+ stat = 0.0
+ for x, y in cells:
+ total = x + y
+ for observed, n in ((x, na), (y, nb)):
+ expected = total * n / (na + nb)
+ stat += (observed - expected) ** 2 / expected
+ return chi2_sf(stat, len(cells) - 1), tv, len(cells)
+
+
+def compare(args) -> int:
+ with open(args.reference, encoding="utf-8") as f:
+ ref = json.load(f)
+ with open(args.candidate, encoding="utf-8") as f:
+ cand = json.load(f)
+ tests = [] # (setting, prompt, what, p, tv, cells)
+ for name, entry in cand["settings"].items():
+ if "refused" in entry:
+ print(f"{name:12s} REFUSED by the server: {entry['refused']}")
+ continue
+ if name not in ref["settings"]:
+ continue
+ for i, (r_tokens, c_tokens) in enumerate(zip(ref["settings"][name]["tokens"], entry["tokens"])):
+ k = min(len(r_tokens[0]), len(c_tokens[0]))
+ r_joint = [tuple(t[:JOINT]) for t in r_tokens]
+ c_joint = [tuple(t[:JOINT]) for t in c_tokens]
+ tests.append((name, i, f"joint 1-{JOINT}", *homogeneity(r_joint, c_joint)))
+ for pos in range(k):
+ tests.append(
+ (name, i, f"token {pos + 1}", *homogeneity([t[pos] for t in r_tokens], [t[pos] for t in c_tokens]))
+ )
+ # Tokens 2 and 3 given the reference's most common prefix: the verify round's own draws, free of any
+ # difference in the prefill's sampling (other attention kernels move near-tied top-k / top-p cuts).
+ for pos in (1, 2):
+ prefix = collections.Counter(tuple(t[:pos]) for t in r_tokens).most_common(1)[0][0]
+ r_next = [t[pos] for t in r_tokens if tuple(t[:pos]) == prefix]
+ c_next = [t[pos] for t in c_tokens if tuple(t[:pos]) == prefix]
+ if r_next and c_next:
+ tests.append((name, i, f"token {pos + 1} | modal prefix", *homogeneity(r_next, c_next)))
+ level = args.alpha / max(1, len(tests))
+ failed = False
+ for name in cand["settings"]:
+ rows = [t for t in tests if t[0] == name]
+ if not rows:
+ continue
+ worst = min(rows, key=lambda t: t[3])
+ joint_tv = max(t[4] for t in rows if t[2].startswith("joint"))
+ bad = [t for t in rows if t[3] < level]
+ conditional = [t for t in rows if "modal prefix" in t[2]]
+ cond_bad = [t for t in conditional if t[3] < level]
+ failed |= bool(bad)
+ extra = cand["settings"][name].get("mean_tokens_per_verify") or cand["settings"][name].get("spec_counters", "")
+ print(
+ f"{name:12s} {'FAIL' if bad else 'PASS'}: {len(rows)} tests, {len(bad)} below {level:.1e}; min p "
+ f"{worst[3]:.2e} ({worst[2]}, prompt {worst[1]}, TV {worst[4]:.3f}); max joint TV {joint_tv:.3f}; "
+ f"{cand['settings'][name]['seconds']} s (ref {ref['settings'][name]['seconds']} s) {extra}"
+ )
+ cond_worst = min(conditional, key=lambda t: t[3]) if conditional else None
+ if cond_worst:
+ print(
+ f" verify draws given the modal prefix: {'FAIL' if cond_bad else 'PASS'}, {len(cond_bad)} of "
+ f"{len(conditional)} below; min p {cond_worst[3]:.2e} ({cond_worst[2]}, prompt {cond_worst[1]})"
+ )
+ for t in sorted(bad, key=lambda t: t[3])[:5]:
+ print(f" {t[2]}, prompt {t[1]}: p {t[3]:.2e}, TV {t[4]:.3f}, {t[5]} cells")
+ for temperature, entry in cand.get("speed", {}).items():
+ ref_entry = ref.get("speed", {}).get(temperature, {})
+ line = f"speed at temperature {temperature}: {entry['tok_s']} tok/s (reference {ref_entry.get('tok_s')})"
+ if float(temperature) == 0.0 and ref_entry:
+ same = sum(a == b for a, b in zip(entry["tokens"], ref_entry["tokens"]))
+ line += f"; greedy outputs equal to the reference's: {same}/{len(entry['tokens'])}"
+ print(line)
+ if cand.get("seeds"):
+ seeds = cand["seeds"]
+ reproduced = cand.get("seeds_reproduced", 0)
+ same_as_ref = sum(ref.get("seeds", {}).get(s) == ids for s, ids in seeds.items())
+ prefix = [
+ next((j for j, (x, y) in enumerate(zip(ids, ref["seeds"][s])) if x != y), len(ids))
+ for s, ids in seeds.items()
+ if s in ref.get("seeds", {})
+ ]
+ print(
+ f"seeds: {reproduced}/{len(seeds)} reproduced their text; {same_as_ref}/{len(seeds)} equal the "
+ f"reference's text for the same seed (mean common prefix {sum(prefix) / max(1, len(prefix)):.1f} tokens)"
+ )
+ failed |= reproduced != len(seeds)
+ return 1 if failed else 0
+
+
+def main(argv: Optional[Sequence[str]] = None) -> int:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ sub = parser.add_subparsers(dest="cmd", required=True)
+ r = sub.add_parser("run")
+ r.add_argument("--api", choices=("sglang", "vllm"), required=True)
+ r.add_argument("--port", type=int, required=True)
+ r.add_argument("--tokenizer", required=True)
+ r.add_argument("--out", required=True)
+ r.add_argument("--settings", default=",".join(SETTINGS))
+ r.add_argument("--samples", type=int, default=2000, help="completions per prompt and setting")
+ r.add_argument("--max-new-tokens", type=int, default=6)
+ r.add_argument("--concurrency", type=int, default=32)
+ r.add_argument("--seeds", type=int, default=0)
+ r.add_argument("--seed-tokens", type=int, default=32)
+ r.add_argument("--speed-data", help="SPEED-Bench jsonl: also time batch-size-1 decoding")
+ r.add_argument("--speed-prompts", type=int, default=8)
+ r.add_argument("--speed-tokens", type=int, default=512)
+ c = sub.add_parser("compare")
+ c.add_argument("reference")
+ c.add_argument("candidate")
+ c.add_argument("--alpha", type=float, default=0.01, help="family-wise level, Bonferroni-corrected")
+ args = parser.parse_args(argv)
+ return run(args) if args.cmd == "run" else compare(args)
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/serving_choice.py b/tools/serving_choice.py
new file mode 100644
index 0000000..e89eb78
--- /dev/null
+++ b/tools/serving_choice.py
@@ -0,0 +1,33 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Choose an engine configuration before startup from measured served-round costs.
+
+A zero-draft speculative engine is a separate candidate from a true no-spec
+engine: it still owns draft KV and speculative recurrent state. This policy
+never translates a no-spec choice into an in-engine width-one schedule.
+"""
+
+from __future__ import annotations
+
+import math
+from collections.abc import Mapping
+
+
+def serving_choice(no_spec_us: float, candidates: Mapping[str, tuple[float, float]]) -> str | None:
+ """Return the fastest candidate, or None for the independently timed no-spec engine.
+
+ Each candidate is ``(expected tokens per request per round, round microseconds)``
+ at the same batch size and workload. Only measured candidates are considered;
+ a tie keeps no speculation. This is a startup choice, not live request migration.
+ """
+ if not math.isfinite(no_spec_us) or no_spec_us <= 0:
+ raise ValueError("no-spec round time must be positive and finite")
+ best, best_rate = None, 1.0 / no_spec_us
+ for name, (tokens, us) in sorted(candidates.items()):
+ if not math.isfinite(tokens) or tokens < 1 or not math.isfinite(us) or us <= 0:
+ raise ValueError(f"invalid served cost for {name}: tokens={tokens}, round_us={us}")
+ rate = tokens / us
+ if rate > best_rate:
+ best, best_rate = name, rate
+ return best
diff --git a/tools/stop_check.py b/tools/stop_check.py
new file mode 100644
index 0000000..bf269f1
--- /dev/null
+++ b/tools/stop_check.py
@@ -0,0 +1,240 @@
+#!/usr/bin/env python3
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Per-request stop conditions under batched speculation: one batch mixes every kind of stop.
+
+Sends ``--concurrency`` greedy requests at once to a running server, so they share decode rounds, cycling
+four kinds of request:
+
+- ``ignore_eos``: must run to ``--max-new-tokens`` (an EOS or another request's stop must not end it);
+- ``stop_token``: ``stop_token_ids=[<"\\n\\n">]``; the stop token may only be the last output token;
+- ``stop_string``: ``stop=[" and"]``; the text may not go on past the stop string (kept in the output);
+- ``eos``: neither; an EOS may only be the last output token.
+
+Every kind must also end for its own reason only: a stop-token finish must end on the request's own stop
+token or EOS, a request without stop tokens must not end on one. A speculative round accepts several
+tokens per request, so an engine that checked one request's stop set for the whole batch, or checked only
+the last accepted token, fails here. Greedy, thinking off, first user turns of ``--data``.
+
+The checker is checked by the engine's no-spec server (0 violations). With ``--reference`` (the no-spec
+server's output file) it also counts the rows whose tokens equal the reference's.
+
+ python tools/stop_check.py --api sglang --port P --data question_multiturn.jsonl \\
+ --tokenizer <model dir> --out stop_nospec.json
+ python tools/stop_check.py --api vllm --port P ... --reference stop_nospec.json --out stop_spec.json
+
+``--api tokenspeed`` is sglang's ``/generate`` with the model name TokenSpeed's gateway routes by.
+
+Exit code 1 when any request violates its stop condition or fails.
+"""
+
+from __future__ import annotations
+
+import argparse
+import concurrent.futures
+import json
+import sys
+import time
+from typing import Dict, List, Optional, Sequence, Set, Tuple
+
+import requests
+
+KINDS = ("ignore_eos", "stop_token", "stop_string", "eos")
+STOP_STRING = " and"
+STOP_TOKEN_TEXT = "\n\n"
+
+
+def first_turns(path: str, count: int) -> List[str]:
+ """The first user turn of the first ``count`` conversations."""
+ turns = []
+ with open(path, encoding="utf-8") as f:
+ for line in f:
+ turns.append(json.loads(line)["turns"][0])
+ if len(turns) == count:
+ break
+ return turns
+
+
+def eos_ids(tokenizer, model_dir: str) -> Set[int]:
+ """The tokenizer's EOS id and the generation config's EOS ids (what the engines stop on by default)."""
+ ids = {tokenizer.eos_token_id}
+ try:
+ with open(f"{model_dir}/generation_config.json", encoding="utf-8") as f:
+ configured = json.load(f).get("eos_token_id")
+ except FileNotFoundError:
+ configured = None
+ if configured is not None:
+ ids.update(configured if isinstance(configured, list) else [configured])
+ ids.discard(None)
+ return ids
+
+
+def violation(
+ kind: str, tokens: Sequence[int], text: str, max_new: int, stop_token: int, eos: Set[int], last_chars: int
+) -> Optional[str]:
+ """Why a finished request broke its stop condition, or None. ``last_chars``: the length of the last token's
+ text (a stop string can end inside it, and the engines keep the whole token)."""
+ if not tokens:
+ return "no tokens"
+ inner, last = tokens[:-1], tokens[-1]
+ if kind == "ignore_eos":
+ return None if len(tokens) == max_new else f"{len(tokens)} of {max_new} tokens"
+ ends_by_length = len(tokens) == max_new
+ allowed_last = set(eos) | ({stop_token} if kind == "stop_token" else set())
+ if kind == "stop_token" and stop_token in inner:
+ return f"stop token at {inner.index(stop_token)} of {len(tokens)}"
+ if kind == "stop_string":
+ at = text.find(STOP_STRING)
+ past = len(text) - at - len(STOP_STRING)
+ if at >= 0 and past >= last_chars:
+ return f"text goes on {past} chars past the stop string"
+ if at >= 0:
+ return None # ended on the stop string
+ hit = [i for i, t in enumerate(inner) if t in eos]
+ if hit:
+ return f"EOS at {hit[0]} of {len(tokens)}"
+ if not ends_by_length and last not in allowed_last:
+ return f"ended early on token {last}, not one of its stops"
+ return None
+
+
+def generate(api: str, base: str, model: Optional[str], prompt: List[int], kind: str, args, stop_token: int):
+ """One greedy request; returns (output token ids, text, finish reason)."""
+ stop_ids = [stop_token] if kind == "stop_token" else []
+ stop = [STOP_STRING] if kind == "stop_string" else []
+ if api in ("sglang", "tokenspeed"):
+ params = {
+ "temperature": 0,
+ "max_new_tokens": args.max_new_tokens,
+ "ignore_eos": kind == "ignore_eos",
+ "no_stop_trim": True,
+ "skip_special_tokens": False,
+ "stop_token_ids": stop_ids,
+ "stop": stop,
+ }
+ body = {"input_ids": prompt, "sampling_params": params}
+ if model is not None: # TokenSpeed's gateway routes /generate by model name
+ body["model"] = model
+ r = requests.post(f"{base}/generate", json=body, timeout=3600)
+ r.raise_for_status()
+ out = r.json()
+ if isinstance(out, list): # TokenSpeed's gateway wraps the one result in a list
+ (out,) = out
+ return out["output_ids"], out["text"], out["meta_info"].get("finish_reason")
+ body = {
+ "model": model,
+ "prompt": prompt,
+ "max_tokens": args.max_new_tokens,
+ "temperature": 0,
+ "ignore_eos": kind == "ignore_eos",
+ "include_stop_str_in_output": True,
+ "skip_special_tokens": False,
+ "return_token_ids": True,
+ "stop_token_ids": stop_ids,
+ "stop": stop,
+ }
+ r = requests.post(f"{base}/v1/completions", json=body, timeout=3600)
+ r.raise_for_status()
+ choice = r.json()["choices"][0]
+ return choice["token_ids"], choice["text"], {"type": choice["finish_reason"], "matched": choice.get("stop_reason")}
+
+
+def main(argv: Optional[Sequence[str]] = None) -> int:
+ parser = argparse.ArgumentParser(description="Per-request stop conditions under batched speculation.")
+ parser.add_argument("--api", choices=("sglang", "vllm", "tokenspeed"), required=True)
+ parser.add_argument("--port", type=int, required=True)
+ parser.add_argument("--data", required=True, help="SPEED-Bench question_multiturn.jsonl (first turns are used)")
+ parser.add_argument("--tokenizer", required=True, help="the target model directory")
+ parser.add_argument("--out", required=True)
+ parser.add_argument("--concurrency", type=int, default=16, help="requests in flight together (one batch)")
+ parser.add_argument("--waves", type=int, default=2, help="batches sent one after the other")
+ parser.add_argument("--max-new-tokens", type=int, default=256)
+ parser.add_argument("--reference", help="a no-spec run's --out: count rows with the same tokens")
+ args = parser.parse_args(argv)
+
+ from transformers import AutoTokenizer
+
+ tokenizer = AutoTokenizer.from_pretrained(args.tokenizer)
+ stop_token = tokenizer.encode(STOP_TOKEN_TEXT, add_special_tokens=False)
+ if len(stop_token) != 1:
+ raise SystemExit(f"{STOP_TOKEN_TEXT!r} is not one token in this tokenizer: {stop_token}")
+ stop_token = stop_token[0]
+ eos = eos_ids(tokenizer, args.tokenizer)
+ base = f"http://127.0.0.1:{args.port}"
+ model = requests.get(f"{base}/v1/models", timeout=60).json()["data"][0]["id"] if args.api != "sglang" else None
+ turns = first_turns(args.data, args.concurrency * args.waves)
+ prompts = [
+ tokenizer.encode(
+ tokenizer.apply_chat_template(
+ [{"role": "user", "content": turn}], add_generation_prompt=True, tokenize=False, enable_thinking=False
+ ),
+ add_special_tokens=False,
+ )
+ for turn in turns
+ ]
+
+ rows: List[dict] = []
+ t0 = time.time()
+ for wave in range(args.waves):
+ jobs: List[Tuple[int, str]] = [
+ (wave * args.concurrency + i, KINDS[(i + wave) % len(KINDS)]) for i in range(args.concurrency)
+ ]
+ with concurrent.futures.ThreadPoolExecutor(args.concurrency) as pool:
+ futures = {
+ pool.submit(generate, args.api, base, model, prompts[i], kind, args, stop_token): (i, kind)
+ for i, kind in jobs
+ }
+ for future in concurrent.futures.as_completed(futures):
+ i, kind = futures[future]
+ row: Dict = {"index": i, "wave": wave, "kind": kind}
+ try:
+ tokens, text, finish = future.result()
+ row.update(
+ tokens=tokens,
+ text=text,
+ finish=finish,
+ violation=violation(
+ kind,
+ tokens,
+ text,
+ args.max_new_tokens,
+ stop_token,
+ eos,
+ len(tokenizer.decode(tokens[-1:])),
+ ),
+ )
+ except Exception as e: # noqa: BLE001 -- a failed request is a result
+ row["error"] = f"{type(e).__name__}: {e}"
+ rows.append(row)
+ rows.sort(key=lambda r: r["index"])
+
+ bad = [r for r in rows if r.get("violation") or r.get("error")]
+ summary: Dict[str, object] = {
+ kind: {
+ "requests": sum(r["kind"] == kind for r in rows),
+ "violations": sum(r["kind"] == kind and bool(r.get("violation")) for r in rows),
+ "errors": sum(r["kind"] == kind and "error" in r for r in rows),
+ }
+ for kind in KINDS
+ }
+ if args.reference:
+ with open(args.reference, encoding="utf-8") as f:
+ reference = {r["index"]: r.get("tokens") for r in json.load(f)["rows"]}
+ summary["same_tokens_as_reference"] = sum(reference.get(r["index"]) == r.get("tokens") for r in rows)
+ with open(args.out, "w", encoding="utf-8") as f:
+ json.dump(
+ {"api": args.api, "args": vars(args), "wall_s": time.time() - t0, "summary": summary, "rows": rows}, f
+ )
+ for kind in KINDS:
+ print(f"{kind:<12} {summary[kind]}")
+ if args.reference:
+ print(f"same tokens as the reference: {summary['same_tokens_as_reference']} of {len(rows)}")
+ for r in bad:
+ print(f" BAD #{r['index']} {r['kind']}: {r.get('violation') or r.get('error')} finish={r.get('finish')}")
+ print(f"violations+errors {len(bad)} of {len(rows)}")
+ return 1 if bad else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/third_party_headers.json b/tools/third_party_headers.json
new file mode 100644
index 0000000..d70ecac
--- /dev/null
+++ b/tools/third_party_headers.json
@@ -0,0 +1,25 @@
+{
+ "files": [
+ {
+ "path": "eagle_harness/kernels/gdn_tree_chunk_flydsl.py",
+ "notice": "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n",
+ "modified": true,
+ "absent_in_baseline": true
+ },
+ {
+ "path": "eagle_harness/kernels/gdn_tree_records.py",
+ "notice": "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n",
+ "modified": true,
+ "absent_in_baseline": true
+ },
+ {
+ "path": "eagle_harness/sglang/gdn_tree_verify.py",
+ "notice": "# Copyright (c) 2026 Advanced Micro Devices, Inc.\n# SPDX-License-Identifier: Apache-2.0\n",
+ "modified": true,
+ "first_party_sha256": [
+ "7acb5a5a11dcd22eb67e295c0d1afd745c2f29a2be681ca691e48dd105f60406",
+ "7acb5a5a11dcd22eb67e295c0d1afd745c2f29a2be681ca691e48dd105f60406"
+ ]
+ }
+ ]
+}
diff --git a/tools/tune_gemm_solutions.py b/tools/tune_gemm_solutions.py
new file mode 100644
index 0000000..177b82d
--- /dev/null
+++ b/tools/tune_gemm_solutions.py
@@ -0,0 +1,142 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Tune the GEMM solutions a serving stack uses and save them with the GPU's calibration data.
+
+1. Record the GEMM shapes of the serving configuration (one short run, e.g. ``tools/greedy_parity.py run``
+ or a speed smoke against the server), with PyTorch's untuned-shape log enabled in the server process::
+
+ PYTORCH_TUNABLEOP_ENABLED=1 PYTORCH_TUNABLEOP_TUNING=0 PYTORCH_TUNABLEOP_RECORD_UNTUNED=1 \\
+ PYTORCH_TUNABLEOP_UNTUNED_FILENAME=/tmp/untuned.csv python -m sglang.launch_server ...
+
+ (TunableOp appends the device ordinal: the file is ``/tmp/untuned0.csv``; one file per rank at TP > 1).
+
+2. Tune every recorded shape offline and write ``<data_path>/gemm_solutions.csv``::
+
+ python tools/tune_gemm_solutions.py --data-path COST --untuned /tmp/untuned0.csv [/tmp/untuned1.csv ...]
+
+ Weights of a decode round stream from HBM, so each solution is timed over inputs rotated through a buffer
+ larger than the GPU's last-level cache (``--rotating-buffer-mb``, default 1024).
+
+The server loads the file through ``eagle_harness.core.gemm_solutions`` (tuning off); see that module.
+"""
+
+from __future__ import annotations
+
+import argparse
+import os
+import time
+from pathlib import Path
+
+import torch
+import torch.cuda.tunable as tunable
+
+from eagle_harness.core.gemm_solutions import GEMM_SOLUTIONS_FILE
+
+
+def untuned_lines(paths: list[Path], max_rows: int, rows: set[int] | None = None) -> list[str]:
+ """Select distinct GEMM lines in first-seen order, by exact row counts or the maximum row count."""
+ seen: dict[str, None] = {}
+ for path in paths:
+ for line in path.read_text().splitlines():
+ if not line.startswith(("Gemm", "ScaledGemm")):
+ continue
+ m = gemm_rows(line)
+ selected = m <= max_rows if rows is None else m in rows
+ if selected:
+ seen.setdefault(line.strip(), None)
+ return list(seen)
+
+
+def decode_rows(batch_sizes: list[int], top_k: int, widths: list[int]) -> set[int]:
+ """The row counts of a decode round at the served batch sizes: B (one token), B x top_k (a draft step) and
+ B x width (the verify and the draft extend)."""
+ return {b * m for b in batch_sizes for m in (1, top_k, *widths)}
+
+
+def gemm_rows(line: str) -> int:
+ """The row count (BLAS ``m``) of an untuned line's signature ``<layout>_<n>_<m>_<k>_...``."""
+ return int(line.split(",")[1].split("_")[2])
+
+
+def tune_line(line: str, device: torch.device) -> None:
+ """Run the GEMM of one untuned line once, which tunes it.
+
+ ``F.linear`` lines (``GemmTunableOp_<dtype>_TN``, plain leading dimensions) are replayed as the linear
+ they came from, which also covers the one-row GEMMs torch's offline helper skips; everything else goes
+ through that helper.
+ """
+ op, params = line.split(",")[:2]
+ fields = params.split("_")
+ if op.startswith("GemmTunableOp_") and op.endswith("_TN") and fields[4] == "ld":
+ n, m, k = (int(v) for v in fields[1:4])
+ ldb, lda, ldc = (int(v) for v in fields[5:8])
+ if (ldb, lda, ldc) == (k, k, n):
+ dtype = {"BFloat16": torch.bfloat16, "Half": torch.half, "float": torch.float32}[op.split("_")[1]]
+ x = torch.randn(m, k, dtype=dtype, device=device)
+ w = torch.randn(n, k, dtype=dtype, device=device)
+ torch.nn.functional.linear(x, w)
+ return
+ tunable._process_single_offline_gemm(line, device.index or 0)
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument("--data-path", type=Path, required=True, help="calibration directory of the GPU")
+ parser.add_argument("--untuned", type=Path, nargs="+", required=True, help="TunableOp untuned-shape files")
+ parser.add_argument(
+ "--max-rows",
+ type=int,
+ default=64,
+ help="tune GEMMs of at most this many rows: the decode round's (draft, verify, no-spec); "
+ "prefill GEMMs take a row count per prompt length and keep the default solution",
+ )
+ parser.add_argument(
+ "--decode-rows",
+ nargs=3,
+ metavar=("BATCH_SIZES", "TOP_K", "WIDTHS"),
+ help="instead of --max-rows: only the row counts of the decode rounds, e.g. 1-8 4 8,16,32 for batch "
+ "sizes 1..8, draft top-k 4 and verify widths 8/16/32 (prefill lengths are left out)",
+ )
+ parser.add_argument("--rotating-buffer-mb", type=int, default=1024)
+ parser.add_argument("--max-tuning-ms", type=int, default=20, help="time budget per candidate solution")
+ parser.add_argument("--max-tuning-iterations", type=int, default=30)
+ args = parser.parse_args()
+ rows = None
+ if args.decode_rows:
+ batches, top_k, widths = args.decode_rows
+ try:
+ first, last = (int(v) for v in batches.split("-")) if "-" in batches else (int(batches), int(batches))
+ top_k = int(top_k)
+ widths = [int(width) for width in widths.split(",")]
+ if not 1 <= first <= last or top_k < 1 or any(width < 1 for width in widths):
+ raise ValueError
+ except ValueError:
+ parser.error(
+ "--decode-rows requires a positive batch or ascending range, positive top-k, and positive widths"
+ )
+ rows = decode_rows(list(range(first, last + 1)), top_k, widths)
+ lines = untuned_lines(args.untuned, args.max_rows, rows)
+ if not lines:
+ raise SystemExit(f"no GEMM lines in {[str(p) for p in args.untuned]}")
+ out = args.data_path / GEMM_SOLUTIONS_FILE
+ tunable.enable(True)
+ tunable.tuning_enable(True)
+ tunable.set_rotating_buffer_size(args.rotating_buffer_mb)
+ tunable.set_max_tuning_duration(args.max_tuning_ms)
+ tunable.set_max_tuning_iterations(args.max_tuning_iterations)
+ device = torch.device("cuda", torch.cuda.current_device())
+ for i, line in enumerate(lines, 1):
+ start = time.perf_counter()
+ tune_line(line, device)
+ torch.cuda.synchronize()
+ print(f"[{i}/{len(lines)}] {line.split(',')[1]} {time.perf_counter() - start:.1f}s", flush=True)
+ tunable.tuning_enable(False)
+ os.makedirs(args.data_path, exist_ok=True)
+ if not tunable.write_file(str(out)):
+ raise SystemExit(f"could not write {out}")
+ print(f"{len(tunable.get_results())} GEMM solutions -> {out}")
+
+
+if __name__ == "__main__":
+ main()