A short rider voice note goes in; situation, next action, language, and a two-level safety alert (SOS or “Are you safe?”) come out.
This repository holds the trained classifier head (and its calibration and threshold files) — an adapter-style head on a frozen audio backbone, not a fine-tune of the backbone itself. The model is inspired by last-mile delivery apps and is not affiliated with Zomato or Swiggy. All training speech is synthetic. No real rider recordings were used.
The model suggests; a person confirms. It is not a production safety system.
On a held-out synthetic test set (37 scripts / 740 clips): action accuracy 72.6, situation 82.3, language 85.7, false SOS on normal clips 0.7%.
Code: Data-Scientist-Sahil/helmet-mind · the Gradio dispatch console lives in space/. A private Hugging Face Space is intended at sahildl/rider-voice-decisions once the account can host Gradio Spaces (Pro is required for Gradio on cpu-basic).
One forward pass over a short voice note — English, Hindi, or Hinglish, including street noise — returns calibrated probabilities for four questions, with no transcription step:
| Question | What it answers |
|---|---|
| Situation | Why the rider is calling in (unreachable customer, wrong address, accident, …) |
| Next action | Wait, call the customer, talk to support, or SOS |
| Language | Hinglish, Hindi, or English |
| Alert | A two-level safety flag: SOS, or an amber “Are you safe?” check-in |
This milestone (M1, door-step wedge) scores a scoped label set, as stored in config.json: seven situations and four actions. Out-of-scope options in the broader product taxonomy are masked.
google/gemma-4-E4B-it fine-tune). The clip and a fixed text request (one state + four questions) go in once; post-norm hidden states (width 2,560) are pooled for every question. Features for this run were extracted in fp16 (mem_cap 256, twice_max 3,000, Decision Index spec 0.4.0).hidden=2560, d=768, layers=4, heads=12 (also stored as metadata in head.safetensors).sos_tau; a check-in if the combined safety score — max(p(safety), p(accident or harassment), p(SOS)) — is at or above checkin_tau.Synthetic multilingual TTS mixed with real MS-SNSD environmental noise (traffic, horns, rain, crowd, plus a phone-mic / codec chain). 285 scripts, 2,512 clips, split by script (never by clip) into 195 / 53 / 37 train / validation / test scripts. Train+validation in this run: 1,560 + 212 = 1,772 clips; the held-out test set is 740 clips. Voices and noise variants of a test script never appear in training.
No real rider data.
Numbers below are from the held-out round-3 test set (37 scripts / 740 clips), unless noted. Intervals resample scripts, not clips. Phrase these as results in this test set.
| Head | Test result |
|---|---|
| Situation | 82.3 |
| Next action | 72.6 [script-level CI 63.1–81.1] |
| Language | 85.7 |
Next-action accuracy is +19.1 points over the released head used zero-shot on the same clips. A 20/20 backbone parity check passed before this head was trained.
| Action | Recall |
|---|---|
| Wait | 80.0 |
| Call the customer | 44.3 |
| Contact support | 73.9 |
| SOS | 85.5 |
| Metric | Test result |
|---|---|
| Safety recall | 100% (15 / 15 safety scripts) |
| Safety AUROC | 0.958 |
| False SOS on normal notes | 0.7% |
| Any alert on true SOS | 100% |
| Check-ins on normal notes | 33.6% |
| Condition | Action accuracy |
|---|---|
| Clean | 83.8 |
| SNR 20 dB | 77.0 |
| SNR 10 dB | 73.0 |
| SNR 5 dB | 68.2 |
| SNR 0 dB | 60.8 |
| English | 69.5 |
| Hindi | 76.4 |
| Hinglish | 71.9 |
fp16 on a T4, batch 1, after warmup: p50 604 ms, p95 614 ms.
For comparison with the previous training round: action 75.0, situation 87.4, safety 9/9 scripts caught, false SOS 0.7%.
thresholds.json and calibration.json in this repo were fit on out-of-fold train+validation clips (source: oof; 1,772 clips). They confirm the shipped thresholds (sos_tau 0.42, checkin_tau 0.04, safety_tau 0.02) and report OOF operating-point rates that should not be mixed with the test figures above:
| OOF two-level rate | Value |
|---|---|
| False SOS on normal | 4.94% (1,012 normal clips) |
| Check-ins on normal | 50.5% |
| Any-alert coverage on all safety clips | 99.3% (422 clips) |
| SOS recall on hard safety clips | 74.2% (356 clips) |
Binary safety recall at safety_tau 0.02 |
99.43% (73 / 74 scripts fully caught) |
The raw safety flag at 0.02 is deliberately aggressive (OOF false-alarm rate 70.4%), which is why the two-level SOS / check-in rule exists.
Shipped operating point (also in thresholds.json):
| Parameter | Value |
|---|---|
sos_tau |
0.42 |
checkin_tau |
0.04 |
safety_tau |
0.02 |
call_customer is weak, especially on wrong-address notes (recall 44.3%). Next-action accuracy is the weakest of the four heads and drops further in heavy noise (60.8 at 0 dB SNR).| File | Size | Role |
|---|---|---|
head.safetensors |
166.2 MB | Same trained head weights in safetensors form (the state tensors; cfg is in file metadata) |
head.pt |
166.2 MB | Same weights in the original {"cfg", "state"} PyTorch checkpoint. Keep this file: the nirnaya-inference engine and the GitHub demo load head.pt |
config.json |
1.7 KB | Training run config, label scope, feature metadata |
t_entropy.json |
724 B | Per-question entropy temperature fit |
thresholds.json |
2.0 KB | Shipped sos_tau / checkin_tau / safety_tau, plus OOF fit diagnostics |
calibration.json |
3.1 KB | Calibration quality (NLL, ECE) and a copy of the OOF threshold record |
NOTICE |
1.4 KB | Attribution for Nirnaya Flash 1.0, nirnaya-inference, and other dependencies |
examples/ |
9 WAV clips | Short synthetic TTS demo notes (Hinglish / Hindi, with noise) used by the Kaggle live-demo notebook. These are not real rider recordings |
The weight tensors, without unpickling a .pt file:
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="sahildl/rider-voice-decisions-m1v3",
filename="head.safetensors",
)
state = load_file(path)
# cfg is also in the file metadata: {"hidden": 2560, "d": 768, "layers": 4, "heads": 12}
# To rebuild the checkpoint the original engine expects:
# ckpt = {"cfg": {"hidden": 2560, "d": 768, "layers": 4, "heads": 12}, "state": state}
To run the bundled engine (this still downloads head.pt, plus the frozen backbone and a checkout of nirnaya-inference):
from pathlib import Path
from huggingface_hub import hf_hub_download
run = Path("run/m1v3")
run.mkdir(parents=True, exist_ok=True)
for name in [
"head.pt",
"config.json",
"t_entropy.json",
"thresholds.json",
"calibration.json",
]:
hf_hub_download(
repo_id="sahildl/rider-voice-decisions-m1v3",
filename=name,
local_dir=run,
)
# from https://github.com/Data-Scientist-Sahil/helmet-mind
from src.engine import RiderVoiceEngine
engine = RiderVoiceEngine(
"Darkrider/nirnaya-flash-1.0", # or a local snapshot of the backbone
str(run),
precision="fp16", # use fp32 on CPU
)
out = engine.decide("clip.wav")
print(
out["answers"]["situation"]["choice"],
out["answers"]["action"]["choice"],
out["answers"]["language"]["choice"],
out["card"]["kind"],
out["latency_ms"],
)
A Gradio dispatch console that does this at startup lives in space/. The intended Space URL is sahildl/rider-voice-decisions (not hosted yet).
This head is built on:
Darkrider/nirnaya-flash-1.0), Copyright 2026 Anshik Bansal, Apache License 2.0. It is a modified version of Gemma 4 E4B by Google, also Apache-2.0. "Nirnaya" is a name of Anshik Bansal and is used here only to describe where this work came from.See NOTICE for the full attribution, including the Decision Index request format (evaluation style only; no suite data is used) and the synthetic-speech / noise sources.
The files in this repository and the training / demo code are under the Apache License 2.0, matching helmet-mind. The frozen backbone is a separate model with its own card and terms.
head.pt 166 MBhead.safetensors 166 MBDarkrider/nirnaya-flash-1.0