WaterSheep

Calibrated decisions for any text. Runs entirely in your browser.

Usage

pip install transformers torch
from transformers import pipeline

ws = pipeline(model="samratduttaofficial/WaterSheep", trust_remote_code=True)
ws("I was charged twice.", question="Which team should handle this?",
   options=["billing", "shipping", "support"])

With the Python package, decide returns the answer, its confidence and a probability for every option. ask answers several questions about one text:

pip install git+https://github.com/SamratDuttaOfficial/WaterSheep
from watersheep import WaterSheep

ws = WaterSheep.load("samratduttaofficial/WaterSheep")
ws.ask({
    "state": {"customer": "Priya (premium plan)",
              "message": "Charged twice for order #4411 and the package is 12 days late."},
    "questions": {
        "escalate": {"type": "noul", "instructions": "Should a human agent take over now?"},
        "team": {"type": "choice", "instructions": "Which team should handle this?",
                 "criteria": {"billing": "payments, refunds", "shipping": "delivery problems"}},
        "frustration": {"type": "score", "instructions": "How frustrated is the customer?",
                        "criteria": ["calm", "annoyed", "frustrated", "furious"]},
        "issues": {"type": "multi", "instructions": "Which issues are reported?",
                   "criteria": ["double charge", "late delivery", "damaged item"]},
    },
})
TypeQuestionAnswer
noulyes/noprobability of yes
choicesingle choicethe option, with a probability for each
scorerating scalethe expected level, with a probability for each
multimulti-labelevery option above the threshold, with probabilities

Using Jev?

WaterSheep is an open-source alternative to Jev. Run it as a local server:

pip install git+https://github.com/SamratDuttaOfficial/WaterSheep
watersheep --model samratduttaofficial/WaterSheep --serve

It answers Jev's POST /v1/systemone requests on your machine, and TypeSafe's Python SDK works against it without code changes:

export TYPESAFE_BASE_URL=http://127.0.0.1:8766

Any API key value works locally. Multi-label questions ("type": "multi") work too, as plain JSON. WaterSheep is independent and not affiliated with TypeSafe AI.

Evaluation

EvaluationAccuracyECE
In-distribution test split77.8%0.026
Held-out datasets, not seen in training61.2%0.043

ECE is the expected calibration error (lower is better).

Reliability diagrams: accuracy against confidence for each question type
Accuracy against confidence for each question type, before (raw) and after calibration.
Error against coverage on the test split and the held-out datasets
Error among the questions answered when the model only answers above a confidence threshold. The dots mark thresholds of 0.70, 0.90 and 0.97.

Benchmarks

BenchmarkSuiteQuestionsAccuracyECEIn training data
goemotionssentiment2,00022.4%0.023other split
hatechecksafety2,00075.1%0.139no
legal_abercrombielegal9521.1%0.316no
legal_contract_nli_confidentiality_of_agreementlegal8269.5%0.177no
legal_corporate_lobbyinglegal49068.4%0.216no
legal_cuad_audit_rightslegal1,21686.3%0.041no
legal_definition_classificationlegal1,33756.9%0.279no
legal_function_of_decision_sectionlegal36724.3%0.245no
legal_hearsaylegal9456.4%0.307no
legal_overrulinglegal2,00062.5%0.151no
legal_personal_jurisdictionlegal5050.0%0.160no
legal_privacy_policy_qalegal2,00058.9%0.274no
legal_proalegal9551.6%0.379no
legal_ucc_v_common_lawlegal9462.8%0.171no
prompt_injectionsafety11691.4%0.079other split
xstestsafety45073.6%0.140no

Training

Training loss, learning rate and validation accuracy by question type
Training loss and learning rate (left); validation accuracy by question type (right).
Share of synthetic examples kept after verification
Share of synthetic examples kept after verification, by question type (left) and by family (right).

Limitations

License and citation

Apache 2.0 (LICENSE). Attributions: NOTICE.

@misc{watersheep,
  author = {Samrat Dutta},
  title  = {WaterSheep: calibrated decisions for any text},
  year   = {2026},
  url    = {https://huggingface.co/samratduttaofficial/WaterSheep}
}
Read the preprint Buy me a coffee