Add GLiNER-2.5-Decide benchmark results
#33
by jfbrown95 - opened
- .gitattributes +1 -0
- README.md +79 -56
- assets/bug-tradeoff.svg +4 -1
- assets/lint-tradeoff.svg +4 -1
- assets/security-tradeoff.svg +4 -1
- gliner_decide.py +408 -0
- perch-sizing.mjs +96 -0
- predictions/current/bug/gliner25-decide.jsonl +3 -0
- predictions/current/lint/gliner25-decide.jsonl +3 -0
- predictions/current/security/gliner25-decide.jsonl +3 -0
- results-current.jsonl +6 -0
- results.jsonl +6 -0
- tradeoff.py +21 -9
.gitattributes
CHANGED
|
@@ -35,6 +35,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 35 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 36 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 37 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 38 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 39 |
# Audio files - uncompressed
|
| 40 |
*.pcm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 35 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 36 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 37 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
predictions/current/*/gliner25-decide.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 39 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 40 |
# Audio files - uncompressed
|
| 41 |
*.pcm filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -21,6 +21,7 @@ Pairs come from open-source projects in Rust, JavaScript, TypeScript, Python, Go
|
|
| 21 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | [Respan scoring API](https://api.respan.ai/api/v1/scores) (`span-01-pro`) |
|
| 22 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | [Liquid decision API](https://api.liquid.ai/decisions/v1/systemone) (`d1:free`) |
|
| 23 |
| [TypeLLM](https://typellm.ai/docs) | [TypeLLM API](https://api.typellm.ai/v1/generate) (`typellm-latest`) |
|
|
|
|
| 24 |
|
| 25 |
<!-- BEGIN TRADEOFF_RESULTS -->
|
| 26 |
|
|
@@ -30,6 +31,8 @@ Each line shows how many issues a model finds and what percentage of clean metho
|
|
| 30 |
|
| 31 |
The tables use each run's recorded alert settings. A value of 20% under ‘Clean methods wrongly flagged’ means one in five clean methods received an alert. Models are ranked by recall minus that percentage. Bold marks the best full-set value in each column; cost compares priced runs captured here.
|
| 32 |
|
|
|
|
|
|
|
| 33 |
## Bugs
|
| 34 |
|
| 35 |
[Public pairs](https://huggingface.co/datasets/perchscan/bug-pairs-public)
|
|
@@ -38,30 +41,32 @@ The tables use each run's recorded alert settings. A value of 20% under ‘Clean
|
|
| 38 |
|
| 39 |
### Public — 2,220 pairs
|
| 40 |
|
| 41 |
-
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |
|
| 42 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 43 |
-
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.4% | 27.1% | **6.3%** | $0.239 |
|
| 44 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 17.7% | 12.7% | 5.0% | $0.551 |
|
| 45 |
-
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 43.0% | 39.7% | 3.3% | $0.239 |
|
| 46 |
-
| [TypeLLM](https://typellm.ai/docs) | 8.3% | 5.5% | 2.7% | $0.576 |
|
| 47 |
-
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 25.3% | 22.6% | 2.7% | **$0.182
|
| 48 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 4.1% |
|
| 49 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | **81.9%** | 80.9% | 1.0% | ~$0.210 |
|
| 50 |
-
| [
|
|
|
|
| 51 |
|
| 52 |
CodeQL scored 52 of the 2,220 public pairs; other models scored all pairs. Its [method decisions](codeql-comparison/) and [evaluation protocol](CODEQL.md) are available here.
|
| 53 |
|
| 54 |
### Private — 498 pairs
|
| 55 |
|
| 56 |
-
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |
|
| 57 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 58 |
-
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 35.8% | 27.3% | **8.6%** | $0.054 |
|
| 59 |
-
| [TypeLLM](https://typellm.ai/docs) | 11.3% | 5.8% | 5.6% | $0.129 |
|
| 60 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.0% | 15.6% | 4.5% | $0.123 |
|
| 61 |
-
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 28.5% | 24.3% | 4.2% | **$0.040
|
| 62 |
-
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.3% | 41.8% | 2.6% | $0.054 |
|
| 63 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 5.2% |
|
| 64 |
-
| [
|
|
|
|
| 65 |
|
| 66 |
## Security
|
| 67 |
|
|
@@ -71,30 +76,32 @@ CodeQL scored 52 of the 2,220 public pairs; other models scored all pairs. Its [
|
|
| 71 |
|
| 72 |
### Public — 1,311 pairs
|
| 73 |
|
| 74 |
-
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |
|
| 75 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 76 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 34.6% | 23.6% | **11.0%** | $0.507 |
|
| 77 |
-
| [TypeLLM](https://typellm.ai/docs) | 27.8% | 17.4% | 10.5% | $0.566 |
|
| 78 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 55.6% | 46.8% | 8.8% | Free tier |
|
| 79 |
-
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.1% | 25.8% | 7.3% | **$0.208** |
|
| 80 |
-
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 21.0% |
|
| 81 |
-
| [CodeQL](https://codeql.github.com/) (70 pairs) | 3.7% | 0.0% | 3.7% | — |
|
| 82 |
-
| [
|
| 83 |
-
| [
|
|
|
|
| 84 |
|
| 85 |
CodeQL scored 70 of the 1,311 public pairs; other models scored all pairs. Its [method decisions](codeql-comparison/) and [evaluation protocol](CODEQL.md) are available here.
|
| 86 |
|
| 87 |
### Private — 439 pairs
|
| 88 |
|
| 89 |
-
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |
|
| 90 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 91 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 34.2% | 29.0% | **5.2%** | Free tier |
|
| 92 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.6% | 16.7% | 3.9% | $0.182 |
|
| 93 |
-
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 21.9% | 18.5% | 3.3% | **$0.074** |
|
| 94 |
-
| [TypeLLM](https://typellm.ai/docs) | 8.8% |
|
| 95 |
-
| [
|
| 96 |
-
| [
|
| 97 |
-
| [
|
|
|
|
| 98 |
|
| 99 |
## Perch Lint Bench
|
| 100 |
|
|
@@ -104,27 +111,29 @@ CodeQL scored 70 of the 1,311 public pairs; other models scored all pairs. Its [
|
|
| 104 |
|
| 105 |
### Public — 214 pairs
|
| 106 |
|
| 107 |
-
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |
|
| 108 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 109 |
-
| [TypeLLM](https://typellm.ai/docs) | **61.7%** | 2.8% | **58.9%** | $0.050 |
|
| 110 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 50.0% |
|
| 111 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.1% | 0.9% | 48.1% | Free tier |
|
| 112 |
-
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 52.8% | 5.1% | 47.7% | $0.018 |
|
| 113 |
-
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 50.0% | 11.2% | 38.8% | $0.014 |
|
| 114 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 38.8% | 37.4% | 1.4% | **~$0.010** |
|
| 115 |
-
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 32.2% | 31.3% | 0.9% | $0.018 |
|
|
|
|
| 116 |
|
| 117 |
### Private — 71 pairs
|
| 118 |
|
| 119 |
-
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |
|
| 120 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 121 |
-
| [TypeLLM](https://typellm.ai/docs) | **59.2%** | 5.6% | **53.5%** | $0.016 |
|
| 122 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 53.5% |
|
| 123 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.3% |
|
| 124 |
-
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 53.5% | 8.5% | 45.1% | $0.006 |
|
| 125 |
-
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.1% | 8.5% | 36.6% | $0.005 |
|
| 126 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.7% | 49.3% | 1.4% | **~$0.003** |
|
| 127 |
-
| [
|
|
|
|
| 128 |
|
| 129 |
<!-- END TRADEOFF_RESULTS -->
|
| 130 |
|
|
@@ -134,6 +143,8 @@ Span-01 uses its [behavior-scoring API](https://www.respan.ai/docs/documentation
|
|
| 134 |
|
| 135 |
Liquid d1 received the same Perch method state and all applicable questions in one API call per method. Semantic lint used the same compiled `ensure` rule as Jev.
|
| 136 |
|
|
|
|
|
|
|
| 137 |
Inference costs cover scoring the method sides in each table. Jev costs are estimated from API-reported input tokens at [TypeSafe's published rate](https://typesafe.ai/blog/introducing-system-one-models-and-jev); for semantic lint, input-token usage was measured by replaying the same 570 requests with `jev-1.13.0`. Span-01 costs use API-reported input tokens at [Respan's published rate](https://www.respan.ai/docs/documentation/span-01/concept). Beam costs are API-reported. CLM cost is an estimated share of a 38.4-minute H100 run costing $2.23 total, allocated by embedding count. Costs are not ranked. Liquid d1 was tested on the `d1:free` API tier; a paid per-token price was not published. TypeLLM cost uses API-reported input tokens at its [published rate](https://typellm.ai/pricing); no thinking tokens were used.
|
| 138 |
|
| 139 |
JevLike (192-byte input), Laya (512-token input), and Kev (packed-branch limit) could not score every full-context method. NanoJev was unavailable on Beam. They are excluded rather than ranked on partial results.
|
|
@@ -148,6 +159,8 @@ JevLike (192-byte input), Laya (512-token input), and Kev (packed-branch limit)
|
|
| 148 |
- [`span01.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/span01.py): calls Span-01 with all applicable behaviors in one request per method, saves resumable predictions, and scores the completed dataset.
|
| 149 |
- [`liquid.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/liquid.py): calls Liquid d1 with the frozen Perch question pack, saves resumable predictions, and scores each track.
|
| 150 |
- [`typellm.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/typellm.py): scores each method independently with applicable boolean questions and saves the returned probabilities.
|
|
|
|
|
|
|
| 151 |
- [`perch-lint-bench-public`](https://huggingface.co/datasets/perchscan/perch-lint-bench-public): paired rules and its runnable scorer.
|
| 152 |
|
| 153 |
To run Jev with the current pack, set `TYPESAFE_API_KEY` or `PERCH_API_KEY` in your environment:
|
|
@@ -163,4 +176,14 @@ To run Span-01 on the public security pairs, set `RESPAN_API_KEY` and run:
|
|
| 163 |
python3 span01.py --domain security --predictions security-span01.jsonl --report security-span01.json
|
| 164 |
```
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
For another model, use `--scorer command --command 'python3 your_adapter.py' --model-revision YOUR_MODEL`. The adapter receives the method state and each applicable detection question and returns its true-answer probability. The runner saves predictions for resumption and reports scores only when every method side is complete.
|
|
|
|
| 21 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | [Respan scoring API](https://api.respan.ai/api/v1/scores) (`span-01-pro`) |
|
| 22 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | [Liquid decision API](https://api.liquid.ai/decisions/v1/systemone) (`d1:free`) |
|
| 23 |
| [TypeLLM](https://typellm.ai/docs) | [TypeLLM API](https://api.typellm.ai/v1/generate) (`typellm-latest`) |
|
| 24 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | [Fastino classification API](https://api.fastino.ai/v1/chat/completions) (`fastino/GLiNER-2.5-Decide`) |
|
| 25 |
|
| 26 |
<!-- BEGIN TRADEOFF_RESULTS -->
|
| 27 |
|
|
|
|
| 31 |
|
| 32 |
The tables use each run's recorded alert settings. A value of 20% under ‘Clean methods wrongly flagged’ means one in five clean methods received an alert. Models are ranked by recall minus that percentage. Bold marks the best full-set value in each column; cost compares priced runs captured here.
|
| 33 |
|
| 34 |
+
Failed requests count as incorrect decisions: a failed issue is a miss; a failed clean method is a false positive. Failed cases receive no model score and remain incorrect across the plotted cutoffs.
|
| 35 |
+
|
| 36 |
## Bugs
|
| 37 |
|
| 38 |
[Public pairs](https://huggingface.co/datasets/perchscan/bug-pairs-public)
|
|
|
|
| 41 |
|
| 42 |
### Public — 2,220 pairs
|
| 43 |
|
| 44 |
+
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 45 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 46 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.4% | 27.1% | **6.3%** | **0** | $0.239 |
|
| 47 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 17.7% | 12.7% | 5.0% | **0** | $0.551 |
|
| 48 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 43.0% | 39.7% | 3.3% | **0** | $0.239 |
|
| 49 |
+
| [TypeLLM](https://typellm.ai/docs) | 8.3% | 5.5% | 2.7% | **0** | $0.576 |
|
| 50 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 25.3% | 22.6% | 2.7% | **0** | $0.182 |
|
| 51 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 4.1% | 2.5% | 1.6% | **0** | Free tier |
|
| 52 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | **81.9%** | 80.9% | 1.0% | **0** | ~$0.210 |
|
| 53 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 2.3% | **2.1%** | 0.2% | **0** | **$0.175** |
|
| 54 |
+
| [CodeQL](https://codeql.github.com/) (52 pairs) | 0.0% | 0.0% | 0.0% | — | — |
|
| 55 |
|
| 56 |
CodeQL scored 52 of the 2,220 public pairs; other models scored all pairs. Its [method decisions](codeql-comparison/) and [evaluation protocol](CODEQL.md) are available here.
|
| 57 |
|
| 58 |
### Private — 498 pairs
|
| 59 |
|
| 60 |
+
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 61 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 62 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 35.8% | 27.3% | **8.6%** | **0** | $0.054 |
|
| 63 |
+
| [TypeLLM](https://typellm.ai/docs) | 11.3% | 5.8% | 5.6% | **0** | $0.129 |
|
| 64 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.0% | 15.6% | 4.5% | **0** | $0.123 |
|
| 65 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 28.5% | 24.3% | 4.2% | **0** | $0.040 |
|
| 66 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.3% | 41.8% | 2.6% | **0** | $0.054 |
|
| 67 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 5.2% | 3.0% | 2.2% | **0** | Free tier |
|
| 68 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 1.7% | **2.1%** | -0.4% | **0** | **$0.039** |
|
| 69 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | **79.5%** | 80.1% | -0.6% | **0** | ~$0.047 |
|
| 70 |
|
| 71 |
## Security
|
| 72 |
|
|
|
|
| 76 |
|
| 77 |
### Public — 1,311 pairs
|
| 78 |
|
| 79 |
+
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 80 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 81 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 34.6% | 23.6% | **11.0%** | **0** | $0.507 |
|
| 82 |
+
| [TypeLLM](https://typellm.ai/docs) | 27.8% | 17.4% | 10.5% | **0** | $0.566 |
|
| 83 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 55.6% | 46.8% | 8.8% | **0** | Free tier |
|
| 84 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.1% | 25.8% | 7.3% | **0** | **$0.208** |
|
| 85 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 21.0% | 17.2% | 3.9% | **0** | $0.251 |
|
| 86 |
+
| [CodeQL](https://codeql.github.com/) (70 pairs) | 3.7% | 0.0% | 3.7% | — | — |
|
| 87 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 2.1% | **1.6%** | 0.5% | 6 | $0.434 |
|
| 88 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | **100.0%** | 99.9% | 0.1% | **0** | **$0.208** |
|
| 89 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | **100.0%** | 100.0% | 0.0% | **0** | ~$1.432 |
|
| 90 |
|
| 91 |
CodeQL scored 70 of the 1,311 public pairs; other models scored all pairs. Its [method decisions](codeql-comparison/) and [evaluation protocol](CODEQL.md) are available here.
|
| 92 |
|
| 93 |
### Private — 439 pairs
|
| 94 |
|
| 95 |
+
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 96 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 97 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 34.2% | 29.0% | **5.2%** | **0** | Free tier |
|
| 98 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.6% | 16.7% | 3.9% | **0** | $0.182 |
|
| 99 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 21.9% | 18.5% | 3.3% | **0** | **$0.074** |
|
| 100 |
+
| [TypeLLM](https://typellm.ai/docs) | 8.8% | 6.2% | 2.5% | **0** | $0.203 |
|
| 101 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 2.0% | **1.5%** | 0.6% | 1 | $0.142 |
|
| 102 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | **100.0%** | 100.0% | 0.0% | **0** | ~$0.528 |
|
| 103 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | **100.0%** | 100.0% | 0.0% | **0** | **$0.074** |
|
| 104 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 8.0% | 8.1% | -0.1% | **0** | $0.091 |
|
| 105 |
|
| 106 |
## Perch Lint Bench
|
| 107 |
|
|
|
|
| 111 |
|
| 112 |
### Public — 214 pairs
|
| 113 |
|
| 114 |
+
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 115 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 116 |
+
| [TypeLLM](https://typellm.ai/docs) | **61.7%** | 2.8% | **58.9%** | **0** | $0.050 |
|
| 117 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 50.0% | 0.5% | 49.5% | **0** | $0.048 |
|
| 118 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.1% | 0.9% | 48.1% | **0** | Free tier |
|
| 119 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 52.8% | 5.1% | 47.7% | **0** | $0.018 |
|
| 120 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 50.0% | 11.2% | 38.8% | **0** | $0.014 |
|
| 121 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 38.8% | 37.4% | 1.4% | **0** | **~$0.010** |
|
| 122 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 32.2% | 31.3% | 0.9% | **0** | $0.018 |
|
| 123 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 0.0% | **0.0%** | 0.0% | **0** | **$0.010** |
|
| 124 |
|
| 125 |
### Private — 71 pairs
|
| 126 |
|
| 127 |
+
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 128 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 129 |
+
| [TypeLLM](https://typellm.ai/docs) | **59.2%** | 5.6% | **53.5%** | **0** | $0.016 |
|
| 130 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 53.5% | 1.4% | 52.1% | **0** | $0.016 |
|
| 131 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.3% | 1.4% | 47.9% | **0** | Free tier |
|
| 132 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 53.5% | 8.5% | 45.1% | **0** | $0.006 |
|
| 133 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.1% | 8.5% | 36.6% | **0** | $0.005 |
|
| 134 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.7% | 49.3% | 1.4% | **0** | **~$0.003** |
|
| 135 |
+
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 0.0% | **0.0%** | 0.0% | **0** | $0.004 |
|
| 136 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 42.3% | 45.1% | -2.8% | **0** | $0.006 |
|
| 137 |
|
| 138 |
<!-- END TRADEOFF_RESULTS -->
|
| 139 |
|
|
|
|
| 143 |
|
| 144 |
Liquid d1 received the same Perch method state and all applicable questions in one API call per method. Semantic lint used the same compiled `ensure` rule as Jev.
|
| 145 |
|
| 146 |
+
GLiNER-2.5-Decide scores the answer criteria as native classification labels. Perch sizes each method's context and batches its applicable questions to fit the endpoint. Large methods are read in overlapping source chunks; each question's highest issue score supplies the method decision. Returned label confidences supply the scores. Timeouts and requests that still cannot fit are recorded as failures. Costs use API-reported prompt tokens at the live catalog rate of $0.03 per million input tokens.
|
| 147 |
+
|
| 148 |
Inference costs cover scoring the method sides in each table. Jev costs are estimated from API-reported input tokens at [TypeSafe's published rate](https://typesafe.ai/blog/introducing-system-one-models-and-jev); for semantic lint, input-token usage was measured by replaying the same 570 requests with `jev-1.13.0`. Span-01 costs use API-reported input tokens at [Respan's published rate](https://www.respan.ai/docs/documentation/span-01/concept). Beam costs are API-reported. CLM cost is an estimated share of a 38.4-minute H100 run costing $2.23 total, allocated by embedding count. Costs are not ranked. Liquid d1 was tested on the `d1:free` API tier; a paid per-token price was not published. TypeLLM cost uses API-reported input tokens at its [published rate](https://typellm.ai/pricing); no thinking tokens were used.
|
| 149 |
|
| 150 |
JevLike (192-byte input), Laya (512-token input), and Kev (packed-branch limit) could not score every full-context method. NanoJev was unavailable on Beam. They are excluded rather than ranked on partial results.
|
|
|
|
| 159 |
- [`span01.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/span01.py): calls Span-01 with all applicable behaviors in one request per method, saves resumable predictions, and scores the completed dataset.
|
| 160 |
- [`liquid.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/liquid.py): calls Liquid d1 with the frozen Perch question pack, saves resumable predictions, and scores each track.
|
| 161 |
- [`typellm.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/typellm.py): scores each method independently with applicable boolean questions and saves the returned probabilities.
|
| 162 |
+
- [`gliner_decide.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/gliner_decide.py): runs GLiNER-2.5-Decide through its native classification endpoint, saves returned confidences and failed requests, and scores each completed track.
|
| 163 |
+
- [`perch-sizing.mjs`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/perch-sizing.mjs): uses Perch's source chunking, context sizing, and question batching. Each reading records its source-byte coverage.
|
| 164 |
- [`perch-lint-bench-public`](https://huggingface.co/datasets/perchscan/perch-lint-bench-public): paired rules and its runnable scorer.
|
| 165 |
|
| 166 |
To run Jev with the current pack, set `TYPESAFE_API_KEY` or `PERCH_API_KEY` in your environment:
|
|
|
|
| 176 |
python3 span01.py --domain security --predictions security-span01.jsonl --report security-span01.json
|
| 177 |
```
|
| 178 |
|
| 179 |
+
To run GLiNER-2.5-Decide, install the npm dependencies in a [Perch source checkout](https://github.com/lakeday-org/perch), set `PERCH_SOURCE` to that checkout and `FASTINO_API_KEY` to your API key, then run:
|
| 180 |
+
|
| 181 |
+
```sh
|
| 182 |
+
python3 gliner_decide.py --domain lint --out gliner-lint --budget 10
|
| 183 |
+
python3 gliner_decide.py --domain bug --out gliner-bug --budget 10
|
| 184 |
+
python3 gliner_decide.py --domain security --out gliner-security --budget 10
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
The runner starts with a 1,200-token state budget and a 1,800-token request budget. `--state-budget`, `--request-budget`, and `--max-questions` set model limits. A size rejection splits the question batch first, then rebuilds the source readings with a smaller state budget. Perch shortens caller and callee excerpts before splitting the target source. If a leading comment outside the target prevents a reading from fitting, it is omitted and recorded. Every target-source byte must remain covered. Saved results include the Perch revision, sizing settings, question scores, and API usage. Bug and security question floors and the 70% semantic lint floor stay unchanged.
|
| 188 |
+
|
| 189 |
For another model, use `--scorer command --command 'python3 your_adapter.py' --model-revision YOUR_MODEL`. The adapter receives the method state and each applicable detection question and returns its true-answer probability. The runner saves predictions for resumption and reports scores only when every method side is complete.
|
assets/bug-tradeoff.svg
CHANGED
|
|
|
|
assets/lint-tradeoff.svg
CHANGED
|
|
|
|
assets/security-tradeoff.svg
CHANGED
|
|
|
|
gliner_decide.py
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Benchmark GLiNER-2.5-Decide through its native classification API.
|
| 3 |
+
|
| 4 |
+
Perch batches each method's checks and sizes source readings for the endpoint.
|
| 5 |
+
Both answer-label confidences are saved; the issue-bearing label supplies the score.
|
| 6 |
+
Failures are saved once and count as wrong decisions, never as model scores.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import atexit
|
| 13 |
+
from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait
|
| 14 |
+
import hashlib
|
| 15 |
+
import importlib.util
|
| 16 |
+
import json
|
| 17 |
+
import os
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
import subprocess
|
| 20 |
+
import threading
|
| 21 |
+
import time
|
| 22 |
+
from urllib.error import HTTPError
|
| 23 |
+
from urllib.request import Request, urlopen
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
ROOT = Path(__file__).resolve().parent
|
| 27 |
+
MODEL = 'fastino/GLiNER-2.5-Decide'
|
| 28 |
+
API = 'https://api.fastino.ai/v1/chat/completions'
|
| 29 |
+
PRICE = .03
|
| 30 |
+
PROTOCOL = 'gliner25-decide-perch-sized-classification-v1'
|
| 31 |
+
spec = importlib.util.spec_from_file_location('perch_benchmark', ROOT / 'benchmark.py')
|
| 32 |
+
core = importlib.util.module_from_spec(spec)
|
| 33 |
+
spec.loader.exec_module(core)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class AccountError(RuntimeError):
|
| 37 |
+
pass
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class SizeError(RuntimeError):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class PerchSizer:
|
| 45 |
+
def __init__(self, source, cache):
|
| 46 |
+
self.lock = threading.Lock()
|
| 47 |
+
self.closed = False
|
| 48 |
+
self.process = subprocess.Popen(['node', str(ROOT / 'perch-sizing.mjs'), str(source), str(cache)],
|
| 49 |
+
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True, bufsize=1)
|
| 50 |
+
atexit.register(self.close)
|
| 51 |
+
|
| 52 |
+
def plan(self, side, checks, state_budget, request_budget, max_questions):
|
| 53 |
+
with self.lock:
|
| 54 |
+
self.process.stdin.write(json.dumps({'side': side, 'checks': checks,
|
| 55 |
+
'stateBudget': state_budget, 'requestBudget': request_budget,
|
| 56 |
+
'maxQuestions': max_questions}) + '\n')
|
| 57 |
+
self.process.stdin.flush()
|
| 58 |
+
line = self.process.stdout.readline()
|
| 59 |
+
if not line:
|
| 60 |
+
raise RuntimeError('Perch sizing process stopped')
|
| 61 |
+
result = json.loads(line)
|
| 62 |
+
if result.get('error'):
|
| 63 |
+
if result.get('name') == 'ContextLimitError':
|
| 64 |
+
raise SizeError(result['error'])
|
| 65 |
+
raise RuntimeError(result['error'])
|
| 66 |
+
return result['readings']
|
| 67 |
+
|
| 68 |
+
def close(self):
|
| 69 |
+
if self.closed:
|
| 70 |
+
return
|
| 71 |
+
self.closed = True
|
| 72 |
+
self.process.stdin.close()
|
| 73 |
+
try:
|
| 74 |
+
self.process.wait(timeout=10)
|
| 75 |
+
except subprocess.TimeoutExpired:
|
| 76 |
+
self.process.terminate()
|
| 77 |
+
self.process.wait(timeout=5)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def read_rows(path):
|
| 81 |
+
return [json.loads(line) for line in path.read_text().splitlines() if line.strip()] if path.exists() else []
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def questions_for(pair, domain, pack):
|
| 85 |
+
if domain == 'lint':
|
| 86 |
+
rule = ' '.join(pair['rule']['ensure'].split())
|
| 87 |
+
return [{'name': 'semantic', 'question': {
|
| 88 |
+
'instructions': 'Does this method satisfy this requirement?',
|
| 89 |
+
'criteria': {'true': rule, 'false': 'The method violates this requirement: ' + rule}},
|
| 90 |
+
'issue': {'on': False}, 'min': 70}]
|
| 91 |
+
return core.detection_questions(core.scan_questions(pack, domain, pair['language']), domain)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def request_labels(key, state, checks, timeout):
|
| 95 |
+
tasks, task_keys = [], {}
|
| 96 |
+
for check in checks:
|
| 97 |
+
q = check['question']
|
| 98 |
+
task = check['name'] + ': ' + q['instructions']
|
| 99 |
+
labels = [q['criteria']['true'], q['criteria']['false']]
|
| 100 |
+
if len(set(labels)) != 2:
|
| 101 |
+
raise ValueError('Classification requires distinct answer labels')
|
| 102 |
+
tasks.append({'task': task, 'labels': labels, 'multi_label': True, 'top_k': 2})
|
| 103 |
+
task_keys[check['name']] = (task, labels)
|
| 104 |
+
payload = {'model': MODEL,
|
| 105 |
+
'messages': [{'role': 'user', 'content': json.dumps(state, ensure_ascii=False)}],
|
| 106 |
+
'schema': {'classifications': tasks}, 'threshold': 0,
|
| 107 |
+
'include_confidence': True, 'store': False}
|
| 108 |
+
request = Request(API, data=json.dumps(payload, ensure_ascii=False).encode(),
|
| 109 |
+
headers={'Authorization': 'Bearer ' + key, 'Content-Type': 'application/json'})
|
| 110 |
+
start = time.monotonic()
|
| 111 |
+
try:
|
| 112 |
+
with urlopen(request, timeout=timeout) as response:
|
| 113 |
+
result = json.load(response)
|
| 114 |
+
except HTTPError as exc:
|
| 115 |
+
detail = exc.read(500).decode(errors='replace')
|
| 116 |
+
if exc.code in (401, 402, 403):
|
| 117 |
+
raise AccountError(f'Fastino HTTP {exc.code}: {detail}') from None
|
| 118 |
+
if exc.code in (400, 413, 422) and ('input_too_long' in detail or exc.code == 413):
|
| 119 |
+
raise SizeError(f'Fastino HTTP {exc.code}: {detail}') from None
|
| 120 |
+
raise RuntimeError(f'Fastino HTTP {exc.code}: {detail}') from None
|
| 121 |
+
if result['model'] != MODEL:
|
| 122 |
+
raise ValueError('API returned a different model')
|
| 123 |
+
content = json.loads(result['choices'][0]['message']['content'])
|
| 124 |
+
answers = content.get('classifications', content)
|
| 125 |
+
confidences, issue_scores = {}, {}
|
| 126 |
+
for check in checks:
|
| 127 |
+
task, labels = task_keys[check['name']]
|
| 128 |
+
answer = answers[task]
|
| 129 |
+
if not isinstance(answer, list):
|
| 130 |
+
raise ValueError('API did not return both answer-label confidences')
|
| 131 |
+
values = {item['label']: core.probability(item['confidence']) for item in answer}
|
| 132 |
+
if set(values) != set(labels):
|
| 133 |
+
raise ValueError('API returned missing or unexpected answer labels')
|
| 134 |
+
confidences[check['name']] = {'true': values[labels[0]], 'false': values[labels[1]]}
|
| 135 |
+
issue_scores[check['name']] = values[labels[1] if check['issue'].get('on') is False else labels[0]]
|
| 136 |
+
return confidences, issue_scores, result.get('usage', {}), time.monotonic() - start
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def predict(key, pair, role, domain, pack, timeout, sizer, state_budget, request_budget, max_questions):
|
| 140 |
+
checks = questions_for(pair, domain, pack)
|
| 141 |
+
by_name = {check['name']: check for check in checks}
|
| 142 |
+
usage, requests, repacks, spent_readings = {}, 0, 0, []
|
| 143 |
+
start = time.monotonic()
|
| 144 |
+
budget = state_budget
|
| 145 |
+
for attempt in range(9):
|
| 146 |
+
confidences, issue_scores, readings = {}, {}, []
|
| 147 |
+
try:
|
| 148 |
+
plans = sizer.plan(pair[role], checks, budget, request_budget, max_questions)
|
| 149 |
+
def ask_reading(plan, names):
|
| 150 |
+
nonlocal requests, repacks
|
| 151 |
+
requests += 1
|
| 152 |
+
try:
|
| 153 |
+
values, scores, charged, latency = request_labels(key, plan['state'], [by_name[n] for n in names], timeout)
|
| 154 |
+
except SizeError:
|
| 155 |
+
if len(names) == 1:
|
| 156 |
+
raise
|
| 157 |
+
repacks += 1
|
| 158 |
+
middle = (len(names) + 1) // 2
|
| 159 |
+
ask_reading(plan, names[:middle])
|
| 160 |
+
ask_reading(plan, names[middle:])
|
| 161 |
+
return
|
| 162 |
+
for name, value in charged.items():
|
| 163 |
+
if isinstance(value, (int, float)):
|
| 164 |
+
usage[name] = usage.get(name, 0) + value
|
| 165 |
+
for name, score in scores.items():
|
| 166 |
+
if name not in issue_scores or score > issue_scores[name]:
|
| 167 |
+
issue_scores[name], confidences[name] = score, values[name]
|
| 168 |
+
reading = {k: v for k, v in plan.items() if k not in ('state', 'question_names')}
|
| 169 |
+
reading.update(question_names=names, state_sha256=hashlib.sha256(json.dumps(plan['state'], sort_keys=True).encode()).hexdigest(),
|
| 170 |
+
latency_seconds=latency, usage=charged, state_budget=budget)
|
| 171 |
+
readings.append(reading)
|
| 172 |
+
spent_readings.append(reading)
|
| 173 |
+
for plan in plans:
|
| 174 |
+
ask_reading(plan, plan['question_names'])
|
| 175 |
+
break
|
| 176 |
+
except SizeError as exc:
|
| 177 |
+
smaller = budget // 2
|
| 178 |
+
if attempt == 8 or smaller < 128:
|
| 179 |
+
exc.usage, exc.requests = usage, requests
|
| 180 |
+
raise
|
| 181 |
+
budget = smaller
|
| 182 |
+
repacks += 1
|
| 183 |
+
except Exception as exc:
|
| 184 |
+
exc.usage, exc.requests = usage, requests
|
| 185 |
+
raise
|
| 186 |
+
if set(issue_scores) != set(by_name):
|
| 187 |
+
exc = RuntimeError('Not every check received a score')
|
| 188 |
+
exc.usage, exc.requests = usage, requests
|
| 189 |
+
raise exc
|
| 190 |
+
if domain == 'lint':
|
| 191 |
+
score = issue_scores['semantic']
|
| 192 |
+
alert = score > .7
|
| 193 |
+
else:
|
| 194 |
+
score, alert = core.scan_result(issue_scores, checks, domain, .5)
|
| 195 |
+
return {'pair_id': pair['pair_id'], 'role': role, 'domain': domain,
|
| 196 |
+
'model_revision': MODEL, 'protocol_id': PROTOCOL,
|
| 197 |
+
'pack_sha256': pack['pack_sha256'] if domain != 'lint' else None,
|
| 198 |
+
'score': score, 'alert': alert, 'question_scores': issue_scores,
|
| 199 |
+
'answer_confidences': confidences, 'usage': usage, 'api_requests': requests,
|
| 200 |
+
'readings': readings, 'discarded_readings': len(spent_readings) - len(readings),
|
| 201 |
+
'size_repacks': repacks, 'final_state_budget': budget,
|
| 202 |
+
'latency_seconds': time.monotonic() - start}
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def report(pairs, predictions, failures, domain, digest, split):
|
| 206 |
+
counts = dict(tp=0, fp=0, fn=0, tn=0)
|
| 207 |
+
items, eligible, correct, ties = [], 0, 0, 0
|
| 208 |
+
for pair in pairs:
|
| 209 |
+
for role in ('before', 'after'):
|
| 210 |
+
identity = pair['pair_id'], role
|
| 211 |
+
label = pair[role]['labels'][pair['domain'] if domain == 'lint' else domain]
|
| 212 |
+
row = predictions.get(identity)
|
| 213 |
+
if row:
|
| 214 |
+
items.append((label, row['score']))
|
| 215 |
+
counts['tp' if label and row['alert'] else 'fn' if label else 'fp' if row['alert'] else 'tn'] += 1
|
| 216 |
+
elif identity in failures:
|
| 217 |
+
counts['fn' if label else 'fp'] += 1
|
| 218 |
+
if pair['before']['labels'][pair['domain']] == 1 and pair['after']['labels'][pair['domain']] == 0:
|
| 219 |
+
eligible += 1
|
| 220 |
+
before = predictions.get((pair['pair_id'], 'before'))
|
| 221 |
+
after = predictions.get((pair['pair_id'], 'after'))
|
| 222 |
+
if before and after:
|
| 223 |
+
correct += before['score'] > after['score']
|
| 224 |
+
ties += before['score'] == after['score']
|
| 225 |
+
tp, fp, fn, tn = (counts[k] for k in ('tp', 'fp', 'fn', 'tn'))
|
| 226 |
+
tokens = sum(row.get('usage', {}).get('prompt_tokens', 0) for row in [*predictions.values(), *failures.values()])
|
| 227 |
+
return {'domain': domain, 'split': split, 'model_revision': MODEL,
|
| 228 |
+
'protocol_id': PROTOCOL,
|
| 229 |
+
'benchmark_sha256': digest, 'benchmark_pairs': len(pairs),
|
| 230 |
+
'benchmark_methods': 2 * len(pairs), 'answered_methods': len(predictions),
|
| 231 |
+
'failed_methods': len(failures),
|
| 232 |
+
'complete': len(predictions) + len(failures) == 2 * len(pairs),
|
| 233 |
+
'failure_policy': 'failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering',
|
| 234 |
+
'confusion': counts, 'precision': tp / (tp + fp) if tp + fp else 0,
|
| 235 |
+
'recall': tp / (tp + fn) if tp + fn else 0,
|
| 236 |
+
'false_positive_rate': fp / (fp + tn) if fp + tn else 0,
|
| 237 |
+
'f1': 2 * tp / (2 * tp + fp + fn) if 2 * tp + fp + fn else 0,
|
| 238 |
+
'average_precision_answered_methods': core.average_precision(items) if items else None,
|
| 239 |
+
'vulnerable_or_buggy_before_above_fixed_after': {'correct': correct, 'ties': ties, 'eligible': eligible},
|
| 240 |
+
'input_tokens': tokens, 'inference_cost_usd': tokens * PRICE / 1_000_000,
|
| 241 |
+
'cost_basis': 'API-reported prompt tokens; failed requests have no returned usage'}
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def main():
|
| 245 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 246 |
+
parser.add_argument('--manifest', type=Path, help='Suite manifest listing local datasets and their SHA-256 hashes')
|
| 247 |
+
parser.add_argument('--domain', choices=('bug', 'security', 'lint'), help='Run one public benchmark instead of a suite manifest')
|
| 248 |
+
parser.add_argument('--dataset', type=Path, help='Local benchmark.jsonl; otherwise download the public dataset')
|
| 249 |
+
parser.add_argument('--out', type=Path, required=True)
|
| 250 |
+
parser.add_argument('--question-pack', type=Path, default=ROOT / 'question-pack.json')
|
| 251 |
+
parser.add_argument('--workers', type=int, default=8)
|
| 252 |
+
parser.add_argument('--timeout', type=float, default=45)
|
| 253 |
+
parser.add_argument('--budget', type=float, default=10)
|
| 254 |
+
parser.add_argument('--limit', type=int, default=0, help='Maximum newly attempted method sides')
|
| 255 |
+
parser.add_argument('--keychain-service', default='perch-fastino-api-key')
|
| 256 |
+
parser.add_argument('--perch-source', type=Path, default=os.getenv('PERCH_SOURCE'))
|
| 257 |
+
parser.add_argument('--state-budget', type=int, default=1200)
|
| 258 |
+
parser.add_argument('--request-budget', type=int, default=1800)
|
| 259 |
+
parser.add_argument('--max-questions', type=int)
|
| 260 |
+
parser.add_argument('--score-saved', action='store_true')
|
| 261 |
+
args = parser.parse_args()
|
| 262 |
+
if bool(args.manifest) == bool(args.domain):
|
| 263 |
+
parser.error('Use either --manifest or --domain')
|
| 264 |
+
if args.workers < 1 or args.timeout <= 0 or args.budget <= 0 or args.limit < 0:
|
| 265 |
+
parser.error('Workers, timeout, and budget must be positive; limit must be nonnegative')
|
| 266 |
+
if args.state_budget < 128 or args.request_budget <= args.state_budget:
|
| 267 |
+
parser.error('State budget must be at least 128 and smaller than the request budget')
|
| 268 |
+
if args.manifest:
|
| 269 |
+
manifest = json.loads(args.manifest.read_text())
|
| 270 |
+
else:
|
| 271 |
+
path = args.dataset
|
| 272 |
+
if path is None:
|
| 273 |
+
url = ('https://huggingface.co/datasets/perchscan/perch-lint-bench-public/resolve/main/benchmark.jsonl'
|
| 274 |
+
if args.domain == 'lint' else core.DATASET_URL[args.domain])
|
| 275 |
+
with urlopen(url, timeout=120) as response:
|
| 276 |
+
raw = response.read()
|
| 277 |
+
args.out.mkdir(parents=True, exist_ok=True)
|
| 278 |
+
path = args.out / 'benchmark.jsonl'
|
| 279 |
+
path.write_bytes(raw)
|
| 280 |
+
manifest = {'datasets': [{'split': 'public', 'domain': args.domain, 'path': str(path),
|
| 281 |
+
'sha256': hashlib.sha256(path.read_bytes()).hexdigest()}]}
|
| 282 |
+
pack = core.load_pack(args.question_pack)
|
| 283 |
+
sizing = {'state_budget': args.state_budget, 'request_budget': args.request_budget,
|
| 284 |
+
'max_questions': args.max_questions,
|
| 285 |
+
'adapter_sha256': hashlib.sha256((ROOT / 'perch-sizing.mjs').read_bytes()).hexdigest()}
|
| 286 |
+
if args.perch_source:
|
| 287 |
+
revision_file = args.perch_source / 'revision.json'
|
| 288 |
+
if revision_file.exists():
|
| 289 |
+
revision = json.loads(revision_file.read_text())
|
| 290 |
+
sizing['perch_revision'] = revision.get('revision', revision.get('sha'))
|
| 291 |
+
else:
|
| 292 |
+
sizing['perch_revision'] = subprocess.check_output(
|
| 293 |
+
['git', '-C', str(args.perch_source), 'rev-parse', 'HEAD'], text=True).strip()
|
| 294 |
+
groups, pending = [], []
|
| 295 |
+
for dataset in manifest['datasets']:
|
| 296 |
+
raw = Path(dataset['path']).read_bytes()
|
| 297 |
+
digest = hashlib.sha256(raw).hexdigest()
|
| 298 |
+
if digest != dataset['sha256']:
|
| 299 |
+
raise ValueError('Dataset checksum changed')
|
| 300 |
+
pairs = [json.loads(line) for line in raw.splitlines() if line]
|
| 301 |
+
directory = args.out / dataset['split'] / dataset['domain']
|
| 302 |
+
directory.mkdir(parents=True, exist_ok=True)
|
| 303 |
+
preds = {(r['pair_id'], r['role']): r for r in read_rows(directory / 'predictions.jsonl')}
|
| 304 |
+
fails = {(r['pair_id'], r['role']): r for r in read_rows(directory / 'failures.jsonl')}
|
| 305 |
+
expected = {(p['pair_id'], role) for p in pairs for role in ('before', 'after')}
|
| 306 |
+
if set(preds) & set(fails) or not (set(preds) | set(fails)) <= expected:
|
| 307 |
+
raise ValueError('Incompatible or duplicate saved outcomes')
|
| 308 |
+
if any(r['model_revision'] != MODEL or r['dataset_sha256'] != digest or r['protocol_id'] != PROTOCOL for r in [*preds.values(), *fails.values()]):
|
| 309 |
+
raise ValueError('Saved outcomes mix models or datasets')
|
| 310 |
+
saved_sizing = {json.dumps(r['sizing'], sort_keys=True) for r in [*preds.values(), *fails.values()]}
|
| 311 |
+
if len(saved_sizing) > 1:
|
| 312 |
+
raise ValueError('Saved outcomes mix sizing configurations')
|
| 313 |
+
if saved_sizing:
|
| 314 |
+
recorded = json.loads(next(iter(saved_sizing)))
|
| 315 |
+
if args.score_saved:
|
| 316 |
+
if groups and sizing != recorded:
|
| 317 |
+
raise ValueError('Suite outcomes mix sizing configurations')
|
| 318 |
+
sizing = recorded
|
| 319 |
+
elif sizing != recorded:
|
| 320 |
+
raise ValueError('Sizing configuration changed; use a new output directory')
|
| 321 |
+
group = dict(pairs=pairs, predictions=preds, failures=fails, directory=directory,
|
| 322 |
+
domain=dataset['domain'], split=dataset['split'], digest=digest)
|
| 323 |
+
groups.append(group)
|
| 324 |
+
for pair in pairs:
|
| 325 |
+
for role in ('before', 'after'):
|
| 326 |
+
if (pair['pair_id'], role) not in preds and (pair['pair_id'], role) not in fails:
|
| 327 |
+
pending.append((group, pair, role))
|
| 328 |
+
spent = sum(r.get('usage', {}).get('prompt_tokens', 0) for g in groups for r in [*g['predictions'].values(), *g['failures'].values()]) * PRICE / 1_000_000
|
| 329 |
+
def save_reports():
|
| 330 |
+
reports = []
|
| 331 |
+
for g in groups:
|
| 332 |
+
r = report(g['pairs'], g['predictions'], g['failures'], g['domain'], g['digest'], g['split'])
|
| 333 |
+
r['sizing'] = sizing
|
| 334 |
+
r['question_pack_sha256'] = pack['pack_sha256'] if g['domain'] != 'lint' else None
|
| 335 |
+
(g['directory'] / 'report.json').write_text(json.dumps(r, indent=2) + '\n')
|
| 336 |
+
reports.append(r)
|
| 337 |
+
(args.out / 'status.json').write_text(json.dumps({'model': MODEL, 'reports': reports,
|
| 338 |
+
'reported_cost_usd': sum(r['inference_cost_usd'] for r in reports),
|
| 339 |
+
'complete': all(r['complete'] for r in reports)}, indent=2) + '\n')
|
| 340 |
+
save_reports()
|
| 341 |
+
if args.score_saved or not pending:
|
| 342 |
+
return
|
| 343 |
+
if not args.perch_source:
|
| 344 |
+
parser.error('Set PERCH_SOURCE or --perch-source to the public Perch source checkout with npm dependencies installed')
|
| 345 |
+
sizer = PerchSizer(args.perch_source, args.out / '.sizing')
|
| 346 |
+
key = os.getenv('FASTINO_API_KEY') or subprocess.check_output(
|
| 347 |
+
['security', 'find-generic-password', '-s', args.keychain_service, '-w'], text=True).strip()
|
| 348 |
+
if args.limit:
|
| 349 |
+
pending = pending[:args.limit]
|
| 350 |
+
iterator = iter(pending)
|
| 351 |
+
with ThreadPoolExecutor(max_workers=args.workers) as pool:
|
| 352 |
+
active = {}
|
| 353 |
+
def submit():
|
| 354 |
+
if spent >= args.budget:
|
| 355 |
+
return False
|
| 356 |
+
item = next(iterator, None)
|
| 357 |
+
if item is None:
|
| 358 |
+
return False
|
| 359 |
+
g, pair, role = item
|
| 360 |
+
active[pool.submit(predict, key, pair, role, g['domain'], pack, args.timeout,
|
| 361 |
+
sizer, args.state_budget, args.request_budget, args.max_questions)] = item
|
| 362 |
+
return True
|
| 363 |
+
for _ in range(args.workers):
|
| 364 |
+
submit()
|
| 365 |
+
attempted = 0
|
| 366 |
+
try:
|
| 367 |
+
while active:
|
| 368 |
+
done, _ = wait(active, return_when=FIRST_COMPLETED)
|
| 369 |
+
for future in done:
|
| 370 |
+
g, pair, role = active.pop(future)
|
| 371 |
+
identity = pair['pair_id'], role
|
| 372 |
+
try:
|
| 373 |
+
row = future.result()
|
| 374 |
+
except AccountError:
|
| 375 |
+
for queued in active:
|
| 376 |
+
queued.cancel()
|
| 377 |
+
raise
|
| 378 |
+
except Exception as exc:
|
| 379 |
+
row = {'pair_id': pair['pair_id'], 'role': role, 'domain': g['domain'],
|
| 380 |
+
'model_revision': MODEL, 'dataset_sha256': g['digest'],
|
| 381 |
+
'protocol_id': PROTOCOL, 'status': 'failed', 'error': str(exc),
|
| 382 |
+
'sizing': sizing,
|
| 383 |
+
'usage': getattr(exc, 'usage', {}), 'api_requests': getattr(exc, 'requests', 0)}
|
| 384 |
+
g['failures'][identity] = row
|
| 385 |
+
spent += row['usage'].get('prompt_tokens', 0) * PRICE / 1_000_000
|
| 386 |
+
with (g['directory'] / 'failures.jsonl').open('a') as stream:
|
| 387 |
+
stream.write(json.dumps(row) + '\n')
|
| 388 |
+
print(f"{g['split']}/{g['domain']}: failed {pair['pair_id']}:{role}: {exc}", flush=True)
|
| 389 |
+
else:
|
| 390 |
+
row['dataset_sha256'] = g['digest']
|
| 391 |
+
row['sizing'] = sizing
|
| 392 |
+
g['predictions'][identity] = row
|
| 393 |
+
spent += row.get('usage', {}).get('prompt_tokens', 0) * PRICE / 1_000_000
|
| 394 |
+
with (g['directory'] / 'predictions.jsonl').open('a') as stream:
|
| 395 |
+
stream.write(json.dumps(row) + '\n')
|
| 396 |
+
attempted += 1
|
| 397 |
+
if attempted % 50 == 0 or not active:
|
| 398 |
+
save_reports()
|
| 399 |
+
print(f"Attempted {attempted}/{len(pending)} new methods; reported cost ${spent:.4f}", flush=True)
|
| 400 |
+
submit()
|
| 401 |
+
finally:
|
| 402 |
+
save_reports()
|
| 403 |
+
print('Completed all scheduled method sides.', flush=True)
|
| 404 |
+
sizer.close()
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
if __name__ == '__main__':
|
| 408 |
+
main()
|
perch-sizing.mjs
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** Size saved benchmark methods with Perch's request and source-chunking code. */
|
| 2 |
+
import { createRequire } from 'node:module';
|
| 3 |
+
import { createInterface } from 'node:readline';
|
| 4 |
+
import { mkdirSync, existsSync, symlinkSync } from 'node:fs';
|
| 5 |
+
import { resolve, join, dirname } from 'node:path';
|
| 6 |
+
import { pathToFileURL } from 'node:url';
|
| 7 |
+
import { createHash } from 'node:crypto';
|
| 8 |
+
|
| 9 |
+
const [source, cache] = process.argv.slice(2).map(value => resolve(value));
|
| 10 |
+
if (!source || !cache) throw new Error('Usage: node perch-sizing.mjs PERCH_SOURCE CACHE_DIR');
|
| 11 |
+
mkdirSync(cache, { recursive: true });
|
| 12 |
+
if (!existsSync(join(cache, 'node_modules'))) symlinkSync(join(source, 'node_modules'), join(cache, 'node_modules'), 'dir');
|
| 13 |
+
if (!existsSync(join(dirname(cache), 'scan.yaml'))) symlinkSync(join(source, 'scan.yaml'), join(dirname(cache), 'scan.yaml'));
|
| 14 |
+
const require = createRequire(join(source, 'package.json'));
|
| 15 |
+
const { build } = require('esbuild');
|
| 16 |
+
const library = join(cache, 'perch-sizing-lib.mjs');
|
| 17 |
+
await build({ stdin: {
|
| 18 |
+
contents: `export { methodSteps } from ${JSON.stringify(join(source, 'src/questions.js'))};\nexport { questionBatches, estimateTokens } from ${JSON.stringify(join(source, 'src/tokens.js'))};`,
|
| 19 |
+
resolveDir: source, sourcefile: 'benchmark-sizing.mjs', loader: 'js',
|
| 20 |
+
}, outfile: library, bundle: true, packages: 'external', platform: 'node', format: 'esm', logLevel: 'silent' });
|
| 21 |
+
const { methodSteps, questionBatches, estimateTokens } = await import(pathToFileURL(library));
|
| 22 |
+
|
| 23 |
+
function unnumber(source) {
|
| 24 |
+
return String(source ?? '').split('\n').filter(line => !/^\.\.\. \(\d+ (?:lines above|more lines)\)$/.test(line))
|
| 25 |
+
.map(line => line.replace(/^L\d+\| ?/, '')).join('\n');
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
function methodInput(side) {
|
| 29 |
+
const state = side.state, method = state.method;
|
| 30 |
+
const body = side.source ?? unnumber(method.source);
|
| 31 |
+
const comment = method.leading_comment ?? '';
|
| 32 |
+
const prefix = comment ? comment.split('\n') : [];
|
| 33 |
+
const lines = [...prefix, ...body.split('\n')];
|
| 34 |
+
const id = method.id ?? `${method.path}::${method.name}`;
|
| 35 |
+
const node = { id, path: method.path, qualified_name: method.name, line: prefix.length + 1, end_line: lines.length, metrics: method.metrics };
|
| 36 |
+
const names = new Map([[method.name, id], [id, id]]);
|
| 37 |
+
const neighbor = item => {
|
| 38 |
+
const text = unnumber(item.source), firstLine = Number(String(item.source ?? '').match(/^L(\d+)\|/m)?.[1] ?? 1);
|
| 39 |
+
const lines = text.split('\n');
|
| 40 |
+
const id = item.id ?? `${item.path}::${item.name}`;
|
| 41 |
+
names.set(item.name, id); names.set(id, id);
|
| 42 |
+
return { node: { id, path: item.path, qualified_name: item.name, line: 1, end_line: lines.length, metrics: item.metrics },
|
| 43 |
+
lines, ...(item.calls_method_at ? { site: Math.max(1, item.calls_method_at - firstLine + 1) } : {}), handover: item.handover ?? false };
|
| 44 |
+
};
|
| 45 |
+
const callees = (state.calls ?? []).map(neighbor), callers = (state.called_by ?? []).map(neighbor);
|
| 46 |
+
const edges = (state.call_graph ?? []).map(edge => Array.isArray(edge) ? edge : String(edge).split(' -> '))
|
| 47 |
+
.filter(edge => edge.length === 2).map(edge => edge.map(name => names.get(name) ?? name));
|
| 48 |
+
return { node, lines, callees, callers, edges };
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function plan({ side, checks, stateBudget, requestBudget, maxQuestions }) {
|
| 52 |
+
const target = side.source ?? unnumber(side.state.method.source);
|
| 53 |
+
const bytes = Buffer.byteLength(target);
|
| 54 |
+
const questions = Object.fromEntries(checks.map(check => [check.name, {
|
| 55 |
+
type: 'choice', instructions: check.name + ': ' + check.question.instructions,
|
| 56 |
+
criteria: check.question.criteria,
|
| 57 |
+
}]));
|
| 58 |
+
const limits = { state: stateBudget, single: requestBudget, request: requestBudget, questions: maxQuestions ?? Infinity, options: 2 };
|
| 59 |
+
let steps, leadingCommentOmitted = false;
|
| 60 |
+
if (estimateTokens(side.state) <= stateBudget && unnumber(side.state.method.source).includes(target.trim()))
|
| 61 |
+
steps = [{ state: side.state, covers: { start_byte: 0, end_byte: bytes } }];
|
| 62 |
+
else {
|
| 63 |
+
try { steps = methodSteps({ ...methodInput(side), budget: stateBudget, asked: [] }); }
|
| 64 |
+
catch (error) {
|
| 65 |
+
if (error.name !== 'ContextLimitError' || !side.state.method.leading_comment) throw error;
|
| 66 |
+
// The saved leading comment is surrounding context, outside the canonical target source.
|
| 67 |
+
const withoutComment = { ...side, state: { ...side.state, method: { ...side.state.method, leading_comment: null } } };
|
| 68 |
+
steps = methodSteps({ ...methodInput(withoutComment), budget: stateBudget, asked: [] });
|
| 69 |
+
leadingCommentOmitted = true;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
let covered = 0;
|
| 73 |
+
for (const step of steps) {
|
| 74 |
+
if (step.covers.start_byte > covered) throw new Error('Source readings leave a gap in the target method');
|
| 75 |
+
covered = Math.max(covered, step.covers.end_byte);
|
| 76 |
+
}
|
| 77 |
+
if (covered !== bytes) throw new Error('Source readings do not cover the complete target method');
|
| 78 |
+
const readings = [];
|
| 79 |
+
for (let index = 0; index < steps.length; index++) {
|
| 80 |
+
const step = steps[index];
|
| 81 |
+
for (const batch of questionBatches(step.state, questions, limits)) readings.push({
|
| 82 |
+
state: step.state, question_names: Object.keys(batch),
|
| 83 |
+
source_reading: step.state.reading ?? null, covers: step.covers ?? null,
|
| 84 |
+
source_pass: index, source_passes: steps.length, estimated_state_tokens: estimateTokens(step.state),
|
| 85 |
+
target_source_bytes: bytes, target_source_sha256: createHash('sha256').update(target).digest('hex'),
|
| 86 |
+
leading_comment_omitted: leadingCommentOmitted,
|
| 87 |
+
});
|
| 88 |
+
}
|
| 89 |
+
return readings;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
for await (const line of createInterface({ input: process.stdin, crlfDelay: Infinity })) {
|
| 93 |
+
if (!line.trim()) continue;
|
| 94 |
+
try { process.stdout.write(JSON.stringify({ readings: plan(JSON.parse(line)) }) + '\n'); }
|
| 95 |
+
catch (error) { process.stdout.write(JSON.stringify({ error: error.message, name: error.name }) + '\n'); }
|
| 96 |
+
}
|
predictions/current/bug/gliner25-decide.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33d9f9a780c9a2de4c27a64535b3e8a8b5cffc7771922e8b4a8cc0ffb8883d89
|
| 3 |
+
size 12338489
|
predictions/current/lint/gliner25-decide.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e737f22f09804dd314134013587b51d8b9895e303c07c4f753682f04f8d9e02
|
| 3 |
+
size 727671
|
predictions/current/security/gliner25-decide.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:991c295fb93028a632b7b3af198ec845377f833278d7c7ba3772a1d994049f80
|
| 3 |
+
size 26258297
|
results-current.jsonl
CHANGED
|
@@ -40,3 +40,9 @@
|
|
| 40 |
{"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4916331564208488, "benchmark_methods": 878, "benchmark_pairs": 439, "confusion": {"fn": 363, "fp": 30, "tn": 450, "tp": 35}, "domain": "security", "f1": 0.1511879049676026, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.20261235, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5025125628140703, "pair_order_correct": 200, "pair_order_eligible": 398, "precision": 0.5384615384615384, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08793969849246232, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
|
| 41 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9489849049042018, "benchmark_methods": 428, "benchmark_pairs": 214, "confusion": {"fn": 82, "fp": 6, "tn": 208, "tp": 132}, "domain": "lint", "f1": 0.75, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.049926450000000004, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.9532710280373832, "pair_order_correct": 204, "pair_order_eligible": 214, "precision": 0.9565217391304348, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.616822429906542, "run_id": "typellm-20260930", "threshold": 0.7, "track": "public"}
|
| 42 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9441042508382544, "benchmark_methods": 142, "benchmark_pairs": 71, "confusion": {"fn": 29, "fp": 4, "tn": 67, "tp": 42}, "domain": "lint", "f1": 0.717948717948718, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.0159958, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9130434782608695, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.5915492957746479, "run_id": "typellm-20260930", "threshold": 0.7, "track": "private"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
{"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4916331564208488, "benchmark_methods": 878, "benchmark_pairs": 439, "confusion": {"fn": 363, "fp": 30, "tn": 450, "tp": 35}, "domain": "security", "f1": 0.1511879049676026, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.20261235, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5025125628140703, "pair_order_correct": 200, "pair_order_eligible": 398, "precision": 0.5384615384615384, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08793969849246232, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
|
| 41 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9489849049042018, "benchmark_methods": 428, "benchmark_pairs": 214, "confusion": {"fn": 82, "fp": 6, "tn": 208, "tp": 132}, "domain": "lint", "f1": 0.75, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.049926450000000004, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.9532710280373832, "pair_order_correct": 204, "pair_order_eligible": 214, "precision": 0.9565217391304348, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.616822429906542, "run_id": "typellm-20260930", "threshold": 0.7, "track": "public"}
|
| 42 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9441042508382544, "benchmark_methods": 142, "benchmark_pairs": 71, "confusion": {"fn": 29, "fp": 4, "tn": 67, "tp": 42}, "domain": "lint", "f1": 0.717948717948718, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.0159958, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9130434782608695, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.5915492957746479, "run_id": "typellm-20260930", "threshold": 0.7, "track": "private"}
|
| 43 |
+
{"alert_rule": "rule violation confidence > 0.7", "answered_methods": 428, "average_precision_answered_methods": 0.5287989800050326, "benchmark_methods": 428, "benchmark_pairs": 214, "benchmark_sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75", "complete": true, "confusion": {"fn": 214, "fp": 0, "tn": 214, "tp": 0}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "lint", "f1": 0.0, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.0, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.010324469999999999, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 344149, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.5934579439252337, "pair_order_correct": 127, "pair_order_eligible": 214, "precision": 0, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": null, "recall": 0.0, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "public", "threshold": 0.7, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 127, "eligible": 214, "ties": 7}}
|
| 44 |
+
{"alert_rule": "rule violation confidence > 0.7", "answered_methods": 142, "average_precision_answered_methods": 0.5264561177710998, "benchmark_methods": 142, "benchmark_pairs": 71, "benchmark_sha256": "a6e9f2e4ee8ae77bdaf23af46920d97d1ba47375dc9ce03b950cdbe95c2777f9", "complete": true, "confusion": {"fn": 71, "fp": 0, "tn": 71, "tp": 0}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "lint", "f1": 0.0, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.0, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.0035382, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 117940, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.6338028169014085, "pair_order_correct": 45, "pair_order_eligible": 71, "precision": 0, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": null, "recall": 0.0, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "private", "threshold": 0.7, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 45, "eligible": 71, "ties": 1}}
|
| 45 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 4440, "average_precision_answered_methods": 0.422300940463931, "benchmark_methods": 4440, "benchmark_pairs": 2220, "benchmark_sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2", "complete": true, "confusion": {"fn": 1818, "fp": 54, "tn": 2525, "tp": 43}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "bug", "f1": 0.043922369765066395, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.02093834819697557, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.17524755, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 5841585, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.5173961840628507, "pair_order_correct": 922, "pair_order_eligible": 1782, "precision": 0.44329896907216493, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.0231058570660935, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "public", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 922, "eligible": 1782, "ties": 121}}
|
| 46 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 996, "average_precision_answered_methods": 0.43547986367375113, "benchmark_methods": 996, "benchmark_pairs": 498, "benchmark_sha256": "3df4ade65fedd1128d30bc17c9c9869c8ab9bd526e666156d0e16685e78f8a73", "complete": true, "confusion": {"fn": 417, "fp": 12, "tn": 560, "tp": 7}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "bug", "f1": 0.03160270880361174, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.02097902097902098, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.039281729999999994, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 1309391, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.5211970074812967, "pair_order_correct": 209, "pair_order_eligible": 401, "precision": 0.3684210526315789, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.01650943396226415, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "private", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 209, "eligible": 401, "ties": 28}}
|
| 47 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 2616, "average_precision_answered_methods": 0.4560152509236216, "benchmark_methods": 2622, "benchmark_pairs": 1311, "benchmark_sha256": "2407059caa3486371749884138b997d89043eec646e548ee8f44ba3ab08514b8", "complete": true, "confusion": {"fn": 1118, "fp": 23, "tn": 1457, "tp": 24}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "security", "f1": 0.040370058873002525, "failed_methods": 6, "failure_counts": {"other": 6}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.015540540540540541, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.43368182999999993, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 14456061, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.45729537366548045, "pair_order_correct": 514, "pair_order_eligible": 1124, "precision": 0.5106382978723404, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.021015761821366025, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "public", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 514, "eligible": 1124, "ties": 35}}
|
| 48 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 877, "average_precision_answered_methods": 0.44020539336977416, "benchmark_methods": 878, "benchmark_pairs": 439, "benchmark_sha256": "a4b81728e9e520cf1c6f342974bec369d72f5b7d8aabc1c9cf2aceba966f8051", "complete": true, "confusion": {"fn": 390, "fp": 7, "tn": 473, "tp": 8}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "security", "f1": 0.0387409200968523, "failed_methods": 1, "failure_counts": {"other": 1}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.014583333333333334, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.14154047999999997, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 4718016, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.4949748743718593, "pair_order_correct": 197, "pair_order_eligible": 398, "precision": 0.5333333333333333, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.020100502512562814, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "private", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 197, "eligible": 398, "ties": 8}}
|
results.jsonl
CHANGED
|
@@ -86,3 +86,9 @@
|
|
| 86 |
{"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4916331564208488, "benchmark_methods": 878, "benchmark_pairs": 439, "confusion": {"fn": 363, "fp": 30, "tn": 450, "tp": 35}, "domain": "security", "f1": 0.1511879049676026, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.20261235, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5025125628140703, "pair_order_correct": 200, "pair_order_eligible": 398, "precision": 0.5384615384615384, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08793969849246232, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
|
| 87 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9489849049042018, "benchmark_methods": 428, "benchmark_pairs": 214, "confusion": {"fn": 82, "fp": 6, "tn": 208, "tp": 132}, "domain": "lint", "f1": 0.75, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.049926450000000004, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.9532710280373832, "pair_order_correct": 204, "pair_order_eligible": 214, "precision": 0.9565217391304348, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.616822429906542, "run_id": "typellm-20260930", "threshold": 0.7, "track": "public"}
|
| 88 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9441042508382544, "benchmark_methods": 142, "benchmark_pairs": 71, "confusion": {"fn": 29, "fp": 4, "tn": 67, "tp": 42}, "domain": "lint", "f1": 0.717948717948718, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.0159958, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9130434782608695, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.5915492957746479, "run_id": "typellm-20260930", "threshold": 0.7, "track": "private"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
{"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4916331564208488, "benchmark_methods": 878, "benchmark_pairs": 439, "confusion": {"fn": 363, "fp": 30, "tn": 450, "tp": 35}, "domain": "security", "f1": 0.1511879049676026, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.20261235, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5025125628140703, "pair_order_correct": 200, "pair_order_eligible": 398, "precision": 0.5384615384615384, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08793969849246232, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
|
| 87 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9489849049042018, "benchmark_methods": 428, "benchmark_pairs": 214, "confusion": {"fn": 82, "fp": 6, "tn": 208, "tp": 132}, "domain": "lint", "f1": 0.75, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.049926450000000004, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.9532710280373832, "pair_order_correct": 204, "pair_order_eligible": 214, "precision": 0.9565217391304348, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.616822429906542, "run_id": "typellm-20260930", "threshold": 0.7, "track": "public"}
|
| 88 |
{"alert_rule": "rule violation score > 0.7", "average_precision": 0.9441042508382544, "benchmark_methods": 142, "benchmark_pairs": 71, "confusion": {"fn": 29, "fp": 4, "tn": 67, "tp": 42}, "domain": "lint", "f1": 0.717948717948718, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.0159958, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9130434782608695, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.5915492957746479, "run_id": "typellm-20260930", "threshold": 0.7, "track": "private"}
|
| 89 |
+
{"alert_rule": "rule violation confidence > 0.7", "answered_methods": 428, "average_precision_answered_methods": 0.5287989800050326, "benchmark_methods": 428, "benchmark_pairs": 214, "benchmark_sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75", "complete": true, "confusion": {"fn": 214, "fp": 0, "tn": 214, "tp": 0}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "lint", "f1": 0.0, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.0, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.010324469999999999, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 344149, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.5934579439252337, "pair_order_correct": 127, "pair_order_eligible": 214, "precision": 0, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": null, "recall": 0.0, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "public", "threshold": 0.7, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 127, "eligible": 214, "ties": 7}}
|
| 90 |
+
{"alert_rule": "rule violation confidence > 0.7", "answered_methods": 142, "average_precision_answered_methods": 0.5264561177710998, "benchmark_methods": 142, "benchmark_pairs": 71, "benchmark_sha256": "a6e9f2e4ee8ae77bdaf23af46920d97d1ba47375dc9ce03b950cdbe95c2777f9", "complete": true, "confusion": {"fn": 71, "fp": 0, "tn": 71, "tp": 0}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "lint", "f1": 0.0, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.0, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.0035382, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 117940, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.6338028169014085, "pair_order_correct": 45, "pair_order_eligible": 71, "precision": 0, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": null, "recall": 0.0, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "private", "threshold": 0.7, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 45, "eligible": 71, "ties": 1}}
|
| 91 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 4440, "average_precision_answered_methods": 0.422300940463931, "benchmark_methods": 4440, "benchmark_pairs": 2220, "benchmark_sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2", "complete": true, "confusion": {"fn": 1818, "fp": 54, "tn": 2525, "tp": 43}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "bug", "f1": 0.043922369765066395, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.02093834819697557, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.17524755, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 5841585, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.5173961840628507, "pair_order_correct": 922, "pair_order_eligible": 1782, "precision": 0.44329896907216493, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.0231058570660935, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "public", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 922, "eligible": 1782, "ties": 121}}
|
| 92 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 996, "average_precision_answered_methods": 0.43547986367375113, "benchmark_methods": 996, "benchmark_pairs": 498, "benchmark_sha256": "3df4ade65fedd1128d30bc17c9c9869c8ab9bd526e666156d0e16685e78f8a73", "complete": true, "confusion": {"fn": 417, "fp": 12, "tn": 560, "tp": 7}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "bug", "f1": 0.03160270880361174, "failed_methods": 0, "failure_counts": {}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.02097902097902098, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.039281729999999994, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 1309391, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.5211970074812967, "pair_order_correct": 209, "pair_order_eligible": 401, "precision": 0.3684210526315789, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.01650943396226415, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "private", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 209, "eligible": 401, "ties": 28}}
|
| 93 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 2616, "average_precision_answered_methods": 0.4560152509236216, "benchmark_methods": 2622, "benchmark_pairs": 1311, "benchmark_sha256": "2407059caa3486371749884138b997d89043eec646e548ee8f44ba3ab08514b8", "complete": true, "confusion": {"fn": 1118, "fp": 23, "tn": 1457, "tp": 24}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "security", "f1": 0.040370058873002525, "failed_methods": 6, "failure_counts": {"other": 6}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.015540540540540541, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.43368182999999993, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 14456061, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.45729537366548045, "pair_order_correct": 514, "pair_order_eligible": 1124, "precision": 0.5106382978723404, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.021015761821366025, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "public", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 514, "eligible": 1124, "ties": 35}}
|
| 94 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 877, "average_precision_answered_methods": 0.44020539336977416, "benchmark_methods": 878, "benchmark_pairs": 439, "benchmark_sha256": "a4b81728e9e520cf1c6f342974bec369d72f5b7d8aabc1c9cf2aceba966f8051", "complete": true, "confusion": {"fn": 390, "fp": 7, "tn": 473, "tp": 8}, "cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "domain": "security", "f1": 0.0387409200968523, "failed_methods": 1, "failure_counts": {"other": 1}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.014583333333333334, "inference_cost_basis": "API-reported prompt tokens; failed requests have no returned usage", "inference_cost_usd": 0.14154047999999997, "inference_endpoint": "https://api.fastino.ai/v1/chat/completions", "inference_host": "Fastino API", "input_tokens": 4718016, "model_id": "gliner25-decide", "model_revision": "fastino/GLiNER-2.5-Decide", "pair_order": 0.4949748743718593, "pair_order_correct": 197, "pair_order_eligible": 398, "precision": 0.5333333333333333, "protocol_id": "gliner25-decide-perch-sized-classification-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.020100502512562814, "run_id": "gliner25-decide-perch-sized-20261002", "sizing": {"adapter_sha256": "6be2c1e0003b8181ea7725193c039ed21b3a86fa80bafe46f99d7759b76c6b93", "max_questions": null, "perch_revision": "3db94f007ca49433c816b4a3855253d15f7b8139", "request_budget": 1800, "state_budget": 1200}, "split": "private", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 197, "eligible": 398, "ties": 8}}
|
tradeoff.py
CHANGED
|
@@ -31,11 +31,13 @@ NAMES = {
|
|
| 31 |
"span01": ("Span-01", "https://www.respan.ai/docs/documentation/span-01/concept"),
|
| 32 |
"clm": ("CLM-v0.1-8B", "https://huggingface.co/Contrastive-LM/CLM-v0.1-8B"),
|
| 33 |
"semif": ("SemiF", "https://github.com/TheoLeeCJ/SemIf"),
|
|
|
|
| 34 |
}
|
| 35 |
COLORS = {
|
| 36 |
"jev": "#1976d2", "typellm": "#c64f81", "liquid-d1": "#7638d6",
|
| 37 |
"diffusiongemma": "#e08a22", "span01": "#168d80", "clm": "#677586",
|
| 38 |
"semif": "#b14b39",
|
|
|
|
| 39 |
}
|
| 40 |
ORDER = tuple(NAMES)
|
| 41 |
|
|
@@ -70,20 +72,26 @@ def labels_for(domain: str, pairs: list[dict]) -> dict[tuple[str, str], int]:
|
|
| 70 |
|
| 71 |
def curve(labels: dict[tuple[str, str], int], prediction_path: Path) -> tuple[list[tuple[int, int]], int, int]:
|
| 72 |
predictions = lines(prediction_path)
|
| 73 |
-
scores = {}
|
| 74 |
for row in predictions:
|
| 75 |
key = row["pair_id"], row["role"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
value = row["score"]
|
| 77 |
-
if key in scores or not isinstance(value, (int, float)) or not isfinite(value) or not 0 <= value <= 1:
|
| 78 |
raise ValueError(f"Invalid prediction in {prediction_path}: {key}")
|
| 79 |
scores[key] = float(value)
|
| 80 |
-
if scores.keys() != labels.keys():
|
| 81 |
-
raise ValueError(f"Incomplete
|
| 82 |
groups = defaultdict(lambda: [0, 0])
|
| 83 |
for key, score in scores.items():
|
| 84 |
groups[score][1 - labels[key]] += 1 # index 0 is positive; 1 is negative
|
| 85 |
-
|
| 86 |
-
tp =
|
|
|
|
| 87 |
for score in sorted(groups, reverse=True):
|
| 88 |
positive, negative = groups[score]
|
| 89 |
tp += positive
|
|
@@ -128,14 +136,15 @@ def results_table(rows: list[dict]) -> str:
|
|
| 128 |
best_recall = max(round(metrics[row["model_id"]][0] * 100, 1) for row in full_rows)
|
| 129 |
best_false_positive_rate = min(round(metrics[row["model_id"]][1] * 100, 1) for row in full_rows)
|
| 130 |
best_net_recall = max(round(metrics[row["model_id"]][2] * 100, 1) for row in full_rows)
|
|
|
|
| 131 |
priced_costs = [round(row["inference_cost_usd"], 3) for row in full_rows if row.get("inference_cost_usd") is not None]
|
| 132 |
best_priced_cost = min(priced_costs) if priced_costs else None
|
| 133 |
|
| 134 |
def mark(value: str, winner: bool) -> str:
|
| 135 |
return f"**{value}**" if winner else value
|
| 136 |
|
| 137 |
-
table = ["| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Inference cost |",
|
| 138 |
-
"| --- | ---: | ---: | ---: | ---: |"]
|
| 139 |
for row in ordered:
|
| 140 |
recall, false_positive_rate, j = metrics[row["model_id"]]
|
| 141 |
cost = row.get("inference_cost_usd")
|
|
@@ -148,6 +157,7 @@ def results_table(rows: list[dict]) -> str:
|
|
| 148 |
mark(percent(recall), not is_codeql and round(recall * 100, 1) == best_recall),
|
| 149 |
mark(percent(false_positive_rate), not is_codeql and round(false_positive_rate * 100, 1) == best_false_positive_rate),
|
| 150 |
mark(percent(j), not is_codeql and round(j * 100, 1) == best_net_recall),
|
|
|
|
| 151 |
"—" if is_codeql else mark(money(row), cost is not None and round(cost, 3) == best_priced_cost),
|
| 152 |
)) + " |")
|
| 153 |
return "\n".join(table)
|
|
@@ -170,7 +180,7 @@ def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]],
|
|
| 170 |
title = {"bug": "Bug detection", "security": "Security detection", "lint": "Perch Lint Bench"}[domain]
|
| 171 |
out = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" viewBox="0 0 {width} {height}" role="img" aria-labelledby="title desc">',
|
| 172 |
f'<title id="title">{title}: recall versus false alerts</title>',
|
| 173 |
-
'<desc id="desc">
|
| 174 |
f'<rect width="{width}" height="{height}" rx="16" fill="#101318"/>',
|
| 175 |
f'<text x="{left}" y="43" fill="#f2f5fa" font-family="Arial,sans-serif" font-weight="700" font-size="28">{html.escape(title)}</text>',
|
| 176 |
f'<text x="{left}" y="70" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="16">Public methods · recall versus false alerts</text>']
|
|
@@ -209,6 +219,8 @@ def render_sections(results: list[dict], curves_by_domain: dict[str, dict], outp
|
|
| 209 |
sections = ["## Reading the results", "",
|
| 210 |
"Each line shows how many issues a model finds and what percentage of clean methods it wrongly flags as its score cutoff changes. Higher and farther left is better.", "",
|
| 211 |
"The tables use each run's recorded alert settings. A value of 20% under ‘Clean methods wrongly flagged’ means one in five clean methods received an alert. Models are ranked by recall minus that percentage. Bold marks the best full-set value in each column; cost compares priced runs captured here.", ""]
|
|
|
|
|
|
|
| 212 |
for domain in ("bug", "security", "lint"):
|
| 213 |
title = {"bug": "Bugs", "security": "Security", "lint": "Perch Lint Bench"}[domain]
|
| 214 |
link = {"bug": "bug-pairs-public", "security": "security-pairs-public", "lint": "perch-lint-bench-public"}[domain]
|
|
|
|
| 31 |
"span01": ("Span-01", "https://www.respan.ai/docs/documentation/span-01/concept"),
|
| 32 |
"clm": ("CLM-v0.1-8B", "https://huggingface.co/Contrastive-LM/CLM-v0.1-8B"),
|
| 33 |
"semif": ("SemiF", "https://github.com/TheoLeeCJ/SemIf"),
|
| 34 |
+
"gliner25-decide": ("GLiNER-2.5-Decide", "https://huggingface.co/fastino/GLiNER2.5-Decide"),
|
| 35 |
}
|
| 36 |
COLORS = {
|
| 37 |
"jev": "#1976d2", "typellm": "#c64f81", "liquid-d1": "#7638d6",
|
| 38 |
"diffusiongemma": "#e08a22", "span01": "#168d80", "clm": "#677586",
|
| 39 |
"semif": "#b14b39",
|
| 40 |
+
"gliner25-decide": "#9b7a39",
|
| 41 |
}
|
| 42 |
ORDER = tuple(NAMES)
|
| 43 |
|
|
|
|
| 72 |
|
| 73 |
def curve(labels: dict[tuple[str, str], int], prediction_path: Path) -> tuple[list[tuple[int, int]], int, int]:
|
| 74 |
predictions = lines(prediction_path)
|
| 75 |
+
scores, failed = {}, set()
|
| 76 |
for row in predictions:
|
| 77 |
key = row["pair_id"], row["role"]
|
| 78 |
+
if row.get("status") == "failed":
|
| 79 |
+
if key in scores or key in failed or key not in labels:
|
| 80 |
+
raise ValueError(f"Invalid failure in {prediction_path}: {key}")
|
| 81 |
+
failed.add(key)
|
| 82 |
+
continue
|
| 83 |
value = row["score"]
|
| 84 |
+
if key in scores or key in failed or not isinstance(value, (int, float)) or not isfinite(value) or not 0 <= value <= 1:
|
| 85 |
raise ValueError(f"Invalid prediction in {prediction_path}: {key}")
|
| 86 |
scores[key] = float(value)
|
| 87 |
+
if scores.keys() | failed != labels.keys():
|
| 88 |
+
raise ValueError(f"Incomplete outcomes in {prediction_path}: {len(scores) + len(failed)} of {len(labels)}")
|
| 89 |
groups = defaultdict(lambda: [0, 0])
|
| 90 |
for key, score in scores.items():
|
| 91 |
groups[score][1 - labels[key]] += 1 # index 0 is positive; 1 is negative
|
| 92 |
+
# Failures count as wrong at every cutoff. They never receive invented scores.
|
| 93 |
+
tp, fp = 0, sum(labels[key] == 0 for key in failed)
|
| 94 |
+
points = [(fp, tp)]
|
| 95 |
for score in sorted(groups, reverse=True):
|
| 96 |
positive, negative = groups[score]
|
| 97 |
tp += positive
|
|
|
|
| 136 |
best_recall = max(round(metrics[row["model_id"]][0] * 100, 1) for row in full_rows)
|
| 137 |
best_false_positive_rate = min(round(metrics[row["model_id"]][1] * 100, 1) for row in full_rows)
|
| 138 |
best_net_recall = max(round(metrics[row["model_id"]][2] * 100, 1) for row in full_rows)
|
| 139 |
+
best_failures = min(row.get("failed_methods", 0) for row in full_rows)
|
| 140 |
priced_costs = [round(row["inference_cost_usd"], 3) for row in full_rows if row.get("inference_cost_usd") is not None]
|
| 141 |
best_priced_cost = min(priced_costs) if priced_costs else None
|
| 142 |
|
| 143 |
def mark(value: str, winner: bool) -> str:
|
| 144 |
return f"**{value}**" if winner else value
|
| 145 |
|
| 146 |
+
table = ["| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |",
|
| 147 |
+
"| --- | ---: | ---: | ---: | ---: | ---: |"]
|
| 148 |
for row in ordered:
|
| 149 |
recall, false_positive_rate, j = metrics[row["model_id"]]
|
| 150 |
cost = row.get("inference_cost_usd")
|
|
|
|
| 157 |
mark(percent(recall), not is_codeql and round(recall * 100, 1) == best_recall),
|
| 158 |
mark(percent(false_positive_rate), not is_codeql and round(false_positive_rate * 100, 1) == best_false_positive_rate),
|
| 159 |
mark(percent(j), not is_codeql and round(j * 100, 1) == best_net_recall),
|
| 160 |
+
"—" if is_codeql else mark(str(row.get("failed_methods", 0)), row.get("failed_methods", 0) == best_failures),
|
| 161 |
"—" if is_codeql else mark(money(row), cost is not None and round(cost, 3) == best_priced_cost),
|
| 162 |
)) + " |")
|
| 163 |
return "\n".join(table)
|
|
|
|
| 180 |
title = {"bug": "Bug detection", "security": "Security detection", "lint": "Perch Lint Bench"}[domain]
|
| 181 |
out = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" viewBox="0 0 {width} {height}" role="img" aria-labelledby="title desc">',
|
| 182 |
f'<title id="title">{title}: recall versus false alerts</title>',
|
| 183 |
+
'<desc id="desc">Model score curves on the public benchmark. Higher and farther left is better.</desc>',
|
| 184 |
f'<rect width="{width}" height="{height}" rx="16" fill="#101318"/>',
|
| 185 |
f'<text x="{left}" y="43" fill="#f2f5fa" font-family="Arial,sans-serif" font-weight="700" font-size="28">{html.escape(title)}</text>',
|
| 186 |
f'<text x="{left}" y="70" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="16">Public methods · recall versus false alerts</text>']
|
|
|
|
| 219 |
sections = ["## Reading the results", "",
|
| 220 |
"Each line shows how many issues a model finds and what percentage of clean methods it wrongly flags as its score cutoff changes. Higher and farther left is better.", "",
|
| 221 |
"The tables use each run's recorded alert settings. A value of 20% under ‘Clean methods wrongly flagged’ means one in five clean methods received an alert. Models are ranked by recall minus that percentage. Bold marks the best full-set value in each column; cost compares priced runs captured here.", ""]
|
| 222 |
+
if any(r.get("failed_methods") for r in results):
|
| 223 |
+
sections += ["Failed requests count as incorrect decisions: a failed issue is a miss; a failed clean method is a false positive. Failed cases receive no model score and remain incorrect across the plotted cutoffs.", ""]
|
| 224 |
for domain in ("bug", "security", "lint"):
|
| 225 |
title = {"bug": "Bugs", "security": "Security", "lint": "Perch Lint Bench"}[domain]
|
| 226 |
link = {"bug": "bug-pairs-public", "security": "security-pairs-public", "lint": "perch-lint-bench-public"}[domain]
|