Skip to main content

sb-decision

The SB Decision Model, by Sarathi Balakrishnan. Give it a text and your own list of options, each written as name: when to choose it, and it returns a calibrated probability per option in one pass. Nothing is retrained per use case: the option definitions are the policy. A reserved ask option is trained to win when the deciding fact is missing from the text, so irreversible actions go to a person instead of being guessed.

Not an LLM. It never generates text. It is the router, guardrail, or triage layer in front of one.

Install

pip install sb-decision

Use

from sb_decision import SBDecision

m = SBDecision.load()  # sarathi-balakrishnan/browser-decision-model-base
m.decide(
    "Package arrived broken, second time this month. I want a manager.",
    [
        "refund: customer wants money back for a damaged, wrong, or missing item",
        "replace: customer wants the product again",
        "escalate: angry, threatens to leave, or asks for a manager",
    ],
)
# {'decision': 'escalate', 'band': 'auto', 'scores': {'escalate': 0.90, 'ask': 0.09, 'refund': 0.01, 'replace': 0.01}}

band is auto when the top score is at or above auto=0.7, review at or above review=0.4, otherwise abstain. If ask wins it is always abstain. Both thresholds are arguments; they are statements about the error rate you accept, not model constants.

Independent tags, when several options can apply at once:

m.decide(
    "Headache since morning and now my chest feels tight.",
    ["headache: pain in the head", "chest pain: pressure or tightness in the chest", "rash: skin redness or itching"],
    mode="multi",
)
# {'decision': 'chest pain', 'band': 'auto', 'tags': ['headache', 'chest pain'],
#  'scores': {'chest pain': 0.76, 'headache': 0.61, 'ask': 0.14, 'rash': 0.0}}

Many texts at once: m.scores_many(texts, options). Command line:

sb-decision "It doesn't work on my machine." -o "crash: the app exits or hangs" -o "slow: works but takes too long" -o "question: asks how to do something"

JavaScript, React or Node

The same API ships on npm as sb-decision (browser on WebGPU or WASM, and Node):

import { SBDecision } from "sb-decision";

const m = await SBDecision.load({ token: HF_TOKEN });
const r = await m.decide("Package arrived broken, second time this month. I want a manager.", [
  "refund: customer wants money back for a damaged, wrong, or missing item",
  "replace: customer wants the product again",
  "escalate: angry, threatens to leave, or asks for a manager",
]);
// { decision: "escalate", band: "auto", scores: { escalate: 0.9, ask: 0.09, refund: 0.01, replace: 0.01 } }

React and Node examples are in the npm package README: https://www.npmjs.com/package/sb-decision

Access

The package is public; the weights are in private preview. SBDecision.load() raises SBAccessError with contact details if your Hugging Face token does not have access. To try it on your own option set, contact Sarathi Balakrishnan at https://huggingface.co/sarathi-balakrishnan .

Writing options

  • One line per option, saying when to choose it, with the boundary to its neighbours explicit.
  • Describe what the text says, not what you will do about it. "chest pressure with sweating or arm tingling" scores; "tell the caller to call 911" does not.
  • Keep ask in the list whenever the action is irreversible.
  • Up to 12 options, 1,024 tokens, English. It decides from the text, not the world: no lookups, no arithmetic.

Results

Measured on 4,745 messages from five domains never seen in training or validation.

model params held-out top-1 vs teacher ask recall false ask calibration error (ECE)
base 151M 0.765 0.752 0.024 0.030
large 399M 0.796 0.822 0.021 0.072

The teacher's own self-agreement on the same messages is 0.883.

License

Apache-2.0. See NOTICE.

Metadata

Release files for sb-decision 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sb-decision 0.2.1
File Size Uploaded Provenance
sb_decision-0.2.1.tar.gz 15.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sb-decision 0.2.1
File Interpreter ABI Platform
sb_decision-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.3 kB

Release files / sb_decision-0.2.1.tar.gz

Download URL sb_decision-0.2.1.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c8a4112ebbb5a9cfcbd4ceb7d6f75257dc34e6d7849caf4faca0a5945c848704
BLAKE2b-256 checksum
How to use checksums
ffad197b6e5a1d7a23cfd941d9daf686c21a48f894b2c4716cd0da8d40d8207c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / sb_decision-0.2.1-py3-none-any.whl

Download URL sb_decision-0.2.1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4d8418417c4624a7c62ab209fae3761ac2ec077463a18e7da4d24839d55ffc1
BLAKE2b-256 checksum
How to use checksums
9a960e19bdabbf18f15cb412046d1d4fe72e65c71f7dfef3cf196b1343230fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Security for sb-decision 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page