Raia โ€” a Web3 Security sLLM

raia is a specialized small language model (sLLM) fine-tuned for Web3 security work: auditing smart contracts across multiple chains and conducting on-chain investigations in the style of a blockchain forensics analyst. It is built on top of Qwen/Qwen2.5-Coder-7B-Instruct and trained with LoRA on a purpose-built, hand-curated dataset.

The goal of raia is narrow and deliberate: instead of being a general assistant that also knows a little security, it is a focused analyst that reasons through vulnerabilities and fund flows in a consistent, structured format โ€” the way a real auditor or investigator would write up their findings.


What raia does

raia is trained for five concrete tasks:

Capability What it produces
Vulnerability detection Step-by-step reasoning, a severity rating, an isolated proof-of-concept, and a remediation
Fund tracing A 4-step attribution chain, a traceable endpoint, a calibrated confidence level, and a recommended next step
Scammer profiling A risk score (0โ€“100), risk categories, connected addresses, and a recommended action
Anomaly triage A suspicion score (0โ€“100), the reasoning behind it, and a next step
Smart-money watching A signal, a confidence level, and an explicit "not investment advice" caveat

Every response begins with an explicit <reasoning> block so the analysis is auditable โ€” you can see how raia reached a conclusion, not just the conclusion.

Multi-chain coverage

  • Smart-contract languages: Solidity, Vyper, Rust (Solana), Move (Aptos/Sui), Cairo (Starknet), ink! (Polkadot)
  • Chains for on-chain analysis: Ethereum, Solana, BSC, Polygon, Arbitrum, Base, Optimism, Cosmos, TON, Cardano, and cross-chain bridges

What makes raia different: calibration

A security model that flags everything as malicious is useless โ€” it drowns real threats in false positives. raia was deliberately trained with a large set of negative controls: benign cases that look suspicious but are legitimate (payroll distributions, burn addresses, whitehat rescues, market-maker rebalancing, bridge refunds, DAO vendor payments, arbitrage bots, and more).

As a result, raia distinguishes signal from noise. It will score a mixer-funded serial drainer at 90+ and correctly recognize that a burn address is a 0 โ€” because it was taught the difference, not just the alarm.


Intended use

raia is designed for defensive security work by Web3 teams, auditors, and red teams:

  • Triaging smart contracts for known vulnerability classes
  • Tracing stolen funds and building attribution chains from public on-chain data
  • Profiling suspicious addresses and clusters
  • Prioritizing alerts in a monitoring pipeline

Offensive analysis goes up to isolated proof-of-concept in a sandboxed environment (e.g. a Foundry/Hardhat fork). raia is not intended to produce weaponized, production-ready exploits.


How to use it

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "cyberthebaby/raia"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

messages = [
    {
        "role": "system",
        "content": (
            "You are an on-chain investigator. Given transaction data and wallet "
            "addresses, trace fund flows and build an attribution chain, citing the "
            "specific on-chain evidence at each step. End with a calibrated confidence."
        ),
    },
    {
        "role": "user",
        "content": (
            "Trace this flow: 0x5a2c...d190 received 1,300 ETH from a protocol exploit, "
            "supplied it as collateral on a cross-chain lending market, borrowed "
            "stablecoins on another chain, abandoned the collateral, and cashed out to "
            "three CEX deposit addresses. Where did the funds end up?"
        ),
    },
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=768, temperature=0.3)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Prompting tips

  • Use a task-appropriate system prompt. raia was trained with distinct system prompts per task (auditor, investigator, threat-intel analyst, monitoring assistant). Matching the system prompt to your task produces the cleanest, best-formatted output.
  • Give concrete details. Addresses, amounts, hops, and known labels let raia build a specific attribution chain rather than a generic answer.
  • Low temperature (0.2โ€“0.4) keeps the structured format tight.

Training details

  • Base model: Qwen/Qwen2.5-Coder-7B-Instruct (7B parameters, natively multilingual, strong code understanding)
  • Method: LoRA fine-tuning in BF16 (r=16, ฮฑ=32, dropout=0.05), attention projections
  • Schedule: 5 epochs, learning rate 2e-4, cosine schedule, effective batch size 16
  • Hardware: 1ร— AMD Instinct MI300X (192GB)
  • Dataset: ~450 hand-curated examples across the five capabilities, English, in ChatML format with explicit chain-of-thought reasoning. Held-out validation and test splits were carved out with group-based splitting to prevent leakage.
  • Result: validation loss improved to ~1.24 with token accuracy ~0.72; the best checkpoint by validation loss was retained.

Limitations

  • English only. The specialization dataset is entirely in English. The base model is multilingual, so raia may understand other languages, but its structured security output is reliable only in English. A multilingual version is planned.
  • Not a substitute for a human auditor. raia accelerates and structures analysis; it does not replace professional review. Always verify its findings, especially before acting on financial or legal conclusions.
  • Addresses and figures in examples are illustrative. raia reasons about patterns; it does not have live chain access and cannot verify that a specific address exists or that funds are where it infers.
  • Possible hallucination. Like any LLM, raia can produce plausible-but-wrong details. Treat its output as an expert first pass, not ground truth.

Ethical use

raia is a defensive tool. It is intended to help teams find and fix vulnerabilities, recover stolen funds, and protect users โ€” not to build attacks. Proof-of-concept output is scoped to isolated test environments. Please use it responsibly and within the law.


License

Released under the Apache 2.0 license, inheriting from the base model. You are free to use, modify, and build on raia, including commercially, subject to the license terms.

Downloads last month
-
Safetensors
Model size
8B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for cyberthebaby/raia

Base model

Qwen/Qwen2.5-7B
Finetuned
(493)
this model