Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
feat(examples): refresh typed-decisions evidence on a faster server and add GLiNER2.5-Decide (#376)
svonava8b4dc459dea7
diff --git a/examples/README.md b/examples/README.mdindex 1f15a070d..e8a8544cd 100644--- a/examples/README.md+++ b/examples/README.md@@ -24,7 +24,7 @@ service keys.| [Pick the passage that meets every condition](./multi-vector) | Separating same-page near-duplicates with ColBERT late interaction, scored token by token | `encode` | SIE Cloud with GTE-ModernColBERT-v1; `fetch.py` pulls the recorded token vectors, `score.py` scores them with no key | Runnable recorded example || [Fill a JSON Schema from a messy document](./structured-output) | Reading NHTSA complaints, SEC officer filings and GSA listings into schema-valid JSON, with the two wrong fields left visible | `chat/completions` | SIE Cloud with Qwen3.8 27B; `fetch.py` pulls the recorded run, `score.py` reproduces the number with no key | Runnable recorded example || [Route a request to the action it asks for](./classify) | Scoring held-out SNIPS requests against seven action labels, and showing what happens when the labels overlap | `extract` | SIE Cloud with GLiClass; `fetch.py` pulls the recorded run, `score.py` reproduces the number with no key | Runnable recorded example |-| [Answer several triage questions about one record, each with a probability](./typed-decisions) | Asking CVE descriptions typed pick-one and yes-or-no questions against NVD analyst gold, with a fast, a smart and an LLM lane, and the questions no model passed reported rather than shown | `extract`, `chat/completions` | Self-hosted SIE with GLiFormer, GLiClass, Laya, GLiNER2 and Qwen3 4B; `fetch.py` pulls the recorded run, `score.py` reproduces the figures with no key | Runnable recorded example |+| [Answer several triage questions about one record, each with a probability](./typed-decisions) | Asking CVE descriptions typed pick-one and yes-or-no questions against NVD analyst gold, with a fast, a smart and an LLM lane, and the questions no model passed reported rather than shown | `extract`, `chat/completions` | Self-hosted SIE with GLiFormer, GLiClass, Laya, GLiNER2, GLiNER2.5-Decide and Qwen3 4B; `fetch.py` pulls the recorded run, `score.py` reproduces the figures with no key | Runnable recorded example || [Check text for a planted instruction](./guardrails) | Gating an agent on one label over twelve inputs from BIPIA, InjecAgent, LLMail-Inject, AgentDojo and XSTest, misses included | `extract`, `chat_completions` | SIE Cloud with GLiGuard and Granite Guardian; `fetch.py` pulls the recorded run, `score.py` reproduces both models' numbers with no key | Runnable recorded example || [Expand a query into matchable terms](./sparse) | Comparing SPLADE, which adds terms the text never used, with bge-m3 sparse, which does not | `encode` | SIE Cloud with SPLADE++ and bge-m3; `fetch.py` pulls the recorded vectors, `score.py` reproduces the figures with no key | Runnable recorded example || [Get the exact character offsets to mask](./redact) | Naming your own ID types, measuring against published gold PII spans, and showing what a 384-word window costs | `extract` | SIE Cloud with GLiNER multi PII; `fetch.py` pulls the recorded run, `score.py` reproduces the figures with no key | Runnable recorded example |diff --git a/examples/typed-decisions/PREREGISTRATION.md b/examples/typed-decisions/PREREGISTRATION.mdindex 420651852..43fdf37b3 100644--- a/examples/typed-decisions/PREREGISTRATION.md+++ b/examples/typed-decisions/PREREGISTRATION.md@@ -313,3 +313,130 @@ record:- **LLM row.** `Qwen/Qwen3.5-4B` was checked on dev and kept out, because itfails the remote-without-login question that `Qwen/Qwen3-4B-Instruct-2507`passes.++## Amendment 1, 2026-09-25: a faster server, one-call Smart, GLiNER2.5-Decide++This amendment was written and committed before any test record was sent to the+new server. Everything above still applies unless this section says otherwise.++**Server.**+- SIE `d41ba7f`. Its GLiClass changes mean the Smart model can answer all three+ questions in one call, and it runs with CUDA graphs by default.+- Bundles: the default bundle for the encoders, the transformers5 bundle for+ GLiNER2.5-Decide, and the SGLang bundle for the LLM.+- Each session reserves one NVIDIA L4, 10 CPU cores and 40 GiB of memory.+- Each recording names the server commit it ran against, and the manifest lists+ every commit.++**Smart, one call per record.**+- `gliclass-large-v1-one-call` sends `knowledgator/gliclass-large-v1.0` all three+ questions in one call, each question a label group encoded as its own row, on+ the model's default profile.+- Its phrasing, cut-off and prior correction are `gliclass-large-v1`'s from+ `tuning.json`, unchanged (`tune.INHERITS`). It is not tuned itself.+- Before the test slice it is recorded on dev in that tuned mix and judged by the+ page rule with those settings. As for every lane, a question it fails is left+ out.+- The per-question backend `gliclass-large-v1` stays in the plan and is recorded+ on test too, for comparison.++**Fast and the LLM.**+- Fast is `gliformer-large`, as tuned.+- The LLM row is `Qwen/Qwen3-4B-Instruct-2507` with the same call. Neither is+ re-tuned. Both are recorded again on the new server.++**Grouped instruct GLiClass.** The server now encodes label groups separately+unless told otherwise. So `gliclass-instruct-large-grouped` asks for joint+encoding explicitly, as it was recorded before, and is recorded again on dev+(`short`, `concrete`, then the tuned mix). Its settings are refitted by the+same procedure.++**The test slice.**+- Every backend in the plan is recorded once on the 160 test records at the new+ commit. So are the workflow set and the GLiFormer multi-task run.+- Accuracy is reported as it comes out, and the withdrawal rule applies to the+ point figures as before.+- The previous run's figures stay in the README, and its evidence stays at+ dataset revision `30b05245e375f15cc87aa37a1705c4aad0d26f45`.++**Time.**+- Same protocol: one record at a time, the client beside the server, the median+ per record, and "a round trip, not a service level".+- A speed claim still needs 1.5 times.+- Smart now makes one call, so the first comparison becomes Fast's one call+ against Smart's one call, on the attack-vector answer both show.+- The second is Smart's one call against the LLM's one call, on the same three+ answers.++**The cascade.** The cascade now makes one Smart call per record, whenever any+question escalates. Its control is unchanged.++**The cards.** Same rule. The records it picks can change, because the answers+can.++**GLiNER2.5-Decide.** Fastino's three typed decision models are new backends:++| Backend | Model |+|---|---|+| `gliner2.5-decide` | `fastino/GLiNER2.5-Decide` |+| `gliner2.5-multi-decide` | `fastino/GLiNER2.5-multi-Decide` |+| `gliner2.5-decide-1b` | `fastino/GLiNER2.5-Decide-1B` |++- They are asked Laya's typed questions as `output_schema`, one call per record,+ and return every option's probability.+- They are tuned on dev only, by the same procedure as every other backend:+ phrasing, then decision rules, then the page rule.+- Their settings and dev verdicts are added below, in amendment 2, and committed+ before any of them sees a test record.+- Each joins the catalog with the questions it passes on dev (`page.CATALOG`).+ This amendment reassigns no lane. Where Decide stands against Fast and Smart+ is reported, not decided here.++## Amendment 2, 2026-09-25: the dev results, before the test slice++These are the dev recordings on the new server. This section was committed+before any test record was sent to it.++**Earlier settings.** Every earlier backend's phrasing and rules came out+unchanged. That includes grouped instruct GLiClass, whose joint-encoded+recordings reproduce its earlier dev figures exactly.++**Smart, one call.**+- It matches the per-question calls on all 672 dev answers, with no change of+ top option and at most 0.0038 difference in probability.+- Its dev verdicts are the per-question ones. All three questions pass:+ - weakness 0.879, 5th percentile 0.845;+ - attack vector 0.924 accuracy, 0.774 balanced, 5th percentile 0.706;+ - remote without a login 0.821, 5th percentile 0.774.+- Its median on dev is 28 ms per record for one call. The per-question backend+ on the earlier server took 139 ms for its three calls.++**The cascade.** On dev it again matches Smart with zero regressions. It+escalates 73.7% of weakness answers and every attack-vector answer, and makes+2.00 calls per record against Smart's 1.00. It fails its control and stays off+the page.++**GLiNER2.5-Decide.**+- `gliner2.5-decide` is recorded on dev in `short` and `concrete` only. Its+ prompt budget is 256 of its 512 tokens, and the described questions take+ 369.+- For the same reason it cannot take any workflow's questions as the source+ writes them (305 to 425 tokens). A placeholder document was used to check+ this, and no benchmark record was sent. It is left out of the workflow set+ (`run.WORKFLOWS_UNFIT`).++The settings chosen by the procedure:++| Backend | Phrasing (weakness, attack vector, remote) | Rules | `weakness` | `attack_vector` | `remote_unauthenticated` | Median per record |+|---|---|---|---|---|---|---|+| `gliner2.5-decide` | concrete, short, short | prior, argmax, cut-off 0.81 | **passes**: 0.920, 5th pct 0.887 | fails: 0.799, under the majority's 0.844 | fails: 0.593 balanced; "exploitable remotely" right 27 of 120 | 61 ms |+| `gliner2.5-multi-decide` | concrete, concrete, short | prior, argmax, cut-off 0.88 | **passes**: 0.866, 5th pct 0.826 | fails: 0.705, under the majority's | fails: 0.574 balanced; "exploitable remotely" right 19 of 120 | 37 ms |+| `gliner2.5-decide-1b` | described, short, described | prior, argmax, cut-off 0.46 | **passes**: 0.902, 5th pct 0.867 | **passes**: 0.933, 0.804 balanced, 5th pct 0.737 | fails: 0.543 balanced; "needs local access or a login" right 15 of 104 | 42 ms |++- In the catalog, each Decide backend shows the questions it passes above:+ - `gliner2.5-decide`: weakness.+ - `gliner2.5-multi-decide`: weakness.+ - `gliner2.5-decide-1b`: weakness and attack vector.+- No lane changes. None of the three passes the yes-or-no question, so none can+ answer everything Smart answers. The README reports how they compare with+ Fast and Smart on test.diff --git a/examples/typed-decisions/README.md b/examples/typed-decisions/README.mdindex a72b1d05d..60977e28f 100644--- a/examples/typed-decisions/README.md+++ b/examples/typed-decisions/README.md@@ -8,8 +8,14 @@ It covers zero-shot label classifiers, typed decision models and a small LLM.Everything that decides what is reported was fixed on 224 earlier records andcommitted before the 160 test records were sent, in-[PREREGISTRATION.md](PREREGISTRATION.md). The test slice was then recorded-once, against SIE server commit `28a07f5`.+[PREREGISTRATION.md](PREREGISTRATION.md). The test slice was first recorded+against SIE server commit `28a07f5`.++On 2026-09-25 it was recorded again against `d41ba7f`, under the+pre-registration's two amendments. That server runs the Smart model's three+questions in one call, with CUDA graphs, and serves Fastino's GLiNER2.5-Decide+models. The figures below are that run. The first run is under+[The first run](#the-first-run-server-28a07f5).## What this shows@@ -30,22 +36,24 @@ brackets.| Lane | Model | Vendor | `weakness` | `attack_vector` | `remote_unauthenticated` | Median per record ||---|---|---|---|---|---|---|-| Fast | `knowledgator/gliformer-large-v1` | Knowledgator | not shown (failed on dev) | 144 (0.873) | not asked | 69 ms, 1 call |-| Smart | `knowledgator/gliclass-large-v1.0` | Knowledgator | 142 (0.887) | 147 (0.796) | 115 (0.725) | 205 ms, 3 calls |-| LLM | `Qwen/Qwen3-4B-Instruct-2507` | Qwen | not shown (failed on dev) | 150 (0.867) | 129 (0.815) | 2,671 ms, 1 call |+| Fast | `knowledgator/gliformer-large-v1` | Knowledgator | not shown (failed on dev) | 144 (0.873) | not asked | 65 ms, 1 call |+| Smart | `knowledgator/gliclass-large-v1.0`, the three questions as separate label groups in one call | Knowledgator | 142 (0.887) | 147 (0.796) | 115 (0.725) | 28 ms, 1 call |+| LLM | `Qwen/Qwen3-4B-Instruct-2507` | Qwen | not shown (failed on dev) | 150 (0.867) | 129 (0.815) | 2,676 ms, 1 call |- **By question type:** Smart answered 289 of 320 pick-one questions and 115of 160 yes-or-no questions.- **Medians are round trips, not a service level.** Each server ran on one- NVIDIA L4 GPU, with the client on the same machine, one record at a time.-- **One speed claim clears its pre-registered 1.5x margin.** Smart answers the- same three questions 13.0 times faster than the LLM. Fast's one call and- Smart's attack-vector request take about the same time (1.02x), so no speed- claim is made between them.+ NVIDIA L4 GPU with 10 CPU cores and 40 GiB of memory reserved, with the+ client on the same machine, one record at a time.+- **Two speed claims clear the pre-registered 1.5x margin.**+ - Smart's one call is 2.35 times faster than Fast's, on the attack-vector+ answer both show; Smart's call carries two more questions.+ - Smart answers the same three questions 96 times faster than the LLM.+ - On this server, Smart is the faster lane.- **The LLM gives no probabilities.** It returns values, so its answers carrynone.- **No credit figures.** `page.py --prices` prices only models the published- SIE Cloud price list names. On 2026-09-24 it named none of these three.+ SIE Cloud price list names. On 2026-09-25 it named none of these three.GLiFormer is not asked the yes-or-no question. Asked all three in one call, itconfused "exploitable remotely without a login" with "remotely over the@@ -58,10 +66,29 @@ network".| `gliclass-instruct-large` | `knowledgator/gliclass-instruct-large-v1.0` | Knowledgator | weakness 142; attack vector 149 || `laya` | `convaiinnovations/laya` | Convai Innovations | weakness 134 || `laya-typed-decisions` | `convaiinnovations/laya-typed-decisions` | Convai Innovations | weakness 145 |+| `gliner2.5-decide` | `fastino/GLiNER2.5-Decide` | Fastino | weakness 146 |+| `gliner2.5-multi-decide` | `fastino/GLiNER2.5-multi-Decide` | Fastino | weakness 137 |+| `gliner2.5-decide-1b` | `fastino/GLiNER2.5-Decide-1B` | Fastino | weakness 139; attack vector 150 (0.852 balanced) |`laya-typed-decisions` also passed the yes-or-no question on dev. On test itsbalanced accuracy there fell to 0.673, below 0.70, so the pre-registered-withdrawal rule took it off every surface.+withdrawal rule took it off every surface, in both runs.++**Where GLiNER2.5-Decide stands.** The three Decide models were tuned on dev+only, like every other backend, and each answers all three questions in one+call.+- **Weakness.** `fastino/GLiNER2.5-Decide` is right on 146 of 160, the most of+ any backend, against Smart's 142.+- **Weakness and attack vector.** `fastino/GLiNER2.5-Decide-1B` passes both.+ Its attack-vector answer matches the LLM's 150 of 160 and beats Smart's 147.+- **The yes-or-no question.** None of the three passes it on dev. Their+ balanced accuracy was 0.54 to 0.59, and on test 0.51 to 0.54, so none can+ stand in for Smart. None takes a lane; each shows in the catalog.+- **Time.** Their medians on test are 39 ms (Decide), 30 ms (multi) and 34 ms+ (1B) per record.+- **Window.** `fastino/GLiNER2.5-Decide` reads questions in at most 256 of its+ 512 tokens. So it was not given the described phrasing, nor the workflow+ set's questions, which need 305 to 425.**Three records illustrate the answers.** They were chosen by the stated rulein `page.py`, which picks one record for each argument:@@ -93,8 +120,9 @@ On test:| remote without a login | 100% (Fast is not asked) | 0.719, 0.725 balanced | 0.719, 0.725 |It matches Smart with zero regressions and beats it on weakness. But it makes-3.68 calls per record against Smart's 3.00, so it fails its control, as it did-on dev.+2.00 calls per record against Smart's one, so it fails its control, as it did+on dev. Fast is not asked the yes-or-no question, so Smart is called for every+record anyway.**Severity, computed and never asked.** `cvss.compose_severity` scores everycombination of a backend's three answers with the CVSS v3.1 base-score formula,@@ -105,7 +133,7 @@ reproduces NVD's base score for all 384 records. Scored on the exact level:| Severity from | Accuracy | Balanced accuracy ||---|---|---|| the NVD analyst's own three answers (the ceiling) | 0.719 | 0.743 |-| Smart | 0.600 | 0.601 |+| Smart | 0.606 | 0.612 || the LLM, from its whole CVSS vector | 0.675 | 0.613 || always the most common level | 0.463 | |@@ -134,8 +162,37 @@ own distribution. Every other backend is zero-shot.| `laya-typed-decisions` (fine-tuned on the benchmark's training split) | 0.769 | 0.663 || always the most common answer | 0.522 | 0.230 || `gliner2-large` (Fastino), the best zero-shot backend | 0.516 | 0.345 |+| `gliner2.5-multi-decide` (Fastino) | 0.456 | 0.301 |+| `gliner2.5-decide-1b` (Fastino) | 0.442 | 0.297 || `laya` (Convai Innovations), the base checkpoint | 0.360 | 0.239 |+`fastino/GLiNER2.5-Decide` is not scored here: its 256-token question budget+holds none of the four workflows' question sets.++### The first run (server `28a07f5`)++The first test run, on 2026-09-24, is kept at dataset revision+[`30b05245`](https://huggingface.co/datasets/superlinked/sie-task-evidence/tree/30b05245e375f15cc87aa37a1705c4aad0d26f45/typed-decisions).+Across all 160 test records, no decided answer of any backend changed between+the two runs:+- Smart's one call moved probabilities by at most 0.0058 against its three+ per-question calls.+- GLiFormer, the LLM, GLiClass instruct and Laya returned the same+ probabilities.+- Smart's computed severity moved from 96 to 97 of 160 right: it is composed+ from whole distributions.++Only time changed:++| Lane | Median per record, first run | Median per record, this run |+|---|---|---|+| Fast | 69 ms, 1 call | 65 ms, 1 call |+| Smart | 205 ms, 3 calls (one per question) | 28 ms, 1 call |+| LLM | 2,671 ms | 2,676 ms |++In the first run Smart was 13.0 times faster than the LLM, and Fast and Smart+were within 1.02 times of each other on the attack-vector answer.+### Every backend recorded| Backend | Model | Vendor | How the questions are sent | Calls per record |@@ -143,10 +200,12 @@ own distribution. Every other backend is zero-shot.| `laya` | `convaiinnovations/laya` | Convai Innovations | the question dict as `output_schema` | 1 || `laya-typed-decisions` | `convaiinnovations/laya-typed-decisions`, fine-tuned on the workflow benchmark's training split | Convai Innovations | the question dict as `output_schema` | 1 || `gliformer-large` | `knowledgator/gliformer-large-v1` | Knowledgator | every question a label group, named by the question; on vulnerability triage it is asked `weakness` and `attack_vector` only | 1 |-| `gliclass-instruct-large-grouped` | `knowledgator/gliclass-instruct-large-v1.0` | Knowledgator | every question a label group, the questions in the instruction | 1 |+| `gliclass-instruct-large-grouped` | `knowledgator/gliclass-instruct-large-v1.0` | Knowledgator | every question a label group, encoded jointly, the questions in the instruction | 1 || `gliclass-instruct-large` | `knowledgator/gliclass-instruct-large-v1.0` | Knowledgator | one question per call, the question as the instruction | one per question || `gliclass` | `knowledgator/gliclass-large-v3.0` | Knowledgator | one question per call, labels only | one per question || `gliclass-large-v1`, `gliclass-base-v1`, `gliclass-small-v1` | `knowledgator/gliclass-{large,base,small}-v1.0` | Knowledgator | one question per call, labels only | one per question |+| `gliclass-large-v1-one-call` | `knowledgator/gliclass-large-v1.0` | Knowledgator | every question a label group, each group encoded as its own row; the per-question backend's tuned settings | 1 |+| `gliner2.5-decide`, `gliner2.5-multi-decide`, `gliner2.5-decide-1b` | `fastino/GLiNER2.5-Decide`, `-multi-Decide`, `-Decide-1B` | Fastino | the question dict as `output_schema`, as for Laya | 1 || `gliner2-base`, `gliner2-large` | `fastino/gliner2-{base,large}-v1` | Fastino | one question per call, the question id as the task name | one per question || `nli-modernbert-base` | `MoritzLaurer/ModernBERT-base-zeroshot-v2.0` | MoritzLaurer | one question per call, each label as an NLI hypothesis | one per question || `qwen3-4b-instruct` | `Qwen/Qwen3-4B-Instruct-2507` | Qwen | one chat completion with a JSON schema, returning the CVSS v3.1 base metrics and the weakness class (vulnerability triage only) | 1 |@@ -179,7 +238,7 @@ score:```shpython3 fetch.py # downloads the pinned revision into data/-python3 run.py --check # rebuilds all 17,856 recorded requests from the inputs+python3 run.py --check # rebuilds all 22,384 recorded requests from the inputspython3 score.py # every backend and question on the test slice; asserts the published figurespython3 page.py # the page's lanes, cards, catalog and cascade; asserts what the page showspython3 multitask.py --score --calls data/multitask/test.json@@ -200,22 +259,36 @@ without sending them.### Record it yourself-This needs an SIE server that serves these models. The LLMs need a server-built with SGLang (the `sie-server:latest-cuda12-sglang` image). The steps are-the ones PREREGISTRATION.md fixes: every phrasing on dev, then the tuned-configuration on dev, then the test slice once.+This needs an SIE server that serves these models. The server image depends on+the backend:+- The encoders run in the default image.+- GLiNER2.5-Decide needs the transformers5 bundle.+- The LLMs need a server built with SGLang (the+ `sie-server:latest-cuda12-sglang` image).++The steps are the ones PREREGISTRATION.md fixes: every phrasing on dev, then+the tuned configuration on dev, then the test slice once.+`gliclass-large-v1-one-call` takes `gliclass-large-v1`'s settings and is+recorded on dev only in its tuned mix. `gliner2.5-decide` is recorded on dev in+`short` and `concrete` only.```shuv sync --group builduv run python build_inputs.py # rebuilds data/inputs/<set>/cases.json from the NVD and Hugging FaceBACKENDS="laya laya-typed-decisions gliformer-large gliclass-instruct-large-grouped gliclass-instruct-large- gliclass gliclass-large-v1 gliclass-base-v1 gliclass-small-v1 gliner2-base gliner2-large nli-modernbert-base"+ gliclass gliclass-large-v1 gliclass-base-v1 gliclass-small-v1 gliner2-base gliner2-large nli-modernbert-base+ gliner2.5-decide gliner2.5-multi-decide gliner2.5-decide-1b"URL=http://localhost:8080+SIE_COMMIT=d41ba7fb828cedb6a08f4c4028c6ce621385168f # the SIE commit your server runs-# 1. Dev, every phrasing, then choose the phrasing per question+# 1. Dev, every phrasing the plan gives each backend, then choose the phrasing per questionfor b in $BACKENDS; do- uv run python run.py --record --set vulnerability-triage --split dev --variant short described concrete \+ case $b in+ gliclass-instruct-large-grouped|gliner2.5-decide) PHRASINGS="short concrete" ;; # described does not fit+ *) PHRASINGS="short described concrete" ;;+ esac+ uv run python run.py --record --set vulnerability-triage --split dev --variant $PHRASINGS \--backend $b --url $URL --out run-output/dev--$b.jsondonefor b in qwen3-4b-instruct qwen3.5-4b; do@@ -225,23 +298,24 @@ donepython3 tune.py phrasing --calls run-output/dev--*.json# 2. Dev in the chosen phrasing, then fit the decision rules, the lanes and the cascade-for b in $BACKENDS; do+for b in $BACKENDS gliclass-large-v1-one-call; douv run python run.py --record --set vulnerability-triage --split dev --variant tuned \--backend $b --url $URL --out run-output/dev-tuned--$b.jsondonepython3 tune.py rules --calls run-output/dev-tuned--*.jsonpython3 tune.py lanes --calls run-output/dev-tuned--*.json run-output/dev--qwen3-4b-instruct.json-# 3. Test, once, in the tuned configuration; and the workflow set-for b in $BACKENDS qwen3-4b-instruct; do- uv run python run.py --record --set vulnerability-triage --split test --backend $b --url $URL+# 3. Test, once, in the tuned configuration; and the workflow set (the plan leaves out gliner2.5-decide)+for b in $BACKENDS gliclass-large-v1-one-call qwen3-4b-instruct; do+ uv run python run.py --record --set vulnerability-triage --split test --backend $b --url $URL --server-commit "$SIE_COMMIT"done-for b in $BACKENDS; do- uv run python run.py --record --set workflows --backend $b --url $URL+for b in $BACKENDS gliclass-large-v1-one-call; do+ [ "$b" = gliner2.5-decide ] && continue # not in the workflow plan+ uv run python run.py --record --set workflows --backend $b --url $URL --server-commit "$SIE_COMMIT"doneuv run python multitask.py --record --split test --url $URL --out run-output/multitask/test.json-python3 run.py --merge run-output/*--*.json --server-commit <sie commit> # calls.json and manifest.json+python3 run.py --merge run-output/*--*.json --server-commit "$SIE_COMMIT" # calls.json and manifest.json```Rebuilt inputs can differ from the published ones, because NVD records keep@@ -258,7 +332,7 @@ than on every one, and their probabilities differ in the third decimal place.## What to expect-`run.py --check` prints `17856 of 17856 recorded calls rebuilt from the inputs+`run.py --check` prints `22384 of 22384 recorded calls rebuilt from the inputsand matched`. It fails if a call is missing, recorded twice, implied by nocase, or sent something other than what the inputs and `tuning.json` produce.@@ -269,7 +343,7 @@ per backend and question type:- latency per record;- a per-question table.-It ends with `All 24 published figures reproduced.` and exits nonzero if any+It ends with `All 29 published figures reproduced.` and exits nonzero if anyfigure in `PUBLISHED` stops reproducing.`page.py` prints the lanes, the figures row, the cards, the catalog, the speed@@ -286,6 +360,9 @@ claims and the cascade:card network-needs-login: CVE-2023-6826 (file_upload)card local-access: CVE-2023-44278 (path_traversal)...+ speed attack vector: Fast's one call against Smart's one call: 65 vs 28 ms, smart 2.35x faster, claimed+ speed a record's three answers: Smart's one call against the LLM's one: 28 vs 2676 ms, smart 96.29x faster, claimed+ ...WITHDRAWN {'catalog': 'laya-typed-decisions', 'question': 'remote_unauthenticated', 'reasons': ['balanced accuracy 0.673']}The page's cards, time medians, speed claims and withdrawals reproduced.@@ -297,7 +374,7 @@ The page's cards, time medians, speed claims and withdrawals reproduced.typed-decisions/inputs/vulnerability-triage/cases.json 384 NVD records: description, gold, CVSS vector, CPE, source digestinputs/workflows/cases.json 400 typed-decisions benchmark cases with their questions and gold- calls.json 17,856 calls: request digest, response, status, timing+ calls.json 22,384 calls: request digest, response, status, timing, server commit per recordingsummary.json score.py's figures for every backend, set and splitpage.json page.py's surfaces on the test slicemultitask/test.json the GLiFormer multi-task run and its 160 embeddings@@ -308,7 +385,12 @@ typed-decisions/stored as its SHA-256 (`body_sha256`), because the body is fully determined bythe inputs and `tuning.json`. `run.py --check` rebuilds every body and comparesdigests, and `run.py --show` prints any of them. Dev calls are included, in-every phrasing, so the tuning can be re-derived.+every phrasing, so the tuning can be re-derived. Each recording names the+server commit it ran against:+- dev recordings on `28a07f5` for the backends tuned in the first run;+- dev recordings for the one-call Smart, the re-encoded grouped instruct+ GLiClass and GLiNER2.5-Decide on `d41ba7f`;+- the whole test slice, the workflow set and the multi-task run on `d41ba7f`.## The two setsdiff --git a/examples/typed-decisions/fetch.py b/examples/typed-decisions/fetch.pyindex 879a997e8..e8ae5aa0f 100755--- a/examples/typed-decisions/fetch.py+++ b/examples/typed-decisions/fetch.py@@ -41,8 +41,8 @@ from pathlib import PathDATASET = "superlinked/sie-task-evidence"TASK = "typed-decisions"-REVISION = "30b05245e375f15cc87aa37a1705c4aad0d26f45"-MANIFEST_SHA256 = "24131629767bfb1d3db5c2596f153d994fb56c781c322c80dba93f18c338acfc"+REVISION = "bcf30acf1f1b18ae550715c42eefcb0c50783578"+MANIFEST_SHA256 = "b06b4b65afaf6dc281ffee18e147db75f36775cf66a136d3b18b575ace51cde5"BASE = f"https://huggingface.co/datasets/{DATASET}/resolve/{REVISION}/{TASK}"HTTP_OK = 200diff --git a/examples/typed-decisions/page.py b/examples/typed-decisions/page.pyindex c61d801ef..ff78a716d 100644--- a/examples/typed-decisions/page.py+++ b/examples/typed-decisions/page.py@@ -81,15 +81,22 @@ CARDS = (lambda gold: gold["attack_vector"] in ("local", "physical"),),)-CATALOG = ("gliclass-instruct-large", "laya", "laya-typed-decisions")+CATALOG = (+ "gliclass-instruct-large",+ "laya",+ "laya-typed-decisions",+ "gliner2.5-decide",+ "gliner2.5-multi-decide",+ "gliner2.5-decide-1b",+)SPEED_MARGIN = 1.5# What the page publishes from the test slice beyond score.py's figures. page.py# exits nonzero when the recording stops reproducing any of it.PUBLISHED = {"cards": ["CVE-2023-49378", "CVE-2023-6826", "CVE-2023-44278"],- "median_ms_per_record": {"fast": 69, "smart": 205, "llm": 2671},- "speed_claims": [["attack vector", False], ["a record's three answers", True]],+ "median_ms_per_record": {"fast": 65, "smart": 28, "llm": 2676},+ "speed_claims": [["attack vector", "smart", True], ["a record's three answers", "smart", True]],"withdrawn": [["laya-typed-decisions", "remote_unauthenticated"]],}@@ -98,7 +105,9 @@ def published_failures(page: dict[str, Any]) -> list[str]:actual = {"cards": [card["case"] for card in page["cards"]],"median_ms_per_record": {name: round(lane["median_ms_per_record"]) for name, lane in page["board"].items()},- "speed_claims": [[claim["compares"].split(":")[0], claim["claimed"]] for claim in page["speed"]],+ "speed_claims": [+ [claim["compares"].split(":")[0], claim["faster"], claim["claimed"]] for claim in page["speed"]+ ],"withdrawn": [[item.get("lane") or item.get("catalog"), item["question"]] for item in page["withdrawn"]],}return [@@ -390,26 +399,32 @@ def speed_claims(board: dict[str, Any], latency: dict, gold: dict[str, dict[str,claims = []fast, smart = board["fast"], board["smart"]if "attack_vector" in fast["cells"] and "attack_vector" in smart["cells"]:- records = sorted(gold)- fast_ms = statistics.median(latency[("gliformer-large", c)]["total"] for c in records)- smart_ms = statistics.median(latency[("gliclass-large-v1", c)]["attack_vector"] for c in records)- claims.append(("attack vector: Fast's one call against Smart's attack-vector request", fast_ms, smart_ms))+ # The one answer both lanes show. Each lane makes one call per record, and+ # Smart's call carries two more questions.+ claims.append(+ (+ "attack vector: Fast's one call against Smart's one call",+ ("fast", fast["median_ms_per_record"]),+ ("smart", smart["median_ms_per_record"]),+ )+ )if "llm" in board:claims.append((- "a record's three answers: Smart's three requests against the LLM's one",- smart["median_ms_per_record"],- board["llm"]["median_ms_per_record"],+ "a record's three answers: Smart's one call against the LLM's one",+ ("smart", smart["median_ms_per_record"]),+ ("llm", board["llm"]["median_ms_per_record"]),))out = []- for what, first, second in claims:+ for what, (first_lane, first), (second_lane, second) in claims:ratio = max(first, second) / min(first, second)out.append({"compares": what,"median_ms": [first, second],"ratio": ratio,+ "faster": first_lane if first <= second else second_lane,"claimed": ratio >= SPEED_MARGIN,})@@ -445,7 +460,7 @@ def report(page: dict[str, Any]) -> None:mark = "claimed" if claim["claimed"] else "not claimed"print(f" speed {claim['compares']}: {claim['median_ms'][0]:.0f} vs {claim['median_ms'][1]:.0f} ms, "- f"{claim['ratio']:.2f}x, {mark}"+ f"{claim['faster']} {claim['ratio']:.2f}x faster, {mark}")cascade = page["cascade"]print(diff --git a/examples/typed-decisions/run.py b/examples/typed-decisions/run.pyindex 9fabc8160..603f8c527 100644--- a/examples/typed-decisions/run.py+++ b/examples/typed-decisions/run.py@@ -122,6 +122,14 @@ SIE_MODELS: dict[str, dict[str, str]] = {},"gliclass": {"model": "knowledgator/gliclass-large-v3.0", "family": "gliclass", "vendor": "Knowledgator"},"gliclass-large-v1": {"model": "knowledgator/gliclass-large-v1.0", "family": "gliclass", "vendor": "Knowledgator"},+ # The same model, asked every question in one call: each question a label+ # group, each group encoded as its own row. It answers as the per-question+ # calls do and inherits their tuned settings (tune.INHERITS).+ "gliclass-large-v1-one-call": {+ "model": "knowledgator/gliclass-large-v1.0",+ "family": "gliclass-separate",+ "vendor": "Knowledgator",+ },"gliclass-base-v1": {"model": "knowledgator/gliclass-base-v1.0", "family": "gliclass", "vendor": "Knowledgator"},"gliclass-small-v1": {"model": "knowledgator/gliclass-small-v1.0", "family": "gliclass", "vendor": "Knowledgator"},"gliclass-instruct-large": {@@ -137,6 +145,11 @@ SIE_MODELS: dict[str, dict[str, str]] = {"gliformer-large": {"model": "knowledgator/gliformer-large-v1", "family": "gliformer", "vendor": "Knowledgator"},"gliner2-base": {"model": "fastino/gliner2-base-v1", "family": "gliner2", "vendor": "Fastino"},"gliner2-large": {"model": "fastino/gliner2-large-v1", "family": "gliner2", "vendor": "Fastino"},+ # Fastino's typed decision models take Laya's question mapping as output_schema+ # and answer in Laya's shape, one call per record.+ "gliner2.5-decide": {"model": "fastino/GLiNER2.5-Decide", "family": "decide", "vendor": "Fastino"},+ "gliner2.5-multi-decide": {"model": "fastino/GLiNER2.5-multi-Decide", "family": "decide", "vendor": "Fastino"},+ "gliner2.5-decide-1b": {"model": "fastino/GLiNER2.5-Decide-1B", "family": "decide", "vendor": "Fastino"},"nli-modernbert-base": {"model": "MoritzLaurer/ModernBERT-base-zeroshot-v2.0","family": "nli",@@ -179,7 +192,9 @@ NLI_STATEMENT_TEMPLATE = "{}"# How each family's answers come back, which is how score.py reads them.TRANSPORTS = {"laya": "sie-extract-typed",+ "decide": "sie-extract-typed","gliclass-grouped": "sie-extract-groups",+ "gliclass-separate": "sie-extract-groups","gliformer": "sie-extract-group-labels","gliclass": "sie-extract","gliclass-instruct": "sie-extract",@@ -195,7 +210,19 @@ TRANSPORTS = {# is not tuned.# Grouped GLiClass cannot take the described phrasing: its six labelled groups# need 573 tokens before any record text, over the model's 512-token window.-DEV_PHRASINGS = {"gliclass-instruct-large-grouped": (SHORT, CONCRETE)}+DEV_PHRASINGS = {+ "gliclass-instruct-large-grouped": (SHORT, CONCRETE),+ # GLiNER2.5-Decide reads every question's prompt and labels in at most 256 of+ # its 512 tokens; the described questions take 369.+ "gliner2.5-decide": (SHORT, CONCRETE),+ # One-call GLiClass takes the per-question backend's settings (tune.INHERITS),+ # so on dev it is recorded only in that tuned mix, to judge it by the page rule.+ "gliclass-large-v1-one-call": (),+}+# Backends that cannot take the workflow set's questions as the source writes+# them: GLiNER2.5-Decide's 256-token prompt budget holds none of the four+# workflows' question sets (305 to 425 tokens, checked with a placeholder text).+WORKFLOWS_UNFIT = ("gliner2.5-decide",)# The LLM backend sends one fixed prompt, so it has one phrasing and nothing to# tune; its prompt is about CVSS, so it answers only the vulnerability set.LLM_BACKENDS = tuple(backend for backend, spec in SIE_MODELS.items() if spec["family"] == "llm")@@ -211,7 +238,11 @@ PLAN: dict[str, dict[str, dict[str, tuple[str, ...]]]] = {)for backend in SIE_MODELS},- WORKFLOWS: {backend: {"test": (DESCRIBED,)} for backend in SIE_MODELS if backend not in LLM_BACKENDS},+ WORKFLOWS: {+ backend: {"test": (DESCRIBED,)}+ for backend in SIE_MODELS+ if backend not in LLM_BACKENDS and backend not in WORKFLOWS_UNFIT+ },}VARIANT_CHOICES = (SHORT, DESCRIBED, CONCRETE, TUNED)@@ -264,7 +295,7 @@ def requests_for(rendered, _ = typed_questions(questions, variant)return [{"state": state, "questions": rendered}]family = family_of(backend)- if family == "laya":+ if family in ("laya", "decide"):# SIE's Laya adapter takes a text state as `text` and a structured one as# `metadata.state`, and the question dict as `output_schema`.rendered, _ = typed_questions(questions, variant)@@ -299,6 +330,15 @@ def requests_for(}}]+ if family == "gliclass-separate":+ # Each question a label group named by its id, in its own phrasing. Each+ # group is encoded as its own row, so it scores as a labels request with+ # that group's labels would.+ groups = {+ qid: [label for _, label in label_options(q, phrasing_of(variant, qid))] for qid, q in questions.items()+ }+ params = {"options": {"label_groups": groups, "group_encoding": "separate", "overflow_policy": "truncate_text"}}+ return [{"groups": {qid: qid for qid in questions}, "body": {"items": [{"text": text}], "params": params}}]if family in ("gliclass-grouped", "gliformer"):# GLiClass joins a group's name to each of its labels, so the name stays# short and the questions travel in the instruction. GLiFormer reads a@@ -313,9 +353,11 @@ def requests_for(for qid, q in questions.items()}if family == "gliclass-grouped":+ # Joint: one row per record with every group's labels, as the+ # server encoded label groups before separate rows became the default.params: dict[str, Any] = {"instruction": grouped_instruction(questions),- "options": {"label_groups": groups, "overflow_policy": "truncate_text"},+ "options": {"label_groups": groups, "group_encoding": "joint", "overflow_policy": "truncate_text"},}else:# Every label's score, not only the winner's: threshold 0 and multi-label.@@ -442,12 +484,12 @@ class SIEExtractRunner:)if result.get("error"):raise CallFailedError(f"item error {result['error']}")- if self.family == "laya":+ if self.family in ("laya", "decide"):data = result.get("data") or {}if set(data) != set(params["output_schema"]):raise CallFailedError(f"answered {sorted(data)}, asked {sorted(params['output_schema'])}")return {"data": data, "model": result.get("model", self.model)}- if self.family == "gliclass-grouped":+ if self.family in ("gliclass-grouped", "gliclass-separate"):data = result.get("data") or {}if set(data) != set(request["groups"]):raise CallFailedError(f"answered groups {sorted(data)}, asked {sorted(request['groups'])}")@@ -620,6 +662,8 @@ def record(args: argparse.Namespace) -> int:"environment": environment(),"concurrency": 1,"warm_up": "one unrecorded case before the first recorded call",+ # As given with --server-commit: the SIE commit the server ran.+ "server_commit": args.server_commit[0] if args.server_commit else None,},"call_count": len(calls),"failed_calls": len(failed),@@ -771,6 +815,7 @@ def merge(files already in `out_dir` (a scorer's summary, say) to pin as well."""recordings = [load(path) for path in paths]+ default_commit = (server_commits or [None])[0]calls = [{**call, "requests": digested(call["requests"])} for recording in recordings for call in recording["calls"]]@@ -788,7 +833,12 @@ def merge("failed_calls": sum(recording["failed_calls"] for recording in recordings),"complete": not incomplete,"recordings": [- {"set": recording["set"], "backend": recording["backend"], **recording["recorded"]}+ {+ "set": recording["set"],+ "backend": recording["backend"],+ **recording["recorded"],+ "server_commit": recording["recorded"].get("server_commit") or default_commit,+ }for recording in recordings],"calls": calls,@@ -819,8 +869,11 @@ def merge("files_sha256": files,"endpoint": sorted({recording["recorded"]["runner"].get("endpoint") for recording in recordings} - {None}),"endpoint_note": "A self-hosted SIE server, with the client on the same machine, one record at a time.",- # The SIE server commit(s) the recordings were made against, as given.- "server_commits": server_commits or [],+ # The SIE server commits the recordings were made against; calls.json+ # names each recording's own.+ "server_commits": sorted(+ {recording["recorded"].get("server_commit") or default_commit for recording in recordings} - {None}+ ),"hardware": hardware,"models": sorted({call["model"] for call in calls}),"run_dates": sorted({recording["recorded"]["at"][:10] for recording in recordings}),@@ -849,7 +902,12 @@ def main() -> int:parser.add_argument("--record", action="store_true", help="make live calls")parser.add_argument("--merge", nargs="+", metavar="RECORDING", help="combine recordings into calls.json")parser.add_argument("--merge-out", default="run-output", help="where --merge writes (default: run-output)")- parser.add_argument("--server-commit", nargs="+", help="with --merge: the SIE server commit(s) recorded against")+ parser.add_argument(+ "--server-commit",+ nargs="+",+ help="with --record: the SIE commit the server runs, stamped on the recording; "+ "with --merge: the commit for recordings that carry no stamp",+ )parser.add_argument("--hardware", help="with --merge: what the server ran on, for the manifest")parser.add_argument("--attach", nargs="+", help="with --merge: files in --merge-out to pin in the manifest")parser.add_argument("--set", choices=sorted(PLAN), default=VULNERABILITY_TRIAGE)diff --git a/examples/typed-decisions/score.py b/examples/typed-decisions/score.pyindex 126d83726..def12d870 100644--- a/examples/typed-decisions/score.py+++ b/examples/typed-decisions/score.py@@ -85,16 +85,16 @@ SUM_TOLERANCE = 0.02# All test slice, in each backend's tuned configuration (the LLM's described).VT, WF = VULNERABILITY_TRIAGE, WORKFLOWSPUBLISHED: dict[str, float] = {- # The board: Smart (knowledgator/gliclass-large-v1.0)- f"{VT}/gliclass-large-v1/weakness/correct": 142,- f"{VT}/gliclass-large-v1/weakness/balanced_accuracy": 0.887,- f"{VT}/gliclass-large-v1/attack_vector/correct": 147,- f"{VT}/gliclass-large-v1/attack_vector/balanced_accuracy": 0.796,- f"{VT}/gliclass-large-v1/remote_unauthenticated/correct": 115,- f"{VT}/gliclass-large-v1/remote_unauthenticated/balanced_accuracy": 0.725,+ # The board: Smart (knowledgator/gliclass-large-v1.0, one call per record)+ f"{VT}/gliclass-large-v1-one-call/weakness/correct": 142,+ f"{VT}/gliclass-large-v1-one-call/weakness/balanced_accuracy": 0.887,+ f"{VT}/gliclass-large-v1-one-call/attack_vector/correct": 147,+ f"{VT}/gliclass-large-v1-one-call/attack_vector/balanced_accuracy": 0.796,+ f"{VT}/gliclass-large-v1-one-call/remote_unauthenticated/correct": 115,+ f"{VT}/gliclass-large-v1-one-call/remote_unauthenticated/balanced_accuracy": 0.725,# The figures row: Smart's pick-one and yes-or-no answers- f"{VT}/gliclass-large-v1/choice/accuracy": 0.903,- f"{VT}/gliclass-large-v1/noul/accuracy": 0.719,+ f"{VT}/gliclass-large-v1-one-call/choice/accuracy": 0.903,+ f"{VT}/gliclass-large-v1-one-call/noul/accuracy": 0.719,# The board: Fast (knowledgator/gliformer-large-v1)f"{VT}/gliformer-large/attack_vector/correct": 144,f"{VT}/gliformer-large/attack_vector/balanced_accuracy": 0.873,@@ -108,9 +108,14 @@ PUBLISHED: dict[str, float] = {f"{VT}/gliclass-instruct-large/attack_vector/correct": 149,f"{VT}/laya/weakness/correct": 134,f"{VT}/laya-typed-decisions/weakness/correct": 145,+ f"{VT}/gliner2.5-decide/weakness/correct": 146,+ f"{VT}/gliner2.5-multi-decide/weakness/correct": 137,+ f"{VT}/gliner2.5-decide-1b/weakness/correct": 139,+ f"{VT}/gliner2.5-decide-1b/attack_vector/correct": 150,+ f"{VT}/gliner2.5-decide-1b/attack_vector/balanced_accuracy": 0.852,# The README: computed severity, reported and not shown- f"{VT}/gliclass-large-v1/severity/accuracy": 0.600,- f"{VT}/gliclass-large-v1/severity/balanced_accuracy": 0.601,+ f"{VT}/gliclass-large-v1-one-call/severity/accuracy": 0.606,+ f"{VT}/gliclass-large-v1-one-call/severity/balanced_accuracy": 0.612,f"{VT}/qwen3-4b-instruct/severity/accuracy": 0.675,f"{VT}/qwen3-4b-instruct/severity/balanced_accuracy": 0.613,# The README: the fine-tuned Laya checkpoint on the workflow benchmark's teacher labelsdiff --git a/examples/typed-decisions/tests/test_example.py b/examples/typed-decisions/tests/test_example.pyindex 801d1cbe0..b2d160e9a 100644--- a/examples/typed-decisions/tests/test_example.py+++ b/examples/typed-decisions/tests/test_example.py@@ -336,6 +336,49 @@ class GroupedBackendTests(unittest.TestCase):gold = self.case["gold"][qid]self.assertEqual(answers[qid]["top"], gold)+ def test_grouped_gliclass_asks_for_joint_encoding(self) -> None:+ options = self._request("gliclass-instruct-large-grouped")["body"]["params"]["options"]+ self.assertEqual(options["group_encoding"], "joint")++ def test_one_call_gliclass_sends_each_question_as_a_separate_group(self) -> None:+ request = self._request("gliclass-large-v1-one-call")+ options = request["body"]["params"]["options"]+ self.assertEqual(options["group_encoding"], "separate")+ self.assertEqual(request["groups"], {qid: qid for qid in questions.VULNERABILITY_QUESTIONS})+ (per_question,) = run.requests_for(+ "gliclass-large-v1",+ "short",+ self.case["state"],+ {"weakness": questions.VULNERABILITY_QUESTIONS["weakness"]},+ )+ self.assertEqual(options["label_groups"]["weakness"], per_question["body"]["params"]["labels"])+ self.assertNotIn("instruction", request["body"]["params"])++ def test_one_call_gliclass_answers_map_to_option_keys(self) -> None:+ request = self._request("gliclass-large-v1-one-call")+ data = {}+ for qid, labels in request["body"]["params"]["options"]["label_groups"].items():+ scores = gold_scores(self.case, qid, labels, "short")+ total = sum(scores.values())+ data[qid] = {"type": "choice", "probabilities": {label: v / total for label, v in scores.items()}}+ call = {+ "id": "o",+ "set": questions.VULNERABILITY_TRIAGE,+ "backend": "gliclass-large-v1-one-call",+ "variant": "short",+ "requests": [request],+ "responses": [{"data": data}],+ }+ answers = score.NORMALISERS[run.TRANSPORTS["gliclass-separate"]](call, questions.VULNERABILITY_QUESTIONS)+ for qid in questions.VULNERABILITY_QUESTIONS:+ self.assertEqual(answers[qid]["top"], self.case["gold"][qid])++ def test_decide_is_asked_the_typed_questions_the_way_laya_is(self) -> None:+ decide = self._request("gliner2.5-decide")+ laya = self._request("laya")+ self.assertEqual(decide["body"], laya["body"])+ self.assertEqual(run.TRANSPORTS["decide"], run.TRANSPORTS["laya"])+def test_grouped_gliclass_missing_group_fails_closed(self) -> None:call = self._gliclass_grouped_call()call["responses"][0]["data"].pop("attack vector")@@ -516,6 +559,31 @@ class TuneTests(unittest.TestCase):self.assertEqual(tune.worst_recall(tune.metrics(gold, predicted)), 0.5)+class InheritanceTests(unittest.TestCase):+ def test_same_as_takes_the_other_backends_settings(self) -> None:+ settings = {+ "backends": {+ "s": {+ "parent": {+ "phrasing": {"q": {"phrasing": "short"}},+ "questions": {"q": {"rule": {"kind": "argmax"}}},+ },+ "child": {"same_as": "parent"},+ }+ }+ }+ self.assertEqual(tuning.phrasing("s", "child", tuning.TUNED, settings), {"q": "short"})+ self.assertEqual(tuning.rules("s", "child", tuning.TUNED, settings), {"q": {"kind": "argmax"}})++ def test_a_one_call_second_stage_counts_one_call_when_anything_escalates(self) -> None:+ latency = {("f", "c"): {"total": 10.0, "requests": 1}, ("s", "c"): {"total": 8.0, "requests": 1}}+ lane = {"backend": "f", "escalate_to": "s"}+ self.assertEqual(tune.record_calls(lane, "c", {"a": True, "b": True}, latency), 2)+ self.assertEqual(tune.record_latency(lane, "c", {"a": True, "b": True}, latency), 18.0)+ self.assertEqual(tune.record_calls(lane, "c", {"a": False, "b": False}, latency), 1)+ self.assertEqual(tune.record_latency(lane, "c", {"a": False, "b": False}, latency), 10.0)++class CardTests(unittest.TestCase):def test_cards_skip_misses_overridden_answers_and_repeated_weakness_classes(self) -> None:def ans(top: str, p: float, returned: str | None = None) -> dict[str, Any]:diff --git a/examples/typed-decisions/tune.py b/examples/typed-decisions/tune.pyindex 3ec926a49..2c43d558f 100644--- a/examples/typed-decisions/tune.py+++ b/examples/typed-decisions/tune.py@@ -81,11 +81,15 @@ LANE_CUTOFFS = (None, *(round(step / 100, 2) for step in range(50, 100, 5)), 1.0# The lanes the page's board compares, each one model on its own.LANES = {"fast": {"backend": "gliformer-large"},- "smart": {"backend": "gliclass-large-v1"},+ "smart": {"backend": "gliclass-large-v1-one-call"},"llm": {"backend": PAGE_LLM},}# Fast first, and Smart for what Fast is unsure of. Judged against Smart alone.-CASCADE = {"backend": "gliformer-large", "escalate_to": "gliclass-large-v1"}+CASCADE = {"backend": "gliformer-large", "escalate_to": "gliclass-large-v1-one-call"}+# Backends that take another backend's tuned settings unchanged, rather than+# being tuned themselves: the one-call GLiClass answers as its per-question+# calls do (PREREGISTRATION.md, amendment 1).+INHERITS = {"gliclass-large-v1-one-call": "gliclass-large-v1"}def metrics(gold: list[str], predicted: list[str]) -> dict[str, Any]:@@ -258,6 +262,9 @@ def choose_phrasing(paths: list[str], data_dir: Path, tuned: dict[str, Any]) ->phrasings[qid] = {"phrasing": best_phrasing(tried), "dev": tried}target[backend] = {"phrasing": phrasings}print(f"{backend}: " + ", ".join(f"{qid}={p['phrasing']}" for qid, p in phrasings.items()))+ for child, parent in INHERITS.items():+ target[child] = {"same_as": parent}+ print(f"{child}: the settings of {parent}")def fit_rules(paths: list[str], data_dir: Path, tuned: dict[str, Any]) -> None:@@ -265,9 +272,18 @@ def fit_rules(paths: list[str], data_dir: Path, tuned: dict[str, Any]) -> None:by = answers_by(calls, data_dir, decided=False)gold = gold_of(data_dir)target = tuned["backends"][VULNERABILITY_TRIAGE]- for (backend, variant), per_case in sorted(by.items()):+ for (backend, variant), per_case in sorted(by.items(), key=lambda item: (item[0][0] in INHERITS, item[0])):if variant != tuning.TUNED:continue+ if backend in INHERITS:+ # Its rules are its parent's, fitted above; only its dev verdicts are its own.+ rules = {qid: entry["rule"] for qid, entry in target[INHERITS[backend]]["questions"].items()}+ target[backend]["dev"] = {}+ for qid, rule in rules.items():+ sample = rows_for(per_case, gold, qid)+ target[backend]["dev"][qid] = verdict([g for _, g in sample], decide(sample, rule))+ report(backend, qid, rule, target[backend]["dev"][qid])+ continuesettings: dict[str, Any] = {}for qid in asked(VULNERABILITY_TRIAGE, backend, VULNERABILITY_QUESTIONS):sample = rows_for(per_case, gold, qid)@@ -400,14 +416,19 @@ def record_latency(lane: dict[str, Any], case: str, escalated: dict[str, bool],total = latency[(lane["backend"], case)]["total"]if "escalate_to" in lane:second = latency[(lane["escalate_to"], case)]- total += sum(second[qid] for qid, up in escalated.items() if up)+ if second["requests"] == 1:+ # One call answers every question: it is made once if anything escalates.+ total += second["total"] if any(escalated.values()) else 0.0+ else:+ total += sum(second[qid] for qid, up in escalated.items() if up)return totaldef record_calls(lane: dict[str, Any], case: str, escalated: dict[str, bool], latency: dict) -> int:calls = latency[(lane["backend"], case)]["requests"]if "escalate_to" in lane:- calls += sum(escalated.values())+ second = latency[(lane["escalate_to"], case)]["requests"]+ calls += int(any(escalated.values())) if second == 1 else sum(escalated.values())return callsdiff --git a/examples/typed-decisions/tuning.json b/examples/typed-decisions/tuning.jsonindex 96d5fb45a..9ecf954ea 100644--- a/examples/typed-decisions/tuning.json+++ b/examples/typed-decisions/tuning.json@@ -1283,6 +1283,108 @@}}},+ "gliclass-large-v1-one-call": {+ "dev": {+ "attack_vector": {+ "accuracy": 0.9241071428571429,+ "balanced_accuracy": 0.7741207594148771,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.049107142857142794,+ "balanced_accuracy": 0.7055245189323401+ },+ "eligible": true,+ "macro_f1": 0.8824769433465086,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 19,+ 34+ ],+ "network": [+ 187,+ 189+ ]+ }+ },+ "remote_unauthenticated": {+ "accuracy": 0.8214285714285714,+ "balanced_accuracy": 0.8166666666666667,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.2276785714285714,+ "balanced_accuracy": 0.7739463601532567+ },+ "eligible": true,+ "macro_f1": 0.81859410430839,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [],+ "recall": {+ "false": [+ 78,+ 104+ ],+ "true": [+ 106,+ 120+ ]+ }+ },+ "weakness": {+ "accuracy": 0.8794642857142857,+ "balanced_accuracy": 0.8794642857142857,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6785714285714286,+ "balanced_accuracy": 0.8452305809110244+ },+ "eligible": true,+ "macro_f1": 0.8785389706276832,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 23,+ 28+ ],+ "command_injection": [+ 24,+ 28+ ],+ "cross_site_scripting": [+ 27,+ 28+ ],+ "file_upload": [+ 24,+ 28+ ],+ "memory_corruption": [+ 18,+ 28+ ],+ "path_traversal": [+ 27,+ 28+ ],+ "request_forgery": [+ 27,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ }+ },+ "same_as": "gliclass-large-v1"+ },"gliclass-small-v1": {"phrasing": {"attack_vector": {@@ -1658,43 +1760,711 @@"n": 224,"reasons": [],"recall": {- "adjacent": [- 0,- 1- ],- "local": [- 25,- 34+ "adjacent": [+ 0,+ 1+ ],+ "local": [+ 25,+ 34+ ],+ "network": [+ 180,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7276785714285714,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.5133928571428571,+ "balanced_accuracy": 0.6853481520545485+ },+ "eligible": false,+ "macro_f1": 0.7286963591291679,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.728, 5th percentile 0.685",+ "cross_site_scripting right 9 of 28"+ ],+ "recall": {+ "access_control": [+ 15,+ 28+ ],+ "command_injection": [+ 27,+ 28+ ],+ "cross_site_scripting": [+ 9,+ 28+ ],+ "file_upload": [+ 25,+ 28+ ],+ "memory_corruption": [+ 20,+ 28+ ],+ "path_traversal": [+ 16,+ 28+ ],+ "request_forgery": [+ 24,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 19.948304509859202,+ "command_injection": 4.502613666790282,+ "cross_site_scripting": 3.109042497116438,+ "file_upload": 14.735908429180249,+ "memory_corruption": 13.966513545828212,+ "path_traversal": 26.48468977823594,+ "request_forgery": 9.857947013608783,+ "sql_injection": 7.84468599393789+ }+ }+ }+ }+ },+ "gliner2-base": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.6428571428571429,+ "balanced_accuracy": 0.7521786492374727,+ "p05_balanced_accuracy": 0.700339558573854,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.6964285714285714,+ "balanced_accuracy": 0.7959850606909431,+ "p05_balanced_accuracy": 0.7503799392097263,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.6428571428571429,+ "balanced_accuracy": 0.7521786492374727,+ "p05_balanced_accuracy": 0.700339558573854,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "described"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.6383928571428571,+ "balanced_accuracy": 0.6259615384615385,+ "p05_balanced_accuracy": 0.5729665071770335,+ "passes": false,+ "rule": {+ "cutoff": 0.89,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.6919642857142857,+ "balanced_accuracy": 0.6766025641025641,+ "p05_balanced_accuracy": 0.6300248736259327,+ "passes": false,+ "rule": {+ "cutoff": 0.94,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5669642857142857,+ "balanced_accuracy": 0.5362179487179487,+ "p05_balanced_accuracy": 0.5086834733893557,+ "passes": false,+ "rule": {+ "cutoff": 0.88,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8303571428571429,+ "balanced_accuracy": 0.8303571428571429,+ "p05_balanced_accuracy": 0.7901335673217011,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "p05_balanced_accuracy": 0.8285957044284912,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.8035714285714286,+ "balanced_accuracy": 0.8035714285714286,+ "p05_balanced_accuracy": 0.76298176416624,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "described"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.6964285714285714,+ "balanced_accuracy": 0.7959850606909431,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.2142857142857143,+ "balanced_accuracy": 0.7503799392097263+ },+ "eligible": false,+ "macro_f1": 0.7560959917647816,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "accuracy over the majority answer -0.147, 5th percentile -0.214"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 32,+ 34+ ],+ "network": [+ 123,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.6919642857142857,+ "balanced_accuracy": 0.6766025641025641,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.0982142857142857,+ "balanced_accuracy": 0.6300248736259327+ },+ "eligible": false,+ "macro_f1": 0.6690009637006104,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.677, 5th percentile 0.630"+ ],+ "recall": {+ "false": [+ 48,+ 104+ ],+ "true": [+ 107,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.94,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6607142857142857,+ "balanced_accuracy": 0.8285957044284912+ },+ "eligible": true,+ "macro_f1": 0.8678019691022372,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 25,+ 28+ ],+ "command_injection": [+ 26,+ 28+ ],+ "cross_site_scripting": [+ 25,+ 28+ ],+ "file_upload": [+ 27,+ 28+ ],+ "memory_corruption": [+ 18,+ 28+ ],+ "path_traversal": [+ 21,+ 28+ ],+ "request_forgery": [+ 25,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ }+ }+ },+ "gliner2-large": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8291316526610644,+ "p05_balanced_accuracy": 0.7680791884816753,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.8348214285714286,+ "balanced_accuracy": 0.8297541238717709,+ "p05_balanced_accuracy": 0.7736892736892738,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8291316526610644,+ "p05_balanced_accuracy": 0.7680791884816753,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.7410714285714286,+ "balanced_accuracy": 0.7294871794871796,+ "p05_balanced_accuracy": 0.6792962356792144,+ "passes": false,+ "rule": {+ "cutoff": 0.46,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.6026785714285714,+ "balanced_accuracy": 0.576602564102564,+ "p05_balanced_accuracy": 0.5401785714285714,+ "passes": false,+ "rule": {+ "cutoff": 0.95,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.6473214285714286,+ "balanced_accuracy": 0.6240384615384615,+ "p05_balanced_accuracy": 0.5840047865975269,+ "passes": false,+ "rule": {+ "cutoff": 0.92,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "concrete"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8526785714285714,+ "balanced_accuracy": 0.8526785714285714,+ "p05_balanced_accuracy": 0.8140708168232712,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.875,+ "balanced_accuracy": 0.875,+ "p05_balanced_accuracy": 0.8402927504309851,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.8482142857142857,+ "p05_balanced_accuracy": 0.8084105544060255,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "described"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8291316526610644,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.03125,+ "balanced_accuracy": 0.7680791884816753+ },+ "eligible": true,+ "macro_f1": 0.888761994775463,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 24,+ 34+ ],+ "network": [+ 180,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.7410714285714286,+ "balanced_accuracy": 0.7294871794871796,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.1473214285714286,+ "balanced_accuracy": 0.6792962356792144+ },+ "eligible": false,+ "macro_f1": 0.7286096256684491,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.729, 5th percentile 0.679"+ ],+ "recall": {+ "false": [+ 59,+ 104+ ],+ "true": [+ 107,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.46,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.875,+ "balanced_accuracy": 0.875,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6696428571428572,+ "balanced_accuracy": 0.8402927504309851+ },+ "eligible": true,+ "macro_f1": 0.873976209735951,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 26,+ 28+ ],+ "command_injection": [+ 26,+ 28+ ],+ "cross_site_scripting": [+ 27,+ 28+ ],+ "file_upload": [+ 15,+ 28+ ],+ "memory_corruption": [+ 25,+ 28+ ],+ "path_traversal": [+ 25,+ 28+ ],+ "request_forgery": [+ 25,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ }+ }+ },+ "gliner2.5-decide": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.6651785714285714,+ "balanced_accuracy": 0.7292250233426704,+ "p05_balanced_accuracy": 0.6689303904923599,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.7991071428571429,+ "balanced_accuracy": 0.7724089635854342,+ "p05_balanced_accuracy": 0.7045617816091954,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.5580357142857143,+ "balanced_accuracy": 0.5272435897435898,+ "p05_balanced_accuracy": 0.4989973262032085,+ "passes": false,+ "rule": {+ "cutoff": 0.44,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5714285714285714,+ "balanced_accuracy": 0.5935897435897436,+ "p05_balanced_accuracy": 0.5518217332376625,+ "passes": false,+ "rule": {+ "cutoff": 0.76,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "short"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.9151785714285714,+ "p05_balanced_accuracy": 0.8818117935305435,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.413773411871413,+ "command_injection": 7.159002854226448,+ "cross_site_scripting": 8.669658774637675,+ "file_upload": 6.984877903645131,+ "memory_corruption": 11.134685324781621,+ "path_traversal": 8.486770881527942,+ "request_forgery": 7.767596004265464,+ "sql_injection": 7.660452881028643+ }+ }+ },+ "short": {+ "accuracy": 0.90625,+ "balanced_accuracy": 0.90625,+ "p05_balanced_accuracy": 0.8727225209080047,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.5469741683244,+ "command_injection": 6.941470955294189,+ "cross_site_scripting": 8.476246802593076,+ "file_upload": 6.917438666069473,+ "memory_corruption": 13.671520435804982,+ "path_traversal": 8.11964366491385,+ "request_forgery": 7.581345014272981,+ "sql_injection": 7.536341706194211+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.7991071428571429,+ "balanced_accuracy": 0.7724089635854342,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.1026785714285714,+ "balanced_accuracy": 0.7045617816091954+ },+ "eligible": false,+ "macro_f1": 0.5196466973886329,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "accuracy over the majority answer -0.045, 5th percentile -0.103"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 25,+ 34+ ],+ "network": [+ 153,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.5669642857142857,+ "balanced_accuracy": 0.5932692307692308,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.0714285714285714,+ "balanced_accuracy": 0.5589571872757714+ },+ "eligible": false,+ "macro_f1": 0.5155082837202043,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.593, 5th percentile 0.559",+ "accuracy over the majority answer +0.031, 5th percentile -0.071",+ "true right 27 of 120"+ ],+ "recall": {+ "false": [+ 100,+ 104],- "network": [- 180,- 189+ "true": [+ 27,+ 120]}},"rule": {- "kind": "argmax"+ "cutoff": 0.81,+ "kind": "cutoff"}},"weakness": {"dev": {- "accuracy": 0.7276785714285714,- "balanced_accuracy": 0.7276785714285714,+ "accuracy": 0.9196428571428571,+ "balanced_accuracy": 0.9196428571428572,"bootstrap_p05": {- "accuracy_over_majority": 0.5133928571428571,- "balanced_accuracy": 0.6853481520545485+ "accuracy_over_majority": 0.7232142857142857,+ "balanced_accuracy": 0.8873388471550236},- "eligible": false,- "macro_f1": 0.7286963591291679,+ "eligible": true,+ "macro_f1": 0.9199865732979268,"majority_accuracy": 0.125,"n": 224,- "reasons": [- "balanced accuracy 0.728, 5th percentile 0.685",- "cross_site_scripting right 9 of 28"- ],+ "reasons": [],"recall": {"access_control": [- 15,+ 26,28],"command_injection": [@@ -1702,7 +2472,7 @@28],"cross_site_scripting": [- 9,+ 28,28],"file_upload": [@@ -1710,15 +2480,15 @@28],"memory_corruption": [- 20,+ 26,28],"path_traversal": [- 16,+ 21,28],"request_forgery": [- 24,+ 26,28],"sql_injection": [@@ -1730,82 +2500,82 @@"rule": {"kind": "prior","weights": {- "access_control": 19.948304509859202,- "command_injection": 4.502613666790282,- "cross_site_scripting": 3.109042497116438,- "file_upload": 14.735908429180249,- "memory_corruption": 13.966513545828212,- "path_traversal": 26.48468977823594,- "request_forgery": 9.857947013608783,- "sql_injection": 7.84468599393789+ "access_control": 7.559838882851704,+ "command_injection": 7.313985434381895,+ "cross_site_scripting": 8.592908540967995,+ "file_upload": 6.929251664688557,+ "memory_corruption": 10.970650471110693,+ "path_traversal": 8.375443108972515,+ "request_forgery": 7.7271819411955684,+ "sql_injection": 7.671966648872116}}}}},- "gliner2-base": {+ "gliner2.5-decide-1b": {"phrasing": {"attack_vector": {"dev": {"concrete": {- "accuracy": 0.6428571428571429,- "balanced_accuracy": 0.7521786492374727,- "p05_balanced_accuracy": 0.700339558573854,- "passes": false,+ "accuracy": 0.9330357142857143,+ "balanced_accuracy": 0.8035325241207594,+ "p05_balanced_accuracy": 0.7371134020618557,+ "passes": true,"rule": {"kind": "argmax"}},"described": {- "accuracy": 0.6964285714285714,- "balanced_accuracy": 0.7959850606909431,- "p05_balanced_accuracy": 0.7503799392097263,- "passes": false,+ "accuracy": 0.9285714285714286,+ "balanced_accuracy": 0.7767662620603797,+ "p05_balanced_accuracy": 0.7056595365418895,+ "passes": true,"rule": {"kind": "argmax"}},"short": {- "accuracy": 0.6428571428571429,- "balanced_accuracy": 0.7521786492374727,- "p05_balanced_accuracy": 0.700339558573854,- "passes": false,+ "accuracy": 0.9196428571428571,+ "balanced_accuracy": 0.8197167755991286,+ "p05_balanced_accuracy": 0.7534534534534535,+ "passes": true,"rule": {"kind": "argmax"}}},- "phrasing": "described"+ "phrasing": "short"},"remote_unauthenticated": {"dev": {"concrete": {- "accuracy": 0.6383928571428571,- "balanced_accuracy": 0.6259615384615385,- "p05_balanced_accuracy": 0.5729665071770335,+ "accuracy": 0.5714285714285714,+ "balanced_accuracy": 0.5423076923076923,+ "p05_balanced_accuracy": 0.5110047846889952,"passes": false,"rule": {- "cutoff": 0.89,+ "cutoff": 0.54,"kind": "cutoff"}},"described": {- "accuracy": 0.6919642857142857,- "balanced_accuracy": 0.6766025641025641,- "p05_balanced_accuracy": 0.6300248736259327,+ "accuracy": 0.5803571428571429,+ "balanced_accuracy": 0.5493589743589743,+ "p05_balanced_accuracy": 0.5217252650880969,"passes": false,"rule": {- "cutoff": 0.94,+ "cutoff": 0.31,"kind": "cutoff"}},"short": {"accuracy": 0.5669642857142857,- "balanced_accuracy": 0.5362179487179487,- "p05_balanced_accuracy": 0.5086834733893557,+ "balanced_accuracy": 0.5471153846153846,+ "p05_balanced_accuracy": 0.5026026604973973,"passes": false,"rule": {- "cutoff": 0.88,+ "cutoff": 0.58,"kind": "cutoff"}}@@ -1815,30 +2585,60 @@"weakness": {"dev": {"concrete": {- "accuracy": 0.8303571428571429,- "balanced_accuracy": 0.8303571428571429,- "p05_balanced_accuracy": 0.7901335673217011,+ "accuracy": 0.8883928571428571,+ "balanced_accuracy": 0.8883928571428572,+ "p05_balanced_accuracy": 0.8501648922502312,"passes": true,"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 9.870609051177622,+ "command_injection": 8.150556638920788,+ "cross_site_scripting": 6.896181989072268,+ "file_upload": 6.602206474564733,+ "memory_corruption": 9.891735968122996,+ "path_traversal": 10.273361934496746,+ "request_forgery": 6.656498630379785,+ "sql_injection": 7.6415738510348845+ }}},"described": {- "accuracy": 0.8660714285714286,- "balanced_accuracy": 0.8660714285714286,- "p05_balanced_accuracy": 0.8285957044284912,+ "accuracy": 0.8973214285714286,+ "balanced_accuracy": 0.8973214285714286,+ "p05_balanced_accuracy": 0.8626028361772438,"passes": true,"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 8.211113457551315,+ "command_injection": 6.383483554850092,+ "cross_site_scripting": 6.877169155593291,+ "file_upload": 7.513218491342839,+ "memory_corruption": 17.14373378676815,+ "path_traversal": 8.976190770543367,+ "request_forgery": 6.369786837259156,+ "sql_injection": 8.596616544592102+ }}},"short": {- "accuracy": 0.8035714285714286,- "balanced_accuracy": 0.8035714285714286,- "p05_balanced_accuracy": 0.76298176416624,+ "accuracy": 0.8883928571428571,+ "balanced_accuracy": 0.8883928571428572,+ "p05_balanced_accuracy": 0.8535923487432108,"passes": true,"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 9.467287784070272,+ "command_injection": 7.1746862434172085,+ "cross_site_scripting": 6.865965162027873,+ "file_upload": 6.458273938334908,+ "memory_corruption": 15.733142671888015,+ "path_traversal": 9.166872203068674,+ "request_forgery": 6.63947138348642,+ "sql_injection": 7.6193277940667805+ }}}},@@ -1848,30 +2648,28 @@"questions": {"attack_vector": {"dev": {- "accuracy": 0.6964285714285714,- "balanced_accuracy": 0.7959850606909431,+ "accuracy": 0.9330357142857143,+ "balanced_accuracy": 0.8035325241207594,"bootstrap_p05": {- "accuracy_over_majority": -0.2142857142857143,- "balanced_accuracy": 0.7503799392097263+ "accuracy_over_majority": 0.0580357142857143,+ "balanced_accuracy": 0.7371134020618557},- "eligible": false,- "macro_f1": 0.7560959917647816,+ "eligible": true,+ "macro_f1": 0.6778598971722365,"majority_accuracy": 0.84375,"n": 224,- "reasons": [- "accuracy over the majority answer -0.147, 5th percentile -0.214"- ],+ "reasons": [],"recall": {"adjacent": [1,1],"local": [- 32,+ 21,34],"network": [- 123,+ 187,189]}@@ -1882,51 +2680,53 @@},"remote_unauthenticated": {"dev": {- "accuracy": 0.6919642857142857,- "balanced_accuracy": 0.6766025641025641,+ "accuracy": 0.5714285714285714,+ "balanced_accuracy": 0.5429487179487179,"bootstrap_p05": {- "accuracy_over_majority": 0.0982142857142857,- "balanced_accuracy": 0.6300248736259327+ "accuracy_over_majority": -0.008928571428571397,+ "balanced_accuracy": 0.5111288392500997},"eligible": false,- "macro_f1": 0.6690009637006104,+ "macro_f1": 0.46997929606625255,"majority_accuracy": 0.5357142857142857,"n": 224,"reasons": [- "balanced accuracy 0.677, 5th percentile 0.630"+ "balanced accuracy 0.543, 5th percentile 0.511",+ "accuracy over the majority answer +0.036, 5th percentile -0.009",+ "false right 15 of 104"],"recall": {"false": [- 48,+ 15,104],"true": [- 107,+ 113,120]}},"rule": {- "cutoff": 0.94,+ "cutoff": 0.46,"kind": "cutoff"}},"weakness": {"dev": {- "accuracy": 0.8660714285714286,- "balanced_accuracy": 0.8660714285714286,+ "accuracy": 0.9017857142857143,+ "balanced_accuracy": 0.9017857142857143,"bootstrap_p05": {- "accuracy_over_majority": 0.6607142857142857,- "balanced_accuracy": 0.8285957044284912+ "accuracy_over_majority": 0.7008928571428571,+ "balanced_accuracy": 0.866991659330369},"eligible": true,- "macro_f1": 0.8678019691022372,+ "macro_f1": 0.9031916720607572,"majority_accuracy": 0.125,"n": 224,"reasons": [],"recall": {"access_control": [- 25,+ 22,28],"command_injection": [@@ -1934,23 +2734,23 @@28],"cross_site_scripting": [- 25,+ 26,28],"file_upload": [- 27,+ 26,28],"memory_corruption": [- 18,+ 26,28],"path_traversal": [- 21,+ 22,28],"request_forgery": [- 25,+ 27,28],"sql_injection": [@@ -1960,138 +2760,181 @@}},"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 7.965732290382141,+ "command_injection": 6.60760442679789,+ "cross_site_scripting": 6.866368877100924,+ "file_upload": 7.023229435078475,+ "memory_corruption": 17.47006756629641,+ "path_traversal": 9.314821436979257,+ "request_forgery": 6.509621417381238,+ "sql_injection": 8.555480373591248+ }}}}},- "gliner2-large": {+ "gliner2.5-multi-decide": {"phrasing": {"attack_vector": {"dev": {"concrete": {- "accuracy": 0.9151785714285714,- "balanced_accuracy": 0.8291316526610644,- "p05_balanced_accuracy": 0.7680791884816753,- "passes": true,+ "accuracy": 0.75,+ "balanced_accuracy": 0.7071272953625896,+ "p05_balanced_accuracy": 0.6380832282471627,+ "passes": false,"rule": {"kind": "argmax"}},"described": {- "accuracy": 0.8348214285714286,- "balanced_accuracy": 0.8297541238717709,- "p05_balanced_accuracy": 0.7736892736892738,+ "accuracy": 0.5758928571428571,+ "balanced_accuracy": 0.6763149704326175,+ "p05_balanced_accuracy": 0.616346292816881,"passes": false,"rule": {"kind": "argmax"}},"short": {- "accuracy": 0.9151785714285714,- "balanced_accuracy": 0.8291316526610644,- "p05_balanced_accuracy": 0.7680791884816753,- "passes": true,+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.6938997821350763,+ "p05_balanced_accuracy": 0.6252321981424149,+ "passes": false,"rule": {"kind": "argmax"}}},- "phrasing": "short"+ "phrasing": "concrete"},"remote_unauthenticated": {"dev": {"concrete": {- "accuracy": 0.7410714285714286,- "balanced_accuracy": 0.7294871794871796,- "p05_balanced_accuracy": 0.6792962356792144,+ "accuracy": 0.5401785714285714,+ "balanced_accuracy": 0.5073717948717948,+ "p05_balanced_accuracy": 0.48518821603927986,"passes": false,"rule": {- "cutoff": 0.46,+ "cutoff": 0.28,"kind": "cutoff"}},"described": {- "accuracy": 0.6026785714285714,- "balanced_accuracy": 0.576602564102564,- "p05_balanced_accuracy": 0.5401785714285714,+ "accuracy": 0.5714285714285714,+ "balanced_accuracy": 0.5416666666666667,+ "p05_balanced_accuracy": 0.5119047619047619,"passes": false,"rule": {- "cutoff": 0.95,+ "cutoff": 0.35,"kind": "cutoff"}},"short": {- "accuracy": 0.6473214285714286,- "balanced_accuracy": 0.6240384615384615,- "p05_balanced_accuracy": 0.5840047865975269,+ "accuracy": 0.5401785714285714,+ "balanced_accuracy": 0.5701923076923077,+ "p05_balanced_accuracy": 0.5438299927553731,"passes": false,"rule": {- "cutoff": 0.92,+ "cutoff": 0.88,"kind": "cutoff"}}},- "phrasing": "concrete"+ "phrasing": "short"},"weakness": {"dev": {"concrete": {- "accuracy": 0.8526785714285714,- "balanced_accuracy": 0.8526785714285714,- "p05_balanced_accuracy": 0.8140708168232712,+ "accuracy": 0.8705357142857143,+ "balanced_accuracy": 0.8705357142857143,+ "p05_balanced_accuracy": 0.8304482153852523,"passes": true,"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 8.727809880558361,+ "command_injection": 7.5982296684121025,+ "cross_site_scripting": 6.425874911259648,+ "file_upload": 7.596565545344709,+ "memory_corruption": 14.509487231871825,+ "path_traversal": 8.345166645700795,+ "request_forgery": 6.9740646379202955,+ "sql_injection": 7.43958067475173+ }}},"described": {- "accuracy": 0.875,- "balanced_accuracy": 0.875,- "p05_balanced_accuracy": 0.8402927504309851,+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "p05_balanced_accuracy": 0.8249237193202711,"passes": true,"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 6.142343640482597,+ "command_injection": 7.359504483929905,+ "cross_site_scripting": 9.21235978041554,+ "file_upload": 8.081077628580905,+ "memory_corruption": 27.798734428024705,+ "path_traversal": 6.343802788838736,+ "request_forgery": 5.8287424753433505,+ "sql_injection": 9.629210186990765+ }}},"short": {- "accuracy": 0.8482142857142857,- "balanced_accuracy": 0.8482142857142857,- "p05_balanced_accuracy": 0.8084105544060255,+ "accuracy": 0.8616071428571429,+ "balanced_accuracy": 0.8616071428571429,+ "p05_balanced_accuracy": 0.8239439453942496,"passes": true,"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 8.248007139550978,+ "command_injection": 7.313660730780948,+ "cross_site_scripting": 6.348848754932183,+ "file_upload": 7.329521748236985,+ "memory_corruption": 20.727341579307215,+ "path_traversal": 8.282743680286892,+ "request_forgery": 6.911256286058866,+ "sql_injection": 7.439654223505508+ }}}},- "phrasing": "described"+ "phrasing": "concrete"}},"questions": {"attack_vector": {"dev": {- "accuracy": 0.9151785714285714,- "balanced_accuracy": 0.8291316526610644,+ "accuracy": 0.7053571428571429,+ "balanced_accuracy": 0.680672268907563,"bootstrap_p05": {- "accuracy_over_majority": 0.03125,- "balanced_accuracy": 0.7680791884816753+ "accuracy_over_majority": -0.1964285714285715,+ "balanced_accuracy": 0.6105820105820106},- "eligible": true,- "macro_f1": 0.888761994775463,+ "eligible": false,+ "macro_f1": 0.6233675373134329,"majority_accuracy": 0.84375,"n": 224,- "reasons": [],+ "reasons": [+ "balanced accuracy 0.681, 5th percentile 0.611",+ "accuracy over the majority answer -0.138, 5th percentile -0.196"+ ],"recall": {"adjacent": [1,1],"local": [- 24,+ 22,34],"network": [- 180,+ 135,189]}@@ -2102,55 +2945,57 @@},"remote_unauthenticated": {"dev": {- "accuracy": 0.7410714285714286,- "balanced_accuracy": 0.7294871794871796,+ "accuracy": 0.5446428571428571,+ "balanced_accuracy": 0.5743589743589743,"bootstrap_p05": {- "accuracy_over_majority": 0.1473214285714286,- "balanced_accuracy": 0.6792962356792144+ "accuracy_over_majority": -0.09375000000000006,+ "balanced_accuracy": 0.5470085470085471},"eligible": false,- "macro_f1": 0.7286096256684491,+ "macro_f1": 0.47012987012987006,"majority_accuracy": 0.5357142857142857,"n": 224,"reasons": [- "balanced accuracy 0.729, 5th percentile 0.679"+ "balanced accuracy 0.574, 5th percentile 0.547",+ "accuracy over the majority answer +0.009, 5th percentile -0.094",+ "true right 19 of 120"],"recall": {"false": [- 59,+ 103,104],"true": [- 107,+ 19,120]}},"rule": {- "cutoff": 0.46,+ "cutoff": 0.88,"kind": "cutoff"}},"weakness": {"dev": {- "accuracy": 0.875,- "balanced_accuracy": 0.875,+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,"bootstrap_p05": {- "accuracy_over_majority": 0.6696428571428572,- "balanced_accuracy": 0.8402927504309851+ "accuracy_over_majority": 0.6607142857142857,+ "balanced_accuracy": 0.8256002703013573},"eligible": true,- "macro_f1": 0.873976209735951,+ "macro_f1": 0.8661919471448787,"majority_accuracy": 0.125,"n": 224,"reasons": [],"recall": {"access_control": [- 26,+ 24,28],"command_injection": [- 26,+ 25,28],"cross_site_scripting": [@@ -2158,15 +3003,15 @@28],"file_upload": [- 15,+ 24,28],"memory_corruption": [- 25,+ 18,28],"path_traversal": [- 25,+ 24,28],"request_forgery": [@@ -2180,7 +3025,17 @@}},"rule": {- "kind": "argmax"+ "kind": "prior",+ "weights": {+ "access_control": 8.825749553762895,+ "command_injection": 7.636205151132178,+ "cross_site_scripting": 6.362523384719162,+ "file_upload": 7.488613055600675,+ "memory_corruption": 14.476685913631519,+ "path_traversal": 8.38722792467163,+ "request_forgery": 7.016359197069325,+ "sql_injection": 7.4513367610524135+ }}}}@@ -2978,7 +3833,7 @@},"cascade": {"backend": "gliformer-large",- "calls_per_record": 3.736607142857143,+ "calls_per_record": 2.0,"control": {"costs_less": false,"matches_smart": true,@@ -2989,8 +3844,8 @@"attack_vector": 1.01,"weakness": 0.95},- "escalate_to": "gliclass-large-v1",- "latency_ms_median": 178.985,+ "escalate_to": "gliclass-large-v1-one-call",+ "latency_ms_median": 73.175,"questions": {"attack_vector": {"accuracy": 0.9241071428571429,@@ -3347,9 +4202,9 @@}},"smart": {- "backend": "gliclass-large-v1",- "calls_per_record": 3.0,- "latency_ms_median": 139.19,+ "backend": "gliclass-large-v1-one-call",+ "calls_per_record": 1.0,+ "latency_ms_median": 27.96,"questions": {"attack_vector": {"accuracy": 0.9241071428571429,diff --git a/examples/typed-decisions/tuning.py b/examples/typed-decisions/tuning.pyindex eebc5adbb..eaa9eaf2b 100644--- a/examples/typed-decisions/tuning.py+++ b/examples/typed-decisions/tuning.py@@ -17,6 +17,9 @@ Per backend and question, tuning.json holds:and renormalisingdev the dev figures the choice was made onpage whether the question passes the page rule on dev, and why not++A backend entry of the form {"same_as": other} takes the other backend's+phrasing and rules as they are (tune.INHERITS says which)."""from __future__ import annotations@@ -40,8 +43,13 @@ def load(path: Path | None = None) -> dict[str, Any]:def entry(set_name: str, backend: str, tuning: dict[str, Any] | None = None) -> dict[str, Any] | None:+ """A backend's settings. An entry {"same_as": other} uses the other backend's, unchanged."""tuning = load() if tuning is None else tuning- return tuning.get("backends", {}).get(set_name, {}).get(backend)+ backends = tuning.get("backends", {}).get(set_name, {})+ found = backends.get(backend)+ if found is not None and "same_as" in found:+ return backends.get(found["same_as"])+ return founddef phrasing(set_name: str, backend: str, variant: str, tuning: dict[str, Any] | None = None) -> Phrasing: