Skip to content

Releases

0.5.1

Choose a tag to compare

@sshah03 sshah03 released this 03 Nov 08:44
  • Exports no longer contain a __pycache__ folder. The check that compares an export with load() used to leave Python's bytecode cache next to the runtime.
  • Price quotes count prompt caching. label(dry_run=True) and check_teachers(dry_run=True), for classifiers and panels, now price a long system prompt on Anthropic models as a cached read after the first call, which is what those calls are billed. An optimized prompt was quoted several times over before. estimate_calls() takes cached_prompt=True for the same. Spending caps (budget_usd=, autotune()) keep the full price, since the first calls of a run can miss the cache.

Backward compatible: nothing existing changed apart from the dry-run quotes, which are now closer to what's billed.

0.5.0

Choose a tag to compare

@sshah03 sshah03 released this 03 Nov 07:30
  • Run a model without shrewd. shrewd.export(dir, out_dir) writes the shipped model into a folder you can copy into any project, checked against load() before it returns.
    • tf-idf and embedding models (classifiers and panels) come with a small runtime: shrewd_model.py needs only numpy, and shrewd_model.js needs nothing (Node, Deno, Bun or a browser). The calls match load()'s: predict, predict_proba and decide. precision="float16" stores an embedding model at about half size.
    • Encoder and SetFit classifiers export as ONNX with the tokenizer.json they expect (format="onnx", pip install "shrewd[onnx]"). Encoders also export as a Hugging Face folder (format="hf").
    • A routing threshold travels as metadata, and confident(texts) says which texts clear it. The teacher fallback stays in shrewd.
    • Not yet: panels built on an encoder, and panels with a zero-shot stack.
  • Serving notes in the README: load once, pass batches, and a minimal FastAPI endpoint.

Backward compatible: nothing existing changed. export and the [onnx] extra are new.

0.4.0

Choose a tag to compare

@sshah03 sshah03 released this 02 Nov 18:44
  • Several teachers, weighted by how well they match you. Give Decisions a list of teachers and each answers every document, your dev split included; their answers are combined per question by how often each matched your labels. Classifiers get the same with label(pool, combine="weighted"). For panels, judge(pool, escalate=0.05) asks the first teacher everywhere and the others only where it might be overruled.
  • Check the teachers first. check_teachers() has each teacher answer only your dev split, so you see how each one matches you before paying for the pool.
  • Routing for classifiers. distill(route_budget=0.02) sets a confidence threshold with the same guarantee panels already had, and load(dir).predict(texts, fallback=proj.ask) sends the rest to the teacher. shrewd.route.curve() and rebudget() change the limit later without retraining.
  • Review and editing in code. review() and unreview() record or take back your answers without editing needs_review.csv. add_examples(), fix_example() and remove_examples() change your examples without re-splitting. Labels and questions can be changed, merged or removed in place.
  • Smaller things. prune(dir) strips a shipped project down to what load() needs. checkpoint_dir= lets an encoder fine-tune resume after an interruption. Decisions.compare() ranks featurizations on dev. A score answer keyed by its level name ("low") is now read instead of dropped. model2vec is pinned below 0.10, which can't load the pre-built embed panels.

Backward compatible: existing calls, defaults, saved models and answers are unchanged, and models saved by 0.4.0 load in 0.3.1.

0.3.1

Choose a tag to compare

@sshah03 sshah03 released this 29 Sep 20:48
  • Quickstart notebook. examples/quickstart.ipynb runs the whole workflow on the SMS demo data in a couple of minutes, with no API key: it uses the teacher's cached answers. Open it in Colab.
  • Clearer report. The routing section wraps to the terminal width, and the last column of the question table names its metric (acc, AUROC or MAE) instead of being headed acc for all of them.
  • README. A new opening, and the four prebuilt panels are now presented as demos, with the guardrail and email panels' known gaps written up.
  • Package metadata. The PyPI summary matches the new tagline, and PyPI now lists the supported Python versions (3.11–3.14).

No changes to answers, saved models or the API: everything behaves as in 0.3.0.

0.3.0

Choose a tag to compare

@sshah03 sshah03 released this 29 Sep 19:36
  • distill(route_budget=0.02) picks the confidence threshold for you, with a guarantee: with 95% probability, at most 2% of requests are answered locally and disagree with the teacher. The threshold is set on 30% of the judged pool held out of training, so it's checked on the model you actually save.
  • decide(texts, fallback=d.ask) sends the documents below the threshold to the teacher and returns the same answer format. route=True leaves them as None instead, and .local(texts) tells you which documents clear it.
  • The report now checks the locally answered test documents against your human labels.
  • examples/panels/routing_study.py reproduces the results on the four pre-built panels from the committed teacher answers. Reading the threshold off the curve broke the 2% budget in 4-7 of 10 draws; the guaranteed threshold held about as often as a 95% bound promises. Details in BENCHMARKS.

Everything is opt-in. Existing code and saved models behave exactly as in 0.2.0, and models saved by 0.3.0 still load in 0.2.0.

0.2.0

Choose a tag to compare

@sshah03 sshah03 released this 29 Sep 18:01
  • distill(calibration="auto-full") adds vector and matrix scaling to the calibration search for multi-option questions. On the pre-built panels it fit the teacher better on all six multi-option questions and moved them closer to gold where gold could be derived. It can change the predicted option (1-10% of documents there) and makes the top option's stated confidence less calibrated on some questions, so it's opt-in. "auto" is unchanged. Details in BENCHMARKS.md.
  • Reports split Brier into reliability, resolution and uncertainty, with a resol column and a warning when a multi-option head barely moves from the base rates.
  • Clearer load errors: a calibrator this version doesn't recognize now says which shrewd version saved it.
  • New examples: examples/panels/consistency.py, calibration_study.py, description_prior.py, plus build.py --calibration. fetch.py now says it needs huggingface_hub and pyarrow.

Panels saved with calibration="auto-full" need shrewd ≥ 0.2.0 to load.

Example decision panels, v1

Choose a tag to compare

@sshah03 sshah03 released this 22 Sep 18:50

Four compiled decision panels built by examples/panels/. They're examples of what shrewd's calibrated-decisions path produces, not models to adopt as is. The teacher was Fable 5.1, and each panel was scored on a separate holdout that played no part in training. Numbers and data sources are in the README under "Try a pre-built panel".

from shrewd import load
pii = load("https://github.com/sshah03/shrewd/releases/download/panels-v1/panel-pii.tar.gz")
pii.decide("my password is hunter2 and the PIN is 4471")
panel decides student size
messages SMS spam/scam triage fine-tuned encoder ~555 MB
email spam/phishing triage tf-idf ~26 MB
guardrail harmful / jailbreak / injection static embeddings ~28 MB
pii contact / identity / financial / credentials / device fine-tuned encoder ~555 MB

The guardrail panel's training data includes lmsys/toxic-chat, which is CC BY-NC 4.0, so that panel is for non-commercial use only.

Every panel can be rebuilt with no API calls from the committed teacher answers: python examples/panels/build.py <panel> --from-judged.