TS-PRGuard v1, trained with typestrict.ai
Browse files- .gitattributes +1 -0
- README.md +180 -0
- decision_ai.json +96 -0
- figures/banner.png +0 -0
- figures/results.png +3 -0
- holdout.json +0 -0
- onnx/model_8bit.onnx +3 -0
- tokenizer.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
figures/results.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,183 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: onnx
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
base_model: typestrict/TS-Ettin-150M
|
| 6 |
+
tags:
|
| 7 |
+
- typestrict
|
| 8 |
+
- decision-model
|
| 9 |
+
- typed-decisions
|
| 10 |
+
- onnx
|
| 11 |
+
- cpu
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
<p align="center">
|
| 15 |
+
<a href="https://typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e"><img src="https://huggingface.co/typestrict/TS-PRGuard/resolve/main/figures/banner.png" width="100%" alt="TS-PRGuard by typestrict.ai"></a>
|
| 16 |
+
</p>
|
| 17 |
+
|
| 18 |
+
<p align="center">
|
| 19 |
+
<a href="https://typestrict.ai"><b>Train your own on typestrict.ai</b></a> |
|
| 20 |
+
<a href="https://typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e">Model page</a> |
|
| 21 |
+
<a href="https://docs.typestrict.ai">Docs</a> |
|
| 22 |
+
<a href="https://docs.typestrict.ai/agents">MCP for AI assistants</a> |
|
| 23 |
+
<a href="https://huggingface.co/typestrict">All TS models</a>
|
| 24 |
+
<br>
|
| 25 |
+
<b>License</b>: Apache 2.0 |
|
| 26 |
+
<b>Authors</b>: <a href="https://huggingface.co/typestrict">typestrict</a>, trained with <a href="https://typestrict.ai">typestrict.ai</a>
|
| 27 |
+
</p>
|
| 28 |
+
|
| 29 |
+
# TS-PRGuard
|
| 30 |
+
|
| 31 |
+
A decision model trained on [typestrict.ai](https://typestrict.ai) that answers 5 questions in one pass, each with the probability of every option and a confidence, on a CPU.
|
| 32 |
+
|
| 33 |
+
> [!TIP]
|
| 34 |
+
> **Beats Jev on 4 of 5 questions**, the market reference model, on held-out examples never used in training, by the [refund calculation](https://docs.typestrict.ai/refund) (a model of several questions has to win on two thirds of them). Anyone can recompute the verdict from the [audit file](https://typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e).
|
| 35 |
+
|
| 36 |
+
- **Typed decisions**: each question is a `choice` (one option out of many), a `noul` (is this statement true) or a `score` (a value on an ordered rubric), with the probability of every option and a confidence.
|
| 37 |
+
- **Small and fast**: 150M parameters, an 8-bit ONNX file that runs on a CPU, in a browser or on a phone.
|
| 38 |
+
- **Measured, not claimed**: every number below comes from examples held out before training, and the audit file recomputes the verdict.
|
| 39 |
+
|
| 40 |
+
<p align="center">
|
| 41 |
+
<img src="https://huggingface.co/typestrict/TS-PRGuard/resolve/main/figures/results.png" width="100%" alt="TS-PRGuard against Jev, question by question">
|
| 42 |
+
</p>
|
| 43 |
+
|
| 44 |
+
## 📊 Results
|
| 45 |
+
|
| 46 |
+
Macro-F1 of this model and of Jev on the same held-out examples, and the gain the [refund calculation](https://docs.typestrict.ai/refund) measures (a weighted score of four metrics, with its 95% bootstrap interval). A question is won when the gain holds up under resampling (the interval stays above zero) and no metric collapses.
|
| 47 |
+
|
| 48 |
+
<div class="dark:hidden" style="overflow-x:auto;">
|
| 49 |
+
<table align="center" style="display:table;width:auto;max-width:100%;margin-left:auto;margin-right:auto;border-collapse:collapse;">
|
| 50 |
+
<thead><tr><th scope="col" style="padding:12px;text-align:left;background:#1A1806;color:#FFD400;">Question</th><th scope="col" style="padding:12px;text-align:center;background:#1A1806;color:#FFD400;">Held-out examples</th><th scope="col" style="padding:12px;text-align:center;background:#1A1806;color:#FFD400;">This model</th><th scope="col" style="padding:12px;text-align:center;background:#1A1806;color:#FFD400;">Jev</th><th scope="col" style="padding:12px;text-align:center;background:#1A1806;color:#FFD400;">Gain over Jev (95% CI)</th><th scope="col" style="padding:12px;text-align:center;background:#1A1806;color:#FFD400;">Result</th></tr></thead>
|
| 51 |
+
<tbody>
|
| 52 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Does the code change do what the pull request description says?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">436</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.928</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.807</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">+0.109 [+0.078; +0.141]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Beats Jev</td></tr>
|
| 53 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">How hard is this change to review?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">221</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.660</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.383</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">+0.196 [+0.131; +0.248]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Beats Jev</td></tr>
|
| 54 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Does this change break compatibility for the users of this code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">2,000</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">0.870</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">0.910</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">−0.037 [−0.048; −0.026]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Jev ahead</td></tr>
|
| 55 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Do the tests in this change cover the changed code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">2,000</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.921</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.879</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">+0.036 [+0.025; +0.047]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Beats Jev</td></tr>
|
| 56 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Does this code change introduce a security vulnerability?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">597</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.904</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">0.755</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">+0.139 [+0.108; +0.168]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:700;background:#FFE766;">Beats Jev</td></tr>
|
| 57 |
+
</tbody>
|
| 58 |
+
</table>
|
| 59 |
+
</div>
|
| 60 |
+
<div class="hidden dark:block" style="overflow-x:auto;">
|
| 61 |
+
<table align="center" style="display:table;width:auto;max-width:100%;margin-left:auto;margin-right:auto;border-collapse:collapse;">
|
| 62 |
+
<thead><tr><th scope="col" style="padding:12px;text-align:left;background:#FFD400;color:#1A1806;">Question</th><th scope="col" style="padding:12px;text-align:center;background:#FFD400;color:#1A1806;">Held-out examples</th><th scope="col" style="padding:12px;text-align:center;background:#FFD400;color:#1A1806;">This model</th><th scope="col" style="padding:12px;text-align:center;background:#FFD400;color:#1A1806;">Jev</th><th scope="col" style="padding:12px;text-align:center;background:#FFD400;color:#1A1806;">Gain over Jev (95% CI)</th><th scope="col" style="padding:12px;text-align:center;background:#FFD400;color:#1A1806;">Result</th></tr></thead>
|
| 63 |
+
<tbody>
|
| 64 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Does the code change do what the pull request description says?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">436</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.928</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.807</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">+0.109 [+0.078; +0.141]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Beats Jev</td></tr>
|
| 65 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">How hard is this change to review?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">221</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.660</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.383</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">+0.196 [+0.131; +0.248]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Beats Jev</td></tr>
|
| 66 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Does this change break compatibility for the users of this code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">2,000</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">0.870</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">0.910</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">−0.037 [−0.048; −0.026]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Jev ahead</td></tr>
|
| 67 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Do the tests in this change cover the changed code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">2,000</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.921</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.879</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">+0.036 [+0.025; +0.047]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Beats Jev</td></tr>
|
| 68 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Does this code change introduce a security vulnerability?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">597</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.904</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">0.755</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">+0.139 [+0.108; +0.168]</td><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#FFD400;font-weight:700;background:#3D3300;">Beats Jev</td></tr>
|
| 69 |
+
</tbody>
|
| 70 |
+
</table>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
## ❓ The questions
|
| 74 |
+
|
| 75 |
+
<div class="dark:hidden" style="overflow-x:auto;">
|
| 76 |
+
<table align="center" style="display:table;width:auto;max-width:100%;margin-left:auto;margin-right:auto;border-collapse:collapse;">
|
| 77 |
+
<thead><tr><th scope="col" style="padding:12px;text-align:left;background:#1A1806;color:#FFD400;">Question</th><th scope="col" style="padding:12px;text-align:center;background:#1A1806;color:#FFD400;">Type</th><th scope="col" style="padding:12px;text-align:left;background:#1A1806;color:#FFD400;">Options</th></tr></thead>
|
| 78 |
+
<tbody>
|
| 79 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Does the code change do what the pull request description says?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">No, the diff does something different from the description.<br>Yes, the diff implements what the description says.</td></tr>
|
| 80 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">How hard is this change to review?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><code>choice</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Trivial: a few lines in one place<br>Small: a short, focused change<br>Medium: several files or some new branching logic<br>Large: many lines or files, or a lot of new branching<br>Very large: hundreds of lines across many files with much new logic</td></tr>
|
| 81 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Does this change break compatibility for the users of this code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">No, existing users keep working without changes.<br>Yes, existing users must change their code or configuration.</td></tr>
|
| 82 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Do the tests in this change cover the changed code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">No, the change needs tests and the ones included do not cover it.<br>Yes, the tests in the change exercise the changed code.</td></tr>
|
| 83 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Does this code change introduce a security vulnerability?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">No, the change does not introduce a security vulnerability.<br>Yes, the change introduces a security vulnerability.</td></tr>
|
| 84 |
+
</tbody>
|
| 85 |
+
</table>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="hidden dark:block" style="overflow-x:auto;">
|
| 88 |
+
<table align="center" style="display:table;width:auto;max-width:100%;margin-left:auto;margin-right:auto;border-collapse:collapse;">
|
| 89 |
+
<thead><tr><th scope="col" style="padding:12px;text-align:left;background:#FFD400;color:#1A1806;">Question</th><th scope="col" style="padding:12px;text-align:center;background:#FFD400;color:#1A1806;">Type</th><th scope="col" style="padding:12px;text-align:left;background:#FFD400;color:#1A1806;">Options</th></tr></thead>
|
| 90 |
+
<tbody>
|
| 91 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Does the code change do what the pull request description says?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">No, the diff does something different from the description.<br>Yes, the diff implements what the description says.</td></tr>
|
| 92 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">How hard is this change to review?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><code>choice</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Trivial: a few lines in one place<br>Small: a short, focused change<br>Medium: several files or some new branching logic<br>Large: many lines or files, or a lot of new branching<br>Very large: hundreds of lines across many files with much new logic</td></tr>
|
| 93 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Does this change break compatibility for the users of this code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">No, existing users keep working without changes.<br>Yes, existing users must change their code or configuration.</td></tr>
|
| 94 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Do the tests in this change cover the changed code?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">No, the change needs tests and the ones included do not cover it.<br>Yes, the tests in the change exercise the changed code.</td></tr>
|
| 95 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Does this code change introduce a security vulnerability?</th><td style="padding:10px 12px;text-align:center;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><code>noul</code></td><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">No, the change does not introduce a security vulnerability.<br>Yes, the change introduces a security vulnerability.</td></tr>
|
| 96 |
+
</tbody>
|
| 97 |
+
</table>
|
| 98 |
+
</div>
|
| 99 |
+
|
| 100 |
+
## 🏃 Use it
|
| 101 |
+
|
| 102 |
+
`decision_ai.json` describes the package: the files, the inputs and outputs of the ONNX model, and each question with its options (`tasks`).
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
pip install huggingface_hub
|
| 106 |
+
huggingface-cli download typestrict/TS-PRGuard --local-dir ts-prguard
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
- **Flutter (phone, browser):** the [decision_ai](https://pub.dev/packages/decision_ai) package reads this package as it is.
|
| 110 |
+
- **Python, Node, any runtime:** ONNX Runtime with the inputs listed in `decision_ai.json`.
|
| 111 |
+
- **Try it first:** the [playground](https://typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e/playground) runs it in your browser.
|
| 112 |
+
|
| 113 |
+
## 📚 Training data
|
| 114 |
+
|
| 115 |
+
124,194 labeled examples; 10,389 of them held out from training to compare with Jev. The questions, the examples and the training run are on the [model page](https://typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e).
|
| 116 |
+
|
| 117 |
+
Sources and their licenses, as given by the owner:
|
| 118 |
+
|
| 119 |
+
Built from the [TS-PRGuard dataset](https://huggingface.co/datasets/typestrict/TS-PRGuard) (labels under CC BY 4.0; every diff under its repository's license, kept with its `repo`, `ref` and `license`), plus more test-coverage examples from SWE-rebench-V2 and more pull requests labeled as breaking. Commercial use is allowed by every source.
|
| 120 |
+
|
| 121 |
+
| Source | License | Questions |
|
| 122 |
+
|---|---|---|
|
| 123 |
+
| Git histories of permissively licensed repositories (MIT, Apache-2.0, BSD and similar) | Each repository's plexity, tests, vulnerability|
|
| 124 |
+
| [bigcode/commitpack](https:bigcode/commitpack) | MIT(code under each repository's license) | description, complexity |
|
| 125 |
+
| Pull requests labeled as brter pull requests labeled `c:API break` | Each repository's license (Flutter: BSD-3-Clause) | breaking change |
|
| 126 |
+
| [nebius/SWE-rebench-V2](httts/nebius/SWE-rebench-V2) | CC BY 4.0 | tests |
|
| 127 |
+
| [GitHub Advisory Database](advisory-database) | CC BY 4.0 | vulnerability |
|
| 128 |
+
| [MoreFixes](https://zenodo. BY 4.0 | vulnerability |
|
| 129 |
+
|
| 130 |
+
## 🚀 Train your own on typestrict.ai
|
| 131 |
+
|
| 132 |
+
This model started from [TS-Ettin-150M](https://huggingface.co/typestrict/TS-Ettin-150M) and learned its questions from its owner's data on [typestrict.ai](https://typestrict.ai). Yours can too: send your data, review what the agent proposes, and get a model measured against Jev on your held-out examples. If it does not beat Jev, the credit comes back.
|
| 133 |
+
|
| 134 |
+
**From your AI assistant** (ChatGPT, Claude, Cursor, Codex, Copilot and others), with the remote MCP server:
|
| 135 |
+
|
| 136 |
+
```bash
|
| 137 |
+
claude mcp add --transport http typestrict https://api.typestrict.ai/mcp
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
**From a terminal or CI**, with the [typestrict CLI](https://github.com/typestrict-lab/cli):
|
| 141 |
+
|
| 142 |
+
```bash
|
| 143 |
+
curl -fsSL https://typestrict.ai/install.sh | sh && typestrict login
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## 🗒️ Model details
|
| 147 |
+
|
| 148 |
+
<div class="dark:hidden" style="overflow-x:auto;">
|
| 149 |
+
<table align="center" style="display:table;width:auto;max-width:100%;margin-left:auto;margin-right:auto;border-collapse:collapse;">
|
| 150 |
+
<thead><tr><th scope="col" style="padding:12px;text-align:left;background:#1A1806;color:#FFD400;">Property</th><th scope="col" style="padding:12px;text-align:left;background:#1A1806;color:#FFD400;">TS-PRGuard</th></tr></thead>
|
| 151 |
+
<tbody>
|
| 152 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Base model</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><a href="https://huggingface.co/typestrict/TS-Ettin-150M">TS-Ettin-150M</a> (Apache-2.0)</td></tr>
|
| 153 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Parameters</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">150M</td></tr>
|
| 154 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Languages</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">EN</td></tr>
|
| 155 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Questions</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">5 (<code>noul</code>, <code>choice</code>)</td></tr>
|
| 156 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Files</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;"><code>decision_ai.json</code>, <code>tokenizer.json</code>, <code>onnx/model_8bit.onnx</code> (8-bit ONNX)</td></tr>
|
| 157 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Runs on</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">CPU, in a browser or on a phone (ONNX Runtime)</td></tr>
|
| 158 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Version</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">v1 on typestrict.ai</td></tr>
|
| 159 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">License</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #E8E2C0;color:#1A1806;font-weight:400;">Apache-2.0</td></tr>
|
| 160 |
+
</tbody>
|
| 161 |
+
</table>
|
| 162 |
+
</div>
|
| 163 |
+
<div class="hidden dark:block" style="overflow-x:auto;">
|
| 164 |
+
<table align="center" style="display:table;width:auto;max-width:100%;margin-left:auto;margin-right:auto;border-collapse:collapse;">
|
| 165 |
+
<thead><tr><th scope="col" style="padding:12px;text-align:left;background:#FFD400;color:#1A1806;">Property</th><th scope="col" style="padding:12px;text-align:left;background:#FFD400;color:#1A1806;">TS-PRGuard</th></tr></thead>
|
| 166 |
+
<tbody>
|
| 167 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Base model</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><a href="https://huggingface.co/typestrict/TS-Ettin-150M">TS-Ettin-150M</a> (Apache-2.0)</td></tr>
|
| 168 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Parameters</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">150M</td></tr>
|
| 169 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Languages</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">EN</td></tr>
|
| 170 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Questions</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">5 (<code>noul</code>, <code>choice</code>)</td></tr>
|
| 171 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Files</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;"><code>decision_ai.json</code>, <code>tokenizer.json</code>, <code>onnx/model_8bit.onnx</code> (8-bit ONNX)</td></tr>
|
| 172 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Runs on</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">CPU, in a browser or on a phone (ONNX Runtime)</td></tr>
|
| 173 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Version</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">v1 on typestrict.ai</td></tr>
|
| 174 |
+
<tr><th scope="row" style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">License</th><td style="padding:10px 12px;text-align:left;border-bottom:1px solid #2E2B14;color:#E8E4CF;font-weight:400;">Apache-2.0</td></tr>
|
| 175 |
+
</tbody>
|
| 176 |
+
</table>
|
| 177 |
+
</div>
|
| 178 |
+
|
| 179 |
+
## Links
|
| 180 |
+
|
| 181 |
+
- **Model page**: [typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e](https://typestrict.ai/models/01a19e01-da22-729e-8d6c-4869efc4691e), with the data, the training run, the audit file and the playground
|
| 182 |
+
- **typestrict.ai**: [typestrict.ai](https://typestrict.ai), the docs at [docs.typestrict.ai](https://docs.typestrict.ai)
|
| 183 |
+
- **Open source**: [CLI and MCP server](https://github.com/typestrict-lab/cli), [decision_ai for Flutter](https://pub.dev/packages/decision_ai)
|
decision_ai.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"format": "decision-ai/option-reader@1",
|
| 3 |
+
"name": "typestrict multi-task model",
|
| 4 |
+
"license": "apache-2.0",
|
| 5 |
+
"files": {
|
| 6 |
+
"model": "onnx/model_8bit.onnx",
|
| 7 |
+
"tokenizer": "tokenizer.json"
|
| 8 |
+
},
|
| 9 |
+
"sha256": {
|
| 10 |
+
"onnx/model_8bit.onnx": "5f61cf8beeb8cdc2f2d112549f0a66ff42f75e05fc216f4c8e2d0766d9815891",
|
| 11 |
+
"tokenizer.json": "858fe1cd418807d6c71c01e24b6d3239a224a1e3c995472fef20841e09eab056"
|
| 12 |
+
},
|
| 13 |
+
"max_length": 7999,
|
| 14 |
+
"pad_multiple": 64,
|
| 15 |
+
"tokens": {
|
| 16 |
+
"cls": "[CLS]",
|
| 17 |
+
"sep": "[SEP]",
|
| 18 |
+
"pad": "[PAD]",
|
| 19 |
+
"option": "[OPT]"
|
| 20 |
+
},
|
| 21 |
+
"question_types": {
|
| 22 |
+
"noul": 0,
|
| 23 |
+
"choice": 1,
|
| 24 |
+
"score": 2
|
| 25 |
+
},
|
| 26 |
+
"noul_false_default": "A afirmação não se aplica.",
|
| 27 |
+
"inputs": {
|
| 28 |
+
"ids": "ids",
|
| 29 |
+
"pad_mask": "pad_mask",
|
| 30 |
+
"option_positions": "opt_positions",
|
| 31 |
+
"option_mask": "opt_mask",
|
| 32 |
+
"question_type": "qtype"
|
| 33 |
+
},
|
| 34 |
+
"outputs": {
|
| 35 |
+
"logits": "logits",
|
| 36 |
+
"confidence_logit": "conf_logit"
|
| 37 |
+
},
|
| 38 |
+
"calibration": {
|
| 39 |
+
"temperature": null,
|
| 40 |
+
"platt": null
|
| 41 |
+
},
|
| 42 |
+
"truncation": {
|
| 43 |
+
"max_length": 4096,
|
| 44 |
+
"max_criterion_tokens": 160
|
| 45 |
+
},
|
| 46 |
+
"tasks": [
|
| 47 |
+
{
|
| 48 |
+
"name": "pr-descricao-noul",
|
| 49 |
+
"kind": "noul",
|
| 50 |
+
"question": "Does the code change do what the pull request description says?",
|
| 51 |
+
"options": [
|
| 52 |
+
"No, the diff does something different from the description.",
|
| 53 |
+
"Yes, the diff implements what the description says."
|
| 54 |
+
]
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"name": "prg-complexidade",
|
| 58 |
+
"kind": "choice",
|
| 59 |
+
"question": "How hard is this change to review?",
|
| 60 |
+
"options": [
|
| 61 |
+
"Trivial: a few lines in one place",
|
| 62 |
+
"Small: a short, focused change",
|
| 63 |
+
"Medium: several files or some new branching logic",
|
| 64 |
+
"Large: many lines or files, or a lot of new branching",
|
| 65 |
+
"Very large: hundreds of lines across many files with much new logic"
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"name": "prg-quebra",
|
| 70 |
+
"kind": "noul",
|
| 71 |
+
"question": "Does this change break compatibility for the users of this code?",
|
| 72 |
+
"options": [
|
| 73 |
+
"No, existing users keep working without changes.",
|
| 74 |
+
"Yes, existing users must change their code or configuration."
|
| 75 |
+
]
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"name": "prg-testes",
|
| 79 |
+
"kind": "noul",
|
| 80 |
+
"question": "Do the tests in this change cover the changed code?",
|
| 81 |
+
"options": [
|
| 82 |
+
"No, the change needs tests and the ones included do not cover it.",
|
| 83 |
+
"Yes, the tests in the change exercise the changed code."
|
| 84 |
+
]
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"name": "prg-vul",
|
| 88 |
+
"kind": "noul",
|
| 89 |
+
"question": "Does this code change introduce a security vulnerability?",
|
| 90 |
+
"options": [
|
| 91 |
+
"No, the change does not introduce a security vulnerability.",
|
| 92 |
+
"Yes, the change introduces a security vulnerability."
|
| 93 |
+
]
|
| 94 |
+
}
|
| 95 |
+
]
|
| 96 |
+
}
|
figures/banner.png
ADDED
|
figures/results.png
ADDED
|
Git LFS Details
|
holdout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
onnx/model_8bit.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f61cf8beeb8cdc2f2d112549f0a66ff42f75e05fc216f4c8e2d0766d9815891
|
| 3 |
+
size 164505784
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|