Zero-Shot Classification
Transformers
Safetensors
English
qwen3
text-generation
assay
decision-model
calibrated
conformal-prediction
text-classification
structured-output
text-generation-inference
Instructions to use Berk/assay-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Berk/assay-4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="Berk/assay-4b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Berk/assay-4b") model = AutoModelForCausalLM.from_pretrained("Berk/assay-4b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +21 -0
- conformal-eval.json +60 -0
- conformal.json +22 -0
README.md
CHANGED
|
@@ -82,6 +82,27 @@ questions packed_ms separate_ms
|
|
| 82 |
24 56.5 543.7
|
| 83 |
```
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
## Usage
|
| 86 |
|
| 87 |
```python
|
|
|
|
| 82 |
24 56.5 543.7
|
| 83 |
```
|
| 84 |
|
| 85 |
+
## Abstention
|
| 86 |
+
|
| 87 |
+
`conformal.json` holds per-question-type thresholds fitted on the seen-task calibration split
|
| 88 |
+
(alpha 0.1, delta 0.05): a prediction-set threshold with coverage at least
|
| 89 |
+
1 - alpha and an act threshold on the top probability whose acted-on error rate is at most alpha
|
| 90 |
+
at confidence 1 - delta, both on inputs distributed like the calibration split. `assay.server`
|
| 91 |
+
returns them as `act` and `set` on every answer. How they carry over to other tasks:
|
| 92 |
+
|
| 93 |
+
| split | type | coverage | set size | act rate / error among acted |
|
| 94 |
+
|---|---|---|---|---|
|
| 95 |
+
| unseen tasks | bool | 0.86 | 1.07 | 75% / 10.2% |
|
| 96 |
+
| unseen tasks | choice | 0.93 | 1.37 | 74% / 8.0% |
|
| 97 |
+
| unseen tasks | score | 0.81 | 2.10 | no threshold |
|
| 98 |
+
| transfer suite | bool | 0.82 | 1.02 | 85% / 14.2% |
|
| 99 |
+
| transfer suite | choice | 0.88 | 1.37 | 73% / 13.7% |
|
| 100 |
+
| transfer suite | score | 1.00 | 1.55 | no threshold |
|
| 101 |
+
|
| 102 |
+
Score questions get prediction sets but usually no act threshold, because exact-level accuracy
|
| 103 |
+
is the wrong error notion for ordinal answers. Refit on your own labelled data with
|
| 104 |
+
`python -m assay.conformal` for a guarantee about your distribution.
|
| 105 |
+
|
| 106 |
## Usage
|
| 107 |
|
| 108 |
```python
|
conformal-eval.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"holdout": {
|
| 3 |
+
"bool": {
|
| 4 |
+
"count": 800,
|
| 5 |
+
"coverage": 0.8575,
|
| 6 |
+
"mean_set_size": 1.07,
|
| 7 |
+
"singleton_rate": 0.93,
|
| 8 |
+
"act_rate": 0.74625,
|
| 9 |
+
"act_error": 0.102177554438861,
|
| 10 |
+
"abstain_accuracy": 0.6059113300492611
|
| 11 |
+
},
|
| 12 |
+
"choice": {
|
| 13 |
+
"count": 1020,
|
| 14 |
+
"coverage": 0.9333333333333333,
|
| 15 |
+
"mean_set_size": 1.3735294117647059,
|
| 16 |
+
"singleton_rate": 0.6656862745098039,
|
| 17 |
+
"act_rate": 0.7431372549019608,
|
| 18 |
+
"act_error": 0.08047493403693928,
|
| 19 |
+
"abstain_accuracy": 0.5801526717557252
|
| 20 |
+
},
|
| 21 |
+
"score": {
|
| 22 |
+
"count": 200,
|
| 23 |
+
"coverage": 0.81,
|
| 24 |
+
"mean_set_size": 2.105,
|
| 25 |
+
"singleton_rate": 0.1,
|
| 26 |
+
"act_rate": 0.0,
|
| 27 |
+
"act_error": NaN,
|
| 28 |
+
"abstain_accuracy": 0.575
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"transfer-v4": {
|
| 32 |
+
"bool": {
|
| 33 |
+
"count": 280,
|
| 34 |
+
"coverage": 0.8178571428571428,
|
| 35 |
+
"mean_set_size": 1.0214285714285714,
|
| 36 |
+
"singleton_rate": 0.9785714285714285,
|
| 37 |
+
"act_rate": 0.8535714285714285,
|
| 38 |
+
"act_error": 0.14225941422594146,
|
| 39 |
+
"abstain_accuracy": 0.5121951219512195
|
| 40 |
+
},
|
| 41 |
+
"choice": {
|
| 42 |
+
"count": 444,
|
| 43 |
+
"coverage": 0.8806306306306306,
|
| 44 |
+
"mean_set_size": 1.3738738738738738,
|
| 45 |
+
"singleton_rate": 0.6779279279279279,
|
| 46 |
+
"act_rate": 0.7252252252252253,
|
| 47 |
+
"act_error": 0.1366459627329193,
|
| 48 |
+
"abstain_accuracy": 0.45901639344262296
|
| 49 |
+
},
|
| 50 |
+
"score": {
|
| 51 |
+
"count": 40,
|
| 52 |
+
"coverage": 1.0,
|
| 53 |
+
"mean_set_size": 1.55,
|
| 54 |
+
"singleton_rate": 0.45,
|
| 55 |
+
"act_rate": 0.0,
|
| 56 |
+
"act_error": NaN,
|
| 57 |
+
"abstain_accuracy": 0.975
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
conformal.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha": 0.1,
|
| 3 |
+
"delta": 0.05,
|
| 4 |
+
"types": {
|
| 5 |
+
"bool": {
|
| 6 |
+
"count": 1605,
|
| 7 |
+
"set_threshold": 0.5736941734075884,
|
| 8 |
+
"act_threshold": 0.73
|
| 9 |
+
},
|
| 10 |
+
"choice": {
|
| 11 |
+
"count": 3000,
|
| 12 |
+
"set_threshold": 0.8358629694672518,
|
| 13 |
+
"act_threshold": 0.7
|
| 14 |
+
},
|
| 15 |
+
"score": {
|
| 16 |
+
"count": 900,
|
| 17 |
+
"set_threshold": 0.8073051128394045,
|
| 18 |
+
"act_threshold": null
|
| 19 |
+
}
|
| 20 |
+
},
|
| 21 |
+
"temperature": 1.2628892508565965
|
| 22 |
+
}
|