Skip to content

lcd955/AI-assisant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-assisant

深圳国际金融大赛人工智能赛道 - 个性化推荐系统 + 账单识别 + 大模型小助手功能实现

Python 3.8+ License

项目简介

FinPersona 是一个基于多模态大模型的可解释智能金融助手系统,提供:

  • 🤖 自然交互:基于金融领域微调的大语言模型,支持自然语言和语音交互
  • 👤 深度个性化:利用图神经网络和强化学习构建动态用户画像
  • 📊 可解释AI:透明的推荐理由和决策过程
  • 🔮 财务模拟:what-if场景模拟和目标规划
  • 📸 多模态支持:图片账单识别和自动分类

核心功能

1. 自然对话引擎

支持自然语言查询,如:

  • "帮我看看上个月餐饮花了多少?"
  • "如果我想三年内买房,每月该存多少?"
  • "那投资呢?"(上下文理解)

技术特点

  • 对话状态跟踪(DST)保持上下文连贯性
  • 意图识别和实体抽取(NLU)
  • 语音识别(ASR)和语音合成(TTS)支持

2. 动态用户画像

数据融合

  • 交易流水分析
  • 账单自动分类
  • 风险偏好评估
  • 行为日志追踪

智能算法

  • 图神经网络(GNN)构建用户-产品-场景关系图谱
  • 强化学习(RL)动态优化推荐策略

个性化服务示例

  • 年轻职场人:自动储蓄计划 + 低门槛定投
  • 中年家庭:教育金保险 + 稳健型基金
  • 退休人群:国债逆回购 + 高股息股票

3. 可解释推荐

每个推荐都提供:

  • 详细推荐理由
  • 决策因素分析(权重可视化)
  • 风险评估
  • 预期收益分析
  • 替代方案建议

4. 财务模拟沙盒

支持场景:

  • 储蓄计划模拟
  • 目标规划(买房、教育、退休)
  • What-if分析
  • 投资组合模拟
  • 蒙特卡洛模拟

5. 多模态交互

  • 拍照上传账单自动识别
  • OCR文字提取
  • 智能分类
  • 批量处理

系统架构

AI Financial Recommendation System
├── src/
│   ├── dialogue_engine/      # 对话引擎
│   │   ├── dialogue_engine.py    # 主对话引擎
│   │   ├── nlu_engine.py         # 自然语言理解
│   │   ├── dialogue_state_tracker.py  # 对话状态跟踪
│   │   └── speech_engine.py      # 语音交互
│   ├── user_profile/          # 用户画像
│   │   ├── profile_manager.py    # 画像管理
│   │   └── gnn_model.py          # 图神经网络
│   ├── recommendation/        # 推荐引擎
│   │   ├── recommendation_engine.py  # 推荐引擎
│   │   └── rl_strategy.py        # 强化学习策略
│   ├── explainability/        # 可解释性
│   │   └── explainability_engine.py
│   ├── multimodal/           # 多模态
│   │   └── bill_recognition.py   # 账单识别
│   ├── simulation/           # 财务模拟
│   │   └── financial_simulator.py
│   └── api/                  # REST API
│       └── main.py
├── models/                   # 数据模型
├── config/                   # 配置文件
├── examples/                 # 示例代码
└── tests/                    # 测试代码

快速开始

1. 安装依赖

pip install -r requirements.txt

2. 配置系统

编辑 config/config.yaml 设置您的配置:

dialogue_engine:
  model_name: "Qwen/Qwen-7B"  # 或使用其他模型
  temperature: 0.7
  max_tokens: 512

3. 启动API服务

python -m src.api.main

API将在 http://localhost:8000 启动。

访问 http://localhost:8000/docs 查看交互式API文档。

4. 运行示例

python examples/usage_examples.py

API使用示例

对话查询

import requests

response = requests.post(
    "http://localhost:8000/api/v1/dialogue/query",
    json={
        "user_id": "user_001",
        "query": "帮我看看上个月餐饮花了多少?"
    }
)

print(response.json())

创建用户画像

response = requests.post(
    "http://localhost:8000/api/v1/profile/create",
    params={
        "user_id": "user_001",
        "age": 28,
        "monthly_income": 12000,
        "monthly_expenses": 8000,
        "savings": 50000,
        "risk_level": "moderate"
    }
)

获取个性化推荐

response = requests.post(
    "http://localhost:8000/api/v1/recommendations",
    json={
        "user_id": "user_001"
    },
    params={"top_k": 5}
)

recommendations = response.json()

财务模拟

response = requests.post(
    "http://localhost:8000/api/v1/simulation/goal-planning",
    params={
        "goal_amount": 500000,
        "time_horizon_months": 36,
        "current_savings": 100000,
        "investment_return_rate": 0.05
    }
)

print(f"每月需存: {response.json()['required_monthly_savings']}")

账单识别

files = {"file": open("bill.jpg", "rb")}
response = requests.post(
    "http://localhost:8000/api/v1/multimodal/recognize-bill",
    params={"user_id": "user_001"},
    files=files
)

print(response.json())

技术栈

  • 深度学习框架: PyTorch, Transformers
  • 图神经网络: PyTorch Geometric
  • 强化学习: Stable-Baselines3
  • NLP: Sentence Transformers, LangChain
  • Web框架: FastAPI
  • 数据处理: Pandas, NumPy
  • OCR: Pytesseract
  • 语音: SpeechRecognition, pyttsx3

性能指标

  • 对话响应: < 800ms
  • 推荐生成: < 1.5s (95分位)
  • 支持并发: 1000+ QPS
  • 账单识别准确率: > 90%
  • 推荐采纳率: 25%+ 提升

部署指南

Docker部署

docker build -t ai-financial-system .
docker run -p 8000:8000 ai-financial-system

Kubernetes部署

kubectl apply -f k8s/deployment.yaml

安全与合规

  • ✅ 数据加密存储
  • ✅ 联邦学习支持
  • ✅ 差分隐私保护
  • ✅ 合规性解释输出
  • ✅ 审计日志

贡献指南

欢迎提交Issue和Pull Request!

许可证

MIT License

联系方式

About

基于 LoRA 的 Qwen-7B 微调应用于智能金融对话,深圳国际金融大赛人工智能赛道-个性化推荐系统+账单识别+大模型小助手功能实现,

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages