Tian AI:完全离线的自我进化AI系统,基于Qwen2.5
English: Tian AI — A Fully Offline, Self-Evolving AI System Powered by Qwen2.5
中文为主,英文为辅。本文为中英双语介绍。
什么是 Tian AI?/ What Is Tian AI?
中文:
Tian AI 是一个完全离线的自我进化AI系统,它是 TFinancial OS 的姊妹项目。如果说 TFinancial OS 专注于金融智能分析,那么 Tian AI 则是通用的自主AI框架——它不仅能回答问题,还能学习和进化,甚至修改自己的代码。
Tian AI 基于 Qwen2.5-1.5B 大语言模型,配合本地知识库、多层推理引擎和自主Agent调度系统,实现了一整套可在手机上运行的AI体系。
English:
Tian AI is a completely offline, self-evolving AI system — the sister project to TFinancial OS. While TFinancial OS focuses on financial intelligence, Tian AI is a general-purpose autonomous AI framework. It doesn't just answer questions — it learns, evolves, and even modifies its own source code.
Built on Qwen2.5-1.5B, Tian AI combines a local knowledge base, multi-layer reasoning engine, and autonomous agent scheduling system into a complete AI platform that runs entirely on your phone.
| 指标 / Metric | 数据 / Value |
|---|---|
| Project Size | 770 Python files, ~170K lines of code |
| Core LLM | Qwen2.5-1.5B (via llama.cpp GGUF) |
| Knowledge Base | SQLite with millions of indexed concepts |
| Backend | Flask REST API |
| Extension Languages | C (tian_hash), C++ (tian_engine), Java (tian_tools) |
| License | Open Source |
| GitHub | github.com/3969129510/tian-ai |
核心架构 / Core Architecture
中文:
Tian AI 由五大核心引擎组成,协同工作形成一个完整的AI系统:
English:
Tian AI's architecture is built around five specialized engines:
┌──────────────────────────────────────────────────────┐
│ Web UI / API Layer │
├──────────────────────────────────────────────────────┤
│ ┌──────────┐ ┌──────────┐ ┌────────────────────┐ │
│ │ Thinker │ │ Talker │ │ Knowledge Retriever │ │
│ │ (LLM Eng)│ │ (Dialog) │ │ (SQLite Search) │ │
│ └────┬─────┘ └────┬─────┘ └─────────┬──────────┘ │
│ └──────────────┼──────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Agent Scheduler │ │
│ │ (Task routing, orchestration, priority) │ │
│ └──────────────────┬───────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Self-Evolution System │ │
│ │ (XP tracking, capability unlock, code mod) │ │
│ └──────────────────────────────────────────────┘ │
├──────────────────────────────────────────────────────┤
│ Qwen2.5-1.5B (llama.cpp backend) │
└──────────────────────────────────────────────────────┘
1. Thinker — 推理引擎 / LLM Reasoning Engine
中文:
Thinker 是 Tian AI 的大脑,负责所有LLM推理,支持三种思考模式。
English:
The Thinker is the brain, handling all LLM inference with three thinking modes:
- Fast Mode (快速模式) — 简单查询单次响应,手机上约1-3秒 / Single-pass for simple queries, ~1-3s on mobile
- Chain-of-Thought Mode (思维链模式) — 逐步推理解决复杂问题 / Step-by-step reasoning for complex problems
- Deep Mode (深度模式) — 多视角分析+反思合成 / Multi-perspective analysis with reflection and synthesis
Thinker 通过智能提示模板架构,让1.5B的小模型发挥出远超其参数规模的推理能力。
2. Talker — 对话系统 / Conversation System
中文:
Talker 管理多轮对话,维护上下文,支持短期和长期记忆、情感感知和LLM追问。
English:
The Talker manages multi-turn dialogues, maintaining context across interactions with short/long-term memory, emotion awareness, and LLM-powered follow-up questions.
3. Knowledge Retriever — 知识检索 / Knowledge Base
中文:
为弥补小模型的知识局限,Tian AI 包含一个大规模预建的SQLite知识库:
- 数百万索引概念,覆盖100+领域
- 每个概念30种提问模式,灵活检索
- 0.04秒内完成检索
- 完全本地,无需调用外部API
- 可更新,无需重新训练模型
English:
To compensate for the smaller model's knowledge limitations, Tian AI includes a massive pre-built SQLite knowledge base:
- Millions of indexed concepts across 100+ domains
- 30 question patterns per concept for flexible retrieval
- 0.04s lookup time
- Fully local — no external API calls needed
- Updateable without retraining the model
4. Agent Scheduler — 任务调度 / Task Orchestration
中文:
Agent调度系统负责任务路由、优先级队列管理、并发请求处理。TaskQueue实现依赖排序,安全白名单确保系统安全。
English:
The Agent Scheduler routes tasks to appropriate engines, manages priority queues, and handles concurrent requests. TaskQueue implements dependency sorting, and a security whitelist ensures system safety.
5. Self-Evolution — 自我进化系统
中文:
Tian AI 最独特的功能——它能自我成长:
- XP系统 — 通过对话和任务积累经验值
- 等级解锁 — 里程碑等级解锁新能力
- 版本升级 — M1-E1-Theme格式的命名版本
- 自我修改 — 通过AST分析代码、LLM提出改进建议、自动打补丁
进化循环: 扫描 → 分析 → 建议 → 打补丁 → 验证
English:
The most distinctive feature of Tian AI — it can grow itself:
- XP System — Earn experience through conversations and tasks
- Leveling — Unlock new capabilities at milestones
- Version Upgrades — Named releases (M1-E1-Theme format)
- Self-Modifying Code — AST-based code analysis, LLM-suggested improvements, automatic patching
Evolution loop: SCAN → ANALYZE → SUGGEST → PATCH → VERIFY
为什么需要离线AI?/ Why Offline AI Matters
中文:
AI行业正在朝着越来越大的云端模型竞赛。但有一个根本问题:你的数据离开了你的设备。 每一次向ChatGPT、Claude或Gemini提问,都是在你不控制的服务器上处理的。
Tian AI 采取相反的哲学:
English:
The AI industry is racing toward ever-larger cloud models. But there's a fundamental problem: your data leaves your device. Every query to ChatGPT, Claude, or Gemini is processed on servers you don't control.
Tian AI takes the opposite approach:
| 特性 / Feature | Tian AI | ChatGPT | Ollama |
|---|---|---|---|
| 完全离线 / Fully Offline | ✅ | ❌ | ✅ |
| 内置知识库 / Built-in Knowledge | ✅ 百万级 | ❌ | ❌ |
| 三层推理 / Three-Layer Thinking | ✅ | ❌ | ❌ |
| 自我进化 / Self-Evolution | ✅ | ❌ | ❌ |
| 自修改代码 / Self-Modifying Code | ✅ | ❌ | ❌ |
| 手机上运行 / Runs on Android | ✅ | ❌ | ❌ |
| 隐私零泄露 / Zero Data Leakage | ✅ | ❌ | 看配置 |
| 开源 / Open Source | ✅ | ❌ | ✅ |
中文: 一个能在你手机上运行的、了解你的数据、永远不会对外传输的AI系统,比一个更聪明但你无法信任的云端模型更有价值。
English: A model that runs on your phone, knows your data, and never phones home is more valuable than a smarter model you can't fully trust.
技术栈 / Tech Stack
| 层 / Layer | 技术 / Technology | 用途 / Purpose |
|---|---|---|
| LLM Engine | llama.cpp + Qwen2.5-1.5B GGUF | 本地ARM/CPU推理 |
| Backend | Flask (Python) | REST API |
| Knowledge Base | SQLite (indexed) | 本地知识检索 |
| Frontend | Pure HTML/CSS/JS | 零依赖UI |
| Agent System | Python TaskQueue | 任务调度与编排 |
| Self-Modify | Python AST analysis + LLM | 代码分析与打补丁 |
| Auth | Simple session + localStorage | 无外部依赖 |
快速开始 / Getting Started
# 克隆仓库
git clone https://github.com/3969129510/tian-ai
cd tian-ai
# 安装依赖
pip install -r requirements.txt
# 下载 Qwen2.5-1.5B GGUF 模型
# 放到 ~/storage/downloads/qwen-1.5b-q4.gguf
# 启动 llama.cpp 服务端
llama-server -m ~/storage/downloads/qwen-1.5b-q4.gguf --port 8080 -t 4 -c 2048
# 启动 Tian AI
python run.py
支持项目 / Support the Project
中文: Tian AI 完全免费开源。如果愿意支持开发,欢迎捐赠:
English: Tian AI is completely free and open source. If you'd like to support development:
USDT (TRC-20): TNeUMpbwWFcv6v7tYHmkFkE7gC5eWzqbrs
BTC: bc1ph7qnaqkx4pkg4fmucvudlu3ydzgwnfmxy7dkv3nyl48wwa03kmnsvpc2xv
中文: Tian AI — 你的私有AI,完全离线,完全开源,自我进化。
English: Tian AI — Your Private AI, Completely Offline. Open Source. Self-Evolving.
GitHub: github.com/3969129510/tian-ai