Clarify model behavior and align the model card with Chowder positioning
Browse files
README.md
CHANGED
|
@@ -9,147 +9,174 @@ tags: [boolean-qa, abstention, calibration, sequence-classification]
|
|
| 9 |
<img src="https://huggingface.co/chowderai/Bitsy-3.3B/resolve/main/assets/bitsy-cat-v3.png" alt="Bitsy mascot" width="280" height="280">
|
| 10 |
</p>
|
| 11 |
|
| 12 |
-
# Bitsy
|
| 13 |
|
| 14 |
-
|
| 15 |
-
distribution over `true`, `false`, `unknown` in **one forward pass with no decoding at all**.
|
| 16 |
|
| 17 |
-
|
| 18 |
-
proposition. Threshold `P(unknown)` to get SQL-`NULL` semantics for columnar inference over data you
|
| 19 |
-
supply.
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
classify path with **zero sampling parameters**:
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|---|---:|
|
| 31 |
-
| **Bitsy-3.3B**, held-out test half (n=496) | **0.861** |
|
| 32 |
-
| Bitsy-3.3B, all 1,000 rows | 0.862 |
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
all 1,000.
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|---|---:|---|---|---:|
|
| 40 |
-
| `unknown` (n=345) | 0.875 | | over-abstention | 0.098 |
|
| 41 |
-
| `true` (n=331) | 0.867 | | under-abstention | 0.125 |
|
| 42 |
-
| `false` (n=324) | 0.843 | | | |
|
| 43 |
|
| 44 |
-
|
| 45 |
-
mnli 0.900, sharc 0.892, boolq 0.883, wanli 0.880, qasper 0.850, pubmedqa 0.829, condaqa 0.783,
|
| 46 |
-
anli 0.742.
|
| 47 |
|
| 48 |
-
|
| 49 |
-
> own prompt template (below), which it was trained on; the models in `bool-bench`'s published table
|
| 50 |
-
> are evaluated at that benchmark's protocol. That is not strictly like-for-like and the choice
|
| 51 |
-
> favours Bitsy. The same caveat is recorded there for the other fine-tune in that table.
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
```python
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
```
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
-
import torch
|
| 76 |
-
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 77 |
|
| 78 |
-
|
| 79 |
-
m = AutoModelForSequenceClassification.from_pretrained(
|
| 80 |
-
"johnsonkuan/Bitsy-3.3B", dtype=torch.bfloat16).cuda().eval()
|
| 81 |
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
with torch.inference_mode():
|
| 84 |
-
|
| 85 |
|
| 86 |
-
labels = [
|
|
|
|
|
|
|
| 87 |
```
|
| 88 |
|
| 89 |
-
|
| 90 |
-
Read the label order from `config.id2label` rather than assuming it.
|
| 91 |
-
Cast logits to `float()` before the softmax -- the decision-carrying differences are small and bf16
|
| 92 |
-
blurs them.
|
| 93 |
|
| 94 |
### vLLM
|
| 95 |
|
|
|
|
|
|
|
| 96 |
```python
|
| 97 |
from vllm import LLM
|
| 98 |
-
llm = LLM(model="johnsonkuan/Bitsy-3.3B", runner="pooling", convert="classify",
|
| 99 |
-
hf_overrides={"architectures": ["Qwen3_5ForCausalLM"]})
|
| 100 |
-
probs = llm.classify([prompt])[0].outputs.probs # [P(true), P(false), P(unknown)]
|
| 101 |
-
```
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
`Qwen3_5TextForSequenceClassification`, which vLLM's registry does not yet carry. The override
|
| 107 |
-
points it at the causal architecture it does know, and it then applies `as_seq_cls_model` under
|
| 108 |
-
`convert="classify"` -- reading the last token through the `score` head, which is exactly this
|
| 109 |
-
model's readout. Drop the flag once vLLM supports the class natively. The alternative -- writing the
|
| 110 |
-
causal name into the config -- would mis-declare the artifact to every other tool that reads that
|
| 111 |
-
field, so it is a serving-side workaround by choice.
|
| 112 |
|
| 113 |
-
## Architecture
|
| 114 |
|
| 115 |
-
| | |
|
| 116 |
-
|---|---|
|
| 117 |
-
|
|
| 118 |
-
|
|
| 119 |
-
|
|
| 120 |
-
|
|
| 121 |
-
| embeddings |
|
| 122 |
|
| 123 |
-
The
|
| 124 |
-
A bias-free linear map forces every decision boundary through the origin, and these features sit far
|
| 125 |
-
from it, so the probe initialisation carries its constant in the weights along a direction on which
|
| 126 |
-
the features are near-constant (`h . mu/||mu||^2` has mean 1.000, std 0.058). That is an
|
| 127 |
-
initialisation only; training adapts from there and the shipped weights approximate nothing.
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
| 132 |
-
targets. 2 epochs, lr 2e-6, warmup 50, checkpoint selected on a frozen dev half (step 12,000 of
|
| 133 |
-
17,560). Probe-initialised from a frozen linear fit on layer-24 features.
|
| 134 |
|
| 135 |
-
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
|
| 140 |
-
n=1,000 is roughly +-2 points, which is wider than most differences anyone will want to draw.
|
| 141 |
|
| 142 |
-
|
| 143 |
-
source families, so this measures performance on that distribution, not general transfer.
|
| 144 |
|
| 145 |
-
|
| 146 |
-
on XNLI (500 rows per language), accuracy falls from 0.836 in English to 0.69-0.77 in Spanish, German,
|
| 147 |
-
Russian, Chinese and Arabic, 0.580 in Hindi and 0.516 in Swahili, where `true`/`false` recall reaches
|
| 148 |
-
chance (0.33). `unknown` recall holds at 0.87-0.92 in every language, so the model degrades by
|
| 149 |
-
**abstaining more**, not by guessing wrong -- which makes the drop easy to miss as a rising rate of
|
| 150 |
-
`unknown`. The weakness is inherited from `Qwen/Qwen3.5-4B` (the untouched base drops further
|
| 151 |
-
from its own English score in six of seven languages), not induced by fine-tuning.
|
| 152 |
-
Translate non-English input to English first.
|
| 153 |
|
| 154 |
-
|
| 155 |
-
threshold. The abstention cut belongs to your data and should be fitted on your own held-out rows.
|
|
|
|
| 9 |
<img src="https://huggingface.co/chowderai/Bitsy-3.3B/resolve/main/assets/bitsy-cat-v3.png" alt="Bitsy mascot" width="280" height="280">
|
| 10 |
</p>
|
| 11 |
|
| 12 |
+
# Bitsy
|
| 13 |
|
| 14 |
+
Bitsy is the 3.3B-parameter model behind Chowder's `infer(..., BOOLEAN)` route. Given a document and a question or statement, it scores three answers: `true`, `false`, and `unknown`. Chowder returns the selected answer as a native SQL Boolean, with `unknown` represented as `NULL` in the result envelope's `.output` field.
|
|
|
|
| 15 |
|
| 16 |
+
Bitsy is designed for document-grounded decisions across collections of records. It uses the evidence in the document you provide, rather than outside knowledge.
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
| Answer | Meaning |
|
| 19 |
+
| --- | --- |
|
| 20 |
+
| `true` | The document supports a positive answer. |
|
| 21 |
+
| `false` | The document supports a negative answer. |
|
| 22 |
+
| `unknown` | The document does not provide enough evidence to decide. |
|
| 23 |
|
| 24 |
+
`unknown` is a learned class for insufficient evidence. It does not guarantee that the model will recognize every unanswerable question or avoid confident errors. The scores are softmax probabilities; their calibration has not been established.
|
| 25 |
|
| 26 |
+
## Choose a model format
|
|
|
|
| 27 |
|
| 28 |
+
This repository contains two representations of Bitsy:
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
- **Original Safetensors checkpoint:** a sequence classifier with three output scores. It makes a decision in one forward pass without generating answer text. Use the Transformers or vLLM classification examples below.
|
| 31 |
+
- **`Bitsy-3.3B-Q4_K_M.gguf`:** a quantized conversion used by Chowder's local llama.cpp runtime. It includes the classifier's prompt, tokenizer, and label contract. The conversion exposes the three classifier scores through designated token outputs; Chowder handles that interface for you.
|
|
|
|
| 32 |
|
| 33 |
+
The original checkpoint has a classification head rather than a language-model head. Use its classification interface instead of `generate()`. The GGUF is also intended for this classification task, rather than general text generation. Quantization and serving differences can change individual predictions; the checkpoint results below are not a separate evaluation of the GGUF.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
Both formats are currently in a private repository. You need a Hugging Face account with access to download them.
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
## Evaluation
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
The selected checkpoint was evaluated on [Bool-Bench](https://huggingface.co/datasets/chowderai/Bool-Bench), a 1,000-example benchmark for document-grounded Boolean decisions with abstention, using vLLM's classification interface.
|
| 40 |
|
| 41 |
+
| Evaluation set | Accuracy |
|
| 42 |
+
| --- | ---: |
|
| 43 |
+
| Fixed test half, 496 examples | **86.1%** |
|
| 44 |
+
| All 1,000 examples, including development examples | 86.2% |
|
| 45 |
|
| 46 |
+
The other 504 examples were used to select the final checkpoint. Use **86.1% on the test half** as the primary result for the selected checkpoint. The full-set figure includes development examples. The test half was excluded from final checkpoint selection and weight updates, but exploratory prompt and model-design studies used the full benchmark. It is not an entirely untouched test of every design choice.
|
| 47 |
+
|
| 48 |
+
The following breakdowns describe **all 1,000 examples**, including the development half:
|
| 49 |
+
|
| 50 |
+
| Reference class | Examples | Recall |
|
| 51 |
+
| --- | ---: | ---: |
|
| 52 |
+
| `true` | 331 | 86.7% |
|
| 53 |
+
| `false` | 324 | 84.3% |
|
| 54 |
+
| `unknown` | 345 | 87.5% |
|
| 55 |
+
|
| 56 |
+
Over-abstention was 9.8%: the share of answerable examples predicted as `unknown`. Under-abstention was 12.5%: the share of `unknown` examples predicted as `true` or `false`.
|
| 57 |
+
|
| 58 |
+
Per-source accuracy was: VitaminC 92.5%, ContractNLI 92.0%, synthetic conversation transcripts 91.7%, synthetic Common Pile examples 91.1%, MNLI 90.0%, ShARC 89.2%, BoolQ 88.3%, WANLI 88.0%, QASPER 85.0%, PubMedQA 82.9%, CondaQA 78.3%, and ANLI 74.2%. These small slices describe this benchmark, rather than performance on each source as a whole.
|
| 59 |
+
|
| 60 |
+
**Comparison limits:** Bitsy uses the prompt it was trained on and a classification interface. Other models in the benchmark use the benchmark's prompt and serving protocol. Comparisons therefore include differences in prompting and serving, as well as model weights. Total parameter counts alone do not establish speed or cost savings. Final-classifier throughput and cost per decision have not been measured in this evaluation.
|
| 61 |
+
|
| 62 |
+
## Use the original checkpoint
|
| 63 |
+
|
| 64 |
+
### Prepare the prompt
|
| 65 |
+
|
| 66 |
+
Use the trained prompt format, including its final answer cue. Changing the wording or omitting the cue can change predictions and abstention behavior.
|
| 67 |
+
|
| 68 |
+
Run this setup before either backend example:
|
| 69 |
|
| 70 |
```python
|
| 71 |
+
from transformers import AutoTokenizer
|
| 72 |
+
|
| 73 |
+
model_id = "chowderai/Bitsy-3.3B"
|
| 74 |
+
tok = AutoTokenizer.from_pretrained(model_id)
|
| 75 |
+
tok.padding_side = "left"
|
| 76 |
+
tok.truncation_side = "left"
|
| 77 |
+
|
| 78 |
+
GROUNDING = (
|
| 79 |
+
"Decide using only the document below. Do not use outside knowledge, "
|
| 80 |
+
"even if you know the answer.\n\n"
|
| 81 |
+
)
|
| 82 |
+
TEMPLATE = (
|
| 83 |
+
"## Document:\n{document}\n\n## Proposition:\n{proposition}\n\n"
|
| 84 |
+
"The answer to the proposition based on the document is:"
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def format_prompt(document, proposition):
|
| 89 |
+
user = GROUNDING + TEMPLATE.format(document=document, proposition=proposition)
|
| 90 |
+
return tok.apply_chat_template(
|
| 91 |
+
[{"role": "user", "content": user}],
|
| 92 |
+
tokenize=False,
|
| 93 |
+
add_generation_prompt=True,
|
| 94 |
+
enable_thinking=False,
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
prompt = format_prompt(
|
| 99 |
+
"The customer confirmed the refund.",
|
| 100 |
+
"Did the customer confirm the refund?",
|
| 101 |
+
)
|
| 102 |
```
|
| 103 |
|
| 104 |
+
The recorded training setup used a maximum of 12,288 tokens with left truncation. Long inputs can lose evidence when truncated. For reproducible deployments, pin the tokenizer and model to the same full repository commit SHA using `revision`.
|
| 105 |
|
| 106 |
+
### Transformers
|
|
|
|
|
|
|
| 107 |
|
| 108 |
+
This example uses a CUDA GPU with bfloat16 support and the original Safetensors checkpoint. Use a Transformers version that supports `Qwen3_5TextForSequenceClassification`.
|
|
|
|
|
|
|
| 109 |
|
| 110 |
+
```python
|
| 111 |
+
import torch
|
| 112 |
+
from transformers import AutoModelForSequenceClassification
|
| 113 |
+
|
| 114 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
| 115 |
+
model_id, dtype=torch.bfloat16
|
| 116 |
+
).to("cuda").eval()
|
| 117 |
+
|
| 118 |
+
encoded = tok(
|
| 119 |
+
prompt,
|
| 120 |
+
return_tensors="pt",
|
| 121 |
+
add_special_tokens=False,
|
| 122 |
+
truncation=True,
|
| 123 |
+
max_length=12288,
|
| 124 |
+
).to("cuda")
|
| 125 |
with torch.inference_mode():
|
| 126 |
+
probabilities = model(**encoded).logits[0].float().softmax(-1)
|
| 127 |
|
| 128 |
+
labels = [model.config.id2label[i] for i in range(model.config.num_labels)]
|
| 129 |
+
prediction = labels[int(probabilities.argmax().item())]
|
| 130 |
+
scores = dict(zip(labels, probabilities.cpu().tolist()))
|
| 131 |
```
|
| 132 |
|
| 133 |
+
Read the label order from `config.id2label`. Compute the softmax in float32, as shown, to retain precision when the logits are close. To classify a batch, pass a list of prompts with `padding=True` and the same tokenization settings. The chat template already supplies special tokens, so the second tokenization step uses `add_special_tokens=False`.
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
### vLLM
|
| 136 |
|
| 137 |
+
This is the classification setup used for the recorded vLLM evaluation. It reuses the tokenizer and `prompt` from the setup above:
|
| 138 |
+
|
| 139 |
```python
|
| 140 |
from vllm import LLM
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
llm = LLM(
|
| 143 |
+
model=model_id,
|
| 144 |
+
runner="pooling",
|
| 145 |
+
convert="classify",
|
| 146 |
+
max_model_len=12288,
|
| 147 |
+
enforce_eager=True,
|
| 148 |
+
hf_overrides={"architectures": ["Qwen3_5ForCausalLM"]},
|
| 149 |
+
)
|
| 150 |
+
probabilities = llm.classify([prompt])[0].outputs.probs
|
| 151 |
+
# Label order is defined by the checkpoint's config.id2label.
|
| 152 |
+
```
|
| 153 |
|
| 154 |
+
The architecture override is a serving-side compatibility setting for the recorded evaluation environment, which used vLLM 0.29.0. It lets that version load the backbone and apply the classification head. It does not change the checkpoint's declared architecture. This path scores classes directly and does not take text-generation sampling parameters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
+
## Architecture and training
|
| 157 |
|
| 158 |
+
| Property | Value |
|
| 159 |
+
| --- | --- |
|
| 160 |
+
| Base model | `Qwen/Qwen3.5-4B`, reduced from 32 to 24 decoder blocks |
|
| 161 |
+
| Parameters | 3,313,246,592 |
|
| 162 |
+
| Classification head | `Linear(2560, 3, bias=False)`, 7,680 parameters |
|
| 163 |
+
| Readout position | Last non-padding token |
|
| 164 |
+
| Token embeddings | Frozen during training |
|
| 165 |
|
| 166 |
+
The classification head was initialized from a linear probe on frozen layer-24 features, then fine-tuned with the backbone. Training used roughly 100,000 document-and-proposition examples with soft targets from `moonshotai/Kimi-K3`: distributions over the three labels rather than only the teacher's highest-scoring answer.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
+
The schedule was two epochs at a learning rate of `2e-6`, with 50 warmup steps. The released checkpoint was selected at step 12,000 of the 17,560-step schedule using development accuracy. Bool-Bench examples were not used for weight updates; the benchmark's development half was used for checkpoint selection.
|
| 169 |
|
| 170 |
+
## Limits and abstention
|
|
|
|
|
|
|
| 171 |
|
| 172 |
+
These results come from one final training run, without repeated-run estimates. Training and benchmark source families overlap. Exact-text checks found no benchmark overlap with the training mixture, but do not rule out near duplicates or pretraining exposure. Validate the model on your own documents and questions before relying on its scores.
|
| 173 |
|
| 174 |
+
The model was trained on English inputs. On XNLI, with 500 examples per language, recorded accuracy fell from 83.6% in English to 69–77% in Spanish, German, Russian, Chinese, and Arabic; 58.0% in Hindi; and 51.6% in Swahili. High `unknown` recall alongside lower accuracy does not establish reliable uncertainty detection. We recommend English inputs and evaluation on your intended domain. If you translate inputs, evaluate the translated workflow too.
|
| 175 |
|
| 176 |
+
By default, Chowder selects the highest-scoring label and maps `unknown` to `NULL`. It does not obtain SQL `NULL` semantics by applying a separate cutoff to `P(unknown)`. If you use the checkpoint directly and choose additional rejection thresholds, fit and evaluate them on representative held-out data. A high `true` or `false` score is not a guarantee of correctness.
|
|
|
|
| 177 |
|
| 178 |
+
## About Chowder
|
|
|
|
| 179 |
|
| 180 |
+
Chowder is an open-source, AI-native SQL engine for multimodal data analytics. Run SQL on documents, text, images, video, audio, and more.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
+
[Chowder](https://chowder.ai) · [Documentation](https://docs.chowder.ai) · [`infer()` reference](https://docs.chowder.ai/reference/functions/infer)
|
|
|