Text Generation
Transformers
Safetensors
gemma4
image-text-to-text
routing
intent-classification
function-calling
information-extraction
nli
voice-agents
indic
code-mixed
conversational
Instructions to use RinggAI/ringg-router-e2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RinggAI/ringg-router-e2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RinggAI/ringg-router-e2b") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("RinggAI/ringg-router-e2b") model = AutoModelForMultimodalLM.from_pretrained("RinggAI/ringg-router-e2b", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RinggAI/ringg-router-e2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RinggAI/ringg-router-e2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RinggAI/ringg-router-e2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RinggAI/ringg-router-e2b
- SGLang
How to use RinggAI/ringg-router-e2b 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 "RinggAI/ringg-router-e2b" \ --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": "RinggAI/ringg-router-e2b", "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 "RinggAI/ringg-router-e2b" \ --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": "RinggAI/ringg-router-e2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RinggAI/ringg-router-e2b with Docker Model Runner:
docker model run hf.co/RinggAI/ringg-router-e2b
Card: training recipe and considerations
Browse files
README.md
CHANGED
|
@@ -238,12 +238,97 @@ GPU. Generating the rationale adds roughly 20–25 tokens.
|
|
| 238 |
- As with any language model, decisions can be wrong; keep a fallback for high-stakes actions (payments, account
|
| 239 |
changes, cancellations).
|
| 240 |
|
| 241 |
-
## Training
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
## License
|
| 249 |
|
|
|
|
| 238 |
- As with any language model, decisions can be wrong; keep a fallback for high-stakes actions (payments, account
|
| 239 |
changes, cancellations).
|
| 240 |
|
| 241 |
+
## Training
|
| 242 |
+
|
| 243 |
+
### Data
|
| 244 |
+
|
| 245 |
+
A multitask mix in one shared format (system prompt per task, JSON input, JSON answer):
|
| 246 |
+
|
| 247 |
+
| task family | public sources |
|
| 248 |
+
|---|---|
|
| 249 |
+
| Intent routing | MASSIVE (multilingual), Banking77, CLINC-OOS, Bitext customer support, Hindi prompt routing, Hinglish-TOP |
|
| 250 |
+
| Typed decisions (choice / yes-no-unknown / score) | Open-Jev, jev-bench, jev-distill, tasksource-jev, typed-decisions-synth |
|
| 251 |
+
| NLI and yes/no, English + 10 Indic languages | IndicXNLI, BoolQ-Indic, BoolQ, MultiNLI |
|
| 252 |
+
| Explanations | e-SNLI, ECQA |
|
| 253 |
+
| Entity extraction | Naamapadam, HiNER, MultiCoNER v2 |
|
| 254 |
+
| Slots, function selection and arguments | SGD, MASSIVE-Agents, BFCL-Hi, ToolACE, Hermes JSON mode, xLAM irrelevance, X-RiSAWOZ |
|
| 255 |
+
| Extractive QA | IndicQA |
|
| 256 |
+
|
| 257 |
+
On top of these, Ringg's own conversational routing data (not released) teaches the voice-agent setting: transcribed
|
| 258 |
+
multilingual calls, multi-step flows, and when to stay versus move. Its rationales are short English sentences.
|
| 259 |
+
|
| 260 |
+
About half of the public rows are in Indian languages or code-mixed text. Telugu, Kannada and Gujarati are
|
| 261 |
+
oversampled because they are underrepresented in the sources. Every row passed automatic format checks (the gold id
|
| 262 |
+
is among the options, ids are unique, JSON is valid), and a sample of every source was reviewed for label quality.
|
| 263 |
+
Sources whose labels did not hold up in review were left out.
|
| 264 |
+
|
| 265 |
+
### Recipe
|
| 266 |
+
|
| 267 |
+
- **Base:** `google/gemma-4-E2B-it`, text only. Parameter-efficient fine-tuning (LoRA on the language-model attention
|
| 268 |
+
and MLP projections), then merged into the base weights. The vision and audio towers are untouched.
|
| 269 |
+
- **Objective:** next-token loss on the answer only. The option id is weighted up, so the decision is learned first;
|
| 270 |
+
rationale tokens are weighted down.
|
| 271 |
+
- **Order invariance:** options are reshuffled every epoch, and ids are sometimes replaced by opaque codes, so the
|
| 272 |
+
model reads the descriptions instead of trusting positions or id names. Some examples appear twice in an epoch with
|
| 273 |
+
different option orders and the same answer.
|
| 274 |
+
- **Robustness:** a "none of these" option is added to some public choice tasks, and fields to extract are reshuffled.
|
| 275 |
+
- **Length:** prompts up to about 2.5k tokens. Long conversations keep their latest turns.
|
| 276 |
+
- **Selection:** the checkpoint was chosen on routing accuracy for held-out agents (conversation flows never seen in
|
| 277 |
+
training), not on the public benchmarks above. Training stopped once that score stopped improving.
|
| 278 |
+
- **Precision:** bf16 throughout, on a single GPU.
|
| 279 |
+
|
| 280 |
+
Evaluation rows in this card are disjoint from training rows. Belebele and the Kev suites were never used in training.
|
| 281 |
+
|
| 282 |
+
## Considerations
|
| 283 |
+
|
| 284 |
+
### Designing options
|
| 285 |
+
|
| 286 |
+
- **Write options as conditions.** "User reports a failed or pending payment" works; "intent = payments" does not.
|
| 287 |
+
The model never sees your agent's system prompt, so any rule it must follow has to be in the option text.
|
| 288 |
+
- **Put the call stage in the text.** For example: "user has no further questions after being helped" or "user agreed
|
| 289 |
+
to talk to a live specialist". Wrap-up and hand-off moves are the ones the model misses when the option is vague.
|
| 290 |
+
- **Include an explicit stay option**, and a "none of these" option for open-ended menus.
|
| 291 |
+
- **Use unique, short ids.** Up to 24 options per decision were seen in training.
|
| 292 |
+
- **Feed data the model cannot hear as text** in the state or option (e.g. "account status: not registered"). Do not
|
| 293 |
+
expect the model to infer hidden facts.
|
| 294 |
+
|
| 295 |
+
### Deployment
|
| 296 |
+
|
| 297 |
+
- **Precision:** use bfloat16. float16 corrupts Gemma-4 outputs.
|
| 298 |
+
- **Attention kernels:** Gemma-4's 512-wide attention heads need a GPU with enough shared memory. Ada/Hopper (L4,
|
| 299 |
+
L40S, H100) work with vLLM's Triton backend; T4 does not (use transformers in bf16 there, which is slow).
|
| 300 |
+
- **Multimodal memory:** with vLLM, pass `limit_mm_per_prompt={"image": 0, "video": 0, "audio": 0}` to skip
|
| 301 |
+
reserving memory for inputs you don't send.
|
| 302 |
+
- **Context:** the model was trained on the most recent turns of a conversation (about five lines). Longer histories
|
| 303 |
+
add latency more than accuracy.
|
| 304 |
+
- **Constrained decoding:** to guarantee a valid id, constrain the branch to your option ids (e.g. vLLM structured
|
| 305 |
+
outputs with a `choice` list), or map the decoded text back to the nearest id.
|
| 306 |
+
- **Calibration:** the first-token log-probabilities of the option ids give a usable ranking. Calibrate a stay/move
|
| 307 |
+
threshold on your own traffic before you act on low-margin decisions.
|
| 308 |
+
|
| 309 |
+
### Safety and responsible use
|
| 310 |
+
|
| 311 |
+
- **Prompt injection:** the model is trained to treat the `state` as data, not instructions, but it is not a
|
| 312 |
+
security boundary. Keep permission checks and irreversible actions (payments, cancellations, account changes)
|
| 313 |
+
behind your own logic and confirmations.
|
| 314 |
+
- **Imperfect output:** routing and extraction mistakes happen, and more often on noisy transcripts, rare languages
|
| 315 |
+
and long option lists. Log the decisions and keep a human or LLM fallback for ambiguous cases.
|
| 316 |
+
- **Uneven language coverage:** English, Hindi and Hinglish are strongest. Some Indic languages have less training
|
| 317 |
+
data. Evaluate on your own languages and domains before production.
|
| 318 |
+
- **Personal data:** extraction pulls personal details (names, numbers, addresses) out of conversations when asked.
|
| 319 |
+
Handle outputs under your data-protection obligations. Do not use the model to profile people or to make decisions
|
| 320 |
+
with legal or similarly significant effects without human review.
|
| 321 |
+
- **Rationales** are short explanations of the chosen option, useful for logs and debugging. They are not guaranteed
|
| 322 |
+
to reflect the model's internal reasoning.
|
| 323 |
+
|
| 324 |
+
### Evaluation caveats
|
| 325 |
+
|
| 326 |
+
- **Small samples:** each source contributes up to 150 held-out rows (60 for validation), so single-dataset numbers
|
| 327 |
+
carry a few points of noise. Task-family averages are steadier.
|
| 328 |
+
- **Extraction scoring** uses exact match after normalisation, so a correct value in different wording counts as
|
| 329 |
+
wrong. This penalises all three models equally.
|
| 330 |
+
- **Same prompts for all three models:** the base models are scored zero-shot on this card's prompt format, and a
|
| 331 |
+
different prompt could raise their scores.
|
| 332 |
|
| 333 |
## License
|
| 334 |
|