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): add a typed-decisions verification example (#362)
svonavad4e00b3b3370
diff --git a/examples/README.md b/examples/README.mdindex fcf32f878..1f15a070d 100644--- a/examples/README.md+++ b/examples/README.md@@ -24,6 +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 || [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/.gitignore b/examples/typed-decisions/.gitignorenew file mode 100644index 000000000..65f1e7e5b--- /dev/null+++ b/examples/typed-decisions/.gitignore@@ -0,0 +1,5 @@+data/+run-output/+.venv/+__pycache__/+*.pycdiff --git a/examples/typed-decisions/PREREGISTRATION.md b/examples/typed-decisions/PREREGISTRATION.mdnew file mode 100644index 000000000..420651852--- /dev/null+++ b/examples/typed-decisions/PREREGISTRATION.md@@ -0,0 +1,315 @@+# Pre-registration++Everything here was settled on the dev records and committed before any test+record was sent in the tuned configuration. That covers the questions, every+backend's phrasing and decision rules, the page rule, what the page shows, how+its cards are chosen and the cascade's control. The code that applies each rule+is named next to it. The test slice is recorded once, against SIE server commit+`28a07f5`, which the manifest records.++## Inputs, frozen++`build_inputs.py` builds both case files. They were built once, on 2026-09-24+(UTC), and are frozen at these SHA-256 digests. The vulnerability file's+`questions` field was later regenerated from `questions.py`, before any+recording used it, and the records were left untouched. NVD records keep+changing after publication, so a later rebuild may differ; the published files+are these.++| File | SHA-256 |+|---|---|+| `inputs/vulnerability-triage/cases.json` | `54217dc3ea90863d49d719fd936c8506d3ef93b1eb8946829b5e7b2535358650` |+| `inputs/workflows/cases.json` | `165a41b3acaa3ca8878a9ab738396aca4095907ec430e8ce48d22e73cda84b2e` |++The vulnerability-triage records split by NVD publication date:++| Window | Records | Split |+|---|---|---|+| 2023-10-01 to 2023-10-31 | 20 per weakness class, 160 | dev |+| 2023-11-01 to 2023-11-15 | 8 per weakness class, 64 | dev |+| 2023-12-01 to 2023-12-31 | 20 per weakness class, 160 | test |++The October records were scored while the example was planned. That is why+they are in the dev pool and December is the test slice. No setting is chosen+on December.++The workflow set is the full 400-case test split of the typed-decisions+benchmark. It has no dev split, is not tuned, and every figure on it uses the+benchmark's own questions. Nothing from it goes on the page.++## The questions++A question belongs to a genre, not to a document: a question is kept or dropped+for every record alike, never for one record. Every backend is asked these+three about every record (`questions.py`):++| Question | Type | Gold, from the NVD record |+|---|---|---|+| `weakness` | pick one of 8 | the primary CWE, mapped to eight classes |+| `attack_vector` | pick one of 4 | CVSS v3.1 AV |+| `remote_unauthenticated` | yes or no | AV is network and PR is none |++GLiFormer is the exception: it is asked `weakness` and `attack_vector` only+(`questions.ASKED`). On dev, asked all three in one call, it confused+"exploitable remotely without a login" with "remotely over the network", and+its attack-vector answer collapsed to network.++These were asked on dev and dropped, for every record and backend, before this+freeze. A description rarely states them:+- user interaction, whether an account is needed, and the impact pattern.+ Each failed the page rule on dev, even for the Smart model.+- privileges required, and severity asked as a rubric. No model is asked a+ rubric question on this set.++**Severity is never asked.** `cvss.compose_severity` computes it in caller code+from a backend's three answers. It uses the CVSS v3.1 formula and tables in+`cvss.py`, fitted once on the dev records' NVD vectors:+- user interaction by weakness class;+- impact pattern by weakness class;+- privileges none when the record is exploitable remotely without a login,+ and low otherwise;+- attack complexity low.++It is scored on the exact level, never within one level. It is labelled+computed wherever it appears. It does not go on the page (see below).++## What is tuned on dev, and how (`tune.py`, `tuning.py`)++Every backend and question gets the same procedure.++1. **Phrasing.** Each question is recorded on dev in three phrasings:+ - `short`: option names only.+ - `described`: name and description.+ - `concrete`: the short names, with a concrete name where `questions.py`+ gives one:+ - memory corruption becomes "buffer overflow or out-of-bounds memory access";+ - the yes-or-no options become "anyone on the network can do it without an+ account" and "only a local user or a logged-in user can do it".++ For each phrasing, a decision rule is fitted (step 2) and judged by the page+ rule (step 3). A phrasing that passes is kept over one that does not, and+ among those, the one with the highest 5th-percentile balanced accuracy. When+ none passes, the one with the highest balanced accuracy is kept. Ties go to+ `described`, then `short`, then `concrete`. The kept mix is the `tuned`+ variant.++ Grouped GLiClass carries every question in one prompt, so its `described`+ phrasing (573 tokens) does not fit the 512-token window. It is recorded in+ `short` and `concrete` only.+2. **Decision rule.** The rule is refitted on a dev recording made in the tuned+ mix.+ - **Yes or no:** a cut-off on P(true), from 0.05 to 0.95 in steps of 0.01.+ Among cut-offs whose dev accuracy is at least the majority answer's, the+ one with the highest balanced accuracy wins. If none reaches that accuracy,+ the highest balanced accuracy wins. Ties go to the cut-off nearest 0.5.+ - **Pick one:** the plain top option, or the top option after dividing each+ option's probability by its mean over the dev records. The division uses+ no labels. It is kept only if all three of these hold:+ - it raises dev balanced accuracy;+ - accuracy stays at or above the majority answer's;+ - the worst recall among options with at least 10 dev records does not+ fall.+ - A backend that returns only its top option (GLiNER2 on pick-one questions)+ keeps it. The LLM returns a value, not a distribution, and gets no rule.+3. **The page rule, with margin.** A question passes for a backend or a lane+ when all of these hold on its dev answers, with its settings fixed:+ - In 1,000 bootstrap resamples (seed 20260924), the 5th percentile of+ balanced accuracy is at least 0.70.+ - The 5th percentile of accuracy minus the resample's majority-answer+ accuracy is at least 0.+ - Every option with at least 10 dev records is answered right at least 40%+ of the time.++ Balanced accuracy is the mean recall over the options with at least 10+ records. An option with one or two records would move it by a third or more+ on a single answer.++## What the page shows, fixed on dev (`page.py`)++**The board.** Three lanes, each one model on its own (`tune.LANES`):++| Lane | Backend | Model |+|---|---|---|+| Fast | `gliformer-large` | `knowledgator/gliformer-large-v1` |+| Smart | `gliclass-large-v1` | `knowledgator/gliclass-large-v1.0` |+| LLM | `qwen3-4b-instruct` | `Qwen/Qwen3-4B-Instruct-2507` |++**Which LLM.** Two Qwen models of the same size were recorded on dev with the+same call (the CVSS v3.1 base metrics and the weakness class as JSON), and+judged by the same page rule. `Qwen/Qwen3.5-4B` is named in the published SIE+Cloud prices, so it would carry a credit figure. It was to replace+`Qwen/Qwen3-4B-Instruct-2507` only if it passed the same questions. It did not:++| Model | `weakness` | `attack_vector` | `remote_unauthenticated` |+|---|---|---|---|+| `Qwen/Qwen3-4B-Instruct-2507` | fails: 0.674 | passes: 0.924 accuracy, 0.813 balanced, 5th pct 0.749 | passes: 0.817, 0.804, 5th pct 0.765 |+| `Qwen/Qwen3.5-4B` (non-speculative profile) | fails: 0.737, memory corruption 11 of 28 | passes: 0.924, 0.822, 5th pct 0.756 | fails: 0.688, 0.664, 5th pct 0.627; "needs local access or a login" right 35 of 104 |++The LLM row is `Qwen/Qwen3-4B-Instruct-2507` (`run.PAGE_LLM`). The prices do+not name it, so it gets no credit figure. `Qwen/Qwen3.5-4B` stays a dev-only+backend and is not recorded on test.++A lane shows a question only if it passed the page rule on dev. Any other+question is left out, and the foot counts it. On dev:++| Lane | `weakness` | `attack_vector` | `remote_unauthenticated` | severity, computed |+|---|---|---|---|---|+| Fast | left out: 0.728 balanced, 5th pct 0.685, cross-site scripting 9 of 28 | **shown**: 0.915 accuracy, 0.844 balanced, 5th pct 0.779 | not asked | not computed |+| Smart | **shown**: 0.879, 0.879, 5th pct 0.845 | **shown**: 0.924, 0.774, 5th pct 0.706 | **shown**: 0.821, 0.817, 5th pct 0.774 (cut-off 0.79) | left out: 0.638, 0.642, 5th pct 0.591 |+| LLM | left out: 0.674, file upload 8 of 28, memory corruption 7 of 28 | **shown**: 0.924, 0.813, 5th pct 0.749 | **shown**: 0.817, 0.804, 5th pct 0.765 | left out: 0.545, 0.525 |++**Why severity is left out.** No backend can pass it. Composed from the NVD+analyst's own answers to the three questions, the computed severity reaches+0.692 accuracy and 0.706 balanced accuracy on dev, with a 5th percentile of+0.657. The best lookup from those three answers to a level, fitted and scored+on dev, reaches only a 5th percentile of 0.718. The three questions a+description grounds do not carry enough of the vector.++**The figures row.** One row per question type, for Smart: how many answers it+got right, of how many, summed over its shown questions of that type.++**The cards.** There are three, in the order of `page.CARDS`:+1. A record anyone on the network can exploit without an account.+2. A record reachable over the network but only with an account.+3. A record exploitable only with local or physical access.++Each card is the first test record, in the order of+sha256("sie-typed-decisions-cards-v1:" + CVE id), that meets all of these:+- it meets the card's condition on its gold answers;+- its weakness class is not on an earlier card;+- every answer the card shows is right, from Fast's and Smart's shown+ questions;+- every answer the card shows is the model's own top option, so no decision+ rule changed it.++A card with no such record is dropped, and the page says so. A card cell holds+the returned answer and the probability the model returned for it, nothing+else. `page.py` refuses to emit a card that would show a miss.++**The catalog.** These backends, each with the questions it passed on dev:+- `gliclass-instruct-large`: weakness, attack vector.+- `laya`: weakness.+- `laya-typed-decisions`: weakness, and remote without a login.++**The totals line.** It gives the records shown on cards of the records+recorded, and each shown question's right-of-answered over the whole test+slice.++**Withdrawal on test.** The test slice gets the page rule on its point figures,+without the dev margin:+- balanced accuracy of at least 0.70;+- accuracy at or above the majority answer's;+- every option with at least 10 records right at least 40% of the time.++A shown question that fails any of these is withdrawn from every surface and+listed as withdrawn. Nothing else is removed after the test run.++**Time and cost.**+- Each lane's median time per record is labelled "a round trip, not a service+ level".+- A speed claim is made only when the slower median is at least 1.5 times the+ faster on test, comparing the same answers (`page.SPEED_MARGIN`). There are+ two comparisons:+ - Fast's one call against Smart's attack-vector request. On dev this is+ 1.02 times, so no claim is expected.+ - Smart's three requests against the LLM's one call. On dev this is about+ 19 times.+- Calls per record and every request are recorded. Cost in credits comes from+ a copy of the published SIE Cloud prices (`page.py --prices`). It applies+ only to a model the prices list, and only where its recorded responses carry+ the units it is billed in. No credit figure is given otherwise. On+ 2026-09-24 the prices (version `2026-09-05-production-bootstrap-v4`) list+ none of the three board models.++## The cascade, and its control (`tune.py lanes`)++The cascade runs Fast first and hands two kinds of answer to Smart:+- the questions Fast is not asked;+- any answer whose top probability is below a per-question cut-off.++It is gated on probability, never on whether an answer looks right. The cut-off+for each question is the lowest (least escalated) of 0.50 to 0.95 in steps of+0.05, or 1.01 (escalate all), that meets all of these on dev:+- accuracy at or above Smart's alone;+- balanced accuracy at or above Smart's alone;+- no record that Smart answers right is answered wrong.++The cascade then passes its control only if it also costs less than Smart alone,+in calls per record.++On dev:++| Question | Cut-off | Escalated | Cascade | Smart alone |+|---|---|---|---|---|+| weakness | 0.95 | 73.7% | 0.888 accuracy, 0.888 balanced | 0.879, 0.879 |+| attack vector | 1.01 | 100% | 0.924, 0.774 | 0.924, 0.774 |+| remote without a login | not asked of Fast | 100% | 0.821, 0.817 | 0.821, 0.817 |++It matches or beats Smart on every question, with zero regressions. But it+makes 3.74 calls per record against Smart's 3.00, so **it fails its control**.+It does not go on the page. The README reports it on test, under the same+control.++No LLM rung is added. The cascade fails before one would matter, and the LLM+does not pass weakness.++## Figures computed on the test slice only (`score.py`, `page.py`)++- Accuracy, balanced accuracy, macro-F1, Brier and ECE per backend and+ question, in the tuned configuration, with the majority answer beside them.+ This covers the computed severity, which is reported but not shown.+- Selective accuracy for pick-one questions. At each confidence cut-off in+ 0.5, 0.7, 0.8, 0.9 and 0.95, this is the number of records whose top option's+ probability, after the rule, is at least the cut-off, and how many of those+ are right.+- The page surfaces above, and any withdrawal.+- The cascade against Smart alone.++## The GLiFormer multi-task run (`multitask.py`)++- **Records.** The first 12 test records, in the order of+ sha256("sie-typed-decisions-multitask-v1:" + CVE id), whose NVD entry lists+ exactly one vulnerable CPE vendor and product, both written in the+ description after lowercasing and keeping only letters and digits.+- **Combined call.** One call per record, at threshold 0.1, carries:+ - entity labels vendor, product and version;+ - relation labels "made by" and "affects version";+ - an output schema with `affected_component` and root enums for weakness and+ attack vector.+- **Separate calls.** The same tasks, repeated as three calls.+- **Found.** An extracted product span counts as found when, after lowercasing+ and keeping only letters and digits, it equals the NVD CPE product, or one+ contains the other and the shorter has at least 4 characters.+- **Pass rule.**+ - Product found for at least 10 of 12 records.+ - The combined and separate calls agree on the weakness enum for at least 11+ of 12.+- **Reported, not claimed.** Vendor (matched the same way) and the+ attack-vector enum. These were settled on 12 dev records before the test run:+ - Threshold 0.1 found the most products (12 of 12, against 10 at 0.3).+ - The combined call found the vendor for only 3 of 12 at any threshold or+ label wording, because it folds the vendor into the product span.+ - The attack-vector enum came back for 1 of 12.+- **Nearest neighbours.** Every test record is embedded with the same model.+ The report is how often a record's nearest other record by cosine similarity+ has the same weakness class, against chance.++## Revisions before any test record was sent++This file was revised on dev only. None of these changes looked at a test+record:+- **Questions.** Five questions (two of them rubrics) became three, and severity+ is now computed rather than asked. The case file's `questions` field was+ regenerated to match, which changed its digest.+- **Page rule.** It gained the bootstrap margin and a class floor of 40%, up+ from a quarter. Balanced accuracy now counts only options with at least 10+ records.+- **Phrasing choice.** It now prefers a phrasing that passes the page rule.+- **Prior correction.** It may no longer lower the worst recall.+- **Yes-or-no cut-offs.** They run from 0.05 to 0.95.+- **Page design.** GLiFormer is asked two questions. The Fast lane is+ GLiFormer alone, and the cascade is judged against Smart alone. The LLM row,+ the card rule, the withdrawal rule and the speed margin were added.+- **LLM row.** `Qwen/Qwen3.5-4B` was checked on dev and kept out, because it+ fails the remote-without-login question that `Qwen/Qwen3-4B-Instruct-2507`+ passes.diff --git a/examples/typed-decisions/README.md b/examples/typed-decisions/README.mdnew file mode 100644index 000000000..a72b1d05d--- /dev/null+++ b/examples/typed-decisions/README.md@@ -0,0 +1,374 @@+# Answer several triage questions about one record, each with a probability++One record goes in with a few typed questions: pick one of N options, or a+yes-or-no check. Every answer comes back with a probability a program can+branch on. This example measures how well models served by SIE answer those+questions about public CVE records, against the NVD analysts' own assessments.+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 and+committed before the 160 test records were sent, in+[PREREGISTRATION.md](PREREGISTRATION.md). The test slice was then recorded+once, against SIE server commit `28a07f5`.++## What this shows++Three questions are asked of every CVE description:++| Question | Type | Gold, from the NVD record |+|---|---|---|+| `weakness` | pick one of 8 classes | the primary CWE, mapped to eight classes |+| `attack_vector` | pick one of 4 | CVSS v3.1 attack vector |+| `remote_unauthenticated` | yes or no: "anyone who can reach the system over the network can exploit this without logging in" | attack vector network and privileges none |++### The results on the 160 December 2023 test records++Each lane is one model. A cell is filled only where the model passed the+pre-registered page rule on the dev records, with a bootstrap margin (see+PREREGISTRATION.md). Right answers are out of 160; balanced accuracy is in+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 |++- **By question type:** Smart answered 289 of 320 pick-one questions and 115+ of 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.+- **The LLM gives no probabilities.** It returns values, so its answers carry+ none.+- **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.++GLiFormer is not asked the yes-or-no question. Asked all three in one call, it+confused "exploitable remotely without a login" with "remotely over the+network".++**More models, each on the questions it passed on dev:**++| Backend | Model | Vendor | Right of 160 |+|---|---|---|---|+| `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 |++`laya-typed-decisions` also passed the yes-or-no question on dev. On test its+balanced accuracy there fell to 0.673, below 0.70, so the pre-registered+withdrawal rule took it off every surface.++**Three records illustrate the answers.** They were chosen by the stated rule+in `page.py`, which picks one record for each argument:++| Record | Argument |+|---|---|+| CVE-2023-49378 | anyone on the network can exploit it without an account |+| CVE-2023-6826 | reachable over the network, but only with an account |+| CVE-2023-44278 | local access only |++Every answer shown on them is right, and each is the model's own top option.++### Also recorded, and not on the page++**A cascade.** Fast answers first. Smart answers what Fast is not asked, and+any answer whose top probability is below a cut-off fixed on dev. The cascade+passes its pre-registered control only if it meets all three of these against+Smart alone:+- it matches or beats Smart;+- it answers wrong no record that Smart answers right;+- it costs less.++On test:++| Question | Escalated to Smart | Cascade | Smart alone |+|---|---|---|---|+| weakness | 67.5% | 0.919 accuracy | 0.887 |+| attack vector | 100% | 0.919, 0.796 balanced | 0.919, 0.796 |+| 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.++**Severity, computed and never asked.** `cvss.compose_severity` scores every+combination of a backend's three answers with the CVSS v3.1 base-score formula,+weighted by their probabilities. The metrics a description rarely states come+from tables fitted on the dev records' NVD vectors, in `cvss.py`. The formula+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 |+| the LLM, from its whole CVSS vector | 0.675 | 0.613 |+| always the most common level | 0.463 | |++The three questions a description grounds do not carry enough of the vector,+so no backend passes. GLiNER2 returns only its top option on pick-one+questions, so no severity can be composed for it.++**A GLiFormer multi-task run.** On 12 pre-registered test records,+`multitask.py` asks one GLiFormer call for entities, relations and a typed+record together, and scores them against NVD's CPE vendor and product. This+recorded run did not meet its pre-registered bar. The product was found in 9+of 12 records, against a bar of 10. The combined and separate calls agreed on+the weakness class in 11 of 12, against a bar of 11. Nothing from it is+claimed.++**The workflow set.** This is the 400-case test split of the public+[typed-decisions benchmark](https://huggingface.co/datasets/LocalLLaMA/typed-decisions),+with five questions per case. Its gold is a teacher model's label, and the+benchmark's own card puts that teacher's self-agreement at 0.735.+`convaiinnovations/laya-typed-decisions` was fine-tuned on that benchmark's+training split, so it is a specialist scored against the teacher labels of its+own distribution. Every other backend is zero-shot.++| Backend | Accuracy over 2,000 decisions | Macro-F1 |+|---|---|---|+| `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 |+| `laya` (Convai Innovations), the base checkpoint | 0.360 | 0.239 |++### Every backend recorded++| Backend | Model | Vendor | How the questions are sent | Calls per record |+|---|---|---|---|---|+| `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` | `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 |+| `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 |+| `qwen3.5-4b` | `Qwen/Qwen3.5-4B`, through its non-speculative profile, which keeps the JSON schema enforced | Qwen | the same chat completion; recorded on dev only | 1 |++Every model is Apache-2.0. "One call" means one request per record. It says+nothing about how many encoder passes the server runs inside it.++A label classifier takes a text and a list of labels, so each label has to+carry its meaning (`questions.py` holds every rendering). A yes-or-no question+becomes two labels, and the workflow set's rubric questions become one label+per level. GLiNER2 in single-label mode returns only its top label, so it has+no Brier score for pick-one questions. GLiFormer scores each label+independently, so a missing label counts as zero, and each question's scores+are divided by their sum. That makes Brier and ECE computable, but not+calibrated.++`laya-package` and `laya-typed-decisions-package` run the same checkpoints+through the reference `laya==0.3.11` package at pinned revisions (`aa8c91ca`+and `bc76315b`). They are not in the plan; they check that SIE answers the way+the reference implementation does.++## Run it++The code is in this repository. The inputs and the recorded responses are in+the public Hugging Face dataset+[`superlinked/sie-task-evidence`](https://huggingface.co/datasets/superlinked/sie-task-evidence),+under `typed-decisions/`, so a clone alone is not enough. Fetch, then check and+score:++```sh+python3 fetch.py # downloads the pinned revision into data/+python3 run.py --check # rebuilds all 17,856 recorded requests from the inputs+python3 score.py # every backend and question on the test slice; asserts the published figures+python3 page.py # the page's lanes, cards, catalog and cascade; asserts what the page shows+python3 multitask.py --score --calls data/multitask/test.json+python3 -m unittest discover -s tests -v+```++These need nothing installed: they are standard library only, and none of them+needs an API key, a Hugging Face token or any inference spend. `fetch.py`+pins a commit SHA, not `main`, and checks every downloaded file against a+digest. It replaces `--dest` wholesale, so it refuses to touch anything+without the `.sie-evidence` marker it writes.++`python3 score.py --split dev` reports the dev records the settings were+chosen on. `python3 tune.py phrasing|rules|lanes --calls data/calls.json`+re-derives `tuning.json` from them. `run.py --show vulnerability-triage+CVE-2023-49378 gliclass-large-v1 tuned` prints the requests one record sends,+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.++```sh+uv sync --group build+uv run python build_inputs.py # rebuilds data/inputs/<set>/cases.json from the NVD and Hugging Face++BACKENDS="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"+URL=http://localhost:8080++# 1. Dev, every phrasing, then choose the phrasing per question+for b in $BACKENDS; do+ uv run python run.py --record --set vulnerability-triage --split dev --variant short described concrete \+ --backend $b --url $URL --out run-output/dev--$b.json+done+for b in qwen3-4b-instruct qwen3.5-4b; do+ uv run python run.py --record --set vulnerability-triage --split dev --backend $b \+ --url $URL --out run-output/dev--$b.json+done+python3 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+ uv run python run.py --record --set vulnerability-triage --split dev --variant tuned \+ --backend $b --url $URL --out run-output/dev-tuned--$b.json+done+python3 tune.py rules --calls run-output/dev-tuned--*.json+python3 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+done+for b in $BACKENDS; do+ uv run python run.py --record --set workflows --backend $b --url $URL+done+uv 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+```++Rebuilt inputs can differ from the published ones, because NVD records keep+changing after publication. Set `SIE_BASE_URL` (or pass `--url`) to point the+backends at another server, and `SIE_API_KEY` when that server needs one.+`--limit N` records the first N cases for a quick look and marks the recording+incomplete.++To compare SIE's Laya answers with the reference package, `uv sync --group laya`+and record `laya-package` and `laya-typed-decisions-package` the same way.+`score.py` reads both through the same normaliser. On a GPU the server runs+Laya in reduced precision, so the two agree on almost every top answer rather+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+and matched`. It fails if a call is missing, recorded twice, implied by no+case, or sent something other than what the inputs and `tuning.json` produce.++`score.py` prints, per set, the majority-option reference and then one block+per backend and question type:+- accuracy, macro-F1, Brier and ECE;+- for rubric questions, the mean absolute error of the expected level;+- latency per record;+- a per-question table.++It ends with `All 24 published figures reproduced.` and exits nonzero if any+figure in `PUBLISHED` stops reproducing.++`page.py` prints the lanes, the figures row, the cards, the catalog, the speed+claims and the cascade:++```+== page surfaces, test slice, 160 records+ fast knowledgator/gliformer-large-v1 attack_vector 144/160 (bal 0.873)+ llm Qwen/Qwen3-4B-Instruct-2507 attack_vector 150/160 (bal 0.867), remote_unauthenticated 129/160 (bal 0.815)+ smart knowledgator/gliclass-large-v1.0 attack_vector 147/160 (bal 0.796), remote_unauthenticated 115/160 (bal 0.725), weakness 142/160 (bal 0.887)+ figures choice: 289 of 320 over 2 question(s)+ figures noul: 115 of 160 over 1 question(s)+ card remote-no-login: CVE-2023-49378 (request_forgery)+ card network-needs-login: CVE-2023-6826 (file_upload)+ card local-access: CVE-2023-44278 (path_traversal)+ ...+ WITHDRAWN {'catalog': 'laya-typed-decisions', 'question': 'remote_unauthenticated', 'reasons': ['balanced accuracy 0.673']}++The page's cards, time medians, speed claims and withdrawals reproduced.+```++## What is in the dataset++```+typed-decisions/+ inputs/vulnerability-triage/cases.json 384 NVD records: description, gold, CVSS vector, CPE, source digest+ inputs/workflows/cases.json 400 typed-decisions benchmark cases with their questions and gold+ calls.json 17,856 calls: request digest, response, status, timing+ summary.json score.py's figures for every backend, set and split+ page.json page.py's surfaces on the test slice+ multitask/test.json the GLiFormer multi-task run and its 160 embeddings+ manifest.json server commit, hardware, models, plan, sources and terms, digests+```++`calls.json` keeps every response as it was recorded. Each request body is+stored as its SHA-256 (`body_sha256`), because the body is fully determined by+the inputs and `tuning.json`. `run.py --check` rebuilds every body and compares+digests, and `run.py --show` prints any of them. Dev calls are included, in+every phrasing, so the tuning can be re-derived.++## The two sets++### `vulnerability-triage`++CVE records from the [NVD CVE API 2.0](https://nvd.nist.gov/developers/vulnerabilities).+The model reads the English description and nothing else. The gold answers are+the NVD analyst's own:+- the primary CWE, mapped to eight weakness classes in `build_inputs.py`;+- the CVSS v3.1 attack vector;+- whether the record is exploitable over the network without privileges;+- the base severity.++The selection rule is in `build_inputs.py` and was fixed before any model call.+Records are taken from three publication windows: October 2023 and 1 to 15+November 2023 (224 dev records), and December 2023 (160 test records), 48 per+weakness class in all. Each record must meet all of these:+- it is not rejected;+- it has exactly one NVD primary CVSS v3.1 metric;+- it has exactly one NVD CWE in the mapped set;+- it has an ASCII English description of 12 to 150 words.++Records are ordered by a salted SHA-256 of the CVE id, and the first N per+class in each window are taken. No record was chosen or dropped by hand.++This product uses data from the NVD API but is not endorsed or certified by the+NVD. CVE descriptions are used under the+[CVE Program Terms of Use](https://www.cve.org/Legal/TermsOfUse): Copyright (c)+1999-2026, The MITRE Corporation. CVE is a trademark and the CVE logo is a+registered trademark of The MITRE Corporation. `manifest.json` carries the+license text in full.++### `workflows`++The `test` split of the [typed-decisions benchmark](https://huggingface.co/datasets/LocalLLaMA/typed-decisions)+at commit `c76749ec58bd8c3d2ea706b31c333a9059c38f90`, used under Apache-2.0.+The states are synthetic: a model wrote the text around sampled scenario+factors. `cases.json` reformats 100 rows per workflow, in salted-hash order,+and changes no text. It has no dev split and is not tuned.++## What this does NOT establish++- **Nothing about served latency.** A median is a round trip on one machine,+ one record at a time, not a service level.+- **Nothing about correctness on the workflow set.** Its gold is a teacher+ model's answer to synthetic states, and the one strong score there comes+ from a checkpoint fine-tuned on that benchmark.+- **Nothing about the CVSS fields a description does not state.** NVD analysts+ also read vendor advisories and code. That is why severity is computed from+ three grounded answers and fixed tables, and why it still falls short.+- **Nothing about other phrasings or questions.** Each question got three+ phrasings, and each backend kept the one it did best with on dev. A+ different wording, or a question dropped on dev, could move any row.+- **No calibration claim.** A decision rule is chosen for accuracy on dev, not+ to make the probabilities calibrated.+- **Nothing about rare attack vectors.** The test slice has 130 network+ records, 27 local, 2 adjacent and 1 physical. Balanced accuracy counts only+ options with at least 10 records, so it covers network and local.+- **Nothing about the end of a long record, for GLiClass.** GLiClass requests+ ask SIE to cut the record text, never the labels, when both do not fit in 512+ tokens.+- **Nothing about calibration for `laya-multilingual`.** It is defined in+ `run.py` but not in the plan, and it ships no temperature table.diff --git a/examples/typed-decisions/build_inputs.py b/examples/typed-decisions/build_inputs.pynew file mode 100644index 000000000..fa37a5ccb--- /dev/null+++ b/examples/typed-decisions/build_inputs.py@@ -0,0 +1,355 @@+#!/usr/bin/env python3+"""Build the two case files from their public sources, by a rule fixed before any model call.++ uv sync --group build+ uv run python build_inputs.py # writes data/inputs/<set>/cases.json++Readers normally never run this: once the evidence is published, fetch.py+downloads the same files at a pinned revision. It is here so the selection can+be audited and rebuilt.++Two sets.++vulnerability-triage+ CVE records from the NVD API 2.0, with the NVD analyst's own assessment as+ the gold answer: the primary CWE decides `weakness`, the CVSS v3.1 vector+ decides `attack_vector`, `user_interaction` and `privileges_required`, and+ the CVSS base severity decides `severity`. `needs_account`,+ `remote_unauthenticated` and `impact` are read off the same vector+ (cvss.py). The model sees the English description and nothing else.++ Three windows, by publication date (UTC):++ 2023-10 2023-10-01 to 2023-10-31 dev, 20 per weakness class+ 2023-11a 2023-11-01 to 2023-11-15 dev, 8 per weakness class+ 2023-12 2023-12-01 to 2023-12-31 test, 20 per weakness class++ Everything that is tuned (phrasing, yes-or-no cut-offs, choice prior+ corrections) is chosen on the 224 dev records only. The December records+ are the held-out test slice: they were added after the October slice had+ been looked at, and no setting is chosen on them.++ A record is eligible when it is not rejected; has exactly one CVSS v3.1+ metric of type Primary from [email protected]; has exactly one CWE from+ [email protected] and that CWE is in CWE_CLASS below; has exactly one English+ description of 12 to 150 words, ASCII only. Eligible records are ordered by+ sha256("sie-typed-decisions-nvd-v1:" + CVE id) and the first N per weakness+ class are taken from each window. No record is chosen or dropped by hand.++ Each case also carries the vendor and product of every vulnerable CPE NVD+ lists for it, which the GLiFormer multi-task run (multitask.py) scores+ against.++ NVD records keep changing after publication. The rebuilt file records each+ record's `lastModified` and a digest of the fields used, so drift between a+ rebuild and the published inputs shows up as a different digest rather than+ as a different score.++workflows+ The `test` split of the typed-decisions benchmark on Hugging Face, pinned to+ a commit, four workflows. Each case carries its own state and five questions+ in the source's exact shape, and its gold is the benchmark's: the mean of+ three samples from a teacher model, reduced to the argmax label. A score here+ measures agreement with that teacher, not correctness.++ All 400 test cases are taken, 100 per workflow, ordered by+ sha256("sie-typed-decisions-workflows-v1:" + case id).+"""++from __future__ import annotations++import argparse+import hashlib+import io+import json+import re+import sys+import time+import urllib.parse+import urllib.request+from collections import defaultdict+from datetime import UTC, datetime+from pathlib import Path+from typing import Any++from cvss import derived_gold+from questions import (+ VULNERABILITY_QUESTIONS,+ VULNERABILITY_TRIAGE,+ WORKFLOWS,+ from_source_question,+ keys,+ typed_questions,+)++NVD_API = "https://services.nvd.nist.gov/rest/json/cves/2.0"+# window id -> (split, first publication date, last publication date, records per weakness class)+NVD_WINDOWS = {+ "2023-10": ("dev", "2023-10-01T00:00:00.000", "2023-10-31T23:59:59.999", 20),+ "2023-11a": ("dev", "2023-11-01T00:00:00.000", "2023-11-15T23:59:59.999", 8),+ "2023-12": ("test", "2023-12-01T00:00:00.000", "2023-12-31T23:59:59.999", 20),+}+NVD_SALT = "sie-typed-decisions-nvd-v1:"+NVD_PAGE_SIZE = 2000+# NVD asks unauthenticated clients for no more than 5 requests in 30 seconds.+NVD_PAUSE_S = 6.5++CWE_CLASS = {+ "CWE-79": "cross_site_scripting",+ "CWE-89": "sql_injection",+ "CWE-119": "memory_corruption",+ "CWE-120": "memory_corruption",+ "CWE-121": "memory_corruption",+ "CWE-122": "memory_corruption",+ "CWE-125": "memory_corruption",+ "CWE-416": "memory_corruption",+ "CWE-787": "memory_corruption",+ "CWE-77": "command_injection",+ "CWE-78": "command_injection",+ "CWE-94": "command_injection",+ "CWE-22": "path_traversal",+ "CWE-352": "request_forgery",+ "CWE-285": "access_control",+ "CWE-287": "access_control",+ "CWE-306": "access_control",+ "CWE-639": "access_control",+ "CWE-862": "access_control",+ "CWE-863": "access_control",+ "CWE-434": "file_upload",+}+ATTACK_VECTOR = {"NETWORK": "network", "ADJACENT_NETWORK": "adjacent", "LOCAL": "local", "PHYSICAL": "physical"}+USER_INTERACTION = {"NONE": "false", "REQUIRED": "true"}+PRIVILEGES = {"NONE": "0", "LOW": "1", "HIGH": "2"}+SEVERITY = {"LOW": "0", "MEDIUM": "1", "HIGH": "2", "CRITICAL": "3"}+MIN_WORDS, MAX_WORDS = 12, 150++WORKFLOW_DATASET = "LocalLLaMA/typed-decisions"+WORKFLOW_REVISION = "c76749ec58bd8c3d2ea706b31c333a9059c38f90"+WORKFLOW_FILE = "all/test-00000-of-00001.parquet"+WORKFLOW_SALT = "sie-typed-decisions-workflows-v1:"+WORKFLOW_PER_WORKFLOW = 100+++def http_get(url: str) -> bytes:+ request = urllib.request.Request(url, headers={"Accept": "*/*", "User-Agent": "sie-typed-decisions-example"}) # noqa: S310+ with urllib.request.urlopen(request, timeout=300) as response: # noqa: S310+ return response.read()+++def sha256(payload: bytes | str) -> str:+ if isinstance(payload, str):+ payload = payload.encode("utf-8")+ return hashlib.sha256(payload).hexdigest()+++def canonical(value: Any) -> str:+ return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=False)+++def nvd_window(start: str, end: str) -> tuple[list[dict[str, Any]], list[str]]:+ records: list[dict[str, Any]] = []+ urls: list[str] = []+ index = 0+ while True:+ query = urllib.parse.urlencode(+ {"pubStartDate": start, "pubEndDate": end, "resultsPerPage": NVD_PAGE_SIZE, "startIndex": index}+ )+ url = f"{NVD_API}?{query}"+ urls.append(url)+ page = json.loads(http_get(url))+ records.extend(entry["cve"] for entry in page["vulnerabilities"])+ index += page["resultsPerPage"]+ if index >= page["totalResults"]:+ return records, urls+ time.sleep(NVD_PAUSE_S)+++def nvd_case(record: dict[str, Any]) -> dict[str, Any] | None:+ """One eligible record as a case, or None when the rule excludes it."""+ if record.get("vulnStatus") == "Rejected":+ return None+ metrics = [+ metric+ for metric in record.get("metrics", {}).get("cvssMetricV31", [])+ if metric.get("type") == "Primary" and metric.get("source") == "[email protected]"+ ]+ if len(metrics) != 1:+ return None+ cwes = sorted(+ {+ description["value"]+ for weakness in record.get("weaknesses", [])+ if weakness.get("source") == "[email protected]"+ for description in weakness["description"]+ }+ )+ if len(cwes) != 1 or cwes[0] not in CWE_CLASS:+ return None+ english = [entry["value"] for entry in record.get("descriptions", []) if entry.get("lang") == "en"]+ if len(english) != 1:+ return None+ text = re.sub(r"\s+", " ", english[0]).strip()+ if not text.isascii() or not MIN_WORDS <= len(text.split()) <= MAX_WORDS:+ return None+ cvss = metrics[0]["cvssData"]+ used = {"description": text, "cwe": cwes[0], "cvss": cvss}+ cpes = sorted(+ {+ tuple(match["criteria"].split(":")[3:5])+ for node in (configuration.get("nodes", []) for configuration in record.get("configurations", []))+ for part in node+ for match in part.get("cpeMatch", [])+ if match.get("vulnerable") and match.get("criteria", "").startswith("cpe:2.3:")+ }+ )+ return {+ "slug": record["id"],+ "state": text,+ "gold": {+ "weakness": CWE_CLASS[cwes[0]],+ "attack_vector": ATTACK_VECTOR[cvss["attackVector"]],+ "user_interaction": USER_INTERACTION[cvss["userInteraction"]],+ "privileges_required": PRIVILEGES[cvss["privilegesRequired"]],+ "severity": SEVERITY[cvss["baseSeverity"]],+ **derived_gold(cvss["vectorString"]),+ },+ "source": {+ "url": f"https://nvd.nist.gov/vuln/detail/{record['id']}",+ "published": record["published"],+ "last_modified": record["lastModified"],+ "cwe": cwes[0],+ "cvss_vector": cvss["vectorString"],+ "cvss_base_score": cvss["baseScore"],+ "used_fields_sha256": sha256(canonical(used)),+ "cpe_vendor_product": [list(pair) for pair in cpes],+ },+ }+++def build_vulnerability_triage() -> dict[str, Any]:+ cases: list[dict[str, Any]] = []+ queries: dict[str, list[str]] = {}+ counts: dict[str, dict[str, int]] = {}+ for window, (split, start, end, per_class) in NVD_WINDOWS.items():+ records, urls = nvd_window(start, end)+ queries[window] = urls+ eligible: dict[str, list[dict[str, Any]]] = defaultdict(list)+ for record in records:+ case = nvd_case(record)+ if case is not None:+ eligible[case["gold"]["weakness"]].append(case)+ counts[window] = {"retrieved": len(records), **{key: len(value) for key, value in sorted(eligible.items())}}+ for weakness in keys(VULNERABILITY_QUESTIONS["weakness"]):+ ordered = sorted(eligible[weakness], key=lambda case: sha256(NVD_SALT + case["slug"]))+ if len(ordered) < per_class:+ raise SystemExit(f"{window}: only {len(ordered)} eligible {weakness} records")+ for case in ordered[:per_class]:+ cases.append({**case, "split": split, "window": window})+ time.sleep(NVD_PAUSE_S)+ return {+ "set": VULNERABILITY_TRIAGE,+ "built_at": datetime.now(UTC).isoformat(timespec="seconds"),+ "source": {+ "name": "National Vulnerability Database (NVD), CVE API 2.0",+ "queries": queries,+ "eligible_counts": counts,+ "terms": (+ "This product uses data from the NVD API but is not endorsed or certified by the NVD. "+ "CVE descriptions are used under the CVE Program Terms of Use."+ ),+ },+ "rule": {+ "salt": NVD_SALT,+ "windows": {+ window: {"split": v[0], "from": v[1], "to": v[2], "per_class": v[3]}+ for window, v in NVD_WINDOWS.items()+ },+ "words": [MIN_WORDS, MAX_WORDS],+ "cwe_class": CWE_CLASS,+ "gold_maps": {+ "attack_vector": ATTACK_VECTOR,+ "user_interaction": USER_INTERACTION,+ "privileges_required": PRIVILEGES,+ "severity": SEVERITY,+ },+ },+ "questions": VULNERABILITY_QUESTIONS,+ "cases": cases,+ }+++def build_workflows() -> dict[str, Any]:+ # Optional dependency: only this builder reads parquet.+ import pyarrow.parquet as pq # noqa: PLC0415++ url = f"https://huggingface.co/datasets/{WORKFLOW_DATASET}/resolve/{WORKFLOW_REVISION}/{WORKFLOW_FILE}"+ payload = http_get(url)+ rows = pq.read_table(io.BytesIO(payload)).to_pylist()++ workflow_questions: dict[str, dict[str, Any]] = {}+ by_workflow: dict[str, list[dict[str, Any]]] = defaultdict(list)+ for row in rows:+ source_questions = json.loads(row["questions"])+ converted = {qid: from_source_question(question) for qid, question in source_questions.items()}+ rendered, _ = typed_questions(converted, "described")+ if rendered != source_questions:+ raise SystemExit(f"{row['id']}: questions do not round-trip through the converter")+ known = workflow_questions.setdefault(row["workflow"], source_questions)+ if known != source_questions:+ raise SystemExit(f"{row['id']}: questions differ from the rest of {row['workflow']}")+ gold = json.loads(row["gold"])+ by_workflow[row["workflow"]].append(+ {+ "slug": row["id"],+ "split": "test",+ "workflow": row["workflow"],+ "state": json.loads(row["state"]),+ "gold": {qid: str(answer["label"]) for qid, answer in gold.items()},+ "gold_probabilities": {qid: answer["probabilities"] for qid, answer in gold.items()},+ }+ )++ cases: list[dict[str, Any]] = []+ for workflow in sorted(by_workflow):+ ordered = sorted(by_workflow[workflow], key=lambda case: sha256(WORKFLOW_SALT + case["slug"]))+ cases.extend(ordered[:WORKFLOW_PER_WORKFLOW])+ return {+ "set": WORKFLOWS,+ "built_at": datetime.now(UTC).isoformat(timespec="seconds"),+ "source": {+ "name": "typed-decisions benchmark, test split",+ "dataset": WORKFLOW_DATASET,+ "revision": WORKFLOW_REVISION,+ "file": WORKFLOW_FILE,+ "file_sha256": sha256(payload),+ "license": "Apache-2.0",+ "gold": "mean of three teacher-model samples; the argmax label is scored",+ },+ "rule": {"salt": WORKFLOW_SALT, "per_workflow": WORKFLOW_PER_WORKFLOW},+ "questions": {workflow: workflow_questions[workflow] for workflow in sorted(workflow_questions)},+ "cases": cases,+ }+++def write(path: Path, payload: dict[str, Any]) -> None:+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")+ print(f"wrote {path}: {len(payload['cases'])} cases")+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--data", default="data", help="output directory (default: data)")+ parser.add_argument("--set", choices=[VULNERABILITY_TRIAGE, WORKFLOWS], action="append", help="build one set")+ args = parser.parse_args()+ wanted = args.set or [VULNERABILITY_TRIAGE, WORKFLOWS]+ data_dir = Path(args.data)+ if VULNERABILITY_TRIAGE in wanted:+ write(data_dir / f"inputs/{VULNERABILITY_TRIAGE}/cases.json", build_vulnerability_triage())+ if WORKFLOWS in wanted:+ write(data_dir / f"inputs/{WORKFLOWS}/cases.json", build_workflows())+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/cvss.py b/examples/typed-decisions/cvss.pynew file mode 100644index 000000000..fa278e51a--- /dev/null+++ b/examples/typed-decisions/cvss.py@@ -0,0 +1,197 @@+"""CVSS v3.1 base scores, and the NVD-derived gold for the questions built on them.++Standard library only. The formula follows the CVSS v3.1 specification from+FIRST (section 7.1, and Appendix A for Roundup). It reproduces NVD's recorded+base score for every record in the case file; tests/test_example.py checks a+set of published vectors.++Used two ways:+ build_inputs.py derives the gold answers of the questions that are read off+ a record's CVSS vector (needs_account, remote_unauthenticated,+ impact)+ score.py composes a severity from a model's answers to the component+ questions, with the same formula+"""++from __future__ import annotations++import math+from itertools import product++AV = {"N": 0.85, "A": 0.62, "L": 0.55, "P": 0.2}+AC = {"L": 0.77, "H": 0.44}+UI = {"N": 0.85, "R": 0.62}+CIA = {"H": 0.56, "L": 0.22, "N": 0.0}++# The impact patterns the `impact` question offers: (scope, confidentiality,+# integrity, availability). Together they are the exact vector of 200 of the+# 224 dev records; `impact_pattern` maps the rest to the nearest one.+IMPACT_PATTERNS = {+ "full_compromise": ("U", "H", "H", "H"),+ "data_exposure": ("U", "H", "N", "N"),+ "browser_script": ("C", "L", "L", "N"),+ "limited_change": ("U", "N", "L", "N"),+ "denial_of_service": ("U", "N", "N", "H"),+ "tampering": ("U", "N", "H", "N"),+}+SEVERITY_LEVELS = ("0", "1", "2", "3") # low, medium, high, critical+++def parse(vector: str) -> dict[str, str]:+ """`CVSS:3.1/AV:N/AC:L/...` -> {"AV": "N", "AC": "L", ...}."""+ return dict(part.split(":") for part in vector.split("/")[1:])+++def roundup(value: float) -> float:+ """CVSS v3.1 Appendix A: the smallest number, to one decimal, not less than `value`."""+ integer = round(value * 100000)+ if integer % 10000 == 0:+ return integer / 100000.0+ return (math.floor(integer / 10000) + 1) / 10.0+++def privileges_weight(privileges: str, scope: str) -> float:+ if privileges == "N":+ return 0.85+ if privileges == "L":+ return 0.68 if scope == "C" else 0.62+ return 0.5 if scope == "C" else 0.27+++def impact_subscore(confidentiality: str, integrity: str, availability: str) -> float:+ return 1 - (1 - CIA[confidentiality]) * (1 - CIA[integrity]) * (1 - CIA[availability])+++def base_score(metrics: dict[str, str]) -> float:+ iss = impact_subscore(metrics["C"], metrics["I"], metrics["A"])+ if metrics["S"] == "U":+ impact = 6.42 * iss+ else:+ impact = 7.52 * (iss - 0.029) - 3.25 * (iss - 0.02) ** 15+ exploitability = (+ 8.22+ * AV[metrics["AV"]]+ * AC[metrics["AC"]]+ * privileges_weight(metrics["PR"], metrics["S"])+ * UI[metrics["UI"]]+ )+ if impact <= 0:+ return 0.0+ if metrics["S"] == "U":+ return roundup(min(impact + exploitability, 10))+ return roundup(min(1.08 * (impact + exploitability), 10))+++def severity(score: float) -> str | None:+ """NVD's qualitative rating, as the level keys the severity rubric uses; None for a score of 0."""+ if score == 0:+ return None+ if score < 4.0:+ return "0"+ if score < 7.0:+ return "1"+ if score < 9.0:+ return "2"+ return "3"+++def impact_pattern(metrics: dict[str, str]) -> str:+ """The impact pattern a vector has, or the nearest one.++ Nearest: the smallest difference in impact subscore, plus 0.5 when the+ scope differs, then the fewest differing C/I/A letters, then the order of+ IMPACT_PATTERNS.+ """+ record = (metrics["S"], metrics["C"], metrics["I"], metrics["A"])+ for key, pattern in IMPACT_PATTERNS.items():+ if pattern == record:+ return key+ record_iss = impact_subscore(*record[1:])++ def distance(item: tuple[int, tuple[str, tuple[str, ...]]]) -> tuple[float, int, int]:+ order, (_, pattern) = item+ gap = abs(impact_subscore(*pattern[1:]) - record_iss) + (0.5 if pattern[0] != record[0] else 0.0)+ letters = sum(a != b for a, b in zip(pattern[1:], record[1:]))+ return (round(gap, 9), letters, order)++ _, (key, _) = min(enumerate(IMPACT_PATTERNS.items()), key=distance)+ return key+++def derived_gold(vector: str) -> dict[str, str]:+ """Gold answers read off a CVSS v3.1 vector."""+ metrics = parse(vector)+ return {+ "needs_account": "true" if metrics["PR"] != "N" else "false",+ "remote_unauthenticated": "true" if metrics["AV"] == "N" and metrics["PR"] == "N" else "false",+ "impact": impact_pattern(metrics),+ }+++# Composition. A severity is computed from three asked answers: the weakness+# class, the attack vector, and whether the record can be exploited remotely+# without a login. The other base metrics come from fixed tables, fitted once on+# the 224 dev records' NVD vectors and frozen before any test record was sent:+# user interaction required for the two classes that need a victim to act+# (cross-site scripting 28 of 28 dev records, request+# forgery 26 of 28), none for every other class+# impact the pattern each weakness class most often has on dev+# (path traversal is a 12-12 tie, broken by IMPACT_PATTERNS+# order)+# privileges none when the record is exploitable remotely without a+# login, otherwise low (low or high on 100 of the 104 dev+# records that are not)+# attack complexity low (221 of 224 dev records)+ATTACK_VECTOR = {"network": "N", "adjacent": "A", "local": "L", "physical": "P"}+USER_INTERACTION_BY_WEAKNESS = {+ "cross_site_scripting": "R",+ "sql_injection": "N",+ "memory_corruption": "N",+ "command_injection": "N",+ "path_traversal": "N",+ "request_forgery": "R",+ "access_control": "N",+ "file_upload": "N",+}+IMPACT_BY_WEAKNESS = {+ "cross_site_scripting": "browser_script",+ "sql_injection": "full_compromise",+ "memory_corruption": "full_compromise",+ "command_injection": "full_compromise",+ "path_traversal": "full_compromise",+ "request_forgery": "full_compromise",+ "access_control": "data_exposure",+ "file_upload": "full_compromise",+}+++def compose_severity(+ weakness: dict[str, float], attack_vector: dict[str, float], remote_unauthenticated: dict[str, float]+) -> dict[str, float]:+ """A distribution over severity levels from the three answers' distributions.++ Every combination of answers is scored with the CVSS formula, the other+ metrics taken from the tables above, and weighted by the product of the+ answers' probabilities, as if the answers were independent.+ """+ levels = dict.fromkeys(SEVERITY_LEVELS, 0.0)+ for (w, p_w), (av, p_av), (remote, p_r) in product(+ weakness.items(), attack_vector.items(), remote_unauthenticated.items()+ ):+ weight = p_w * p_av * p_r+ if weight == 0:+ continue+ scope, confidentiality, integrity, availability = IMPACT_PATTERNS[IMPACT_BY_WEAKNESS[w]]+ metrics = {+ "AV": ATTACK_VECTOR[av],+ "AC": "L",+ "PR": "N" if remote == "true" else "L",+ "UI": USER_INTERACTION_BY_WEAKNESS[w],+ "S": scope,+ "C": confidentiality,+ "I": integrity,+ "A": availability,+ }+ levels[severity(base_score(metrics))] += weight+ total = sum(levels.values())+ return {level: value / total for level, value in levels.items()}diff --git a/examples/typed-decisions/fetch.py b/examples/typed-decisions/fetch.pynew file mode 100755index 000000000..879a997e8--- /dev/null+++ b/examples/typed-decisions/fetch.py@@ -0,0 +1,213 @@+#!/usr/bin/env python3+"""Download the recorded typed-decisions evidence from a pinned dataset revision.++ python3 fetch.py [--dest data]++Standard library only. No API key, no Hugging Face token, no inference spend.+The dataset is public and anonymous-readable.++REVISION is a commit SHA, never a branch. `main` moves; a SHA does not.++Every downloaded file is checked against a digest before the scorer sees it.+The chain is anchored in this file: MANIFEST_SHA256 pins manifest.json,+manifest.json pins calls.json and every input file. A file that is missing or+that fails its digest is a FAILURE, never a skip, and the script exits+nonzero without writing a partial tree the scorer could mistake for complete.++This script replaces `--dest` wholesale, so it refuses to touch anything it did+not write. A directory qualifies only when it holds a `.sie-evidence` marker naming+this dataset and task, and never when it is the working directory, an ancestor+of it, your home directory or the filesystem root. Anything else stops the run+with an explanation rather than being deleted.++The replacement itself is two renames, not a delete and a copy: the old+directory is renamed aside, the verified download is renamed into place, and+only then is the old one removed. If the second rename fails the first is+undone, so a reader is never left with neither.+"""++from __future__ import annotations++import argparse+import hashlib+import json+import os+import shutil+import sys+import tempfile+import urllib.error+import urllib.request+from pathlib import Path++DATASET = "superlinked/sie-task-evidence"+TASK = "typed-decisions"+REVISION = "30b05245e375f15cc87aa37a1705c4aad0d26f45"+MANIFEST_SHA256 = "24131629767bfb1d3db5c2596f153d994fb56c781c322c80dba93f18c338acfc"++BASE = f"https://huggingface.co/datasets/{DATASET}/resolve/{REVISION}/{TASK}"+HTTP_OK = 200+MARKER_NAME = ".sie-evidence"+++def download(relative_path: str) -> bytes:+ url = f"{BASE}/{relative_path}"+ request = urllib.request.Request(url, headers={"Accept": "*/*"}) # noqa: S310+ try:+ with urllib.request.urlopen(request, timeout=120) as response: # noqa: S310+ if response.status != HTTP_OK:+ raise RuntimeError(f"{url} returned HTTP {response.status}")+ return response.read()+ except urllib.error.HTTPError as error:+ raise RuntimeError(f"{url} returned HTTP {error.code}") from error+ except urllib.error.URLError as error:+ raise RuntimeError(f"{url} could not be reached: {error.reason}") from error+++def digest(payload: bytes) -> str:+ return hashlib.sha256(payload).hexdigest()+++def marker_bytes() -> bytes:+ """What marks a directory as this script's to replace."""+ return (+ json.dumps(+ {"written_by": "fetch.py", "dataset": DATASET, "task": TASK, "revision": REVISION},+ indent=2,+ )+ + "\n"+ ).encode("utf-8")+++def refuse_reason(dest: Path) -> str | None:+ """Why `dest` must not be replaced, or None when replacing it is safe.++ Checked before anything is downloaded and again before the swap.+ """+ resolved = dest.resolve()+ cwd = Path.cwd().resolve()+ # These hold whatever the marker says. A marker can be planted; the+ # working tree still must not be removable by a --dest typo.+ if resolved == resolved.parent:+ return f"{resolved} is the filesystem root"+ if resolved == cwd:+ return f"{resolved} is the current working directory"+ if resolved in cwd.parents:+ return f"{resolved} contains the current working directory"+ if resolved == Path.home().resolve():+ return f"{resolved} is your home directory"++ if dest.is_symlink():+ return f"{dest} is a symlink"+ if not dest.exists():+ return None+ if not dest.is_dir():+ return f"{dest} exists and is not a directory"++ marker = dest / MARKER_NAME+ if not marker.is_file():+ return (+ f"{dest} exists but holds no {MARKER_NAME}, so this script did not write it. "+ f"Move it aside, or pass --dest somewhere else."+ )+ try:+ recorded = json.loads(marker.read_text(encoding="utf-8"))+ except (OSError, ValueError) as error:+ return f"{dest}/{MARKER_NAME} could not be read: {error}"+ if recorded.get("dataset") != DATASET or recorded.get("task") != TASK:+ return f"{dest}/{MARKER_NAME} names {recorded.get('dataset')}/{recorded.get('task')}, not {DATASET}/{TASK}"+ return None+++def swap_into_place(staging: Path, dest: Path) -> None:+ """Put `staging` at `dest` without deleting anything first.++ Both live in the same parent, so each rename is atomic and cannot half+ happen. The previous directory is only removed once the new one is in+ place; if that fails, the previous one goes back.+ """+ previous = None+ if dest.exists():+ previous = dest.with_name(f"{dest.name}.previous-{os.getpid()}")+ if previous.exists():+ shutil.rmtree(previous)+ dest.replace(previous)+ try:+ staging.replace(dest)+ except OSError:+ if previous is not None:+ previous.replace(dest)+ raise+ if previous is not None:+ shutil.rmtree(previous, ignore_errors=True)+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--dest", default="data", help="output directory (default: data)")+ args = parser.parse_args()++ if not REVISION or not MANIFEST_SHA256:+ print(+ f"The {TASK} evidence is not published to {DATASET} yet, so there is nothing to fetch.\n"+ "Build the inputs with build_inputs.py and record with run.py --record; see the README.",+ file=sys.stderr,+ )+ return 1++ dest = Path(args.dest)+ reason = refuse_reason(dest)+ if reason is not None:+ print(f"refusing to replace {dest}: {reason}", file=sys.stderr)+ return 1++ dest.parent.mkdir(parents=True, exist_ok=True)++ manifest_bytes = download("manifest.json")+ if digest(manifest_bytes) != MANIFEST_SHA256:+ print(+ f"manifest.json digest is {digest(manifest_bytes)}, expected {MANIFEST_SHA256}",+ file=sys.stderr,+ )+ return 1+ manifest = json.loads(manifest_bytes)++ files = manifest["files_sha256"]+ # Staged beside the destination, so the swap below is a rename on one+ # filesystem rather than a copy that can fail half way.+ staging = Path(tempfile.mkdtemp(prefix=f".{TASK}-evidence-", dir=dest.parent))+ try:+ (staging / "manifest.json").write_bytes(manifest_bytes)+ for relative_path, expected in sorted(files.items()):+ payload = download(relative_path)+ actual = digest(payload)+ if actual != expected:+ print(f"{relative_path} digest is {actual}, expected {expected}", file=sys.stderr)+ return 1+ target = staging / relative_path+ target.parent.mkdir(parents=True, exist_ok=True)+ target.write_bytes(payload)++ calls_sha = digest((staging / "calls.json").read_bytes())+ if calls_sha != manifest["calls_sha256"]:+ print("calls.json does not match the digest in manifest.json", file=sys.stderr)+ return 1++ (staging / MARKER_NAME).write_bytes(marker_bytes())++ # Re-checked here: the first check ran before the download, and the+ # destination could have changed since.+ reason = refuse_reason(dest)+ if reason is not None:+ print(f"refusing to replace {dest}: {reason}", file=sys.stderr)+ return 1+ swap_into_place(staging, dest)+ finally:+ shutil.rmtree(staging, ignore_errors=True)++ print(f"{TASK}: {len(files) + 1} files verified into {args.dest}/ at revision {REVISION}")+ print(f"{manifest['call_count']} recorded calls in {args.dest}/calls.json")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/lanes.py b/examples/typed-decisions/lanes.pynew file mode 100644index 000000000..c4dd52c64--- /dev/null+++ b/examples/typed-decisions/lanes.py@@ -0,0 +1,73 @@+"""How a lane answers a record: one model alone, or a fast model that escalates what it is unsure of.++Standard library only. score.py and tune.py read recordings into per-case+answers (after each backend's decision rules) and hand them here.++A lane in tuning.json:++ {"backend": "gliclass-large-v1"}+ every question answered by that backend++ {"backend": "gliformer-large", "escalate_to": "gliclass-large-v1",+ "cutoffs": {"weakness": 0.6, ...}}+ the first backend answers; where its top option's probability for a+ question is below that question's cut-off, the answer comes from the+ second backend instead. A question with no cut-off is never escalated;+ a question the first backend is not asked (questions.ASKED) always is.++Every lane also answers `severity`, computed from its own answers to+weakness, attack_vector and remote_unauthenticated with the CVSS v3.1 formula+and the tables in cvss.py (cvss.compose_severity).+"""++from __future__ import annotations++from typing import Any++from cvss import compose_severity++SEVERITY = "severity"+COMPONENTS = ("weakness", "attack_vector", "remote_unauthenticated")+++def severity_answer(answers: dict[str, dict[str, Any]]) -> dict[str, Any] | None:+ """The composed severity answer, or None when a component has no full distribution.++ A backend that returned a whole CVSS vector (the LLM) already carries its+ computed severity, which is used as it is.+ """+ if SEVERITY in answers:+ return answers[SEVERITY]+ parts = [answers.get(qid) for qid in COMPONENTS]+ if any(part is None or part["distribution"] is None for part in parts):+ return None+ distribution = compose_severity(*(part["distribution"] for part in parts))+ top = max(distribution, key=distribution.get)+ return {"distribution": distribution, "top": top, "top_p": distribution[top], "type": "score"}+++def lane_answers(+ lane: dict[str, Any], by_backend: dict[str, dict[str, dict[str, dict[str, Any]]]]+) -> tuple[dict[str, dict[str, dict[str, Any]]], dict[str, dict[str, bool]]]:+ """Per case, the lane's answer to every question plus `severity`, and which questions escalated."""+ first = by_backend[lane["backend"]]+ second = by_backend.get(lane.get("escalate_to", ""), {})+ cutoffs = lane.get("cutoffs", {})+ answers: dict[str, dict[str, dict[str, Any]]] = {}+ escalated: dict[str, dict[str, bool]] = {}+ for case, own in first.items():+ answers[case], escalated[case] = {}, {}+ qids = list(own) + [qid for qid in second.get(case, {}) if qid not in own and qid != SEVERITY]+ for qid in qids:+ answer = own.get(qid)+ cutoff = cutoffs.get(qid)+ # A question the first backend is not asked always goes to the second.+ up = answer is None or (cutoff is not None and answer["top_p"] < cutoff)+ if up and qid not in second.get(case, {}):+ raise SystemExit(f"{case}: {qid} escalates to {lane.get('escalate_to')}, which has no answer for it")+ answers[case][qid] = second[case][qid] if up else answer+ escalated[case][qid] = up+ composed = severity_answer(answers[case])+ if composed is not None:+ answers[case][SEVERITY] = composed+ return answers, escalateddiff --git a/examples/typed-decisions/multitask.py b/examples/typed-decisions/multitask.pynew file mode 100644index 000000000..d2e859d6b--- /dev/null+++ b/examples/typed-decisions/multitask.py@@ -0,0 +1,298 @@+#!/usr/bin/env python3+"""One GLiFormer call per CVE record: entities, relations and a typed record together.++ python3 multitask.py --show # the requests, offline+ uv run python multitask.py --record --url http://localhost:8080 --split test+ python3 multitask.py --score --calls run-output/multitask--test.json++Standard library only, apart from `sie_sdk` for --record. Everything below was+fixed before the first call.++Records+ From the vulnerability-triage case file, one split (test for the published+ run). Records are ordered by sha256("sie-typed-decisions-multitask-v1:" ++ CVE id); the first 12 whose NVD entry lists exactly one vulnerable CPE+ vendor and product, both written in the description (after lowercasing+ and keeping only letters and digits), are taken. NVD's CPE names are often+ not in the text at all, and a name the text never gives cannot be found.++Calls, all to knowledgator/gliformer-large-v1 through SIE extract+ combined one call: entity labels vendor, product and version; relation+ types "made by" and "affects version"; and an output_schema+ with `affected_component` (a string) and root enums `weakness`+ and `attack_vector` (the option names of those two questions),+ every task at threshold THRESHOLD. On dev, 0.1 found the most+ products (12 of 12, against 11 at 0.2 and 10 at 0.3), with+ either wording of the entity labels.+ separate the same three tasks as three calls: entities alone, entities+ with relations, and the output_schema alone.+ encode every record of the split, embedded with the same model.++What is scored+ product found when an extracted product span matches the NVD CPE+ product: after lowercasing and dropping everything but+ letters and digits, the two are equal or one contains+ the other and the shorter has at least 4 characters.+ Rule: at least 10 of 12.+ weakness the combined call's weakness enum against NVD gold, and+ against the separate schema call. Rule: the two modes+ agree on at least 11 of 12.+ reported, no rule vendor, matched the same way, and the attack_vector enum.+ On dev the combined call found the vendor for 3 of 12+ (it folds the vendor into the product span; the entities+ call alone finds most of them) and returned an+ attack_vector for 1 of 12, so neither is claimed.+ neighbours for every record of the split, whether its nearest other+ record by cosine similarity has the same weakness class,+ against the rate expected by chance.+"""++from __future__ import annotations++import argparse+import hashlib+import json+import math+import re+import sys+import time+from datetime import UTC, datetime+from pathlib import Path+from typing import Any++from questions import VULNERABILITY_QUESTIONS, VULNERABILITY_TRIAGE++MODEL = "knowledgator/gliformer-large-v1"+SALT = "sie-typed-decisions-multitask-v1:"+RECORDS = 12+ENTITY_LABELS = ["vendor", "product", "version"]+RELATIONS = ["made by", "affects version"]+# The option GLiFormer reads relation types from. Older adapter builds called it+# `relations`; `--relations-key` records against one of those on dev only.+RELATIONS_KEY = "relation_labels"+FOUND_AT_LEAST = 10+THRESHOLD = 0.1+AGREE_AT_LEAST = 11+MIN_CONTAINED = 4++ENUM_NAMES = {+ qid: {option["name"]: option["key"] for option in VULNERABILITY_QUESTIONS[qid]["options"]}+ for qid in ("weakness", "attack_vector")+}+SCHEMA = {+ "type": "object",+ "properties": {+ "affected_component": {"type": "string"},+ "weakness": {"type": "string", "enum": list(ENUM_NAMES["weakness"])},+ "attack_vector": {"type": "string", "enum": list(ENUM_NAMES["attack_vector"])},+ },+}+++def load(path: Path) -> Any:+ if not path.exists():+ raise SystemExit(f"{path} is missing")+ return json.loads(path.read_text(encoding="utf-8"))+++def normalise(text: str) -> str:+ return re.sub(r"[^a-z0-9]", "", text.lower())+++def eligible(case: dict[str, Any]) -> bool:+ pairs = case["source"]["cpe_vendor_product"]+ if len(pairs) != 1:+ return False+ text = normalise(case["state"])+ return all(normalise(name) in text for name in pairs[0])+++def selected(cases: dict[str, Any], split: str) -> list[dict[str, Any]]:+ pool = [case for case in cases["cases"] if case["split"] == split]+ ordered = sorted(pool, key=lambda case: hashlib.sha256((SALT + case["slug"]).encode()).hexdigest())+ return [case for case in ordered if eligible(case)][:RECORDS]+++def requests_for(+ text: str, threshold: float = THRESHOLD, relations_key: str = RELATIONS_KEY+) -> dict[str, dict[str, Any]]:+ item = {"text": text}+ options: dict[str, Any] = {"threshold": threshold}+ return {+ "combined": {+ "items": [item],+ "params": {+ "labels": ENTITY_LABELS,+ "output_schema": SCHEMA,+ "options": {**options, relations_key: RELATIONS},+ },+ },+ "entities": {"items": [item], "params": {"labels": ENTITY_LABELS, "options": options}},+ "relations": {+ "items": [item],+ "params": {"labels": ENTITY_LABELS, "options": {**options, relations_key: RELATIONS}},+ },+ "schema": {"items": [item], "params": {"output_schema": SCHEMA, "options": options}},+ }+++def matches(span: str, cpe: str) -> bool:+ a, b = normalise(span), normalise(cpe)+ if not a or not b:+ return False+ if a == b:+ return True+ shorter, longer = sorted((a, b), key=len)+ return len(shorter) >= MIN_CONTAINED and shorter in longer+++def record(args: argparse.Namespace, cases: dict[str, Any]) -> int:+ from sie_sdk import SIEClient # noqa: PLC0415 - only --record needs the SDK++ client = SIEClient(args.url, timeout_s=900)+ calls = []+ for case in selected(cases, args.split):+ entry: dict[str, Any] = {+ "case": case["slug"],+ "requests": requests_for(case["state"], args.threshold, args.relations_key),+ "responses": {},+ "ms": {},+ }+ for name, body in entry["requests"].items():+ params = body["params"]+ started = time.perf_counter()+ result = client.extract(+ MODEL,+ body["items"][0],+ labels=params.get("labels"),+ output_schema=params.get("output_schema"),+ options=params.get("options"),+ )+ entry["ms"][name] = round((time.perf_counter() - started) * 1000, 2)+ entry["responses"][name] = {key: result.get(key) for key in ("entities", "relations", "data", "error")}+ calls.append(entry)+ pool = [case for case in cases["cases"] if case["split"] == args.split]+ started = time.perf_counter()+ vectors = client.encode(MODEL, [{"text": case["state"]} for case in pool])+ encode_ms = round((time.perf_counter() - started) * 1000, 2)+ payload = {+ "model": MODEL,+ "split": args.split,+ "threshold": args.threshold,+ "relations_key": args.relations_key,+ "recorded_at": datetime.now(UTC).isoformat(timespec="seconds"),+ "calls": calls,+ "encode": {+ "cases": [case["slug"] for case in pool],+ "dense": [list(map(float, v["dense"])) for v in vectors],+ "ms": encode_ms,+ },+ }+ out = Path(args.out or f"run-output/multitask--{args.split}.json")+ out.parent.mkdir(parents=True, exist_ok=True)+ out.write_text(json.dumps(payload) + "\n", encoding="utf-8")+ print(f"wrote {out}: {len(calls)} records, {len(pool)} embeddings")+ return 0+++def spans(response: dict[str, Any], label: str) -> list[str]:+ return [entity["text"] for entity in response.get("entities") or [] if entity["label"] == label]+++def enum_answer(response: dict[str, Any], qid: str) -> str | None:+ value = (response.get("data") or {}).get(qid)+ return ENUM_NAMES[qid].get(value) if isinstance(value, str) else None+++def cosine(a: list[float], b: list[float]) -> float:+ dot = sum(x * y for x, y in zip(a, b))+ return dot / (math.sqrt(sum(x * x for x in a)) * math.sqrt(sum(y * y for y in b)))+++def score(args: argparse.Namespace, cases: dict[str, Any]) -> int:+ payload = load(Path(args.calls))+ by_slug = {case["slug"]: case for case in cases["cases"]}+ expected = [case["slug"] for case in selected(cases, payload["split"])]+ if [call["case"] for call in payload["calls"]] != expected:+ raise SystemExit("the recorded records are not the pre-registered selection")+ found = {"vendor": 0, "product": 0}+ agree = {qid: 0 for qid in ENUM_NAMES}+ right = {qid: 0 for qid in ENUM_NAMES}+ relations = components = 0+ for call in payload["calls"]:+ case = by_slug[call["case"]]+ if call["requests"] != requests_for(+ case["state"], payload["threshold"], payload.get("relations_key", RELATIONS_KEY)+ ):+ raise SystemExit(f"{call['case']}: recorded requests differ from the rebuilt ones")+ ((vendor, product),) = case["source"]["cpe_vendor_product"]+ combined = call["responses"]["combined"]+ found["vendor"] += any(matches(span, vendor) for span in spans(combined, "vendor"))+ found["product"] += any(matches(span, product) for span in spans(combined, "product"))+ relations += bool(combined.get("relations"))+ components += bool((combined.get("data") or {}).get("affected_component"))+ for qid in ENUM_NAMES:+ answer = enum_answer(combined, qid)+ agree[qid] += answer == enum_answer(call["responses"]["schema"], qid)+ right[qid] += answer == case["gold"][qid]+ print(+ f"{call['case']}: cpe {vendor}/{product}; vendor {spans(combined, 'vendor')} product "+ f"{spans(combined, 'product')}; {len(combined.get('relations') or [])} relations; "+ f"weakness {enum_answer(combined, 'weakness')} (gold {case['gold']['weakness']}); "+ f"{call['ms']['combined']:.0f} ms"+ )+ n = len(payload["calls"])+ print(+ f"\nproduct found {found['product']} of {n} (rule: at least {FOUND_AT_LEAST}); vendor found {found['vendor']} of {n}"+ )+ for qid in ENUM_NAMES:+ print(+ f"{qid}: matches NVD {right[qid]} of {n}; combined and separate agree {agree[qid]} of {n}"+ + (f" (rule: at least {AGREE_AT_LEAST})" if qid == "weakness" else "")+ )+ print(f"records with at least one relation: {relations} of {n}; with an affected_component: {components} of {n}")++ encoded = payload["encode"]+ weakness = [by_slug[slug]["gold"]["weakness"] for slug in encoded["cases"]]+ same = 0+ for i, vector in enumerate(encoded["dense"]):+ nearest = max(+ (j for j in range(len(encoded["dense"])) if j != i), key=lambda j: cosine(vector, encoded["dense"][j])+ )+ same += weakness[i] == weakness[nearest]+ total = len(weakness)+ chance = sum(weakness.count(w) - 1 for w in weakness) / (total * (total - 1))+ print(f"nearest neighbour has the same weakness class: {same} of {total} (chance {chance:.3f})")+ passed = found["product"] >= FOUND_AT_LEAST and agree["weakness"] >= AGREE_AT_LEAST+ print("\nrules " + ("hold" if passed else "do NOT hold"))+ return 0 if passed else 1+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--data", default="data")+ parser.add_argument("--split", choices=("dev", "test"), default="test")+ parser.add_argument("--show", action="store_true")+ parser.add_argument("--record", action="store_true")+ parser.add_argument("--score", action="store_true")+ parser.add_argument("--calls", help="recording --score reads")+ parser.add_argument("--url", default="http://localhost:8080")+ parser.add_argument("--threshold", type=float, default=THRESHOLD, help="dev only; test uses THRESHOLD")+ parser.add_argument("--relations-key", default=RELATIONS_KEY, help="dev only; test uses RELATIONS_KEY")+ parser.add_argument("--out")+ args = parser.parse_args()+ cases = load(Path(args.data) / f"inputs/{VULNERABILITY_TRIAGE}/cases.json")+ if args.record:+ if args.split == "test" and (args.threshold, args.relations_key) != (THRESHOLD, RELATIONS_KEY):+ raise SystemExit(f"the test run uses threshold {THRESHOLD} and {RELATIONS_KEY}")+ return record(args, cases)+ if args.score:+ return score(args, cases)+ for case in selected(cases, args.split):+ print(case["slug"], case["source"]["cpe_vendor_product"])+ print(json.dumps(requests_for("<record text>")["combined"], indent=2))+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/page.py b/examples/typed-decisions/page.pynew file mode 100644index 000000000..c61d801ef--- /dev/null+++ b/examples/typed-decisions/page.py@@ -0,0 +1,496 @@+#!/usr/bin/env python3+"""Build the task page's surfaces from the recordings, and refuse any surface that would show a miss.++ python3 page.py --calls <recordings> [--split test] [--json page.json]++Standard library only, no model. Every setting comes from tuning.json, which+was fixed on the dev slice and committed before any test record was sent+(PREREGISTRATION.md); this script never changes one.++What the page shows:++ board one row per lane in tuning.json (Fast, Smart and the LLM, each one+ model on its own), with a cell per question the lane passed the+ page rule for on dev. A question a lane was not asked, or did not+ pass on dev, is left out, and the foot counts it. Each cell holds+ the slice's right-of-answered and balanced accuracy. The median+ per-record time is a round trip, not a service level.+ figures one row per question type, for Smart: right of answered, summed+ over its shown questions of that type.+ cards CARDS below, in order. A card is the first record, in the order of+ sha256(CARD_SALT + CVE id), that meets its condition, has a+ weakness class no earlier card has, and on which every answer the+ card shows (each CARD_LANES lane's shown questions) is right and+ is the model's own top option, so the decision rule changed+ none of them. A card with no such record is dropped. A card+ cell holds only the returned answer and the probability the+ model returned for it.+ catalog CATALOG below, each backend with the questions it passed on dev.+ totals records shown on cards, of records recorded, and each shown+ question's figure over the whole slice.+ credits per lane, from a copy of the published SIE Cloud prices (--prices):+ only for a model the prices name, whose recorded responses+ carry the units it is billed in. Otherwise no credit figure.+ speed a speed claim, only when the slower median is at least+ SPEED_MARGIN times the faster, comparing the same answers.+ cascade not shown: the cascade with its dev cut-offs against Smart+ alone, under its control (PREREGISTRATION.md).++On the slice, a shown question whose point figures fail the page rule+(balanced accuracy under 0.70, accuracy under the majority answer's, or an+option with at least 10 records answered right under 40% of the time) is+withdrawn: it is left off every surface and listed under `withdrawn`.+"""++from __future__ import annotations++import argparse+import hashlib+from fractions import Fraction+import json+import statistics+import sys+from collections import defaultdict+from pathlib import Path+from typing import Any++import lanes+import score+import tune+import tuning+from questions import DESCRIBED, VULNERABILITY_QUESTIONS, VULNERABILITY_TRIAGE, asked+from run import LLM_BACKENDS++CARD_SALT = "sie-typed-decisions-cards-v1:"+CARD_LANES = ("fast", "smart")+# (name, the argument the card makes, condition on the record's gold answers)+CARDS = (+ (+ "remote-no-login",+ "a record anyone on the network can exploit without an account",+ lambda gold: gold["remote_unauthenticated"] == "true",+ ),+ (+ "network-needs-login",+ "reachable over the network, but only with an account: the yes-or-no answer is not the attack vector restated",+ lambda gold: gold["attack_vector"] == "network" and gold["remote_unauthenticated"] == "false",+ ),+ (+ "local-access",+ "a record exploitable only with local or physical access, the attack vector most records are not",+ lambda gold: gold["attack_vector"] in ("local", "physical"),+ ),+)+CATALOG = ("gliclass-instruct-large", "laya", "laya-typed-decisions")+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]],+ "withdrawn": [["laya-typed-decisions", "remote_unauthenticated"]],+}+++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"]],+ "withdrawn": [[item.get("lane") or item.get("catalog"), item["question"]] for item in page["withdrawn"]],+ }+ return [+ f"{key}: got {actual[key]}, published {expected}"+ for key, expected in PUBLISHED.items()+ if actual[key] != expected+ ]+++def sha256(text: str) -> str:+ return hashlib.sha256(text.encode("utf-8")).hexdigest()+++def split_calls(paths: list[str], split: str) -> list[dict[str, Any]]:+ calls = []+ for path in paths:+ for call in score.usable(score.load(Path(path))):+ if call["set"] == VULNERABILITY_TRIAGE and call["split"] == split:+ calls.append(call)+ return calls+++def per_backend(calls: list[dict[str, Any]], data_dir: Path) -> dict[str, dict[str, dict[str, Any]]]:+ """backend -> case -> question -> answer after its rules: the tuned call, or an LLM's described one."""+ cases = score.load(data_dir / f"inputs/{VULNERABILITY_TRIAGE}/cases.json")+ by_slug = {case["slug"]: case for case in cases["cases"]}+ out: dict[str, dict[str, dict[str, Any]]] = defaultdict(dict)+ for call in calls:+ wanted = DESCRIBED if call["backend"] in LLM_BACKENDS else tuning.TUNED+ if call["variant"] != wanted:+ continue+ case = by_slug[call["case"]]+ questions = asked(VULNERABILITY_TRIAGE, call["backend"], score.questions_for(cases, case))+ returned = score.NORMALISERS[call["transport"]](call, questions)+ answers = score.decided(call, returned)+ for qid, item in answers.items():+ # What the model itself returned: its own top option and that option's probability.+ item["returned"] = {"top": returned[qid]["top"], "top_p": returned[qid]["top_p"]}+ out[call["backend"]][call["case"]] = answers+ return out+++def point_verdict(gold: list[str], predicted: list[str]) -> dict[str, Any]:+ """The page rule on the slice's point figures, without the dev margin."""+ figures = tune.metrics(gold, predicted)+ majority = tune.majority_accuracy(gold)+ reasons = []+ if figures["balanced_accuracy"] < tune.PAGE_MIN_BALANCED:+ reasons.append(f"balanced accuracy {figures['balanced_accuracy']:.3f}")+ if figures["accuracy"] < majority:+ reasons.append(f"accuracy {figures['accuracy']:.3f} under the majority answer's {majority:.3f}")+ for option, (right, total) in figures["recall"].items():+ if total >= tune.PAGE_MIN_CLASS_RECORDS and right / total < tune.PAGE_MIN_CLASS_RECALL:+ reasons.append(f"{option} right {right} of {total}")+ right = sum(g == p for g, p in zip(gold, predicted))+ return {+ "right": right,+ "n": len(gold),+ "accuracy": figures["accuracy"],+ "balanced_accuracy": figures["balanced_accuracy"],+ "majority_accuracy": majority,+ "recall": figures["recall"],+ "holds": not reasons,+ "reasons": reasons,+ }+++def option_label(qid: str, key: str) -> str:+ if qid == lanes.SEVERITY:+ return key+ return next(option["name"] for option in VULNERABILITY_QUESTIONS[qid]["options"] if option["key"] == key)+++def build(+ calls: list[dict[str, Any]], data_dir: Path, settings: dict[str, Any], prices: dict[str, Any] | None = None+) -> dict[str, Any]:+ answers_by_backend = per_backend(calls, data_dir)+ cases = score.load(data_dir / f"inputs/{VULNERABILITY_TRIAGE}/cases.json")+ split = {call["split"] for call in calls}+ gold = {case["slug"]: case["gold"] for case in cases["cases"] if case["split"] in split}+ latency = tune.request_latencies(calls)+ withdrawn: list[dict[str, Any]] = []++ board: dict[str, Any] = {}+ lane_answers: dict[str, dict[str, dict[str, Any]]] = {}+ for name, lane_settings in settings["lanes"].items():+ lane = {key: value for key, value in lane_settings.items() if key in ("backend", "escalate_to", "cutoffs")}+ answers, escalated = lanes.lane_answers(lane, answers_by_backend)+ lane_answers[name] = answers+ records = sorted(answers)+ cells, left_out = {}, []+ for qid, dev in lane_settings["questions"].items():+ if not dev["eligible"]:+ left_out.append(qid)+ continue+ rows = [(answers[c][qid]["top"], gold[c][qid]) for c in records if qid in answers[c]]+ cell = point_verdict([g for _, g in rows], [p for p, _ in rows])+ if not cell["holds"]:+ withdrawn.append({"lane": name, "question": qid, "reasons": cell["reasons"]})+ continue+ cells[qid] = cell+ not_asked = [qid for qid in VULNERABILITY_QUESTIONS if qid not in lane_settings["questions"]]+ board[name] = {+ "model": next(call["model"] for call in calls if call["backend"] == lane["backend"]),+ "cells": cells,+ "left_out": {"not_passed_on_dev": left_out, "not_asked": not_asked},+ "records": len(records),+ "median_ms_per_record": statistics.median(+ tune.record_latency(lane, c, escalated[c], latency) for c in records+ ),+ "calls_per_record": statistics.fmean(tune.record_calls(lane, c, escalated[c], latency) for c in records),+ "credits": credits(lane, calls, prices),+ }++ figures: dict[str, dict[str, int]] = {}+ for qid, cell in board["smart"]["cells"].items():+ qtype = "score" if qid == lanes.SEVERITY else VULNERABILITY_QUESTIONS[qid]["type"]+ entry = figures.setdefault(qtype, {"right": 0, "answered": 0, "questions": 0})+ entry["right"] += cell["right"]+ entry["answered"] += cell["n"]+ entry["questions"] += 1++ cards = choose_cards(gold, lane_answers, board)++ catalog = {}+ for backend in CATALOG:+ dev = tuning.entry(VULNERABILITY_TRIAGE, backend, settings) or {}+ shown = {}+ for qid, entry in dev.get("questions", {}).items():+ if not entry["dev"]["eligible"] or backend not in answers_by_backend:+ continue+ per_case = answers_by_backend[backend]+ rows = [(per_case[c][qid]["top"], gold[c][qid]) for c in sorted(per_case)]+ cell = point_verdict([g for _, g in rows], [p for p, _ in rows])+ if not cell["holds"]:+ withdrawn.append({"catalog": backend, "question": qid, "reasons": cell["reasons"]})+ continue+ shown[qid] = cell+ catalog[backend] = shown++ return {+ "split": sorted(split),+ "records": len(gold),+ "board": board,+ "figures": figures,+ "cards": cards,+ "catalog": catalog,+ "totals": {+ "records_on_cards": len(cards),+ "records_recorded": len(gold),+ "whole_slice": {+ name: {qid: f"{cell['right']} of {cell['n']}" for qid, cell in lane["cells"].items()}+ for name, lane in board.items()+ },+ },+ "speed": speed_claims(board, latency, gold),+ "cascade": cascade_control(settings, answers_by_backend, gold, latency, board),+ "withdrawn": withdrawn,+ }+++def credits(lane: dict[str, Any], calls: list[dict[str, Any]], prices: dict[str, Any] | None) -> dict[str, Any] | None:+ """Credits per record from the published SIE Cloud prices, where they can be computed.++ Only a lane of one model the price list names, whose recorded responses+ carry the units it bills (a chat completion's prompt and completion+ tokens), gets a figure. Anything else gets None: no price, no figure.+ """+ if prices is None or "escalate_to" in lane:+ return None+ lane_calls = [call for call in calls if call["backend"] == lane["backend"]]+ model = lane_calls[0]["model"].split(":", 1)[0]+ unit_price = {+ item["unit"]: Fraction(int(item["usd_per_unit"]["numerator"]), int(item["usd_per_unit"]["denominator"]))+ for item in prices["items"]+ if item["model"] == model and item["operation"] == "generate" and item["profile"] == "default"+ }+ if not {"input_tokens", "output_tokens"} <= set(unit_price):+ return None+ pack = prices["stripe_credit_pack"]+ credits_per_usd = Fraction(pack["credits"]) / (Fraction(pack["usd_cents"]) / 100)+ per_record = []+ for call in lane_calls:+ usage = call["responses"][0].get("usage") or {}+ if "prompt_tokens" not in usage or "completion_tokens" not in usage:+ return None+ usd = (+ usage["prompt_tokens"] * unit_price["input_tokens"]+ + usage["completion_tokens"] * unit_price["output_tokens"]+ )+ per_record.append(float(usd * credits_per_usd))+ return {+ "pricing_version": prices["pricing_version"],+ "median_credits_per_record": statistics.median(per_record),+ "usd_per_1000_records": float(Fraction(statistics.fmean(per_record)) * 1000 / credits_per_usd),+ }+++def choose_cards(+ gold: dict[str, dict[str, str]], lane_answers: dict[str, dict[str, dict[str, Any]]], board: dict[str, Any]+) -> list[dict[str, Any]]:+ order = sorted(gold, key=lambda slug: sha256(CARD_SALT + slug))+ cards: list[dict[str, Any]] = []+ for name, argument, condition in CARDS:+ taken = {card["gold"]["weakness"] for card in cards}+ for slug in order:+ if not condition(gold[slug]) or gold[slug]["weakness"] in taken:+ continue+ shown = {+ lane: {+ qid: lane_answers[lane][slug][qid]+ for qid in board[lane]["cells"]+ if slug in lane_answers[lane] and qid in lane_answers[lane][slug]+ }+ for lane in CARD_LANES+ }+ complete = all(set(shown[lane]) == set(board[lane]["cells"]) and bool(shown[lane]) for lane in CARD_LANES)+ if not complete or any(+ a["top"] != gold[slug][qid] or a["returned"]["top"] != a["top"]+ for cells in shown.values()+ for qid, a in cells.items()+ ):+ continue+ cards.append(+ {+ "card": name,+ "argument": argument,+ "case": slug,+ "gold": gold[slug],+ "answers": {+ lane: {+ qid: {+ "answer": a["top"],+ "label": option_label(qid, a["top"]),+ "probability": a["returned"]["top_p"],+ }+ for qid, a in cells.items()+ }+ for lane, cells in shown.items()+ },+ }+ )+ break+ for card in cards:+ for lane, cells in card["answers"].items():+ for qid, cell in cells.items():+ if cell["answer"] != card["gold"][qid]:+ raise SystemExit(f"card {card['card']} would show a miss: {lane} {qid}")+ return cards+++def cascade_control(+ settings: dict[str, Any], answers_by_backend: dict, gold: dict[str, dict[str, str]], latency: dict, board: dict+) -> dict[str, Any]:+ """The cascade, with its dev cut-offs, against Smart alone on this slice. Reported, never shown."""+ lane = {key: settings["cascade"][key] for key in ("backend", "escalate_to", "cutoffs")}+ cascade, escalated = lanes.lane_answers(lane, answers_by_backend)+ alone, _ = lanes.lane_answers(dict(settings["lanes"]["smart"], cutoffs={}), answers_by_backend)+ records = sorted(cascade)+ questions: dict[str, Any] = {}+ regressions = 0+ for qid in [q for q in VULNERABILITY_QUESTIONS if q in cascade[records[0]]]:+ g = [gold[c][qid] for c in records]+ mine = tune.metrics(g, [cascade[c][qid]["top"] for c in records])+ theirs = tune.metrics(g, [alone[c][qid]["top"] for c in records])+ lost = sum(alone[c][qid]["top"] == gold[c][qid] != cascade[c][qid]["top"] for c in records)+ regressions += lost+ questions[qid] = {+ "cascade": {k: mine[k] for k in ("accuracy", "balanced_accuracy")},+ "smart": {k: theirs[k] for k in ("accuracy", "balanced_accuracy")},+ "escalated": statistics.fmean(escalated[c][qid] for c in records),+ "regressions": lost,+ }+ calls = statistics.fmean(tune.record_calls(lane, c, escalated[c], latency) for c in records)+ matches = all(q["cascade"][k] >= q["smart"][k] for q in questions.values() for k in q["cascade"])+ return {+ "cutoffs": lane["cutoffs"],+ "questions": questions,+ "calls_per_record": calls,+ "smart_calls_per_record": board["smart"]["calls_per_record"],+ "matches_smart": matches,+ "regressions": regressions,+ "passes": matches and regressions == 0 and calls < board["smart"]["calls_per_record"],+ }+++def speed_claims(board: dict[str, Any], latency: dict, gold: dict[str, dict[str, str]]) -> list[dict[str, Any]]:+ """Claims that clear SPEED_MARGIN, each comparing the same answers."""+ 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))+ 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"],+ )+ )+ out = []+ for what, first, second in claims:+ ratio = max(first, second) / min(first, second)+ out.append(+ {+ "compares": what,+ "median_ms": [first, second],+ "ratio": ratio,+ "claimed": ratio >= SPEED_MARGIN,+ }+ )+ return out+++def report(page: dict[str, Any]) -> None:+ print(f"== page surfaces, {', '.join(page['split'])} slice, {page['records']} records")+ for name, lane in page["board"].items():+ cells = ", ".join(+ f"{qid} {c['right']}/{c['n']} (bal {c['balanced_accuracy']:.3f})" for qid, c in lane["cells"].items()+ )+ foot = lane["left_out"]+ print(+ f" {name:<6}{lane['model']:<42}{cells or '(nothing shown)'}"+ f"\n left out: not passed on dev {foot['not_passed_on_dev']}, not asked {foot['not_asked']};"+ f" median {lane['median_ms_per_record']:.0f} ms per record (a round trip, not a service level),"+ f" {lane['calls_per_record']:.2f} calls; "+ + (+ f"{lane['credits']['median_credits_per_record']:.1f} credits per record (median), "+ f"${lane['credits']['usd_per_1000_records']:.3f} per 1,000 records"+ if lane["credits"]+ else "no credit figure"+ )+ )+ for qtype, entry in page["figures"].items():+ print(f" figures {qtype}: {entry['right']} of {entry['answered']} over {entry['questions']} question(s)")+ for card in page["cards"]:+ print(f" card {card['card']}: {card['case']} ({card['gold']['weakness']})")+ for backend, cells in page["catalog"].items():+ print(f" catalog {backend}: " + ", ".join(f"{q} {c['right']}/{c['n']}" for q, c in cells.items()))+ for claim in page["speed"]:+ 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}"+ )+ cascade = page["cascade"]+ print(+ f" cascade against Smart alone: {cascade['calls_per_record']:.2f} calls per record against "+ f"{cascade['smart_calls_per_record']:.2f}, regressions {cascade['regressions']}, "+ + ("passes its control" if cascade["passes"] else "fails its control (README only)")+ )+ for qid, q in cascade["questions"].items():+ print(+ f" {qid}: escalated {q['escalated']:.3f}, accuracy {q['cascade']['accuracy']:.3f} "+ f"against {q['smart']['accuracy']:.3f}, balanced {q['cascade']['balanced_accuracy']:.3f} "+ f"against {q['smart']['balanced_accuracy']:.3f}"+ )+ for item in page["withdrawn"]:+ print(f" WITHDRAWN {item}")+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--calls", nargs="+", default=["data/calls.json"], help="recordings (default: data/calls.json)")+ parser.add_argument("--data", default="data", help="directory holding inputs/ (default: data)")+ parser.add_argument("--split", choices=("dev", "test"), default="test")+ parser.add_argument("--json", help="also write the surfaces to this path")+ parser.add_argument(+ "--prices", help="a copy of the published SIE Cloud prices (superlinked.com/pricing/sie-cloud-prices.json)"+ )+ args = parser.parse_args()+ settings = tuning.load()+ if "lanes" not in settings:+ raise SystemExit("tuning.json has no lanes; run tune.py lanes on dev first")+ prices = json.loads(Path(args.prices).read_text(encoding="utf-8")) if args.prices else None+ page = build(split_calls(args.calls, args.split), Path(args.data), settings, prices)+ report(page)+ if args.json:+ Path(args.json).write_text(json.dumps(page, indent=1) + "\n", encoding="utf-8")+ if args.split == "test":+ failures = published_failures(page)+ if failures:+ print("\nFAILED to reproduce what the page publishes:", file=sys.stderr)+ for line in failures:+ print(f" {line}", file=sys.stderr)+ return 1+ print("\nThe page's cards, time medians, speed claims and withdrawals reproduced.")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/pyproject.toml b/examples/typed-decisions/pyproject.tomlnew file mode 100644index 000000000..90e10015a--- /dev/null+++ b/examples/typed-decisions/pyproject.toml@@ -0,0 +1,38 @@+[project]+name = "superlinked-sie-typed-decisions-example"+version = "0.1.0"+description = "Answer several typed triage questions about one record, with probabilities, through SIE"+requires-python = ">=3.12,<3.13"+dependencies = [+ "sie-sdk>=0.8.0,<0.9.0",+]++[tool.uv]+package = false++[dependency-groups]+# The reference Laya package, only to check SIE's Laya answers against it.+# Pulls torch and transformers; on Linux torch comes from the CPU wheel index.+laya = [+ "laya==0.3.11",+ "torch>=2.4",+]+# Only build_inputs.py needs it, to read the workflow benchmark's parquet file.+build = [+ "pyarrow>=17",+]+dev = [+ "ruff>=0.14",+]++[tool.uv.sources]+torch = [{ index = "pytorch-cpu", marker = "sys_platform == 'linux'" }]++[[tool.uv.index]]+name = "pytorch-cpu"+url = "https://download.pytorch.org/whl/cpu"+explicit = true++[tool.ruff]+line-length = 120+target-version = "py312"diff --git a/examples/typed-decisions/questions.py b/examples/typed-decisions/questions.pynew file mode 100644index 000000000..0a2d7ef70--- /dev/null+++ b/examples/typed-decisions/questions.py@@ -0,0 +1,373 @@+"""The typed questions each record is asked, and how each backend receives them.++Standard library only. Imported by build_inputs.py, run.py, score.py and the+tests, so the question a model saw and the question a score is computed for are+the same object.++A question is one of three types:++ choice pick one option from a list; the answer is a distribution over options+ noul a yes-or-no statement; the answer is the probability that it holds+ score an ordered rubric; the answer is a distribution over levels, low to high++Every option has a stable `key` (what the gold label and the scorer use), a+short `name` and, where the source has one, a `description`. A backend never+sees the key unless the key is also what it is asked to return.++Three phrasings are defined for the vulnerability-triage set:++ short options by name only+ described options by name and description+ concrete options by name, except where an option has a `concrete` name+ that spells out what happens (memory corruption, and both+ sides of the remote-without-login question)++Which phrasing each question gets is chosen per backend on the dev slice only+(tune.py), and the chosen mix is the `tuned` variant (tuning.py). Anywhere a+phrasing is taken, a dict of question id to phrasing is taken too. The+workflow set keeps its source's own questions, which always carry+descriptions, so it has one phrasing.++Two kinds of backend receive the questions:++ typed a decision model that takes a state and a dict of typed questions+ in one call and answers all of them (`typed_questions`)+ labels a zero-shot label scorer that takes a text and a list of label+ strings, one question per call (`label_options`)+"""++from __future__ import annotations++import json+from typing import Any++CHOICE = "choice"+NOUL = "noul"+SCORE = "score"+TYPES = (CHOICE, NOUL, SCORE)++SHORT = "short"+DESCRIBED = "described"+CONCRETE = "concrete"+VARIANTS = (SHORT, DESCRIBED, CONCRETE)++VULNERABILITY_TRIAGE = "vulnerability-triage"+WORKFLOWS = "workflows"+SETS = (VULNERABILITY_TRIAGE, WORKFLOWS)++# The vulnerability-triage question set. Gold answers come from the NVD+# analyst's CWE and CVSS v3.1 assessment of each record; build_inputs.py holds+# the mapping from NVD values to these keys.+VULNERABILITY_QUESTIONS: dict[str, dict[str, Any]] = {+ "weakness": {+ "type": CHOICE,+ "instructions": "Which kind of weakness does this vulnerability report describe?",+ "options": [+ {+ "key": "cross_site_scripting",+ "name": "cross-site scripting",+ "description": "attacker-supplied script runs in another user's browser",+ },+ {+ "key": "sql_injection",+ "name": "SQL injection",+ "description": "attacker input changes a database query",+ },+ {+ "key": "memory_corruption",+ "name": "memory corruption",+ "concrete": "buffer overflow or out-of-bounds memory access",+ "description": "buffer overflow, out-of-bounds read or write, or use after free",+ },+ {+ "key": "command_injection",+ "name": "command or code injection",+ "description": "attacker input runs as an operating system command or as code",+ },+ {+ "key": "path_traversal",+ "name": "path traversal",+ "description": "attacker-controlled file paths reach files outside the intended directory",+ },+ {+ "key": "request_forgery",+ "name": "cross-site request forgery",+ "description": "a logged-in user's browser is made to send a request the user did not intend",+ },+ {+ "key": "access_control",+ "name": "missing authentication or authorization",+ "description": "an action or resource lacks a proper login or permission check",+ },+ {+ "key": "file_upload",+ "name": "unrestricted file upload",+ "description": "dangerous file types, such as scripts, can be uploaded",+ },+ ],+ },+ "attack_vector": {+ "type": CHOICE,+ "instructions": "From where can an attacker exploit this vulnerability?",+ "options": [+ {+ "key": "network",+ "name": "remotely over the network",+ "description": "from anywhere the vulnerable service or page is reachable, such as the internet",+ },+ {+ "key": "adjacent",+ "name": "from an adjacent network",+ "description": "only from the same local network segment, or within Bluetooth or Wi-Fi range",+ },+ {+ "key": "local",+ "name": "with local access",+ "description": "only from the machine itself, as a logged-in user or through a file a user opens",+ },+ {+ "key": "physical",+ "name": "with physical access",+ "description": "only by physically touching or connecting to the device",+ },+ ],+ },+ "remote_unauthenticated": {+ "type": NOUL,+ "instructions": "Anyone who can reach the system over the network can exploit this without logging in.",+ "options": [+ {+ "key": "false",+ "name": "needs local access or a login",+ "concrete": "only a local user or a logged-in user can do it",+ "description": "the attacker needs access to the machine itself, or an account",+ },+ {+ "key": "true",+ "name": "exploitable remotely without a login",+ "concrete": "anyone on the network can do it without an account",+ "description": "an unauthenticated attacker can exploit it over the network",+ },+ ],+ },+}+++# The questions a backend's call carries, where that is not all of them. A+# one-call model reads every question in the same prompt, and on dev GLiFormer+# confused "exploitable remotely without a login" with "remotely over the+# network": asked all three, its attack-vector answer collapsed to network. It+# is asked the two it answers, and the Fast lane leaves the third unanswered.+ASKED: dict[str, dict[str, tuple[str, ...]]] = {+ VULNERABILITY_TRIAGE: {"gliformer-large": ("weakness", "attack_vector")},+}+++def asked(set_name: str, backend: str, questions: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:+ """The subset of `questions` a backend is asked on one set."""+ keep = ASKED.get(set_name, {}).get(backend)+ return questions if keep is None else {qid: q for qid, q in questions.items() if qid in keep}+++# The severity rubric is not asked of any model; its level keys are the ones a+# computed severity uses. lanes.severity_answer composes that from a backend's+# answers to weakness, attack_vector and remote_unauthenticated with the CVSS+# v3.1 formula and the fixed tables in cvss.py; the LLM's comes from the full+# vector it returns. The gold is NVD's base severity.+SEVERITY_RUBRIC: dict[str, Any] = {+ "type": SCORE,+ "instructions": "How severe is this vulnerability?",+ "options": [+ {"key": "0", "name": "low", "description": "CVSS base score 0.1 to 3.9"},+ {"key": "1", "name": "medium", "description": "CVSS base score 4.0 to 6.9"},+ {"key": "2", "name": "high", "description": "CVSS base score 7.0 to 8.9"},+ {"key": "3", "name": "critical", "description": "CVSS base score 9.0 to 10.0"},+ ],+}+++def humanize(key: str) -> str:+ """`escalate_to_human` -> `escalate to human`."""+ return key.replace("_", " ").strip()+++def level_name(description: str) -> str:+ """The short name of a rubric level: the text before its first colon or semicolon."""+ for separator in (":", ";"):+ if separator in description:+ return description.split(separator, 1)[0].strip()+ return description.strip()+++def from_source_question(question: dict[str, Any]) -> dict[str, Any]:+ """Convert one question in the workflow dataset's own shape to the shape used here.++ The source writes choice criteria as `{key: description}`, score criteria as+ an ordered list of level descriptions and noul criteria as an optional+ `{"false": ..., "true": ...}`. Nothing is reworded. A choice option's name is+ its source key, so `typed_questions(..., DESCRIBED)` gives back the source+ question exactly; a level's name is the text before its first colon or+ semicolon.+ """+ qtype = question["type"]+ criteria = question.get("criteria")+ if qtype == CHOICE:+ options = [{"key": key, "name": key, "description": text} for key, text in criteria.items()]+ elif qtype == SCORE:+ options = [+ {"key": str(index), "name": level_name(text), "description": text} for index, text in enumerate(criteria)+ ]+ elif qtype == NOUL:+ criteria = criteria or {}+ options = [+ {"key": "false", "name": "no", "description": criteria.get("false")},+ {"key": "true", "name": "yes", "description": criteria.get("true")},+ ]+ else:+ raise ValueError(f"unknown question type {qtype!r}")+ return {"type": qtype, "instructions": question["instructions"], "options": options}+++def keys(question: dict[str, Any]) -> list[str]:+ return [option["key"] for option in question["options"]]+++def _level_text(option: dict[str, Any]) -> str:+ """A rubric level with its description, without repeating a name the description already starts with."""+ description = option["description"] or ""+ if not description:+ return option["name"]+ if option["name"] == level_name(description):+ return description+ return f"{option['name']}: {description}"+++Phrasing = str | dict[str, str]+++def phrasing_of(variant: Phrasing, qid: str) -> str:+ """The phrasing one question gets: the variant itself, or its entry when the variant maps questions."""+ phrasing = variant[qid] if isinstance(variant, dict) else variant+ if phrasing not in VARIANTS:+ raise ValueError(f"unknown phrasing {phrasing!r}")+ return phrasing+++def option_name(option: dict[str, Any], phrasing: str) -> str:+ """An option's name in one phrasing: `concrete` swaps in the concrete name where there is one."""+ if phrasing == CONCRETE:+ return option.get("concrete") or option["name"]+ return option["name"]+++def typed_questions(+ questions: dict[str, dict[str, Any]], variant: Phrasing+) -> tuple[dict[str, dict[str, Any]], dict[str, dict[str, str]]]:+ """Render a question set for a typed decision model.++ Returns the question dict to send and, per question, the map from each+ option label the model can return to the option key the scorer uses.++ `described` sends `{name: description}` choice criteria, score levels with+ their descriptions and `true`/`false` noul descriptions where there are any.+ `short` sends choice options as a list of names, score levels by name and+ noul questions as the bare statement. `concrete` is `short` with concrete+ names, and sends a noul question's concrete names as its descriptions.+ Score and noul answers come back by level index and as P(true), so their+ map is the identity.+ """+ rendered: dict[str, dict[str, Any]] = {}+ label_maps: dict[str, dict[str, str]] = {}+ for qid, question in questions.items():+ phrasing = phrasing_of(variant, qid)+ qtype = question["type"]+ options = question["options"]+ body: dict[str, Any] = {"type": qtype, "instructions": question["instructions"]}+ if qtype == CHOICE:+ names = [option_name(option, phrasing) for option in options]+ if phrasing == DESCRIBED:+ body["criteria"] = {name: option["description"] for name, option in zip(names, options)}+ else:+ body["criteria"] = names+ label_maps[qid] = {name: option["key"] for name, option in zip(names, options)}+ elif qtype == SCORE:+ if phrasing == DESCRIBED:+ body["criteria"] = [_level_text(option) for option in options]+ else:+ body["criteria"] = [option_name(option, phrasing) for option in options]+ label_maps[qid] = {str(index): option["key"] for index, option in enumerate(options)}+ else:+ if phrasing == DESCRIBED:+ criteria = {option["key"]: option["description"] for option in options if option["description"]}+ elif phrasing == CONCRETE:+ criteria = {option["key"]: option["concrete"] for option in options if option.get("concrete")}+ else:+ criteria = {}+ if criteria:+ body["criteria"] = criteria+ label_maps[qid] = {"false": "false", "true": "true"}+ if len(label_maps[qid]) != len(options):+ raise ValueError(f"{qid}: two options share a name")+ rendered[qid] = body+ return rendered, label_maps+++def negation(statement: str) -> str:+ """The false-side label for a yes-or-no statement that ships no description of its own."""+ statement = statement.strip()+ return f"Not the case: {statement[0].lower()}{statement[1:]}"+++def label_options(question: dict[str, Any], variant: str) -> list[tuple[str, str]]:+ """Render one question for a label scorer, as `(key, label string)` pairs.++ A label scorer has no instruction channel, so each label has to carry its+ own meaning. `short` sends option names; `described` sends+ `"name: description"`, with underscores in a name read as spaces;+ `concrete` sends the concrete name where an option has one.++ A yes-or-no question whose options carry real names (the vulnerability set)+ sends those names under `short` and `concrete` and the descriptions under+ `described`. One whose options are only "yes" and "no" (the workflow set)+ always sends two full sentences, the true side first, because a bare "yes"+ or "no" says nothing without the question: the source description where+ there is one, otherwise the statement and its negation.+ """+ if variant not in VARIANTS:+ raise ValueError(f"unknown variant {variant!r}")+ qtype = question["type"]+ options = question["options"]+ if qtype == NOUL:+ by_key = {option["key"]: option for option in options}+ named = by_key["true"]["name"] not in ("yes", "no")+ if named and variant != DESCRIBED:+ pairs = [("true", option_name(by_key["true"], variant)), ("false", option_name(by_key["false"], variant))]+ else:+ true_text = by_key["true"]["description"] or question["instructions"]+ false_text = by_key["false"]["description"] or negation(question["instructions"])+ pairs = [("true", true_text), ("false", false_text)]+ elif qtype == SCORE:+ if variant == DESCRIBED:+ pairs = [(option["key"], humanize(_level_text(option))) for option in options]+ else:+ pairs = [(option["key"], humanize(option_name(option, variant))) for option in options]+ elif variant == DESCRIBED:+ pairs = [(option["key"], f"{humanize(option['name'])}: {option['description']}") for option in options]+ else:+ pairs = [(option["key"], humanize(option_name(option, variant))) for option in options]+ labels = [label for _, label in pairs]+ if len(set(labels)) != len(labels):+ raise ValueError(f"two options render to the same label: {labels}")+ return pairs+++def state_text(state: Any) -> str:+ """The text a label scorer receives: the state itself, or its JSON when it is structured.++ Serialised exactly the way the typed decision model serialises a dict state+ (`json.dumps(..., ensure_ascii=False)`), so both kinds of backend read the+ same characters.+ """+ if isinstance(state, str):+ return state+ return json.dumps(state, ensure_ascii=False)diff --git a/examples/typed-decisions/run.py b/examples/typed-decisions/run.pynew file mode 100644index 000000000..9fabc8160--- /dev/null+++ b/examples/typed-decisions/run.py@@ -0,0 +1,895 @@+#!/usr/bin/env python3+"""Ask every case its typed questions through each backend, or check the recorded calls.++ python3 run.py --check --calls run-output/calls.json # offline, nothing installed+ python3 run.py --show vulnerability-triage CVE-2023-5534 gliclass short++ uv sync+ uv run python run.py --record --set vulnerability-triage --backend laya --url http://localhost:8080+ python3 run.py --merge run-output/*--*.json # one calls.json and manifest.json++Backends, each behind the same three steps (build the requests, send them,+record what came back). Every planned backend goes through SIE `extract` with+`sie_sdk.SIEClient`, per AGENTS.md:++ laya convaiinnovations/laya, the English checkpoint+ laya-typed-decisions convaiinnovations/laya-typed-decisions, fine-tuned on+ the workflow set's training split+ gliclass knowledgator/gliclass-large-v3.0, one call per question+ gliclass-large-v1 knowledgator/gliclass-large-v1.0, one call per question+ gliclass-base-v1 knowledgator/gliclass-base-v1.0, one call per question+ gliclass-small-v1 knowledgator/gliclass-small-v1.0, one call per question+ gliclass-instruct-large knowledgator/gliclass-instruct-large-v1.0, one call per+ question, the question sent as its instruction+ gliclass-instruct-large-grouped+ the same model, every question a label group in one call+ gliformer-large knowledgator/gliformer-large-v1, every question a label+ group in one call, the question as the group's name+ gliner2-base fastino/gliner2-base-v1, one call per question+ gliner2-large fastino/gliner2-large-v1, one call per question+ qwen3-4b-instruct Qwen/Qwen3-4B-Instruct-2507, one structured-output+ call returning the CVSS v3.1 base metrics and the+ weakness class; the typed answers are read off those+ metrics+ qwen3.5-4b Qwen/Qwen3.5-4B, the same call, through its+ non-speculative profile+ nli-modernbert-base MoritzLaurer/ModernBERT-base-zeroshot-v2.0, an NLI+ zero-shot classifier, one call per question++The Laya checkpoints are Convai Innovations', GLiClass and GLiFormer are+Knowledgator's, GLiNER2 is Fastino's, the NLI classifier is MoritzLaurer's and+Qwen3 is Qwen's.++A typed backend (Laya) receives the state and a dict of typed questions in one+call and answers all of them; it encodes the state once per question inside+that call, so one call is not one encoder pass. A grouped backend receives the+state as text and every question as a label group in one call. A per-question+backend receives the state as text and one question's labels per call, so a+three-question case is three calls. See questions.py for how each question is+rendered for each.++`laya-package` and `laya-typed-decisions-package` run the same checkpoints+through their reference `laya` package in this process, at a pinned Hugging+Face revision. They are not in PLAN; they exist to check that SIE answers the+way the reference implementation does. The import of each client is deferred+into the runner that needs it, so `--check`, `--show` and `--merge` work on a+bare `python3`.++Every recorded latency is measured on whatever machine ran the recording, one+case at a time. It is not a served-latency benchmark.++`--check` rebuilds every recorded request from the case files and compares it+with the recorded one. It is a bijection over PLAN: a call that is missing,+recorded twice, or implied by no case fails, unless `--partial` limits the+check to the backends and sets present in the file.+"""++from __future__ import annotations++import argparse+import hashlib+import json+import os+import platform+import sys+import time+import urllib.request+from datetime import UTC, datetime+from pathlib import Path+from typing import TYPE_CHECKING, Any++import tuning+from questions import (+ CONCRETE,+ DESCRIBED,+ SHORT,+ VULNERABILITY_QUESTIONS,+ VULNERABILITY_TRIAGE,+ WORKFLOWS,+ Phrasing,+ asked,+ from_source_question,+ humanize,+ label_options,+ phrasing_of,+ state_text,+ typed_questions,+)+from tuning import TUNED++if TYPE_CHECKING:+ from sie_sdk import SIEClient++TASK = "typed-decisions"+DEFAULT_SIE_URL = "http://localhost:8080"++# The reference implementation, for checking SIE's Laya answers against it.+LAYA_PACKAGE_CHECKPOINTS = {+ "laya-package": ("convaiinnovations/laya", "aa8c91ca088ec597df95a0d1c76b3063cb2ae5e8"),+ "laya-typed-decisions-package": (+ "convaiinnovations/laya-typed-decisions",+ "bc76315b568af04bc19f133c8bca9a2b3a2d9905",+ ),+}+LAYA_FILES = ["rl_agent_config.json", "model.safetensors", "tokenizer/*", "encoder/*"]++SIE_MODELS: dict[str, dict[str, str]] = {+ "laya": {"model": "convaiinnovations/laya", "family": "laya", "vendor": "Convai Innovations"},+ "laya-typed-decisions": {+ "model": "convaiinnovations/laya-typed-decisions",+ "family": "laya",+ "vendor": "Convai Innovations",+ },+ "gliclass": {"model": "knowledgator/gliclass-large-v3.0", "family": "gliclass", "vendor": "Knowledgator"},+ "gliclass-large-v1": {"model": "knowledgator/gliclass-large-v1.0", "family": "gliclass", "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": {+ "model": "knowledgator/gliclass-instruct-large-v1.0",+ "family": "gliclass-instruct",+ "vendor": "Knowledgator",+ },+ "gliclass-instruct-large-grouped": {+ "model": "knowledgator/gliclass-instruct-large-v1.0",+ "family": "gliclass-grouped",+ "vendor": "Knowledgator",+ },+ "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"},+ "nli-modernbert-base": {+ "model": "MoritzLaurer/ModernBERT-base-zeroshot-v2.0",+ "family": "nli",+ "vendor": "MoritzLaurer",+ },+ "qwen3-4b-instruct": {"model": "Qwen/Qwen3-4B-Instruct-2507", "family": "llm", "vendor": "Qwen"},+ # Qwen3.5-4B's default profile decodes speculatively, which bypasses the+ # JSON-schema grammar. A schema request goes to its non-speculative profile,+ # as SIE's gateway routes it; against a bare server it is named here.+ "qwen3.5-4b": {"model": "Qwen/Qwen3.5-4B:no-spec", "family": "llm", "vendor": "Qwen"},+}++# The LLM backend scores a vulnerability report as CVSS v3.1 base metrics plus+# a weakness class, in one structured-output call; score.py reads the typed+# questions' answers off those metrics and computes the severity from them.+LLM_MAX_TOKENS = 300+LLM_SYSTEM = (+ "You score software vulnerability reports the way an NVD analyst does. Read the report and "+ "return its CVSS v3.1 base metrics and the kind of weakness it describes, as JSON matching "+ "the schema. Use only what the report says or clearly implies."+)+LLM_METRICS = {+ "attack_vector": ["network", "adjacent", "local", "physical"],+ "attack_complexity": ["low", "high"],+ "privileges_required": ["none", "low", "high"],+ "user_interaction": ["none", "required"],+ "scope": ["unchanged", "changed"],+ "confidentiality": ["none", "low", "high"],+ "integrity": ["none", "low", "high"],+ "availability": ["none", "low", "high"],+}++# An NLI classifier turns each label into a hypothesis through a template. The+# model config's template reads as a topic ("This text is about {}.") and fits+# option names; a yes-or-no question's labels are already statements, so they+# go in as they are.+NLI_TOPIC_TEMPLATE = "This text is about {}."+NLI_STATEMENT_TEMPLATE = "{}"++# How each family's answers come back, which is how score.py reads them.+TRANSPORTS = {+ "laya": "sie-extract-typed",+ "gliclass-grouped": "sie-extract-groups",+ "gliformer": "sie-extract-group-labels",+ "gliclass": "sie-extract",+ "gliclass-instruct": "sie-extract",+ "gliner2": "sie-extract",+ "nli": "sie-extract",+ "llm": "sie-chat-cvss",+}++# Which backend answers which set, per split, in which phrasings. On the+# vulnerability set every phrasing is recorded on dev, where tune.py chooses the+# per-question mix and the decision rules; test is recorded once, in that tuned+# mix. The workflow set keeps its source's own questions, has no dev split and+# 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)}+# 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")+# The LLM the page's board compares against, chosen on dev (PREREGISTRATION.md).+# Every LLM is recorded on dev; only this one is recorded on test.+PAGE_LLM = "qwen3-4b-instruct"+PLAN: dict[str, dict[str, dict[str, tuple[str, ...]]]] = {+ VULNERABILITY_TRIAGE: {+ backend: (+ ({"dev": (DESCRIBED,), "test": (DESCRIBED,)} if backend == PAGE_LLM else {"dev": (DESCRIBED,)})+ if backend in LLM_BACKENDS+ else {"dev": (*DEV_PHRASINGS.get(backend, (SHORT, DESCRIBED, CONCRETE)), TUNED), "test": (TUNED,)}+ )+ for backend in SIE_MODELS+ },+ WORKFLOWS: {backend: {"test": (DESCRIBED,)} for backend in SIE_MODELS if backend not in LLM_BACKENDS},+}+VARIANT_CHOICES = (SHORT, DESCRIBED, CONCRETE, TUNED)+++def load(path: Path) -> Any:+ if not path.exists():+ raise SystemExit(f"{path} is missing. Run: python3 fetch.py (or build_inputs.py)")+ return json.loads(path.read_text(encoding="utf-8"))+++def case_file(data_dir: Path, set_name: str) -> dict[str, Any]:+ return load(data_dir / f"inputs/{set_name}/cases.json")+++def questions_for(cases: dict[str, Any], case: dict[str, Any]) -> dict[str, dict[str, Any]]:+ """The question set one case is asked, in the shape questions.py renders."""+ if cases["set"] == VULNERABILITY_TRIAGE:+ if cases["questions"] != VULNERABILITY_QUESTIONS:+ raise SystemExit("the case file's questions differ from questions.py; rebuild or re-fetch the inputs")+ return cases["questions"]+ source = cases["questions"][case["workflow"]]+ return {qid: from_source_question(question) for qid, question in source.items()}+++def is_package(backend: str) -> bool:+ return backend in LAYA_PACKAGE_CHECKPOINTS+++def family_of(backend: str) -> str:+ return "laya" if is_package(backend) else SIE_MODELS[backend]["family"]+++def grouped_instruction(questions: dict[str, dict[str, Any]]) -> str:+ """One instruction naming every question, for a model that takes one prompt for the whole call."""+ return " ".join(f"{humanize(qid)}: {question['instructions']}" for qid, question in questions.items())+++def requests_for(+ backend: str, variant: Phrasing, state: Any, questions: dict[str, dict[str, Any]]+) -> list[dict[str, Any]]:+ """Every request one case sends through one backend, built from the inputs alone.++ `variant` is a phrasing, or a dict of question id to phrasing (the tuned+ mix; see `tuning.phrasing`). This is what `--check` compares with the+ recording, so it must stay a pure function of its arguments. A grouped+ request also records which group name stands for which question, outside+ the body it sends.+ """+ if is_package(backend):+ rendered, _ = typed_questions(questions, variant)+ return [{"state": state, "questions": rendered}]+ family = family_of(backend)+ if family == "laya":+ # 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)+ item = {"text": state} if isinstance(state, str) else {"metadata": {"state": state}}+ return [{"body": {"items": [item], "params": {"output_schema": rendered}}}]+ text = state_text(state)+ if family == "llm":+ weakness = [option["name"] for option in questions["weakness"]["options"]]+ schema = {+ "type": "object",+ "properties": {+ "weakness": {"type": "string", "enum": weakness},+ **{name: {"type": "string", "enum": values} for name, values in LLM_METRICS.items()},+ },+ "required": ["weakness", *LLM_METRICS],+ "additionalProperties": False,+ }+ return [+ {+ "body": {+ "model": SIE_MODELS[backend]["model"],+ "messages": [+ {"role": "system", "content": LLM_SYSTEM},+ {"role": "user", "content": text},+ ],+ "max_completion_tokens": LLM_MAX_TOKENS,+ "temperature": 0.0,+ "response_format": {+ "type": "json_schema",+ "json_schema": {"name": "cvss", "strict": True, "schema": schema},+ },+ }+ }+ ]+ 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+ # group's name as part of its prompt and takes no instruction, so there+ # the name is the question itself.+ if family == "gliclass-grouped":+ names = {qid: humanize(qid) for qid in questions}+ else:+ names = {qid: question["instructions"] for qid, question in questions.items()}+ groups = {+ names[qid]: [label for _, label in label_options(q, phrasing_of(variant, qid))]+ for qid, q in questions.items()+ }+ if family == "gliclass-grouped":+ params: dict[str, Any] = {+ "instruction": grouped_instruction(questions),+ "options": {"label_groups": groups, "overflow_policy": "truncate_text"},+ }+ else:+ # Every label's score, not only the winner's: threshold 0 and multi-label.+ params = {"options": {"label_groups": groups, "multi_label": True, "threshold": 0.0}}+ return [+ {+ "groups": {names[qid]: qid for qid in questions},+ "body": {"items": [{"text": text}], "params": params},+ }+ ]+ built = []+ for qid, question in questions.items():+ labels = [label for _, label in label_options(question, phrasing_of(variant, qid))]+ params = {"labels": labels}+ if family == "gliner2":+ # GLiNER2 classifies against a named task; threshold 0 keeps the top+ # label even when its confidence is low, rather than returning nothing.+ params["options"] = {"classification_task": humanize(qid), "threshold": 0.0}+ if family in ("gliclass", "gliclass-instruct"):+ # Cut the record text, never the labels, when the two do not fit in+ # 512 tokens together. Without it GLiClass v1.0 base and small refuse+ # the longest customer-service threads with the full label set.+ params["options"] = {"overflow_policy": "truncate_text"}+ if family == "gliclass-instruct":+ # The instruct models take a task prompt, so the question itself goes in.+ params["instruction"] = question["instructions"]+ if family == "nli":+ template = NLI_STATEMENT_TEMPLATE if question["type"] == "noul" else NLI_TOPIC_TEMPLATE+ params["options"] = {"hypothesis_template": template}+ built.append({"question": qid, "body": {"items": [{"text": text}], "params": params}})+ return built+++def model_of(backend: str) -> str:+ if is_package(backend):+ return LAYA_PACKAGE_CHECKPOINTS[backend][0]+ return SIE_MODELS[backend]["model"]+++class CallFailedError(Exception):+ """A call that returned, but not with something that can be recorded as an answer."""+++class LayaPackageRunner:+ """A Laya checkpoint through its reference `laya` package, in this process."""++ transport = "laya-python-package"++ def __init__(self, backend: str, device: str) -> None:+ # Deferred: optional dependencies, needed only to record.+ import laya # noqa: PLC0415+ import torch # noqa: PLC0415+ from huggingface_hub import snapshot_download # noqa: PLC0415++ repo, revision = LAYA_PACKAGE_CHECKPOINTS[backend]+ path = snapshot_download(repo, revision=revision, allow_patterns=LAYA_FILES)+ self.agent = laya.load(path, device=device)+ self.model = repo+ self.describe = {+ "model": repo,+ "revision": revision,+ "package": f"laya=={laya.__version__}",+ "torch": torch.__version__,+ "torch_threads": torch.get_num_threads(),+ "device": str(self.agent.device),+ "temperature_by_options": self.agent.cfg.get("temperature_by_options"),+ }++ def send(self, request: dict[str, Any]) -> dict[str, Any]:+ result = self.agent.predict(request["state"], request["questions"])+ answers = result.get("answers") or {}+ if set(answers) != set(request["questions"]):+ raise CallFailedError(f"answered {sorted(answers)}, asked {sorted(request['questions'])}")+ return result+++class SIEExtractRunner:+ """A model served by SIE, called through `sie_sdk.SIEClient.extract`.++ What comes back depends on the family, and is recorded under a transport+ name that tells score.py how to read it: Laya's typed answers under `data`,+ grouped GLiClass answers under `data`, GLiFormer's grouped labels and every+ per-question model's labels under `classifications`.+ """++ def __init__(self, backend: str, base_url: str, api_key: str | None) -> None:+ # Deferred so --check, --show and --merge run on a bare python3.+ from sie_sdk import SIEClient # noqa: PLC0415++ self.model = SIE_MODELS[backend]["model"]+ self.family = SIE_MODELS[backend]["family"]+ self.transport = TRANSPORTS[self.family]+ self.base_url = base_url+ self.client: SIEClient = SIEClient(base_url, api_key=api_key, timeout_s=900)+ self.describe = {"model": self.model, "endpoint": base_url, **served_model(base_url, self.model, api_key)}++ def send(self, request: dict[str, Any]) -> dict[str, Any]:+ body = request["body"]+ if self.family == "llm":+ completion = self.client.chat_completions(+ body["model"],+ body["messages"],+ max_completion_tokens=body["max_completion_tokens"],+ temperature=body["temperature"],+ response_format=body["response_format"],+ )+ choices = completion.get("choices") or []+ content = (choices[0].get("message") or {}).get("content") if choices else None+ if not content:+ raise CallFailedError("response carried no assistant message")+ try:+ parsed = json.loads(content)+ except ValueError as error:+ raise CallFailedError(f"assistant message is not JSON: {error}") from error+ return {"content": content, "parsed": parsed, "usage": completion.get("usage")}+ params = body["params"]+ result = self.client.extract(+ self.model,+ body["items"][0],+ labels=params.get("labels"),+ output_schema=params.get("output_schema"),+ instruction=params.get("instruction"),+ options=params.get("options"),+ )+ if result.get("error"):+ raise CallFailedError(f"item error {result['error']}")+ if self.family == "laya":+ 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":+ data = result.get("data") or {}+ if set(data) != set(request["groups"]):+ raise CallFailedError(f"answered groups {sorted(data)}, asked {sorted(request['groups'])}")+ return {"data": data, "model": result.get("model", self.model)}+ classifications = result.get("classifications")+ if not classifications:+ raise CallFailedError("response carried no classifications")+ if self.family == "gliformer":+ sent = {f"{name}.{label}" for name, labels in params["options"]["label_groups"].items() for label in labels}+ else:+ sent = set(params["labels"])+ unknown = {entry["label"] for entry in classifications} - sent+ if unknown:+ raise CallFailedError(f"response named labels that were not sent: {sorted(unknown)[:3]}")+ return {"classifications": classifications, "model": result.get("model", self.model)}+++def served_model(base_url: str, model: str, api_key: str | None) -> dict[str, Any]:+ """The revision the server reports for `model`, from its model list."""+ request = urllib.request.Request(f"{base_url}/v1/models") # noqa: S310+ if api_key:+ request.add_header("Authorization", f"Bearer {api_key}")+ try:+ with urllib.request.urlopen(request, timeout=30) as response: # noqa: S310+ listed = json.loads(response.read())+ except OSError as error:+ return {"served_revision": None, "model_list_error": str(error)}+ entries = (listed.get("models") or listed.get("data") or []) if isinstance(listed, dict) else []+ for entry in entries:+ if model in (entry.get("name"), entry.get("id")):+ return {"served_revision": entry.get("revision")}+ return {"served_revision": None}+++Runner = LayaPackageRunner | SIEExtractRunner+++def make_runner(backend: str, args: argparse.Namespace) -> Runner:+ if is_package(backend):+ return LayaPackageRunner(backend, args.device)+ api_key = os.environ.get("SIE_API_KEY", "").strip() or None+ return SIEExtractRunner(backend, args.url, api_key)+++def call_id(set_name: str, backend: str, variant: str, slug: str) -> str:+ return f"{set_name}/{backend}/{variant}/{slug}"+++def record_case(+ runner: Runner,+ set_name: str,+ backend: str,+ variant: str,+ case: dict[str, Any],+ requests: list[dict[str, Any]],+) -> dict[str, Any]:+ entry: dict[str, Any] = {+ "id": call_id(set_name, backend, variant, case["slug"]),+ "set": set_name,+ "backend": backend,+ "variant": variant,+ "case": case["slug"],+ "split": case["split"],+ "model": runner.model,+ "transport": runner.transport,+ "requests": requests,+ }+ requested_at = datetime.now(UTC).isoformat(timespec="seconds")+ responses: list[dict[str, Any]] = []+ per_request_ms: list[float] = []+ try:+ for request in requests:+ started = time.perf_counter()+ responses.append(runner.send(request))+ per_request_ms.append(round((time.perf_counter() - started) * 1000, 2))+ except Exception as error: # noqa: BLE001+ entry.update(+ {+ "status": "error",+ "error": {"type": type(error).__name__, "message": str(error)},+ "responses": None,+ "timing": {"at": requested_at, "latency_ms": None, "per_request_ms": per_request_ms},+ }+ )+ return entry+ entry.update(+ {+ "status": "ok",+ "responses": responses,+ "timing": {+ "at": requested_at,+ "latency_ms": round(sum(per_request_ms), 2),+ "per_request_ms": per_request_ms,+ },+ }+ )+ return entry+++def environment() -> dict[str, Any]:+ cpu = platform.processor() or platform.machine()+ try:+ for line in Path("/proc/cpuinfo").read_text(encoding="utf-8").splitlines():+ if line.startswith("model name"):+ cpu = line.split(":", 1)[1].strip()+ break+ except OSError:+ pass+ return {+ "python": platform.python_version(),+ "platform": platform.platform(),+ "cpu": cpu,+ "cpu_count": os.cpu_count(),+ "hardware_note": "latencies are one record at a time on this machine, not a served-latency benchmark",+ }+++def planned(set_name: str, backend: str, split: str) -> tuple[str, ...]:+ """The variants PLAN records for a backend on one split; a reference-package backend follows its SIE twin."""+ return PLAN[set_name].get(backend.removesuffix("-package"), {}).get(split, ())+++def record(args: argparse.Namespace) -> int:+ data_dir = Path(args.data)+ cases = case_file(data_dir, args.set)+ splits = [args.split] if args.split else sorted({case["split"] for case in cases["cases"]})+ work: list[tuple[str, dict[str, Any]]] = []+ for split in splits:+ variants = tuple(args.variant) if args.variant else planned(args.set, args.backend, split)+ selected = [case for case in cases["cases"] if case["split"] == split]+ if args.limit:+ selected = selected[: args.limit]+ work.extend((variant, case) for variant in variants for case in selected)+ if not work:+ raise SystemExit(f"nothing planned for {args.set}/{args.backend} on {', '.join(splits)}")++ def phrasing(variant: str) -> Phrasing:+ return tuning.phrasing(args.set, args.backend, variant)++ runner = make_runner(args.backend, args)+ # One unrecorded call first, so model loading is not charged to the first case.+ warm_variant, warm = work[0]+ for request in requests_for(+ args.backend, phrasing(warm_variant), warm["state"], asked(args.set, args.backend, questions_for(cases, warm))+ ):+ runner.send(request)++ calls: list[dict[str, Any]] = []+ failed: list[str] = []+ for index, (variant, case) in enumerate(work, start=1):+ requests = requests_for(+ args.backend, phrasing(variant), case["state"], asked(args.set, args.backend, questions_for(cases, case))+ )+ entry = record_case(runner, args.set, args.backend, variant, case, requests)+ calls.append(entry)+ if entry["status"] != "ok":+ failed.append(f"{entry['id']}: {entry['error']['type']}: {entry['error']['message']}")+ if index % 50 == 0 or index == len(work):+ print(f"{args.backend}: {index} of {len(work)}", file=sys.stderr, flush=True)++ out = Path(args.out or f"run-output/{args.set}--{args.backend}.json")+ out.parent.mkdir(parents=True, exist_ok=True)+ payload = {+ "task": TASK,+ "set": args.set,+ "backend": args.backend,+ "recorded": {+ "at": datetime.now(UTC).isoformat(timespec="seconds"),+ "runner": runner.describe,+ "environment": environment(),+ "concurrency": 1,+ "warm_up": "one unrecorded case before the first recorded call",+ },+ "call_count": len(calls),+ "failed_calls": len(failed),+ "complete": not failed and not args.limit,+ "calls": calls,+ }+ out.write_text(json.dumps(payload, indent=1, ensure_ascii=False) + "\n", encoding="utf-8")+ print(f"wrote {out}: {len(calls)} calls, {len(failed)} failed")+ for line in failed:+ print(f" FAILED {line}", file=sys.stderr)+ return 1 if failed else 0+++def expected_calls(+ data_dir: Path, scope: set[tuple[str, str, str, str]] | None+) -> dict[str, tuple[str, str, str, list]]:+ """Every call PLAN implies, by id, with the requests the inputs rebuild for it.++ `scope`, when given, keeps only the (set, backend, variant, split) tuples+ present in the recording being checked.+ """+ expected: dict[str, tuple[str, str, str, list]] = {}+ tuned = tuning.load()+ for set_name, backends in PLAN.items():+ cases = case_file(data_dir, set_name) if scope is None or any(t[0] == set_name for t in scope) else None+ if cases is None:+ continue+ for backend, splits in backends.items():+ for case in cases["cases"]:+ for variant in splits.get(case["split"], ()):+ if scope is not None and (set_name, backend, variant, case["split"]) not in scope:+ continue+ phrasing = tuning.phrasing(set_name, backend, variant, tuned)+ requests = requests_for(+ backend, phrasing, case["state"], asked(set_name, backend, questions_for(cases, case))+ )+ expected[call_id(set_name, backend, variant, case["slug"])] = (set_name, backend, variant, requests)+ return expected+++def body_digest(body: Any) -> str:+ """SHA-256 of a request body as canonical JSON (sorted keys, no whitespace, UTF-8)."""+ canonical = json.dumps(body, sort_keys=True, separators=(",", ":"), ensure_ascii=False)+ return hashlib.sha256(canonical.encode("utf-8")).hexdigest()+++def digested(requests: list[dict[str, Any]]) -> list[dict[str, Any]]:+ """Requests with each body replaced by its digest; a request already digested is kept."""+ out = []+ for request in requests:+ if "body" in request:+ request = {**{k: v for k, v in request.items() if k != "body"}, "body_sha256": body_digest(request["body"])}+ out.append(request)+ return out+++def check(data_dir: Path, calls_paths: list[Path], partial: bool) -> int:+ calls: list[dict[str, Any]] = []+ for path in calls_paths:+ calls.extend(load(path)["calls"])+ scope = {(call["set"], call["backend"], call["variant"], call["split"]) for call in calls} if partial else None+ expected = expected_calls(data_dir, scope)++ recorded: dict[str, dict[str, Any]] = {}+ duplicates: list[str] = []+ for call in calls:+ if call["id"] in recorded:+ duplicates.append(call["id"])+ continue+ recorded[call["id"]] = call+ missing = sorted(set(expected) - set(recorded))+ unexpected = sorted(set(recorded) - set(expected))++ mismatched: list[str] = []+ matched = 0+ for identifier in sorted(set(expected) & set(recorded)):+ set_name, backend, variant, requests = expected[identifier]+ call = recorded[identifier]+ if (call["set"], call["backend"], call["variant"]) != (set_name, backend, variant):+ mismatched.append(f"{identifier}: labelled {call['set']}/{call['backend']}/{call['variant']}")+ elif call["model"] != model_of(backend):+ mismatched.append(f"{identifier}: model {call['model']} is not {model_of(backend)}")+ elif digested(call["requests"]) != digested(requests):+ mismatched.append(f"{identifier}: rebuilt requests differ from the recorded ones")+ else:+ matched += 1++ print(f"{matched} of {len(calls)} recorded calls rebuilt from the inputs and matched")+ print(f"{len(expected)} calls expected{' within the recorded scope' if partial else ''}, {len(recorded)} recorded")+ for identifier in missing:+ print(f"MISSING {identifier}", file=sys.stderr)+ for identifier in duplicates:+ print(f"DUPLICATE {identifier}", file=sys.stderr)+ for identifier in unexpected:+ print(f"UNEXPECTED {identifier}", file=sys.stderr)+ for line in mismatched:+ print(f"MISMATCH {line}", file=sys.stderr)+ return 1 if (missing or duplicates or unexpected or mismatched) else 0+++def sha256_file(path: Path) -> str:+ return hashlib.sha256(path.read_bytes()).hexdigest()+++# Where the inputs come from, and the terms they are used under. Written into+# manifest.json, which travels with the published evidence.+INPUT_SOURCES = {+ VULNERABILITY_TRIAGE: {+ "source": "National Vulnerability Database (NVD), CVE API 2.0, https://nvd.nist.gov/developers/vulnerabilities",+ "what": "CVE descriptions and NVD analyst CWE and CVSS v3.1 assessments, as the case file records them",+ "nvd_notice": "This product uses data from the NVD API but is not endorsed or certified by the NVD.",+ "cve_copyright": (+ "Copyright (c) 1999-2026, The MITRE Corporation. CVE is a trademark and the CVE logo is a "+ "registered trademark of The MITRE Corporation."+ ),+ "cve_license": (+ "MITRE hereby grants 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 Common Vulnerabilities and Exposures (CVE). Any "+ "copy you make for such purposes is authorized provided that you reproduce MITRE's copyright "+ "designation and this license in any such copy. (CVE Program Terms of Use, https://www.cve.org/Legal/TermsOfUse)"+ ),+ },+ WORKFLOWS: {+ "source": "LocalLLaMA/typed-decisions on Hugging Face, https://huggingface.co/datasets/LocalLLaMA/typed-decisions",+ "revision": "c76749ec58bd8c3d2ea706b31c333a9059c38f90",+ "license": "Apache-2.0, https://www.apache.org/licenses/LICENSE-2.0",+ "changes": (+ "400 of the test split's rows (100 per workflow, in salted-hash order) were reformatted into "+ "cases.json: each row's state, questions and gold parsed from JSON strings; no text was changed"+ ),+ },+}+++def merge(+ data_dir: Path,+ paths: list[Path],+ out_dir: Path,+ server_commits: list[str] | None = None,+ attach: list[str] | None = None,+ hardware: str | None = None,+) -> int:+ """Combine per-backend recordings into one compact calls.json and a manifest that pins every file.++ calls.json keeps every response as recorded. Each request body is stored as+ its SHA-256 (`body_sha256`): the body is rebuilt from the inputs by+ `--check`, which compares digests, and `--show` prints it. `attach` names+ files already in `out_dir` (a scorer's summary, say) to pin as well.+ """+ recordings = [load(path) for path in paths]+ calls = [+ {**call, "requests": digested(call["requests"])} for recording in recordings for call in recording["calls"]+ ]+ ids = [call["id"] for call in calls]+ if len(ids) != len(set(ids)):+ raise SystemExit("duplicate call ids across the recordings; refusing to merge")+ incomplete = [str(path) for path, recording in zip(paths, recordings) if not recording.get("complete")]+ out_dir.mkdir(parents=True, exist_ok=True)+ calls_path = out_dir / "calls.json"+ calls_path.write_text(+ json.dumps(+ {+ "task": TASK,+ "call_count": len(calls),+ "failed_calls": sum(recording["failed_calls"] for recording in recordings),+ "complete": not incomplete,+ "recordings": [+ {"set": recording["set"], "backend": recording["backend"], **recording["recorded"]}+ for recording in recordings+ ],+ "calls": calls,+ },+ separators=(",", ":"),+ ensure_ascii=False,+ )+ + "\n",+ encoding="utf-8",+ )+ inputs = {+ f"inputs/{set_name}/cases.json": sha256_file(data_dir / f"inputs/{set_name}/cases.json") for set_name in PLAN+ }+ attached = {name: sha256_file(out_dir / name) for name in attach or []}+ files = {**inputs, "calls.json": sha256_file(calls_path), **attached}+ calls_by_set: dict[str, int] = {}+ statuses: dict[str, int] = {}+ for call in calls:+ calls_by_set[call["set"]] = calls_by_set.get(call["set"], 0) + 1+ statuses[call["status"]] = statuses.get(call["status"], 0) + 1+ manifest = {+ "task": TASK,+ "dataset": "superlinked/sie-task-evidence",+ "call_count": len(calls),+ "calls_by_set": calls_by_set,+ "statuses": statuses,+ "calls_sha256": files["calls.json"],+ "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 [],+ "hardware": hardware,+ "models": sorted({call["model"] for call in calls}),+ "run_dates": sorted({recording["recorded"]["at"][:10] for recording in recordings}),+ "plan": {+ set_name: {b: {split: list(v) for split, v in splits.items()} for b, splits in backends.items()}+ for set_name, backends in PLAN.items()+ },+ "tuning_sha256": sha256_file(tuning.TUNING_PATH) if tuning.TUNING_PATH.exists() else None,+ "input_sources": INPUT_SOURCES,+ "request_bodies": "each request body is stored as body_sha256, the SHA-256 of its canonical JSON; run.py --check rebuilds and compares them",+ }+ (out_dir / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")+ print(f"wrote {calls_path} ({len(calls)} calls) and {out_dir / 'manifest.json'}")+ for path in incomplete:+ print(f"note: {path} is not a complete recording", file=sys.stderr)+ return 0+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--data", default="data", help="directory holding inputs/ (default: data)")+ parser.add_argument("--check", action="store_true", help="offline check, the default")+ parser.add_argument("--calls", nargs="+", default=["data/calls.json"], help="recordings --check reads")+ parser.add_argument("--partial", action="store_true", help="check only the sets and backends recorded")+ parser.add_argument("--show", nargs=4, metavar=("SET", "CASE", "BACKEND", "VARIANT"), help="print requests")+ 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("--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)+ parser.add_argument("--backend", choices=sorted({*LAYA_PACKAGE_CHECKPOINTS, *SIE_MODELS}), default="laya")+ parser.add_argument("--variant", nargs="+", choices=VARIANT_CHOICES, help="record these variants, not the plan's")+ parser.add_argument("--split", choices=("dev", "test"), help="record one split only")+ parser.add_argument("--limit", type=int, help="record the first N cases only (marks the recording incomplete)")+ parser.add_argument("--url", default=os.environ.get("SIE_BASE_URL", DEFAULT_SIE_URL), help="SIE endpoint")+ parser.add_argument("--device", default="cpu", help="device for the reference Laya package (default: cpu)")+ parser.add_argument("--out", help="where --record writes (default: run-output/<set>--<backend>.json)")+ args = parser.parse_args()+ data_dir = Path(args.data)++ if args.show:+ set_name, slug, backend, variant = args.show+ cases = case_file(data_dir, set_name)+ case = next((item for item in cases["cases"] if item["slug"] == slug), None)+ if case is None:+ raise SystemExit(f"no case {slug} in {set_name}")+ requests = requests_for(+ backend,+ tuning.phrasing(set_name, backend, variant),+ case["state"],+ asked(set_name, backend, questions_for(cases, case)),+ )+ print(json.dumps(requests, indent=2, ensure_ascii=False))+ return 0+ if args.merge:+ return merge(+ data_dir,+ [Path(path) for path in args.merge],+ Path(args.merge_out),+ args.server_commit,+ args.attach,+ args.hardware,+ )+ if args.record:+ return record(args)+ return check(data_dir, [Path(path) for path in args.calls], args.partial)+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/score.py b/examples/typed-decisions/score.pynew file mode 100644index 000000000..126d83726--- /dev/null+++ b/examples/typed-decisions/score.py@@ -0,0 +1,723 @@+#!/usr/bin/env python3+"""Score the recorded answers against each case's gold, per backend and question type.++ python3 fetch.py+ python3 score.py # reads data/calls.json+ python3 score.py --calls run-output/calls.json # or any recordings+ python3 score.py --json summary.json # also write every figure as JSON++Standard library only. No API key, no model, no inference spend.++For each set, backend and question type it reports:++ accuracy the answer's top option equals the gold option+ macro F1 F1 per option, averaged over the options that occur in the gold+ or the answers of that question, then over the questions+ Brier mean squared error of the returned probabilities against the+ gold option; only where the backend returns a probability for+ every option (GLiNER2 in single-label mode returns the top one)+ ECE expected calibration error of the top option's probability,+ 10 equal-width bins+ score MAE for rubric questions, |expected level - gold level|, where the+ expected level is the probability-weighted mean when every+ level has a probability and the top level otherwise++and two references computed on the same cases: the majority option of each+question (what a model that ignores the input scores at best), and for yes-or-no+questions the Brier score of always answering the base rate.++On vulnerability triage a backend is scored in its `tuned` configuration: the+phrasing and decision rule per question that tune.py chose on the dev slice+(PREREGISTRATION.md). Each backend's severity is computed from its answers+(cvss.compose_severity) and scored on the exact level. Rubric answers are never+scored within one level.++Latency is the recorded wall time per case, all of that case's requests, on the+recording machine, one case at a time. It is printed for orientation only.++PUBLISHED holds every figure the page and the README publish from this+recording. The script exits nonzero whenever the recording stops reproducing+one of them. page.py asserts the page's cards, speed claims and withdrawals.+"""++from __future__ import annotations++import argparse+import json+import math+import statistics+import sys+from collections import Counter, defaultdict+from pathlib import Path+from typing import Any++import cvss+import lanes+import tuning+from questions import (+ CHOICE,+ DESCRIBED,+ NOUL,+ SCORE,+ SHORT,+ TYPES,+ VULNERABILITY_QUESTIONS,+ VULNERABILITY_TRIAGE,+ WORKFLOWS,+ asked,+ from_source_question,+ label_options,+ phrasing_of,+ typed_questions,+)++HTTP_OK = "ok"+BINS = 10+# Balanced accuracy averages recall over options with at least this many records.+BALANCED_MIN_RECORDS = 10+# The confidence cut-offs selective accuracy is reported at, for pick-one questions.+SELECTIVE_CUTOFFS = (0.5, 0.7, 0.8, 0.9, 0.95)+SUM_TOLERANCE = 0.02++# "<set>/<backend>/<scope>/<metric>" -> a figure the page or the README+# publishes. The scope is a question type (choice, noul, score), "all", or a+# question id. `correct` is a count; every other metric is rounded to 3.+# All test slice, in each backend's tuned configuration (the LLM's described).+VT, WF = VULNERABILITY_TRIAGE, WORKFLOWS+PUBLISHED: 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 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,+ # 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,+ # The board: the LLM (Qwen/Qwen3-4B-Instruct-2507)+ f"{VT}/qwen3-4b-instruct/attack_vector/correct": 150,+ f"{VT}/qwen3-4b-instruct/attack_vector/balanced_accuracy": 0.867,+ f"{VT}/qwen3-4b-instruct/remote_unauthenticated/correct": 129,+ f"{VT}/qwen3-4b-instruct/remote_unauthenticated/balanced_accuracy": 0.815,+ # The catalog+ f"{VT}/gliclass-instruct-large/weakness/correct": 142,+ f"{VT}/gliclass-instruct-large/attack_vector/correct": 149,+ f"{VT}/laya/weakness/correct": 134,+ f"{VT}/laya-typed-decisions/weakness/correct": 145,+ # 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}/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 labels+ f"{WF}/laya-typed-decisions/all/accuracy": 0.769,+ f"{WF}/laya-typed-decisions/all/macro_f1": 0.663,+}+++def load(path: Path) -> Any:+ if not path.exists():+ raise SystemExit(f"{path} is missing. Run: python3 fetch.py")+ return json.loads(path.read_text(encoding="utf-8"))+++def probability(value: Any, where: str) -> float:+ """A returned probability, refusing anything that is not a finite number in [0, 1]."""+ if isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value):+ raise SystemExit(f"{where}: non-numeric probability {value!r}")+ if not -1e-6 <= value <= 1 + 1e-6:+ raise SystemExit(f"{where}: probability {value!r} outside [0, 1]")+ return min(1.0, max(0.0, float(value)))+++def full_distribution(raw: dict[str, float], keys: list[str], where: str) -> dict[str, float]:+ if set(raw) != set(keys):+ raise SystemExit(f"{where}: answered options {sorted(raw)}, expected {sorted(keys)}")+ total = sum(raw.values())+ if total <= 0 or abs(total - 1) > SUM_TOLERANCE:+ raise SystemExit(f"{where}: probabilities sum to {total}")+ return {key: value / total for key, value in raw.items()}+++def answer(distribution: dict[str, float] | None, top: str, top_p: float, qtype: str) -> dict[str, Any]:+ return {"distribution": distribution, "top": top, "top_p": top_p, "type": qtype}+++def phrasing_for(call: dict[str, Any]) -> Any:+ """The phrasing a call was sent in: its variant, or the tuned per-question mix it stands for."""+ return tuning.phrasing(call["set"], call["backend"], call["variant"])+++def from_typed(call: dict[str, Any], questions: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:+ """Answers from a typed decision model's response: one response holding every question."""+ _, label_maps = typed_questions(questions, phrasing_for(call))+ response = call["responses"][0]+ # The package returns `answers`; the SIE adapter returns the same dict as `data`.+ returned = response["answers"] if call["transport"] == "laya-python-package" else response["data"]+ answers = {}+ for qid, question in questions.items():+ where = f"{call['id']} {qid}"+ if qid not in returned:+ raise SystemExit(f"{where}: no answer")+ entry = returned[qid]+ option_keys = [option["key"] for option in question["options"]]+ if question["type"] == NOUL:+ p_true = probability(entry["noul"], where)+ distribution = {"true": p_true, "false": 1.0 - p_true}+ else:+ raw: dict[str, float] = {}+ for label, value in entry["probabilities"].items():+ if label not in label_maps[qid]:+ raise SystemExit(f"{where}: returned option {label!r} that was not sent")+ raw[label_maps[qid][label]] = probability(value, where)+ distribution = full_distribution(raw, option_keys, where)+ top = max(option_keys, key=lambda key: distribution[key])+ answers[qid] = answer(distribution, top, distribution[top], question["type"])+ return answers+++def from_labels(call: dict[str, Any], questions: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:+ """Answers from a label scorer: one response per question, in request order."""+ answers = {}+ if len(call["responses"]) != len(call["requests"]):+ raise SystemExit(f"{call['id']}: {len(call['responses'])} responses to {len(call['requests'])} requests")+ for request, response in zip(call["requests"], call["responses"]):+ qid = request["question"]+ question = questions[qid]+ where = f"{call['id']} {qid}"+ key_of = {label: key for key, label in label_options(question, phrasing_of(phrasing_for(call), qid))}+ raw: dict[str, float] = {}+ for entry in response["classifications"]:+ if entry["label"] not in key_of:+ raise SystemExit(f"{where}: returned label {entry['label']!r} that was not sent")+ if key_of[entry["label"]] in raw:+ raise SystemExit(f"{where}: label {entry['label']!r} returned twice")+ raw[key_of[entry["label"]]] = probability(entry["score"], where)+ if not raw:+ raise SystemExit(f"{where}: no classification returned")+ option_keys = [option["key"] for option in question["options"]]+ if len(raw) == len(option_keys):+ distribution = full_distribution(raw, option_keys, where)+ elif len(raw) == 1 and len(option_keys) == 2: # noqa: PLR2004+ # A single-label answer over two options fixes the other one.+ (top_key, top_p), other = next(iter(raw.items())), next(k for k in option_keys if k not in raw)+ distribution = {top_key: top_p, other: 1.0 - top_p}+ elif len(raw) == 1:+ top_key, top_p = next(iter(raw.items()))+ answers[qid] = answer(None, top_key, top_p, question["type"])+ continue+ else:+ raise SystemExit(f"{where}: {len(raw)} of {len(option_keys)} options returned")+ top = max(option_keys, key=lambda key: distribution[key])+ answers[qid] = answer(distribution, top, distribution[top], question["type"])+ return answers+++def distribution_over(+ raw: dict[str, float], question: dict[str, Any], variant: str, where: str, *, missing_is_zero: bool = False+) -> dict[str, float]:+ """Map `{label string: score}` onto option keys and normalise it to sum to one."""+ key_of = {label: key for key, label in label_options(question, variant)}+ keyed: dict[str, float] = {}+ for label, value in raw.items():+ if label not in key_of:+ raise SystemExit(f"{where}: returned label {label!r} that was not sent")+ keyed[key_of[label]] = probability(value, where)+ option_keys = [option["key"] for option in question["options"]]+ if missing_is_zero:+ keyed = {key: keyed.get(key, 0.0) for key in option_keys}+ if set(keyed) != set(option_keys):+ raise SystemExit(f"{where}: answered options {sorted(keyed)}, expected {sorted(option_keys)}")+ total = sum(keyed.values())+ if total <= 0:+ raise SystemExit(f"{where}: every option scored zero")+ return {key: value / total for key, value in keyed.items()}+++def from_group_answers(call: dict[str, Any], questions: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:+ """Answers from one grouped GLiClass call: `data[group]` is a choice answer per question.++ Each group was scored with its own softmax, so its probabilities already+ sum to one; they are still checked and normalised the same way.+ """+ request = call["requests"][0]+ data = call["responses"][0]["data"]+ answers = {}+ for group, qid in request["groups"].items():+ where = f"{call['id']} {qid}"+ if group not in data:+ raise SystemExit(f"{where}: no answer for group {group!r}")+ question = questions[qid]+ distribution = distribution_over(+ data[group]["probabilities"], question, phrasing_of(phrasing_for(call), qid), where+ )+ option_keys = [option["key"] for option in question["options"]]+ top = max(option_keys, key=lambda key: distribution[key])+ answers[qid] = answer(distribution, top, distribution[top], question["type"])+ if set(answers) != set(questions):+ raise SystemExit(f"{call['id']}: groups cover {sorted(answers)}, questions are {sorted(questions)}")+ return answers+++def from_group_labels(call: dict[str, Any], questions: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:+ """Answers from one grouped GLiFormer call: flat `"group.label"` classifications.++ GLiFormer scores each label with its own sigmoid and only reports labels+ above the threshold (sent as 0, which the model reads as 1e-6), so a label+ that is absent counts as zero. A question's scores are divided by their sum;+ that makes the top option and Brier and ECE computable, not calibrated.+ Labels can contain dots, so each one is matched against the group names+ that were sent rather than split.+ """+ request = call["requests"][0]+ groups = request["groups"]+ raw: dict[str, dict[str, float]] = {group: {} for group in groups}+ for entry in call["responses"][0]["classifications"]:+ owner = next((group for group in groups if entry["label"].startswith(f"{group}.")), None)+ if owner is None:+ raise SystemExit(f"{call['id']}: classification {entry['label']!r} belongs to no group that was sent")+ label = entry["label"][len(owner) + 1 :]+ if label in raw[owner]:+ raise SystemExit(f"{call['id']}: {entry['label']!r} returned twice")+ raw[owner][label] = entry["score"]+ answers = {}+ for group, qid in groups.items():+ where = f"{call['id']} {qid}"+ question = questions[qid]+ distribution = distribution_over(+ raw[group], question, phrasing_of(phrasing_for(call), qid), where, missing_is_zero=True+ )+ option_keys = [option["key"] for option in question["options"]]+ top = max(option_keys, key=lambda key: distribution[key])+ answers[qid] = answer(distribution, top, distribution[top], question["type"])+ return answers+++LLM_CODES = {+ "attack_vector": {"network": "N", "adjacent": "A", "local": "L", "physical": "P"},+ "attack_complexity": {"low": "L", "high": "H"},+ "privileges_required": {"none": "N", "low": "L", "high": "H"},+ "user_interaction": {"none": "N", "required": "R"},+ "scope": {"unchanged": "U", "changed": "C"},+ "confidentiality": {"none": "N", "low": "L", "high": "H"},+ "integrity": {"none": "N", "low": "L", "high": "H"},+ "availability": {"none": "N", "low": "L", "high": "H"},+}+++def from_cvss_llm(call: dict[str, Any], questions: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:+ """Answers read off an LLM's CVSS v3.1 base metrics and weakness class.++ Every answer is the one the metrics imply, with probability 1: the LLM+ returns a value, not a distribution, so it has no probability to branch on.+ `severity` is computed from the full vector, attack complexity included.+ """+ parsed = call["responses"][0]["parsed"]+ where = call["id"]+ try:+ metrics = {+ code: LLM_CODES[field][parsed[field]]+ for field, code in (+ ("attack_vector", "AV"),+ ("attack_complexity", "AC"),+ ("privileges_required", "PR"),+ ("user_interaction", "UI"),+ ("scope", "S"),+ ("confidentiality", "C"),+ ("integrity", "I"),+ ("availability", "A"),+ )+ }+ except KeyError as error:+ raise SystemExit(f"{where}: CVSS field missing or out of range: {error}") from error+ weakness_key = {option["name"]: option["key"] for option in questions["weakness"]["options"]}.get(+ parsed.get("weakness")+ )+ if weakness_key is None:+ raise SystemExit(f"{where}: weakness {parsed.get('weakness')!r} is not an option")+ implied = {+ "weakness": weakness_key,+ "attack_vector": parsed["attack_vector"],+ "user_interaction": "true" if metrics["UI"] == "R" else "false",+ **cvss.derived_gold("CVSS:3.1/" + "/".join(f"{k}:{v}" for k, v in metrics.items())),+ }+ answers = {}+ for qid, question in questions.items():+ keys = [option["key"] for option in question["options"]]+ distribution = {key: 1.0 if key == implied[qid] else 0.0 for key in keys}+ answers[qid] = answer(distribution, implied[qid], 1.0, question["type"])+ level = cvss.severity(cvss.base_score(metrics))+ if level is not None:+ answers[lanes.SEVERITY] = answer(+ {lvl: float(lvl == level) for lvl in cvss.SEVERITY_LEVELS}, level, 1.0, "score"+ )+ return answers+++NORMALISERS = {+ "laya-python-package": from_typed,+ "sie-extract-typed": from_typed,+ "sie-extract-groups": from_group_answers,+ "sie-extract-group-labels": from_group_labels,+ "sie-extract": from_labels,+ "sie-chat-cvss": from_cvss_llm,+}+++def questions_for(cases: dict[str, Any], case: dict[str, Any]) -> dict[str, dict[str, Any]]:+ if cases["set"] == VULNERABILITY_TRIAGE:+ if cases["questions"] != VULNERABILITY_QUESTIONS:+ raise SystemExit("the case file's questions differ from questions.py; rebuild or re-fetch the inputs")+ return cases["questions"]+ source = cases["questions"][case["workflow"]]+ return {qid: from_source_question(question) for qid, question in source.items()}+++def ece(pairs: list[tuple[float, bool]]) -> float:+ bins: dict[int, list[tuple[float, bool]]] = defaultdict(list)+ for confidence, correct in pairs:+ bins[min(BINS - 1, int(confidence * BINS))].append((confidence, correct))+ total = len(pairs)+ return sum(+ len(members)+ / total+ * abs(sum(c for c, _ in members) / len(members) - sum(1 for _, ok in members if ok) / len(members))+ for members in bins.values()+ )+++def macro_f1(gold: list[str], predicted: list[str]) -> float:+ labels = sorted(set(gold) | set(predicted))+ scores = []+ for label in labels:+ tp = sum(1 for g, p in zip(gold, predicted) if g == label and p == label)+ fp = sum(1 for g, p in zip(gold, predicted) if g != label and p == label)+ fn = sum(1 for g, p in zip(gold, predicted) if g == label and p != label)+ scores.append(0.0 if tp == 0 else 2 * tp / (2 * tp + fp + fn))+ return sum(scores) / len(scores)+++def class_recall(gold: list[str], predicted: list[str]) -> dict[str, list[int]]:+ """Per gold option: [answered right, records]."""+ counts: dict[str, list[int]] = {}+ for g, p in zip(gold, predicted):+ counts.setdefault(g, [0, 0])+ counts[g][1] += 1+ counts[g][0] += g == p+ return dict(sorted(counts.items()))+++def balanced_accuracy(gold: list[str], predicted: list[str]) -> float:+ """Mean recall over the options with at least BALANCED_MIN_RECORDS records in the gold.++ An option with one or two records swings an unweighted mean by a third or+ more on a single answer, so rarer options count in accuracy only. When no+ option has that many records, every option counts.+ """+ recalls = class_recall(gold, predicted)+ common = [right / total for right, total in recalls.values() if total >= BALANCED_MIN_RECORDS]+ return statistics.fmean(common or [right / total for right, total in recalls.values()])+++def selective(rows: list[tuple[dict[str, Any], str]], cutoffs: tuple[float, ...] = SELECTIVE_CUTOFFS) -> dict:+ """For each cut-off, how many answers were at least that sure, and how many of those were right."""+ out = {}+ for cutoff in cutoffs:+ sure = [(a, g) for a, g in rows if a["top_p"] >= cutoff]+ out[f"{cutoff:.2f}"] = {"answered": len(sure), "right": sum(a["top"] == g for a, g in sure)}+ return out+++def brier(distribution: dict[str, float], gold: str) -> float:+ return sum((p - (1.0 if key == gold else 0.0)) ** 2 for key, p in distribution.items())+++def expected_level(item: dict[str, Any]) -> float:+ if item["distribution"] is None:+ return float(item["top"])+ return sum(int(key) * p for key, p in item["distribution"].items())+++def question_metrics(rows: list[tuple[dict[str, Any], str]]) -> dict[str, Any]:+ """Figures for one question over its cases. `rows` pairs each answer with its gold key."""+ gold = [g for _, g in rows]+ predicted = [a["top"] for a, _ in rows]+ correct = [a["top"] == g for a, g in rows]+ qtype = rows[0][0]["type"]+ out: dict[str, Any] = {+ "type": qtype,+ "n": len(rows),+ "correct": sum(correct),+ "accuracy": sum(correct) / len(rows),+ "balanced_accuracy": balanced_accuracy(gold, predicted),+ "recall": class_recall(gold, predicted),+ "macro_f1": macro_f1(gold, predicted),+ "ece": ece([(a["top_p"], ok) for (a, _), ok in zip(rows, correct)]),+ "brier": None,+ }+ if all(a["distribution"] is not None for a, _ in rows):+ if qtype == NOUL:+ out["brier"] = statistics.fmean((a["distribution"]["true"] - (g == "true")) ** 2 for a, g in rows)+ else:+ out["brier"] = statistics.fmean(brier(a["distribution"], g) for a, g in rows)+ if qtype == CHOICE:+ out["selective"] = selective(rows)+ if qtype == SCORE:+ out["mae"] = statistics.fmean(abs(expected_level(a) - int(g)) for a, g in rows)+ majority, count = Counter(gold).most_common(1)[0]+ out["majority"] = {+ "option": majority,+ "accuracy": count / len(rows),+ "macro_f1": macro_f1(gold, [majority] * len(rows)),+ }+ if qtype == NOUL:+ rate = sum(g == "true" for g in gold) / len(gold)+ out["majority"]["base_rate_brier"] = rate * (1 - rate)+ return out+++def pooled(per_question: dict[str, dict[str, Any]], qtype: str | None) -> dict[str, Any] | None:+ chosen = [m for m in per_question.values() if qtype is None or m["type"] == qtype]+ if not chosen:+ return None+ n = sum(m["n"] for m in chosen)+ out = {+ "questions": len(chosen),+ "decisions": n,+ "accuracy": sum(m["correct"] for m in chosen) / n,+ "macro_f1": statistics.fmean(m["macro_f1"] for m in chosen),+ "ece": sum(m["ece"] * m["n"] for m in chosen) / n,+ "brier": None,+ "majority_accuracy": sum(m["majority"]["accuracy"] * m["n"] for m in chosen) / n,+ "majority_macro_f1": statistics.fmean(m["majority"]["macro_f1"] for m in chosen),+ }+ if all(m["brier"] is not None for m in chosen):+ out["brier"] = sum(m["brier"] * m["n"] for m in chosen) / n+ if qtype == SCORE:+ out["mae"] = sum(m["mae"] * m["n"] for m in chosen) / n+ if qtype == NOUL:+ out["base_rate_brier"] = sum(m["majority"]["base_rate_brier"] * m["n"] for m in chosen) / n+ return out+++def decided(call: dict[str, Any], answers: dict[str, dict[str, Any]], rules: dict | None = None) -> dict:+ """Answers after the call's decision rules (tuning.json); unchanged for an untuned variant.++ A rule needs every option's probability, so it leaves an answer that only+ carries its top option (GLiNER2's pick-one) as it is.+ """+ rules = tuning.rules(call["set"], call["backend"], call["variant"]) if rules is None else rules+ out = {}+ for qid, item in answers.items():+ rule = rules.get(qid)+ if rule is None or item["distribution"] is None:+ out[qid] = item+ continue+ distribution, top = tuning.apply_rule(item["distribution"], rule)+ out[qid] = answer(distribution, top, distribution[top], item["type"])+ return out+++def score_slice(calls: list[dict[str, Any]], cases: dict[str, Any]) -> dict[str, Any]:+ by_slug = {case["slug"]: case for case in cases["cases"]}+ rows: dict[str, list[tuple[dict[str, Any], str]]] = defaultdict(list)+ latencies = []+ for call in calls:+ case = by_slug.get(call["case"])+ if case is None:+ raise SystemExit(f"{call['id']}: no such case in the inputs")+ questions = asked(cases["set"], call["backend"], questions_for(cases, case))+ answers = decided(call, NORMALISERS[call["transport"]](call, questions))+ prefix = f"{case['workflow']}/" if cases["set"] == WORKFLOWS else ""+ for qid in questions:+ rows[prefix + qid].append((answers[qid], case["gold"][qid]))+ if cases["set"] == VULNERABILITY_TRIAGE:+ composed = lanes.severity_answer(answers)+ if composed is not None:+ rows[lanes.SEVERITY].append((composed, case["gold"]["severity"]))+ latencies.append(call["timing"]["latency_ms"])+ per_question = {qid: question_metrics(pairs) for qid, pairs in sorted(rows.items())}+ return {+ "cases": len(calls),+ "per_question": per_question,+ "by_type": {qtype: pooled(per_question, qtype) for qtype in TYPES},+ "overall": pooled(per_question, None),+ "latency_ms": {+ "median": statistics.median(latencies),+ "p90": sorted(latencies)[max(0, math.ceil(0.9 * len(latencies)) - 1)],+ "requests_per_case": statistics.fmean(len(call["requests"]) for call in calls),+ },+ }+++def usable(payload: dict[str, Any]) -> list[dict[str, Any]]:+ failed = [call["id"] for call in payload["calls"] if call.get("status") != HTTP_OK]+ if failed:+ raise SystemExit("refusing to score calls that failed: " + ", ".join(sorted(failed)[:10]))+ return payload["calls"]+++def choose_variant(dev: dict[str, dict[str, Any]]) -> str:+ """The phrasing with the higher pooled dev accuracy, `described` on a tie."""+ if SHORT not in dev:+ return DESCRIBED+ if DESCRIBED not in dev:+ return SHORT+ return SHORT if dev[SHORT]["overall"]["accuracy"] > dev[DESCRIBED]["overall"]["accuracy"] else DESCRIBED+++def summarise(calls: list[dict[str, Any]], data_dir: Path) -> dict[str, Any]:+ grouped: dict[tuple[str, str, str, str], list[dict[str, Any]]] = defaultdict(list)+ for call in calls:+ grouped[(call["set"], call["backend"], call["variant"], call["split"])].append(call)+ summary: dict[str, Any] = {}+ for set_name in sorted({key[0] for key in grouped}):+ cases = load(data_dir / f"inputs/{set_name}/cases.json")+ summary[set_name] = {}+ for backend in sorted({key[1] for key in grouped if key[0] == set_name}):+ variants = sorted({key[2] for key in grouped if key[:2] == (set_name, backend)})+ dev = {+ v: score_slice(grouped[(set_name, backend, v, "dev")], cases)+ for v in variants+ if grouped.get((set_name, backend, v, "dev"))+ }+ test = {+ v: score_slice(grouped[(set_name, backend, v, "test")], cases)+ for v in variants+ if grouped.get((set_name, backend, v, "test"))+ }+ if tuning.TUNED in variants:+ chosen = tuning.TUNED+ else:+ chosen = choose_variant(dev) if dev else (DESCRIBED if DESCRIBED in test else variants[0])+ any_call = next(calls for key, calls in grouped.items() if key[:2] == (set_name, backend) and calls)+ summary[set_name][backend] = {+ "model": any_call[0]["model"],+ "chosen_variant": chosen,+ "dev": dev,+ "test": test,+ }+ return summary+++def fmt(value: float | None, digits: int = 3) -> str:+ return " n/a" if value is None else f"{value:.{digits}f}"+++def report(summary: dict[str, Any], split: str = "test") -> None:+ for set_name, all_backends in summary.items():+ backends = {b: r for b, r in all_backends.items() if r["chosen_variant"] in r[split]}+ for backend in sorted(set(all_backends) - set(backends)):+ print(f"\nnote: {set_name}/{backend} has no test calls in its chosen phrasing; not reported")+ if not backends:+ continue+ print(f"\n== {set_name} ({split} slice) ==")+ first = next(iter(backends.values()))+ test = first[split][first["chosen_variant"]]+ print(f"{test['cases']} cases; majority-option reference per type:")+ for qtype in (*TYPES, None):+ ref = test["overall"] if qtype is None else test["by_type"][qtype]+ if ref:+ line = f" {qtype or 'all':<7} acc {fmt(ref['majority_accuracy'])} macro-F1 {fmt(ref['majority_macro_f1'])}"+ if qtype == NOUL:+ line += f" base-rate Brier {fmt(ref['base_rate_brier'])}"+ print(line)+ header = f" {'backend':<22}{'phrasing':<11}{'type':<8}{'acc':>7}{'mF1':>7}{'Brier':>7}{'ECE':>7}{'MAE':>7}"+ print(header)+ for backend, result in backends.items():+ for variant in (result["chosen_variant"], *[v for v in result[split] if v != result["chosen_variant"]]):+ metrics = result[split][variant]+ tag = variant if variant == result["chosen_variant"] else f"({variant})"+ for qtype in (*TYPES, None):+ m = metrics["overall"] if qtype is None else metrics["by_type"][qtype]+ if m is None:+ continue+ print(+ f" {backend:<22}{tag:<11}{qtype or 'all':<8}{fmt(m['accuracy']):>7}{fmt(m['macro_f1']):>7}"+ f"{fmt(m['brier']):>7}{fmt(m['ece']):>7}{fmt(m.get('mae')):>7}"+ )+ latency = result[split][result["chosen_variant"]]["latency_ms"]+ dev_line = ""+ if result["dev"]:+ dev_line = " dev acc " + ", ".join(+ f"{v} {fmt(d['overall']['accuracy'])}" for v, d in sorted(result["dev"].items())+ )+ print(+ f" {backend:<22}latency per case: median {latency['median']:.0f} ms, p90 {latency['p90']:.0f} ms, "+ f"{latency['requests_per_case']:.0f} request(s) per case{dev_line}"+ )+ print("\n per question, chosen phrasing: accuracy / balanced accuracy; majority in brackets;")+ print(" for pick-one questions, right of answered when the top option is at least 0.9")+ per_backend = {b: r[split][r["chosen_variant"]]["per_question"] for b, r in backends.items()}+ qids = sorted({qid for per_question in per_backend.values() for qid in per_question})+ for qid in qids:+ majority = next(pq[qid] for pq in per_backend.values() if qid in pq)["majority"]["accuracy"]+ print(f" {qid} [{majority:.2f}]")+ for backend, per_question in per_backend.items():+ if qid not in per_question:+ print(f" {backend:<32} not asked")+ continue+ m = per_question[qid]+ sure = m.get("selective", {}).get("0.90")+ extra = f" >=0.9: {sure['right']}/{sure['answered']}" if sure else ""+ print(f" {backend:<32}{fmt(m['accuracy'], 3)} / {fmt(m['balanced_accuracy'], 3)}{extra}")+++def check_published(summary: dict[str, Any]) -> list[str]:+ failures = []+ for key, expected in PUBLISHED.items():+ set_name, backend, scope, metric = key.split("/")+ result = summary.get(set_name, {}).get(backend)+ if result is None or result["chosen_variant"] not in result["test"]:+ failures.append(f"{key}: not in this recording")+ continue+ metrics = result["test"][result["chosen_variant"]]+ if scope == "all":+ block = metrics["overall"]+ elif scope in TYPES:+ block = metrics["by_type"][scope]+ else:+ block = metrics["per_question"].get(scope)+ if block is None or metric not in block:+ failures.append(f"{key}: not in this recording")+ continue+ actual = block[metric] if metric == "correct" else round(block[metric], 3)+ if actual != expected:+ failures.append(f"{key}: got {actual}, published {expected}")+ return failures+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--data", default="data", help="directory holding inputs/ (default: data)")+ parser.add_argument("--calls", nargs="+", default=["data/calls.json"], help="recordings to score")+ parser.add_argument("--json", help="also write the full summary to this path")+ parser.add_argument("--split", choices=("dev", "test"), default="test", help="which slice to report")+ args = parser.parse_args()+ calls: list[dict[str, Any]] = []+ for path in args.calls:+ payload = load(Path(path))+ if payload.get("complete") is False:+ print(f"note: {path} is not a complete recording", file=sys.stderr)+ calls.extend(usable(payload))+ summary = summarise(calls, Path(args.data))+ report(summary, args.split)+ if args.json:+ Path(args.json).write_text(json.dumps(summary, indent=1) + "\n", encoding="utf-8")+ failures = check_published(summary)+ if failures:+ print("\nFAILED to reproduce the published figures:", file=sys.stderr)+ for line in failures:+ print(f" {line}", file=sys.stderr)+ return 1+ if PUBLISHED:+ print(f"\nAll {len(PUBLISHED)} published figures reproduced.")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/tests/test_example.py b/examples/typed-decisions/tests/test_example.pynew file mode 100644index 000000000..801d1cbe0--- /dev/null+++ b/examples/typed-decisions/tests/test_example.py@@ -0,0 +1,661 @@+"""Offline tests for the question rendering, the normalisers, the metrics and the request check.++ python3 -m unittest discover -s tests -v++Standard library only, no server, no model and no fetched data: each test builds+the small fixture it needs. Most assert that a specific malformed or forged+recording fails closed rather than turning into a number.+"""++from __future__ import annotations++import contextlib+import copy+import importlib.util+import io+import json+import math+import sys+import tempfile+import unittest+from pathlib import Path+from typing import Any++ROOT = Path(__file__).resolve().parents[1]+sys.path.insert(0, str(ROOT))+++def _module(name: str):+ spec = importlib.util.spec_from_file_location(name, ROOT / f"{name}.py")+ assert spec is not None and spec.loader is not None+ module = importlib.util.module_from_spec(spec)+ sys.modules[name] = module+ spec.loader.exec_module(module)+ return module+++questions = _module("questions")+cvss = _module("cvss")+lanes = _module("lanes")+tuning = _module("tuning")+run = _module("run")+score = _module("score")+tune = _module("tune")+page = _module("page")++SOURCE_QUESTIONS = {+ "action": {+ "type": "choice",+ "instructions": "What should the assistant do next?",+ "criteria": {"answer_directly": "Resolve it now.", "escalate_to_human": "Hand off to a person."},+ },+ "needs_human": {+ "type": "noul",+ "instructions": "This conversation requires a human agent.",+ "criteria": {"false": "Automation can finish it.", "true": "A person must take over."},+ },+ "duplicate": {"type": "noul", "instructions": "This invoice duplicates an earlier one."},+ "urgency": {+ "type": "score",+ "instructions": "How time-sensitive is this?",+ "criteria": ["No time pressure; can wait.", "Routine; normal queue.", "Critical; same day."],+ },+}+++def vulnerability_inputs() -> dict[str, Any]:+ return {+ "set": questions.VULNERABILITY_TRIAGE,+ "questions": questions.VULNERABILITY_QUESTIONS,+ "cases": [+ {+ "slug": "CVE-0000-0001",+ "split": "test",+ "state": "Cross-site request forgery in the admin page lets a remote attacker change a password.",+ "gold": {+ "weakness": "request_forgery",+ "attack_vector": "network",+ "user_interaction": "true",+ "privileges_required": "0",+ "severity": "2",+ "needs_account": "false",+ "remote_unauthenticated": "true",+ "impact": "limited_change",+ },+ },+ {+ "slug": "CVE-0000-0002",+ "split": "dev",+ "state": "A heap buffer overflow in the image parser allows a local user to crash the program.",+ "gold": {+ "weakness": "memory_corruption",+ "attack_vector": "local",+ "user_interaction": "false",+ "privileges_required": "1",+ "severity": "1",+ "needs_account": "true",+ "remote_unauthenticated": "false",+ "impact": "denial_of_service",+ },+ },+ {+ "slug": "CVE-0000-0003",+ "split": "dev",+ "state": "SQL injection in the login form lets a remote attacker read the user table.",+ "gold": {+ "weakness": "sql_injection",+ "attack_vector": "network",+ "user_interaction": "false",+ "privileges_required": "0",+ "severity": "3",+ "needs_account": "false",+ "remote_unauthenticated": "true",+ "impact": "full_compromise",+ },+ },+ ],+ }+++def typed_call(case: dict[str, Any], variant: str, answers: dict[str, Any]) -> dict[str, Any]:+ phrasing = tuning.phrasing(questions.VULNERABILITY_TRIAGE, "laya", variant)+ requests = run.requests_for("laya", phrasing, case["state"], questions.VULNERABILITY_QUESTIONS)+ return {+ "id": run.call_id(questions.VULNERABILITY_TRIAGE, "laya", variant, case["slug"]),+ "set": questions.VULNERABILITY_TRIAGE,+ "backend": "laya",+ "variant": variant,+ "case": case["slug"],+ "split": case["split"],+ "model": run.model_of("laya"),+ "transport": "sie-extract-typed",+ "status": "ok",+ "requests": requests,+ "responses": [{"data": answers}],+ "timing": {"latency_ms": 10.0},+ }+++def perfect_typed_answers(case: dict[str, Any], variant: str) -> dict[str, Any]:+ """A typed response that puts 0.9 on each gold option, in the labels the model was sent."""+ phrasing = tuning.phrasing(questions.VULNERABILITY_TRIAGE, "laya", variant)+ _, label_maps = questions.typed_questions(questions.VULNERABILITY_QUESTIONS, phrasing)+ answers: dict[str, Any] = {}+ for qid, question in questions.VULNERABILITY_QUESTIONS.items():+ gold = case["gold"][qid]+ if question["type"] == questions.NOUL:+ answers[qid] = {"noul": 0.9 if gold == "true" else 0.1}+ continue+ labels = list(label_maps[qid])+ rest = 0.1 / (len(labels) - 1)+ answers[qid] = {"probabilities": {label: 0.9 if label_maps[qid][label] == gold else rest for label in labels}}+ return answers+++class QuestionRenderingTests(unittest.TestCase):+ def test_workflow_questions_round_trip_to_the_source(self) -> None:+ converted = {qid: questions.from_source_question(q) for qid, q in SOURCE_QUESTIONS.items()}+ rendered, _ = questions.typed_questions(converted, questions.DESCRIBED)+ self.assertEqual(rendered, SOURCE_QUESTIONS)++ def test_label_options_are_unique_and_true_first(self) -> None:+ for question in [+ *questions.VULNERABILITY_QUESTIONS.values(),+ *map(questions.from_source_question, SOURCE_QUESTIONS.values()),+ ]:+ for variant in questions.VARIANTS:+ pairs = questions.label_options(question, variant)+ labels = [label for _, label in pairs]+ self.assertEqual(len(labels), len(set(labels)))+ self.assertEqual(sorted(key for key, _ in pairs), sorted(questions.keys(question)))+ if question["type"] == questions.NOUL:+ self.assertEqual(pairs[0][0], "true")++ def test_noul_without_description_uses_statement_and_negation(self) -> None:+ pairs = dict(questions.label_options(questions.from_source_question(SOURCE_QUESTIONS["duplicate"]), "short"))+ self.assertEqual(pairs["true"], "This invoice duplicates an earlier one.")+ self.assertEqual(pairs["false"], "Not the case: this invoice duplicates an earlier one.")++ def test_short_typed_choice_maps_names_back_to_keys(self) -> None:+ rendered, label_maps = questions.typed_questions(questions.VULNERABILITY_QUESTIONS, questions.SHORT)+ self.assertIn("cross-site request forgery", rendered["weakness"]["criteria"])+ self.assertEqual(label_maps["weakness"]["cross-site request forgery"], "request_forgery")+ self.assertNotIn("criteria", rendered["remote_unauthenticated"])+++class NormaliserTests(unittest.TestCase):+ def setUp(self) -> None:+ self.case = vulnerability_inputs()["cases"][0]++ def test_typed_answers_map_to_option_keys(self) -> None:+ call = typed_call(self.case, "short", perfect_typed_answers(self.case, "short"))+ answers = score.from_typed(call, questions.VULNERABILITY_QUESTIONS)+ for qid in questions.VULNERABILITY_QUESTIONS:+ gold = self.case["gold"][qid]+ self.assertEqual(answers[qid]["top"], gold, qid)++ def test_typed_unknown_option_fails_closed(self) -> None:+ answers = perfect_typed_answers(self.case, "short")+ answers["weakness"]["probabilities"]["buffer overflow"] = 0.0+ with self.assertRaisesRegex(SystemExit, "was not sent"):+ score.from_typed(typed_call(self.case, "short", answers), questions.VULNERABILITY_QUESTIONS)++ def test_non_finite_and_boolean_probabilities_fail_closed(self) -> None:+ for bad in (float("nan"), True, 1.5):+ answers = perfect_typed_answers(self.case, "described")+ answers["remote_unauthenticated"]["noul"] = bad+ with self.assertRaises(SystemExit):+ score.from_typed(typed_call(self.case, "described", answers), questions.VULNERABILITY_QUESTIONS)++ def test_distribution_that_does_not_sum_to_one_fails_closed(self) -> None:+ answers = perfect_typed_answers(self.case, "described")+ answers["attack_vector"]["probabilities"] = {key: 0.9 for key in answers["attack_vector"]["probabilities"]}+ with self.assertRaisesRegex(SystemExit, "sum to"):+ score.from_typed(typed_call(self.case, "described", answers), questions.VULNERABILITY_QUESTIONS)++ def _label_call(self, classifications: list[list[dict[str, Any]]]) -> dict[str, Any]:+ requests = run.requests_for("gliner2-base", "short", self.case["state"], questions.VULNERABILITY_QUESTIONS)+ return {+ "id": "x",+ "set": questions.VULNERABILITY_TRIAGE,+ "backend": "gliner2-base",+ "variant": "short",+ "requests": requests,+ "responses": [{"classifications": entries} for entries in classifications],+ }++ def test_single_label_answers_keep_only_what_came_back(self) -> None:+ tops = {+ "weakness": "cross-site request forgery",+ "attack_vector": "remotely over the network",+ "remote_unauthenticated": "exploitable remotely without a login",+ }+ call = self._label_call(+ [[{"label": tops[r["question"]], "score": 0.8}] for r in self._label_call([])["requests"]]+ )+ answers = score.from_labels(call, questions.VULNERABILITY_QUESTIONS)+ self.assertIsNone(answers["weakness"]["distribution"])+ self.assertEqual(answers["weakness"]["top"], "request_forgery")+ # Two options: the single answer fixes the other side.+ self.assertAlmostEqual(answers["remote_unauthenticated"]["distribution"]["false"], 0.2)++ def test_label_that_was_not_sent_fails_closed(self) -> None:+ requests = self._label_call([])["requests"]+ call = self._label_call([[{"label": "buffer overflow", "score": 0.9}] for _ in requests])+ with self.assertRaisesRegex(SystemExit, "was not sent"):+ score.from_labels(call, questions.VULNERABILITY_QUESTIONS)+++def gold_scores(case: dict[str, Any], qid: str, labels: list[str], variant: str) -> dict[str, float]:+ """Scores that favour the gold option of one question, keyed by the label strings sent."""+ key_of = {label: key for key, label in questions.label_options(questions.VULNERABILITY_QUESTIONS[qid], variant)}+ return {label: 0.8 if key_of[label] == case["gold"][qid] else 0.1 for label in labels}+++class GroupedBackendTests(unittest.TestCase):+ def setUp(self) -> None:+ self.case = vulnerability_inputs()["cases"][0]++ def _request(self, backend: str) -> dict[str, Any]:+ (request,) = run.requests_for(backend, "short", self.case["state"], questions.VULNERABILITY_QUESTIONS)+ return request++ def test_gliformer_names_each_group_by_its_question(self) -> None:+ request = self._request("gliformer-large")+ options = request["body"]["params"]["options"]+ weakness = questions.VULNERABILITY_QUESTIONS["weakness"]["instructions"]+ self.assertIn(weakness, options["label_groups"])+ self.assertEqual(request["groups"][weakness], "weakness")+ self.assertEqual((options["multi_label"], options["threshold"]), (True, 0.0))++ def test_grouped_gliclass_keeps_group_names_short_and_the_questions_in_the_instruction(self) -> None:+ request = self._request("gliclass-instruct-large-grouped")+ params = request["body"]["params"]+ self.assertEqual(request["groups"]["remote unauthenticated"], "remote_unauthenticated")+ self.assertIn(+ questions.VULNERABILITY_QUESTIONS["remote_unauthenticated"]["instructions"], params["instruction"]+ )+ self.assertEqual(params["options"]["overflow_policy"], "truncate_text")++ def _gliformer_call(self) -> dict[str, Any]:+ request = self._request("gliformer-large")+ classifications = [+ {"label": f"{name}.{label}", "score": score}+ for name, labels in request["body"]["params"]["options"]["label_groups"].items()+ for label, score in gold_scores(self.case, request["groups"][name], labels, "short").items()+ ]+ return {+ "id": "g",+ "set": questions.VULNERABILITY_TRIAGE,+ "backend": "gliformer-large",+ "variant": "short",+ "requests": [request],+ "responses": [{"classifications": classifications}],+ }++ def test_gliformer_labels_are_split_by_group_and_renormalised(self) -> None:+ answers = score.from_group_labels(self._gliformer_call(), questions.VULNERABILITY_QUESTIONS)+ for qid in questions.VULNERABILITY_QUESTIONS:+ gold = self.case["gold"][qid]+ self.assertEqual(answers[qid]["top"], gold)+ self.assertAlmostEqual(sum(answers[qid]["distribution"].values()), 1.0)++ def test_gliformer_label_below_threshold_counts_as_zero(self) -> None:+ call = self._gliformer_call()+ entries = call["responses"][0]["classifications"]+ dropped = next(e for e in entries if e["score"] < 0.5)+ entries.remove(dropped)+ answers = score.from_group_labels(call, questions.VULNERABILITY_QUESTIONS)+ self.assertIn(0.0, [p for a in answers.values() for p in a["distribution"].values()])++ def test_gliformer_label_from_no_group_fails_closed(self) -> None:+ call = self._gliformer_call()+ call["responses"][0]["classifications"].append({"label": "other question.yes", "score": 0.5})+ with self.assertRaisesRegex(SystemExit, "no group"):+ score.from_group_labels(call, questions.VULNERABILITY_QUESTIONS)++ def _gliclass_grouped_call(self) -> dict[str, Any]:+ request = self._request("gliclass-instruct-large-grouped")+ data = {}+ for name, labels in request["body"]["params"]["options"]["label_groups"].items():+ scores = gold_scores(self.case, request["groups"][name], labels, "short")+ total = sum(scores.values())+ data[name] = {"type": "choice", "probabilities": {label: v / total for label, v in scores.items()}}+ return {+ "id": "c",+ "set": questions.VULNERABILITY_TRIAGE,+ "backend": "gliclass-instruct-large-grouped",+ "variant": "short",+ "requests": [request],+ "responses": [{"data": data}],+ }++ def test_grouped_gliclass_answers_map_to_option_keys(self) -> None:+ answers = score.from_group_answers(self._gliclass_grouped_call(), questions.VULNERABILITY_QUESTIONS)+ for qid in questions.VULNERABILITY_QUESTIONS:+ gold = self.case["gold"][qid]+ self.assertEqual(answers[qid]["top"], gold)++ def test_grouped_gliclass_missing_group_fails_closed(self) -> None:+ call = self._gliclass_grouped_call()+ call["responses"][0]["data"].pop("attack vector")+ with self.assertRaisesRegex(SystemExit, "no answer"):+ score.from_group_answers(call, questions.VULNERABILITY_QUESTIONS)+++class PerQuestionBackendTests(unittest.TestCase):+ def setUp(self) -> None:+ self.case = vulnerability_inputs()["cases"][0]++ def test_gliclass_truncates_the_record_rather_than_failing(self) -> None:+ for backend in ("gliclass", "gliclass-base-v1", "gliclass-instruct-large"):+ for request in run.requests_for(backend, "short", self.case["state"], questions.VULNERABILITY_QUESTIONS):+ self.assertEqual(request["body"]["params"]["options"], {"overflow_policy": "truncate_text"})++ def test_gliclass_instruct_sends_the_question_as_its_instruction(self) -> None:+ requests = run.requests_for(+ "gliclass-instruct-large", "short", self.case["state"], questions.VULNERABILITY_QUESTIONS+ )+ self.assertEqual(len(requests), len(questions.VULNERABILITY_QUESTIONS))+ for request in requests:+ question = questions.VULNERABILITY_QUESTIONS[request["question"]]+ self.assertEqual(request["body"]["params"]["instruction"], question["instructions"])+++class LaneTests(unittest.TestCase):+ def test_gliformer_is_asked_only_its_questions_on_the_vulnerability_set(self) -> None:+ asked = questions.asked(questions.VULNERABILITY_TRIAGE, "gliformer-large", questions.VULNERABILITY_QUESTIONS)+ self.assertEqual(list(asked), ["weakness", "attack_vector"])+ self.assertEqual(questions.asked(questions.WORKFLOWS, "gliformer-large", {"a": {}}), {"a": {}})++ def test_a_question_the_first_backend_is_not_asked_comes_from_the_second(self) -> None:+ def ans(top: str, other: str, p: float) -> dict[str, Any]:+ return {"distribution": {top: p, other: 1 - p}, "top": top, "top_p": p, "type": "choice"}++ fast = {+ "c1": {+ "weakness": ans("sql_injection", "cross_site_scripting", 0.4),+ "attack_vector": ans("network", "local", 0.95),+ }+ }+ smart = {+ "c1": {+ "weakness": ans("cross_site_scripting", "sql_injection", 0.9),+ "attack_vector": ans("local", "network", 0.9),+ "remote_unauthenticated": ans("true", "false", 0.8),+ }+ }+ lane = {"backend": "f", "escalate_to": "s", "cutoffs": {"weakness": 0.5, "attack_vector": 0.5}}+ answers, escalated = lanes.lane_answers(lane, {"f": fast, "s": smart})+ self.assertEqual(answers["c1"]["weakness"]["top"], "cross_site_scripting")+ self.assertEqual(answers["c1"]["attack_vector"]["top"], "network")+ self.assertEqual(answers["c1"]["remote_unauthenticated"]["top"], "true")+ self.assertEqual(escalated["c1"], {"weakness": True, "attack_vector": False, "remote_unauthenticated": True})+++class NLITests(unittest.TestCase):+ def test_statements_go_in_as_hypotheses_and_names_through_the_topic_template(self) -> None:+ case = vulnerability_inputs()["cases"][0]+ for request in run.requests_for(+ "nli-modernbert-base", "short", case["state"], questions.VULNERABILITY_QUESTIONS+ ):+ qtype = questions.VULNERABILITY_QUESTIONS[request["question"]]["type"]+ expected = run.NLI_STATEMENT_TEMPLATE if qtype == questions.NOUL else run.NLI_TOPIC_TEMPLATE+ self.assertEqual(request["body"]["params"]["options"], {"hypothesis_template": expected})+++class LayaTests(unittest.TestCase):+ def test_text_and_structured_states_use_the_sie_item_shapes(self) -> None:+ converted = {qid: questions.from_source_question(q) for qid, q in SOURCE_QUESTIONS.items()}+ (text_request,) = run.requests_for("laya", "described", "a ticket", converted)+ (dict_request,) = run.requests_for("laya", "described", {"body": "a ticket"}, converted)+ self.assertEqual(text_request["body"]["items"], [{"text": "a ticket"}])+ self.assertEqual(dict_request["body"]["items"], [{"metadata": {"state": {"body": "a ticket"}}}])+ # The question dict sent is the source's own, exactly as the package receives it.+ self.assertEqual(text_request["body"]["params"]["output_schema"], SOURCE_QUESTIONS)++ def test_package_and_sie_answers_score_the_same(self) -> None:+ case = vulnerability_inputs()["cases"][0]+ sie_call = typed_call(case, "short", perfect_typed_answers(case, "short"))+ package_call = {+ **sie_call,+ "backend": "laya-package",+ "transport": "laya-python-package",+ "requests": run.requests_for("laya-package", "short", case["state"], questions.VULNERABILITY_QUESTIONS),+ "responses": [{"answers": sie_call["responses"][0]["data"]}],+ }+ self.assertEqual(+ score.from_typed(package_call, questions.VULNERABILITY_QUESTIONS),+ score.from_typed(sie_call, questions.VULNERABILITY_QUESTIONS),+ )++ def test_every_planned_backend_is_served_by_sie(self) -> None:+ for backends in run.PLAN.values():+ self.assertFalse([b for b in backends if run.is_package(b)])+++class CVSSTests(unittest.TestCase):+ def test_base_scores_match_published_vectors(self) -> None:+ for vector, expected in (+ ("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", 9.8),+ ("CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", 6.1),+ ("CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", 7.8),+ ("CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", 8.8),+ ("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", 7.5),+ ):+ self.assertEqual(cvss.base_score(cvss.parse(vector)), expected, vector)++ def test_impact_patterns_and_derived_gold(self) -> None:+ gold = cvss.derived_gold("CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N")+ self.assertEqual(gold, {"needs_account": "true", "remote_unauthenticated": "false", "impact": "browser_script"})+ self.assertEqual(+ cvss.impact_pattern(cvss.parse("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H")), "full_compromise"+ )++ def test_composed_severity_is_a_distribution_over_levels(self) -> None:+ certain = cvss.compose_severity({"command_injection": 1.0}, {"network": 1.0}, {"true": 1.0})+ self.assertEqual(max(certain, key=certain.get), "3")+ browser = cvss.compose_severity({"cross_site_scripting": 1.0}, {"network": 1.0}, {"true": 1.0})+ self.assertEqual(max(browser, key=browser.get), "1")+ mixed = cvss.compose_severity(+ {"cross_site_scripting": 0.5, "sql_injection": 0.5},+ {"network": 0.7, "local": 0.3},+ {"true": 0.4, "false": 0.6},+ )+ self.assertAlmostEqual(sum(mixed.values()), 1.0)+++class MetricTests(unittest.TestCase):+ def test_ece_of_a_calibrated_and_an_overconfident_set(self) -> None:+ self.assertAlmostEqual(score.ece([(0.75, True), (0.75, True), (0.75, True), (0.75, False)]), 0.0)+ self.assertAlmostEqual(score.ece([(0.95, True), (0.95, False)]), 0.45)++ def test_macro_f1_and_brier(self) -> None:+ self.assertAlmostEqual(score.macro_f1(["a", "a", "b"], ["a", "b", "b"]), (2 / 3 + 2 / 3) / 2)+ self.assertAlmostEqual(score.brier({"a": 0.5, "b": 0.5}, "a"), 0.5)++ def test_question_metrics_reports_majority_and_levels(self) -> None:+ rows = [+ ({"type": "score", "top": "2", "top_p": 0.6, "distribution": {"0": 0.1, "1": 0.3, "2": 0.6}}, "2"),+ ({"type": "score", "top": "0", "top_p": 0.5, "distribution": {"0": 0.5, "1": 0.25, "2": 0.25}}, "2"),+ ]+ metrics = score.question_metrics(rows)+ self.assertEqual(metrics["accuracy"], 0.5)+ self.assertEqual(metrics["majority"]["accuracy"], 1.0)+ self.assertAlmostEqual(metrics["mae"], (abs(1.5 - 2) + abs(0.75 - 2)) / 2)+ self.assertNotIn("within_one", metrics)+ self.assertTrue(math.isfinite(metrics["brier"]))++ def test_variant_tie_goes_to_described(self) -> None:+ dev = {v: {"overall": {"accuracy": 0.5}} for v in questions.VARIANTS}+ self.assertEqual(score.choose_variant(dev), questions.DESCRIBED)+ dev["short"]["overall"]["accuracy"] = 0.6+ self.assertEqual(score.choose_variant(dev), questions.SHORT)+++class TuneTests(unittest.TestCase):+ def test_a_phrasing_that_passes_beats_a_higher_one_that_does_not(self) -> None:+ tried = {+ "described": {"passes": False, "p05_balanced_accuracy": 0.69, "balanced_accuracy": 0.80},+ "short": {"passes": True, "p05_balanced_accuracy": 0.71, "balanced_accuracy": 0.75},+ "concrete": {"passes": True, "p05_balanced_accuracy": 0.74, "balanced_accuracy": 0.74},+ }+ self.assertEqual(tune.best_phrasing(tried), "concrete")+ for entry in tried.values():+ entry["passes"] = False+ self.assertEqual(tune.best_phrasing(tried), "concrete")+ tried["short"]["p05_balanced_accuracy"] = 0.74+ tried["short"]["balanced_accuracy"] = 0.74+ tried["concrete"]["balanced_accuracy"] = 0.74+ self.assertEqual(tune.best_phrasing(tried), "short")++ def test_balanced_accuracy_leaves_out_options_with_few_records(self) -> None:+ gold = ["a"] * 10 + ["b"] * 10 + ["c"]+ predicted = ["a"] * 10 + ["b"] * 5 + ["a"] * 5 + ["a"]+ self.assertAlmostEqual(score.balanced_accuracy(gold, predicted), 0.75)+ self.assertEqual(tune.worst_recall(tune.metrics(gold, predicted)), 0.5)+++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]:+ return {"top": top, "top_p": p, "returned": {"top": returned or top, "top_p": p}}++ gold = {+ f"CVE-{i}": {"weakness": w, "attack_vector": "network", "remote_unauthenticated": "true"}+ for i, w in enumerate(("sql_injection", "sql_injection", "path_traversal", "file_upload"))+ }+ order = sorted(gold, key=lambda slug: page.sha256(page.CARD_SALT + slug))+ smart = {+ slug: {"weakness": ans(g["weakness"], 0.9), "attack_vector": ans("network", 0.9)}+ for slug, g in gold.items()+ }+ fast = {slug: {"attack_vector": ans("network", 0.8)} for slug in gold}+ # The first record in card order is answered wrong; the second has an answer the rule changed.+ smart[order[0]]["attack_vector"] = ans("local", 0.6)+ fast[order[1]]["attack_vector"] = ans("network", 0.4, returned="local")+ board = {"fast": {"cells": {"attack_vector": {}}}, "smart": {"cells": {"weakness": {}, "attack_vector": {}}}}+ cards = page.choose_cards(gold, {"fast": fast, "smart": smart}, board)+ self.assertEqual(len(cards), 1)+ self.assertEqual(cards[0]["card"], "remote-no-login")+ self.assertNotIn(cards[0]["case"], order[:2])+ self.assertEqual(set(cards[0]["answers"]["smart"]), {"weakness", "attack_vector"})+++class CreditTests(unittest.TestCase):+ PRICES = {+ "pricing_version": "test",+ "stripe_credit_pack": {"usd_cents": 5000, "credits": 5000000},+ "items": [+ {+ "model": "Qwen/Qwen3.5-4B",+ "operation": "generate",+ "profile": "default",+ "unit": unit,+ "usd_per_unit": {"numerator": numerator, "denominator": "1000000"},+ }+ for unit, numerator in (("input_tokens", "1"), ("output_tokens", "2"))+ ],+ }++ def test_a_listed_chat_model_is_priced_from_its_recorded_usage(self) -> None:+ calls = [+ {+ "backend": "llm",+ "model": "Qwen/Qwen3.5-4B:no-spec",+ "responses": [{"usage": {"prompt_tokens": 100, "completion_tokens": 50}}],+ }+ ]+ figure = page.credits({"backend": "llm"}, calls, self.PRICES)+ # 100 x $1e-6 + 50 x $2e-6 = $0.0002, at 100,000 credits per dollar.+ self.assertAlmostEqual(figure["median_credits_per_record"], 20.0)+ self.assertAlmostEqual(figure["usd_per_1000_records"], 0.2)++ def test_an_unlisted_model_gets_no_figure(self) -> None:+ calls = [{"backend": "fast", "model": "knowledgator/gliformer-large-v1", "responses": [{}]}]+ self.assertIsNone(page.credits({"backend": "fast"}, calls, self.PRICES))+++TUNED_LAYA = {+ qid: {"phrasing": phrasing}+ for qid, phrasing in zip(+ questions.VULNERABILITY_QUESTIONS,+ ("concrete", "short", "described"),+ strict=True,+ )+}+++class CheckTests(unittest.TestCase):+ def setUp(self) -> None:+ self.tmp = tempfile.TemporaryDirectory()+ self.data = Path(self.tmp.name)+ self.saved_tuning_path = tuning.TUNING_PATH+ tuning.TUNING_PATH = self.data / "tuning.json"+ tuning.TUNING_PATH.write_text(+ json.dumps({"backends": {questions.VULNERABILITY_TRIAGE: {"laya": {"phrasing": TUNED_LAYA}}}}),+ encoding="utf-8",+ )+ inputs = vulnerability_inputs()+ path = self.data / f"inputs/{questions.VULNERABILITY_TRIAGE}/cases.json"+ path.parent.mkdir(parents=True)+ path.write_text(json.dumps(inputs), encoding="utf-8")+ plan = run.PLAN[questions.VULNERABILITY_TRIAGE]["laya"]+ self.calls = [+ typed_call(case, variant, perfect_typed_answers(case, variant))+ for case in inputs["cases"]+ for variant in plan[case["split"]]+ ]++ def tearDown(self) -> None:+ tuning.TUNING_PATH = self.saved_tuning_path+ self.tmp.cleanup()++ def test_tuned_calls_use_the_tuned_phrasing(self) -> None:+ tuned = [call for call in self.calls if call["variant"] == tuning.TUNED]+ self.assertTrue(tuned)+ sent = tuned[0]["requests"][0]["body"]["params"]["output_schema"]+ self.assertIn("buffer overflow or out-of-bounds memory access", sent["weakness"]["criteria"])+ self.assertIn("criteria", sent["remote_unauthenticated"])++ def _check(self, calls: list[dict[str, Any]]) -> int:+ path = self.data / "calls.json"+ path.write_text(json.dumps({"calls": calls}), encoding="utf-8")+ with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):+ return run.check(self.data, [path], partial=True)++ def test_recorded_requests_rebuild_from_the_inputs(self) -> None:+ self.assertEqual(self._check(self.calls), 0)++ def test_missing_call_fails(self) -> None:+ self.assertEqual(self._check(self.calls[:-1]), 1)++ def test_duplicate_call_fails(self) -> None:+ self.assertEqual(self._check([*self.calls, self.calls[0]]), 1)++ def test_edited_request_fails(self) -> None:+ calls = copy.deepcopy(self.calls)+ calls[0]["requests"][0]["body"]["items"][0]["text"] += " Edited."+ self.assertEqual(self._check(calls), 1)++ def test_digested_requests_check_and_an_edited_digest_fails(self) -> None:+ calls = [{**call, "requests": run.digested(call["requests"])} for call in self.calls]+ self.assertNotIn("body", calls[0]["requests"][0])+ self.assertEqual(self._check(calls), 0)+ calls[0]["requests"][0]["body_sha256"] = "0" * 64+ self.assertEqual(self._check(calls), 1)++ def test_wrong_model_fails(self) -> None:+ calls = copy.deepcopy(self.calls)+ calls[0]["model"] = "someone/else"+ self.assertEqual(self._check(calls), 1)++ def test_scoring_refuses_failed_calls(self) -> None:+ calls = copy.deepcopy(self.calls)+ calls[0]["status"] = "error"+ with self.assertRaisesRegex(SystemExit, "failed"):+ score.usable({"calls": calls})+++if __name__ == "__main__":+ unittest.main()diff --git a/examples/typed-decisions/tune.py b/examples/typed-decisions/tune.pynew file mode 100644index 000000000..3ec926a49--- /dev/null+++ b/examples/typed-decisions/tune.py@@ -0,0 +1,433 @@+#!/usr/bin/env python3+"""Choose phrasing, decision rules and lane cut-offs on the dev slice, and write tuning.json.++ python3 tune.py phrasing --calls <dev recordings in short, described and concrete>+ python3 tune.py rules --calls <dev recordings in the tuned variant>+ python3 tune.py lanes --calls <dev recordings in the tuned variant>++Standard library only, no model. Only dev calls are read; test calls in the+input are skipped unread, so the published calls.json can be passed whole. The procedure is written down in PREREGISTRATION.md before+any test record is sent, and applies to every backend and question the same way.++A decision rule turns returned probabilities into an answer (see tuning.py):++ yes or no a cut-off on P(true), from 0.05 to 0.95 in steps of 0.01. Among+ cut-offs whose dev accuracy is at least the majority answer's,+ the one with the highest balanced accuracy wins; if none reaches+ the majority's accuracy, the highest balanced accuracy wins+ anyway. Ties go to the cut-off nearest 0.5.+ pick one either the plain top option, or the top option after dividing+ each option's probability by its mean over the dev records (a+ correction for the options a model favours regardless of input;+ it uses no labels). The correction is kept only if it raises dev+ balanced accuracy without taking accuracy below the majority's+ and without lowering the worst recall among options with at+ least 10 dev records.++A backend that returns only its top option (GLiNER2 on pick-one questions)+keeps the plain top option.++`phrasing` fits a rule for each phrasing of each question and keeps the+phrasing that passes the page rule below, preferring the highest 5th-percentile+balanced accuracy; when none passes, the highest balanced accuracy (ties:+described, then short, then concrete). `rules` refits the rule on the tuned recording,+where every question is sent in its chosen phrasing.++The page rule, with margin. A question passes for a backend or a lane when, on+the dev records with its settings fixed, in at least 95% of 1,000 bootstrap+resamples (seed SEED) its balanced accuracy is at least 0.70 and its accuracy is+at least the resample's majority answer's; and every option with at least 10+dev records is answered right at least 40% of the time. The composed severity+is held to the same rule on exact level.++`lanes` judges the board's lanes (Fast, Smart and the LLM, each one model on+its own) by the page rule, and fits the cascade: Fast first, Smart for the+questions Fast is not asked and for the answers whose top probability is below+a cut-off. The cut-off per question is the lowest (least escalated) at which,+on dev, the cascade's accuracy and balanced accuracy are at least Smart's alone+and no record Smart answers right is answered wrong. Escalating everything+always meets that. The cascade then passes its control only if it also costs+less than Smart alone, in calls per record; a cascade that fails is reported in+the README and does not go on the page.+"""++from __future__ import annotations++import argparse+import json+import random+import statistics+import sys+from collections import defaultdict+from pathlib import Path+from typing import Any++import lanes+import score+import tuning+from questions import CHOICE, CONCRETE, DESCRIBED, NOUL, SHORT, VULNERABILITY_QUESTIONS, VULNERABILITY_TRIAGE, asked+from run import LLM_BACKENDS, PAGE_LLM++PHRASING_ORDER = (DESCRIBED, SHORT, CONCRETE)+CUTOFFS = tuple(round(step / 100, 2) for step in range(5, 96))+PAGE_MIN_BALANCED = 0.70+PAGE_MIN_CLASS_RECALL = 0.40+PAGE_MIN_CLASS_RECORDS = 10+BOOTSTRAP = 1000+BOOTSTRAP_QUANTILE = 0.05+SEED = 20260924+LANE_CUTOFFS = (None, *(round(step / 100, 2) for step in range(50, 100, 5)), 1.01)++# The lanes the page's board compares, each one model on its own.+LANES = {+ "fast": {"backend": "gliformer-large"},+ "smart": {"backend": "gliclass-large-v1"},+ "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"}+++def metrics(gold: list[str], predicted: list[str]) -> dict[str, Any]:+ right = sum(g == p for g, p in zip(gold, predicted))+ return {+ "n": len(gold),+ "accuracy": right / len(gold),+ "balanced_accuracy": score.balanced_accuracy(gold, predicted),+ "macro_f1": score.macro_f1(gold, predicted),+ "recall": score.class_recall(gold, predicted),+ }+++def majority_accuracy(gold: list[str]) -> float:+ return max(gold.count(option) for option in set(gold)) / len(gold)+++def worst_recall(figures: dict[str, Any]) -> float:+ """The lowest recall among options with at least PAGE_MIN_CLASS_RECORDS records."""+ common = [right / total for right, total in figures["recall"].values() if total >= PAGE_MIN_CLASS_RECORDS]+ return min(common) if common else 1.0+++def fit_rule(rows: list[tuple[dict[str, Any], str]]) -> tuple[dict[str, Any], dict[str, Any]]:+ """The decision rule for one question on dev rows of (answer, gold), and its dev figures."""+ gold = [g for _, g in rows]+ floor = majority_accuracy(gold)+ qtype = rows[0][0]["type"]+ have_distributions = all(a["distribution"] is not None for a, _ in rows)+ plain = metrics(gold, [a["top"] for a, _ in rows])+ if qtype == NOUL and have_distributions:+ scored = []+ for cutoff in CUTOFFS:+ rule = {"kind": "cutoff", "cutoff": cutoff}+ figures = metrics(gold, [tuning.apply_rule(a["distribution"], rule)[1] for a, _ in rows])+ scored.append(+ (figures["accuracy"] >= floor, figures["balanced_accuracy"], -abs(cutoff - 0.5), rule, figures)+ )+ allowed = [entry for entry in scored if entry[0]] or scored+ _, _, _, rule, figures = max(allowed, key=lambda entry: (entry[1], entry[2]))+ return rule, figures+ if qtype == CHOICE and have_distributions:+ options = list(rows[0][0]["distribution"])+ means = {key: sum(a["distribution"][key] for a, _ in rows) / len(rows) for key in options}+ if all(mean > 0 for mean in means.values()):+ rule = {"kind": "prior", "weights": {key: 1 / means[key] for key in options}}+ corrected = metrics(gold, [tuning.apply_rule(a["distribution"], rule)[1] for a, _ in rows])+ if (+ corrected["balanced_accuracy"] > plain["balanced_accuracy"]+ and corrected["accuracy"] >= floor+ and worst_recall(corrected) >= worst_recall(plain)+ ):+ return rule, corrected+ return {"kind": "argmax"}, plain+++def decide(sample: list[tuple[dict[str, Any], str]], rule: dict[str, Any]) -> list[str]:+ return [+ tuning.apply_rule(a["distribution"], rule)[1] if a["distribution"] is not None else a["top"] for a, _ in sample+ ]+++def verdict(gold: list[str], predicted: list[str]) -> dict[str, Any]:+ """The page rule with margin, on fixed answers."""+ rng = random.Random(SEED)+ n = len(gold)+ balanced, margins = [], []+ for _ in range(BOOTSTRAP):+ picks = [rng.randrange(n) for _ in range(n)]+ g = [gold[i] for i in picks]+ p = [predicted[i] for i in picks]+ balanced.append(score.balanced_accuracy(g, p))+ margins.append(sum(a == b for a, b in zip(g, p)) / n - majority_accuracy(g))+ at = int(BOOTSTRAP * BOOTSTRAP_QUANTILE)+ low_balanced, low_margin = sorted(balanced)[at], sorted(margins)[at]+ figures = metrics(gold, predicted)+ reasons = []+ if low_balanced < PAGE_MIN_BALANCED:+ reasons.append(f"balanced accuracy {figures['balanced_accuracy']:.3f}, 5th percentile {low_balanced:.3f}")+ if low_margin < 0:+ reasons.append(+ f"accuracy over the majority answer {figures['accuracy'] - majority_accuracy(gold):+.3f}, 5th percentile {low_margin:+.3f}"+ )+ for option, (right, total) in figures["recall"].items():+ if total >= PAGE_MIN_CLASS_RECORDS and right / total < PAGE_MIN_CLASS_RECALL:+ reasons.append(f"{option} right {right} of {total}")+ return {+ "eligible": not reasons,+ "reasons": reasons,+ "bootstrap_p05": {"balanced_accuracy": low_balanced, "accuracy_over_majority": low_margin},+ **figures,+ "majority_accuracy": majority_accuracy(gold),+ }+++def dev_calls(paths: list[str]) -> list[dict[str, Any]]:+ calls = []+ for path in paths:+ for call in score.usable(score.load(Path(path))):+ if call["set"] != VULNERABILITY_TRIAGE:+ continue+ # Only dev calls are read; a test call is never seen.+ if call["split"] == "dev":+ calls.append(call)+ return calls+++def answers_by(calls: list[dict[str, Any]], data_dir: Path, decided: bool) -> dict[tuple[str, str], dict]:+ """(backend, variant) -> case -> question -> answer."""+ cases = score.load(data_dir / f"inputs/{VULNERABILITY_TRIAGE}/cases.json")+ by_slug = {case["slug"]: case for case in cases["cases"]}+ out: dict[tuple[str, str], dict] = defaultdict(dict)+ for call in calls:+ case = by_slug[call["case"]]+ answers = score.NORMALISERS[call["transport"]](+ call, asked(VULNERABILITY_TRIAGE, call["backend"], score.questions_for(cases, case))+ )+ out[(call["backend"], call["variant"])][call["case"]] = score.decided(call, answers) if decided else answers+ return out+++def gold_of(data_dir: Path) -> dict[str, dict[str, str]]:+ cases = score.load(data_dir / f"inputs/{VULNERABILITY_TRIAGE}/cases.json")+ return {case["slug"]: case["gold"] for case in cases["cases"]}+++def rows_for(per_case: dict[str, dict], gold: dict[str, dict[str, str]], qid: str) -> list[tuple[dict, str]]:+ return [(answers[qid], gold[case][qid]) for case, answers in sorted(per_case.items()) if qid in answers]+++def best_phrasing(tried: dict[str, dict[str, Any]]) -> str:+ """A phrasing that passes the page rule over one that does not, then the higher 5th percentile."""+ return max(+ tried,+ key=lambda p: (+ tried[p]["passes"],+ tried[p]["p05_balanced_accuracy"],+ tried[p]["balanced_accuracy"],+ -PHRASING_ORDER.index(p),+ ),+ )+++def lane_call(call: dict[str, Any]) -> bool:+ """A call the lanes read: a tuned recording, or an LLM's described one."""+ return call["variant"] == tuning.TUNED or (call["backend"] in LLM_BACKENDS and call["variant"] == DESCRIBED)+++def choose_phrasing(paths: list[str], data_dir: Path, tuned: dict[str, Any]) -> None:+ calls = [call for call in dev_calls(paths) if call["variant"] in PHRASING_ORDER]+ by = answers_by(calls, data_dir, decided=False)+ gold = gold_of(data_dir)+ target = tuned.setdefault("backends", {}).setdefault(VULNERABILITY_TRIAGE, {})+ for backend in sorted({backend for backend, _ in by} - set(LLM_BACKENDS)):+ phrasings: dict[str, Any] = {}+ for qid in asked(VULNERABILITY_TRIAGE, backend, VULNERABILITY_QUESTIONS):+ tried = {}+ for phrasing in PHRASING_ORDER:+ sample = rows_for(by.get((backend, phrasing), {}), gold, qid)+ if not sample:+ continue+ rule, _ = fit_rule(sample)+ judged = verdict([g for _, g in sample], decide(sample, rule))+ tried[phrasing] = {+ "rule": rule,+ "passes": judged["eligible"],+ "p05_balanced_accuracy": judged["bootstrap_p05"]["balanced_accuracy"],+ **{k: judged[k] for k in ("accuracy", "balanced_accuracy")},+ }+ 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()))+++def fit_rules(paths: list[str], data_dir: Path, tuned: dict[str, Any]) -> None:+ calls = [call for call in dev_calls(paths) if call["variant"] == tuning.TUNED]+ 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()):+ if variant != tuning.TUNED:+ continue+ settings: dict[str, Any] = {}+ for qid in asked(VULNERABILITY_TRIAGE, backend, VULNERABILITY_QUESTIONS):+ sample = rows_for(per_case, gold, qid)+ rule, _ = fit_rule(sample)+ settings[qid] = {"rule": rule, "dev": verdict([g for _, g in sample], decide(sample, rule))}+ report(backend, qid, rule, settings[qid]["dev"])+ target[backend]["questions"] = settings+++def report(name: str, qid: str, rule: dict[str, Any] | None, figures: dict[str, Any]) -> None:+ mark = "PASS" if figures["eligible"] else "fail"+ kind = "" if rule is None else rule["kind"] + (f" {rule['cutoff']}" if rule["kind"] == "cutoff" else "")+ print(+ f"{name:<34}{qid:<24}{mark} {kind:<12} acc {figures['accuracy']:.3f} (maj {figures['majority_accuracy']:.3f})"+ f" bal {figures['balanced_accuracy']:.3f} p05 {figures['bootstrap_p05']['balanced_accuracy']:.3f}"+ + ("" if figures["eligible"] else f" [{'; '.join(figures['reasons'])}]")+ )+++def lane_inputs(calls: list[dict[str, Any]], data_dir: Path) -> dict[str, dict[str, dict[str, Any]]]:+ """backend -> case -> question -> answer after its rules: the tuned recording, or an LLM's described one."""+ by = answers_by(calls, data_dir, decided=True)+ out = {backend: per_case for (backend, variant), per_case in by.items() if variant == tuning.TUNED}+ for (backend, variant), per_case in by.items():+ if backend in LLM_BACKENDS and variant == DESCRIBED:+ out[backend] = per_case+ return out+++def judge_lane(+ lane: dict[str, Any], per_backend: dict, gold: dict[str, dict[str, str]], latency: dict, name: str+) -> dict[str, Any]:+ answers, escalated = lanes.lane_answers(lane, per_backend)+ cases = sorted(answers)+ out: dict[str, Any] = {**lane, "questions": {}}+ for qid in sorted({qid for a in answers.values() for qid in a}):+ rows = [(answers[c][qid]["top"], gold[c][qid]) for c in cases if qid in answers[c]]+ figures = verdict([g for _, g in rows], [p for p, _ in rows])+ if qid != lanes.SEVERITY and "escalate_to" in lane:+ figures["escalated"] = statistics.fmean(escalated[c][qid] for c in cases)+ out["questions"][qid] = figures+ report(f"lane {name}", qid, None, figures)+ out["latency_ms_median"] = statistics.median(record_latency(lane, c, escalated[c], latency) for c in cases)+ out["calls_per_record"] = statistics.fmean(record_calls(lane, c, escalated[c], latency) for c in cases)+ print(f"lane {name}: median {out['latency_ms_median']:.0f} ms per record, {out['calls_per_record']:.2f} calls")+ return out+++def fit_cascade(per_backend: dict, gold: dict[str, dict[str, str]]) -> dict[str, Any]:+ """The cascade's cut-off per question, found on dev against Smart alone."""+ fast_answers = per_backend[CASCADE["backend"]]+ smart_answers = per_backend[CASCADE["escalate_to"]]+ cases = sorted(set(smart_answers) & set(fast_answers))+ cutoffs: dict[str, float] = {}+ for qid in sorted(next(iter(fast_answers.values()))):+ g = [gold[c][qid] for c in cases]+ s_pred = [smart_answers[c][qid]["top"] for c in cases]+ s_fig = metrics(g, s_pred)+ for cutoff in LANE_CUTOFFS:+ pred = [+ smart_answers[c][qid]["top"]+ if cutoff is not None and fast_answers[c][qid]["top_p"] < cutoff+ else fast_answers[c][qid]["top"]+ for c in cases+ ]+ fig = metrics(g, pred)+ regressions = sum(sp == gg and p != gg for sp, p, gg in zip(s_pred, pred, g))+ if (+ fig["accuracy"] >= s_fig["accuracy"]+ and fig["balanced_accuracy"] >= s_fig["balanced_accuracy"]+ and regressions == 0+ ):+ if cutoff is not None:+ cutoffs[qid] = cutoff+ break+ return {**CASCADE, "cutoffs": cutoffs}+++def fit_lanes(paths: list[str], data_dir: Path, tuned: dict[str, Any]) -> None:+ calls = [call for call in dev_calls(paths) if lane_call(call)]+ per_backend = lane_inputs(calls, data_dir)+ latency = request_latencies(calls)+ gold = gold_of(data_dir)+ out = {name: judge_lane(lane, per_backend, gold, latency, name) for name, lane in LANES.items()}+ cascade = judge_lane(fit_cascade(per_backend, gold), per_backend, gold, latency, "cascade")+ smart = out["smart"]+ shared = [qid for qid in smart["questions"] if qid in cascade["questions"] and qid != lanes.SEVERITY]+ answers, _ = lanes.lane_answers(cascade, per_backend)+ alone, _ = lanes.lane_answers(LANES["smart"], per_backend)+ regressions = sum(+ alone[c][qid]["top"] == gold[c][qid] and answers[c][qid]["top"] != gold[c][qid]+ for c in answers+ for qid in shared+ )+ control = {+ "matches_smart": all(+ cascade["questions"][qid][k] >= smart["questions"][qid][k]+ for qid in shared+ for k in ("accuracy", "balanced_accuracy")+ ),+ "regressions": regressions,+ "costs_less": cascade["calls_per_record"] < smart["calls_per_record"],+ }+ control["passes"] = control["matches_smart"] and regressions == 0 and control["costs_less"]+ cascade["control"] = control+ print(+ f"cascade against Smart alone: matches {control['matches_smart']}, regressions {regressions}, "+ f"{cascade['calls_per_record']:.2f} calls per record against {smart['calls_per_record']:.2f}: "+ + ("PASS" if control["passes"] else "fail")+ )+ tuned["lanes"] = out+ tuned["cascade"] = cascade+++def request_latencies(calls: list[dict[str, Any]]) -> dict[tuple[str, str], dict[str, Any]]:+ """(backend, case) -> {"total": ms, "requests": n, question id: ms} from the recordings lanes read."""+ out: dict[tuple[str, str], dict[str, Any]] = {}+ for call in calls:+ if not lane_call(call):+ continue+ entry = {"total": call["timing"]["latency_ms"], "requests": len(call["requests"])}+ for request, ms in zip(call["requests"], call["timing"]["per_request_ms"]):+ if "question" in request:+ entry[request["question"]] = ms+ out[(call["backend"], call["case"])] = entry+ return out+++def record_latency(lane: dict[str, Any], case: str, escalated: dict[str, bool], latency: dict) -> float:+ 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)+ return total+++def 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())+ return calls+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("stage", choices=("phrasing", "rules", "lanes"))+ parser.add_argument("--calls", nargs="+", required=True, help="dev recordings")+ parser.add_argument("--data", default="data", help="directory holding inputs/ (default: data)")+ args = parser.parse_args()+ tuned = tuning.load()+ if args.stage == "phrasing":+ choose_phrasing(args.calls, Path(args.data), tuned)+ elif args.stage == "rules":+ fit_rules(args.calls, Path(args.data), tuned)+ else:+ fit_lanes(args.calls, Path(args.data), tuned)+ tuning.TUNING_PATH.write_text(json.dumps(tuned, indent=1, sort_keys=True) + "\n", encoding="utf-8")+ print(f"wrote {tuning.TUNING_PATH.name}")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/typed-decisions/tuning.json b/examples/typed-decisions/tuning.jsonnew file mode 100644index 000000000..96d5fb45a--- /dev/null+++ b/examples/typed-decisions/tuning.json@@ -0,0 +1,3483 @@+{+ "backends": {+ "vulnerability-triage": {+ "gliclass": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.5491071428571429,+ "balanced_accuracy": 0.7207438530967942,+ "p05_balanced_accuracy": 0.6802232854864434,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.7633928571428571,+ "balanced_accuracy": 0.7874260815437286,+ "p05_balanced_accuracy": 0.7278957044960722,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.5491071428571429,+ "balanced_accuracy": 0.7207438530967942,+ "p05_balanced_accuracy": 0.6802232854864434,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "described"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.6160714285714286,+ "balanced_accuracy": 0.6346153846153846,+ "p05_balanced_accuracy": 0.5922266139657444,+ "passes": false,+ "rule": {+ "cutoff": 0.05,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.8303571428571429,+ "balanced_accuracy": 0.8282051282051281,+ "p05_balanced_accuracy": 0.7888942462230795,+ "passes": true,+ "rule": {+ "cutoff": 0.68,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.7767857142857143,+ "balanced_accuracy": 0.766025641025641,+ "p05_balanced_accuracy": 0.723217141029741,+ "passes": true,+ "rule": {+ "cutoff": 0.13,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8392857142857143,+ "balanced_accuracy": 0.8392857142857143,+ "p05_balanced_accuracy": 0.8030706649672167,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 11.562035619918511,+ "command_injection": 4.396620366094622,+ "cross_site_scripting": 7.478058659997666,+ "file_upload": 14.924648481553396,+ "memory_corruption": 9.834559765356452,+ "path_traversal": 9.047521920904108,+ "request_forgery": 6.544047871558103,+ "sql_injection": 8.311553070598249+ }+ }+ },+ "described": {+ "accuracy": 0.8125,+ "balanced_accuracy": 0.8125,+ "p05_balanced_accuracy": 0.7729785280970626,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 3.700934315414952,+ "command_injection": 4.2159969975137175,+ "cross_site_scripting": 8.783257090722309,+ "file_upload": 21.60648675897351,+ "memory_corruption": 23.540463375069606,+ "path_traversal": 12.87434384292174,+ "request_forgery": 10.82739328572516,+ "sql_injection": 8.336214843106061+ }+ }+ },+ "short": {+ "accuracy": 0.8169642857142857,+ "balanced_accuracy": 0.8169642857142857,+ "p05_balanced_accuracy": 0.7772936435961173,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 9.80476282672217,+ "command_injection": 4.205013459501192,+ "cross_site_scripting": 7.472014463071114,+ "file_upload": 14.929863840024218,+ "memory_corruption": 14.152847820274854,+ "path_traversal": 9.215375976423344,+ "request_forgery": 6.300513798865432,+ "sql_injection": 8.23071310505582+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.7633928571428571,+ "balanced_accuracy": 0.7874260815437286,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.1428571428571429,+ "balanced_accuracy": 0.7278957044960722+ },+ "eligible": false,+ "macro_f1": 0.6752220765982234,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "accuracy over the majority answer -0.080, 5th percentile -0.143"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 28,+ 34+ ],+ "network": [+ 142,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.8303571428571429,+ "balanced_accuracy": 0.8282051282051281,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.2321428571428572,+ "balanced_accuracy": 0.7888942462230795+ },+ "eligible": true,+ "macro_f1": 0.8289938926390228,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [],+ "recall": {+ "false": [+ 83,+ 104+ ],+ "true": [+ 103,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.68,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.8392857142857143,+ "balanced_accuracy": 0.8392857142857143,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6339285714285714,+ "balanced_accuracy": 0.8030706649672167+ },+ "eligible": true,+ "macro_f1": 0.8407182040410708,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 19,+ 28+ ],+ "command_injection": [+ 27,+ 28+ ],+ "cross_site_scripting": [+ 27,+ 28+ ],+ "file_upload": [+ 16,+ 28+ ],+ "memory_corruption": [+ 23,+ 28+ ],+ "path_traversal": [+ 23,+ 28+ ],+ "request_forgery": [+ 26,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 11.562035619918511,+ "command_injection": 4.396620366094622,+ "cross_site_scripting": 7.478058659997666,+ "file_upload": 14.924648481553396,+ "memory_corruption": 9.834559765356452,+ "path_traversal": 9.047521920904108,+ "request_forgery": 6.544047871558103,+ "sql_injection": 8.311553070598249+ }+ }+ }+ }+ },+ "gliclass-base-v1": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.8794642857142857,+ "balanced_accuracy": 0.6029411764705882,+ "p05_balanced_accuracy": 0.546875,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.32142857142857145,+ "balanced_accuracy": 0.5858232181761593,+ "p05_balanced_accuracy": 0.5494764397905759,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.8794642857142857,+ "balanced_accuracy": 0.6029411764705882,+ "p05_balanced_accuracy": 0.546875,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "described"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.6160714285714286,+ "balanced_accuracy": 0.5916666666666667,+ "p05_balanced_accuracy": 0.5521541950113379,+ "passes": false,+ "rule": {+ "cutoff": 0.95,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.6964285714285714,+ "balanced_accuracy": 0.6788461538461539,+ "p05_balanced_accuracy": 0.6343878290268051,+ "passes": false,+ "rule": {+ "cutoff": 0.94,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5669642857142857,+ "balanced_accuracy": 0.5342948717948718,+ "p05_balanced_accuracy": 0.5116718988972068,+ "passes": false,+ "rule": {+ "cutoff": 0.95,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "p05_balanced_accuracy": 0.8296692143674902,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 4.754467039593211,+ "command_injection": 8.312241050081841,+ "cross_site_scripting": 6.564394078189863,+ "file_upload": 9.56562391427312,+ "memory_corruption": 10.110490877554959,+ "path_traversal": 10.219269547613377,+ "request_forgery": 8.872335525260725,+ "sql_injection": 9.70708152859477+ }+ }+ },+ "described": {+ "accuracy": 0.7991071428571429,+ "balanced_accuracy": 0.7991071428571429,+ "p05_balanced_accuracy": 0.7602213016868189,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 9.943708864418015,+ "command_injection": 8.21886818623309,+ "cross_site_scripting": 2.634320259817459,+ "file_upload": 10.055180584213394,+ "memory_corruption": 113.681999418389,+ "path_traversal": 7.786170095319399,+ "request_forgery": 12.21701219727593,+ "sql_injection": 12.558953289199655+ }+ }+ },+ "short": {+ "accuracy": 0.7901785714285714,+ "balanced_accuracy": 0.7901785714285714,+ "p05_balanced_accuracy": 0.7514671512697828,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 4.651283616277249,+ "command_injection": 7.622615410738631,+ "cross_site_scripting": 4.605222283922111,+ "file_upload": 11.18962875098341,+ "memory_corruption": 40.316190721243764,+ "path_traversal": 8.550441086064358,+ "request_forgery": 9.058613098616584,+ "sql_injection": 10.50921050075283+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.32142857142857145,+ "balanced_accuracy": 0.5858232181761593,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.6026785714285714,+ "balanced_accuracy": 0.5494764397905759+ },+ "eligible": false,+ "macro_f1": 0.5453618756371049,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.586, 5th percentile 0.549",+ "accuracy over the majority answer -0.522, 5th percentile -0.603",+ "network right 38 of 189"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 33,+ 34+ ],+ "network": [+ 38,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.6964285714285714,+ "balanced_accuracy": 0.6788461538461539,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.1116071428571428,+ "balanced_accuracy": 0.6343878290268051+ },+ "eligible": false,+ "macro_f1": 0.6675687472719336,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.679, 5th percentile 0.634"+ ],+ "recall": {+ "false": [+ 45,+ 104+ ],+ "true": [+ 111,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.94,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6651785714285714,+ "balanced_accuracy": 0.8296692143674902+ },+ "eligible": true,+ "macro_f1": 0.8661808361295427,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 23,+ 28+ ],+ "command_injection": [+ 23,+ 28+ ],+ "cross_site_scripting": [+ 27,+ 28+ ],+ "file_upload": [+ 24,+ 28+ ],+ "memory_corruption": [+ 23,+ 28+ ],+ "path_traversal": [+ 22,+ 28+ ],+ "request_forgery": [+ 25,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 4.754467039593211,+ "command_injection": 8.312241050081841,+ "cross_site_scripting": 6.564394078189863,+ "file_upload": 9.56562391427312,+ "memory_corruption": 10.110490877554959,+ "path_traversal": 10.219269547613377,+ "request_forgery": 8.872335525260725,+ "sql_injection": 9.70708152859477+ }+ }+ }+ }+ },+ "gliclass-instruct-large": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.9464285714285714,+ "balanced_accuracy": 0.8355897914721444,+ "p05_balanced_accuracy": 0.7707338638373121,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.84375,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.9464285714285714,+ "balanced_accuracy": 0.8355897914721444,+ "p05_balanced_accuracy": 0.7707338638373121,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.5401785714285714,+ "balanced_accuracy": 0.5048076923076923,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "cutoff": 0.92,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.5357142857142857,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "cutoff": 0.5,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5357142857142857,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "cutoff": 0.5,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "concrete"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8839285714285714,+ "balanced_accuracy": 0.8839285714285714,+ "p05_balanced_accuracy": 0.8469483103103793,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 12.857133230617379,+ "command_injection": 6.682122425981666,+ "cross_site_scripting": 6.125525203858402,+ "file_upload": 8.911303216070447,+ "memory_corruption": 7.4482250899722136,+ "path_traversal": 9.595552402902518,+ "request_forgery": 7.49841274922966,+ "sql_injection": 7.983133607110188+ }+ }+ },+ "described": {+ "accuracy": 0.8571428571428571,+ "balanced_accuracy": 0.8571428571428572,+ "p05_balanced_accuracy": 0.8190859350532271,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 6.379991132350418,+ "command_injection": 6.34499236079464,+ "cross_site_scripting": 4.723841164549825,+ "file_upload": 10.600316765017828,+ "memory_corruption": 18.0382451633513,+ "path_traversal": 9.621761573682905,+ "request_forgery": 9.334723041536789,+ "sql_injection": 8.839334431507215+ }+ }+ },+ "short": {+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "p05_balanced_accuracy": 0.8291998231653404,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 9.69480763520804,+ "command_injection": 5.103662197059022,+ "cross_site_scripting": 6.55562281836213,+ "file_upload": 8.860826486561937,+ "memory_corruption": 17.23896257345732,+ "path_traversal": 8.887228616382984,+ "request_forgery": 7.316907345032132,+ "sql_injection": 7.793123135911944+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.9464285714285714,+ "balanced_accuracy": 0.8355897914721444,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.0669642857142857,+ "balanced_accuracy": 0.7707338638373121+ },+ "eligible": true,+ "macro_f1": 0.9207252044081052,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 23,+ 34+ ],+ "network": [+ 188,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.5401785714285714,+ "balanced_accuracy": 0.5048076923076923,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.031250000000000056,+ "balanced_accuracy": 0.5+ },+ "eligible": false,+ "macro_f1": 0.35937803692905734,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.505, 5th percentile 0.500",+ "accuracy over the majority answer +0.004, 5th percentile -0.031",+ "false right 1 of 104"+ ],+ "recall": {+ "false": [+ 1,+ 104+ ],+ "true": [+ 120,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.92,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.8839285714285714,+ "balanced_accuracy": 0.8839285714285714,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6785714285714286,+ "balanced_accuracy": 0.8469483103103793+ },+ "eligible": true,+ "macro_f1": 0.8832656500713079,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 19,+ 28+ ],+ "command_injection": [+ 26,+ 28+ ],+ "cross_site_scripting": [+ 27,+ 28+ ],+ "file_upload": [+ 23,+ 28+ ],+ "memory_corruption": [+ 27,+ 28+ ],+ "path_traversal": [+ 23,+ 28+ ],+ "request_forgery": [+ 26,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 12.857133230617379,+ "command_injection": 6.682122425981666,+ "cross_site_scripting": 6.125525203858402,+ "file_upload": 8.911303216070447,+ "memory_corruption": 7.4482250899722136,+ "path_traversal": 9.595552402902518,+ "request_forgery": 7.49841274922966,+ "sql_injection": 7.983133607110188+ }+ }+ }+ }+ },+ "gliclass-instruct-large-grouped": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.84375,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.9017857142857143,+ "balanced_accuracy": 0.7005913476501712,+ "p05_balanced_accuracy": 0.6339482915421593,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "adjacent": 26501.320144899873,+ "local": 78249.58517972707,+ "network": 1.000050633197912,+ "physical": 8543752.693956165+ }+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.5357142857142857,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "cutoff": 0.5,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5357142857142857,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "cutoff": 0.5,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "short"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.9107142857142857,+ "balanced_accuracy": 0.9107142857142857,+ "p05_balanced_accuracy": 0.8769499962095071,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 4.257740944617593,+ "command_injection": 9.413791233401916,+ "cross_site_scripting": 5.772156949024336,+ "file_upload": 12.032505862428076,+ "memory_corruption": 10.29146264965769,+ "path_traversal": 13.009200179375474,+ "request_forgery": 8.832499257661825,+ "sql_injection": 8.673174506937857+ }+ }+ },+ "short": {+ "accuracy": 0.8392857142857143,+ "balanced_accuracy": 0.8392857142857143,+ "p05_balanced_accuracy": 0.8062576337542804,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 3.7818393329678357,+ "command_injection": 6.236497724810029,+ "cross_site_scripting": 6.814622734540422,+ "file_upload": 11.883836602583727,+ "memory_corruption": 44.39112830739429,+ "path_traversal": 11.550701322992422,+ "request_forgery": 8.839625841742166,+ "sql_injection": 8.189202925106796+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.9017857142857143,+ "balanced_accuracy": 0.7126517273576096,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.0267857142857143,+ "balanced_accuracy": 0.6470839260312944+ },+ "eligible": false,+ "macro_f1": 0.8403618378237668,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.713, 5th percentile 0.647"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 15,+ 34+ ],+ "network": [+ 186,+ 189+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "adjacent": 24174.82718161058,+ "local": 60909.49484734883,+ "network": 1.0000579260411164,+ "physical": 7166297.32987114+ }+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.5357142857142857,+ "balanced_accuracy": 0.5,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.035714285714285754,+ "balanced_accuracy": 0.5+ },+ "eligible": false,+ "macro_f1": 0.3488372093023256,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.500, 5th percentile 0.500",+ "accuracy over the majority answer +0.000, 5th percentile -0.036",+ "false right 0 of 104"+ ],+ "recall": {+ "false": [+ 0,+ 104+ ],+ "true": [+ 120,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.5,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.9151785714285714,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.7142857142857143,+ "balanced_accuracy": 0.8824840192487251+ },+ "eligible": true,+ "macro_f1": 0.9176485221025895,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 27,+ 28+ ],+ "command_injection": [+ 26,+ 28+ ],+ "cross_site_scripting": [+ 28,+ 28+ ],+ "file_upload": [+ 24,+ 28+ ],+ "memory_corruption": [+ 26,+ 28+ ],+ "path_traversal": [+ 21,+ 28+ ],+ "request_forgery": [+ 26,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 4.905310848253284,+ "command_injection": 8.755158989261057,+ "cross_site_scripting": 6.43304081222983,+ "file_upload": 11.14022899286989,+ "memory_corruption": 8.465229433162232,+ "path_traversal": 11.925937610923066,+ "request_forgery": 8.713819860170188,+ "sql_injection": 8.335602449483185+ }+ }+ }+ }+ },+ "gliclass-large-v1": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.9241071428571429,+ "balanced_accuracy": 0.7741207594148771,+ "p05_balanced_accuracy": 0.7055245189323401,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.9017857142857143,+ "balanced_accuracy": 0.6885309679427326,+ "p05_balanced_accuracy": 0.6185805422647528,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.9241071428571429,+ "balanced_accuracy": 0.7741207594148771,+ "p05_balanced_accuracy": 0.7055245189323401,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.7946428571428571,+ "balanced_accuracy": 0.7916666666666667,+ "p05_balanced_accuracy": 0.7440932311621966,+ "passes": true,+ "rule": {+ "cutoff": 0.93,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.8214285714285714,+ "balanced_accuracy": 0.8166666666666667,+ "p05_balanced_accuracy": 0.7739463601532567,+ "passes": true,+ "rule": {+ "cutoff": 0.79,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.7544642857142857,+ "balanced_accuracy": 0.7426282051282052,+ "p05_balanced_accuracy": 0.6972639011473962,+ "passes": false,+ "rule": {+ "cutoff": 0.95,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8660714285714286,+ "balanced_accuracy": 0.8660714285714286,+ "p05_balanced_accuracy": 0.8335695006747639,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 12.83246982813465,+ "command_injection": 4.225361016208481,+ "cross_site_scripting": 5.491715727698804,+ "file_upload": 18.677700936131643,+ "memory_corruption": 8.492320972238181,+ "path_traversal": 9.686143164699034,+ "request_forgery": 8.218935235555167,+ "sql_injection": 9.336169543850003+ }+ }+ },+ "described": {+ "accuracy": 0.8794642857142857,+ "balanced_accuracy": 0.8794642857142857,+ "p05_balanced_accuracy": 0.8452305809110244,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.6799835748208745,+ "command_injection": 6.871498463580198,+ "cross_site_scripting": 5.594004271546466,+ "file_upload": 12.802813326164816,+ "memory_corruption": 22.452487562156154,+ "path_traversal": 6.275673608179835,+ "request_forgery": 6.754670487771767,+ "sql_injection": 8.66082694647881+ }+ }+ },+ "short": {+ "accuracy": 0.8214285714285714,+ "balanced_accuracy": 0.8214285714285714,+ "p05_balanced_accuracy": 0.7837070562914945,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 12.120945082108959,+ "command_injection": 3.6624156509573993,+ "cross_site_scripting": 5.161261216846685,+ "file_upload": 20.159758782868686,+ "memory_corruption": 19.04862375632236,+ "path_traversal": 9.073745171157556,+ "request_forgery": 7.722224485155923,+ "sql_injection": 9.182920402173837+ }+ }+ }+ },+ "phrasing": "described"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "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+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "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+ ]+ }+ },+ "rule": {+ "cutoff": 0.79,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "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+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.6799835748208745,+ "command_injection": 6.871498463580198,+ "cross_site_scripting": 5.594004271546466,+ "file_upload": 12.802813326164816,+ "memory_corruption": 22.452487562156154,+ "path_traversal": 6.275673608179835,+ "request_forgery": 6.754670487771767,+ "sql_injection": 8.66082694647881+ }+ }+ }+ }+ },+ "gliclass-small-v1": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.5147058823529411,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.5,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.5147058823529411,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.5446428571428571,+ "balanced_accuracy": 0.5096153846153846,+ "p05_balanced_accuracy": 0.5,+ "passes": false,+ "rule": {+ "cutoff": 0.93,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.6071428571428571,+ "balanced_accuracy": 0.5967948717948718,+ "p05_balanced_accuracy": 0.5416666666666666,+ "passes": false,+ "rule": {+ "cutoff": 0.93,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5491071428571429,+ "balanced_accuracy": 0.5208333333333333,+ "p05_balanced_accuracy": 0.4866129032258064,+ "passes": false,+ "rule": {+ "cutoff": 0.95,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.7589285714285714,+ "balanced_accuracy": 0.7589285714285714,+ "p05_balanced_accuracy": 0.7140663156288156,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 22.051104038759494,+ "command_injection": 6.50268174122999,+ "cross_site_scripting": 3.120669004463667,+ "file_upload": 25.067044105573096,+ "memory_corruption": 29.17425097653922,+ "path_traversal": 6.939195026375454,+ "request_forgery": 5.162597473692254,+ "sql_injection": 14.610423556183108+ }+ }+ },+ "described": {+ "accuracy": 0.6026785714285714,+ "balanced_accuracy": 0.6026785714285714,+ "p05_balanced_accuracy": 0.5575,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 422.2762204471234,+ "command_injection": 3.0118986953153626,+ "cross_site_scripting": 3.8996547248459628,+ "file_upload": 57.85000895836186,+ "memory_corruption": 544.8935623633673,+ "path_traversal": 4.383288323562173,+ "request_forgery": 7.19462324684476,+ "sql_injection": 43.61245142358155+ }+ }+ },+ "short": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7276785714285714,+ "p05_balanced_accuracy": 0.6799730714538306,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 15.42997139150055,+ "command_injection": 6.610581730139736,+ "cross_site_scripting": 3.3179156724694487,+ "file_upload": 25.107251169169825,+ "memory_corruption": 36.31567470159296,+ "path_traversal": 5.976918167228225,+ "request_forgery": 5.480623903592631,+ "sql_injection": 15.293401309503604+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.5147058823529411,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.0,+ "balanced_accuracy": 0.5+ },+ "eligible": false,+ "macro_f1": 0.32487286176606567,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.515, 5th percentile 0.500",+ "local right 1 of 34"+ ],+ "recall": {+ "adjacent": [+ 0,+ 1+ ],+ "local": [+ 1,+ 34+ ],+ "network": [+ 189,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.6071428571428571,+ "balanced_accuracy": 0.5967948717948718,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.004464285714285698,+ "balanced_accuracy": 0.5416666666666666+ },+ "eligible": false,+ "macro_f1": 0.5928282244071719,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.597, 5th percentile 0.542"+ ],+ "recall": {+ "false": [+ 47,+ 104+ ],+ "true": [+ 89,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.93,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.7589285714285714,+ "balanced_accuracy": 0.7589285714285714,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.5446428571428572,+ "balanced_accuracy": 0.7140663156288156+ },+ "eligible": true,+ "macro_f1": 0.7546517536541825,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 15,+ 28+ ],+ "command_injection": [+ 22,+ 28+ ],+ "cross_site_scripting": [+ 25,+ 28+ ],+ "file_upload": [+ 16,+ 28+ ],+ "memory_corruption": [+ 16,+ 28+ ],+ "path_traversal": [+ 23,+ 28+ ],+ "request_forgery": [+ 26,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 22.051104038759494,+ "command_injection": 6.50268174122999,+ "cross_site_scripting": 3.120669004463667,+ "file_upload": 25.067044105573096,+ "memory_corruption": 29.17425097653922,+ "path_traversal": 6.939195026375454,+ "request_forgery": 5.162597473692254,+ "sql_injection": 14.610423556183108+ }+ }+ }+ }+ },+ "gliformer-large": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8438375350140056,+ "p05_balanced_accuracy": 0.7793814432989691,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.8883928571428571,+ "balanced_accuracy": 0.6591192032368502,+ "p05_balanced_accuracy": 0.59375,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8317771553065672,+ "p05_balanced_accuracy": 0.7658394435044181,+ "passes": true,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "concrete"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7276785714285714,+ "p05_balanced_accuracy": 0.6853481520545485,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 19.948304549842522,+ "command_injection": 4.502613668719228,+ "cross_site_scripting": 3.1090424954155074,+ "file_upload": 14.735908449445544,+ "memory_corruption": 13.966513530389948,+ "path_traversal": 26.484689777360217,+ "request_forgery": 9.857947011365251,+ "sql_injection": 7.844685993353233+ }+ }+ },+ "described": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7276785714285715,+ "p05_balanced_accuracy": 0.6817030111857698,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 23.22823194250643,+ "command_injection": 4.938784805407601,+ "cross_site_scripting": 2.166561520282506,+ "file_upload": 17.12314560426565,+ "memory_corruption": 47.232129849156514,+ "path_traversal": 26.993651223582177,+ "request_forgery": 14.687058639093834,+ "sql_injection": 9.241827423101384+ }+ }+ },+ "short": {+ "accuracy": 0.6875,+ "balanced_accuracy": 0.6875,+ "p05_balanced_accuracy": 0.645242550425188,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 18.419180417557612,+ "command_injection": 3.707149317090949,+ "cross_site_scripting": 3.2666407619433477,+ "file_upload": 14.355102515834918,+ "memory_corruption": 40.62895698201439,+ "path_traversal": 25.497193161618785,+ "request_forgery": 9.924743080321825,+ "sql_injection": 7.375613834309719+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8438375350140056,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.03125,+ "balanced_accuracy": 0.7793814432989691+ },+ "eligible": true,+ "macro_f1": 0.5617207305085623,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [],+ "recall": {+ "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"+ }+ }+ }+ },+ "laya": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.39732142857142855,+ "balanced_accuracy": 0.5946156240273888,+ "p05_balanced_accuracy": 0.5425863044708545,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.27232142857142855,+ "balanced_accuracy": 0.5326019296607531,+ "p05_balanced_accuracy": 0.48545454545454547,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.39732142857142855,+ "balanced_accuracy": 0.5946156240273888,+ "p05_balanced_accuracy": 0.5425863044708545,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.6116071428571429,+ "balanced_accuracy": 0.6182692307692308,+ "p05_balanced_accuracy": 0.5649122807017544,+ "passes": false,+ "rule": {+ "cutoff": 0.59,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.6383928571428571,+ "balanced_accuracy": 0.6496794871794872,+ "p05_balanced_accuracy": 0.6011262880421759,+ "passes": false,+ "rule": {+ "cutoff": 0.56,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.5982142857142857,+ "balanced_accuracy": 0.6038461538461539,+ "p05_balanced_accuracy": 0.5498866213151927,+ "passes": false,+ "rule": {+ "cutoff": 0.81,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8258928571428571,+ "balanced_accuracy": 0.8258928571428572,+ "p05_balanced_accuracy": 0.785618940845234,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.50602147659458,+ "command_injection": 13.211058166536604,+ "cross_site_scripting": 4.102728492574767,+ "file_upload": 9.298171286558055,+ "memory_corruption": 9.920975509290214,+ "path_traversal": 13.775439861402003,+ "request_forgery": 8.584617796291363,+ "sql_injection": 6.670478737506391+ }+ }+ },+ "described": {+ "accuracy": 0.7991071428571429,+ "balanced_accuracy": 0.7991071428571428,+ "p05_balanced_accuracy": 0.753575313266637,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 5.9461052249973525,+ "command_injection": 13.16216969674277,+ "cross_site_scripting": 3.1198749312990226,+ "file_upload": 7.573532198340523,+ "memory_corruption": 15.708279466104536,+ "path_traversal": 15.191657544772669,+ "request_forgery": 17.858361076826355,+ "sql_injection": 8.488932776481642+ }+ }+ },+ "short": {+ "accuracy": 0.7857142857142857,+ "balanced_accuracy": 0.7857142857142857,+ "p05_balanced_accuracy": 0.7431541895604395,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.435705105600964,+ "command_injection": 11.518259799389439,+ "cross_site_scripting": 3.643474909921417,+ "file_upload": 9.556272907861148,+ "memory_corruption": 17.04359421695394,+ "path_traversal": 13.642631517621338,+ "request_forgery": 9.056355318619072,+ "sql_injection": 6.361480236427861+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.39732142857142855,+ "balanced_accuracy": 0.5946156240273888,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.5223214285714286,+ "balanced_accuracy": 0.5425863044708545+ },+ "eligible": false,+ "macro_f1": 0.22544919238467626,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.595, 5th percentile 0.543",+ "accuracy over the majority answer -0.446, 5th percentile -0.522",+ "network right 58 of 189"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 30,+ 34+ ],+ "network": [+ 58,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.6339285714285714,+ "balanced_accuracy": 0.6448717948717949,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.008928571428571397,+ "balanced_accuracy": 0.5937774582634395+ },+ "eligible": false,+ "macro_f1": 0.6296774193548387,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.645, 5th percentile 0.594"+ ],+ "recall": {+ "false": [+ 83,+ 104+ ],+ "true": [+ 59,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.56,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.8258928571428571,+ "balanced_accuracy": 0.8258928571428572,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6160714285714286,+ "balanced_accuracy": 0.785618940845234+ },+ "eligible": true,+ "macro_f1": 0.8298639132721494,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 22,+ 28+ ],+ "command_injection": [+ 20,+ 28+ ],+ "cross_site_scripting": [+ 25,+ 28+ ],+ "file_upload": [+ 24,+ 28+ ],+ "memory_corruption": [+ 25,+ 28+ ],+ "path_traversal": [+ 17,+ 28+ ],+ "request_forgery": [+ 25,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.50602147659458,+ "command_injection": 13.211058166536604,+ "cross_site_scripting": 4.102728492574767,+ "file_upload": 9.298171286558055,+ "memory_corruption": 9.920975509290214,+ "path_traversal": 13.775439861402003,+ "request_forgery": 8.584617796291363,+ "sql_injection": 6.670478737506391+ }+ }+ }+ }+ },+ "laya-typed-decisions": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.42410714285714285,+ "balanced_accuracy": 0.6225490196078431,+ "p05_balanced_accuracy": 0.5741436623789565,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.5669642857142857,+ "balanced_accuracy": 0.7072051042639278,+ "p05_balanced_accuracy": 0.6557291666666667,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.42410714285714285,+ "balanced_accuracy": 0.6225490196078431,+ "p05_balanced_accuracy": 0.5741436623789565,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "described"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.6785714285714286,+ "balanced_accuracy": 0.675,+ "p05_balanced_accuracy": 0.6225490196078431,+ "passes": false,+ "rule": {+ "cutoff": 0.61,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.7589285714285714,+ "balanced_accuracy": 0.7596153846153846,+ "p05_balanced_accuracy": 0.7098214285714286,+ "passes": true,+ "rule": {+ "cutoff": 0.56,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.6160714285714286,+ "balanced_accuracy": 0.6211538461538462,+ "p05_balanced_accuracy": 0.5634218289085545,+ "passes": false,+ "rule": {+ "cutoff": 0.57,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.8482142857142857,+ "p05_balanced_accuracy": 0.8060759980384726,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.866065308558451,+ "command_injection": 8.663756296827398,+ "cross_site_scripting": 4.001093280233269,+ "file_upload": 11.319995309116582,+ "memory_corruption": 11.519951292796554,+ "path_traversal": 10.285635640770423,+ "request_forgery": 9.065521733500097,+ "sql_injection": 8.01022883802658+ }+ }+ },+ "described": {+ "accuracy": 0.8705357142857143,+ "balanced_accuracy": 0.8705357142857143,+ "p05_balanced_accuracy": 0.8331913896791614,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.29313665916814,+ "command_injection": 8.65732136478079,+ "cross_site_scripting": 3.345457663410147,+ "file_upload": 9.84914517163936,+ "memory_corruption": 13.680560347419906,+ "path_traversal": 11.749054060023003,+ "request_forgery": 12.981680354966782,+ "sql_injection": 8.95336020441376+ }+ }+ },+ "short": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.8482142857142857,+ "p05_balanced_accuracy": 0.8068119692055451,+ "passes": true,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 8.101555384072148,+ "command_injection": 8.343335225556734,+ "cross_site_scripting": 3.9277310092933684,+ "file_upload": 11.19565078659502,+ "memory_corruption": 12.959303375554873,+ "path_traversal": 10.410114301274008,+ "request_forgery": 9.390396449538587,+ "sql_injection": 7.514638261075207+ }+ }+ }+ },+ "phrasing": "described"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.5669642857142857,+ "balanced_accuracy": 0.7072051042639278,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.3526785714285714,+ "balanced_accuracy": 0.6557291666666667+ },+ "eligible": false,+ "macro_f1": 0.518975121507357,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.707, 5th percentile 0.656",+ "accuracy over the majority answer -0.277, 5th percentile -0.353"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 31,+ 34+ ],+ "network": [+ 95,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.7589285714285714,+ "balanced_accuracy": 0.7596153846153846,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.1517857142857143,+ "balanced_accuracy": 0.7098214285714286+ },+ "eligible": true,+ "macro_f1": 0.7584471603163192,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [],+ "recall": {+ "false": [+ 80,+ 104+ ],+ "true": [+ 90,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.56,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.8705357142857143,+ "balanced_accuracy": 0.8705357142857143,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6696428571428571,+ "balanced_accuracy": 0.8331913896791614+ },+ "eligible": true,+ "macro_f1": 0.8708084376301255,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [],+ "recall": {+ "access_control": [+ 24,+ 28+ ],+ "command_injection": [+ 23,+ 28+ ],+ "cross_site_scripting": [+ 25,+ 28+ ],+ "file_upload": [+ 22,+ 28+ ],+ "memory_corruption": [+ 25,+ 28+ ],+ "path_traversal": [+ 25,+ 28+ ],+ "request_forgery": [+ 25,+ 28+ ],+ "sql_injection": [+ 26,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 7.29313665916814,+ "command_injection": 8.65732136478079,+ "cross_site_scripting": 3.345457663410147,+ "file_upload": 9.84914517163936,+ "memory_corruption": 13.680560347419906,+ "path_traversal": 11.749054060023003,+ "request_forgery": 12.981680354966782,+ "sql_injection": 8.95336020441376+ }+ }+ }+ }+ },+ "nli-modernbert-base": {+ "phrasing": {+ "attack_vector": {+ "dev": {+ "concrete": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.7773887332710863,+ "p05_balanced_accuracy": 0.708359133126935,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "described": {+ "accuracy": 0.8125,+ "balanced_accuracy": 0.7079831932773109,+ "p05_balanced_accuracy": 0.6397447868036104,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ },+ "short": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.7773887332710863,+ "p05_balanced_accuracy": 0.708359133126935,+ "passes": false,+ "rule": {+ "kind": "argmax"+ }+ }+ },+ "phrasing": "short"+ },+ "remote_unauthenticated": {+ "dev": {+ "concrete": {+ "accuracy": 0.7098214285714286,+ "balanced_accuracy": 0.6996794871794871,+ "p05_balanced_accuracy": 0.6524482786165029,+ "passes": false,+ "rule": {+ "cutoff": 0.31,+ "kind": "cutoff"+ }+ },+ "described": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7201923076923077,+ "p05_balanced_accuracy": 0.6719298245614036,+ "passes": false,+ "rule": {+ "cutoff": 0.63,+ "kind": "cutoff"+ }+ },+ "short": {+ "accuracy": 0.6428571428571429,+ "balanced_accuracy": 0.6358974358974359,+ "p05_balanced_accuracy": 0.5837096774193549,+ "passes": false,+ "rule": {+ "cutoff": 0.55,+ "kind": "cutoff"+ }+ }+ },+ "phrasing": "described"+ },+ "weakness": {+ "dev": {+ "concrete": {+ "accuracy": 0.7901785714285714,+ "balanced_accuracy": 0.7901785714285714,+ "p05_balanced_accuracy": 0.7486144163878196,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 8.947484233909377,+ "command_injection": 2.9893334273249264,+ "cross_site_scripting": 6.520506634070211,+ "file_upload": 68.26500603900853,+ "memory_corruption": 13.841912421475437,+ "path_traversal": 13.294648869704318,+ "request_forgery": 8.90830896376455,+ "sql_injection": 7.937417748968577+ }+ }+ },+ "described": {+ "accuracy": 0.78125,+ "balanced_accuracy": 0.78125,+ "p05_balanced_accuracy": 0.7398771061454885,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 5.352813412540489,+ "command_injection": 4.134197355865671,+ "cross_site_scripting": 7.638524400024515,+ "file_upload": 27.39052779988603,+ "memory_corruption": 9.327852446677007,+ "path_traversal": 8.789935842965098,+ "request_forgery": 8.612727177118769,+ "sql_injection": 14.971495036084207+ }+ }+ },+ "short": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7276785714285714,+ "p05_balanced_accuracy": 0.6836052932308527,+ "passes": false,+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 8.697162584886337,+ "command_injection": 2.7873048614047855,+ "cross_site_scripting": 6.294093904945935,+ "file_upload": 63.9438947704551,+ "memory_corruption": 39.57819422915059,+ "path_traversal": 12.793075498203198,+ "request_forgery": 8.68988597788267,+ "sql_injection": 7.506233112896248+ }+ }+ }+ },+ "phrasing": "concrete"+ }+ },+ "questions": {+ "attack_vector": {+ "dev": {+ "accuracy": 0.8482142857142857,+ "balanced_accuracy": 0.7773887332710863,+ "bootstrap_p05": {+ "accuracy_over_majority": -0.044642857142857206,+ "balanced_accuracy": 0.708359133126935+ },+ "eligible": false,+ "macro_f1": 0.43222919304708185,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [+ "accuracy over the majority answer +0.004, 5th percentile -0.045"+ ],+ "recall": {+ "adjacent": [+ 1,+ 1+ ],+ "local": [+ 23,+ 34+ ],+ "network": [+ 166,+ 189+ ]+ }+ },+ "rule": {+ "kind": "argmax"+ }+ },+ "remote_unauthenticated": {+ "dev": {+ "accuracy": 0.7276785714285714,+ "balanced_accuracy": 0.7201923076923077,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.1294642857142857,+ "balanced_accuracy": 0.6719298245614036+ },+ "eligible": false,+ "macro_f1": 0.7208637208637209,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.720, 5th percentile 0.672"+ ],+ "recall": {+ "false": [+ 64,+ 104+ ],+ "true": [+ 99,+ 120+ ]+ }+ },+ "rule": {+ "cutoff": 0.63,+ "kind": "cutoff"+ }+ },+ "weakness": {+ "dev": {+ "accuracy": 0.7901785714285714,+ "balanced_accuracy": 0.7901785714285714,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.5758928571428571,+ "balanced_accuracy": 0.7486144163878196+ },+ "eligible": false,+ "macro_f1": 0.7810877230034523,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [+ "file_upload right 9 of 28"+ ],+ "recall": {+ "access_control": [+ 22,+ 28+ ],+ "command_injection": [+ 26,+ 28+ ],+ "cross_site_scripting": [+ 23,+ 28+ ],+ "file_upload": [+ 9,+ 28+ ],+ "memory_corruption": [+ 23,+ 28+ ],+ "path_traversal": [+ 22,+ 28+ ],+ "request_forgery": [+ 25,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ },+ "rule": {+ "kind": "prior",+ "weights": {+ "access_control": 8.947484233909377,+ "command_injection": 2.9893334273249264,+ "cross_site_scripting": 6.520506634070211,+ "file_upload": 68.26500603900853,+ "memory_corruption": 13.841912421475437,+ "path_traversal": 13.294648869704318,+ "request_forgery": 8.90830896376455,+ "sql_injection": 7.937417748968577+ }+ }+ }+ }+ }+ }+ },+ "cascade": {+ "backend": "gliformer-large",+ "calls_per_record": 3.736607142857143,+ "control": {+ "costs_less": false,+ "matches_smart": true,+ "passes": false,+ "regressions": 0+ },+ "cutoffs": {+ "attack_vector": 1.01,+ "weakness": 0.95+ },+ "escalate_to": "gliclass-large-v1",+ "latency_ms_median": 178.985,+ "questions": {+ "attack_vector": {+ "accuracy": 0.9241071428571429,+ "balanced_accuracy": 0.7741207594148771,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.049107142857142794,+ "balanced_accuracy": 0.7055245189323401+ },+ "eligible": true,+ "escalated": 1.0,+ "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,+ "escalated": 1.0,+ "macro_f1": 0.81859410430839,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [],+ "recall": {+ "false": [+ 78,+ 104+ ],+ "true": [+ 106,+ 120+ ]+ }+ },+ "severity": {+ "accuracy": 0.6473214285714286,+ "balanced_accuracy": 0.6529840480433751,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.14732142857142855,+ "balanced_accuracy": 0.6020726196041765+ },+ "eligible": false,+ "macro_f1": 0.6480120902529904,+ "majority_accuracy": 0.4330357142857143,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.653, 5th percentile 0.602"+ ],+ "recall": {+ "1": [+ 38,+ 74+ ],+ "2": [+ 67,+ 97+ ],+ "3": [+ 40,+ 53+ ]+ }+ },+ "weakness": {+ "accuracy": 0.8883928571428571,+ "balanced_accuracy": 0.8883928571428571,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.6875,+ "balanced_accuracy": 0.855216413864746+ },+ "eligible": true,+ "escalated": 0.7366071428571429,+ "macro_f1": 0.8886149545012791,+ "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": [+ 20,+ 28+ ],+ "path_traversal": [+ 27,+ 28+ ],+ "request_forgery": [+ 27,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ }+ }+ },+ "lanes": {+ "fast": {+ "backend": "gliformer-large",+ "calls_per_record": 1.0,+ "latency_ms_median": 45.004999999999995,+ "questions": {+ "attack_vector": {+ "accuracy": 0.9151785714285714,+ "balanced_accuracy": 0.8438375350140056,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.03125,+ "balanced_accuracy": 0.7793814432989691+ },+ "eligible": true,+ "macro_f1": 0.5617207305085623,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [],+ "recall": {+ "adjacent": [+ 0,+ 1+ ],+ "local": [+ 25,+ 34+ ],+ "network": [+ 180,+ 189+ ]+ }+ },+ "weakness": {+ "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+ ]+ }+ }+ }+ },+ "llm": {+ "backend": "qwen3-4b-instruct",+ "calls_per_record": 1.0,+ "latency_ms_median": 2669.8450000000003,+ "questions": {+ "attack_vector": {+ "accuracy": 0.9241071428571429,+ "balanced_accuracy": 0.8129474011826954,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.044642857142857206,+ "balanced_accuracy": 0.7491641337386018+ },+ "eligible": true,+ "macro_f1": 0.5631352282515073,+ "majority_accuracy": 0.84375,+ "n": 224,+ "reasons": [],+ "recall": {+ "adjacent": [+ 0,+ 1+ ],+ "local": [+ 22,+ 34+ ],+ "network": [+ 185,+ 189+ ]+ }+ },+ "remote_unauthenticated": {+ "accuracy": 0.8169642857142857,+ "balanced_accuracy": 0.8041666666666667,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.2276785714285715,+ "balanced_accuracy": 0.765110329389191+ },+ "eligible": true,+ "macro_f1": 0.806109738847721,+ "majority_accuracy": 0.5357142857142857,+ "n": 224,+ "reasons": [],+ "recall": {+ "false": [+ 65,+ 104+ ],+ "true": [+ 118,+ 120+ ]+ }+ },+ "severity": {+ "accuracy": 0.5446428571428571,+ "balanced_accuracy": 0.5254332332721751,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.0401785714285714,+ "balanced_accuracy": 0.47005957005957005+ },+ "eligible": false,+ "macro_f1": 0.4041118449564026,+ "majority_accuracy": 0.4330357142857143,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.525, 5th percentile 0.470",+ "3 right 20 of 53"+ ],+ "recall": {+ "1": [+ 46,+ 74+ ],+ "2": [+ 56,+ 97+ ],+ "3": [+ 20,+ 53+ ]+ }+ },+ "weakness": {+ "accuracy": 0.6741071428571429,+ "balanced_accuracy": 0.6741071428571429,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.4553571428571428,+ "balanced_accuracy": 0.6302534851718155+ },+ "eligible": false,+ "macro_f1": 0.6668152270449319,+ "majority_accuracy": 0.125,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.674, 5th percentile 0.630",+ "file_upload right 8 of 28",+ "memory_corruption right 7 of 28"+ ],+ "recall": {+ "access_control": [+ 17,+ 28+ ],+ "command_injection": [+ 20,+ 28+ ],+ "cross_site_scripting": [+ 28,+ 28+ ],+ "file_upload": [+ 8,+ 28+ ],+ "memory_corruption": [+ 7,+ 28+ ],+ "path_traversal": [+ 18,+ 28+ ],+ "request_forgery": [+ 26,+ 28+ ],+ "sql_injection": [+ 27,+ 28+ ]+ }+ }+ }+ },+ "smart": {+ "backend": "gliclass-large-v1",+ "calls_per_record": 3.0,+ "latency_ms_median": 139.19,+ "questions": {+ "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+ ]+ }+ },+ "severity": {+ "accuracy": 0.6383928571428571,+ "balanced_accuracy": 0.6421902353627699,+ "bootstrap_p05": {+ "accuracy_over_majority": 0.13839285714285715,+ "balanced_accuracy": 0.5911966885449585+ },+ "eligible": false,+ "macro_f1": 0.6384046273876782,+ "majority_accuracy": 0.4330357142857143,+ "n": 224,+ "reasons": [+ "balanced accuracy 0.642, 5th percentile 0.591"+ ],+ "recall": {+ "1": [+ 37,+ 74+ ],+ "2": [+ 67,+ 97+ ],+ "3": [+ 39,+ 53+ ]+ }+ },+ "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+ ]+ }+ }+ }+ }+ }+}diff --git a/examples/typed-decisions/tuning.py b/examples/typed-decisions/tuning.pynew file mode 100644index 000000000..eebc5adbb--- /dev/null+++ b/examples/typed-decisions/tuning.py@@ -0,0 +1,85 @@+"""The settings chosen on the dev slice, and how they apply to a recorded answer.++Standard library only. tune.py writes tuning.json from dev recordings; run.py+reads it to build the `tuned` requests and score.py reads it to turn a tuned+recording's probabilities into answers. Nothing here is fitted on test.++Per backend and question, tuning.json holds:++ phrasing which phrasing (short, described, concrete) the question is sent in+ rule how a probability becomes an answer:+ {"kind": "argmax"} the top option+ {"kind": "cutoff", "cutoff": t} yes when P(true) >= t; P(true)+ is shifted by t's log-odds+ {"kind": "prior", "weights": {option: w}} the top option after+ multiplying each option's+ probability by its weight+ and renormalising+ dev the dev figures the choice was made on+ page whether the question passes the page rule on dev, and why not+"""++from __future__ import annotations++import json+import math+from pathlib import Path+from typing import Any++from questions import Phrasing++TUNED = "tuned"+TUNING_PATH = Path(__file__).resolve().with_name("tuning.json")+++def load(path: Path | None = None) -> dict[str, Any]:+ path = TUNING_PATH if path is None else path+ if not path.exists():+ return {"backends": {}}+ return json.loads(path.read_text(encoding="utf-8"))+++def entry(set_name: str, backend: str, tuning: dict[str, Any] | None = None) -> dict[str, Any] | None:+ tuning = load() if tuning is None else tuning+ return tuning.get("backends", {}).get(set_name, {}).get(backend)+++def phrasing(set_name: str, backend: str, variant: str, tuning: dict[str, Any] | None = None) -> Phrasing:+ """The phrasing a recorded variant stands for: itself, or the tuned per-question mix."""+ if variant != TUNED:+ return variant+ found = entry(set_name, backend, tuning)+ if found is None or "phrasing" not in found:+ raise SystemExit(f"tuning.json has no tuned phrasing for {set_name}/{backend}; run tune.py first")+ return {qid: settings["phrasing"] for qid, settings in found["phrasing"].items()}+++def rules(set_name: str, backend: str, variant: str, tuning: dict[str, Any] | None = None) -> dict[str, dict]:+ """The decision rule per question for a recorded variant; argmax everywhere unless it is `tuned`."""+ if variant != TUNED:+ return {}+ found = entry(set_name, backend, tuning) or {}+ return {qid: settings["rule"] for qid, settings in found.get("questions", {}).items()}+++def logit(p: float) -> float:+ return math.log(p / (1 - p))+++def apply_rule(distribution: dict[str, float], rule: dict[str, Any] | None) -> tuple[dict[str, float], str]:+ """The distribution after a rule, and the answer it gives."""+ kind = (rule or {}).get("kind", "argmax")+ if kind == "cutoff":+ # Shift P(true) by the cut-off's log-odds: the answer is yes exactly when+ # P(true) >= cut-off, and the shifted probability says how far past the+ # cut-off it is, which is what a composition or a confidence check reads.+ p_true = min(max(distribution["true"], 1e-6), 1 - 1e-6)+ shifted = 1 / (1 + math.exp(-(logit(p_true) - logit(rule["cutoff"]))))+ return {"true": shifted, "false": 1 - shifted}, "true" if shifted >= 0.5 else "false"+ if kind == "prior":+ weighted = {key: p * rule["weights"][key] for key, p in distribution.items()}+ total = sum(weighted.values())+ distribution = {key: value / total for key, value in weighted.items()} if total > 0 else distribution+ elif kind != "argmax":+ raise SystemExit(f"unknown rule kind {kind!r}")+ return distribution, max(distribution, key=distribution.get)diff --git a/examples/typed-decisions/uv.lock b/examples/typed-decisions/uv.locknew file mode 100644index 000000000..2a45432d1--- /dev/null+++ b/examples/typed-decisions/uv.lock@@ -0,0 +1,853 @@+version = 1+requires-python = "==3.12.*"+resolution-markers = [+ "sys_platform == 'linux'",+ "sys_platform != 'linux'",+]++[[package]]+name = "aiohappyeyeballs"+version = "2.7.1"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/ce/f4/eec0465c2f67b2664688d0240b3212d5196fd89e741df67ddb81f8d35658/aiohappyeyeballs-2.7.1.tar.gz", hash = "sha256:065665c041c42a5938ed220bdcd7230f22527fbec085e1853d2402c8a3615d9d", size = 24757 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/71/43/1947f06babed6b3f1d7f38b0c767f52df66bfb2bc10b468c4a7de9eceff2/aiohappyeyeballs-2.7.1-py3-none-any.whl", hash = "sha256:9243213661e29250eb41368e5daa826fc017156c3b8a11440826b2e3ed376472", size = 15038 },+]++[[package]]+name = "aiohttp"+version = "3.14.3"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "aiohappyeyeballs" },+ { name = "aiosignal" },+ { name = "attrs" },+ { name = "frozenlist" },+ { name = "multidict" },+ { name = "propcache" },+ { name = "typing-extensions" },+ { name = "yarl" },+]+sdist = { url = "https://files.pythonhosted.org/packages/58/d9/22ce5786ac0c1653ae8b6c23bded02c1686d11f0dbb45b31ce128e0df985/aiohttp-3.14.3.tar.gz", hash = "sha256:9491196535a88924a60afd5b5f434b5b203b6cc616250878dbdb223a8f7844bc", size = 7971213 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/18/d4/eb96299230e20acf2efae207cb8d69051f1f68e357e5ea5e479bf6fb097a/aiohttp-3.14.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:39aded8c7f3b935b54aab1d8d73c70ec0ee2d3ec3b943e0e86611bc150ba47f5", size = 754690 },+ { url = "https://files.pythonhosted.org/packages/88/11/e7a70a209eb9a067c0d3212b518a0134e3484f5178c7533878b6b514d469/aiohttp-3.14.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5bcb6ff3fdab1258a192679ff1a05d44f59626430aa05cd1a9d2447423599228", size = 509484 },+ { url = "https://files.pythonhosted.org/packages/30/07/4bbc222cc8dbe31d4c3e8a5baad2286e4d42026ac0c570027b89afce6344/aiohttp-3.14.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:617105e2c3018ee38d0c8ce5ee3c84f621a6d8b9f723202aacaff28449ca91ee", size = 511949 },+ { url = "https://files.pythonhosted.org/packages/54/b9/42e74c46b7b7c794b995bbc1f573fb48950c38b19d8600c62a6804ee2d67/aiohttp-3.14.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f631fe87a6f30df5fbe6d79640b25e4cffb38c31c7fb6f10871517b84b0f8c1a", size = 1765282 },+ { url = "https://files.pythonhosted.org/packages/6b/ed/62bc4d74363ad346d518e0720363a949f63e2e23439a79eb5813d4d29bb3/aiohttp-3.14.3-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a94dbaae5ae27bd849c93570669bff91e0510f33a80805738e3de72a7be0447b", size = 1741511 },+ { url = "https://files.pythonhosted.org/packages/d0/9f/181e8a8bc79e47d13c7fc4540bd7a3b729d9505609c61f392a8dd2fbfe55/aiohttp-3.14.3-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8f2f1c4c032c7cedd7d8da6f54c97b70266c6570c3108d3fdffee7188bb70529", size = 1810680 },+ { url = "https://files.pythonhosted.org/packages/5c/9a/dec94d6ad694552fe3424e3f1928d7a606a5d9d9433a04e7ecdd9d38ae7f/aiohttp-3.14.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ea05e1f97ceea523942d9b2a7d7c0359d781d683d6b043f5943a602b14da4787", size = 1905646 },+ { url = "https://files.pythonhosted.org/packages/52/b7/7cd31f29d6055bd711ae6e669367fba6f5ae9de463910a793e30556a8db7/aiohttp-3.14.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:543906c127fb1d929b95076db19b83fa2d46751006ff1e23b093aa5ac4d8db42", size = 1792122 },+ { url = "https://files.pythonhosted.org/packages/66/73/10b1ef93afa61f4963c746257b70ced619cf31a4798671de5fdb2608501d/aiohttp-3.14.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0a5ff2dfbb9ce645fa5b8ef3e02c6c0b9cc3f6030ff863d0c51fffc50cb5541b", size = 1591127 },+ { url = "https://files.pythonhosted.org/packages/49/ed/3b203fa6de1b338c14acdc06bf6ca9b043b7944f005966958c2ced932cde/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:041badb8f84396357c4d3ad26de6afd7a32b112f43d3c63045c0c8278cfd2043", size = 1725210 },+ { url = "https://files.pythonhosted.org/packages/28/b7/1c2aab8c706436dcc28598452488ac9cd7c409da815237c28c27d58993e6/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:530125ee1163c4219af35dc3aa1206e541e7b31b6efc1a3f93b70a136f65d427", size = 1764848 },+ { url = "https://files.pythonhosted.org/packages/54/50/94c28f08b131c4bf10984ea2c7a536c9920608bb2d6e7f95642c30cc87b7/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c8653fd547c93a61aadc612007790f5555cdd18946fa48cf45e26d8ea4ea473d", size = 1777102 },+ { url = "https://files.pythonhosted.org/packages/13/d4/e7d09ba7d345fb2d74440fd2fa033c5e079fac05552927705986f41a364f/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:89176250f686cb9853c0fb7ead90e639e915b84a6f43eedc2a4e7ec21f1037f0", size = 1580205 },+ { url = "https://files.pythonhosted.org/packages/a3/84/072a91d68e1e1eb587985b54baab94221277f877e8ef274fc213a0ceae28/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:3a26434dafe408229ff3403458ca58de24fb51936504decac49ce6755f77e59d", size = 1797219 },+ { url = "https://files.pythonhosted.org/packages/e0/eb/aad34e897e668424d6e995da5dff8a4a09af93363d3392488772957a63aa/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:d1558173930a5a8d3069cee5c92fc91c87c4dbcb099debbb3622053717145a19", size = 1768629 },+ { url = "https://files.pythonhosted.org/packages/b6/2b/6bb88ddba0fecd9122aa3ebcad25996cf6c083a4a7040dbb3a4f97972af6/aiohttp-3.14.3-cp312-cp312-win32.whl", hash = "sha256:16100ad3ab8d649fdfbee87602d9d2dcdca9df0b9eda8a1b5fdc0d41f96da559", size = 451481 },+ { url = "https://files.pythonhosted.org/packages/76/9b/f2f8f108da17ecef2cc3efc424e8b7ad3782b1a8360f7b8eae8ced84f6ea/aiohttp-3.14.3-cp312-cp312-win_amd64.whl", hash = "sha256:33a2d7c28d33797a2e99923dffa63f83d908a19b6bf26cfe80fa790aa5e1a75a", size = 476845 },+ { url = "https://files.pythonhosted.org/packages/3e/44/28dac80a8941b604f4da10ce21097614ca1bf905ce93dca28d8d7de9c1e7/aiohttp-3.14.3-cp312-cp312-win_arm64.whl", hash = "sha256:362a3fd481769cac1a824514bcd86fda51c65e8fe6e051099e008fddde6db17c", size = 448050 },+]++[[package]]+name = "aiosignal"+version = "1.4.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "frozenlist" },+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/61/62/06741b579156360248d1ec624842ad0edf697050bbaf7c3e46394e106ad1/aiosignal-1.4.0.tar.gz", hash = "sha256:f47eecd9468083c2029cc99945502cb7708b082c232f9aca65da147157b251c7", size = 25007 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/fb/76/641ae371508676492379f16e2fa48f4e2c11741bd63c48be4b12a6b09cba/aiosignal-1.4.0-py3-none-any.whl", hash = "sha256:053243f8b92b990551949e63930a839ff0cf0b0ebbe0597b0f3fb19e1a0fe82e", size = 7490 },+]++[[package]]+name = "annotated-doc"+version = "0.0.5"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/5a/8e/38aa427ed5402449e226975b649c5dc73ccadfefeb95e6aecb8f8ea4b6b6/annotated_doc-0.0.5.tar.gz", hash = "sha256:c7e58ce09192557605d8bbd92836d7e1d520ac9580096042c0bfd197efacf1bb", size = 10758 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/3e/30/e900b21425a860e195f32e37657aa1f7c7f2b1bfb26f03ca209b90933c06/annotated_doc-0.0.5-py3-none-any.whl", hash = "sha256:117bac03a25ede5df5440e855b32d556049ca169ead221505badf432fed4b101", size = 5302 },+]++[[package]]+name = "anyio"+version = "4.15.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "idna" },+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/a9/d2/f4d173e22df740bc37b1db102b386ba719b66e95b0f0d751f556b387e6d2/anyio-4.15.1.tar.gz", hash = "sha256:9f28306018cbd6d329e64a36d58256edff76dd996fe423bc957326e578b82a94", size = 276966 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", hash = "sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", size = 132079 },+]++[[package]]+name = "attrs"+version = "26.1.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548 },+]++[[package]]+name = "certifi"+version = "2026.7.22"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983 },+]++[[package]]+name = "click"+version = "8.5.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/c7/0e/7fa0ef50764b67090eca4114772a2abf8b6148198475e54c660b97caeee6/click-8.5.0.tar.gz", hash = "sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34", size = 382235 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/58/50/6c0d534c5f134586a8e1ba4e330569e32f057e33372ae556463212fb4cd3/click-8.5.0-py3-none-any.whl", hash = "sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360", size = 125251 },+]++[[package]]+name = "colorama"+version = "0.4.6"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },+]++[[package]]+name = "filelock"+version = "4.0.2"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/15/c0/dae217a1af7595d36c90e4c4c81cd2e801dd2fe3c1bda2255b7e9386a130/filelock-4.0.2.tar.gz", hash = "sha256:0b7b3b63255dc289a48076c8b77eb63c973fb913185c6dc4651b16820cc1097d", size = 243554 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/06/72/25da2cfd66ce639039966f97c07e5f9fa3f0a10c558c031cff80c27a8f9c/filelock-4.0.2-py3-none-any.whl", hash = "sha256:ac613ea13d8a99f9e9c05cd3d0991bbcbaed81e4b53790350ddf4077996e5d70", size = 108249 },+]++[[package]]+name = "frozenlist"+version = "1.8.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/2d/f5/c831fac6cc817d26fd54c7eaccd04ef7e0288806943f7cc5bbf69f3ac1f0/frozenlist-1.8.0.tar.gz", hash = "sha256:3ede829ed8d842f6cd48fc7081d7a41001a56f1f38603f9d49bf3020d59a31ad", size = 45875 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/69/29/948b9aa87e75820a38650af445d2ef2b6b8a6fab1a23b6bb9e4ef0be2d59/frozenlist-1.8.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:78f7b9e5d6f2fdb88cdde9440dc147259b62b9d3b019924def9f6478be254ac1", size = 87782 },+ { url = "https://files.pythonhosted.org/packages/64/80/4f6e318ee2a7c0750ed724fa33a4bdf1eacdc5a39a7a24e818a773cd91af/frozenlist-1.8.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:229bf37d2e4acdaf808fd3f06e854a4a7a3661e871b10dc1f8f1896a3b05f18b", size = 50594 },+ { url = "https://files.pythonhosted.org/packages/2b/94/5c8a2b50a496b11dd519f4a24cb5496cf125681dd99e94c604ccdea9419a/frozenlist-1.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f833670942247a14eafbb675458b4e61c82e002a148f49e68257b79296e865c4", size = 50448 },+ { url = "https://files.pythonhosted.org/packages/6a/bd/d91c5e39f490a49df14320f4e8c80161cfcce09f1e2cde1edd16a551abb3/frozenlist-1.8.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:494a5952b1c597ba44e0e78113a7266e656b9794eec897b19ead706bd7074383", size = 242411 },+ { url = "https://files.pythonhosted.org/packages/8f/83/f61505a05109ef3293dfb1ff594d13d64a2324ac3482be2cedc2be818256/frozenlist-1.8.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:96f423a119f4777a4a056b66ce11527366a8bb92f54e541ade21f2374433f6d4", size = 243014 },+ { url = "https://files.pythonhosted.org/packages/d8/cb/cb6c7b0f7d4023ddda30cf56b8b17494eb3a79e3fda666bf735f63118b35/frozenlist-1.8.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3462dd9475af2025c31cc61be6652dfa25cbfb56cbbf52f4ccfe029f38decaf8", size = 234909 },+ { url = "https://files.pythonhosted.org/packages/31/c5/cd7a1f3b8b34af009fb17d4123c5a778b44ae2804e3ad6b86204255f9ec5/frozenlist-1.8.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c4c800524c9cd9bac5166cd6f55285957fcfc907db323e193f2afcd4d9abd69b", size = 250049 },+ { url = "https://files.pythonhosted.org/packages/c0/01/2f95d3b416c584a1e7f0e1d6d31998c4a795f7544069ee2e0962a4b60740/frozenlist-1.8.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d6a5df73acd3399d893dafc71663ad22534b5aa4f94e8a2fabfe856c3c1b6a52", size = 256485 },+ { url = "https://files.pythonhosted.org/packages/ce/03/024bf7720b3abaebcff6d0793d73c154237b85bdf67b7ed55e5e9596dc9a/frozenlist-1.8.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:405e8fe955c2280ce66428b3ca55e12b3c4e9c336fb2103a4937e891c69a4a29", size = 237619 },+ { url = "https://files.pythonhosted.org/packages/69/fa/f8abdfe7d76b731f5d8bd217827cf6764d4f1d9763407e42717b4bed50a0/frozenlist-1.8.0-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:908bd3f6439f2fef9e85031b59fd4f1297af54415fb60e4254a95f75b3cab3f3", size = 250320 },+ { url = "https://files.pythonhosted.org/packages/f5/3c/b051329f718b463b22613e269ad72138cc256c540f78a6de89452803a47d/frozenlist-1.8.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:294e487f9ec720bd8ffcebc99d575f7eff3568a08a253d1ee1a0378754b74143", size = 246820 },+ { url = "https://files.pythonhosted.org/packages/0f/ae/58282e8f98e444b3f4dd42448ff36fa38bef29e40d40f330b22e7108f565/frozenlist-1.8.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:74c51543498289c0c43656701be6b077f4b265868fa7f8a8859c197006efb608", size = 250518 },+ { url = "https://files.pythonhosted.org/packages/8f/96/007e5944694d66123183845a106547a15944fbbb7154788cbf7272789536/frozenlist-1.8.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:776f352e8329135506a1d6bf16ac3f87bc25b28e765949282dcc627af36123aa", size = 239096 },+ { url = "https://files.pythonhosted.org/packages/66/bb/852b9d6db2fa40be96f29c0d1205c306288f0684df8fd26ca1951d461a56/frozenlist-1.8.0-cp312-cp312-win32.whl", hash = "sha256:433403ae80709741ce34038da08511d4a77062aa924baf411ef73d1146e74faf", size = 39985 },+ { url = "https://files.pythonhosted.org/packages/b8/af/38e51a553dd66eb064cdf193841f16f077585d4d28394c2fa6235cb41765/frozenlist-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:34187385b08f866104f0c0617404c8eb08165ab1272e884abc89c112e9c00746", size = 44591 },+ { url = "https://files.pythonhosted.org/packages/a7/06/1dc65480ab147339fecc70797e9c2f69d9cea9cf38934ce08df070fdb9cb/frozenlist-1.8.0-cp312-cp312-win_arm64.whl", hash = "sha256:fe3c58d2f5db5fbd18c2987cba06d51b0529f52bc3a6cdc33d3f4eab725104bd", size = 40102 },+ { url = "https://files.pythonhosted.org/packages/9a/9a/e35b4a917281c0b8419d4207f4334c8e8c5dbf4f3f5f9ada73958d937dcc/frozenlist-1.8.0-py3-none-any.whl", hash = "sha256:0c18a16eab41e82c295618a77502e17b195883241c563b00f0aa5106fc4eaa0d", size = 13409 },+]++[[package]]+name = "fsspec"+version = "2026.9.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/77/cd/9be253869fc42e764de7f3dedd6969af7d44ff9c3375214a3442a6f3fc08/fsspec-2026.9.0.tar.gz", hash = "sha256:0f08147951c8cb31d844c3547d631053b127863b60be04cf06e121333ee0e2fe", size = 333545 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/6c/c0/a98505f18594f1bce828bb159cec0fcf9860562f1a2c85913409fc8f3d9e/fsspec-2026.9.0-py3-none-any.whl", hash = "sha256:8dd6e646e99ea382bd85f97a45e6b526a442d79423a7dc673f1e2756d05fcb5f", size = 221738 },+]++[[package]]+name = "h11"+version = "0.16.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515 },+]++[[package]]+name = "hf-xet"+version = "1.6.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/1b/ab/522a2ab67f27971a9d48ca666d4fca85ef7d5282d142e31fd087e27b1bbe/hf_xet-1.6.0.tar.gz", hash = "sha256:2e58454a340b3556dfa4972d5451aff4fba8dd42a236600ba1a1d2b1514f0fef", size = 920527 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/a2/50/7afa2c9c787405864fc47a0d1bbc02c62e9101947ed43c1f43899fc7d91d/hf_xet-1.6.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:633dc0cd71d32da58ab8c03ad38e2fac452c15c2b0a2866ebf6ededfe0a5061d", size = 4071729 },+ { url = "https://files.pythonhosted.org/packages/4b/69/55b8dcf636142ae660fec1869fcac14c4da2e8412e14d6eee1523be77e9f/hf_xet-1.6.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:f0906082d9932ae0c0057fa194041c22b4e2cdb46b2592ef3b91f020d62a081a", size = 3876287 },+ { url = "https://files.pythonhosted.org/packages/67/4e/a28359bf1c1ecf11eba22123168c138698f7cb576ac678f5a2e16cd5da08/hf_xet-1.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d62671bb130879cef0ee4c9ebe47a14af6c66ec53e6d84dc15936e5ffdfac82f", size = 4464663 },+ { url = "https://files.pythonhosted.org/packages/9a/69/1f0cbc2fb22ae6082d094f743d1b8945a3f36f6089cb95f42b7ee348cda7/hf_xet-1.6.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:0e6e21fa3cdfcdcd76748564bf593870a5e013f47d97cf10aed63aa222cff5b7", size = 4262538 },+ { url = "https://files.pythonhosted.org/packages/d1/3a/4f4f2301ade26e404462d3336fa11f7958d914cabbabdd6e03c3c5d5658c/hf_xet-1.6.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:4fc74352a17015bd0ee90038bc9efe38db894cde45f268b6712b04fce8cd0acb", size = 4460520 },+ { url = "https://files.pythonhosted.org/packages/ab/5f/311725e2a905534dfee2dcb5b08414f249147f1f12252bfc2bd24caa075c/hf_xet-1.6.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:8fb4f71cba6129110c3374a33f919001ff130488fc23553698e34cc1c2a1198c", size = 4675937 },+ { url = "https://files.pythonhosted.org/packages/98/b7/8c59a66d15205024662f1d66968136f13893f96df1ddc5087e2e281fc95f/hf_xet-1.6.0-cp38-abi3-win_amd64.whl", hash = "sha256:fb4fadde1b2b70bf4c0c14a6dccbe7194b1c28947fefd5bbe3fed9d940676c3b", size = 4033128 },+ { url = "https://files.pythonhosted.org/packages/73/63/ca511b6f802f28cf3489b280fe77475bcca8de85e81a6299d7916b5b5555/hf_xet-1.6.0-cp38-abi3-win_arm64.whl", hash = "sha256:3dc3e35441ba395006af5aaacc40ef2e603c51ef46c3530b9156185f00935ea3", size = 3859359 },+]++[[package]]+name = "httpcore"+version = "1.0.9"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "certifi" },+ { name = "h11" },+]+sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784 },+]++[[package]]+name = "httpx"+version = "0.28.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "anyio" },+ { name = "certifi" },+ { name = "httpcore" },+ { name = "idna" },+]+sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 },+]++[[package]]+name = "huggingface-hub"+version = "1.32.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "click" },+ { name = "filelock" },+ { name = "fsspec" },+ { name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" },+ { name = "httpx" },+ { name = "packaging" },+ { name = "pyyaml" },+ { name = "tqdm" },+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/fe/0f/e83fdd856da8fca26bf78d71709ebd120432a0ce535e72b9597cab1eb5bf/huggingface_hub-1.32.0.tar.gz", hash = "sha256:ed70a45498abe86039df7c2f4e5f7575de524be908d3840e8f828d5525eafd6a", size = 1038662 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/1b/cf/d98dd561d6d0d7b7d7a64d1563f8aaaa7c235daee41c1c9bcc3da62420ed/huggingface_hub-1.32.0-py3-none-any.whl", hash = "sha256:b0c7c80561969d9cdacdd55fce67ba9584cca0b9d4ea80957a3a5c1445fac5c8", size = 842906 },+]++[[package]]+name = "idna"+version = "3.20"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583 },+]++[[package]]+name = "jinja2"+version = "3.1.6"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "markupsafe" },+]+sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899 },+]++[[package]]+name = "laya"+version = "0.3.11"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "huggingface-hub" },+ { name = "numpy" },+ { name = "safetensors" },+ { name = "torch", version = "2.14.0", source = { registry = "https://pypi.org/simple" }, marker = "sys_platform != 'linux'" },+ { name = "torch", version = "2.14.0+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'linux'" },+ { name = "transformers" },+]+sdist = { url = "https://files.pythonhosted.org/packages/69/04/0abe8a5986500e9385f43d795a62910dab63628390250c73fea5e1e98822/laya-0.3.11.tar.gz", hash = "sha256:f484efeb339a39f68fe44c650947aa90238bfb84d9ec5450b157b51fb2fa0794", size = 238537 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/6d/57/1090909277c07555fd75a8e9c2fcd4d1952372cfbff2a01b081450a63f21/laya-0.3.11-py3-none-any.whl", hash = "sha256:1ee717dd05a742135869383af9b66b20d5c5f62e62d9e57e3fcf84203ea1e443", size = 106531 },+]++[[package]]+name = "markdown-it-py"+version = "4.2.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "mdurl" },+]+sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687 },+]++[[package]]+name = "markupsafe"+version = "3.0.3"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/7e/99/7690b6d4034fffd95959cbe0c02de8deb3098cc577c67bb6a24fe5d7caa7/markupsafe-3.0.3.tar.gz", hash = "sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698", size = 80313 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/5a/72/147da192e38635ada20e0a2e1a51cf8823d2119ce8883f7053879c2199b5/markupsafe-3.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d53197da72cc091b024dd97249dfc7794d6a56530370992a5e1a08983ad9230e", size = 11615 },+ { url = "https://files.pythonhosted.org/packages/9a/81/7e4e08678a1f98521201c3079f77db69fb552acd56067661f8c2f534a718/markupsafe-3.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1872df69a4de6aead3491198eaf13810b565bdbeec3ae2dc8780f14458ec73ce", size = 12020 },+ { url = "https://files.pythonhosted.org/packages/1e/2c/799f4742efc39633a1b54a92eec4082e4f815314869865d876824c257c1e/markupsafe-3.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3a7e8ae81ae39e62a41ec302f972ba6ae23a5c5396c8e60113e9066ef893da0d", size = 24332 },+ { url = "https://files.pythonhosted.org/packages/3c/2e/8d0c2ab90a8c1d9a24f0399058ab8519a3279d1bd4289511d74e909f060e/markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d6dd0be5b5b189d31db7cda48b91d7e0a9795f31430b7f271219ab30f1d3ac9d", size = 22947 },+ { url = "https://files.pythonhosted.org/packages/2c/54/887f3092a85238093a0b2154bd629c89444f395618842e8b0c41783898ea/markupsafe-3.0.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:94c6f0bb423f739146aec64595853541634bde58b2135f27f61c1ffd1cd4d16a", size = 21962 },+ { url = "https://files.pythonhosted.org/packages/c9/2f/336b8c7b6f4a4d95e91119dc8521402461b74a485558d8f238a68312f11c/markupsafe-3.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:be8813b57049a7dc738189df53d69395eba14fb99345e0a5994914a3864c8a4b", size = 23760 },+ { url = "https://files.pythonhosted.org/packages/32/43/67935f2b7e4982ffb50a4d169b724d74b62a3964bc1a9a527f5ac4f1ee2b/markupsafe-3.0.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:83891d0e9fb81a825d9a6d61e3f07550ca70a076484292a70fde82c4b807286f", size = 21529 },+ { url = "https://files.pythonhosted.org/packages/89/e0/4486f11e51bbba8b0c041098859e869e304d1c261e59244baa3d295d47b7/markupsafe-3.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:77f0643abe7495da77fb436f50f8dab76dbc6e5fd25d39589a0f1fe6548bfa2b", size = 23015 },+ { url = "https://files.pythonhosted.org/packages/2f/e1/78ee7a023dac597a5825441ebd17170785a9dab23de95d2c7508ade94e0e/markupsafe-3.0.3-cp312-cp312-win32.whl", hash = "sha256:d88b440e37a16e651bda4c7c2b930eb586fd15ca7406cb39e211fcff3bf3017d", size = 14540 },+ { url = "https://files.pythonhosted.org/packages/aa/5b/bec5aa9bbbb2c946ca2733ef9c4ca91c91b6a24580193e891b5f7dbe8e1e/markupsafe-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:26a5784ded40c9e318cfc2bdb30fe164bdb8665ded9cd64d500a34fb42067b1c", size = 15105 },+ { url = "https://files.pythonhosted.org/packages/e5/f1/216fc1bbfd74011693a4fd837e7026152e89c4bcf3e77b6692fba9923123/markupsafe-3.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:35add3b638a5d900e807944a078b51922212fb3dedb01633a8defc4b01a3c85f", size = 13906 },+]++[[package]]+name = "mdurl"+version = "0.1.2"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 },+]++[[package]]+name = "mpmath"+version = "1.3.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/e0/47/dd32fa426cc72114383ac549964eecb20ecfd886d1e5ccf5340b55b02f57/mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f", size = 508106 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/43/e3/7d92a15f894aa0c9c4b49b8ee9ac9850d6e63b03c9c32c0367a13ae62209/mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c", size = 536198 },+]++[[package]]+name = "msgpack"+version = "1.2.2"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/6d/44/ea2100ec54d30c46ee9dba10a3bfb79b655e96c6df237238a3234c75869b/msgpack-1.2.2.tar.gz", hash = "sha256:9eb0b0e602064527a045ea28c4f174ed69383587e29cebe28947e3b84106eb2a", size = 187025 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/31/78/90c15bebb1a72667349ca62d4507e9d9369e7f8f76b95f490b823d3622e5/msgpack-1.2.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a4348705be86e029d04e741cf9ed0dfe03e942d7d3b92e838fa80d3aa2c3ebc", size = 84275 },+ { url = "https://files.pythonhosted.org/packages/88/88/c2b6d8e81571da87aa232c0e34a3f3a0e618e6235892065ec82d1d81fc7a/msgpack-1.2.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0a652ceeededf71d3fa40c303a02a149d42338d310162367b91c539d4bd6e0a3", size = 83970 },+ { url = "https://files.pythonhosted.org/packages/da/c0/d3ede9f5d16acb4c05a9281859f1e99ef9f877a928eb78454c37f70db001/msgpack-1.2.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:90986cc9aab9d7d1d8f38bcbf65d3f7ac83bdd90c35765db7d691b4829698cba", size = 409401 },+ { url = "https://files.pythonhosted.org/packages/41/f0/29f591bea185616cf417645ac03bd3ad9b317483ad8572160e325f7fe777/msgpack-1.2.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:77c2e018417dc1d66f235e383877ee885b60ade9d29e494dd581e08af2cb1923", size = 420619 },+ { url = "https://files.pythonhosted.org/packages/4e/8e/c70c8c9180c5ddf4440eb8658ebead98e22e7686fbf84f6b165031430750/msgpack-1.2.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0e91332144f69bc3018c91232fac26da580ef748fb8eaddd7914d4458001cc4f", size = 379747 },+ { url = "https://files.pythonhosted.org/packages/50/9a/f10ce11fa62700c9ab87a22e65b9ca272f7f673ddd31aeb2de6ae272ad35/msgpack-1.2.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3e915d390d7068b257ca8b62f3fc59fad135c8631d1017ab03b0b924b07c5367", size = 398944 },+ { url = "https://files.pythonhosted.org/packages/82/fe/d7be978456ff8552e69a8e270d882e7530e01513c096b293d83df03753ea/msgpack-1.2.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:c522420d78db2431887d45b518e304d86e27b9ad0b30f24e3806a6ad5d8bdbfc", size = 373979 },+ { url = "https://files.pythonhosted.org/packages/be/af/91b0d8d3fb3063e259daee3ea8515cea6282f68f4b0e5f0b6fea25762c6e/msgpack-1.2.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:4b554d8164ebb526892194f71dcd96ef1fefe0c250087498785d3ffc04a80be3", size = 417781 },+ { url = "https://files.pythonhosted.org/packages/8e/3c/ce8e9efe1fd9e95c78b3705e4300ba7feba3dc6c00fb76259895db155518/msgpack-1.2.2-cp312-cp312-win32.whl", hash = "sha256:0e3315de5a4b2920ccef48d96b4448025e064a10d0f5a250f6584477d839c8d4", size = 65267 },+ { url = "https://files.pythonhosted.org/packages/85/98/a33b8b4af14e3476bb0da1b8c36ef7a0f28dcf95db1c5e68ff88cb89d591/msgpack-1.2.2-cp312-cp312-win_amd64.whl", hash = "sha256:b68614fba0570349833b7dd999ff0aed4e5cc8d9eb6e3a7d4527be33c65e33d3", size = 72275 },+ { url = "https://files.pythonhosted.org/packages/df/5e/2f323a33a6aba5bd4b2d8b430e4fab21d92cd91c093b49ee287bc166ee54/msgpack-1.2.2-cp312-cp312-win_arm64.whl", hash = "sha256:59d5b93efa45fd09f620d0c9ba81cde339a2c9937af3eea42ee9653094ce6640", size = 65488 },+]++[[package]]+name = "msgpack-numpy"+version = "0.4.8"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "msgpack" },+ { name = "numpy" },+]+sdist = { url = "https://files.pythonhosted.org/packages/08/94/61e8aee142733ebfdc400a05bdac6e1763c4514bba3b42743d223f388450/msgpack-numpy-0.4.8.tar.gz", hash = "sha256:c667d3180513422f9c7545be5eec5d296dcbb357e06f72ed39cc683797556e69", size = 10923 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/9b/5d/f25ac7d4fb77cbd53ddc6d05d833c6bf52b12770a44fa9a447eed470ca9a/msgpack_numpy-0.4.8-py2.py3-none-any.whl", hash = "sha256:773c19d4dfbae1b3c7b791083e2caf66983bb19b40901646f61d8731554ae3da", size = 6919 },+]++[[package]]+name = "multidict"+version = "6.9.1"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/d6/99/1d4d69c3512d0ddbfa3a1b69cfd9a151012ab2eb4eabbb096201b1f0b7d8/multidict-6.9.1.tar.gz", hash = "sha256:0f06e60fa190aa7abd0914c2a766736fdc8e9f34878c4346338534b73d1b20e2", size = 182404 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d9/0d/4b5afb6d3e545c9af0cdfe2db8f6f4c6664568c23d863d888674e447e6a4/multidict-6.9.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:29138fef49828542e859828107e42e50d0e587c513b7eb4b2d92bade2b0860fe", size = 98360 },+ { url = "https://files.pythonhosted.org/packages/89/ab/1b9ca66251899981b21138b87da9d5a9c2c81af12b1ea7d19466972f7fe2/multidict-6.9.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:19e31815d41cefc365489e591d105d2baceb2f65aa75d29471fbdbda8651e006", size = 59979 },+ { url = "https://files.pythonhosted.org/packages/36/eb/6ae44062466c26c8469ef43f2481a6a48d8cea0587b2d54514ec92e2adfd/multidict-6.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6ed30be8918e18c8bed0a2e8b70639ecf02feb61ed00ca2e41cfcb2a50fa3f42", size = 57736 },+ { url = "https://files.pythonhosted.org/packages/b9/5c/a67817593019257a4ac8b0d1b4c426030e637c047b0692ef405439ecea7a/multidict-6.9.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:637f4ae36264bd7b8d9a60193acddc1d735ad52e8ed53a19931ea6d921fea8e5", size = 333097 },+ { url = "https://files.pythonhosted.org/packages/90/bf/599ae2e6222822d88a247a8a7ae82fe6fd25d5700757b79603d5edafe6a0/multidict-6.9.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:35fc236507fb1b3138f0af5ecd5f94ed752d4d6d826248eae425f86204013eea", size = 334196 },+ { url = "https://files.pythonhosted.org/packages/15/10/d8aac5acacbe7f5c117866c776ec26d5f15a868759b6f37ad8e7ed3b5b02/multidict-6.9.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e58952f04772f59f11c6e007471449809a30165188669bca8fdb19dde40a8f24", size = 317465 },+ { url = "https://files.pythonhosted.org/packages/19/0a/714f796f7293a8b1c5c3f465a26996231d5450c54e85d64ef1258c091134/multidict-6.9.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d35a4f1c63f07fbb8c8f9946dea98b21eddf6c57421585f71d91864be3ba2a24", size = 345914 },+ { url = "https://files.pythonhosted.org/packages/da/b1/e37fbf769c567be277bcf32df6234035a4384677fcc1bd852752be3d6b93/multidict-6.9.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b5f8771aaaed7f80e84a4e471d2f29ab6721e4595075e54d03ae1ed951b2000a", size = 351163 },+ { url = "https://files.pythonhosted.org/packages/ed/5b/db08419c1e1f7c9d60cfd2787b2b517d7ae4ebbda8281b48a33eb5141467/multidict-6.9.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:976fd7689d69ec78d67d31d38d396d8adb562f7e8368279f76aed4aa451fa06d", size = 336881 },+ { url = "https://files.pythonhosted.org/packages/9b/07/cc9bc8a62651d2d53ab93ee4993b3a71b7cb78eb8ebfc9c757a5b6698617/multidict-6.9.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:95052e8777a86bae87c0bd0b5ab22d809e3d1d02bf69e3e66ddda5ba75a05805", size = 303405 },+ { url = "https://files.pythonhosted.org/packages/b6/0c/8e912afafa70e944dbb8bec4b66ca6e008511395278c0d3dd0e89567536a/multidict-6.9.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1a8adfcaf96f587ab138476eaddef95f29b8a2a8a9afbfea8d2fd62180995d02", size = 324265 },+ { url = "https://files.pythonhosted.org/packages/66/6a/62c2af80fb085e6234805017af857b8e913dfac7a55e9c1349c27768c58a/multidict-6.9.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:1a53de2772cfb74559df2eb4456ec4eeb908435ec55a84b69370d9d745d62aa8", size = 322085 },+ { url = "https://files.pythonhosted.org/packages/f8/6b/35bf801b336fd960811207203ffdcdc24acc3558b3e7ff2e1c914b141e70/multidict-6.9.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f2ce963299d42fa3f22a90adc0fdf174792ffef5ff4c7ffb68260548fb05580", size = 338107 },+ { url = "https://files.pythonhosted.org/packages/80/41/495ef65bf5bba29d142d81b3fe1b8154b919bed70e96491b1e93c3c26f0f/multidict-6.9.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:5b30ddf7234e611ca877575b62840e6af5977f92f1f9d532eedbb05a44ff8004", size = 339631 },+ { url = "https://files.pythonhosted.org/packages/19/bd/057fdff5f4e04dcd40a960e38f77d19d3c4b67dd243ffa5f43718edb29fc/multidict-6.9.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:63ada7ee2e9345695f9e9bc4c65d72222253f07b1ac94fd0e37555cc6f3c7f60", size = 302080 },+ { url = "https://files.pythonhosted.org/packages/3f/de/9ace933ee8dad808632523726f42255b09600087219e3d4ead7369820910/multidict-6.9.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:3c95601ed98fad3f6e2f8fe809c3b526b0fab31ef525e00a155e227f3d17f58a", size = 341107 },+ { url = "https://files.pythonhosted.org/packages/d8/ac/7c1204406097bfc5c283d4a3287d61166807d189917567df4c1318484fc4/multidict-6.9.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c148e8b596000dd3e4bfe206e70f3e666be18d72032e0012555f2373c52e35d6", size = 333482 },+ { url = "https://files.pythonhosted.org/packages/ff/c0/a70c32ea3299ebe00f44533740cb46905717c51faf29bbd3ce8bb5886d9d/multidict-6.9.1-cp312-cp312-win32.whl", hash = "sha256:f9dad513626a33670f17cddc6078e30e311f444c957e8dbfc5b2b4603c8b4edb", size = 52548 },+ { url = "https://files.pythonhosted.org/packages/d7/2e/8c9c2591df01e5692ad1bf92febb082a17b1c6c3a19aa8b7ff49988fd989/multidict-6.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:a16a1dc8529f9e734a41c3b856f3eae7ebacdc061dde3f8a844e0c7889c97203", size = 59622 },+ { url = "https://files.pythonhosted.org/packages/d0/95/59f4472ec512bc180fd207899594c7803ece96262ff9aaa3a4b6d7da6940/multidict-6.9.1-cp312-cp312-win_arm64.whl", hash = "sha256:361f7206cf341ba94fb015688f5c8b480f8e63bd58a4c14a48aeca7851a241cc", size = 54930 },+ { url = "https://files.pythonhosted.org/packages/be/59/e26cb779be4c591d1a910f59d29aca9fba4de70349840a833beba2652371/multidict-6.9.1-py3-none-any.whl", hash = "sha256:7bf6478188f4e47bf5686e8a33da4ae28bf43b1b2528d9ee144d28492bfac60b", size = 19176 },+]++[[package]]+name = "networkx"+version = "3.7"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/dc/76/3af777226b63a5e64a6b36b1ec5855c14e2b94a37096d4760e595fc43511/networkx-3.7.tar.gz", hash = "sha256:fd77a511bd90f39f3d016351345b52cf5319b813bdca01de3f755d3cca62e96a", size = 1866482 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/7e/cd/fe58041e9011f307c490e3e17dd48cc516448f7c698a3f2d9d9d65d7e6a8/networkx-3.7-py3-none-any.whl", hash = "sha256:e3fd2c13a7814cee3746340d8d7f8598a67f16a58bf47fb7f8793fab6efca1b0", size = 2142205 },+]++[[package]]+name = "numpy"+version = "2.5.3"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/13/01/11703282db468b85f6f7b8c7f22d058de5970d5c7e60a3a8aaa313c3de36/numpy-2.5.3.tar.gz", hash = "sha256:df2d5874ff183595a4ba404edd04f6bd9b5505c1d7708573f6a6c17489a67563", size = 20791231 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d6/50/8fdbb16af64895706a45f06a4068e29db732ec180f3c1375f14123359138/numpy-2.5.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:cb189f09db39283b26bfd061ec16189e14f71c6755207f72a0f7540867afe5b9", size = 16994982 },+ { url = "https://files.pythonhosted.org/packages/60/39/789131c1188c078dcb3a1692e72e1e050c68b88ffe72c9ccaac9bcd7a9cd/numpy-2.5.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f59a878c33d6b88122d80d239bb3b845d58708750b0cb06a09aebb9b18ec696c", size = 12009327 },+ { url = "https://files.pythonhosted.org/packages/9c/59/a312e95696e5f601914dd8b6dd844692ba61670807417e24b68e337b5c70/numpy-2.5.3-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:a72f874bc9e10e4b8f80426fb49716d5141f64442a0c8418065093ec8017fbb0", size = 5445405 },+ { url = "https://files.pythonhosted.org/packages/30/d0/5623a1707ed4fe16e3909fe3cf5ee3da004ae677ad23d83bbf3adf1a6faf/numpy-2.5.3-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:fc36dc566135b5eceec4cf89758fcb719266a019ef07dae1754ae7c9f617ef3e", size = 6783213 },+ { url = "https://files.pythonhosted.org/packages/f1/32/84146fc020ad3c25f805f70ab60da46fe3c540a21369754a7e4369754b6f/numpy-2.5.3-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:76c2c1e6bfa5c84adc6434dfbf013aa92096a7985221762c8f11fedfd20fff58", size = 15687872 },+ { url = "https://files.pythonhosted.org/packages/65/af/aa78d1a88805456e212b65461354cd943197fb9acecc4c90fd12295123a3/numpy-2.5.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b7e18c623bb5c95acb3b3328861272816ba199fb531921c5d6d0b675f1fde9e3", size = 16717410 },+ { url = "https://files.pythonhosted.org/packages/3b/24/faa79d865e69a97ba17473b23a1b74094b2259c03e820c70297293b9ea49/numpy-2.5.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4f8929ee6c96bfbd7b4ed2032e0c03af86fe1826740ab61ddabf9072d06e57ff", size = 17040975 },+ { url = "https://files.pythonhosted.org/packages/62/4a/8877e629445a7176297dffcaf9c485faa96a95d81728a62521ad55bd4c0f/numpy-2.5.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b5d93cf48f687479941d12b69c873ad2cc76bbd487f0091c2200636497f34034", size = 18476479 },+ { url = "https://files.pythonhosted.org/packages/c8/db/35e1c2d38b04cbd5b731f9d71495e055e813197669d22b612f11748d2ff9/numpy-2.5.3-cp312-cp312-win32.whl", hash = "sha256:bf63afbe037eb5d2fe87fbcc7778e61da53ebaf21d938a4515aa73b62532a5d4", size = 6133378 },+ { url = "https://files.pythonhosted.org/packages/3c/a1/accf6d4f0c80c5d9ba9735d6b1550e444180599f34dec69ca01360f717ad/numpy-2.5.3-cp312-cp312-win_amd64.whl", hash = "sha256:0a59a421a32580a009e8a1751345bf829631b990dc1794b80514ab722b435def", size = 12567828 },+ { url = "https://files.pythonhosted.org/packages/22/43/1764aff32e4652526ae2f71fa8b3efd8d25c8a3d6926914454e47138ed1e/numpy-2.5.3-cp312-cp312-win_arm64.whl", hash = "sha256:ccb32e0525d29e8b0572eb84c9a57af0e7a4e615726927506f55063c62414034", size = 10485432 },+]++[[package]]+name = "packaging"+version = "26.3"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956 },+]++[[package]]+name = "pillow"+version = "12.3.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/1c/3d/bb7fca845737cf9d7dbde16ed1843984665ff2e0a518f5db43e77ec540b9/pillow-12.3.0.tar.gz", hash = "sha256:3b8182a766685eaa002637e28b4ec8d6b18819a0c71f579bf0dbaa5830297cce", size = 47025035 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/37/bf/fb3ebff8ddcb76aac5a01389251bbbb9519922a9b520d8247c1ca864a25d/pillow-12.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ba09209fbe443b4acccebe845d8a138b89a8f4fbaeedd44953490b5315d5e965", size = 5345969 },+ { url = "https://files.pythonhosted.org/packages/d8/66/9a386a92561f402389a4fc70c18838bf6d35eb5eb5c6850b4b2dc64f5048/pillow-12.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ffd0c5368496f41b0944be820fcb7a838aa6e623d250b01acf2643939c3f99d7", size = 4780323 },+ { url = "https://files.pythonhosted.org/packages/25/27/ac8f99618ffd3dde21db0f4d4b1d2ab00c0880595bfd17df103f7f39fd0c/pillow-12.3.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d9c7f76c0673154f044e9d78c8655fb4213f6ca31a836df48b40fe5d187717b9", size = 6266838 },+ { url = "https://files.pythonhosted.org/packages/84/21/a35af28dcc61f37ed850a2d64c65c701321dfbf25085e469d5559360cbbf/pillow-12.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:78cb2c6865a35ab8ff8b75fd122f6033b92a62c82801110e48ddd6c936a45d91", size = 6940830 },+ { url = "https://files.pythonhosted.org/packages/eb/51/8b08617af3ad95e33ce6d7dd2c99ed6c8298f7fb131636303956be022e25/pillow-12.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e491916b378fba47242221bb9ead245211b70d504f495d105d17b14a24b4907c", size = 6344383 },+ { url = "https://files.pythonhosted.org/packages/1d/72/cf78ac9780bb93c28328f408973845a309d4d145041665f734572ced1b52/pillow-12.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0dd2064cbc55aaec028ef5fbb60fa47bb6c3e7918e07ff17935284b227a9d2df", size = 7052934 },+ { url = "https://files.pythonhosted.org/packages/20/20/25e0f4dc178a6bc0696793720055519a0de89e7661dae886992decbd2f81/pillow-12.3.0-cp312-cp312-win32.whl", hash = "sha256:dbce0b29841537a2fa4a214c2bbf14de3587c9680caa9b4e217568472490b28f", size = 6472684 },+ { url = "https://files.pythonhosted.org/packages/45/89/da2f7971a317f83d807fdd4065c0af40208e59e692cc43d315a71a0e96d1/pillow-12.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:a2b55dd6b2a4c4b7d87ffa56bdb33fdc5fdb9a462173861a7bc097f17d91cb09", size = 7227137 },+ { url = "https://files.pythonhosted.org/packages/de/47/4845a0a6c0dbf1db8456bd9fc791f13c5ced7ced20606d08a0aacfd25b49/pillow-12.3.0-cp312-cp312-win_arm64.whl", hash = "sha256:331b624368d4f1d069149002f25f44bc61c8919ce8ddb3c45bdad8f6e2d89510", size = 2568267 },+]++[[package]]+name = "propcache"+version = "0.5.4"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/b3/9a/9fbf4e4ec0c2d7f1c32519fff782ef467859b8faa9fbc5331a96f6395d43/propcache-0.5.4.tar.gz", hash = "sha256:ff6b113f50bc066a698db5d944d2c6dc7507168dd3341e255a8892fd0715a558", size = 61545 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/71/cd/348d58f142aebc4873345c6b31087629182ca6e0f2b3caeaa528cf882eba/propcache-0.5.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:b28f41fa3b8c6900457f858ec5b03998f3a6d535fbc1bb2edec5961ea05ec429", size = 87285 },+ { url = "https://files.pythonhosted.org/packages/df/f4/f3ffaee281b276da854ac1d7a6a506d26cbc62ea2e623756f1d0a4a1ba1a/propcache-0.5.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:dcbf346a318a5e30063f547630b02bb787ce2f45b6368d5da143660b6a3835d8", size = 50984 },+ { url = "https://files.pythonhosted.org/packages/25/88/1d7df7201750b37765ef2b23bc1c526c028dadde80afa0f57a118fc01182/propcache-0.5.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:87a3caecf8095e48dc72f84bfa42e23a848cf410cc9cc13031fba4869b706a21", size = 52460 },+ { url = "https://files.pythonhosted.org/packages/83/4f/48865bd02a16ee5236bc46166b2946f37b93e07b0eae355dac0be0b216ca/propcache-0.5.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:60a64cbccaa11b7760ce705a14ada17ba459e7ca9f23ba587eb013821032d7ef", size = 251768 },+ { url = "https://files.pythonhosted.org/packages/b0/19/3742a5eed62317b03b4002ee865dc9fd720308bdd0da1f29a5786c630311/propcache-0.5.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a74bfa37147cc08fb29df10bd9c16f40fa7f860cd3a6d2fff853323a94f6e17f", size = 257723 },+ { url = "https://files.pythonhosted.org/packages/cb/d5/ee6350fb0be9122bb6c67082a876d34b90d980d100c106af4b81023e04f4/propcache-0.5.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a4d7a54719b67338a305dca2ce6aafe366817df94ddfd4b5514374356f5ca546", size = 265597 },+ { url = "https://files.pythonhosted.org/packages/85/9f/83a07b6ec0e043c050cfdd35fb0cf1b7897b91d554d6eea293740309afe7/propcache-0.5.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2814ecd8e818f487bee4b0f921bc4d1c176cc5fc71ac0f072d0fa67eda4ac14b", size = 250424 },+ { url = "https://files.pythonhosted.org/packages/33/2c/a763a8251f50fba042af0fb1f02bfec4b31381e40aff760db2be7b2e1f84/propcache-0.5.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6af4693716bfb03f1752ef1b30faa593db2c01d5272e9b8564a1549452a979ab", size = 216748 },+ { url = "https://files.pythonhosted.org/packages/6a/e2/4d11bea8fd6a777149c6c20645f873952eab5de3a2497aa11648ec9ab6ab/propcache-0.5.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4fbc1a15dc8cd1689508758d626b372b1f09d28d9577667feaf9e6bfcd8efcbc", size = 246533 },+ { url = "https://files.pythonhosted.org/packages/9f/36/6683597de4907e70c717e3588c541202c66086a72ff3db58be49de66e72c/propcache-0.5.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:cdee8205a44d0be91bbac4c41b95d86641b72dfc7aef1279400e4fda3f26a937", size = 238173 },+ { url = "https://files.pythonhosted.org/packages/85/84/cb08d79f1762daafeb2b030c470cd0c725c97b8ad67412457c6f35c53e9d/propcache-0.5.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:9a2a8a50a93dee0268a860a07fa3b4bd968f8ce4dbd794957da772f395368526", size = 251128 },+ { url = "https://files.pythonhosted.org/packages/c2/0d/41b848036db6621370c1f2e5471a7da8149c730f8552a5257567721f4576/propcache-0.5.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:7ffafcbfc7b549ab940047e505c831eabac5e67de53e1bc174adbc5285c55944", size = 214821 },+ { url = "https://files.pythonhosted.org/packages/f1/b7/adfae4bf9c63bccf12e2d9690a175c6579047a6eec3b5a6a5f51428c15e2/propcache-0.5.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:d1f5a500bfcbb2c0ab85e98a0dcd70f5899d34efe365a0187700369a79603031", size = 254793 },+ { url = "https://files.pythonhosted.org/packages/51/6f/eeca9647245d5f92e87d53e5f14335bb42fce1a7e6842c8045b364eded8b/propcache-0.5.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8a235f73d6e020855dc29dff012d920c02ee0feab8d73a24185a7569f4be1161", size = 247134 },+ { url = "https://files.pythonhosted.org/packages/5d/a9/424e38838793d37160b4379c702f61c74c598fc6cd17204adbe3c554f7a8/propcache-0.5.4-cp312-cp312-win32.whl", hash = "sha256:b3083bfe87f95c756e610bd8025f26cbd1cd4aaa03a422f2d65efb7a97cd53d8", size = 43073 },+ { url = "https://files.pythonhosted.org/packages/58/7b/6e8ef26f6d510a7916064fec68d55fcbfbdf7eb01e377480d66a122152d8/propcache-0.5.4-cp312-cp312-win_amd64.whl", hash = "sha256:98914de2c4d7f0f9f4a8c6ea4bf05841f4175796941e3ef7d47eb718f22311fb", size = 46190 },+ { url = "https://files.pythonhosted.org/packages/08/b9/72028c5b56ced97f456de6aefa79435ca64d7f77af78ea8cf3c76fc5195f/propcache-0.5.4-cp312-cp312-win_arm64.whl", hash = "sha256:8876b39961e33d912afe3c1bee18ee564fdad0206f873cc15d522756b7f50737", size = 43075 },+ { url = "https://files.pythonhosted.org/packages/f5/cd/785c64ed382f3f04201870267b02783f63b4678c2acfddc177a3ebcc2727/propcache-0.5.4-py3-none-any.whl", hash = "sha256:62c60aec739ed00124573cce1178138fd690c7676352d67a37328c1cf51d7468", size = 16338 },+]++[[package]]+name = "pyarrow"+version = "25.0.1"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/3d/e3/27f57f80141379d60defe6703eb50a707325706f07fedfd1312c7a751995/pyarrow-25.0.1.tar.gz", hash = "sha256:9150a83248bfed9813ea3c3af74c3856c1984d444aa28e58bf7733b9750ddf6a", size = 1201653 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/a6/e2/9ab15b88cbfac28e16419ce5439ec29234c5172cb8259301b4ba639bdec0/pyarrow-25.0.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:df961f2e7ae9cf496459259d798652c70625f6c080650d6952f8c04053c58ee9", size = 35861559 },+ { url = "https://files.pythonhosted.org/packages/58/79/a0036dbe1eabe1f73127427342f1d99982584c4a2cde2651d6c93499c6f6/pyarrow-25.0.1-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:cc4aa407fde9fc660be3939e49ea31f50f3e9fec17c0ec63159f7711edd3efc9", size = 37628383 },+ { url = "https://files.pythonhosted.org/packages/13/49/d93a57d375f4bf0cf82913dd6bb54acafde83dd993be2282c81ac5616cad/pyarrow-25.0.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:4340f0ba6c1d2e13f21658de1d7c662ca2545018568d0030a1e9afca159d87e3", size = 46820190 },+ { url = "https://files.pythonhosted.org/packages/60/c9/711ca85d79f1ec98f29a5eae2b051e25b4ecec5de3e3c0e2d5c5dcb15664/pyarrow-25.0.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:5389cdf79447ed1515c9e31620e6e1e2302249564d603f2ad727d4f6d313e4c3", size = 50102437 },+ { url = "https://files.pythonhosted.org/packages/80/53/8fb8359ff17cfb6263a1cf3ebf7caec9fe197de118719e84fcb1d0618026/pyarrow-25.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d51592cb7561e87877c506113e7adbf1342ab579e6c21f0ef44b8ba41cb74c80", size = 49942424 },+ { url = "https://files.pythonhosted.org/packages/e8/83/4e5ae02a9341571b18a6fca380ac7a58ce6ddae7ab3c060208c0a1e79f02/pyarrow-25.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:6109c94d8b9f3b17a041daca16cacb2f651ad8f1ef70a4232c2c0f37a23da2a8", size = 53144206 },+ { url = "https://files.pythonhosted.org/packages/65/ee/197cbf47e49f83e6ebeb946a5259a48a638dea27ac774db42fe78022179d/pyarrow-25.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:8858d7bfc22e3f51529aeaa4077225029724623e4595dc9eff8c793935c34140", size = 27953934 },+]++[[package]]+name = "pygments"+version = "2.21.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147 },+]++[[package]]+name = "pyyaml"+version = "6.0.3"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", size = 130960 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d1/33/422b98d2195232ca1826284a76852ad5a86fe23e31b009c9886b2d0fb8b2/pyyaml-6.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196", size = 182063 },+ { url = "https://files.pythonhosted.org/packages/89/a0/6cf41a19a1f2f3feab0e9c0b74134aa2ce6849093d5517a0c550fe37a648/pyyaml-6.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0", size = 173973 },+ { url = "https://files.pythonhosted.org/packages/ed/23/7a778b6bd0b9a8039df8b1b1d80e2e2ad78aa04171592c8a5c43a56a6af4/pyyaml-6.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28", size = 775116 },+ { url = "https://files.pythonhosted.org/packages/65/30/d7353c338e12baef4ecc1b09e877c1970bd3382789c159b4f89d6a70dc09/pyyaml-6.0.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c", size = 844011 },+ { url = "https://files.pythonhosted.org/packages/8b/9d/b3589d3877982d4f2329302ef98a8026e7f4443c765c46cfecc8858c6b4b/pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc", size = 807870 },+ { url = "https://files.pythonhosted.org/packages/05/c0/b3be26a015601b822b97d9149ff8cb5ead58c66f981e04fedf4e762f4bd4/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e", size = 761089 },+ { url = "https://files.pythonhosted.org/packages/be/8e/98435a21d1d4b46590d5459a22d88128103f8da4c2d4cb8f14f2a96504e1/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea", size = 790181 },+ { url = "https://files.pythonhosted.org/packages/74/93/7baea19427dcfbe1e5a372d81473250b379f04b1bd3c4c5ff825e2327202/pyyaml-6.0.3-cp312-cp312-win32.whl", hash = "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5", size = 137658 },+ { url = "https://files.pythonhosted.org/packages/86/bf/899e81e4cce32febab4fb42bb97dcdf66bc135272882d1987881a4b519e9/pyyaml-6.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b", size = 154003 },+ { url = "https://files.pythonhosted.org/packages/1a/08/67bd04656199bbb51dbed1439b7f27601dfb576fb864099c7ef0c3e55531/pyyaml-6.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd", size = 140344 },+]++[[package]]+name = "regex"+version = "2026.9.10"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/b9/5c/f403115361de25809e8f785686ec7096e30fef73be9ae35aa51da4e80abb/regex-2026.9.10.tar.gz", hash = "sha256:1e321e2c84f0e52c457f5ea5944f796d6e8e09cb99738ea98dcc1bfe402a128d", size = 417072 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/32/c8/bfbe893e90ee0148bd2860dd086f09b5d2080ca2b125f740c2e118c16982/regex-2026.9.10-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:880ac684c27176464c00c3fdc456116364f5ebc70da07aad0c2d4a7ba45e98db", size = 496609 },+ { url = "https://files.pythonhosted.org/packages/8c/ac/56d5ae6efb759255c3b3db650a4be25f96a844ea3613b91e1e189a3b7294/regex-2026.9.10-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b9d36b03dc362aa40ffaaec9d9bd75e87763529563ec008c43b0e07782f5be7a", size = 297024 },+ { url = "https://files.pythonhosted.org/packages/60/4b/0f2d5f6bbb791cc10f22f0ed16c487e630dde8fa8fa0bd92a2bfe21a4b20/regex-2026.9.10-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:866de9f98df0611d7b62b3a8729d3284a64c0cc6edd90bb95a533e443a4939cb", size = 291905 },+ { url = "https://files.pythonhosted.org/packages/89/51/3fb5fe0d32f4cf0bc982286722c729a8d6f522d2fa2d5d14a702d9fc87f8/regex-2026.9.10-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4c66d54042a14a503907d81861b8a5235e6d1f03d4fbc1d8767f652eaf957ac1", size = 800055 },+ { url = "https://files.pythonhosted.org/packages/89/46/ee507bd2f9d4420f26a594b35c551d7194b66f5d7897f63730fae6ec05c1/regex-2026.9.10-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:032da15431c890d376f53547f0a6219f4f4cd19f3e4f11bdc321453b5bd207e4", size = 871133 },+ { url = "https://files.pythonhosted.org/packages/d1/75/cbaa90689684f91b1bc017e7f8c6d9425c6bd299108db02482dc51376d8a/regex-2026.9.10-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:23ac9a28180f274d7dd7651fa131ad5b02d343b75df4b040737f0356223895dd", size = 919627 },+ { url = "https://files.pythonhosted.org/packages/cb/f5/dcdf5e0d898024005cfcce631e3e934d111dfbe177ca0b7f253ae8a735a2/regex-2026.9.10-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2e67f8843f0e4b931f1fa860bf3bbe4134b714c0155cc5c7c0d7ea450230aae0", size = 804587 },+ { url = "https://files.pythonhosted.org/packages/73/70/eedfe81c29bae266a06ab4250978361a9bccd474704d88d4f4ef4506dff8/regex-2026.9.10-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bb7774924f8cd69f49cba0b3c2d679a6326f777e0e67d130ad5203e4df53f0d3", size = 777320 },+ { url = "https://files.pythonhosted.org/packages/ca/e5/86b207077efbcd91305700488f170b7eb1e1c54721cea74175273aa3b9a4/regex-2026.9.10-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0c32480f3371b75068decaf9e5da72c224e953830dd71e36e06cf80e30ea39d8", size = 790572 },+ { url = "https://files.pythonhosted.org/packages/b2/92/f622c3b2323f4c035b98e80221740a442127ad7993135b814f52057430db/regex-2026.9.10-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:d2d377fd1cad611b806cdd732d86b65f536c768209890cb442556548daa65a23", size = 865485 },+ { url = "https://files.pythonhosted.org/packages/4a/be/34bd621d3d6ac906ad67e57ed56c40cd45f7d51b9c0328335e97a7cb8ecb/regex-2026.9.10-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:c014641157e9049b0603b8daa5343bd408d9b757b709aaa0f373cd3fab2d7944", size = 767925 },+ { url = "https://files.pythonhosted.org/packages/0d/28/ddbf7cba86f2adf5038c6c16aa829636ffc6e437f81bb0cbf302899cea5e/regex-2026.9.10-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:1562aabd9d4eb09bd88a62ad97ed06800094b529ac43419e43020b9cefec79b0", size = 858800 },+ { url = "https://files.pythonhosted.org/packages/d0/f1/e8d7656ff3d3bd32e881d32f540b4981c79dee61908d6b790a45966e6895/regex-2026.9.10-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2479171edccced52ef02b899558f88ab2c235fe05b93180fdcae1670aacd89e1", size = 791648 },+ { url = "https://files.pythonhosted.org/packages/fc/65/eac1a79115c8475d8ff539602eb54031564d719fdea5a599c4b0a1a26d1b/regex-2026.9.10-cp312-cp312-win32.whl", hash = "sha256:239620b0e0681669367c0e218c8eb2551d9f8fe3b9fccfc8d0003377804e8348", size = 267326 },+ { url = "https://files.pythonhosted.org/packages/ad/d4/4dcd0a05d3e97ca829165df1c39717f899d1d484dac8a6032439f2cb8d6d/regex-2026.9.10-cp312-cp312-win_amd64.whl", hash = "sha256:4db7d00c4afbfbb55b8e17b1e371da11418ea9389b030acec63c1fa4c7ad4b86", size = 277933 },+ { url = "https://files.pythonhosted.org/packages/55/f8/22617a80dee28f2451011eae36bc26b3d78c4994ba87b5281d60acf9b6c0/regex-2026.9.10-cp312-cp312-win_arm64.whl", hash = "sha256:c25a754bb81a2edcfc3b65eda50f017d736f818112ed43e8aafd595cb00678ae", size = 277447 },+]++[[package]]+name = "rich"+version = "15.0.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "markdown-it-py" },+ { name = "pygments" },+]+sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654 },+]++[[package]]+name = "ruff"+version = "0.16.8"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/ba/78/449cb84790bd5cc3823b2652ee405a4558856e5c4195aee3a16bf7b3eb5d/ruff-0.16.8.tar.gz", hash = "sha256:9247bf92b5f04d825c8639a4fe423ec2e4222acd9222e58412b0dab7e442798b", size = 4938814 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/ac/25/6071aabc530e9be7e2c195e8fe3f7aea2735405b6cf447212832d7811831/ruff-0.16.8-py3-none-linux_armv6l.whl", hash = "sha256:6ffbd6d87383c1edf5f6fa890f10200950240d7c1a16052a19a09d3a2307dd38", size = 10048966 },+ { url = "https://files.pythonhosted.org/packages/54/98/07f90ecbc74dd5fb5764f11f2bc774d6a7cffef92d2ff5f5b4e9e23c754e/ruff-0.16.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:42ed6b878ed61e3acca92f2730a17acff39286944ea82398544696366a6f925e", size = 10165498 },+ { url = "https://files.pythonhosted.org/packages/fe/1f/e6a712e3b47cad4a40600134105ed193cb773f618a42eb7ba323cb812cc0/ruff-0.16.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7ea781c7f2afba8c6a505ea0fb3f994020249e0c450635f5381286fea6b46170", size = 9830004 },+ { url = "https://files.pythonhosted.org/packages/23/f2/311a08776d75d81c7676e20b6b020ae63cbe881fcdc7a8dd64e6e18bdd93/ruff-0.16.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8efeae3bbe414a5efefda11a792dfb51ef90ac48d50c4830de2f644caf3e8659", size = 9986558 },+ { url = "https://files.pythonhosted.org/packages/f3/ed/37b6cb3d3ba8c73e68ae3eb1d502383beb5aa05a582bb7bb3a922f929f54/ruff-0.16.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a79b795469fef7fc6e908b218eed2eb17332afd85031db6480dc864560e69b2", size = 9877332 },+ { url = "https://files.pythonhosted.org/packages/22/cc/40873a8f36ad084cc540d55fcca7077264d5b13b24659e9180c176fb2b08/ruff-0.16.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3fdc5563cdc50555e6fba39322850860e9267c1b3d12c26a74729d8604c3c812", size = 10507125 },+ { url = "https://files.pythonhosted.org/packages/c3/e4/fc91a642b78ccbab6b9477720f3644ae7a10a9bcce69a934679cd64f62bc/ruff-0.16.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:34508983c70665578dab88f5223d8e6228307e1135398ca8bfc8b7e9501e282b", size = 11336694 },+ { url = "https://files.pythonhosted.org/packages/c2/3d/bbd2a9a600a4e73dc3e7548a249c8d1671273464b55822c6fae50f602dff/ruff-0.16.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:644bb578569e0ffc575741232bd385dacdd6fbe123f1a729e7a225f54aa3957f", size = 10774448 },+ { url = "https://files.pythonhosted.org/packages/1a/41/d83af9879a7b6e8bf5fe16b1da0b134049d2f5d3afac12defb0897cb84bd/ruff-0.16.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15e7d226246961db9235098333caa13063906d3851136b84c2900b82f5daa1df", size = 10323796 },+ { url = "https://files.pythonhosted.org/packages/f5/2c/cefd07bfe914b84943ea769ade8d607bd22750b965d3228eefd7cebd15d0/ruff-0.16.8-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:a2bf6bc3e9ebdd4449abc6f06cf64b98051a2c61cf94d2fe9596518c881f1a1e", size = 10514115 },+ { url = "https://files.pythonhosted.org/packages/f3/9d/76a2e26c79a23be6e6e3664c57bec9e9fc8de155cfb9e4b67ea91b64f9d7/ruff-0.16.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6ca111ba0849539165e9e59d2b442542f3c1e8060ebbdea82494f1ffbccb1e1f", size = 10072582 },+ { url = "https://files.pythonhosted.org/packages/2e/d4/f42edddb39668af1a559ceafa3823aedd65633a48dc9768e775485faa2c1/ruff-0.16.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:359a1e5b495448ee1e91018064382ebc86f90e8aac2fed222c7d0e4e8df85fd2", size = 9879644 },+ { url = "https://files.pythonhosted.org/packages/f8/d4/913e3195d95e0378786c6656945c865f534a3560e29139da4882aff630d1/ruff-0.16.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:59e8f5681349474110b24d62e93cfda6593f5fa3473446ca3705200cac1a08b9", size = 10231569 },+ { url = "https://files.pythonhosted.org/packages/2b/c4/8aa6ea0bdcedbd1bf87397e2fc4ed8406448ea5842f8660bc6e5f163039d/ruff-0.16.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:efa3e7a16d1baaa79957888dfdf8be9ef2e44db81cb032af06d76632ab59e773", size = 10663666 },+ { url = "https://files.pythonhosted.org/packages/3d/02/7f10ef4700bc223c30a3fdd10631a29830c45524b810a3c7ed947af64591/ruff-0.16.8-py3-none-win32.whl", hash = "sha256:55793ba85c69921e89be061426d91a78652d6e50317c962240922747a4eb713f", size = 10093472 },+ { url = "https://files.pythonhosted.org/packages/1e/5d/a509c07d714b6da88f2c518b4637cf6f1d46b074be8f0f1e5fb9ff5126fe/ruff-0.16.8-py3-none-win_amd64.whl", hash = "sha256:a6b85621fd3c81e31fc5f5add09c9c078b430db3595ca632efafdec9e64ebfaa", size = 10586899 },+ { url = "https://files.pythonhosted.org/packages/fe/a0/50787329e4f20bf9dc9f6230015d46ec69c51a97ace5bc202dae4755365d/ruff-0.16.8-py3-none-win_arm64.whl", hash = "sha256:d075e820af612102ce217f07cc93e69f9490b10ec13ea85fa87bd03d996cef8a", size = 10386316 },+]++[[package]]+name = "safetensors"+version = "0.8.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/45/06/f955dbbb1859e3bd23c8ac6141af5106e7ad5fedec4a3a6e3d60f94b7001/safetensors-0.8.0.tar.gz", hash = "sha256:fabaf3e0f18a6618d9b36560682562157f77c2b71fcffc7b432be2baed9d753d", size = 325846 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/39/a0/f718cda65b05407d228f97602cf60dca269c979867aa5beb25410de26cd3/safetensors-0.8.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:c554f85858e05226d3c2828e32395e677434685d6d94594a41643361c5e837f0", size = 473568 },+ { url = "https://files.pythonhosted.org/packages/f5/b1/fa7c600e7dceae12e9606c7578cbc9ff1e1ed55844883ee5c92205e86226/safetensors-0.8.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:c80201d22cbf405b80647a60ada77bba06c8fba2da2743ba1e89cdcc39a81f25", size = 484562 },+ { url = "https://files.pythonhosted.org/packages/09/7d/65a7de0af421317bb36a067241e4235fff194eed60b961ed6d3f59a3fc60/safetensors-0.8.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a46e5ff292c356d6991e60942ba7f79817682d3a2cef0702136448cb9c4d235", size = 502844 },+ { url = "https://files.pythonhosted.org/packages/91/4f/3175c9d75634e0e0dda0082794193521035edd7c70a6f212bf33ca06ddf4/safetensors-0.8.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4124502b78f03534117c848f87a39b8f31e577b15eff423bf8bfb95f2a8c30d0", size = 511823 },+ { url = "https://files.pythonhosted.org/packages/20/87/846c289e7aa2299eff406335717cf43ce8777194ece8aad75772e0411615/safetensors-0.8.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7bc0a787ba8a35be368ee3574edfa2b1ad389eebd0a72e482ae275490e3f6c98", size = 633461 },+ { url = "https://files.pythonhosted.org/packages/76/22/8d64d9df2c45d5ded401df889d0ad90882804ca172d79ec4f0df8f727fe0/safetensors-0.8.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:040070828e36dc8e122178bbbd5830ff9e97920affb84cbe0f46442497bed358", size = 545148 },+ { url = "https://files.pythonhosted.org/packages/28/50/f203ff3a3ddfe19308efc83c5a3a29ed02bf786732ec35e68bf9162f3365/safetensors-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd6f3f93c9a0a7cc2788ee63fb763353d4bd2e89b0751bc78fcf7dda00bea774", size = 516040 },+ { url = "https://files.pythonhosted.org/packages/46/fb/cdaed17ceb2948784fd9c36b6fd3e951b608547cea81a48e8ee6f8cfdfcb/safetensors-0.8.0-cp310-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:fcdd41ec4628fee5799f807c73c353629130fbd942aa23d83c623dd6c9d52d78", size = 513832 },+ { url = "https://files.pythonhosted.org/packages/0d/49/1e15de264dcc3b77943d2d0c56a95809956883b1c2d6d585c792523f180b/safetensors-0.8.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8e9f537aa183a38ace122d27303dcd986b26bd2a7591f9181d7f0c396f4677ca", size = 559930 },+ { url = "https://files.pythonhosted.org/packages/2a/43/bf38443278eab4b1be1fce2931e2b012ad9cb7df52ada751d0aab8f7659a/safetensors-0.8.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:87eec7ffed2b809f05a398a8becb7d013f19f7837cd15d9748580d6cf30dbaf4", size = 678670 },+ { url = "https://files.pythonhosted.org/packages/72/e3/68cd3fa5b48488e84add63e04cb12f3bc28ae4638c06d4508c6e88823d0e/safetensors-0.8.0-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:4a95ae2b05d7726d751da4ebf626a2ca782b706e101bd894c95bc2450b1cffcc", size = 786679 },+ { url = "https://files.pythonhosted.org/packages/29/4b/1c19c509d56e01f4fbb3d0a2e597450f6cc04d1d56cf52defb0a62dfd715/safetensors-0.8.0-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:3ae091f16662658bdc019a4ff6cb4c085bb7d725eb5978b183ffd265863b6d2d", size = 765683 },+ { url = "https://files.pythonhosted.org/packages/27/43/41c1621732edd934d868a00d1b891584c892a7b62a9aab82ea5a0a5623ee/safetensors-0.8.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:8e080062fcde23be189565e1c3305d16751a218ecf9412c8601e64204eb6f846", size = 722361 },+ { url = "https://files.pythonhosted.org/packages/8e/3f/73ccf82579412b4a71c4ca673f10b5f1f888d7cf5af7fe24f27d30307be4/safetensors-0.8.0-cp310-abi3-win32.whl", hash = "sha256:2ddf52eac562eda224f99acfa7889d02968c1fd59a5b011ae7d8137c37e9c02d", size = 342401 },+ { url = "https://files.pythonhosted.org/packages/1b/6d/3fba214c1e5e0f69991677ec3bc17023f0421776975e1de0c682dca475e2/safetensors-0.8.0-cp310-abi3-win_amd64.whl", hash = "sha256:096ec1a98435df7beb08853bb5aa9081a84f23d0adc67ed1a0a10550f608373f", size = 355540 },+ { url = "https://files.pythonhosted.org/packages/8d/fc/7eedc3510d97878876e32774eebbeb61c43f148a96e915c84229a3e967aa/safetensors-0.8.0-cp310-abi3-win_arm64.whl", hash = "sha256:f7838e5135a406ad3e02efdcb8cf2e5397d368b0154537c4fec682dbc544d452", size = 340500 },+]++[[package]]+name = "setuptools"+version = "84.0.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/6d/44/f5da03a8ef95d369145c5bb53050e7877c9f3d312e128605fd9504829143/setuptools-84.0.0.tar.gz", hash = "sha256:f4695c21257f0d9b537ec2692c941d02ee143b7cc1276941349a546573b2ef73", size = 1168449 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/95/9c/c510029fc6ef33a6275cd2c5d3cecd6613dfd6aa401d57c54f1c18852ccf/setuptools-84.0.0-py3-none-any.whl", hash = "sha256:51a52592b3b99e102b609654876bd65f19f999935166d1352678931132b0c670", size = 818216 },+]++[[package]]+name = "shellingham"+version = "1.5.4"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755 },+]++[[package]]+name = "sie-sdk"+version = "0.8.2"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "aiohttp" },+ { name = "httpx" },+ { name = "msgpack" },+ { name = "msgpack-numpy" },+ { name = "numpy" },+ { name = "pillow" },+ { name = "pyyaml" },+ { name = "websockets" },+]+sdist = { url = "https://files.pythonhosted.org/packages/cb/4e/71574926dc0a307fe3be49913a3999e4a2ce060cba07b4e086e071513280/sie_sdk-0.8.2.tar.gz", hash = "sha256:e0d61eeddedd3f53483a04d79add83c2918999036fdb43b7cf668dd101381083", size = 280220 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d1/a5/f9f0511f1aa812fe5337e13f8f03aea465a38192159ab049a9d3159197d9/sie_sdk-0.8.2-py3-none-any.whl", hash = "sha256:46cc3c0472377dcea2cc461d0cb7c8252a937b8131bff6239c3692828f893163", size = 172966 },+]++[[package]]+name = "superlinked-sie-typed-decisions-example"+version = "0.1.0"+source = { virtual = "." }+dependencies = [+ { name = "sie-sdk" },+]++[package.dev-dependencies]+build = [+ { name = "pyarrow" },+]+dev = [+ { name = "ruff" },+]+laya = [+ { name = "laya" },+ { name = "torch", version = "2.14.0", source = { registry = "https://pypi.org/simple" }, marker = "sys_platform != 'linux'" },+ { name = "torch", version = "2.14.0+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'linux'" },+]++[package.metadata]+requires-dist = [{ name = "sie-sdk", specifier = ">=0.8.0,<0.9.0" }]++[package.metadata.requires-dev]+build = [{ name = "pyarrow", specifier = ">=17" }]+dev = [{ name = "ruff", specifier = ">=0.14" }]+laya = [+ { name = "laya", specifier = "==0.3.11" },+ { name = "torch", marker = "sys_platform != 'linux'", specifier = ">=2.4" },+ { name = "torch", marker = "sys_platform == 'linux'", specifier = ">=2.4", index = "https://download.pytorch.org/whl/cpu" },+]++[[package]]+name = "sympy"+version = "1.14.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "mpmath" },+]+sdist = { url = "https://files.pythonhosted.org/packages/83/d3/803453b36afefb7c2bb238361cd4ae6125a569b4db67cd9e79846ba2d68c/sympy-1.14.0.tar.gz", hash = "sha256:d3d3fe8df1e5a0b42f0e7bdf50541697dbe7d23746e894990c030e2b05e72517", size = 7793921 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/a2/09/77d55d46fd61b4a135c444fc97158ef34a095e5681d0a6c10b75bf356191/sympy-1.14.0-py3-none-any.whl", hash = "sha256:e091cc3e99d2141a0ba2847328f5479b05d94a6635cb96148ccb3f34671bd8f5", size = 6299353 },+]++[[package]]+name = "tokenizers"+version = "0.23.2"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "huggingface-hub" },+]+sdist = { url = "https://files.pythonhosted.org/packages/18/1e/bc6587c5ab643b2e17776cace9070a2ae73549c86bffac9934a600bf3c31/tokenizers-0.23.2.tar.gz", hash = "sha256:7f0f085686b9de0d0079e6f874ae053600db64c5d13049e0bbc0119926d25aac", size = 385745 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/4d/ed/8a443528baa6fac8dfe8c3b75b038c63ac92bb539bcabe311e227c718173/tokenizers-0.23.2-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:85a9a357a3764aecc904ee76bdaf8cf1ad8e5a67a1b929a487c4a39b49ed0e90", size = 3148852 },+ { url = "https://files.pythonhosted.org/packages/67/49/22da045a91732384d3a3771816bf188dc5a1f702c32e635afa7c679c0bef/tokenizers-0.23.2-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:986670e43691469dcee610ea0f846f91a8f84e91fc6f7a48d4c064414c0ec2bf", size = 3101593 },+ { url = "https://files.pythonhosted.org/packages/2e/4d/8f569ed49372a3ed8e57099bd515055fd48d7c95912c4307cda6973c2168/tokenizers-0.23.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a37039b5dfc4af84eb3ef0a92f4307e28936c8f9adccba2629d36f652e9bf7a2", size = 3516830 },+ { url = "https://files.pythonhosted.org/packages/2a/de/e2f14c8919d5bf51874051d00d6c7b7e0e8bde6c6a2dbeddda7f642896ff/tokenizers-0.23.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7b7e37ba198f24150f523e1242e83c4970de4a525480586be5dcc24d9add32c5", size = 3407975 },+ { url = "https://files.pythonhosted.org/packages/c5/bd/93c69152d02ef06ce47aed8b2bf4952dcf733c935a62791873932b2934d9/tokenizers-0.23.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:43e4f2071e3cc8d5d86421c874aebc82659bb51a68bcdef5a0da75ee89511ccb", size = 3748165 },+ { url = "https://files.pythonhosted.org/packages/2d/b7/56b84b80bc96942bba8eb23751a9e8a1fce4faaf4390425e7083f721c98c/tokenizers-0.23.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:325fee2e0418a9dc6c9ecf736a5f5f0db7875183ace9549ae339da76f7a1fbb7", size = 4024165 },+ { url = "https://files.pythonhosted.org/packages/9b/8a/0175e216f005c2fe08238292663aa41e4c802b216e71047a69a0e9fc6fa3/tokenizers-0.23.2-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:950d7c9426fa72406a0ffeacdbc0bb9985f5db20eb8b263f29c79aaf83105703", size = 3591899 },+ { url = "https://files.pythonhosted.org/packages/2c/ca/ca6b93c7820df123b2662a9469e8facc826ccc94e98fdd0d615f6431e73a/tokenizers-0.23.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41c2f84d172449b4dadb9cdc508e3e364076613c35b16e76ecfe47a60d1e3305", size = 3386843 },+ { url = "https://files.pythonhosted.org/packages/e9/a4/4f9106d317b14a80aefea9f0e3a8d07ef25f856a7607eb7f5ab894281fcb/tokenizers-0.23.2-cp310-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:12f0835dc2ee694746a76adf7b1567d4346a4a502ebe93fb1f5f80ea49799b78", size = 3577314 },+ { url = "https://files.pythonhosted.org/packages/8d/6a/1552b70fb0d9ab074fd3fc961435d01364e79c9058481822c3af6e8d402c/tokenizers-0.23.2-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:eb2f9c8a24da020ea8c11a01a19c1c2547912d92121ae4a01cfbca46125dee40", size = 9967367 },+ { url = "https://files.pythonhosted.org/packages/06/01/3ccb3a956c7528b2507b8a9714155c4baf86af593039db6ea375dd0c96c3/tokenizers-0.23.2-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:f486f402f6f9abee5bb032553736813af0c710a86b2e0ca592634c55cea1f835", size = 9811886 },+ { url = "https://files.pythonhosted.org/packages/fa/73/7038e612d48bda1599457f712f6bd3854eae1a9dc9c13aa47f835349db48/tokenizers-0.23.2-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:bef235815a067b2648caf6dcc7a71091b0b0fff9ee8057f6451eb9335fae52ef", size = 10146224 },+ { url = "https://files.pythonhosted.org/packages/b5/d8/8e9e4e0b287a338d8f88976729628c9d22e8a54cfaf9777018a7f7cb58a0/tokenizers-0.23.2-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:5c56bda1511921587789163e524d196ed8284174ac23abd7685d5ea8da6c4718", size = 10256304 },+ { url = "https://files.pythonhosted.org/packages/f3/1f/c79a01f671a49728ebb0b61f7ff9ea45663b66cab40bc0858e9859b25c16/tokenizers-0.23.2-cp310-abi3-win32.whl", hash = "sha256:debf978920d93ba9c219bd67cc4bbfaf912c9039e41e7a28b91ec15e3728c95a", size = 2592809 },+ { url = "https://files.pythonhosted.org/packages/db/f7/0a69ac6b82dbccf3f71add938a161c497952749294b8dd6dfe03a819dc40/tokenizers-0.23.2-cp310-abi3-win_amd64.whl", hash = "sha256:2e96f5699d5249c9c64aa8412e044f727aae3a4098cf830f9901ec1afc361cde", size = 2863236 },+ { url = "https://files.pythonhosted.org/packages/d7/b0/dee84cb44175be1b4c35bd2f770727494e78f0bb38e571a623ade94dbebb/tokenizers-0.23.2-cp310-abi3-win_arm64.whl", hash = "sha256:e49c394456dd9985787fec76132438ba3fb8911f857b1bf3d40119f9292d41aa", size = 2729352 },+]++[[package]]+name = "torch"+version = "2.14.0"+source = { registry = "https://pypi.org/simple" }+resolution-markers = [+ "sys_platform != 'linux'",+]+dependencies = [+ { name = "filelock", marker = "sys_platform != 'linux'" },+ { name = "fsspec", marker = "sys_platform != 'linux'" },+ { name = "jinja2", marker = "sys_platform != 'linux'" },+ { name = "networkx", marker = "sys_platform != 'linux'" },+ { name = "setuptools", marker = "sys_platform != 'linux'" },+ { name = "sympy", marker = "sys_platform != 'linux'" },+ { name = "typing-extensions", marker = "sys_platform != 'linux'" },+]+wheels = [+ { url = "https://files.pythonhosted.org/packages/17/76/bb4770f56cf6d8971671dbcbb7493e5a6a15ad2825f4e359b02c27c38297/torch-2.14.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:c1f844f1c750e87df4b68bc3afbc0e2b0c7ef19d7b8f666e48bdcf6a0c4f0056", size = 127303200 },+ { url = "https://files.pythonhosted.org/packages/be/16/9489b137112040f9911d7527e452854f21cc4e499ce0da79864e6a7451a7/torch-2.14.0-cp312-cp312-win_amd64.whl", hash = "sha256:cad84f41bbdf3dcf333ce394aeeaf25237c4d94fd6b659ba5eb813c829978823", size = 124114011 },+]++[[package]]+name = "torch"+version = "2.14.0+cpu"+source = { registry = "https://download.pytorch.org/whl/cpu" }+resolution-markers = [+ "sys_platform == 'linux'",+]+dependencies = [+ { name = "filelock", marker = "sys_platform == 'linux'" },+ { name = "fsspec", marker = "sys_platform == 'linux'" },+ { name = "jinja2", marker = "sys_platform == 'linux'" },+ { name = "networkx", marker = "sys_platform == 'linux'" },+ { name = "setuptools", marker = "sys_platform == 'linux'" },+ { name = "sympy", marker = "sys_platform == 'linux'" },+ { name = "typing-extensions", marker = "sys_platform == 'linux'" },+]+wheels = [+ { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.14.0%2Bcpu-cp312-cp312-linux_s390x.whl", hash = "sha256:07aefe1a437b6f1b41b0cba15e16583e2f43549ec9d062fcea8e7981a78e014a" },+ { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.14.0%2Bcpu-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:da8140c3d4a41500d29710e35bf8e66a4295ec31026487c69f54a3f583310f8d" },+ { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.14.0%2Bcpu-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:a09987c95ec4cffdb6df798d3d641558110a334cfccce22f2f046d83142bc260" },+]++[[package]]+name = "tqdm"+version = "4.70.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "colorama", marker = "sys_platform == 'win32'" },+]+sdist = { url = "https://files.pythonhosted.org/packages/0d/ea/b2a5bd54b28a324dae8211928b2d730b6547500342c7e6c6dea08bd0a485/tqdm-4.70.1.tar.gz", hash = "sha256:cefd0eca11b2a37a3aee776544d4f4ae913f02688135b5556b8788dfa474afc4", size = 171846 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/a7/03/921a3d3c75785aca9ebfbfcabfbc3a1be12e2ab5265deb026d55a5a3f83e/tqdm-4.70.1-py3-none-any.whl", hash = "sha256:c293e525e6fef9c20e8728fd4612df02a0aa31bb5fe91ecd93e123b1b7bffa73", size = 80199 },+]++[[package]]+name = "transformers"+version = "5.16.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "huggingface-hub" },+ { name = "numpy" },+ { name = "packaging" },+ { name = "pyyaml" },+ { name = "regex" },+ { name = "safetensors" },+ { name = "tokenizers" },+ { name = "tqdm" },+ { name = "typer" },+]+sdist = { url = "https://files.pythonhosted.org/packages/ad/2e/ba418680ab901dae269360bb8642485eae04f1af91ee2ebb8bd6f3607305/transformers-5.16.1.tar.gz", hash = "sha256:17b0eac726ddc55e84ac58946063e0c6d37fd000c456b581f050ea0f4e822869", size = 9650542 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/0d/4d/ee3728674c0bbc637bb4af88ccf0be697f92e4e90b55f5dc110c44d61b61/transformers-5.16.1-py3-none-any.whl", hash = "sha256:2f2d5b98a5ad3718713653734298fa620754ed683702a635ebb587df3ed29c7e", size = 12080592 },+]++[[package]]+name = "typer"+version = "0.27.2"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "annotated-doc" },+ { name = "colorama", marker = "sys_platform == 'win32'" },+ { name = "rich" },+ { name = "shellingham" },+]+sdist = { url = "https://files.pythonhosted.org/packages/16/f7/57713ba479fd405eb76de31404b2c744c289e336b2d999511ebf51e496f7/typer-0.27.2.tar.gz", hash = "sha256:269b7eb9d3c202ca84b4bc9618cb04ebb43d3d4d1e567e4c768607232c05f945", size = 204045 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/dc/bf/205d0004930ede8f542fb58f601526fccf4ae7626075ca1e6c4de5d3d652/typer-0.27.2-py3-none-any.whl", hash = "sha256:b3a5fc4342d5fc8fda8fc3010b1cf117e9249aab7fae800c2eff62fd3842d97d", size = 123130 },+]++[[package]]+name = "typing-extensions"+version = "4.16.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571 },+]++[[package]]+name = "websockets"+version = "14.2"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/94/54/8359678c726243d19fae38ca14a334e740782336c9f19700858c4eb64a1e/websockets-14.2.tar.gz", hash = "sha256:5059ed9c54945efb321f097084b4c7e52c246f2c869815876a69d1efc4ad6eb5", size = 164394 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/c1/81/04f7a397653dc8bec94ddc071f34833e8b99b13ef1a3804c149d59f92c18/websockets-14.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:1f20522e624d7ffbdbe259c6b6a65d73c895045f76a93719aa10cd93b3de100c", size = 163096 },+ { url = "https://files.pythonhosted.org/packages/ec/c5/de30e88557e4d70988ed4d2eabd73fd3e1e52456b9f3a4e9564d86353b6d/websockets-14.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:647b573f7d3ada919fd60e64d533409a79dcf1ea21daeb4542d1d996519ca967", size = 160758 },+ { url = "https://files.pythonhosted.org/packages/e5/8c/d130d668781f2c77d106c007b6c6c1d9db68239107c41ba109f09e6c218a/websockets-14.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6af99a38e49f66be5a64b1e890208ad026cda49355661549c507152113049990", size = 160995 },+ { url = "https://files.pythonhosted.org/packages/a6/bc/f6678a0ff17246df4f06765e22fc9d98d1b11a258cc50c5968b33d6742a1/websockets-14.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:091ab63dfc8cea748cc22c1db2814eadb77ccbf82829bac6b2fbe3401d548eda", size = 170815 },+ { url = "https://files.pythonhosted.org/packages/d8/b2/8070cb970c2e4122a6ef38bc5b203415fd46460e025652e1ee3f2f43a9a3/websockets-14.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b374e8953ad477d17e4851cdc66d83fdc2db88d9e73abf755c94510ebddceb95", size = 169759 },+ { url = "https://files.pythonhosted.org/packages/81/da/72f7caabd94652e6eb7e92ed2d3da818626e70b4f2b15a854ef60bf501ec/websockets-14.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a39d7eceeea35db85b85e1169011bb4321c32e673920ae9c1b6e0978590012a3", size = 170178 },+ { url = "https://files.pythonhosted.org/packages/31/e0/812725b6deca8afd3a08a2e81b3c4c120c17f68c9b84522a520b816cda58/websockets-14.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0a6f3efd47ffd0d12080594f434faf1cd2549b31e54870b8470b28cc1d3817d9", size = 170453 },+ { url = "https://files.pythonhosted.org/packages/66/d3/8275dbc231e5ba9bb0c4f93144394b4194402a7a0c8ffaca5307a58ab5e3/websockets-14.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:065ce275e7c4ffb42cb738dd6b20726ac26ac9ad0a2a48e33ca632351a737267", size = 169830 },+ { url = "https://files.pythonhosted.org/packages/a3/ae/e7d1a56755ae15ad5a94e80dd490ad09e345365199600b2629b18ee37bc7/websockets-14.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e9d0e53530ba7b8b5e389c02282f9d2aa47581514bd6049d3a7cffe1385cf5fe", size = 169824 },+ { url = "https://files.pythonhosted.org/packages/b6/32/88ccdd63cb261e77b882e706108d072e4f1c839ed723bf91a3e1f216bf60/websockets-14.2-cp312-cp312-win32.whl", hash = "sha256:20e6dd0984d7ca3037afcb4494e48c74ffb51e8013cac71cf607fffe11df7205", size = 163981 },+ { url = "https://files.pythonhosted.org/packages/b3/7d/32cdb77990b3bdc34a306e0a0f73a1275221e9a66d869f6ff833c95b56ef/websockets-14.2-cp312-cp312-win_amd64.whl", hash = "sha256:44bba1a956c2c9d268bdcdf234d5e5ff4c9b6dc3e300545cbe99af59dda9dcce", size = 164421 },+ { url = "https://files.pythonhosted.org/packages/7b/c8/d529f8a32ce40d98309f4470780631e971a5a842b60aec864833b3615786/websockets-14.2-py3-none-any.whl", hash = "sha256:7a6ceec4ea84469f15cf15807a747e9efe57e369c384fa86e022b3bea679b79b", size = 157416 },+]++[[package]]+name = "yarl"+version = "1.25.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "idna" },+ { name = "multidict" },+ { name = "propcache" },+]+sdist = { url = "https://files.pythonhosted.org/packages/75/16/e8be8e2fb175bbf41a0680381a319f1199fae256588241a2ac8677eafb49/yarl-1.25.1.tar.gz", hash = "sha256:03dd38de09bc213e9a8b29761eec33ee1d5318dac0e49d8af36e4d27830e23a7", size = 246245 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/75/b3/cd32ac66ae622b854c2df0ac52106dda220d361b65a64fde7d5b3684aa3f/yarl-1.25.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:94d7aa6debf92a1dd14cb5280b083a764169a13cfb23a452111160274ed989f4", size = 144798 },+ { url = "https://files.pythonhosted.org/packages/61/fb/a2c52a8007c2051ba74662afb112ecf3d00346af4c25e33df9d80fd14fb8/yarl-1.25.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:83d4a37e4b95da4d8bda930d6d35b75b4cdadbacbb4980cae290ea3100b5d51d", size = 104583 },+ { url = "https://files.pythonhosted.org/packages/be/dd/ee38aec8e09fdf957e50d4085453fbe202f56c6c3b4cf07b81cdb4f09ee9/yarl-1.25.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e029648f9c951db30e98a7d7ec90835db88ec4b32820efe2a9bdc2287e032eb6", size = 104325 },+ { url = "https://files.pythonhosted.org/packages/1e/b3/058dbfb1857b484c9cf9cc135659f50b85ce66e03c99e44dc2f7b6161f55/yarl-1.25.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4d781294bb815ecb5ea57ff6bbf8038e0a31a95fdf3e1788f66e0dc100d64b58", size = 115358 },+ { url = "https://files.pythonhosted.org/packages/db/39/29693446cf0cf6b15a0e2f75a5d40f93c56819b05b0622196f45e95b5cc0/yarl-1.25.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e12c538e00e7c1b286a07061046b90e8124e6a9793efae2c70db6a4aad07faad", size = 107658 },+ { url = "https://files.pythonhosted.org/packages/86/b3/3c4dd7e1af43b931fba95e0a722737f2ea94a6d199c802585282831d7abd/yarl-1.25.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7e4de3ac4adbad3d0bc7c6f4360a7dbff5de2f15e3b723be3198074e17fd9c40", size = 122660 },+ { url = "https://files.pythonhosted.org/packages/bd/b5/1b60dbc3cfc9c5712b15148c206748f2bc93953ffdbe25ea75b63dfc89c9/yarl-1.25.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:419f392a1da624877975709e3864dfe833af6cc7671b39318086d456e288380c", size = 126506 },+ { url = "https://files.pythonhosted.org/packages/bc/7b/ca212cbe170ac8b96e45317ecbcf9c3c3ecf0cdec98d5b088a9c4088929b/yarl-1.25.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c6f117789d22dce188e5754e8bc65b7e6ebf8cb73963b9fa761f672a5883769d", size = 117050 },+ { url = "https://files.pythonhosted.org/packages/cb/c3/72b4938cdbe619ad71ac156182faef4908846b84dc3ca4dbb4c4e6f84014/yarl-1.25.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:80e47012e730da131c9f059c80936783f9659aae22dc31c03c0595590d11ed54", size = 114174 },+ { url = "https://files.pythonhosted.org/packages/e8/43/268717870f9ba0cc9701a95181587f6dc8c5f387aab4aeecc83158f38a79/yarl-1.25.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e80f557716fd765439577131e526b8942ffc2c07bdbc5e39fa62f660ba1e963f", size = 114944 },+ { url = "https://files.pythonhosted.org/packages/da/84/baa5bf504d51fe062c4bcaf62936da97fffb43285978d0b39984824231fd/yarl-1.25.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:f61964f235a43738bfac50da46fc4254943a7eea3051aeb0b6fc7c992c29fadc", size = 108263 },+ { url = "https://files.pythonhosted.org/packages/a4/28/779a2ed9e0152a601a27039bed9aead3f0b79797a67e2c44bfa444622dd8/yarl-1.25.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:e546fe1d4a93ebc2910f0d768baff19faa09843ab3f2036a67ed6e69fae4419d", size = 122184 },+ { url = "https://files.pythonhosted.org/packages/f8/1f/118e9e5b8f07694d63fd3222e801d7782270003f1a222aa798df3f8d5933/yarl-1.25.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:cce0727fd5ac04d372fa9bbfde9febc2bcf209aadfcf0468e45dec72719895d1", size = 114001 },+ { url = "https://files.pythonhosted.org/packages/0f/ae/a4cf1cf372313734b17996d4007f9f73596e7a178b9485802e5494ecf484/yarl-1.25.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:af4ea5b37403ef4e30f3927eaed540db942bde01d8d3ff083527c0704d1c9c68", size = 120565 },+ { url = "https://files.pythonhosted.org/packages/05/79/ad94f93ca731bc9e44d321833ab96b82a4f9f5f63cf773f81a4aeea5ecc1/yarl-1.25.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:68782fdb4027b8d1eee25ec35e9a6db05e863b899eb0310b3a33b6c3fef55707", size = 117060 },+ { url = "https://files.pythonhosted.org/packages/bb/cc/51a7b4abf4ac593b8e7eb3794b28e5a35ae26eed8bc04787628d215af82f/yarl-1.25.1-cp312-cp312-win_amd64.whl", hash = "sha256:7d575b54cb3863ef9bc290ea4b009999d55dc237326131e4853cf33e888fee03", size = 102593 },+ { url = "https://files.pythonhosted.org/packages/9d/21/0941a6b93a58b59a1ec75e5333bf06929b671309c43c0cd201c172d9c39f/yarl-1.25.1-cp312-cp312-win_arm64.whl", hash = "sha256:bc3ac7bf569f6b64dad04dd7808c7872dae8a97df657856eac05e9b7e3614a85", size = 97697 },+ { url = "https://files.pythonhosted.org/packages/54/22/318c7980066769c6bcd9221ed2248294f5698811da099013098c670565ed/yarl-1.25.1-py3-none-any.whl", hash = "sha256:681c758b0490f9e96b78e5fa8e8dc6e648e9185bb6eaebe73183c33ea0c445f3", size = 63617 },+]