Skip to content

AI Assistant

BlockVault includes an on-device AI assistant that runs entirely on the user's phone — no data is sent to external servers. It understands natural language and can interact with wallet features through tool calling.


Model

PropertyValue
ModelGemma 3 1B Instruction-Tuned
TrainingSFT + GRPO fine-tuning on BlockVault-specific dataset
QuantizationINT4_BLOCK32 (CPU), FP16 (GPU)
Runtime (Android)LiteRT-LM (.litertlm files)
Runtime (iOS)MediaPipe Tasks GenAI (.task files) with Metal GPU

Performance

BackendSpeedNotes
GPU (OpenCL)~20 tok/sNot compatible with INT4 quantized models
CPU (XNNPack)~10–15 tok/sDefault — more stable and compatible

The model is downloaded on first use and cached in the app's documents directory. Downloads are resumable.


Agent Architecture (ReAct)

The AI uses a ReAct (Reasoning + Acting) pattern implemented with LangGraph. Three specialized sub-agents work in sequence:

User message

Classifier → "Can I answer directly, or do I need a tool?"
    ↓ (direct)          ↓ (tool_needed)
  Final answer      Tool Selector → "Which tool(s)?"

                    Tool Caller → Execute tool(s) → Observe result

                    Final answer (with tool results)

Sub-agents

AgentPurposeTemperature
ClassifierDecide if the query needs a tool or can be answered directly0.1
Tool SelectorPick the right tool(s) — supports multi-tool chains0.3
Tool CallerExecute tools, parse results, handle follow-ups0.3

The Tool Caller supports up to 5 tool calls per conversation and can ask the user for missing information before executing.


Available Tools

The AI has access to 10 tools that bridge natural language to wallet operations:

ToolWhat it does
get_balanceCheck crypto balance for an asset or address
get_assetsList available assets, filtered by blockchain or balance
get_priceCurrent market price for one or more symbols
get_historical_priceOHLCV candle data for trend analysis (1h, 4h, 1d, 1w intervals)
get_transaction_historyPast transactions for a blockchain
transferNavigate to the send screen with pre-filled recipient and amount
estimate_feeCalculate transaction cost (slow/normal/fast)
receive_cryptoShow deposit address with QR code
calculate_goalInvestment target planning — how much needed to reach a goal
calculate_dcaDollar-cost averaging strategy calculation

Multi-tool chains

Tools can be chained in sequence for complex queries:

"How much more ETH do I need to reach $10,000?"
    → get_balance (check current ETH)
    → get_price (get current ETH price)
    → calculate_goal (compute the gap)

Wallet integration

Tools interact with real wallet data:

  • get_balance queries the local database (AssetsEntity + BalanceEntity)
  • transfer opens the send screen with pre-filled fields
  • receive_crypto shows a modal with the wallet's QR code
  • If the user doesn't specify an asset, the AI shows a selector modal to let them pick

Conversation Example

User: "What's my Bitcoin balance?"

┌─ Classifier ─────────────────────────┐
│ Needs tool: yes → tool_needed        │
└──────────────────────────────────────┘

┌─ Tool Selector ──────────────────────┐
│ Tool: get_balance                    │
│ Reason: user asks for balance        │
└──────────────────────────────────────┘

┌─ Tool Caller ────────────────────────┐
│ <tool_call>                          │
│ get_balance(symbol: "BTC")           │
│ </tool_call>                         │
│                                      │
│ Observation: { balance: "0.5423" }   │
│                                      │
│ Answer: You have 0.5423 BTC.         │
└──────────────────────────────────────┘

Thinking Process

The model uses <think> tags for internal reasoning, visible to the user as an expandable "thinking" section:

<think>
The user wants to know their Bitcoin balance.
I need to call get_balance with symbol BTC.
</think>

Each ReAct iteration shows: thought → action → observation — giving users transparency into the AI's decision-making.


Training Pipeline

The model is fine-tuned on a custom dataset (~3,500+ examples) covering:

Conversation typeDescription
Single toolOne tool call per conversation
Clarification6+ turns asking for missing parameters
Multi-toolSequential tools passing results between them
DynamicModel decides next tool based on previous results
Error handlingTool fails, model explains the issue
Partial executionPlans more tools than executed
DeflectionUser changes topic mid-conversation

Training uses two phases:

  1. SFT (Supervised Fine-Tuning) — learns the format and tool-calling syntax
  2. GRPO (Group Relative Policy Optimization) — optimizes tool selection accuracy, parameter validation, JSON formatting, and safety

BlockVault Documentation