Text Generation
Transformers
Safetensors
English
qwen3
stablecoin
payments
compliance
x402
eip-3009
eip-712
disputes
refunds
agents
agentkit
trl
web3
usdc
fraud-detection
financial-risk
qwen
mcp
ai-agents
prompt-injection
agentic-payments
payment-security
risk-assessment
ofac
conversational
Eval Results (legacy)
Eval Results
text-generation-inference
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)# pip install -U transformers accelerate # 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=256) 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
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,7 +7,6 @@ language:
|
|
| 7 |
- en
|
| 8 |
pipeline_tag: text-generation
|
| 9 |
library_name: transformers
|
| 10 |
-
|
| 11 |
tags:
|
| 12 |
- stablecoin
|
| 13 |
- payments
|
|
@@ -21,7 +20,6 @@ tags:
|
|
| 21 |
- web3
|
| 22 |
- usdc
|
| 23 |
- eip-3009
|
| 24 |
-
- compliance
|
| 25 |
- fraud-detection
|
| 26 |
- financial-risk
|
| 27 |
- qwen
|
|
@@ -29,80 +27,24 @@ tags:
|
|
| 29 |
- text-generation
|
| 30 |
---
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
GGUF Repo: huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF
|
| 35 |
-
|
| 36 |
-
### 🦙 Run Instantly with Ollama
|
| 37 |
-
|
| 38 |
-
```bash
|
| 39 |
-
ollama run sriram1983007/sra-riskgate
|
| 40 |
-
|
| 41 |
-
# SRA-RiskGate-4B
|
| 42 |
-
|
| 43 |
-
A small model for both ends of a stablecoin payment's life:
|
| 44 |
-
|
| 45 |
-
- **Risk gate:** give it a payment (an x402 request, an EIP-3009 authorization, or an ERC-20 transfer), your
|
| 46 |
-
policy, and your verification tool results; it returns `approve` / `hold` / `reject` with reasons.
|
| 47 |
-
- **Dispute adjudication:** give it a dispute with signed evidence and escrow/ledger state; it decides
|
| 48 |
-
what can actually happen across the settlement-finality line (void before release, arbiter refund from
|
| 49 |
-
escrow or from a merchant bond, voluntary refund, deny, escalate, or no enforceable remedy), with exact
|
| 50 |
-
amount, destination and an idempotency key for any refund. It never proposes reversing a final payment. Fine-tuned from `Qwen/Qwen3-4B-Instruct-2507` on [sriram1983007/sra-stablecoin-risk-bench](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench).
|
| 51 |
-
|
| 52 |
-
# 🛡 SRA-RiskGate-4B
|
| 53 |
|
| 54 |
[](https://sriram1983007-sra-riskgate-demo.static.hf.space/index.html)
|
| 55 |
[](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
* **Overall SRA Score:** `0.9159`
|
| 60 |
-
* **Risk Decision Accuracy:** `99.49%`
|
| 61 |
-
* **Unsafe Approval Rate:** `0.47%` (Threshold: $\le 2.0\%$)
|
| 62 |
-
* **Dispute Impossible Remedy Rate:** `0.19%` (Threshold: $\le 1.0\%$)
|
| 63 |
-
* **JSON Schema Validity:** `100.0%`
|
| 64 |
-
|
| 65 |
-
## Results on the SRA benchmark (test split, 2,000 payments)
|
| 66 |
-
|
| 67 |
-
| model | sra_score | risk gate score | unsafe approvals | dispute score | impossible remedies | wrongful refunds | refund detail acc. |
|
| 68 |
-
|---|---|---|---|---|---|---|---|
|
| 69 |
-
| Qwen/Qwen3-4B-Instruct-2507 (untrained) | 0.421 | 0.443 | 0.345 | 0.400 | 0.000 | 0.000 | 0.000 |
|
| 70 |
-
| **SRA-RiskGate-4B** | 0.916 | 0.995 | 0.005 | 0.837 | 0.002 | 0.022 | 0.660 |
|
| 71 |
-
|
| 72 |
-
`unsafe approvals`: payments that should have been held or rejected but were approved.
|
| 73 |
-
`impossible remedies`: on final payments, reversals, escrow mechanisms, or forced refunds with no usable bond.
|
| 74 |
-
`wrongful refunds`: refunds granted where the correct outcome was not a refund.
|
| 75 |
-
Injection prompts in the test split use phrasings never seen in training.
|
| 76 |
-
|
| 77 |
-
## How to use
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
gate = pipeline("text-generation", model="sriram1983007/SRA-RiskGate-4B", device_map="auto")
|
| 83 |
|
| 84 |
-
|
| 85 |
-
messages = build_messages(now, policy, payload, tool_results) # risk gate
|
| 86 |
-
# messages = build_dispute_messages(now, policy, case, tool_results) # dispute
|
| 87 |
-
out = gate(messages, max_new_tokens=512, do_sample=False)[0]["generated_text"][-1]["content"]
|
| 88 |
-
verdict = json.loads(out)
|
| 89 |
-
```
|
| 90 |
-
|
| 91 |
-
The model expects **tool results** (signature verification, attestation checks, sanctions screening) in the
|
| 92 |
-
prompt. It does not do cryptography and does not know any sanctions list. Always run live screening
|
| 93 |
-
through a tool.
|
| 94 |
-
|
| 95 |
-
## Intended use and limits
|
| 96 |
|
| 97 |
-
|
| 98 |
-
stablecoin operations and dispute desks. It is not a compliance program, not an arbiter, and not legal
|
| 99 |
-
advice. Dispute recommendations should be reviewed by a person before funds move.
|
| 100 |
-
- Trained on synthetic data with templated explanations; expect distribution shift on real payloads,
|
| 101 |
-
and validate on your own traffic before relying on it.
|
| 102 |
-
- Keep a deterministic backstop: sanctions hits and invalid signatures should be rejected by code,
|
| 103 |
-
whatever the model says.
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
|
|
|
| 7 |
- en
|
| 8 |
pipeline_tag: text-generation
|
| 9 |
library_name: transformers
|
|
|
|
| 10 |
tags:
|
| 11 |
- stablecoin
|
| 12 |
- payments
|
|
|
|
| 20 |
- web3
|
| 21 |
- usdc
|
| 22 |
- eip-3009
|
|
|
|
| 23 |
- fraud-detection
|
| 24 |
- financial-risk
|
| 25 |
- qwen
|
|
|
|
| 27 |
- text-generation
|
| 28 |
---
|
| 29 |
|
| 30 |
+
# 🛡️️ SRA-RiskGate-4B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
[](https://sriram1983007-sra-riskgate-demo.static.hf.space/index.html)
|
| 33 |
[](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
|
| 34 |
+
[](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
|
| 35 |
+
[](https://ollama.com/sriram1983007/sra-riskgate)
|
| 36 |
|
| 37 |
+
An autonomous risk scoring, compliance verification, and dispute adjudication model fine-tuned from `Qwen/Qwen3-4B-Instruct-2507` on [sra-stablecoin-risk-bench](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
A specialized 4B model designed for both ends of a stablecoin payment lifecycle:
|
| 40 |
+
- **Risk Gate:** Evaluates incoming payment operations (x402 requests, EIP-3009 authorizations, or raw ERC-20 transfers) against policy constraints and verification tool results to return deterministic `approve`, `hold`, or `reject` verdicts with structured reasoning.
|
| 41 |
+
- **Dispute Adjudication:** Ingests dispute evidence and escrow/ledger state to determine legally and technically viable remedies across settlement-finality boundaries (void before release, arbiter escrow refund, merchant bond claim, voluntary refund, deny, or escalate) complete with exact amount, destination address, and idempotency keys. It strictly avoids proposing impossible reversals on final ledger state.
|
|
|
|
| 42 |
|
| 43 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
### 🦙 Quickstart with Ollama
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
Run locally via the official Ollama registry:
|
| 48 |
|
| 49 |
+
```bash
|
| 50 |
+
ollama run sriram1983007/sra-riskgate
|