Show benchmark recall versus false-alert tradeoffs
Browse files- README.md +67 -73
- assets/bug-tradeoff.svg +63 -0
- assets/lint-tradeoff.svg +57 -0
- assets/security-tradeoff.svg +62 -0
- tradeoff.py +274 -0
README.md
CHANGED
|
@@ -22,113 +22,107 @@ 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 |
|
|
|
|
| 25 |
|
| 26 |
## Reading the results
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
## Bugs
|
| 35 |
|
| 36 |
[Public pairs](https://huggingface.co/datasets/perchscan/bug-pairs-public)
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 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 |
|
| 47 |
-
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 43.8% | 44.7% | 25.3% | 32.3% | 471 | 583 | 1,390 | 45.0% | $0.182 |
|
| 48 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 42.1% | 42.2% | **81.9%** | **55.7%** | **1,525** | 2,087 | **336** | 45.3% | ~$0.210 |
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
### Private — 498 pairs
|
| 53 |
|
| 54 |
-
| Model |
|
| 55 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 56 |
-
| [
|
| 57 |
-
| [
|
| 58 |
-
| [
|
| 59 |
-
| [
|
| 60 |
-
| [
|
| 61 |
-
| [
|
| 62 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) |
|
| 63 |
-
|
| 64 |
-
_Sorted by AP. Bold marks the best value in each quality column; lower FP and FN are better._
|
| 65 |
|
| 66 |
## Security
|
| 67 |
|
| 68 |
[Public pairs](https://huggingface.co/datasets/perchscan/security-pairs-public)
|
| 69 |
|
| 70 |
-
|
| 71 |
|
| 72 |
### Public — 1,311 pairs
|
| 73 |
|
| 74 |
-
| Model |
|
| 75 |
-
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 76 |
-
| [
|
| 77 |
-
| [
|
| 78 |
-
| [
|
| 79 |
-
| [
|
| 80 |
-
| [
|
| 81 |
-
| [SemiF](https://github.com/TheoLeeCJ/SemIf) |
|
| 82 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) |
|
| 83 |
-
|
| 84 |
-
_Sorted by AP. Bold marks the best value in each quality column; lower FP and FN are better._
|
| 85 |
|
| 86 |
### Private — 439 pairs
|
| 87 |
|
| 88 |
-
| Model |
|
| 89 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 90 |
-
| [
|
| 91 |
-
| [
|
| 92 |
-
| [Jev](https://
|
| 93 |
-
| [
|
| 94 |
-
| [
|
| 95 |
-
| [
|
| 96 |
-
| [
|
| 97 |
-
|
| 98 |
-
_Sorted by AP. Bold marks the best value in each quality column; lower FP and FN are better._
|
| 99 |
|
| 100 |
## Perch Lint Bench
|
| 101 |
|
| 102 |
[Public pairs](https://huggingface.co/datasets/perchscan/perch-lint-bench-public)
|
| 103 |
|
| 104 |
-
|
| 105 |
|
| 106 |
-
|
| 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 |
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
### Private — 71 pairs
|
| 119 |
|
| 120 |
-
| Model |
|
| 121 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 122 |
-
| [TypeLLM](https://typellm.ai/docs) |
|
| 123 |
-
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) |
|
| 124 |
-
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) |
|
| 125 |
-
| [
|
| 126 |
-
| [
|
| 127 |
-
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) |
|
| 128 |
-
| [SemiF](https://github.com/TheoLeeCJ/SemIf) |
|
| 129 |
-
|
| 130 |
-
_Sorted by AP. Bold marks the best value in each quality column; lower FP and FN are better._
|
| 131 |
|
|
|
|
| 132 |
|
| 133 |
Bug and security runs use the question floors recorded with each result. Semantic lint rules use a 70% run-wide floor.
|
| 134 |
|
|
@@ -145,6 +139,7 @@ JevLike (192-byte input), Laya (512-token input), and Kev (packed-branch limit)
|
|
| 145 |
- [`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.
|
| 146 |
- [`results.jsonl`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/results.jsonl): all recorded result versions, identified by run and protocol ID.
|
| 147 |
- [`predictions/current/`](https://huggingface.co/datasets/perchscan/benchmark-results/tree/main/predictions/current): public method probabilities from this run. Private predictions are not published.
|
|
|
|
| 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.
|
|
@@ -165,4 +160,3 @@ python3 span01.py --domain security --predictions security-span01.jsonl --report
|
|
| 165 |
```
|
| 166 |
|
| 167 |
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.
|
| 168 |
-
|
|
|
|
| 22 |
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | [Liquid decision API](https://api.liquid.ai/decisions/v1/systemone) (`d1:free`) |
|
| 23 |
| [TypeLLM](https://typellm.ai/docs) | [TypeLLM API](https://api.typellm.ai/v1/generate) (`typellm-latest`) |
|
| 24 |
|
| 25 |
+
<!-- BEGIN TRADEOFF_RESULTS -->
|
| 26 |
|
| 27 |
## Reading the results
|
| 28 |
|
| 29 |
+
Each curve shows how many labelled issues a model finds as its score cutoff changes. Moving right means more false alerts on labelled clean methods. Circles show the recorded Perch alert settings; a circle can sit off its score curve when a question has its own minimum score.
|
| 30 |
+
|
| 31 |
+
The public tables rank models by **recall with no more than 5% of clean methods falsely alerted**. This is a comparison of saved score rankings, not a new deployed cutoff. The private tables show the recorded alert settings and rank by **TPR − FPR** (recall minus the false-alert rate). A model that alerts on every method scores zero on this measure. Costs are for the captured runs.
|
| 32 |
+
|
| 33 |
+
Private method predictions stay private, so the curves use public predictions only. The lint public split has 214 clean methods: its 5% limit permits at most 10 false alerts. The bug and security limits permit 128 and 74 false alerts respectively.
|
| 34 |
|
| 35 |
## Bugs
|
| 36 |
|
| 37 |
[Public pairs](https://huggingface.co/datasets/perchscan/bug-pairs-public)
|
| 38 |
|
| 39 |
+

|
| 40 |
|
| 41 |
+
### Public — 2,220 pairs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
| Model | Recall at ≤5% false alerts | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |
|
| 44 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 45 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 8.4% | 33.4% | 270.6 | 6.3% | $0.239 |
|
| 46 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 8.1% | 17.7% | 127.2 | 5.0% | $0.551 |
|
| 47 |
+
| [TypeLLM](https://typellm.ai/docs) | 7.6% | 8.3% | 55.4 | 2.7% | $0.576 |
|
| 48 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 7.2% | 4.1% | 25.2 | 1.6% | Free tier |
|
| 49 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 6.5% | 43.0% | 396.7 | 3.3% | $0.239 |
|
| 50 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 5.3% | 25.3% | 226.1 | 2.7% | $0.182 |
|
| 51 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 4.6% | 81.9% | 809.2 | 1.0% | ~$0.210 |
|
| 52 |
|
| 53 |
### Private — 498 pairs
|
| 54 |
|
| 55 |
+
| Model | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |
|
| 56 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 57 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 35.8% | 272.7 | 8.6% | $0.054 |
|
| 58 |
+
| [TypeLLM](https://typellm.ai/docs) | 11.3% | 57.7 | 5.6% | $0.129 |
|
| 59 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.0% | 155.6 | 4.5% | $0.123 |
|
| 60 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 28.5% | 243.0 | 4.2% | $0.040 |
|
| 61 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 44.3% | 417.8 | 2.6% | $0.054 |
|
| 62 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 5.2% | 29.7 | 2.2% | Free tier |
|
| 63 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 79.5% | 800.7 | -0.6% | ~$0.047 |
|
|
|
|
|
|
|
| 64 |
|
| 65 |
## Security
|
| 66 |
|
| 67 |
[Public pairs](https://huggingface.co/datasets/perchscan/security-pairs-public)
|
| 68 |
|
| 69 |
+

|
| 70 |
|
| 71 |
### Public — 1,311 pairs
|
| 72 |
|
| 73 |
+
| Model | Recall at ≤5% false alerts | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |
|
| 74 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 75 |
+
| [TypeLLM](https://typellm.ai/docs) | 9.5% | 27.8% | 173.6 | 10.5% | $0.566 |
|
| 76 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 8.8% | 21.0% | 171.6 | 3.9% | $0.251 |
|
| 77 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 8.7% | 33.1% | 258.1 | 7.3% | $0.208 |
|
| 78 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 8.1% | 55.6% | 468.2 | 8.8% | Free tier |
|
| 79 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 7.7% | 34.6% | 235.8 | 11.0% | $0.507 |
|
| 80 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 4.8% | 100.0% | 999.3 | 0.1% | $0.208 |
|
| 81 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 4.6% | 100.0% | 1000.0 | 0.0% | ~$1.432 |
|
|
|
|
|
|
|
| 82 |
|
| 83 |
### Private — 439 pairs
|
| 84 |
|
| 85 |
+
| Model | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |
|
| 86 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 87 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 34.2% | 289.6 | 5.2% | Free tier |
|
| 88 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 20.6% | 166.7 | 3.9% | $0.182 |
|
| 89 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 21.9% | 185.4 | 3.3% | $0.074 |
|
| 90 |
+
| [TypeLLM](https://typellm.ai/docs) | 8.8% | 62.5 | 2.5% | $0.203 |
|
| 91 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 100.0% | 1000.0 | 0.0% | ~$0.528 |
|
| 92 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 100.0% | 1000.0 | 0.0% | $0.074 |
|
| 93 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 8.0% | 81.2 | -0.1% | $0.091 |
|
|
|
|
|
|
|
| 94 |
|
| 95 |
## Perch Lint Bench
|
| 96 |
|
| 97 |
[Public pairs](https://huggingface.co/datasets/perchscan/perch-lint-bench-public)
|
| 98 |
|
| 99 |
+

|
| 100 |
|
| 101 |
+
### Public — 214 pairs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
+
| Model | Recall at ≤5% false alerts | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |
|
| 104 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 105 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 73.8% | 50.0% | 4.7 | 49.5% | $0.048 |
|
| 106 |
+
| [TypeLLM](https://typellm.ai/docs) | 72.4% | 61.7% | 28.0 | 58.9% | $0.050 |
|
| 107 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 65.9% | 49.1% | 9.3 | 48.1% | Free tier |
|
| 108 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 45.3% | 52.8% | 51.4 | 47.7% | $0.018 |
|
| 109 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 27.6% | 50.0% | 112.1 | 38.8% | $0.014 |
|
| 110 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 6.1% | 38.8% | 373.8 | 1.4% | ~$0.010 |
|
| 111 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 2.3% | 32.2% | 313.1 | 0.9% | $0.018 |
|
| 112 |
|
| 113 |
### Private — 71 pairs
|
| 114 |
|
| 115 |
+
| Model | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |
|
| 116 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 117 |
+
| [TypeLLM](https://typellm.ai/docs) | 59.2% | 56.3 | 53.5% | $0.016 |
|
| 118 |
+
| [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) | 53.5% | 14.1 | 52.1% | $0.016 |
|
| 119 |
+
| [Liquid d1](https://docs.liquid.ai/lfm/models/decision-models) | 49.3% | 14.1 | 47.9% | Free tier |
|
| 120 |
+
| [DiffusionGemma Jev](https://github.com/razorback16/openjev) | 53.5% | 84.5 | 45.1% | $0.006 |
|
| 121 |
+
| [Span-01](https://www.respan.ai/docs/documentation/span-01/concept) | 45.1% | 84.5 | 36.6% | $0.005 |
|
| 122 |
+
| [CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) | 50.7% | 493.0 | 1.4% | ~$0.003 |
|
| 123 |
+
| [SemiF](https://github.com/TheoLeeCJ/SemIf) | 42.3% | 450.7 | -2.8% | $0.006 |
|
|
|
|
|
|
|
| 124 |
|
| 125 |
+
<!-- END TRADEOFF_RESULTS -->
|
| 126 |
|
| 127 |
Bug and security runs use the question floors recorded with each result. Semantic lint rules use a 70% run-wide floor.
|
| 128 |
|
|
|
|
| 139 |
- [`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.
|
| 140 |
- [`results.jsonl`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/results.jsonl): all recorded result versions, identified by run and protocol ID.
|
| 141 |
- [`predictions/current/`](https://huggingface.co/datasets/perchscan/benchmark-results/tree/main/predictions/current): public method probabilities from this run. Private predictions are not published.
|
| 142 |
+
- [`tradeoff.py`](https://huggingface.co/datasets/perchscan/benchmark-results/blob/main/tradeoff.py): rebuilds the public recall/false-alert curves and result tables from saved scores and labels.
|
| 143 |
- [`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.
|
| 144 |
- [`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.
|
| 145 |
- [`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.
|
|
|
|
| 160 |
```
|
| 161 |
|
| 162 |
For another model, use `--scorer command --command 'python3 your_adapter.py' --model-revision YOUR_MODEL`. The adapter receives the method state and each applicable detection question and returns its true-answer probability. The runner saves predictions for resumption and reports scores only when every method side is complete.
|
|
|
assets/bug-tradeoff.svg
ADDED
|
|
assets/lint-tradeoff.svg
ADDED
|
|
assets/security-tradeoff.svg
ADDED
|
|
tradeoff.py
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Rebuild public false-alert curves and benchmark result tables.
|
| 3 |
+
|
| 4 |
+
The public curves sweep the saved method scores. The marked operating points
|
| 5 |
+
use the recorded scan alerts, which can include per-question floors. Private
|
| 6 |
+
tables use only the aggregate results already published in results-current.jsonl.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
from collections import defaultdict
|
| 13 |
+
import html
|
| 14 |
+
import json
|
| 15 |
+
from math import floor, isfinite
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
from tempfile import TemporaryDirectory
|
| 18 |
+
from urllib.request import urlopen
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
ROOT = Path(__file__).resolve().parent
|
| 22 |
+
DATASET_URLS = {
|
| 23 |
+
"bug": "https://huggingface.co/datasets/perchscan/bug-pairs-public/resolve/main/benchmark.jsonl",
|
| 24 |
+
"security": "https://huggingface.co/datasets/perchscan/security-pairs-public/resolve/main/benchmark.jsonl",
|
| 25 |
+
"lint": "https://huggingface.co/datasets/perchscan/perch-lint-bench-public/resolve/main/benchmark.jsonl",
|
| 26 |
+
}
|
| 27 |
+
NAMES = {
|
| 28 |
+
"jev": ("Jev", "https://typesafe.ai/blog/introducing-system-one-models-and-jev"),
|
| 29 |
+
"typellm": ("TypeLLM", "https://typellm.ai/docs"),
|
| 30 |
+
"liquid-d1": ("Liquid d1", "https://docs.liquid.ai/lfm/models/decision-models"),
|
| 31 |
+
"diffusiongemma": ("DiffusionGemma Jev", "https://github.com/razorback16/openjev"),
|
| 32 |
+
"span01": ("Span-01", "https://www.respan.ai/docs/documentation/span-01/concept"),
|
| 33 |
+
"clm": ("CLM-v0.1-8B", "https://huggingface.co/Contrastive-LM/CLM-v0.1-8B"),
|
| 34 |
+
"semif": ("SemiF", "https://github.com/TheoLeeCJ/SemIf"),
|
| 35 |
+
}
|
| 36 |
+
COLORS = {
|
| 37 |
+
"jev": "#1976d2", "typellm": "#c64f81", "liquid-d1": "#7638d6",
|
| 38 |
+
"diffusiongemma": "#e08a22", "span01": "#168d80", "clm": "#677586",
|
| 39 |
+
"semif": "#b14b39",
|
| 40 |
+
}
|
| 41 |
+
ORDER = tuple(NAMES)
|
| 42 |
+
CAP = 0.05
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def lines(path: Path) -> list[dict]:
|
| 46 |
+
return [json.loads(line) for line in path.read_text().splitlines() if line]
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def dataset(domain: str, local_root: Path | None) -> list[dict]:
|
| 50 |
+
if local_root:
|
| 51 |
+
path = (local_root / "public" / domain / "benchmark.jsonl")
|
| 52 |
+
if domain == "lint":
|
| 53 |
+
path = local_root / "public" / "lint" / "benchmark.jsonl"
|
| 54 |
+
return lines(path)
|
| 55 |
+
with urlopen(DATASET_URLS[domain], timeout=120) as response:
|
| 56 |
+
return [json.loads(line) for line in response if line.strip()]
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def labels_for(domain: str, pairs: list[dict]) -> dict[tuple[str, str], int]:
|
| 60 |
+
labels = {}
|
| 61 |
+
for pair in pairs:
|
| 62 |
+
for role in ("before", "after"):
|
| 63 |
+
label = (1 if role == "before" else 0) if domain == "lint" else pair[role]["labels"][domain]
|
| 64 |
+
if label not in (0, 1):
|
| 65 |
+
raise ValueError(f"Invalid {domain} label in {pair['pair_id']}:{role}")
|
| 66 |
+
key = pair["pair_id"], role
|
| 67 |
+
if key in labels:
|
| 68 |
+
raise ValueError(f"Duplicate method side: {key}")
|
| 69 |
+
labels[key] = label
|
| 70 |
+
return labels
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def curve(labels: dict[tuple[str, str], int], prediction_path: Path) -> tuple[list[tuple[int, int]], int, int]:
|
| 74 |
+
predictions = lines(prediction_path)
|
| 75 |
+
scores = {}
|
| 76 |
+
for row in predictions:
|
| 77 |
+
key = row["pair_id"], row["role"]
|
| 78 |
+
value = row["score"]
|
| 79 |
+
if key in scores or not isinstance(value, (int, float)) or not isfinite(value) or not 0 <= value <= 1:
|
| 80 |
+
raise ValueError(f"Invalid prediction in {prediction_path}: {key}")
|
| 81 |
+
scores[key] = float(value)
|
| 82 |
+
if scores.keys() != labels.keys():
|
| 83 |
+
raise ValueError(f"Incomplete predictions in {prediction_path}: {len(scores)} of {len(labels)}")
|
| 84 |
+
groups = defaultdict(lambda: [0, 0])
|
| 85 |
+
for key, score in scores.items():
|
| 86 |
+
groups[score][1 - labels[key]] += 1 # index 0 is positive; 1 is negative
|
| 87 |
+
points = [(0, 0)]
|
| 88 |
+
tp = fp = 0
|
| 89 |
+
for score in sorted(groups, reverse=True):
|
| 90 |
+
positive, negative = groups[score]
|
| 91 |
+
tp += positive
|
| 92 |
+
fp += negative
|
| 93 |
+
points.append((fp, tp))
|
| 94 |
+
return points, sum(labels.values()), len(labels) - sum(labels.values())
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def recall_at_cap(points: list[tuple[int, int]], positives: int, negatives: int) -> float:
|
| 98 |
+
limit = floor(CAP * negatives)
|
| 99 |
+
return max(tp for fp, tp in points if fp <= limit) / positives
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def operating_metrics(row: dict) -> tuple[float, float, float]:
|
| 103 |
+
counts = row["confusion"]
|
| 104 |
+
positives = counts["tp"] + counts["fn"]
|
| 105 |
+
negatives = counts["fp"] + counts["tn"]
|
| 106 |
+
recall = counts["tp"] / positives
|
| 107 |
+
alerts_per_1000 = counts["fp"] / negatives * 1000
|
| 108 |
+
return recall, alerts_per_1000, recall - alerts_per_1000 / 1000
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def money(row: dict) -> str:
|
| 112 |
+
value = row.get("inference_cost_usd")
|
| 113 |
+
if value is None:
|
| 114 |
+
return "Free tier"
|
| 115 |
+
prefix = "~" if row["model_id"] == "clm" else ""
|
| 116 |
+
return f"{prefix}${value:.3f}"
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def model_link(model: str) -> str:
|
| 120 |
+
name, url = NAMES[model]
|
| 121 |
+
return f"[{name}]({url})"
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def percent(value: float) -> str:
|
| 125 |
+
return f"{100 * value:.1f}%"
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def public_table(rows: list[dict], curves: dict[str, tuple[list[tuple[int, int]], int, int]]) -> str:
|
| 129 |
+
ordered = sorted(rows, key=lambda row: (-recall_at_cap(*curves[row["model_id"]]), ORDER.index(row["model_id"])))
|
| 130 |
+
table = ["| Model | Recall at ≤5% false alerts | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |",
|
| 131 |
+
"| --- | ---: | ---: | ---: | ---: | ---: |"]
|
| 132 |
+
for row in ordered:
|
| 133 |
+
recall, false_alerts, j = operating_metrics(row)
|
| 134 |
+
fixed_recall = recall_at_cap(*curves[row["model_id"]])
|
| 135 |
+
table.append(f"| {model_link(row['model_id'])} | {percent(fixed_recall)} | {percent(recall)} | {false_alerts:.1f} | {percent(j)} | {money(row)} |")
|
| 136 |
+
return "\n".join(table)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def private_table(rows: list[dict]) -> str:
|
| 140 |
+
ordered = sorted(rows, key=lambda row: (-operating_metrics(row)[2], ORDER.index(row["model_id"])))
|
| 141 |
+
table = ["| Model | Recall at current cutoff | False alerts / 1,000 clean at current cutoff | TPR − FPR at current cutoff | Inference cost |",
|
| 142 |
+
"| --- | ---: | ---: | ---: | ---: |"]
|
| 143 |
+
for row in ordered:
|
| 144 |
+
recall, false_alerts, j = operating_metrics(row)
|
| 145 |
+
table.append(f"| {model_link(row['model_id'])} | {percent(recall)} | {false_alerts:.1f} | {percent(j)} | {money(row)} |")
|
| 146 |
+
return "\n".join(table)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def svg(domain: str, curves: dict[str, tuple[list[tuple[int, int]], int, int]],
|
| 150 |
+
current: dict[str, dict], output: Path) -> None:
|
| 151 |
+
width, height = 1120, 580
|
| 152 |
+
left, right, top, bottom = 90, 40, 126, 82
|
| 153 |
+
plot_w, plot_h = width - left - right, height - top - bottom
|
| 154 |
+
# The chart concentrates on the low-false-alert region. The full sweep,
|
| 155 |
+
# including all-YES points at x=1,000, remains reproducible in tradeoff.py.
|
| 156 |
+
x_max = 150 if domain == "lint" else 300
|
| 157 |
+
|
| 158 |
+
def x(fp: int, negatives: int) -> float:
|
| 159 |
+
return left + (fp / negatives * 1000) / x_max * plot_w
|
| 160 |
+
|
| 161 |
+
def y(tp: int, positives: int) -> float:
|
| 162 |
+
return top + (1 - tp / positives) * plot_h
|
| 163 |
+
|
| 164 |
+
title = {"bug": "Bug detection", "security": "Security detection", "lint": "Perch Lint Bench"}[domain]
|
| 165 |
+
out = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" viewBox="0 0 {width} {height}" role="img" aria-labelledby="title desc">',
|
| 166 |
+
f'<title id="title">{title}: recall versus false alerts</title>',
|
| 167 |
+
'<desc id="desc">Seven model score curves on the public benchmark. Higher and farther left is better. Circles mark recorded alert cutoffs when they fall within the plotted range.</desc>',
|
| 168 |
+
f'<rect width="{width}" height="{height}" rx="16" fill="#101318"/>',
|
| 169 |
+
f'<text x="{left}" y="43" fill="#f2f5fa" font-family="Arial,sans-serif" font-weight="700" font-size="28">{html.escape(title)}</text>',
|
| 170 |
+
f'<text x="{left}" y="70" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="16">Public methods · score cutoffs swept · low false-alert region</text>']
|
| 171 |
+
for i, model in enumerate(ORDER):
|
| 172 |
+
col = i % 4
|
| 173 |
+
row = i // 4
|
| 174 |
+
lx = left + col * 245
|
| 175 |
+
ly = 91 + row * 22
|
| 176 |
+
out += [f'<line x1="{lx}" y1="{ly}" x2="{lx + 24}" y2="{ly}" stroke="{COLORS[model]}" stroke-width="4"/>',
|
| 177 |
+
f'<text x="{lx + 32}" y="{ly + 5}" fill="#e1e7ef" font-family="Arial,sans-serif" font-size="15">{html.escape(NAMES[model][0])}</text>']
|
| 178 |
+
for value in range(0, x_max + 1, 50):
|
| 179 |
+
px = left + value / x_max * plot_w
|
| 180 |
+
out += [f'<line x1="{px:.1f}" y1="{top}" x2="{px:.1f}" y2="{top + plot_h}" stroke="#29303a"/>',
|
| 181 |
+
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>']
|
| 182 |
+
for value in range(0, 101, 20):
|
| 183 |
+
py = top + (1 - value / 100) * plot_h
|
| 184 |
+
out += [f'<line x1="{left}" y1="{py:.1f}" x2="{left + plot_w}" y2="{py:.1f}" stroke="#29303a"/>',
|
| 185 |
+
f'<text x="{left - 12}" y="{py + 5:.1f}" text-anchor="end" fill="#aeb9c7" font-family="Arial,sans-serif" font-size="14">{value}%</text>']
|
| 186 |
+
cap_x = left + 50 / x_max * plot_w
|
| 187 |
+
out.append(f'<line x1="{cap_x:.1f}" y1="{top}" x2="{cap_x:.1f}" y2="{top + plot_h}" stroke="#ced8e4" stroke-width="1.5" stroke-dasharray="5 6"/>')
|
| 188 |
+
out.append(f'<text x="{cap_x + 6:.1f}" y="{top + 18}" fill="#ced8e4" font-family="Arial,sans-serif" font-size="13">5% false-alert limit</text>')
|
| 189 |
+
for model in ORDER:
|
| 190 |
+
points, positives, negatives = curves[model]
|
| 191 |
+
visible = [(fp, tp) for fp, tp in points if fp / negatives * 1000 <= x_max]
|
| 192 |
+
if len(visible) > 1:
|
| 193 |
+
positions = " ".join(f"{x(fp, negatives):.2f},{y(tp, positives):.2f}" for fp, tp in visible)
|
| 194 |
+
out.append(f'<polyline points="{positions}" fill="none" stroke="{COLORS[model]}" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>')
|
| 195 |
+
recall, false_alerts, _ = operating_metrics(current[model])
|
| 196 |
+
if false_alerts <= x_max:
|
| 197 |
+
out.append(f'<circle cx="{left + false_alerts / x_max * plot_w:.2f}" cy="{top + (1 - recall) * plot_h:.2f}" r="5" fill="{COLORS[model]}" stroke="#fff" stroke-width="1.5"/>')
|
| 198 |
+
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">False alerts per 1,000 clean methods →</text>',
|
| 199 |
+
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>',
|
| 200 |
+
'</svg>']
|
| 201 |
+
output.parent.mkdir(parents=True, exist_ok=True)
|
| 202 |
+
output.write_text("\n".join(out) + "\n")
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def render_sections(results: list[dict], curves_by_domain: dict[str, dict], output_dir: Path) -> str:
|
| 206 |
+
sections = ["## Reading the results", "",
|
| 207 |
+
"Each curve shows how many labelled issues a model finds as its score cutoff changes. Moving right means more false alerts on labelled clean methods. Circles show the recorded Perch alert settings; a circle can sit off its score curve when a question has its own minimum score.", "",
|
| 208 |
+
"The public tables rank models by **recall with no more than 5% of clean methods falsely alerted**. This is a comparison of saved score rankings, not a new deployed cutoff. The private tables show the recorded alert settings and rank by **TPR − FPR** (recall minus the false-alert rate). A model that alerts on every method scores zero on this measure. Costs are for the captured runs.", "",
|
| 209 |
+
"Private method predictions stay private, so the curves use public predictions only. The lint public split has 214 clean methods: its 5% limit permits at most 10 false alerts. The bug and security limits permit 128 and 74 false alerts respectively.", ""]
|
| 210 |
+
for domain in ("bug", "security", "lint"):
|
| 211 |
+
title = {"bug": "Bugs", "security": "Security", "lint": "Perch Lint Bench"}[domain]
|
| 212 |
+
link = {"bug": "bug-pairs-public", "security": "security-pairs-public", "lint": "perch-lint-bench-public"}[domain]
|
| 213 |
+
public = [r for r in results if r["domain"] == domain and r["track"] == "public"]
|
| 214 |
+
private = [r for r in results if r["domain"] == domain and r["track"] == "private"]
|
| 215 |
+
if set(r["model_id"] for r in public) != set(ORDER) or set(r["model_id"] for r in private) != set(ORDER):
|
| 216 |
+
raise ValueError(f"Unexpected models in {domain} results")
|
| 217 |
+
current = {r["model_id"]: r for r in public}
|
| 218 |
+
image = output_dir / f"{domain}-tradeoff.svg"
|
| 219 |
+
svg(domain, curves_by_domain[domain], current, image)
|
| 220 |
+
sections += [f"## {title}", "", f"[Public pairs](https://huggingface.co/datasets/perchscan/{link})", "",
|
| 221 |
+
f"", "",
|
| 222 |
+
f"### Public — {public[0]['benchmark_pairs']:,} pairs", "",
|
| 223 |
+
public_table(public, curves_by_domain[domain]), "",
|
| 224 |
+
f"### Private — {private[0]['benchmark_pairs']:,} pairs", "",
|
| 225 |
+
private_table(private), ""]
|
| 226 |
+
return "\n".join(sections)
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def main() -> None:
|
| 230 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 231 |
+
parser.add_argument("--dataset-root", type=Path, help="Directory containing public/{bug,security,lint}/benchmark.jsonl")
|
| 232 |
+
parser.add_argument("--check", action="store_true", help="Check generated card and SVGs without writing")
|
| 233 |
+
args = parser.parse_args()
|
| 234 |
+
results = lines(ROOT / "results-current.jsonl")
|
| 235 |
+
curves_by_domain = {}
|
| 236 |
+
for domain in ("bug", "security", "lint"):
|
| 237 |
+
labels = labels_for(domain, dataset(domain, args.dataset_root))
|
| 238 |
+
curves_by_domain[domain] = {}
|
| 239 |
+
for model in ORDER:
|
| 240 |
+
result = next(r for r in results if r["domain"] == domain and r["track"] == "public" and r["model_id"] == model)
|
| 241 |
+
points, positives, negatives = curve(labels, ROOT / "predictions" / "current" / domain / f"{model}.jsonl")
|
| 242 |
+
counts = result["confusion"]
|
| 243 |
+
if (positives, negatives) != (counts["tp"] + counts["fn"], counts["tn"] + counts["fp"]):
|
| 244 |
+
raise ValueError(f"Label counts differ from recorded result: {domain}/{model}")
|
| 245 |
+
curves_by_domain[domain][model] = points, positives, negatives
|
| 246 |
+
card = ROOT / "README.md"
|
| 247 |
+
original = card.read_text()
|
| 248 |
+
start_marker, end_marker = "<!-- BEGIN TRADEOFF_RESULTS -->", "<!-- END TRADEOFF_RESULTS -->"
|
| 249 |
+
start = original.find(start_marker)
|
| 250 |
+
end = original.find(end_marker)
|
| 251 |
+
if start < 0 or end < 0:
|
| 252 |
+
start = original.index("## Reading the results")
|
| 253 |
+
end = original.index("Bug and security runs use the question floors", start)
|
| 254 |
+
else:
|
| 255 |
+
end += len(end_marker)
|
| 256 |
+
if args.check:
|
| 257 |
+
with TemporaryDirectory() as temporary:
|
| 258 |
+
content = render_sections(results, curves_by_domain, Path(temporary))
|
| 259 |
+
for domain in DATASET_URLS:
|
| 260 |
+
name = f"{domain}-tradeoff.svg"
|
| 261 |
+
if (Path(temporary) / name).read_bytes() != (ROOT / "assets" / name).read_bytes():
|
| 262 |
+
raise SystemExit(f"assets/{name} is not up to date; run python3 tradeoff.py")
|
| 263 |
+
else:
|
| 264 |
+
content = render_sections(results, curves_by_domain, ROOT / "assets")
|
| 265 |
+
updated = (original[:start].rstrip("\n") + "\n\n" + start_marker + "\n\n" + content
|
| 266 |
+
+ "\n" + end_marker + "\n\n" + original[end:].lstrip("\n"))
|
| 267 |
+
if args.check and original != updated:
|
| 268 |
+
raise SystemExit("README.md is not up to date; run python3 tradeoff.py")
|
| 269 |
+
if not args.check:
|
| 270 |
+
card.write_text(updated)
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
if __name__ == "__main__":
|
| 274 |
+
main()
|