Bitsy-3.3B / docs /USAGE.md
johnsonkuan's picture
Align Bitsy card and technical references with paper evidence
390e7b9 verified
|
Raw History Blame Contribute Delete
4.61 kB

Bitsy usage and model formats

Choose a model format

This repository contains two representations of Bitsy:

  • 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.
  • Bitsy-3.3B-Q4_K_M.gguf: a quantized conversion for llama.cpp-based serving. It includes the classifier's prompt, tokenizer, and label contract, and exposes the three classifier scores through designated token outputs. A serving integration must use that contract and read the label-token scores.

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 are not a separate evaluation of the GGUF.

Both formats are currently in a private repository. You need a Hugging Face account with access to download them.

Usage

The examples below use the original Safetensors checkpoint.

Prepare the prompt

Use the trained prompt format, including its final answer cue. Changing the wording or omitting the cue can change predictions and abstention behavior.

Run this setup before either backend example:

from transformers import AutoTokenizer

model_id = "chowderai/Bitsy-3.3B"
tok = AutoTokenizer.from_pretrained(model_id)
tok.padding_side = "left"
tok.truncation_side = "left"

GROUNDING = (
    "Decide using only the document below. Do not use outside knowledge, "
    "even if you know the answer.\n\n"
)
TEMPLATE = (
    "## Document:\n{document}\n\n## Proposition:\n{proposition}\n\n"
    "The answer to the proposition based on the document is:"
)


def format_prompt(document, proposition):
    user = GROUNDING + TEMPLATE.format(document=document, proposition=proposition)
    return tok.apply_chat_template(
        [{"role": "user", "content": user}],
        tokenize=False,
        add_generation_prompt=True,
        enable_thinking=False,
    )


prompt = format_prompt(
    "The customer confirmed the refund.",
    "Did the customer confirm the refund?",
)

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.

Transformers

This example uses a CUDA GPU with bfloat16 support and the original Safetensors checkpoint. Use a Transformers version that supports Qwen3_5TextForSequenceClassification.

import torch
from transformers import AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained(
    model_id, dtype=torch.bfloat16
).to("cuda").eval()

encoded = tok(
    prompt,
    return_tensors="pt",
    add_special_tokens=False,
    truncation=True,
    max_length=12288,
).to("cuda")
with torch.inference_mode():
    probabilities = model(**encoded).logits[0].float().softmax(-1)

labels = [model.config.id2label[i] for i in range(model.config.num_labels)]
prediction = labels[int(probabilities.argmax().item())]
scores = dict(zip(labels, probabilities.cpu().tolist()))

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.

vLLM

This is the classification setup used for the recorded vLLM evaluation. It reuses the tokenizer and prompt from the setup above:

from vllm import LLM

llm = LLM(
    model=model_id,
    runner="pooling",
    convert="classify",
    max_model_len=12288,
    enforce_eager=True,
    hf_overrides={"architectures": ["Qwen3_5ForCausalLM"]},
)
probabilities = llm.classify([prompt])[0].outputs.probs
# Label order is defined by the checkpoint's config.id2label.

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.