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();
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

Package and weights are public; no token is needed. SBDecision.load() raises SBAccessError with what to check if the weights cannot be reached. Questions and use cases: 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.2

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.2
File Size Uploaded Provenance
sb_decision-0.2.2.tar.gz 15.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 30.3 kB

Release files / sb_decision-0.2.2.tar.gz

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

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

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

Security for sb-decision 0.2.2

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