Add TypeLLM benchmark results

#27
README.md CHANGED
@@ -20,6 +20,7 @@ Pairs come from open-source projects in Rust, JavaScript, TypeScript, Python, Go
20
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | Runpod H100 80 GB pod (US-NE-1) |
21
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | [Respan scoring API](https://api.respan.ai/api/v1/scores) (`span-01-pro`) |
22
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | [Liquid decision API](https://api.liquid.ai/decisions/v1/systemone) (`d1:free`) |
 
23
 
24
 
25
  ## Reading the results
@@ -39,6 +40,7 @@ Pairs come from open-source projects in Rust, JavaScript, TypeScript, Python, Go
39
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
40
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
41
  | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **47.3%** | 50.1% | 17.7% | 26.1% | 329 | 328 | 1,532 | 43.8% | $0.551 |
 
42
  | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 46.8% | 47.1% | 33.4% | 39.1% | 621 | 698 | 1,240 | **52.4%** | $0.239 |
43
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 46.6% | **53.9%** | 4.1% | 7.6% | 76 | **65** | 1,785 | 50.1% | Free tier |
44
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.6% | 43.9% | 43.0% | 43.4% | 800 | 1,023 | 1,061 | 44.9% | $0.239 |
@@ -51,8 +53,9 @@ _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN
51
 
52
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
53
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
54
- | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | **48.7%** | **56.4%** | 5.2% | 9.5% | 22 | **17** | 402 | 49.6% | Free tier |
55
- | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 47.9% | 49.4% | 35.8% | 41.5% | 152 | 156 | 272 | **53.1%** | $0.054 |
 
56
  | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 47.1% | 48.9% | 20.0% | 28.4% | 85 | 89 | 339 | 42.9% | $0.123 |
57
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.5% | 46.5% | 28.5% | 35.4% | 121 | 139 | 303 | 44.6% | $0.040 |
58
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.5% | 44.0% | 44.3% | 44.2% | 188 | 239 | 236 | 42.4% | $0.054 |
@@ -70,12 +73,13 @@ _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN
70
 
71
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
72
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
73
- | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **51.5%** | **53.1%** | 34.6% | 41.9% | 395 | 349 | 747 | 52.6% | $0.507 |
 
74
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.4% | 47.8% | 55.6% | 51.4% | 635 | 693 | 507 | 52.2% | Free tier |
75
  | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 48.2% | 49.7% | 33.1% | 39.7% | 378 | 382 | 764 | **53.7%** | $0.208 |
76
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 47.6% | 48.6% | 21.0% | 29.3% | 240 | **254** | 902 | 43.7% | $0.251 |
77
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 43.9% | 43.6% | **100.0%** | **60.7%** | **1,142** | 1,479 | **0** | 46.2% | $0.208 |
78
- | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 42.9% | 43.6% | **100.0%** | **60.7%** | **1,142** | 1,480 | **0** | 45.9% | ~$1.432 |
79
 
80
  _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN are better._
81
 
@@ -84,9 +88,10 @@ _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN
84
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
85
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
86
  | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | **49.2%** | 49.4% | 21.9% | 30.3% | 87 | 89 | 311 | **51.5%** | $0.074 |
87
- | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 48.9% | **50.6%** | 20.6% | 29.3% | 82 | 80 | 316 | 40.2% | $0.182 |
 
88
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 47.8% | 49.5% | 34.2% | 40.4% | 136 | 139 | 262 | 45.5% | Free tier |
89
- | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 47.8% | 45.1% | 8.0% | 13.6% | 32 | **39** | 366 | 50.5% | $0.091 |
90
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 46.9% | 45.3% | **100.0%** | **62.4%** | **398** | 480 | **0** | 51.3% | ~$0.528 |
91
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 46.8% | 45.3% | **100.0%** | **62.4%** | **398** | 480 | **0** | 50.0% | $0.074 |
92
 
@@ -101,8 +106,9 @@ _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN
101
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
102
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
103
  | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **95.0%** | **99.1%** | 50.0% | 66.5% | 107 | **1** | 107 | **96.3%** | $0.048 |
 
104
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 92.5% | 98.1% | 49.1% | 65.4% | 105 | 2 | 109 | 93.5% | Free tier |
105
- | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 87.0% | 91.1% | **52.8%** | **66.9%** | **113** | 11 | **101** | 86.4% | $0.018 |
106
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 79.6% | 81.7% | 50.0% | 62.0% | 107 | 24 | 107 | 88.3% | $0.014 |
107
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.5% | 50.9% | 38.8% | 44.0% | 83 | 80 | 131 | 51.4% | ~$0.010 |
108
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 50.0% | 50.7% | 32.2% | 39.4% | 69 | 67 | 145 | 56.5% | $0.018 |
@@ -113,10 +119,11 @@ _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN
113
 
114
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
115
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
116
- | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **94.3%** | **97.4%** | **53.5%** | **69.1%** | **38** | **1** | **33** | 94.4% | $0.016 |
 
117
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 92.4% | 97.2% | 49.3% | 65.4% | 35 | **1** | 36 | **97.2%** | Free tier |
118
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 83.2% | 84.2% | 45.1% | 58.7% | 32 | 6 | 39 | 91.5% | $0.005 |
119
- | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 83.0% | 86.4% | **53.5%** | 66.1% | **38** | 6 | **33** | 85.9% | $0.006 |
120
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 51.4% | 50.7% | 50.7% | 50.7% | 36 | 35 | 35 | 56.3% | ~$0.003 |
121
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 48.9% | 48.4% | 42.3% | 45.1% | 30 | 32 | 41 | 50.7% | $0.006 |
122
 
@@ -129,7 +136,7 @@ Span-01 uses its [behavior-scoring API](https://www.respan.ai/docs/documentation
129
 
130
  Liquid d1 received the same Perch method state and all applicable questions in one API call per method. Semantic lint used the same compiled `ensure` rule as Jev.
131
 
132
- Inference costs cover scoring the method sides in each table. Jev costs are estimated from API-reported input tokens at [TypeSafe's published rate](https://typesafe.ai/blog/introducing-system-one-models-and-jev); for semantic lint, input-token usage was measured by replaying the same 570 requests with `jev-1.13.0`. Span-01 costs use API-reported input tokens at [Respan's published rate](https://www.respan.ai/docs/documentation/span-01/concept). Beam costs are API-reported. CLM cost is an estimated share of a 38.4-minute H100 run costing $2.23 total, allocated by embedding count. Costs are not ranked. Liquid d1 was tested on the `d1:free` API tier; a paid per-token price was not published.
133
 
134
  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.
135
 
@@ -141,6 +148,7 @@ JevLike (192-byte input), Laya (512-token input), and Kev (packed-branch limit)
141
  - [`benchmark.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/benchmark.py) and [`question-pack.json`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/question-pack.json): reproducible current-pack scorer and frozen questions.
142
  - [`span01.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/span01.py): calls Span-01 with all applicable behaviors in one request per method, saves resumable predictions, and scores the completed dataset.
143
  - [`liquid.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/liquid.py): calls Liquid d1 with the frozen Perch question pack, saves resumable predictions, and scores each track.
 
144
  - [`perch-lint-bench-public`](https://huggingface.co/datasets/perchscan/perch-lint-bench-public): paired rules and its runnable scorer.
145
 
146
  To run Jev with the current pack, set `TYPESAFE_API_KEY` or `PERCH_API_KEY` in your environment:
 
20
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | Runpod H100 80 GB pod (US-NE-1) |
21
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | [Respan scoring API](https://api.respan.ai/api/v1/scores) (`span-01-pro`) |
22
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | [Liquid decision API](https://api.liquid.ai/decisions/v1/systemone) (`d1:free`) |
23
+ | [TypeLLM](https://typellm.ai/docs) | [TypeLLM API](https://api.typellm.ai/v1/generate) (`typellm-latest`) |
24
 
25
 
26
  ## Reading the results
 
40
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
41
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
42
  | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **47.3%** | 50.1% | 17.7% | 26.1% | 329 | 328 | 1,532 | 43.8% | $0.551 |
43
+ | [TypeLLM](https://typellm.ai/docs) | 47.3% | 51.9% | 8.3% | 14.3% | 154 | 143 | 1,707 | 51.3% | $0.576 |
44
  | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 46.8% | 47.1% | 33.4% | 39.1% | 621 | 698 | 1,240 | **52.4%** | $0.239 |
45
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 46.6% | **53.9%** | 4.1% | 7.6% | 76 | **65** | 1,785 | 50.1% | Free tier |
46
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.6% | 43.9% | 43.0% | 43.4% | 800 | 1,023 | 1,061 | 44.9% | $0.239 |
 
53
 
54
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
55
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
56
+ | [TypeLLM](https://typellm.ai/docs) | **50.6%** | **59.3%** | 11.3% | 19.0% | 48 | 33 | 376 | **55.1%** | $0.129 |
57
+ | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 48.7% | 56.4% | 5.2% | 9.5% | 22 | **17** | 402 | 49.6% | Free tier |
58
+ | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 47.9% | 49.4% | 35.8% | 41.5% | 152 | 156 | 272 | 53.1% | $0.054 |
59
  | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 47.1% | 48.9% | 20.0% | 28.4% | 85 | 89 | 339 | 42.9% | $0.123 |
60
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.5% | 46.5% | 28.5% | 35.4% | 121 | 139 | 303 | 44.6% | $0.040 |
61
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.5% | 44.0% | 44.3% | 44.2% | 188 | 239 | 236 | 42.4% | $0.054 |
 
73
 
74
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
75
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
76
+ | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **51.5%** | 53.1% | 34.6% | 41.9% | 395 | 349 | 747 | 52.6% | $0.507 |
77
+ | [TypeLLM](https://typellm.ai/docs) | 50.8% | **55.3%** | 27.8% | 37.0% | 318 | 257 | 824 | 52.0% | $0.566 |
78
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.4% | 47.8% | 55.6% | 51.4% | 635 | 693 | 507 | 52.2% | Free tier |
79
  | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 48.2% | 49.7% | 33.1% | 39.7% | 378 | 382 | 764 | **53.7%** | $0.208 |
80
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 47.6% | 48.6% | 21.0% | 29.3% | 240 | **254** | 902 | 43.7% | $0.251 |
81
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 43.9% | 43.6% | **100.0%** | **60.7%** | **1,142** | 1,479 | **0** | 46.2% | $0.208 |
82
+ | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 42.9% | 43.6% | **100.0%** | 60.7% | **1,142** | 1,480 | **0** | 45.9% | ~$1.432 |
83
 
84
  _Sorted by AP. Bold marks the best value in each quality column; lower FP and FN are better._
85
 
 
88
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
89
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
90
  | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | **49.2%** | 49.4% | 21.9% | 30.3% | 87 | 89 | 311 | **51.5%** | $0.074 |
91
+ | [TypeLLM](https://typellm.ai/docs) | 49.2% | **53.8%** | 8.8% | 15.1% | 35 | **30** | 363 | 50.3% | $0.203 |
92
+ | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 48.9% | 50.6% | 20.6% | 29.3% | 82 | 80 | 316 | 40.2% | $0.182 |
93
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 47.8% | 49.5% | 34.2% | 40.4% | 136 | 139 | 262 | 45.5% | Free tier |
94
+ | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 47.8% | 45.1% | 8.0% | 13.6% | 32 | 39 | 366 | 50.5% | $0.091 |
95
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 46.9% | 45.3% | **100.0%** | **62.4%** | **398** | 480 | **0** | 51.3% | ~$0.528 |
96
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 46.8% | 45.3% | **100.0%** | **62.4%** | **398** | 480 | **0** | 50.0% | $0.074 |
97
 
 
106
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
107
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
108
  | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | **95.0%** | **99.1%** | 50.0% | 66.5% | 107 | **1** | 107 | **96.3%** | $0.048 |
109
+ | [TypeLLM](https://typellm.ai/docs) | 94.9% | 95.7% | **61.7%** | **75.0%** | **132** | 6 | **82** | 95.3% | $0.050 |
110
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 92.5% | 98.1% | 49.1% | 65.4% | 105 | 2 | 109 | 93.5% | Free tier |
111
+ | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 87.0% | 91.1% | 52.8% | 66.9% | 113 | 11 | 101 | 86.4% | $0.018 |
112
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 79.6% | 81.7% | 50.0% | 62.0% | 107 | 24 | 107 | 88.3% | $0.014 |
113
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.5% | 50.9% | 38.8% | 44.0% | 83 | 80 | 131 | 51.4% | ~$0.010 |
114
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 50.0% | 50.7% | 32.2% | 39.4% | 69 | 67 | 145 | 56.5% | $0.018 |
 
119
 
120
  | Model | AP | Precision | Recall | F1 | TP | FP | FN | Pair order | Inference cost |
121
  | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
122
+ | [TypeLLM](https://typellm.ai/docs) | **94.4%** | 91.3% | **59.2%** | **71.8%** | **42** | 4 | **29** | **97.2%** | $0.016 |
123
+ | [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 94.3% | **97.4%** | 53.5% | 69.1% | 38 | **1** | 33 | 94.4% | $0.016 |
124
  | [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 92.4% | 97.2% | 49.3% | 65.4% | 35 | **1** | 36 | **97.2%** | Free tier |
125
  | [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 83.2% | 84.2% | 45.1% | 58.7% | 32 | 6 | 39 | 91.5% | $0.005 |
126
+ | [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 83.0% | 86.4% | 53.5% | 66.1% | 38 | 6 | 33 | 85.9% | $0.006 |
127
  | [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 51.4% | 50.7% | 50.7% | 50.7% | 36 | 35 | 35 | 56.3% | ~$0.003 |
128
  | [SemiF](https://github.com/TheoLeeCJ/SemIf) | 48.9% | 48.4% | 42.3% | 45.1% | 30 | 32 | 41 | 50.7% | $0.006 |
129
 
 
136
 
137
  Liquid d1 received the same Perch method state and all applicable questions in one API call per method. Semantic lint used the same compiled `ensure` rule as Jev.
138
 
139
+ Inference costs cover scoring the method sides in each table. Jev costs are estimated from API-reported input tokens at [TypeSafe's published rate](https://typesafe.ai/blog/introducing-system-one-models-and-jev); for semantic lint, input-token usage was measured by replaying the same 570 requests with `jev-1.13.0`. Span-01 costs use API-reported input tokens at [Respan's published rate](https://www.respan.ai/docs/documentation/span-01/concept). Beam costs are API-reported. CLM cost is an estimated share of a 38.4-minute H100 run costing $2.23 total, allocated by embedding count. Costs are not ranked. Liquid d1 was tested on the `d1:free` API tier; a paid per-token price was not published. TypeLLM cost uses API-reported input tokens at its [published rate](https://typellm.ai/pricing); no thinking tokens were used.
140
 
141
  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.
142
 
 
148
  - [`benchmark.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/benchmark.py) and [`question-pack.json`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/question-pack.json): reproducible current-pack scorer and frozen questions.
149
  - [`span01.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/span01.py): calls Span-01 with all applicable behaviors in one request per method, saves resumable predictions, and scores the completed dataset.
150
  - [`liquid.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/liquid.py): calls Liquid d1 with the frozen Perch question pack, saves resumable predictions, and scores each track.
151
+ - [`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.
152
  - [`perch-lint-bench-public`](https://huggingface.co/datasets/perchscan/perch-lint-bench-public): paired rules and its runnable scorer.
153
 
154
  To run Jev with the current pack, set `TYPESAFE_API_KEY` or `PERCH_API_KEY` in your environment:
predictions/current/bug/typellm.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
predictions/current/lint/typellm.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
predictions/current/security/typellm.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
results-current.jsonl CHANGED
@@ -34,3 +34,9 @@
34
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4784904017284298, "benchmark_methods": 878, "benchmark_pairs": 439, "benchmark_sha256": "a4b81728e9e520cf1c6f342974bec369d72f5b7d8aabc1c9cf2aceba966f8051", "confusion": {"fn": 262, "fp": 139, "tn": 341, "tp": 136}, "domain": "security", "f1": 0.40416047548291234, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 62054285, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.4547738693467337, "pair_order_correct": 181, "pair_order_eligible": 398, "precision": 0.49454545454545457, "protocol_id": "liquid-d1-perch-scan-pack-v1", "question_pack_sha256": "bb53c8a6ca30920140e2bf33b2905d159e7b1709b29d1ea896637905dbf9047d", "recall": 0.3417085427135678, "run_id": "liquid-d1-perch-scan-20260929", "threshold": 0.5, "track": "private"}
35
  {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9251948043796072, "benchmark_methods": 428, "benchmark_pairs": 214, "benchmark_sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75", "confusion": {"fn": 109, "fp": 2, "tn": 212, "tp": 105}, "domain": "lint", "f1": 0.6542056074766355, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 985496, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.9345794392523364, "pair_order_correct": 200, "pair_order_eligible": 214, "precision": 0.9813084112149533, "protocol_id": "liquid-d1-perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.49065420560747663, "run_id": "liquid-d1-perch-scan-20260929", "threshold": 0.7, "track": "public"}
36
  {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9239761802875874, "benchmark_methods": 142, "benchmark_pairs": 71, "benchmark_sha256": "a6e9f2e4ee8ae77bdaf23af46920d97d1ba47375dc9ce03b950cdbe95c2777f9", "confusion": {"fn": 36, "fp": 1, "tn": 70, "tp": 35}, "domain": "lint", "f1": 0.6542056074766355, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 315606, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9722222222222222, "protocol_id": "liquid-d1-perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.49295774647887325, "run_id": "liquid-d1-perch-scan-20260929", "threshold": 0.7, "track": "private"}
 
 
 
 
 
 
 
34
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4784904017284298, "benchmark_methods": 878, "benchmark_pairs": 439, "benchmark_sha256": "a4b81728e9e520cf1c6f342974bec369d72f5b7d8aabc1c9cf2aceba966f8051", "confusion": {"fn": 262, "fp": 139, "tn": 341, "tp": 136}, "domain": "security", "f1": 0.40416047548291234, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 62054285, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.4547738693467337, "pair_order_correct": 181, "pair_order_eligible": 398, "precision": 0.49454545454545457, "protocol_id": "liquid-d1-perch-scan-pack-v1", "question_pack_sha256": "bb53c8a6ca30920140e2bf33b2905d159e7b1709b29d1ea896637905dbf9047d", "recall": 0.3417085427135678, "run_id": "liquid-d1-perch-scan-20260929", "threshold": 0.5, "track": "private"}
35
  {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9251948043796072, "benchmark_methods": 428, "benchmark_pairs": 214, "benchmark_sha256": "534f6c2abddc507c40f4597607e97e07168c544011d617b83aa39e08abb35d75", "confusion": {"fn": 109, "fp": 2, "tn": 212, "tp": 105}, "domain": "lint", "f1": 0.6542056074766355, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 985496, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.9345794392523364, "pair_order_correct": 200, "pair_order_eligible": 214, "precision": 0.9813084112149533, "protocol_id": "liquid-d1-perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.49065420560747663, "run_id": "liquid-d1-perch-scan-20260929", "threshold": 0.7, "track": "public"}
36
  {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9239761802875874, "benchmark_methods": 142, "benchmark_pairs": 71, "benchmark_sha256": "a6e9f2e4ee8ae77bdaf23af46920d97d1ba47375dc9ce03b950cdbe95c2777f9", "confusion": {"fn": 36, "fp": 1, "tn": 70, "tp": 35}, "domain": "lint", "f1": 0.6542056074766355, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 315606, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9722222222222222, "protocol_id": "liquid-d1-perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.49295774647887325, "run_id": "liquid-d1-perch-scan-20260929", "threshold": 0.7, "track": "private"}
37
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4730101495499027, "benchmark_methods": 4440, "benchmark_pairs": 2220, "confusion": {"fn": 1707, "fp": 143, "tn": 2436, "tp": 154}, "domain": "bug", "f1": 0.14272474513438368, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.57606375, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5129068462401796, "pair_order_correct": 914, "pair_order_eligible": 1782, "precision": 0.5185185185185185, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08275120902740463, "run_id": "typellm-20260930", "threshold": 0.5, "track": "public"}
38
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.5064587972284842, "benchmark_methods": 996, "benchmark_pairs": 498, "confusion": {"fn": 376, "fp": 33, "tn": 539, "tp": 48}, "domain": "bug", "f1": 0.1900990099009901, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.12900565, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5511221945137157, "pair_order_correct": 221, "pair_order_eligible": 401, "precision": 0.5925925925925926, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.11320754716981132, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
39
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.5078855584544545, "benchmark_methods": 2622, "benchmark_pairs": 1311, "confusion": {"fn": 824, "fp": 257, "tn": 1223, "tp": 318}, "domain": "security", "f1": 0.37041351193942923, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.566494, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5195729537366548, "pair_order_correct": 584, "pair_order_eligible": 1124, "precision": 0.5530434782608695, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.27845884413309985, "run_id": "typellm-20260930", "threshold": 0.5, "track": "public"}
40
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4916331564208488, "benchmark_methods": 878, "benchmark_pairs": 439, "confusion": {"fn": 363, "fp": 30, "tn": 450, "tp": 35}, "domain": "security", "f1": 0.1511879049676026, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.20261235, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5025125628140703, "pair_order_correct": 200, "pair_order_eligible": 398, "precision": 0.5384615384615384, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08793969849246232, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
41
+ {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9489849049042018, "benchmark_methods": 428, "benchmark_pairs": 214, "confusion": {"fn": 82, "fp": 6, "tn": 208, "tp": 132}, "domain": "lint", "f1": 0.75, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.049926450000000004, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.9532710280373832, "pair_order_correct": 204, "pair_order_eligible": 214, "precision": 0.9565217391304348, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.616822429906542, "run_id": "typellm-20260930", "threshold": 0.7, "track": "public"}
42
+ {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9441042508382544, "benchmark_methods": 142, "benchmark_pairs": 71, "confusion": {"fn": 29, "fp": 4, "tn": 67, "tp": 42}, "domain": "lint", "f1": 0.717948717948718, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.0159958, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9130434782608695, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.5915492957746479, "run_id": "typellm-20260930", "threshold": 0.7, "track": "private"}
results.jsonl CHANGED
@@ -80,3 +80,9 @@
80
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.47062948664262266, "benchmark_methods": 996, "benchmark_pairs": 498, "confusion": {"fn": 339, "fp": 89, "tn": 483, "tp": 85}, "domain": "bug", "f1": 0.2842809364548495, "inference_cost_basis": "API input tokens at published rate", "inference_cost_usd": 0.122626728, "inference_endpoint": "https://api.typesafe.ai/v1/systemone", "inference_host": "TypeSafe API", "model_id": "jev", "model_revision": "jev-1.13.0", "pair_order": 0.428927680798005, "pair_order_correct": 172, "pair_order_eligible": 401, "precision": 0.4885057471264368, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.20047169811320756, "run_id": "perch-bug-two-questions-20260929", "threshold": 0.5, "track": "private"}
81
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.46569203965559486, "benchmark_methods": 4440, "benchmark_pairs": 2220, "benchmark_sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2", "confusion": {"fn": 1785, "fp": 65, "tn": 2514, "tp": 76}, "domain": "bug", "f1": 0.07592407592407592, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 44836228, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.5011223344556678, "pair_order_correct": 893, "pair_order_eligible": 1782, "precision": 0.5390070921985816, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.04083825900053734, "run_id": "perch-bug-two-questions-20260929", "threshold": 0.5, "track": "public"}
82
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.48689814906750656, "benchmark_methods": 996, "benchmark_pairs": 498, "benchmark_sha256": "3df4ade65fedd1128d30bc17c9c9869c8ab9bd526e666156d0e16685e78f8a73", "confusion": {"fn": 402, "fp": 17, "tn": 555, "tp": 22}, "domain": "bug", "f1": 0.09503239740820735, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 10077688, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.49625935162094764, "pair_order_correct": 199, "pair_order_eligible": 401, "precision": 0.5641025641025641, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.05188679245283019, "run_id": "perch-bug-two-questions-20260929", "threshold": 0.5, "track": "private"}
 
 
 
 
 
 
 
80
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.47062948664262266, "benchmark_methods": 996, "benchmark_pairs": 498, "confusion": {"fn": 339, "fp": 89, "tn": 483, "tp": 85}, "domain": "bug", "f1": 0.2842809364548495, "inference_cost_basis": "API input tokens at published rate", "inference_cost_usd": 0.122626728, "inference_endpoint": "https://api.typesafe.ai/v1/systemone", "inference_host": "TypeSafe API", "model_id": "jev", "model_revision": "jev-1.13.0", "pair_order": 0.428927680798005, "pair_order_correct": 172, "pair_order_eligible": 401, "precision": 0.4885057471264368, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.20047169811320756, "run_id": "perch-bug-two-questions-20260929", "threshold": 0.5, "track": "private"}
81
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.46569203965559486, "benchmark_methods": 4440, "benchmark_pairs": 2220, "benchmark_sha256": "32bc68bc85d5535ad28e103adbfa0c09c73e09d0f53a53f7ca35ec219a96e6e2", "confusion": {"fn": 1785, "fp": 65, "tn": 2514, "tp": 76}, "domain": "bug", "f1": 0.07592407592407592, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 44836228, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.5011223344556678, "pair_order_correct": 893, "pair_order_eligible": 1782, "precision": 0.5390070921985816, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.04083825900053734, "run_id": "perch-bug-two-questions-20260929", "threshold": 0.5, "track": "public"}
82
  {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.48689814906750656, "benchmark_methods": 996, "benchmark_pairs": 498, "benchmark_sha256": "3df4ade65fedd1128d30bc17c9c9869c8ab9bd526e666156d0e16685e78f8a73", "confusion": {"fn": 402, "fp": 17, "tn": 555, "tp": 22}, "domain": "bug", "f1": 0.09503239740820735, "inference_cost_basis": "d1:free API tier; no published per-token rate", "inference_cost_usd": null, "inference_endpoint": "https://api.liquid.ai/decisions/v1/systemone", "inference_host": "Liquid AI API", "input_tokens": 10077688, "model_id": "liquid-d1", "model_revision": "d1:free (API revision not published)", "output_tokens": 0, "pair_order": 0.49625935162094764, "pair_order_correct": 199, "pair_order_eligible": 401, "precision": 0.5641025641025641, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.05188679245283019, "run_id": "perch-bug-two-questions-20260929", "threshold": 0.5, "track": "private"}
83
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4730101495499027, "benchmark_methods": 4440, "benchmark_pairs": 2220, "confusion": {"fn": 1707, "fp": 143, "tn": 2436, "tp": 154}, "domain": "bug", "f1": 0.14272474513438368, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.57606375, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5129068462401796, "pair_order_correct": 914, "pair_order_eligible": 1782, "precision": 0.5185185185185185, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08275120902740463, "run_id": "typellm-20260930", "threshold": 0.5, "track": "public"}
84
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.5064587972284842, "benchmark_methods": 996, "benchmark_pairs": 498, "confusion": {"fn": 376, "fp": 33, "tn": 539, "tp": 48}, "domain": "bug", "f1": 0.1900990099009901, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.12900565, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5511221945137157, "pair_order_correct": 221, "pair_order_eligible": 401, "precision": 0.5925925925925926, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.11320754716981132, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
85
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.5078855584544545, "benchmark_methods": 2622, "benchmark_pairs": 1311, "confusion": {"fn": 824, "fp": 257, "tn": 1223, "tp": 318}, "domain": "security", "f1": 0.37041351193942923, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.566494, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5195729537366548, "pair_order_correct": 584, "pair_order_eligible": 1124, "precision": 0.5530434782608695, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.27845884413309985, "run_id": "typellm-20260930", "threshold": 0.5, "track": "public"}
86
+ {"alert_rule": "any issue score > max(run threshold, question min)", "average_precision": 0.4916331564208488, "benchmark_methods": 878, "benchmark_pairs": 439, "confusion": {"fn": 363, "fp": 30, "tn": 450, "tp": 35}, "domain": "security", "f1": 0.1511879049676026, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.20261235, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.5025125628140703, "pair_order_correct": 200, "pair_order_eligible": 398, "precision": 0.5384615384615384, "protocol_id": "perch-scan-afe116cc8461", "question_pack_sha256": "afe116cc8461552aaca996f8f0b639cdf5e42e9d8291c59995482309b5c330dc", "recall": 0.08793969849246232, "run_id": "typellm-20260930", "threshold": 0.5, "track": "private"}
87
+ {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9489849049042018, "benchmark_methods": 428, "benchmark_pairs": 214, "confusion": {"fn": 82, "fp": 6, "tn": 208, "tp": 132}, "domain": "lint", "f1": 0.75, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.049926450000000004, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.9532710280373832, "pair_order_correct": 204, "pair_order_eligible": 214, "precision": 0.9565217391304348, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.616822429906542, "run_id": "typellm-20260930", "threshold": 0.7, "track": "public"}
88
+ {"alert_rule": "rule violation score > 0.7", "average_precision": 0.9441042508382544, "benchmark_methods": 142, "benchmark_pairs": 71, "confusion": {"fn": 29, "fp": 4, "tn": 67, "tp": 42}, "domain": "lint", "f1": 0.717948717948718, "inference_cost_basis": "API-reported input and thinking tokens at published TypeLLM rates", "inference_cost_usd": 0.0159958, "inference_endpoint": "https://api.typellm.ai/v1/generate", "inference_host": "TypeLLM", "model_id": "typellm", "model_revision": "typellm-latest", "pair_order": 0.971830985915493, "pair_order_correct": 69, "pair_order_eligible": 71, "precision": 0.9130434782608695, "protocol_id": "perch-semantic-ensure-v1", "question_pack_sha256": null, "recall": 0.5915492957746479, "run_id": "typellm-20260930", "threshold": 0.7, "track": "private"}
typellm.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Score Perch benchmark methods with TypeLLM's hosted boolean API.
3
+
4
+ Every method side is an independent request. Applicable bug/security questions
5
+ share that request; a semantic-lint pair uses its same ensure rule on both sides.
6
+ The JSONL predictions are append-only and can be resumed after interruption.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import argparse
12
+ from concurrent.futures import ThreadPoolExecutor, as_completed
13
+ import hashlib
14
+ import importlib.util
15
+ import json
16
+ import math
17
+ import os
18
+ from pathlib import Path
19
+ import random
20
+ import sys
21
+ import threading
22
+ import time
23
+ from urllib.error import HTTPError, URLError
24
+ from urllib.request import Request, urlopen
25
+
26
+
27
+ MODEL = "typellm-latest"
28
+ API = "https://api.typellm.ai/v1/generate"
29
+ PROTOCOL = "typellm-boolean-v1"
30
+ LINT_PROTOCOL = "perch-semantic-ensure-v1"
31
+ DEFAULT_INTERVAL = 0.62 # Below the documented account cap of 100 requests/minute.
32
+
33
+
34
+ def module_at(name: str, path: Path):
35
+ spec = importlib.util.spec_from_file_location(name, path)
36
+ if spec is None or spec.loader is None:
37
+ raise ValueError(f"Cannot import {path}")
38
+ module = importlib.util.module_from_spec(spec)
39
+ spec.loader.exec_module(module)
40
+ return module
41
+
42
+
43
+ def probability(value: object) -> float:
44
+ if isinstance(value, bool):
45
+ raise ValueError("Boolean is not a probability")
46
+ score = float(value)
47
+ if not math.isfinite(score) or not 0 <= score <= 1:
48
+ raise ValueError("Invalid probability")
49
+ return score
50
+
51
+
52
+ class RateLimiter:
53
+ def __init__(self, interval: float):
54
+ self.interval = interval
55
+ self.lock = threading.Lock()
56
+ self.next_at = time.monotonic()
57
+
58
+ def wait(self):
59
+ with self.lock:
60
+ now = time.monotonic()
61
+ at = max(now, self.next_at)
62
+ self.next_at = at + self.interval
63
+ if at > now:
64
+ time.sleep(at - now)
65
+
66
+ def back_off(self, seconds: float):
67
+ with self.lock:
68
+ self.next_at = max(self.next_at, time.monotonic() + seconds)
69
+
70
+
71
+ def type_question(question: dict) -> dict:
72
+ item = question["question"]
73
+ true = str(item["criteria"]["true"]).strip()
74
+ false = str(item["criteria"]["false"]).strip()
75
+ return {
76
+ "type": "boolean",
77
+ "instructions": f'{item["instructions"].strip()}\nTrue: {true}\nFalse: {false}',
78
+ "return_probabilities": True,
79
+ }
80
+
81
+
82
+ def lint_question(ensure: str) -> dict:
83
+ rule = " ".join(ensure.split())
84
+ return {
85
+ "type": "boolean",
86
+ "instructions": f"Is `rule` true of the code below?\nRule: {rule}\nTrue: {rule}\nFalse: Not so: {rule}",
87
+ "return_probabilities": True,
88
+ }
89
+
90
+
91
+ def true_score(result: dict) -> float:
92
+ values = result.get("probabilities")
93
+ if not isinstance(values, dict) or "true" not in values or "false" not in values:
94
+ raise ValueError("TypeLLM did not return both boolean probabilities")
95
+ true, false = probability(values["true"]), probability(values["false"])
96
+ if abs(true + false - 1) > 1e-5:
97
+ raise ValueError("Boolean probabilities do not sum to one")
98
+ return true
99
+
100
+
101
+ def invoke(key: str, state: dict, questions: dict, limiter: RateLimiter) -> dict:
102
+ context = "Perch method context (JSON):\n" + json.dumps(state, ensure_ascii=False, separators=(",", ":"))
103
+ payload = json.dumps({"model": MODEL, "context": context, "questions": questions,
104
+ "options": {"temperature": 0}, "timeout": 90}, ensure_ascii=False).encode()
105
+ headers = {"Authorization": "Bearer " + key, "Content-Type": "application/json"}
106
+ for attempt in range(8):
107
+ limiter.wait()
108
+ started = time.monotonic()
109
+ request = Request(API, data=payload, headers=headers, method="POST")
110
+ try:
111
+ with urlopen(request, timeout=105) as response:
112
+ data = json.load(response)
113
+ if data.get("model") != MODEL or set(data.get("result", {})) != set(questions):
114
+ raise ValueError("TypeLLM returned a different model or incomplete result")
115
+ data["request_elapsed_s"] = round(time.monotonic() - started, 3)
116
+ return data
117
+ except HTTPError as exc:
118
+ if exc.code not in (429, 502, 503, 504) or attempt == 7:
119
+ raise RuntimeError(f"TypeLLM HTTP {exc.code}") from None
120
+ header = exc.headers.get("Retry-After")
121
+ try:
122
+ delay = max(1.0, min(90.0, float(header)))
123
+ except (ValueError, TypeError):
124
+ delay = min(60.0, 2.0 ** attempt)
125
+ limiter.back_off(delay)
126
+ time.sleep(delay + random.random() * 0.2)
127
+ except URLError:
128
+ if attempt == 7:
129
+ raise RuntimeError("TypeLLM transport failed after retries") from None
130
+ time.sleep(min(30, 2 ** attempt))
131
+ raise AssertionError("unreachable")
132
+
133
+
134
+ def load_pairs(path: Path, track: str):
135
+ raw = path.read_bytes()
136
+ pairs = [json.loads(line) for line in raw.splitlines() if line]
137
+ if not pairs:
138
+ raise ValueError("Empty benchmark")
139
+ seen = set()
140
+ for pair in pairs:
141
+ pair_id = pair["pair_id"]
142
+ if pair_id in seen:
143
+ raise ValueError("Duplicate pair ID")
144
+ seen.add(pair_id)
145
+ if track != "lint" and pair["domain"] != track:
146
+ raise ValueError("Wrong benchmark domain")
147
+ if track == "lint" and not pair.get("rule", {}).get("ensure"):
148
+ raise ValueError("Missing semantic lint rule")
149
+ return pairs, hashlib.sha256(raw).hexdigest()
150
+
151
+
152
+ def saved_predictions(path: Path, pairs: list[dict], digest: str, track: str, pack: dict | None):
153
+ expected = {(pair["pair_id"], role) for pair in pairs for role in ("before", "after")}
154
+ rows = {}
155
+ if not path.exists():
156
+ return rows
157
+ for line in path.open():
158
+ row = json.loads(line)
159
+ key = row["pair_id"], row["role"]
160
+ if key not in expected or key in rows or row["dataset_sha256"] != digest:
161
+ raise ValueError("Unexpected or duplicate saved prediction")
162
+ if track == "lint":
163
+ if row["protocol"] != LINT_PROTOCOL or row["model"] != MODEL:
164
+ raise ValueError("Incompatible saved lint prediction")
165
+ if abs(probability(row["score"]) + probability(row["rule_true_probability"]) - 1) > 1e-8:
166
+ raise ValueError("Invalid saved lint score")
167
+ else:
168
+ if (row["protocol_id"] != pack["protocol_id"] or row.get("interface_id") != PROTOCOL
169
+ or row["model_revision"] != MODEL
170
+ or row["pack_sha256"] != pack["pack_sha256"]):
171
+ raise ValueError("Incompatible saved scan prediction")
172
+ rows[key] = row
173
+ return rows
174
+
175
+
176
+ def score_one(pair: dict, role: str, track: str, pack: dict | None, core,
177
+ key: str, digest: str, limiter: RateLimiter, threshold: float) -> dict:
178
+ state = pair[role]["state"]
179
+ if track == "lint":
180
+ questions = {"rule_true": lint_question(pair["rule"]["ensure"])}
181
+ else:
182
+ selected = core.detection_questions(core.scan_questions(pack, track, pair["language"]), track)
183
+ questions = {question["name"]: type_question(question) for question in selected}
184
+ if not questions:
185
+ raise ValueError("No applicable detection questions")
186
+ response = invoke(key, state, questions, limiter)
187
+ usage = response.get("usage") or {}
188
+ if track == "lint":
189
+ true = true_score(response["result"]["rule_true"])
190
+ return {"pair_id": pair["pair_id"], "role": role, "domain": pair["domain"],
191
+ "model": MODEL, "protocol": LINT_PROTOCOL, "dataset_sha256": digest,
192
+ "rule_true_probability": true, "score": 1 - true,
193
+ "usage": usage, "elapsed_s": response["request_elapsed_s"]}
194
+ scores = {name: core.raised_score(question, true_score(response["result"][name]))
195
+ for question in selected for name in (question["name"],)}
196
+ score, alert = core.scan_result(scores, selected, track, threshold)
197
+ return {"pair_id": pair["pair_id"], "role": role, "domain": track,
198
+ "model_id": "typellm", "model_revision": MODEL,
199
+ "protocol_id": pack["protocol_id"], "interface_id": PROTOCOL,
200
+ "pack_sha256": pack["pack_sha256"],
201
+ "dataset_sha256": digest, "question_scores": scores,
202
+ "score": score, "alert": alert, "usage": usage,
203
+ "elapsed_s": response["request_elapsed_s"]}
204
+
205
+
206
+ def main():
207
+ parser = argparse.ArgumentParser(description=__doc__)
208
+ parser.add_argument("--track", choices=("bug", "security", "lint"), required=True)
209
+ parser.add_argument("--dataset", type=Path, required=True)
210
+ parser.add_argument("--predictions", type=Path, required=True)
211
+ parser.add_argument("--question-pack", type=Path, default=Path(__file__).with_name("question-pack.json"))
212
+ parser.add_argument("--benchmark-script", type=Path, default=Path(__file__).with_name("benchmark.py"))
213
+ parser.add_argument("--threshold", type=float, default=0.5)
214
+ parser.add_argument("--workers", type=int, default=8)
215
+ parser.add_argument("--interval", type=float, default=DEFAULT_INTERVAL)
216
+ parser.add_argument("--limit", type=int, default=0)
217
+ args = parser.parse_args()
218
+ if not 0 <= args.threshold <= 1 or args.workers < 1 or args.interval < 0.6 or args.limit < 0:
219
+ parser.error("Invalid threshold, workers, interval, or limit")
220
+ key = os.environ.get("TYPELLM_API_KEY")
221
+ if not key:
222
+ raise RuntimeError("Set TYPELLM_API_KEY")
223
+ core = module_at("perch_benchmark", args.benchmark_script) if args.track != "lint" else None
224
+ pack = core.load_pack(args.question_pack) if core else None
225
+ pairs, digest = load_pairs(args.dataset, args.track)
226
+ existing = saved_predictions(args.predictions, pairs, digest, args.track, pack)
227
+ pending = [(pair, role) for pair in pairs for role in ("before", "after")
228
+ if (pair["pair_id"], role) not in existing]
229
+ if args.limit:
230
+ pending = pending[:args.limit]
231
+ if not pending:
232
+ print(f"{args.track}: already complete", flush=True)
233
+ return
234
+ args.predictions.parent.mkdir(parents=True, exist_ok=True)
235
+ limiter = RateLimiter(args.interval)
236
+ with args.predictions.open("a") as output, ThreadPoolExecutor(max_workers=args.workers) as pool:
237
+ futures = [pool.submit(score_one, pair, role, args.track, pack, core, key, digest,
238
+ limiter, args.threshold)
239
+ for pair, role in pending]
240
+ for index, future in enumerate(as_completed(futures), 1):
241
+ row = future.result()
242
+ output.write(json.dumps(row, sort_keys=True) + "\n")
243
+ output.flush()
244
+ if index % 100 == 0 or index == len(pending):
245
+ print(f"{args.track}: {len(existing) + index}/{2 * len(pairs)} sides", flush=True)
246
+
247
+
248
+ if __name__ == "__main__":
249
+ main()