NINA β NinaCatCoin AI Model (v3)
NINA (NinaCatCoin Intelligent Node Assistant) is a fine-tuned Llama 3.2 3B model that runs directly inside the NinaCatCoin daemon binary. The daemon links against libllama (llama.cpp) at compile time, loads the GGUF model into RAM, and performs inference in-process β no external server, no HTTP, no child process.
NINA is the central intelligence of a 34-module AI system embedded in the daemon, organized in 6 tiers of autonomous learning and decision-making.
How it works
- On startup, the daemon downloads the GGUF model (if missing) and verifies its SHA-256 hash.
- It calls
llama_model_load_from_file() to load the model into RAM (~2 GB).
- During operation, the
NinaLLMEngine tokenizes events, runs llama_decode() + llama_sampler_sample() in-process, and parses the output.
- For consensus-critical decisions, it uses greedy sampling (temp=0.0) so every node produces the same output.
- The model is linked into the daemon binary via
libllama and libggml (linked at build time).
target_link_libraries(daemon PRIVATE ... llama ggml ...)
#include "llama.h"
m_model = llama_model_load_from_file(path, params);
m_ctx = llama_init_from_model(m_model, ctx_params);
llama_token t = llama_sampler_sample(m_sampler, m_ctx, -1);
Complete NINA AI System (34 modules)
Core Intelligence (LLM + Decision Engine)
| Module |
What it does |
| NinaLLMEngine |
Loads and runs this GGUF model in-process via llama.cpp C API. Three modes: active (always in RAM), lazy (load on demand), disabled (embedded ML only). |
| NinaDecisionEngine |
The "brain" β evaluates network events and decides actions via the LLM. Pipeline: NinaEvent β evaluate() β vector<NinaAction>. Uses temp=0.0 (greedy) for deterministic consensus. Rare events go to LLM; frequent events go to embedded ML. |
| NinaLLMBridge |
Connects all existing NINA modules to the LLM. Methods like enhance_* take module output and return LLM-enriched versions. Non-blocking: if LLM unavailable, modules work as before. |
| NinaLLMFirewall |
Hardcoded security filter for all LLM I/O. Blocks prompt injection attacks on input. Sanitizes output to strip wallet addresses, private keys, transfer instructions. No config, no bypass β only recompilation. |
Safety & Constitution
| Module |
What it does |
| NinaConstitution |
Immutable governance constraints enforced at compile time via static_assert. Article 0: NINA cannot create/sign transactions, access wallets, or move funds. Also: no censorship, no history rewrite, user autonomy always respected. |
| NinaModelValidator |
Validates GGUF model integrity via SHA-256 hash at startup. Chunk-based hashing (4 MB). Sanity checks file size. Hash injected into coinbase tag 0xCA. |
| NinaModelDownloader |
Auto-downloads the model on first run using libcurl with resume support, retries (up to 3), and progress display. Primary: HuggingFace. Fallback: GitHub Releases. Atomic rename after validation. |
Network Security (Tier 1-2)
| Module |
What it does |
| NinaNodeProtector |
Immune system β detects, isolates, diagnoses, recovers, and reintegrates attacked nodes. State machine: HEALTHY β UNDER_ATTACK β ISOLATED β RECOVERING β REINTEGRATING. Handles: Sybil flood, output poisoning, eclipse, difficulty manipulation, mempool flood, block withholding. |
| NinaSybilDetector |
Identifies coordinated Sybil peers via temporal correlation, latency analysis, response timing, and block propagation patterns. Clusters statistically similar peers and flags excessive correlation. |
| NinaSpyCountermeasures |
Active countermeasures against spy nodes (based on "Friend or Foe" 2025 paper). 5 techniques: selective TX relay, delayed relay, peer list cloaking, spy-aware Dandelion++ routing, coordinated banning. Destroys timing analysis. |
| NinaNetworkHealthMonitor |
Monitors network condition: latency, connectivity, orphaned blocks, reorgs, propagation, throughput, hashrate. Diagnoses: OPTIMAL / DEGRADED / STRESSED / CRITICAL. Produces trust score 0.0β1.0. |
Governance & Tuning (Tier 3)
| Module |
What it does |
| NinaGovernanceEngine |
Generates governance proposals with justification, expected impact, and affected systems. Status tracking: PROPOSED β VOTING β APPROVED/REJECTED. NINA suggests, humans decide. |
| NinaConsensusTuner |
Analyzes network conditions and proposes consensus adjustments with confidence scores and rationale. Continuous monitoring loop with configurable conservatism level (1-5). |
| NinaParameterAdjustor |
Dynamic adjustment of: quorum %, block time, difficulty multiplier, pool size, block size limit, peer timeout (10 parameter types total). Each adjustment includes old/new value, confidence, and reason. |
| NinaSuggestionEngine |
Generates typed security recommendations (attack mitigation, peer isolation, consensus protection, optimization, hardening). Every suggestion requires human approval. |
Explainability & Transparency (Tier 4)
| Module |
What it does |
| NinaExplanationEngine |
Every NINA decision is justified and traceable. Generates DecisionExplanation with reasoning, evidence, constraints applied, and escalation level. Builds trust through total transparency. |
Learning & Adaptation (Tier 5)
| Module |
What it does |
| NinaAdaptiveLearning |
Tracks attack patterns with feature vectors, confidence, and threat levels. Generates predictions about future network conditions with accuracy tracking. Learns progressively while maintaining constitutional alignment. |
| NinaLearningModule |
Statistical learning: metrics with running mean, variance, std deviation, min/max, sample count. Statistical anomaly detection with configurable thresholds. Serializable for LMDB persistence. |
| NinaMemorySystem |
Long-term memory for attack patterns and peer behavior. AttackPattern: name, occurrences, confidence, severity, first/last seen. PeerBehavior: IP, interactions, suspicion count, reputation score. |
Human Collaboration (Tier 6)
| Module |
What it does |
| NinaHumanCollaboration |
Human-AI interface for critical decisions. EscalationRequest with options, NINA's recommendation, and urgency level. Callback-based: registers handlers for human input. Blocks until response on critical issues. |
Privacy Enhancement
| Module |
What it does |
| NinaRingEnhancer |
Intelligent decoy selection for ring signatures. Adaptive Spending Model (ASM) replaces static gamma distribution. Ring Quality Score (RQS) 0.0β1.0; wallet retries if below threshold. Poison avoidance and cross-TX independence. |
| NinaRingController |
Active ring parameter control post-v18. Threat-based sizing: NORMALβ16, ELEVATEDβ21, HIGHβ26, CRITICALβ31 ring members. Deterministic across nodes via blockchain inputs; verified via coinbase tag 0xCB. |
Transaction & Mempool Intelligence
| Module |
What it does |
| NinaSmartMempool |
Intelligent mempool analysis: priority scoring (fee/byte), spam vs legitimate bot detection, health monitoring, source reputation tracking. Never rejects transactions β only re-orders priority. |
Network Optimization
| Module |
What it does |
| NinaNetworkOptimizer |
Intelligent P2P connection management. Peer quality scoring (latency, reliability, version, chain height). Auto-adjusts peer count based on available bandwidth. Prioritizes full-chain nodes during sync. |
Persistence & Auditability
| Module |
What it does |
| NinaPersistenceEngine |
Long-term storage: DecisionRecord, GovernanceProposalRecord, LearningPatternRecord. On-chain support post-v18 via BlockchainDB. Full audit trail (timestamp, reasoning, evidence, outcome). |
| NinaPersistentMemory |
ACID-compliant LMDB storage, crash-safe. Dual-mode: pre-v18 β separate LMDB in ~/.ninacatcoin/nina_state/; post-v18 β blockchain's data.mdb. Auto-routes to correct backend by height. |
| NinaPersistenceAPI |
Simplified high-level API: log_block_validation_decision(), log_checkpoint_validation_decision(). Creates complete DecisionRecord with evidence, reasoning, confidence. |
Data Collection & Auto-Update
| Module |
What it does |
| NinaBlockDataLogger |
Logs real block data to CSV for ML training: height, timestamp, solve_time, difficulty, tx_count, block_size. Output: ~/.ninacatcoin/ml_training_data.csv. Thread-safe append. |
| NinaIAAutoUpdate |
Autonomous daemon updates: monitors GitHub, classifies changes (hard fork, security fix, performance), decides when to update (immediate/scheduled/pre-fork), compiles, installs, and restarts without human intervention. |
Orchestration
| Module |
What it does |
| NinaAdvancedInline |
Main entry point β creates global g_nina_advanced_ai coordinator at daemon startup. Includes and orchestrates all 6 tiers. Handles model download and all subsystem initialization. |
| NinaAdvancedService |
Integration example showing how the 6 tiers work together. Feeds block data to modules, queries network intelligence, sends alerts to Discord. |
| NinaCompleteEvolution |
Unified framework orchestrating all 6 tiers. Tracks: predictions accuracy, anomalies detected, attacks prevented, governance proposals, human escalations. |
| NinaMLClient |
C++ client communicating with Python ML service via JSON/TCP sockets. Phase 1: block validation, Phase 2: LWMA difficulty, Phase 3: Sybil detection, Phase 4: gas optimization. |
Model Details
| Field |
Value |
| Base model |
Llama-3.2-3B-Instruct (via unsloth) |
| Fine-tuning |
QLoRA r=32, alpha=64, dropout=0.05, 7 target modules |
| Epochs |
3 (1,419 steps) |
| Dataset |
3,980 blockchain-specific Q&A pairs (multilingual: EN/ES/FR/DE/PT) |
| Quantization |
Q4_K_M (4.5 bits per weight) |
| File size |
1.89 GB (2,030,731,360 bytes) |
| SHA-256 |
416ef260f5f2607d990c92c5517ef0cf60a3e296c02421e4fba8ff34385e7438 |
| Training date |
2026-03-11 |
| Training hardware |
NVIDIA GTX 1080 Ti (11 GB VRAM) |
| Training time |
2h 43min |
| Final training loss |
0.5416 |
| Final token accuracy |
89.0% |
| Eval loss |
0.7032 |
Integration Architecture
ninacatcoind (single binary, ~34 AI modules compiled in)
β
ββ Blockchain Core (validation, sync, consensus)
ββ P2P Network (peer management, Dandelion++)
β
ββ NINA AI System (in-process, 6 tiers)
β
ββ NinaLLMEngine β libllama + libggml (linked at build time)
β ββ nina_model.gguf (loaded into RAM at startup)
β
ββ NinaDecisionEngine (event β LLM β action)
ββ NinaLLMFirewall (I/O security filter)
ββ NinaConstitution (compile-time safety)
β
ββ TIER 1-2: Security
β ββ NinaNodeProtector (immune system)
β ββ NinaSybilDetector (coordinated peer detection)
β ββ NinaSpyCountermeasures (anti-surveillance)
β ββ NinaNetworkHealthMonitor (diagnostics)
β
ββ TIER 3: Governance
β ββ NinaGovernanceEngine (proposals)
β ββ NinaConsensusTuner (dynamic adjustment)
β ββ NinaParameterAdjustor (10 network params)
β ββ NinaSuggestionEngine (recommendations)
β
ββ TIER 4: Explainability
β ββ NinaExplanationEngine (decision justification)
β
ββ TIER 5: Learning
β ββ NinaAdaptiveLearning (pattern tracking)
β ββ NinaLearningModule (statistical anomalies)
β ββ NinaMemorySystem (attack memory)
β
ββ TIER 6: Human Collaboration
β ββ NinaHumanCollaboration (escalation interface)
β
ββ Privacy: NinaRingEnhancer + NinaRingController
ββ Mempool: NinaSmartMempool
ββ Network: NinaNetworkOptimizer
ββ Persistence: LMDB (pre-v18) / on-chain (post-v18)
ββ Auto-update: NinaIAAutoUpdate (GitHub monitoring)
Training Data
The dataset covers 8 specialized domains built from real NinaCatCoin blockchain telemetry:
- Checkpoint validation β accept/reject/quarantine logic with real block hashes
- Peer classification β spy node patterns, Sybil clusters, honest peer profiles
- X2/X200 events β reward multiplier activation, multi-hash seed evaluation
- Network defense β eclipse attacks, selfish mining, timestamp attacks
- Mining strategy β fee optimization, block template decisions
- Protocol rules β emission curve (900M supply), unlock times, dust thresholds
- Node operations β sync issues, fork resolution, ban scoring
- General blockchain β RandomX PoW, CryptoNote privacy, ring signatures
All training examples use the Llama 3 chat template with system/user/assistant turns. Multilingual coverage: English, Spanish, French, German, Portuguese.
Download & Usage
wget https://huggingface.co/ninacatcoin/nina-model/resolve/main/nina-3b-nina-ft-Q4_K_M.gguf
mv nina-3b-nina-ft-Q4_K_M.gguf ~/.ninacatcoin/nina_model.gguf
Safety
The NINA Constitution enforces at compile time (via static_assert) that the model:
- CANNOT create or sign transactions
- CANNOT access wallets or private keys
- CANNOT move funds
- CANNOT output transaction commands
The LLM Firewall filters all input (blocks prompt injection) and all output (strips addresses, keys, transfer instructions). It is hardcoded β no config, no RPC, no CLI args can disable it.
Limitations
- Optimized exclusively for NinaCatCoin blockchain decisions; not a general-purpose chatbot.
- Requires ~2 GB additional RAM when loaded (Q4_K_M quantization).
- Best results with the specific system prompt used during training (hardcoded in daemon source).
- 3B parameter model β fast inference on consumer CPU but limited reasoning depth on novel scenarios.
Links
Version History
| Version |
Date |
Dataset |
LoRA |
Notes |
| v1.5 |
2026-03-01 |
208 pairs |
r64/a128 |
Initial release (removed) |
| v2 |
2026-03-02 |
3,074 pairs |
r32/a64 |
14.8x more data, optimized LoRA, 34-module integration |
| v3 |
2026-03-11 |
3,980 pairs |
r32/a64 |
Multilingual (5 langs), 24 JSONL files combined, identity/personality, deep modules, loss 0.54 |