A LoRA fine-tune of Qwen2.5-1.5B-Instruct for Solana development, DeFi reasoning, memecoin risk analysis, agent architecture, and Clawd constitutional behavior.
Base model: Qwen/Qwen2.5-1.5B-Instruct Adapter type: LoRA (r=16, alpha=32, ~9M trainable params / 0.6% of base) Training data: solanaclawd/solana-clawd-instruct — 36,109 examples Training config: ai-training/configs/lora_config.yaml Hub model ID: solanaclawd/solana-clawd-1.5b-lora
Tool-use / function calling? Use the 8B Hermes-3 base with
configs/hermes3_lora_config.yaml and the perps/ function-calling suite
(13 tools: funding rate, paper trade, risk assessment, Jupiter quotes).
Fork this to train your own Clawd
Everything below is a working example — swap in your own HF org, dataset, and base model to get your own fine-tuned Solana agent in one sitting.
bash
1# 0. Clone + install2git clone https://github.com/Solizardking/solana-clawd
3cd solana-clawd/ai-training
4pip install -r requirements.txt
5exportHF_TOKEN=hf_... # huggingface.co/settings/tokens (write access)6exportWANDB_API_KEY=... # wandb.ai/authorize (optional, enables live charts)78# 1. (Optional) bring your own data — append to the merged dataset9# Format: {"messages": [{"role": "system", ...}, {"role": "user", ...}, {"role": "assistant", ...}]}10# Then re-run prepare_dataset.py with your JSONL added to the --input list.1112# 2. Push the dataset to your HF org (or reuse ours — skip if using solanaclawd/solana-clawd-instruct)13python3 scripts/prepare_dataset.py \14 --input data/solana_clawd_merged.jsonl \15 --output data/processed \16 --train-ratio 0.9 --eval-ratio 0.05\17 --seed 42\18 --push --repo-id YOUR_ORG/your-dataset-id
1920# 3. Train on a remote A100 (recommended — ~$3–6 for the full 36K × 3-epoch run)21./scripts/launch_hf_jobs.sh a100-large # or h200, l4x12223# 4. Train locally on Mac MPS (sanity check, 1 epoch)24python3 scripts/train_lora.py --num-epochs 1 --no-quant
2526# 5. Watch live training logs27hf jobsps28hf jobs logs <JOB_ID> --follow
2930# 6. Register your model to the onchain Clawd registry (off-chain index — no wallet needed)31./dao/register_model.sh \32 --hf-model "YOUR_ORG/your-model-id"\33 --eval-accuracy 0.60\34 --dataset-size 361093536# 7. Serve locally with Ollama37ollama create my-clawd -f ollama/Modelfile.finetuned
38ollama run my-clawd "How do I detect a rug pull on a fresh Solana token?"
The entire pipeline — dataset → train → eval → onchain registry — is designed to
be reproducible from a single clone. The only external requirement is a Hugging
Face account with write access (free tier works).
The current Fireworks deployment uses the Hugging Face dataset export from
solanaclawd/solana-clawd-instruct, uploaded to Fireworks as JSONL because
the Fireworks dataset API only accepts uploaded files or cloud-storage URIs for
managed SFT.
The trained model is READY in Fireworks, but both attempted on-demand
deployment methods failed during model-server initialization with a Fireworks
internal error. The account currently has no validated deployment shape returned
for accounts/fireworks/models/qwen2p5-7b-instruct.
13 in the committed eval set; runtime sample size depends on --num
Throughput
Populate from outputs/eval/eval_results.json after running the adapter
Refusal rate (heuristic)
Populate from outputs/eval/eval_results.json after running the adapter
Avg generation length
Populate from outputs/eval/eval_results.json after running the adapter
Usage
transformers + peft (universal)
python
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
45BASE ="Qwen/Qwen2.5-1.5B-Instruct"6ADAPTER ="solanaclawd/solana-clawd-1.5b-lora"78tokenizer = AutoTokenizer.from_pretrained(BASE, trust_remote_code=True)9model = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16,10 device_map="auto", trust_remote_code=True)11model = PeftModel.from_pretrained(model, ADAPTER)1213messages =[14{"role":"system","content":"You are Clawd, a sovereign Solana-native AI agent."},15{"role":"user","content":"How do I detect a rug pull on a fresh token?"},16]17prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)18inputs = tokenizer(prompt, return_tensors="pt").to(model.device)1920with torch.no_grad():21 out = model.generate(**inputs, max_new_tokens=512, temperature=0.2, top_p=0.9,22 do_sample=True, pad_token_id=tokenizer.pad_token_id)23print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
mlx-lm (Apple Silicon — fastest local path)
bash
1pip install mlx-lm
2mlx_lm.generate \3 --model Qwen/Qwen2.5-1.5B-Instruct \4 --adapter solanaclawd/solana-clawd-1.5b-lora \5 --prompt "How do I detect a rug pull on a fresh Solana token?"
HF Router (no GPU required)
python
1from openai import OpenAI
23client = OpenAI(base_url="https://router.huggingface.co/v1", api_key="hf_...")4response = client.chat.completions.create(5 model="solanaclawd/solana-clawd-1.5b-lora",6 messages=[7{"role":"system","content":"You are Clawd, a sovereign Solana-native AI agent."},8{"role":"user","content":"What is a PDA?"},9],10 max_tokens=512,11)12print(response.choices[0].message.content)
Hermes-3 perps function calling (8B path only)
bash
1# Paper trade via the perps agent2python3 ai-training/perps/functioncall.py \3 --query "Paper trade: long SOL-PERP $500 at 3x" --verbose
45# GOAP reasoning (multi-step strategies)6python3 ai-training/perps/functioncall.py \7 --goap --query "Assess risk of shorting SOL-PERP $1000 at 5x"
Solana Perps Tool Template (included in the kit)
The perps/ directory is a drop-in tool library for building Solana perpetuals
agents. It works out of the box with no API keys for read-only data, and
plugs directly into any Hermes-3 or OpenAI-compatible function-calling loop.
Transfer SOL (paper mode by default; LIVE_TRADING=true for real)
assess_position_risk
Liq price, max loss, 24h funding cost, 1–10 risk score
Quick start
python
1# Plug the tool library into any OpenAI-compatible function-calling agent2from perps.functions import get_openai_tools, call_function
34tools = get_openai_tools()# returns all 13 tools in OpenAI tool format56# Call a tool directly (no model needed)7import json
8print(json.dumps(call_function("get_sol_price",{}), indent=2))9print(json.dumps(call_function("assess_position_risk",{10"market":"SOL-PERP","side":"long","size_usd":500,"leverage":311}), indent=2))
bash
1# Run the full Hermes-3 perps agent (HF Router — no GPU)2python3 perps/functioncall.py --query "What's the SOL-PERP funding rate? Should I go long?"34# GOAP multi-step reasoning mode5python3 perps/functioncall.py --goap \6 --query "Assess the risk of shorting SOL-PERP with $1000 at 5x leverage"78# Local Hermes-3 (needs GPU or quantized model)9HERMES_LOCAL=1 python3 perps/functioncall.py \10 --query "Paper trade: long SOL-PERP $500 at 3x"
Pydantic schemas (for structured output)
python
1from perps.schema import TradeOrder, RiskAssessment, MarketSignal
23# Force the model to emit a valid TradeOrder JSON4# Pass schema.TradeOrder.schema_json() as the response_format to any OpenAI client
Adding your own tools
python
1# perps/functions.py — add a new tool with the @tool decorator2from functions import tool, ALL_TOOLS
34@tool(5 description="Get the top token holders for a mint (uses Helius DAS).",6 parameters={7"type":"object",8"properties":{9"mint":{"type":"string","description":"Token mint address"},10"limit":{"type":"integer","description":"Number of holders","default":10},11},12"required":["mint"],13}14)15defget_top_holders(mint:str, limit:int=10)->dict:16# your implementation here17return{"mint": mint,"holders":[]}1819ALL_TOOLS.append(get_top_holders)# auto-registered in get_openai_tools()
Onchain Model Registry
Every model trained with this kit gets a permanent, verifiable onchain identity anchored via the solana_ai_inference Anchor program and indexed at onchain.x402.wtf. No centralized API needed — the PDA is queryable forever.
Layer 1 — Off-chain index (one curl, no wallet)
The fastest path. Posts to the onchain.x402.wtf registry and returns a CAAP/1.0 JSON record. Good enough for discovery and routing.
See onchainai.md for the full skill reference including validator registration, submit_data attribution, and AutoResearch pipeline integration.
Limitations
Small model: 1.5B parameters — complex multi-step reasoning on obscure Solana
primitives may degrade to hallucination. Always verify before acting.
Knowledge cutoff: training data is current as of mid-2026. New programs,
tickers, or exploits after that date are outside the model's knowledge.
Not a trading oracle: the model produces plans and analyses — risk and
execution are the user's responsibility.
Constitutional guardrails are best-effort: the model is trained to refuse
harmful actions, but adversarial prompts may still elicit undesired outputs.
Wrap production deployments in an independent safety layer.
Tokenizer: Qwen2.5 tokenizer; switch to Llama tokenizer for Hermes-3 base.
Bias and Safety
Trained on curated Solana/DeFi content with a constitutional system prompt.
The dataset explicitly excludes front-running, wallet draining, and sanctions-evasion
examples. Guardrails are heuristic — not formally verified.
For any production trading or financial application, apply independent review.
1@misc{solana-clawd-1.5b-lora,
2 title = {Solana Clawd 1.5B LoRA — Onchain Model Kit},
3 author = {solanaclawd},
4 year = {2026},
5 url = {https://huggingface.co/solanaclawd/solana-clawd-1.5b-lora},
6 note = {LoRA fine-tune of Qwen2.5-1.5B-Instruct on 36K Solana DeFi + agent data. Part of the Onchain Model Kit.}
7}