Instructions to use sriram1983007/SRA-RiskGate-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sriram1983007/SRA-RiskGate-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sriram1983007/SRA-RiskGate-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sriram1983007/SRA-RiskGate-4B") model = AutoModelForCausalLM.from_pretrained("sriram1983007/SRA-RiskGate-4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sriram1983007/SRA-RiskGate-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sriram1983007/SRA-RiskGate-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sriram1983007/SRA-RiskGate-4B
- SGLang
How to use sriram1983007/SRA-RiskGate-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sriram1983007/SRA-RiskGate-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sriram1983007/SRA-RiskGate-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sriram1983007/SRA-RiskGate-4B with Docker Model Runner:
docker model run hf.co/sriram1983007/SRA-RiskGate-4B
SRA-RiskGate-4B
A small model for both ends of a stablecoin payment's life:
- Risk gate: give it a payment (an x402 request, an EIP-3009 authorization, or an ERC-20 transfer), your
policy, and your verification tool results; it returns
approve/hold/rejectwith reasons. - Dispute adjudication: give it a dispute with signed evidence and escrow/ledger state; it decides
what can actually happen across the settlement-finality line (void before release, arbiter refund from
escrow or from a merchant bond, voluntary refund, deny, escalate, or no enforceable remedy), with exact
amount, destination and an idempotency key for any refund. It never proposes reversing a final payment. Fine-tuned from
Qwen/Qwen3-4B-Instruct-2507on sriram1983007/sra-stablecoin-risk-bench.
🛡 SRA-RiskGate-4B
SRA-RiskGate-4B is an autonomous risk scoring, compliance verification, and dispute resolution model fine-tuned on top of Qwen/Qwen3-4B-Instruct-2507.
- Overall SRA Score:
0.9159 - Risk Decision Accuracy:
99.49% - Unsafe Approval Rate:
0.47%(Threshold: $\le 2.0%$) - Dispute Impossible Remedy Rate:
0.19%(Threshold: $\le 1.0%$) - JSON Schema Validity:
100.0%
Results on the SRA benchmark (test split, 2,000 payments)
| model | sra_score | risk gate score | unsafe approvals | dispute score | impossible remedies | wrongful refunds | refund detail acc. |
|---|---|---|---|---|---|---|---|
| Qwen/Qwen3-4B-Instruct-2507 (untrained) | 0.421 | 0.443 | 0.345 | 0.400 | 0.000 | 0.000 | 0.000 |
| SRA-RiskGate-4B | 0.916 | 0.995 | 0.005 | 0.837 | 0.002 | 0.022 | 0.660 |
unsafe approvals: payments that should have been held or rejected but were approved.
impossible remedies: on final payments, reversals, escrow mechanisms, or forced refunds with no usable bond.
wrongful refunds: refunds granted where the correct outcome was not a refund.
Injection prompts in the test split use phrasings never seen in training.
How to use
import json
from transformers import pipeline
gate = pipeline("text-generation", model="sriram1983007/SRA-RiskGate-4B", device_map="auto")
# see sra/prompt.py in the source repo
messages = build_messages(now, policy, payload, tool_results) # risk gate
# messages = build_dispute_messages(now, policy, case, tool_results) # dispute
out = gate(messages, max_new_tokens=512, do_sample=False)[0]["generated_text"][-1]["content"]
verdict = json.loads(out)
The model expects tool results (signature verification, attestation checks, sanctions screening) in the prompt. It does not do cryptography and does not know any sanctions list. Always run live screening through a tool.
Intended use and limits
- A triage and explanation layer in front of human or rule-based controls for agent payments, stablecoin operations and dispute desks. It is not a compliance program, not an arbiter, and not legal advice. Dispute recommendations should be reviewed by a person before funds move.
- Trained on synthetic data with templated explanations; expect distribution shift on real payloads, and validate on your own traffic before relying on it.
- Keep a deterministic backstop: sanctions hits and invalid signatures should be rejected by code, whatever the model says.
Training
LoRA (r=32, alpha=64, all projections, 4-bit NF4 base during training), 1 epoch, lr 1e-4 cosine, effective batch 16,
max length 3072, loss on the verdict only. Trained with TRL SFTTrainer.
- Downloads last month
- -