Add OpenAI Decisions benchmark results
#35
by jfbrown95 - opened
- .gitattributes +1 -0
- README.md +24 -1
- assets/bug-tradeoff.svg +0 -0
- assets/lint-tradeoff.svg +34 -26
- assets/security-tradeoff.svg +0 -0
- openai-decisions-manifest.json +22 -0
- openai_decisions.py +303 -0
- predictions/current/bug/openai-decisions.jsonl +3 -0
- predictions/current/lint/openai-decisions.jsonl +3 -0
- predictions/current/security/openai-decisions.jsonl +3 -0
- results-current.jsonl +6 -0
- results.jsonl +6 -0
- test_openai_decisions.py +65 -0
- tradeoff.py +10 -7
.gitattributes
CHANGED
|
@@ -59,3 +59,4 @@ predictions/current/*/gliner25-decide.jsonl filter=lfs diff=lfs merge=lfs -text
|
|
| 59 |
# Video files - compressed
|
| 60 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 61 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 59 |
# Video files - compressed
|
| 60 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 61 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
predictions/current/*/openai-decisions.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -22,6 +22,7 @@ Pairs come from open-source projects in Rust, JavaScript, TypeScript, Python, Go
|
|
| 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 |
| [CodeQL](https://codeql.github.com/) | Local CPU run in Docker; CodeQL CLI 2.27.1 |
|
|
|
|
| 25 |
| [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`) |
|
| 26 |
|
| 27 |
<!-- BEGIN TRADEOFF_RESULTS -->
|
|
@@ -45,6 +46,7 @@ Failed requests count as incorrect decisions: a failed issue is a miss; a failed
|
|
| 45 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 46 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 47 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.4% | 27.1% | **6.3%** | **0** | $0.239 |
|
|
|
|
| 48 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 17.7% | 12.7% | 5.0% | **0** | $0.551 |
|
| 49 |
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 43.0% | 39.7% | 3.3% | **0** | $0.239 |
|
| 50 |
| [TypeLLM](https://typellm.ai/docs) | 8.3% | 5.5% | 2.7% | **0** | $0.576 |
|
|
@@ -60,7 +62,8 @@ Failed requests count as incorrect decisions: a failed issue is a miss; a failed
|
|
| 60 |
|
| 61 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 62 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 63 |
-
| [
|
|
|
|
| 64 |
| [TypeLLM](https://typellm.ai/docs) | 11.3% | 5.8% | 5.6% | **0** | $0.129 |
|
| 65 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.0% | 15.6% | 4.5% | **0** | $0.123 |
|
| 66 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 28.5% | 24.3% | 4.2% | **0** | $0.040 |
|
|
@@ -83,6 +86,7 @@ Failed requests count as incorrect decisions: a failed issue is a miss; a failed
|
|
| 83 |
| [TypeLLM](https://typellm.ai/docs) | 27.8% | 17.4% | 10.5% | **0** | $0.566 |
|
| 84 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 55.6% | 46.8% | 8.8% | **0** | Free tier |
|
| 85 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.1% | 25.8% | 7.3% | **0** | **$0.208** |
|
|
|
|
| 86 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 21.0% | 17.2% | 3.9% | **0** | $0.251 |
|
| 87 |
| [CodeQL](https://codeql.github.com/)* | 4.8% | 1.5% | 3.3% | — | — |
|
| 88 |
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 2.1% | **1.6%** | 0.5% | 6 | $0.434 |
|
|
@@ -96,6 +100,7 @@ Failed requests count as incorrect decisions: a failed issue is a miss; a failed
|
|
| 96 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 97 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 98 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 34.2% | 29.0% | **5.2%** | **0** | Free tier |
|
|
|
|
| 99 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.6% | 16.7% | 3.9% | **0** | $0.182 |
|
| 100 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 21.9% | 18.5% | 3.3% | **0** | **$0.074** |
|
| 101 |
| [TypeLLM](https://typellm.ai/docs) | 8.8% | 6.2% | 2.5% | **0** | $0.203 |
|
|
@@ -115,6 +120,7 @@ Failed requests count as incorrect decisions: a failed issue is a miss; a failed
|
|
| 115 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 116 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 117 |
| [TypeLLM](https://typellm.ai/docs) | **61.7%** | 2.8% | **58.9%** | **0** | $0.050 |
|
|
|
|
| 118 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 50.0% | 0.5% | 49.5% | **0** | $0.048 |
|
| 119 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.1% | 0.9% | 48.1% | **0** | Free tier |
|
| 120 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 52.8% | 5.1% | 47.7% | **0** | $0.018 |
|
|
@@ -130,6 +136,7 @@ Failed requests count as incorrect decisions: a failed issue is a miss; a failed
|
|
| 130 |
| [TypeLLM](https://typellm.ai/docs) | **59.2%** | 5.6% | **53.5%** | **0** | $0.016 |
|
| 131 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 53.5% | 1.4% | 52.1% | **0** | $0.016 |
|
| 132 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.3% | 1.4% | 47.9% | **0** | Free tier |
|
|
|
|
| 133 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 53.5% | 8.5% | 45.1% | **0** | $0.006 |
|
| 134 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.1% | 8.5% | 36.6% | **0** | $0.005 |
|
| 135 |
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.7% | 49.3% | 1.4% | **0** | **~$0.003** |
|
|
@@ -150,6 +157,8 @@ Inference costs cover scoring the method sides in each table. Jev costs are esti
|
|
| 150 |
|
| 151 |
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.
|
| 152 |
|
|
|
|
|
|
|
| 153 |
## Files and reproduction
|
| 154 |
|
| 155 |
- [`results-current.jsonl`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/results-current.jsonl): current-pack aggregate results for public and private splits; no private pair data.
|
|
@@ -162,6 +171,7 @@ JevLike (192-byte input), Laya (512-token input), and Kev (packed-branch limit)
|
|
| 162 |
- [`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.
|
| 163 |
- [`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.
|
| 164 |
- [`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.
|
|
|
|
| 165 |
- [`perch-lint-bench-public`](https://huggingface.co/datasets/perchscan/perch-lint-bench-public): paired rules and its runnable scorer.
|
| 166 |
|
| 167 |
To run Jev with the current pack, set `TYPESAFE_API_KEY` or `PERCH_API_KEY` in your environment:
|
|
@@ -188,3 +198,16 @@ python3 gliner_decide.py --domain security --out gliner-security --budget 10
|
|
| 188 |
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.
|
| 189 |
|
| 190 |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
| [CodeQL](https://codeql.github.com/) | Local CPU run in Docker; CodeQL CLI 2.27.1 |
|
| 25 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | [OpenAI Decisions API](https://api.openai.com/v1/decisions) (`gpt-6-luna`) |
|
| 26 |
| [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`) |
|
| 27 |
|
| 28 |
<!-- BEGIN TRADEOFF_RESULTS -->
|
|
|
|
| 46 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 47 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 48 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.4% | 27.1% | **6.3%** | **0** | $0.239 |
|
| 49 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | 24.7% | 19.0% | 5.7% | 98 | $1.146 |
|
| 50 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 17.7% | 12.7% | 5.0% | **0** | $0.551 |
|
| 51 |
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 43.0% | 39.7% | 3.3% | **0** | $0.239 |
|
| 52 |
| [TypeLLM](https://typellm.ai/docs) | 8.3% | 5.5% | 2.7% | **0** | $0.576 |
|
|
|
|
| 62 |
|
| 63 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 64 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 65 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | 29.5% | 20.3% | **9.2%** | 18 | $0.258 |
|
| 66 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 35.8% | 27.3% | 8.6% | **0** | $0.054 |
|
| 67 |
| [TypeLLM](https://typellm.ai/docs) | 11.3% | 5.8% | 5.6% | **0** | $0.129 |
|
| 68 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.0% | 15.6% | 4.5% | **0** | $0.123 |
|
| 69 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 28.5% | 24.3% | 4.2% | **0** | $0.040 |
|
|
|
|
| 86 |
| [TypeLLM](https://typellm.ai/docs) | 27.8% | 17.4% | 10.5% | **0** | $0.566 |
|
| 87 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 55.6% | 46.8% | 8.8% | **0** | Free tier |
|
| 88 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 33.1% | 25.8% | 7.3% | **0** | **$0.208** |
|
| 89 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | 22.6% | 15.9% | 6.6% | 50 | $1.775 |
|
| 90 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 21.0% | 17.2% | 3.9% | **0** | $0.251 |
|
| 91 |
| [CodeQL](https://codeql.github.com/)* | 4.8% | 1.5% | 3.3% | — | — |
|
| 92 |
| [GLiNER-2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) | 2.1% | **1.6%** | 0.5% | 6 | $0.434 |
|
|
|
|
| 100 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 101 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 102 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 34.2% | 29.0% | **5.2%** | **0** | Free tier |
|
| 103 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | 11.1% | 6.5% | 4.6% | 11 | $0.643 |
|
| 104 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.6% | 16.7% | 3.9% | **0** | $0.182 |
|
| 105 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 21.9% | 18.5% | 3.3% | **0** | **$0.074** |
|
| 106 |
| [TypeLLM](https://typellm.ai/docs) | 8.8% | 6.2% | 2.5% | **0** | $0.203 |
|
|
|
|
| 120 |
| Model | Recall | Clean methods wrongly flagged | Recall − false-positive rate | Failed requests | Inference cost |
|
| 121 |
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 122 |
| [TypeLLM](https://typellm.ai/docs) | **61.7%** | 2.8% | **58.9%** | **0** | $0.050 |
|
| 123 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | 51.4% | 0.5% | 50.9% | **0** | $0.095 |
|
| 124 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 50.0% | 0.5% | 49.5% | **0** | $0.048 |
|
| 125 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.1% | 0.9% | 48.1% | **0** | Free tier |
|
| 126 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 52.8% | 5.1% | 47.7% | **0** | $0.018 |
|
|
|
|
| 136 |
| [TypeLLM](https://typellm.ai/docs) | **59.2%** | 5.6% | **53.5%** | **0** | $0.016 |
|
| 137 |
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 53.5% | 1.4% | 52.1% | **0** | $0.016 |
|
| 138 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.3% | 1.4% | 47.9% | **0** | Free tier |
|
| 139 |
+
| [GPT-6 Luna Decisions](https://developers.openai.com/api/docs/guides/decisions) | 50.7% | 2.8% | 47.9% | **0** | $0.030 |
|
| 140 |
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 53.5% | 8.5% | 45.1% | **0** | $0.006 |
|
| 141 |
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.1% | 8.5% | 36.6% | **0** | $0.005 |
|
| 142 |
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.7% | 49.3% | 1.4% | **0** | **~$0.003** |
|
|
|
|
| 157 |
|
| 158 |
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 |
|
| 160 |
+
GPT-6 Luna Decisions receives each method's saved context with all applicable checks as predicate questions in one request. True and false criteria are retained. Semantic lint scores invert the probability that the rule is satisfied. Costs use API-reported input tokens at [$0.10 per million](https://developers.openai.com/api/docs/guides/decisions#pricing-and-availability); output and cache operations carry no extra charge.
|
| 161 |
+
|
| 162 |
## Files and reproduction
|
| 163 |
|
| 164 |
- [`results-current.jsonl`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/results-current.jsonl): current-pack aggregate results for public and private splits; no private pair data.
|
|
|
|
| 171 |
- [`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.
|
| 172 |
- [`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.
|
| 173 |
- [`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.
|
| 174 |
+
- [`openai_decisions.py`](openai_decisions.py) and [`openai-decisions-manifest.json`](openai-decisions-manifest.json): resumable Decisions API scorer and public benchmark file checksums.
|
| 175 |
- [`perch-lint-bench-public`](https://huggingface.co/datasets/perchscan/perch-lint-bench-public): paired rules and its runnable scorer.
|
| 176 |
|
| 177 |
To run Jev with the current pack, set `TYPESAFE_API_KEY` or `PERCH_API_KEY` in your environment:
|
|
|
|
| 198 |
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.
|
| 199 |
|
| 200 |
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.
|
| 201 |
+
|
| 202 |
+
To run OpenAI Decisions, download each public `benchmark.jsonl` into
|
| 203 |
+
`public/bug/`, `public/security/` and `public/lint/`, then set `OPENAI_API_KEY`:
|
| 204 |
+
|
| 205 |
+
```sh
|
| 206 |
+
python3 openai_decisions.py --manifest openai-decisions-manifest.json --out decisions-results
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
The runner preserves the configured question floors and 70% semantic-lint
|
| 210 |
+
violation cutoff. Each side receives only its own context. Timeouts and refusals
|
| 211 |
+
are recorded as failed requests, without a probability score. The six-set local
|
| 212 |
+
run used 24 workers and a request limiter of 1.5 million estimated input tokens
|
| 213 |
+
per minute. Recorded method elapsed times include client throttling and rate-limit backoff. The public manifest contains only the three public sets.
|
assets/bug-tradeoff.svg
CHANGED
|
|
|
|
assets/lint-tradeoff.svg
CHANGED
|
|
|
|
assets/security-tradeoff.svg
CHANGED
|
|
|
|
openai-decisions-manifest.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"datasets": [
|
| 3 |
+
{
|
| 4 |
+
"split": "public",
|
| 5 |
+
"domain": "lint",
|
| 6 |
+
"path": "public/lint/benchmark.jsonl",
|
| 7 |
+
"sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"split": "public",
|
| 11 |
+
"domain": "bug",
|
| 12 |
+
"path": "public/bug/benchmark.jsonl",
|
| 13 |
+
"sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"split": "public",
|
| 17 |
+
"domain": "security",
|
| 18 |
+
"path": "public/security/benchmark.jsonl",
|
| 19 |
+
"sha256": "2407059caa3486371749884138b997d89043eec646e548ee8f44ba3ab08514b8"
|
| 20 |
+
}
|
| 21 |
+
]
|
| 22 |
+
}
|
openai_decisions.py
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Run OpenAI Decisions on the Perch bug, security and semantic lint benchmarks.
|
| 3 |
+
|
| 4 |
+
Each method is independent. Applicable checks share its complete saved context.
|
| 5 |
+
Predicates retain the frozen question and answer criteria. No repair is shown.
|
| 6 |
+
Failed requests are saved once and counted as wrong decisions, without scores.
|
| 7 |
+
"""
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait
|
| 12 |
+
from collections import Counter
|
| 13 |
+
import hashlib
|
| 14 |
+
import importlib.util
|
| 15 |
+
from itertools import zip_longest
|
| 16 |
+
import json
|
| 17 |
+
import os
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
import threading
|
| 20 |
+
import time
|
| 21 |
+
from urllib.error import HTTPError
|
| 22 |
+
from urllib.request import Request, urlopen
|
| 23 |
+
|
| 24 |
+
ROOT = Path(__file__).resolve().parent
|
| 25 |
+
MODEL = 'gpt-6-luna'
|
| 26 |
+
MODEL_ID = 'openai-decisions'
|
| 27 |
+
API = 'https://api.openai.com/v1/decisions'
|
| 28 |
+
PRICE = .10
|
| 29 |
+
PROTOCOL = 'openai-decisions-perch-predicate-v1'
|
| 30 |
+
spec = importlib.util.spec_from_file_location('perch_benchmark', ROOT / 'benchmark.py')
|
| 31 |
+
core = importlib.util.module_from_spec(spec)
|
| 32 |
+
spec.loader.exec_module(core)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class AccountError(RuntimeError):
|
| 36 |
+
pass
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class AnswerError(RuntimeError):
|
| 40 |
+
def __init__(self, message, response, request_id, elapsed):
|
| 41 |
+
super().__init__(message)
|
| 42 |
+
self.usage = response.get('usage', {})
|
| 43 |
+
self.answers = response.get('answers', [])
|
| 44 |
+
self.request_id = request_id
|
| 45 |
+
self.elapsed = elapsed
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class RateLimiter:
|
| 49 |
+
def __init__(self, tokens_per_minute):
|
| 50 |
+
self.lock = threading.Lock()
|
| 51 |
+
self.next_at = 0.
|
| 52 |
+
self.tokens_per_second = tokens_per_minute / 60
|
| 53 |
+
|
| 54 |
+
def wait(self, estimated_tokens):
|
| 55 |
+
with self.lock:
|
| 56 |
+
at = max(time.monotonic(), self.next_at)
|
| 57 |
+
self.next_at = at + estimated_tokens / self.tokens_per_second
|
| 58 |
+
time.sleep(max(0, at - time.monotonic()))
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def read_rows(path):
|
| 62 |
+
return [json.loads(line) for line in path.read_text().splitlines() if line.strip()] if path.exists() else []
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def questions_for(pair, domain, pack):
|
| 66 |
+
if domain == 'lint':
|
| 67 |
+
rule = ' '.join(pair['rule']['ensure'].split())
|
| 68 |
+
return [{'name': 'semantic', 'question': {
|
| 69 |
+
'instructions': 'Is `rule` true of the code below?\nRule: ' + rule,
|
| 70 |
+
'criteria': {'true': rule, 'false': 'Not so: ' + rule}},
|
| 71 |
+
'issue': {'on': False}, 'min': 70}]
|
| 72 |
+
return core.detection_questions(core.scan_questions(pack, domain, pair['language']), domain)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def predicate(check):
|
| 76 |
+
question = check['question']
|
| 77 |
+
return {'type': 'predicate', 'name': check['name'],
|
| 78 |
+
'instructions': question['instructions'].strip() + '\nTrue: ' +
|
| 79 |
+
question['criteria']['true'].strip() + '\nFalse: ' +
|
| 80 |
+
question['criteria']['false'].strip()}
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def payload_for(pair, role, domain, pack):
|
| 84 |
+
checks = questions_for(pair, domain, pack)
|
| 85 |
+
if not checks:
|
| 86 |
+
raise ValueError('No applicable detection questions')
|
| 87 |
+
context = 'Perch method context (JSON):\n' + json.dumps(
|
| 88 |
+
pair[role]['state'], ensure_ascii=False, separators=(',', ':'))
|
| 89 |
+
return {'model': MODEL, 'input': context, 'questions': [predicate(c) for c in checks]}, checks
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def prediction(pair, role, domain, pack, response, elapsed, request_id):
|
| 93 |
+
checks = questions_for(pair, domain, pack)
|
| 94 |
+
if response.get('model') != MODEL:
|
| 95 |
+
raise ValueError('Decisions returned a different model')
|
| 96 |
+
answers = response.get('answers', [])
|
| 97 |
+
if len(answers) != len(checks) or {a['name'] for a in answers} != {c['name'] for c in checks}:
|
| 98 |
+
raise ValueError('Decisions returned missing, duplicate or unexpected answers')
|
| 99 |
+
if any(a.get('type') != 'predicate' for a in answers):
|
| 100 |
+
types = ', '.join(a['name'] + ':' + str(a.get('type')) for a in answers if a.get('type') != 'predicate')
|
| 101 |
+
raise AnswerError('Decisions returned ' + types, response, request_id, elapsed)
|
| 102 |
+
probabilities = {a['name']: core.probability(a['probability']) for a in answers}
|
| 103 |
+
scores = {c['name']: core.raised_score(c, probabilities[c['name']]) for c in checks}
|
| 104 |
+
score, alert = (scores['semantic'], scores['semantic'] > .7) if domain == 'lint' else core.scan_result(scores, checks, domain, .5)
|
| 105 |
+
usage = response.get('usage', {})
|
| 106 |
+
if not isinstance(usage.get('input_tokens'), int) or usage['input_tokens'] < 0:
|
| 107 |
+
raise ValueError('Decisions did not return billable input-token usage')
|
| 108 |
+
return {'pair_id': pair['pair_id'], 'role': role, 'domain': domain,
|
| 109 |
+
'model_id': MODEL_ID, 'model_revision': MODEL, 'protocol_id': PROTOCOL,
|
| 110 |
+
'pack_sha256': pack['pack_sha256'] if domain != 'lint' else None,
|
| 111 |
+
'score': score, 'alert': alert, 'question_scores': scores,
|
| 112 |
+
'predicate_probabilities': probabilities, 'usage': usage,
|
| 113 |
+
'latency_seconds': elapsed, 'request_id': request_id}
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def predict(key, pair, role, domain, pack, timeout, limiter):
|
| 117 |
+
payload, _ = payload_for(pair, role, domain, pack)
|
| 118 |
+
body = json.dumps(payload, ensure_ascii=False).encode()
|
| 119 |
+
estimated_tokens = max(1, len(body) // 3)
|
| 120 |
+
started = time.monotonic()
|
| 121 |
+
for attempt in range(4):
|
| 122 |
+
limiter.wait(estimated_tokens)
|
| 123 |
+
request = Request(API, data=body, headers={
|
| 124 |
+
'Authorization': 'Bearer ' + key, 'Content-Type': 'application/json'})
|
| 125 |
+
try:
|
| 126 |
+
with urlopen(request, timeout=timeout) as result:
|
| 127 |
+
response = json.load(result)
|
| 128 |
+
request_id = result.headers.get('x-request-id')
|
| 129 |
+
return prediction(pair, role, domain, pack, response, time.monotonic() - started, request_id)
|
| 130 |
+
except HTTPError as exc:
|
| 131 |
+
detail = json.loads(exc.read()).get('error', {})
|
| 132 |
+
code = detail.get('code')
|
| 133 |
+
if exc.code in (401, 402, 403) or code in ('insufficient_quota', 'billing_hard_limit_reached'):
|
| 134 |
+
raise AccountError(f'OpenAI HTTP {exc.code}: {code}') from None
|
| 135 |
+
if exc.code != 429 or attempt == 3:
|
| 136 |
+
raise RuntimeError(f'OpenAI HTTP {exc.code}: {code or detail.get("type")}') from None
|
| 137 |
+
time.sleep(min(30, 2 ** (attempt + 1)))
|
| 138 |
+
raise AssertionError('unreachable')
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def report(group, pack):
|
| 142 |
+
pairs, predictions, failures = group['pairs'], group['predictions'], group['failures']
|
| 143 |
+
domain = group['domain']
|
| 144 |
+
counts = dict(tp=0, fp=0, fn=0, tn=0)
|
| 145 |
+
items, eligible, correct, ties = [], 0, 0, 0
|
| 146 |
+
for pair in pairs:
|
| 147 |
+
label_domain = pair['domain'] if domain == 'lint' else domain
|
| 148 |
+
for role in ('before', 'after'):
|
| 149 |
+
identity = pair['pair_id'], role
|
| 150 |
+
label = pair[role]['labels'][label_domain]
|
| 151 |
+
row = predictions.get(identity)
|
| 152 |
+
if row:
|
| 153 |
+
items.append((label, row['score']))
|
| 154 |
+
counts['tp' if label and row['alert'] else 'fn' if label else 'fp' if row['alert'] else 'tn'] += 1
|
| 155 |
+
elif identity in failures:
|
| 156 |
+
counts['fn' if label else 'fp'] += 1
|
| 157 |
+
if pair['before']['labels'][label_domain] == 1 and pair['after']['labels'][label_domain] == 0:
|
| 158 |
+
eligible += 1
|
| 159 |
+
before, after = (predictions.get((pair['pair_id'], role)) for role in ('before', 'after'))
|
| 160 |
+
if before and after:
|
| 161 |
+
correct += before['score'] > after['score']
|
| 162 |
+
ties += before['score'] == after['score']
|
| 163 |
+
tp, fp, fn, tn = (counts[k] for k in ('tp', 'fp', 'fn', 'tn'))
|
| 164 |
+
tokens = sum(r.get('usage', {}).get('input_tokens', 0) for r in [*predictions.values(), *failures.values()])
|
| 165 |
+
latencies = sorted(r['latency_seconds'] for r in predictions.values())
|
| 166 |
+
ordering = {'correct': correct, 'ties': ties, 'eligible': eligible}
|
| 167 |
+
return {'domain': domain, 'track': group['split'], 'model_id': MODEL_ID,
|
| 168 |
+
'model_revision': MODEL, 'protocol_id': PROTOCOL, 'run_id': 'openai-decisions-20261006',
|
| 169 |
+
'benchmark_sha256': group['digest'], 'benchmark_pairs': len(pairs), 'benchmark_methods': 2 * len(pairs),
|
| 170 |
+
'answered_methods': len(predictions), 'failed_methods': len(failures),
|
| 171 |
+
'complete': len(predictions) + len(failures) == 2 * len(pairs),
|
| 172 |
+
'failure_policy': 'failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering',
|
| 173 |
+
'failure_counts': dict(Counter(r['error'] for r in failures.values())),
|
| 174 |
+
'confusion': counts, 'precision': tp / (tp + fp) if tp + fp else 0,
|
| 175 |
+
'recall': tp / (tp + fn) if tp + fn else 0, 'false_positive_rate': fp / (fp + tn) if fp + tn else 0,
|
| 176 |
+
'f1': 2 * tp / (2 * tp + fp + fn) if 2 * tp + fp + fn else 0,
|
| 177 |
+
'average_precision_answered_methods': core.average_precision(items) if items else None,
|
| 178 |
+
'pair_order': correct / eligible if eligible else None, 'pair_order_correct': correct, 'pair_order_eligible': eligible,
|
| 179 |
+
'vulnerable_or_buggy_before_above_fixed_after': ordering,
|
| 180 |
+
'threshold': .7 if domain == 'lint' else .5,
|
| 181 |
+
'alert_rule': 'rule violation probability > 0.7' if domain == 'lint' else 'any issue score > max(0.5, question min)',
|
| 182 |
+
'question_pack_sha256': pack['pack_sha256'] if domain != 'lint' else None,
|
| 183 |
+
'input_tokens': tokens, 'inference_cost_usd': tokens * PRICE / 1_000_000,
|
| 184 |
+
'inference_cost_basis': 'Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded',
|
| 185 |
+
'inference_endpoint': API, 'inference_host': 'OpenAI Decisions API',
|
| 186 |
+
'latency_basis': 'Per-method elapsed time, including client rate-limit waits and 429 backoff',
|
| 187 |
+
'latency_median_seconds': latencies[len(latencies) // 2] if latencies else None,
|
| 188 |
+
'latency_p95_seconds': latencies[min(len(latencies)-1, int(len(latencies)*.95))] if latencies else None}
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def main():
|
| 192 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 193 |
+
parser.add_argument('--manifest', type=Path, required=True)
|
| 194 |
+
parser.add_argument('--out', type=Path, required=True)
|
| 195 |
+
parser.add_argument('--question-pack', type=Path, default=ROOT / 'question-pack.json')
|
| 196 |
+
parser.add_argument('--workers', type=int, default=24)
|
| 197 |
+
parser.add_argument('--tokens-per-minute', type=int, default=1_500_000)
|
| 198 |
+
parser.add_argument('--timeout', type=float, default=45)
|
| 199 |
+
parser.add_argument('--budget', type=float, default=5)
|
| 200 |
+
parser.add_argument('--score-saved', action='store_true')
|
| 201 |
+
args = parser.parse_args()
|
| 202 |
+
pack = core.load_pack(args.question_pack)
|
| 203 |
+
groups, pending_groups = [], []
|
| 204 |
+
for dataset in json.loads(args.manifest.read_text())['datasets']:
|
| 205 |
+
raw = Path(dataset['path']).read_bytes()
|
| 206 |
+
digest = hashlib.sha256(raw).hexdigest()
|
| 207 |
+
if digest != dataset['sha256']:
|
| 208 |
+
raise ValueError('Dataset checksum changed')
|
| 209 |
+
pairs = [json.loads(line) for line in raw.splitlines() if line]
|
| 210 |
+
if len({p['pair_id'] for p in pairs}) != len(pairs):
|
| 211 |
+
raise ValueError('Duplicate benchmark pair')
|
| 212 |
+
directory = args.out / dataset['split'] / dataset['domain']
|
| 213 |
+
directory.mkdir(parents=True, exist_ok=True)
|
| 214 |
+
preds, fails = {}, {}
|
| 215 |
+
expected = {(p['pair_id'], role) for p in pairs for role in ('before', 'after')}
|
| 216 |
+
for file, target in [('predictions.jsonl', preds), ('failures.jsonl', fails)]:
|
| 217 |
+
for r in read_rows(directory / file):
|
| 218 |
+
identity = r['pair_id'], r['role']
|
| 219 |
+
if identity not in expected or identity in preds or identity in fails:
|
| 220 |
+
raise ValueError('Invalid or duplicate saved outcome')
|
| 221 |
+
if r['dataset_sha256'] != digest or r['protocol_id'] != PROTOCOL or r['model_revision'] != MODEL:
|
| 222 |
+
raise ValueError('Saved outcome uses a different dataset, model or protocol')
|
| 223 |
+
if r.get('pack_sha256') != (pack['pack_sha256'] if dataset['domain'] != 'lint' else None):
|
| 224 |
+
raise ValueError('Saved outcome uses a different question pack')
|
| 225 |
+
target[identity] = r
|
| 226 |
+
group = dict(pairs=pairs, predictions=preds, failures=fails, directory=directory,
|
| 227 |
+
domain=dataset['domain'], split=dataset['split'], digest=digest)
|
| 228 |
+
groups.append(group)
|
| 229 |
+
pending_groups.append([(group, pair, role) for pair in pairs for role in ('before', 'after')
|
| 230 |
+
if (pair['pair_id'], role) not in preds and (pair['pair_id'], role) not in fails])
|
| 231 |
+
pending = [job for row in zip_longest(*pending_groups) for job in row if job is not None]
|
| 232 |
+
def save_reports():
|
| 233 |
+
reports = [report(g, pack) for g in groups]
|
| 234 |
+
for g, result in zip(groups, reports):
|
| 235 |
+
(g['directory'] / 'report.json').write_text(json.dumps(result, indent=2) + '\n')
|
| 236 |
+
status = {'model': MODEL, 'reports': reports,
|
| 237 |
+
'reported_cost_usd': sum(r['inference_cost_usd'] for r in reports),
|
| 238 |
+
'complete': all(r['complete'] for r in reports)}
|
| 239 |
+
temp = args.out / 'status.tmp'
|
| 240 |
+
temp.write_text(json.dumps(status, indent=2) + '\n')
|
| 241 |
+
temp.replace(args.out / 'status.json')
|
| 242 |
+
return status['reported_cost_usd']
|
| 243 |
+
spent = save_reports()
|
| 244 |
+
if args.score_saved or not pending:
|
| 245 |
+
return
|
| 246 |
+
key = os.environ.get('OPENAI_API_KEY')
|
| 247 |
+
if not key:
|
| 248 |
+
raise AccountError('Set OPENAI_API_KEY')
|
| 249 |
+
limiter = RateLimiter(args.tokens_per_minute)
|
| 250 |
+
iterator, attempted = iter(pending), 0
|
| 251 |
+
with ThreadPoolExecutor(max_workers=args.workers) as pool:
|
| 252 |
+
active = {}
|
| 253 |
+
def submit():
|
| 254 |
+
if spent >= args.budget:
|
| 255 |
+
return
|
| 256 |
+
job = next(iterator, None)
|
| 257 |
+
if job:
|
| 258 |
+
group, pair, role = job
|
| 259 |
+
active[pool.submit(predict, key, pair, role, group['domain'], pack, args.timeout, limiter)] = job
|
| 260 |
+
for _ in range(args.workers):
|
| 261 |
+
submit()
|
| 262 |
+
try:
|
| 263 |
+
while active:
|
| 264 |
+
done, _ = wait(active, return_when=FIRST_COMPLETED)
|
| 265 |
+
for future in done:
|
| 266 |
+
group, pair, role = active.pop(future)
|
| 267 |
+
identity = pair['pair_id'], role
|
| 268 |
+
try:
|
| 269 |
+
row = future.result()
|
| 270 |
+
except AccountError:
|
| 271 |
+
for f in active:
|
| 272 |
+
f.cancel()
|
| 273 |
+
raise
|
| 274 |
+
except Exception as exc:
|
| 275 |
+
row = {'pair_id': pair['pair_id'], 'role': role, 'domain': group['domain'],
|
| 276 |
+
'model_revision': MODEL, 'protocol_id': PROTOCOL,
|
| 277 |
+
'pack_sha256': pack['pack_sha256'] if group['domain'] != 'lint' else None,
|
| 278 |
+
'status': 'failed', 'error': str(exc),
|
| 279 |
+
'usage': getattr(exc, 'usage', {}), 'answers': getattr(exc, 'answers', []),
|
| 280 |
+
'request_id': getattr(exc, 'request_id', None),
|
| 281 |
+
'latency_seconds': getattr(exc, 'elapsed', None)}
|
| 282 |
+
group['failures'][identity] = row
|
| 283 |
+
spent += row['usage'].get('input_tokens', 0) * PRICE / 1_000_000
|
| 284 |
+
file = 'failures.jsonl'
|
| 285 |
+
else:
|
| 286 |
+
group['predictions'][identity] = row
|
| 287 |
+
spent += row['usage']['input_tokens'] * PRICE / 1_000_000
|
| 288 |
+
file = 'predictions.jsonl'
|
| 289 |
+
row['dataset_sha256'] = group['digest']
|
| 290 |
+
with (group['directory'] / file).open('a') as stream:
|
| 291 |
+
stream.write(json.dumps(row, sort_keys=True) + '\n')
|
| 292 |
+
attempted += 1
|
| 293 |
+
if attempted % 100 == 0:
|
| 294 |
+
save_reports()
|
| 295 |
+
print(f'Completed {attempted}/{len(pending)} new methods; reported cost ${spent:.4f}', flush=True)
|
| 296 |
+
submit()
|
| 297 |
+
finally:
|
| 298 |
+
save_reports()
|
| 299 |
+
print('Finished scheduled methods.', flush=True)
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
if __name__ == '__main__':
|
| 303 |
+
main()
|
predictions/current/bug/openai-decisions.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7801755a7ff36856ef8f18e7c0975f5c9bfc192c258ccb729b34bcda98f8a41
|
| 3 |
+
size 3696789
|
predictions/current/lint/openai-decisions.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f9450d90e0ac177fb260e2abb2ef63d61fc1b84b6e53fb2f4bf1d778afd98e3
|
| 3 |
+
size 318004
|
predictions/current/security/openai-decisions.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b945451a0ea46391c49bdc8b1fa628c95299cd7547a3ceee6cdcba0168eeaff
|
| 3 |
+
size 3950511
|
results-current.jsonl
CHANGED
|
@@ -46,3 +46,9 @@
|
|
| 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}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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}}
|
| 49 |
+
{"alert_rule": "rule violation probability > 0.7", "answered_methods": 428, "average_precision_answered_methods": 0.9634542397775262, "benchmark_methods": 428, "benchmark_pairs": 214, "benchmark_sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75", "complete": true, "confusion": {"fn": 104, "fp": 1, "tn": 213, "tp": 110}, "domain": "lint", "f1": 0.676923076923077, "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.004672897196261682, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.09515590000000002, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 951559, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.316905957995914, "latency_p95_seconds": 4.407675249996828, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.9626168224299065, "pair_order_correct": 206, "pair_order_eligible": 214, "precision": 0.990990990990991, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": null, "recall": 0.514018691588785, "run_id": "openai-decisions-20261006", "threshold": 0.7, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 206, "eligible": 214, "ties": 0}}
|
| 50 |
+
{"alert_rule": "rule violation probability > 0.7", "answered_methods": 142, "average_precision_answered_methods": 0.9270783624477772, "benchmark_methods": 142, "benchmark_pairs": 71, "benchmark_sha256": "a6e9f2e4ee8ae77bdaf23af46920d97d1ba47375dc9ce03b950cdbe95c2777f9", "complete": true, "confusion": {"fn": 35, "fp": 2, "tn": 69, "tp": 36}, "domain": "lint", "f1": 0.6605504587155964, "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.028169014084507043, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.030450900000000003, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 304509, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.284013958007563, "latency_p95_seconds": 4.651008541986812, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.9295774647887324, "pair_order_correct": 66, "pair_order_eligible": 71, "precision": 0.9473684210526315, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": null, "recall": 0.5070422535211268, "run_id": "openai-decisions-20261006", "threshold": 0.7, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 66, "eligible": 71, "ties": 1}}
|
| 51 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 4342, "average_precision_answered_methods": 0.49250227678367686, "benchmark_methods": 4440, "benchmark_pairs": 2220, "benchmark_sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2", "complete": true, "confusion": {"fn": 1402, "fp": 489, "tn": 2090, "tp": 459}, "domain": "bug", "f1": 0.3268066927732289, "failed_methods": 98, "failure_counts": {"Decisions returned bug_edge_case:refusal": 81, "Decisions returned has_bug:refusal": 7, "Decisions returned has_bug:refusal, bug_edge_case:refusal": 9, "OpenAI HTTP 503: server_error": 1}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.1896083753392788, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 1.1459717, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 11459717, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.1877637500001583, "latency_p95_seconds": 4.871147208003094, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.46408529741863075, "pair_order_correct": 827, "pair_order_eligible": 1782, "precision": 0.48417721518987344, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.24664159054271897, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 827, "eligible": 1782, "ties": 121}}
|
| 52 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 978, "average_precision_answered_methods": 0.5111512894105066, "benchmark_methods": 996, "benchmark_pairs": 498, "benchmark_sha256": "3df4ade65fedd1128d30bc17c9c9869c8ab9bd526e666156d0e16685e78f8a73", "complete": true, "confusion": {"fn": 299, "fp": 116, "tn": 456, "tp": 125}, "domain": "bug", "f1": 0.37593984962406013, "failed_methods": 18, "failure_counts": {"Decisions returned bug_edge_case:refusal": 11, "Decisions returned has_bug:refusal": 4, "Decisions returned refusal or non-predicate answer (original response)": 3}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.20279720279720279, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.2575815, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 2575815, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.399392875027843, "latency_p95_seconds": 4.782793291989947, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.513715710723192, "pair_order_correct": 206, "pair_order_eligible": 401, "precision": 0.5186721991701245, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.294811320754717, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 206, "eligible": 401, "ties": 16}}
|
| 53 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 2572, "average_precision_answered_methods": 0.5220220092166592, "benchmark_methods": 2622, "benchmark_pairs": 1311, "benchmark_sha256": "2407059caa3486371749884138b997d89043eec646e548ee8f44ba3ab08514b8", "complete": true, "confusion": {"fn": 884, "fp": 236, "tn": 1244, "tp": 258}, "domain": "security", "f1": 0.3154034229828851, "failed_methods": 50, "failure_counts": {"Decisions returned cwe_120:refusal": 14, "Decisions returned cwe_120:refusal, cwe_122:refusal": 1, "Decisions returned cwe_122:refusal": 2, "Decisions returned cwe_639:refusal": 1, "Decisions returned cwe_770:refusal": 14, "Decisions returned cwe_787:refusal, cwe_120:refusal": 1, "Decisions returned cwe_863:refusal": 5, "Decisions returned cwe_863:refusal, cwe_306:refusal": 1, "Decisions returned refusal or non-predicate answer (original response)": 7, "Expecting value: line 1 column 1 (char 0)": 4}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.15945945945945947, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 1.7751056, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 17751056, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.472128333989531, "latency_p95_seconds": 5.120452375005698, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.5026690391459074, "pair_order_correct": 565, "pair_order_eligible": 1124, "precision": 0.5222672064777328, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.22591943957968477, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 565, "eligible": 1124, "ties": 54}}
|
| 54 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 867, "average_precision_answered_methods": 0.5169176433965138, "benchmark_methods": 878, "benchmark_pairs": 439, "benchmark_sha256": "a4b81728e9e520cf1c6f342974bec369d72f5b7d8aabc1c9cf2aceba966f8051", "complete": true, "confusion": {"fn": 354, "fp": 31, "tn": 449, "tp": 44}, "domain": "security", "f1": 0.18604651162790697, "failed_methods": 11, "failure_counts": {"Decisions returned cwe_120:refusal": 6, "Decisions returned cwe_770:refusal": 2, "Decisions returned cwe_863:refusal": 2, "Decisions returned refusal or non-predicate answer (original response)": 1}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.06458333333333334, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.6434506000000001, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 6434506, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.465080959023908, "latency_p95_seconds": 4.828431333997287, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.5402010050251256, "pair_order_correct": 215, "pair_order_eligible": 398, "precision": 0.5866666666666667, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.11055276381909548, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 215, "eligible": 398, "ties": 19}}
|
results.jsonl
CHANGED
|
@@ -92,3 +92,9 @@
|
|
| 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}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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}}
|
| 95 |
+
{"alert_rule": "rule violation probability > 0.7", "answered_methods": 428, "average_precision_answered_methods": 0.9634542397775262, "benchmark_methods": 428, "benchmark_pairs": 214, "benchmark_sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75", "complete": true, "confusion": {"fn": 104, "fp": 1, "tn": 213, "tp": 110}, "domain": "lint", "f1": 0.676923076923077, "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.004672897196261682, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.09515590000000002, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 951559, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.316905957995914, "latency_p95_seconds": 4.407675249996828, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.9626168224299065, "pair_order_correct": 206, "pair_order_eligible": 214, "precision": 0.990990990990991, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": null, "recall": 0.514018691588785, "run_id": "openai-decisions-20261006", "threshold": 0.7, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 206, "eligible": 214, "ties": 0}}
|
| 96 |
+
{"alert_rule": "rule violation probability > 0.7", "answered_methods": 142, "average_precision_answered_methods": 0.9270783624477772, "benchmark_methods": 142, "benchmark_pairs": 71, "benchmark_sha256": "a6e9f2e4ee8ae77bdaf23af46920d97d1ba47375dc9ce03b950cdbe95c2777f9", "complete": true, "confusion": {"fn": 35, "fp": 2, "tn": 69, "tp": 36}, "domain": "lint", "f1": 0.6605504587155964, "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.028169014084507043, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.030450900000000003, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 304509, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.284013958007563, "latency_p95_seconds": 4.651008541986812, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.9295774647887324, "pair_order_correct": 66, "pair_order_eligible": 71, "precision": 0.9473684210526315, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": null, "recall": 0.5070422535211268, "run_id": "openai-decisions-20261006", "threshold": 0.7, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 66, "eligible": 71, "ties": 1}}
|
| 97 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 4342, "average_precision_answered_methods": 0.49250227678367686, "benchmark_methods": 4440, "benchmark_pairs": 2220, "benchmark_sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2", "complete": true, "confusion": {"fn": 1402, "fp": 489, "tn": 2090, "tp": 459}, "domain": "bug", "f1": 0.3268066927732289, "failed_methods": 98, "failure_counts": {"Decisions returned bug_edge_case:refusal": 81, "Decisions returned has_bug:refusal": 7, "Decisions returned has_bug:refusal, bug_edge_case:refusal": 9, "OpenAI HTTP 503: server_error": 1}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.1896083753392788, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 1.1459717, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 11459717, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.1877637500001583, "latency_p95_seconds": 4.871147208003094, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.46408529741863075, "pair_order_correct": 827, "pair_order_eligible": 1782, "precision": 0.48417721518987344, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.24664159054271897, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 827, "eligible": 1782, "ties": 121}}
|
| 98 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 978, "average_precision_answered_methods": 0.5111512894105066, "benchmark_methods": 996, "benchmark_pairs": 498, "benchmark_sha256": "3df4ade65fedd1128d30bc17c9c9869c8ab9bd526e666156d0e16685e78f8a73", "complete": true, "confusion": {"fn": 299, "fp": 116, "tn": 456, "tp": 125}, "domain": "bug", "f1": 0.37593984962406013, "failed_methods": 18, "failure_counts": {"Decisions returned bug_edge_case:refusal": 11, "Decisions returned has_bug:refusal": 4, "Decisions returned refusal or non-predicate answer (original response)": 3}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.20279720279720279, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.2575815, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 2575815, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.399392875027843, "latency_p95_seconds": 4.782793291989947, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.513715710723192, "pair_order_correct": 206, "pair_order_eligible": 401, "precision": 0.5186721991701245, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.294811320754717, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 206, "eligible": 401, "ties": 16}}
|
| 99 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 2572, "average_precision_answered_methods": 0.5220220092166592, "benchmark_methods": 2622, "benchmark_pairs": 1311, "benchmark_sha256": "2407059caa3486371749884138b997d89043eec646e548ee8f44ba3ab08514b8", "complete": true, "confusion": {"fn": 884, "fp": 236, "tn": 1244, "tp": 258}, "domain": "security", "f1": 0.3154034229828851, "failed_methods": 50, "failure_counts": {"Decisions returned cwe_120:refusal": 14, "Decisions returned cwe_120:refusal, cwe_122:refusal": 1, "Decisions returned cwe_122:refusal": 2, "Decisions returned cwe_639:refusal": 1, "Decisions returned cwe_770:refusal": 14, "Decisions returned cwe_787:refusal, cwe_120:refusal": 1, "Decisions returned cwe_863:refusal": 5, "Decisions returned cwe_863:refusal, cwe_306:refusal": 1, "Decisions returned refusal or non-predicate answer (original response)": 7, "Expecting value: line 1 column 1 (char 0)": 4}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.15945945945945947, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 1.7751056, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 17751056, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.472128333989531, "latency_p95_seconds": 5.120452375005698, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.5026690391459074, "pair_order_correct": 565, "pair_order_eligible": 1124, "precision": 0.5222672064777328, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.22591943957968477, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "public", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 565, "eligible": 1124, "ties": 54}}
|
| 100 |
+
{"alert_rule": "any issue score > max(0.5, question min)", "answered_methods": 867, "average_precision_answered_methods": 0.5169176433965138, "benchmark_methods": 878, "benchmark_pairs": 439, "benchmark_sha256": "a4b81728e9e520cf1c6f342974bec369d72f5b7d8aabc1c9cf2aceba966f8051", "complete": true, "confusion": {"fn": 354, "fp": 31, "tn": 449, "tp": 44}, "domain": "security", "f1": 0.18604651162790697, "failed_methods": 11, "failure_counts": {"Decisions returned cwe_120:refusal": 6, "Decisions returned cwe_770:refusal": 2, "Decisions returned cwe_863:refusal": 2, "Decisions returned refusal or non-predicate answer (original response)": 1}, "failure_policy": "failed positive counts as FN; failed negative counts as FP; failed pair counts as incorrect ordering", "false_positive_rate": 0.06458333333333334, "inference_cost_basis": "Decisions API-reported input tokens at $0.10/M; no output or cache charges; transport failures without returned usage excluded", "inference_cost_usd": 0.6434506000000001, "inference_endpoint": "https://api.openai.com/v1/decisions", "inference_host": "OpenAI Decisions API", "input_tokens": 6434506, "latency_basis": "Per-method elapsed time, including client rate-limit waits and 429 backoff", "latency_median_seconds": 3.465080959023908, "latency_p95_seconds": 4.828431333997287, "model_id": "openai-decisions", "model_revision": "gpt-6-luna", "pair_order": 0.5402010050251256, "pair_order_correct": 215, "pair_order_eligible": 398, "precision": 0.5866666666666667, "protocol_id": "openai-decisions-perch-predicate-v1", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.11055276381909548, "run_id": "openai-decisions-20261006", "threshold": 0.5, "track": "private", "vulnerable_or_buggy_before_above_fixed_after": {"correct": 215, "eligible": 398, "ties": 19}}
|
test_openai_decisions.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import unittest
|
| 2 |
+
|
| 3 |
+
import openai_decisions as decisions
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class DecisionsTests(unittest.TestCase):
|
| 7 |
+
def setUp(self):
|
| 8 |
+
self.pair = {'pair_id': 'repair', 'domain': 'bug', 'language': 'python',
|
| 9 |
+
'rule': {'ensure': 'Reject a zero divisor before dividing.'},
|
| 10 |
+
'before': {'labels': {'bug': 1}, 'state': {'method': {'source': 'before'}}},
|
| 11 |
+
'after': {'labels': {'bug': 0}, 'state': {'method': {'source': 'after'}}}}
|
| 12 |
+
self.pack = decisions.core.load_pack(decisions.ROOT / 'question-pack.json')
|
| 13 |
+
|
| 14 |
+
def test_semantic_satisfaction_is_inverted_to_violation(self):
|
| 15 |
+
response = {'model': decisions.MODEL,
|
| 16 |
+
'answers': [{'type': 'predicate', 'name': 'semantic', 'probability': .1}],
|
| 17 |
+
'usage': {'input_tokens': 100}}
|
| 18 |
+
row = decisions.prediction(self.pair, 'before', 'lint', self.pack, response, .2, 'request')
|
| 19 |
+
self.assertAlmostEqual(row['score'], .9)
|
| 20 |
+
self.assertTrue(row['alert'])
|
| 21 |
+
payload, _ = decisions.payload_for(self.pair, 'before', 'lint', self.pack)
|
| 22 |
+
self.assertIn('before', payload['input'])
|
| 23 |
+
self.assertNotIn('after', payload['input'])
|
| 24 |
+
self.assertNotIn('labels', payload['input'])
|
| 25 |
+
|
| 26 |
+
def test_scan_retains_each_frozen_question_floor(self):
|
| 27 |
+
checks = decisions.questions_for(self.pair, 'bug', self.pack)
|
| 28 |
+
response = {'model': decisions.MODEL,
|
| 29 |
+
'answers': [{'type': 'predicate', 'name': c['name'],
|
| 30 |
+
'probability': max(.5, (c.get('min') or 0) / 100) - .01}
|
| 31 |
+
for c in checks], 'usage': {'input_tokens': 100}}
|
| 32 |
+
row = decisions.prediction(self.pair, 'before', 'bug', self.pack, response, .2, 'request')
|
| 33 |
+
self.assertFalse(row['alert'])
|
| 34 |
+
response['answers'][0]['probability'] = .99
|
| 35 |
+
row = decisions.prediction(self.pair, 'before', 'bug', self.pack, response, .2, 'request')
|
| 36 |
+
self.assertTrue(row['alert'])
|
| 37 |
+
response['answers'].pop()
|
| 38 |
+
with self.assertRaises(ValueError):
|
| 39 |
+
decisions.prediction(self.pair, 'before', 'bug', self.pack, response, .2, 'request')
|
| 40 |
+
|
| 41 |
+
def test_failure_penalty_and_cost_use_actual_returned_usage(self):
|
| 42 |
+
group = {'pairs': [self.pair],
|
| 43 |
+
'predictions': {('repair', 'before'): {'score': .9, 'alert': True,
|
| 44 |
+
'usage': {'input_tokens': 100}, 'latency_seconds': .2}},
|
| 45 |
+
'failures': {('repair', 'after'): {'error': 'timeout'}},
|
| 46 |
+
'domain': 'bug', 'split': 'public', 'digest': 'test'}
|
| 47 |
+
report = decisions.report(group, self.pack)
|
| 48 |
+
self.assertEqual(report['confusion'], {'tp': 1, 'fp': 1, 'fn': 0, 'tn': 0})
|
| 49 |
+
self.assertEqual(report['precision'], .5)
|
| 50 |
+
self.assertEqual(report['pair_order'], 0)
|
| 51 |
+
self.assertAlmostEqual(report['inference_cost_usd'], .00001)
|
| 52 |
+
self.assertTrue(report['complete'])
|
| 53 |
+
|
| 54 |
+
def test_refusal_retains_usage_without_an_invented_probability(self):
|
| 55 |
+
response = {'model': decisions.MODEL,
|
| 56 |
+
'answers': [{'type': 'refusal', 'name': 'semantic'}],
|
| 57 |
+
'usage': {'input_tokens': 123}}
|
| 58 |
+
with self.assertRaises(decisions.AnswerError) as raised:
|
| 59 |
+
decisions.prediction(self.pair, 'before', 'lint', self.pack, response, .2, 'request')
|
| 60 |
+
self.assertEqual(raised.exception.usage['input_tokens'], 123)
|
| 61 |
+
self.assertEqual(raised.exception.answers, response['answers'])
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if __name__ == '__main__':
|
| 65 |
+
unittest.main()
|
tradeoff.py
CHANGED
|
@@ -32,8 +32,10 @@ NAMES = {
|
|
| 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",
|
|
@@ -165,11 +167,11 @@ def results_table(rows: list[dict]) -> str:
|
|
| 165 |
|
| 166 |
def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]], output: Path) -> None:
|
| 167 |
width, height = 1120, 580
|
| 168 |
-
left, right, top, bottom = 90, 40,
|
| 169 |
plot_w, plot_h = width - left - right, height - top - bottom
|
| 170 |
-
#
|
| 171 |
-
x_max =
|
| 172 |
-
y_max = 1.0
|
| 173 |
|
| 174 |
def x(fp: int, negatives: int) -> float:
|
| 175 |
return left + (fp / negatives * 100) / x_max * plot_w
|
|
@@ -182,6 +184,7 @@ def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]],
|
|
| 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>']
|
| 187 |
for i, model in enumerate(ORDER):
|
|
@@ -191,12 +194,12 @@ def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]],
|
|
| 191 |
ly = 91 + row * 22
|
| 192 |
out += [f'<line x1="{lx}" y1="{ly}" x2="{lx + 24}" y2="{ly}" stroke="{COLORS[model]}" stroke-width="4"/>',
|
| 193 |
f'<text x="{lx + 32}" y="{ly + 5}" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="15">{html.escape(NAMES[model][0])}</text>']
|
| 194 |
-
x_step =
|
| 195 |
for value in range(0, x_max + 1, x_step):
|
| 196 |
px = left + value / x_max * plot_w
|
| 197 |
out += [f'<line x1="{px:.1f}" y1="{top}" x2="{px:.1f}" y2="{top + plot_h}" stroke="#29303a"/>',
|
| 198 |
f'<text x="{px:.1f}" y="{top + plot_h + 25}" text-anchor="middle" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="14">{value}%</text>']
|
| 199 |
-
step = 20
|
| 200 |
for value in range(0, round(y_max * 100) + 1, step):
|
| 201 |
py = top + (1 - (value / 100) / y_max) * plot_h
|
| 202 |
out += [f'<line x1="{left}" y1="{py:.1f}" x2="{left + plot_w}" y2="{py:.1f}" stroke="#29303a"/>',
|
|
@@ -206,7 +209,7 @@ def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]],
|
|
| 206 |
visible = [(fp, tp) for fp, tp in points if fp / negatives * 100 <= x_max]
|
| 207 |
if len(visible) > 1:
|
| 208 |
positions = " ".join(f"{x(fp, negatives):.2f},{y(tp, positives):.2f}" for fp, tp in visible)
|
| 209 |
-
out.append(f'<polyline points="{positions}" fill="none" stroke="{COLORS[model]}" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>')
|
| 210 |
out += [f'<text x="{left + plot_w / 2:.1f}" y="{height - 23}" text-anchor="middle" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="17">Clean methods wrongly flagged →</text>',
|
| 211 |
f'<text transform="translate(23 {top + plot_h / 2:.1f}) rotate(-90)" text-anchor="middle" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="17">Actual issues found (recall) →</text>',
|
| 212 |
'</svg>']
|
|
|
|
| 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 |
+
"openai-decisions": ("GPT-6 Luna Decisions", "https://developers.openai.com/api/docs/guides/decisions"),
|
| 36 |
}
|
| 37 |
COLORS = {
|
| 38 |
+
"openai-decisions": "#36b894",
|
| 39 |
"jev": "#1976d2", "typellm": "#c64f81", "liquid-d1": "#7638d6",
|
| 40 |
"diffusiongemma": "#e08a22", "span01": "#168d80", "clm": "#677586",
|
| 41 |
"semif": "#b14b39",
|
|
|
|
| 167 |
|
| 168 |
def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]], output: Path) -> None:
|
| 169 |
width, height = 1120, 580
|
| 170 |
+
left, right, top, bottom = 90, 40, 148, 82
|
| 171 |
plot_w, plot_h = width - left - right, height - top - bottom
|
| 172 |
+
# All benchmarks use one complete plot with the same percentage axes.
|
| 173 |
+
x_max = 100
|
| 174 |
+
y_max = 1.0
|
| 175 |
|
| 176 |
def x(fp: int, negatives: int) -> float:
|
| 177 |
return left + (fp / negatives * 100) / x_max * plot_w
|
|
|
|
| 184 |
f'<title id="title">{title}: recall versus false alerts</title>',
|
| 185 |
'<desc id="desc">Model score curves on the public benchmark. Higher and farther left is better.</desc>',
|
| 186 |
f'<rect width="{width}" height="{height}" rx="16" fill="#101318"/>',
|
| 187 |
+
f'<defs><clipPath id="plot"><rect x="{left}" y="{top}" width="{plot_w}" height="{plot_h}"/></clipPath></defs>',
|
| 188 |
f'<text x="{left}" y="43" fill="#f2f5fa" font-family="Arial,sans-serif" font-weight="700" font-size="28">{html.escape(title)}</text>',
|
| 189 |
f'<text x="{left}" y="70" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="16">Public methods · recall versus false alerts</text>']
|
| 190 |
for i, model in enumerate(ORDER):
|
|
|
|
| 194 |
ly = 91 + row * 22
|
| 195 |
out += [f'<line x1="{lx}" y1="{ly}" x2="{lx + 24}" y2="{ly}" stroke="{COLORS[model]}" stroke-width="4"/>',
|
| 196 |
f'<text x="{lx + 32}" y="{ly + 5}" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="15">{html.escape(NAMES[model][0])}</text>']
|
| 197 |
+
x_step = 20
|
| 198 |
for value in range(0, x_max + 1, x_step):
|
| 199 |
px = left + value / x_max * plot_w
|
| 200 |
out += [f'<line x1="{px:.1f}" y1="{top}" x2="{px:.1f}" y2="{top + plot_h}" stroke="#29303a"/>',
|
| 201 |
f'<text x="{px:.1f}" y="{top + plot_h + 25}" text-anchor="middle" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="14">{value}%</text>']
|
| 202 |
+
step = 20
|
| 203 |
for value in range(0, round(y_max * 100) + 1, step):
|
| 204 |
py = top + (1 - (value / 100) / y_max) * plot_h
|
| 205 |
out += [f'<line x1="{left}" y1="{py:.1f}" x2="{left + plot_w}" y2="{py:.1f}" stroke="#29303a"/>',
|
|
|
|
| 209 |
visible = [(fp, tp) for fp, tp in points if fp / negatives * 100 <= x_max]
|
| 210 |
if len(visible) > 1:
|
| 211 |
positions = " ".join(f"{x(fp, negatives):.2f},{y(tp, positives):.2f}" for fp, tp in visible)
|
| 212 |
+
out.append(f'<polyline points="{positions}" fill="none" stroke="{COLORS[model]}" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round" clip-path="url(#plot)"/>')
|
| 213 |
out += [f'<text x="{left + plot_w / 2:.1f}" y="{height - 23}" text-anchor="middle" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="17">Clean methods wrongly flagged →</text>',
|
| 214 |
f'<text transform="translate(23 {top + plot_h / 2:.1f}) rotate(-90)" text-anchor="middle" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="17">Actual issues found (recall) →</text>',
|
| 215 |
'</svg>']
|