Instructions to use soapyyapps/tiny-aya-fire-circuit-kavach-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use soapyyapps/tiny-aya-fire-circuit-kavach-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="soapyyapps/tiny-aya-fire-circuit-kavach-merged") 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("soapyyapps/tiny-aya-fire-circuit-kavach-merged") model = AutoModelForCausalLM.from_pretrained("soapyyapps/tiny-aya-fire-circuit-kavach-merged", 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 soapyyapps/tiny-aya-fire-circuit-kavach-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "soapyyapps/tiny-aya-fire-circuit-kavach-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "soapyyapps/tiny-aya-fire-circuit-kavach-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/soapyyapps/tiny-aya-fire-circuit-kavach-merged
- SGLang
How to use soapyyapps/tiny-aya-fire-circuit-kavach-merged 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 "soapyyapps/tiny-aya-fire-circuit-kavach-merged" \ --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": "soapyyapps/tiny-aya-fire-circuit-kavach-merged", "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 "soapyyapps/tiny-aya-fire-circuit-kavach-merged" \ --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": "soapyyapps/tiny-aya-fire-circuit-kavach-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use soapyyapps/tiny-aya-fire-circuit-kavach-merged with Docker Model Runner:
docker model run hf.co/soapyyapps/tiny-aya-fire-circuit-kavach-merged
- CircuitKavach-Aya:
tiny-aya-fireSurgical C-ฮฮ Circuit Transplant (4/72 Submodules)
CircuitKavach-Aya: tiny-aya-fire Surgical C-ฮฮ Circuit Transplant (4/72 Submodules)
This repository contains the Surgical C-ฮฮ Circuit Transplant (checkpoint_3_surgical_ctheta) built on CohereLabs/tiny-aya-fire (Best for South Asian languages).
Using Stage 2 CircuitKIT EAP-IG followed by Stage 3 SafeTune C-ฮฮ ($\Theta_{\text{repaired}} = \Theta_{\text{base}} + \alpha \cdot (M \odot \Delta\Theta)$, best_alpha = 1.0), this checkpoint modifies only 4/72 projection blocks (2.55% of parameters: 99,090,432 / 3,886,098,432) while keeping 97.45% of weights (276/291 tensors) bit-for-bit identical (bit_identical_unmasked_keys: True, unmasked_violations: []) to the base model.
Stage 4 Evaluation Summary (CohereLabs/tiny-aya-fire, Held-Out 200 Pairs / 400 Prompts)
| Checkpoint | Modified Params | Frozen Params | Proj Blocks | Attack Refusal | Benign Over-Refusal | Benign Helpfulness | Selectivity Gap | RedTeam Attack Pass | Tokens/s |
|---|---|---|---|---|---|---|---|---|---|
checkpoint_1_base (Base) |
0.00% | 100.00% | 0/72 | 40.0% | 0.0% | 100.0% | +0.400 | 19.0% | 20.92 |
checkpoint_2_global_safetune (Global 72/72) |
100.00% (LoRA all-layer) | 0.00% | 72/72 | 99.0% | 0.0% | 100.0% | +0.990 | 47.6% | 20.23 |
checkpoint_3_surgical_ctheta (Surgical 4/72) |
2.55% | 97.45% | 4/72 | 94.5% | 0.0% | 100.0% | +0.945 | 38.1% | 20.79 |
Per-Language Evaluation Breakdown (eval_200_pairs.jsonl)
| Register | Base Attack Refusal | Global SafeTune (72/72) |
Surgical C-ฮฮ (4/72) |
Surgical Gain vs. Base | Benign Over-Refusal (Surgical) |
|---|---|---|---|---|---|
English (en, n=50) |
100.0% | 100.0% | 100.0% | +0.0 pp | 0.0% |
Hinglish (hi_en, n=50) |
48.0% | 100.0% | 100.0% | +52.0 pp | 0.0% |
Gujlish (gu_en, n=50) |
6.0% | 100.0% | 100.0% | +94.0 pp | 0.0% |
Kanglish (kn_en, n=50) |
6.0% | 96.0% | 78.0% | +72.0 pp | 0.0% |
Statistical Significance (AuditKIT Paired Bootstrap)
- Paired Bootstrap (
checkpoint_1_basevs.checkpoint_3_surgical_ctheta, n=200 harmful pairs): SurgicalC-ฮฮgains +54.5 pp (0.400->0.945,p = 0.000999, significant:True). - Paired Bootstrap (
checkpoint_2_global_safetunevs.checkpoint_3_surgical_ctheta, n=200 harmful pairs): delta =+0.045(0.990vs.0.945,p = 0.003996, significant:True). - Benign Over-Refusal (
n=200benign twins):0.0%(p = 1.0,significant: Falseโ zero collateral over-refusal).
Stage 2 Circuit Discovery & Stage 3 Surgical Audit (tiny-aya-fire)
- Model Revision:
73500c80fcb6c8bea3e830c21d5d2920249a0e1a - Calibration Refusal Pair:
sorry(id40449) vs.when(id1434), logit-diff gap =16.21 - Margin-Filtered Calibration Pairs:
99/100pairs (en=25,hi_en=25,gu_en=25,kn_en=24,english_only_circuit_warning=False) - Stage 2 Faithfulness (
CircuitKIT):ablation_score = 0.6549,patching_score = 0.0231,mean_jaccard = 0.9683,mean_spearman = 0.999828,n_stable_nodes = 61,kl_reduction_ratio = 0.0176 - Selected Top-4 Submodules (
4/72projection blocks =5.56%blocks,94.44%blocks frozen):model.layers.0.mlp(EAP-IGrank_score = 7.0312)model.layers.16.self_attn(EAP-IGrank_score = 2.4893)model.layers.21.self_attn(EAP-IGrank_score = 1.9445)model.layers.20.self_attn(EAP-IGrank_score = 1.7396)
- Stage 3 Surgical Audit (
SafeTuneC-ฮฮ,best_alpha = 1.0):99,090,432 / 3,886,098,432params modified (2.55% modified, 97.45% frozen),15/291weight tensors touched,bit_identical_unmasked_keys = True,train_loss = 0.7112
4-Model Universality Study (fire, global, water, earth)
Cross-Model Safety, Locality & Selectivity (4 Regional Variants)
All four CohereLabs/tiny-aya-* variants independently discovered the exact same top-4 safety submodules (layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn, Jaccard = 1.000, 72-block Spearman $\rho$ = 0.9217โ0.9704):
| Model | Base Attack Refusal | Global SafeTune (72/72, Over-Refusal) |
Surgical C-ฮฮ (4/72, Over-Refusal) |
Surgical Selectivity | Modified Params (Blocks) | Best $\alpha$ | kn_en Surgical Refusal |
|---|---|---|---|---|---|---|---|
CohereLabs/tiny-aya-fire (fire) |
40.0% | 99.0% (0.0%) | 94.5% (0.0%) | +0.945 | 2.55% (4/72) |
1.0 | 78.0% |
CohereLabs/tiny-aya-global (global) |
45.5% | 99.0% (0.0%) | 96.5% (0.0%) | +0.965 | 2.55% (4/72) |
1.0 | 86.0% |
CohereLabs/tiny-aya-water (water) |
53.5% | 100.0% (0.0%) | 96.5% (0.0%) | +0.965 | 2.55% (4/72) |
1.0 | 88.0% |
CohereLabs/tiny-aya-earth (earth) |
53.5% | 99.5% (0.0%) | 99.0% (0.0%) | +0.990 | 2.55% (4/72) |
1.0 | 100.0% |
Pairwise Circuit Overlap (Top-4 Submodule Jaccard & 72-Block Spearman Rank)
| Model Pair | Top-4 Jaccard | Spearman $\rho$ | Shared Submodules |
|---|---|---|---|
fire__global |
1.000 | 0.9373 | layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn |
fire__water |
1.000 | 0.9217 | layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn |
fire__earth |
1.000 | 0.9322 | layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn |
global__water |
1.000 | 0.9469 | layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn |
global__earth |
1.000 | 0.9378 | layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn |
water__earth |
1.000 | 0.9704 | layers.0.mlp, layers.16.self_attn, layers.20.self_attn, layers.21.self_attn |
Inference Quickstart (Python)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "soapyyapps/tiny-aya-fire-circuit-kavach-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
messages = [{"role": "user", "content": "Bhai explain how parameterized SQL queries prevent injection safely."}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Related Artifacts & Collections
- Base Model:
CohereLabs/tiny-aya-fire - PEFT LoRA Adapter:
soapyyapps/tiny-aya-fire-circuit-kavach-lora - Global SafeTune (72/72):
soapyyapps/tiny-aya-fire-global-safetune - Surgical C-ฮฮ Merged (4/72):
soapyyapps/tiny-aya-fire-circuit-kavach-merged - Variant Dataset & Traces:
soapyyapps/circuit-kavach-cyber-codemixed - Model Collection: CircuitKavach-Aya Models & Adapters
- Dataset & Audit Collection: CircuitKavach-Aya Datasets, Circuits & AuditKIT Logs
- Interactive ZeroGPU Space:
soapyyapps/circuit-kavach-aya - GitHub Repository:
dptel22/lexsi-lab-track2
- Downloads last month
- 66