Spaces:
Paused
Paused
File size: 8,224 Bytes
7e30ec6 9c1f52e b300456 e6953e9 7e30ec6 7cc2e96 7e30ec6 a43d14a 7e30ec6 a43d14a 7e30ec6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | ---
title: AI Executive System
emoji: π€
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: "6.5.0"
python_version: "3.11"
app_file: app/app.py
pinned: false
---
# AI Executive System
A production-ready AI chatbot system that replicates the communication style, reasoning patterns, and personality of **Ryouken Okuni, CEO of Akatsuki AI Technologies**. The system uses a dual-LLM architecture with open-source models, designed for white-label deployment across multiple enterprise clients.
## Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI EXECUTIVE SYSTEM β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β [User Query] β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β LLM 1: VOICE MODEL (Llama-3.1-8B-Instruct + LoRA) β β
β β - Fine-tuned on CEO's blog content β β
β β - Captures authentic reasoning patterns & communication style β β
β β - Generates CEO-style draft response β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β LLM 2: REFINEMENT MODEL (Llama-3.1-8B-Instruct) β β
β β - No fine-tuning required (prompt-based) β β
β β - Polishes grammar, clarity, professional formatting β β
β β - Improves logical flow and argument coherence β β
β β - Ensures cultural appropriateness for Japanese business context β β
β β - Preserves voice authenticity while improving quality β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β [Final Response to User] β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## Features
- **Dual-LLM Pipeline**: Voice model for authentic CEO communication + Refinement model for polish
- **QLoRA Fine-tuning**: Efficient training with 4-bit quantization
- **Japanese Business Culture Awareness**: Culturally appropriate responses
- **Hugging Face Integration**: Models stored and loaded from HF Hub
- **Gradio Interface**: Professional chat UI with custom branding
- **Comprehensive Evaluation**: Voice authenticity and factual accuracy metrics
## Project Structure
```
ai-executive/
βββ data/
β βββ raw/ # Original blog posts (blogs.txt)
β βββ processed/ # Cleaned and segmented content
β βββ training/ # Final JSONL training datasets
β
βββ src/
β βββ data_processing/ # Blog parsing, Q&A generation
β βββ training/ # QLoRA/LoRA fine-tuning scripts
β βββ inference/ # Dual-LLM pipeline
β βββ evaluation/ # Voice and accuracy metrics
β
βββ app/ # Gradio application
βββ scripts/ # CLI tools
βββ notebooks/ # Jupyter notebooks for experiments
```
## Quick Start
### 1. Installation
```bash
pip install -r requirements.txt
```
### 2. Prepare Data
Place your CEO's blog content in `data/raw/blogs.txt` with the following format:
```
=== BLOG START ===
[Title of first blog post]
[Content of first blog post...]
=== BLOG END ===
=== BLOG START ===
[Title of second blog post]
[Content of second blog post...]
=== BLOG END ===
```
### 3. Process Blogs
```bash
python scripts/process_blogs.py --input data/raw/blogs.txt --output data/processed/
```
### 4. Generate Training Data
```bash
# Set your API key
export ANTHROPIC_API_KEY=your_key_here
# or
export OPENAI_API_KEY=your_key_here
# Generate Q&A pairs
python scripts/generate_training_data.py \
--input data/processed/ \
--output data/training/ \
--num-pairs 500
```
### 5. Fine-tune the Model
```bash
# Run on Hugging Face infrastructure
python scripts/train_model.py \
--dataset data/training/train.jsonl \
--base-model Qwen/Qwen3-4B-Instruct \
--output-repo your-username/ceo-voice-model \
--epochs 3
```
### 6. Run the Chatbot
```bash
python app/app.py
```
Or deploy to Hugging Face Spaces:
```bash
python scripts/push_to_hub.py --space your-username/ai-executive-chatbot
```
## Configuration
### Environment Variables
Create a `.env` file in the project root:
```env
# API Keys for Q&A generation
ANTHROPIC_API_KEY=your_anthropic_key
OPENAI_API_KEY=your_openai_key
# Hugging Face
HF_TOKEN=your_huggingface_token
HF_USERNAME=your_username
# Model Configuration
VOICE_MODEL_REPO=your-username/ceo-voice-model
REFINEMENT_MODEL=meta-llama/Meta-Llama-3-8B-Instruct
```
### Training Configuration
Key hyperparameters in `src/training/train_qlora.py`:
| Parameter | Default | Description |
|-----------|---------|-------------|
| LoRA rank | 64 | Rank of LoRA matrices |
| LoRA alpha | 128 | Scaling factor |
| Learning rate | 2e-4 | Training learning rate |
| Batch size | 4 | Per-device batch size |
| Gradient accumulation | 4 | Steps before update |
| Max sequence length | 2048 | Maximum tokens per example |
| Epochs | 3-5 | Training epochs |
## Evaluation
Run the evaluation suite:
```bash
python scripts/evaluate_model.py \
--model your-username/ceo-voice-model \
--test-set data/training/validation.jsonl
```
### Metrics
- **Vocabulary Overlap**: Jaccard similarity with blog corpus (target: >0.7)
- **Embedding Similarity**: Topic coherence with source material (target: >0.8)
- **Factual Accuracy**: Claims verified against source (target: >95%)
- **Unique Phrase Preservation**: CEO's signature phrases detected
## Deployment
### Hugging Face Spaces
1. Create a new Space on Hugging Face
2. Push the application:
```bash
python scripts/push_to_hub.py --space your-username/ai-executive-chatbot
```
### Requirements
- GPU: NVIDIA A10G or T4 recommended
- VRAM: 16GB+ for inference
- Storage: 20GB+ for models
## License
Proprietary - Akatsuki AI Technologies
## Contact
For questions or support, contact the Akatsuki AI Technologies team.
|