File size: 11,988 Bytes
5f29fbc
 
7771f36
 
 
 
5f29fbc
7771f36
 
 
5f29fbc
 
 
3f4c9de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f29fbc
 
 
 
7771f36
 
 
 
 
 
 
 
 
 
3f4c9de
 
78efe41
 
3f4c9de
 
78efe41
 
7771f36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f29fbc
 
7771f36
5f29fbc
 
 
 
 
 
 
 
 
 
 
78efe41
 
5f29fbc
 
 
 
 
 
 
 
 
 
7771f36
5f29fbc
 
 
 
7771f36
 
 
 
5f29fbc
7771f36
 
 
5f29fbc
 
7771f36
 
 
5f29fbc
 
7771f36
5f29fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7771f36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f29fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7771f36
5f29fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78efe41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f29fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7771f36
5f29fbc
7771f36
 
 
 
5f29fbc
 
 
7771f36
5f29fbc
 
 
7771f36
5f29fbc
 
 
 
 
 
 
 
 
 
7771f36
5f29fbc
 
 
7771f36
5f29fbc
 
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
---
license: apache-2.0
language:
- en
base_model:
- Qwen/Qwen2.5-3B-Instruct
tags:
- text-generation
- peft
- lora
- grpo
- reinforcement-learning
- reasoning
- corporate strategy
- decision making
- business strategy
- business analysis
- competitive analysis
- strategic planning
- decision support
- management consulting
- market analysis
- business intelligence
- business planning
- organizational development
- performance improvement
- strategic thinking
- executive support
datasets:
- Wildstash/OrgStrategy-Reasoning-1k
library_name: transformers
pipeline_tag: text-generation
pretty_name: Business Analyst Agent (Qwen2.5-3B + LoRA, GRPO)
widget:
- text: "How should a startup compete against established market leaders?"
  parameters:
    max_new_tokens: 256
    temperature: 0.7
- text: "Recommend a 90‑day plan to reduce B2B SaaS churn from 30% to <15%."
  parameters:
    max_new_tokens: 384
    temperature: 0.7
- text: "Corporate strategy decision making for a mid‑market SaaS facing a new competitor."
  parameters:
    max_new_tokens: 384
    temperature: 0.7
- text: "Competitive analysis and go to market plan for entering the EU market."
  parameters:
    max_new_tokens: 384
    temperature: 0.7
inference:
  parameters:
    max_new_tokens: 512
    temperature: 0.7
model-index:
- name: Wildstash/business-analyst-agent
  results:
  - task:
      type: text-generation
      name: Strategy QA (internal heuristic eval)
    dataset:
      name: Wildstash/OrgStrategy-Reasoning-1k
      type: Wildstash/OrgStrategy-Reasoning-1k
      split: test
    metrics:
    - type: structured_output_compliance
      value: 0.95
    - type: framework_accuracy
      value: 0.92
    - type: actionability
      value: 0.88
---

# 🤖 Business Analyst Agent (LoRA on Qwen2.5-3B)

> AI-powered strategic business analyst trained with GRPO (Group Relative Policy Optimization) for expert-level business strategy and analysis.

[![Model](https://img.shields.io/badge/🤗-Model-yellow)](https://huggingface.co/Wildstash/business-analyst-agent)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[![Python](https://img.shields.io/badge/Python-3.9+-green.svg)](https://python.org)

## 🎯 Overview

The **Business Analyst Agent** is a specialized AI assistant trained on 1000+ real business strategy cases. It provides expert-level strategic analysis, actionable recommendations, and structured business insights using advanced reinforcement learning techniques.

> Keywords: corporate strategy decision making, business strategy, competitive analysis, market analysis, go to market, merger and acquisition, digital transformation, business planning, organizational development, performance improvement, management consulting

### ✨ Key Features

- **🎯 Strategic Framework Identification**: Automatically selects appropriate business frameworks
- **🔍 Root Cause Analysis**: Deep analysis of business problems and opportunities  
- **📋 Actionable Action Plans**: Detailed plans with owners, timelines, and budgets
- **📊 Organizational Impact Assessment**: Comprehensive stakeholder and resource analysis
- **🚀 Multi-Domain Expertise**: Market entry, churn reduction, digital transformation, M&A

## 🚀 Quick Start

### Use from Hugging Face (PEFT adapters)

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

base = "Qwen/Qwen2.5-3B-Instruct"
adapter = "Wildstash/business-analyst-agent"

tokenizer = AutoTokenizer.from_pretrained(base, use_fast=True)
base_model = AutoModelForCausalLM.from_pretrained(base, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base_model, adapter)

prompt = "How should a startup compete against established market leaders?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### Use with Hugging Face Inference API

```python
import requests

API_URL = "https://api-inference.huggingface.co/models/Wildstash/business-analyst-agent"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()

output = query({
    "inputs": "A B2B SaaS company has 30% monthly churn. Recommend a strategy to reduce it to under 15%.",
    "parameters": {"max_new_tokens": 512, "temperature": 0.7}
})
### Optional: Merge LoRA → standalone checkpoint

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

base = "Qwen/Qwen2.5-3B-Instruct"
adapter = "Wildstash/business-analyst-agent"

tok = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, torch_dtype=torch.bfloat16)
model = PeftModel.from_pretrained(model, adapter)
merged = model.merge_and_unload()
merged.save_pretrained("wildstash-biz-analyst-merged", safe_serialization=True)
tok.save_pretrained("wildstash-biz-analyst-merged")
```
```

## 📊 Example Output

**Input**: "B2B SaaS with 30% month-3 churn despite NPS 45. Propose a 90-day plan to reduce churn to <15%."

**Output**:
```
<strategic_analysis>
**Framework:** Systems Thinking

**Root Cause Analysis:** Poor customer service responsiveness and inconsistent onboarding experience

**Key Stakeholders:**
- Customer Service team: 15 FTEs
- Product team: 5 FTEs
- Marketing team: 8 FTEs

**Organizational Impact:**
- Revenue impact: $2.4M annually
- Customer lifetime value: $8,400
- Market position: Competitive disadvantage
</strategic_analysis>

<action_plan>
1. **Cross-train support team** (Owner: Product Manager; Timeline: 6 weeks; Budget: $0.27M; Target: Response time <2 hours)
2. **Launch customer success program** (Owner: Marketing Director; Timeline: 5 weeks; Budget: $0.16M; Target: 25% engagement increase)
3. **Implement feedback loop system** (Owner: CTO; Timeline: 6 weeks; Budget: $0.15M; Target: 95% satisfaction score)
</action_plan>
```

## 🎓 Training Details

- **Base Model**: Qwen/Qwen2.5-3B-Instruct (3B parameters)
- **Training Method**: LoRA + GRPO (Group Relative Policy Optimization)
- **Dataset**: [Wildstash/OrgStrategy-Reasoning-1k](https://huggingface.co/datasets/Wildstash/OrgStrategy-Reasoning-1k) (1000+ business strategy cases)
- **Training Framework**: TRL (Transformer Reinforcement Learning)
- **LoRA Configuration**: Rank 16, Alpha 32
- **Training Duration**: 2 epochs, ~4 hours on GPU
- **Cost**: ~$15 on AWS SageMaker

## 📈 Performance Metrics (self-reported)

| Metric | Value |
|--------|-------|
| **Inference Speed** | 1-2s per query (GPU), 30-60s (CPU) |
| **Output Quality** | Structured, actionable business strategies |
| **Framework Coverage** | 15+ strategic frameworks |
| **Domain Coverage** | Market entry, churn reduction, digital transformation, M&A |
| **Response Structure** | 95%+ compliance with XML format |

## 🏗️ Architecture

```
┌─────────────────────────────────────────────────────┐
│                    USER INPUT                        │
│   "Help me with market entry strategy"              │
└────────────────────┬─────────────────────────────────┘


┌─────────────────────────────────────────────────────┐
│              Business Analyst Agent                  │
│   Qwen2.5-3B + LoRA Adapters + GRPO Training       │
└────────────────────┬─────────────────────────────────┘


┌─────────────────────────────────────────────────────┐
│               Structured Output                      │
│   • Strategic Analysis                              │
│   • Framework Identification                        │
│   • Action Plan with Resources                      │
│   • Impact Assessment                               │
└─────────────────────────────────────────────────────┘
```

## 🎯 Use Cases

### 🏢 **Corporate Strategy**
- Market entry strategies
- Competitive positioning
- M&A analysis and integration
- Digital transformation planning

### 📊 **Business Analysis**
- Churn reduction strategies
- Revenue optimization
- Operational efficiency
- Performance improvement

### 🚀 **Startup Advisory**
- Go-to-market strategies
- Product-market fit analysis
- Funding strategy development
- Growth planning

### 📈 **Management Consulting**
- Strategic planning
- Organizational development
- Change management
- Process optimization

## 🔧 Technical Specifications

- **Model Size**: 3B parameters (base) + 16M parameters (LoRA)
- **Memory Usage**: ~6GB GPU RAM (inference)
- **Context Length**: 32K tokens
- **Output Format**: Structured XML with business frameworks
- **Supported Languages**: English
- **Deployment**: Local, AWS SageMaker, HuggingFace Endpoints

## 📚 Dataset Information

Trained on **Wildstash/OrgStrategy-Reasoning-1k**, a curated dataset containing:

- **1000+ business strategy scenarios**
- **15+ strategic frameworks** (Systems Thinking, Lean Analytics, Blue Ocean, etc.)
- **Real-world case studies** from various industries
- **Expert-validated responses** with structured outputs
- **Diverse business contexts** (startups, enterprises, non-profits)

### 🔎 Search keywords (for discoverability)

- corporate strategy
- decision making
- business strategy
- competitive analysis
- market analysis
- go to market
- merger and acquisition
- digital transformation
- business planning
- organizational development
- performance improvement
- management consulting

## 🚀 Deployment Options

### 1. **Local Inference** (CPU/GPU)
```bash
pip install transformers peft torch
python -c "
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model = AutoModelForCausalLM.from_pretrained('Qwen/Qwen2.5-3B-Instruct')
model = PeftModel.from_pretrained(base_model, 'Wildstash/business-analyst-agent')
tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen2.5-3B-Instruct')
"
```

### 2. **HuggingFace Inference Endpoints**
- **Instance**: GPU Medium (~$0.60/hour)
- **Setup**: 5 minutes
- **Scalability**: Auto-scaling
- **API**: RESTful endpoint

### 3. **AWS SageMaker**
- **Instance**: ml.g5.xlarge (~$1.20/hour)
- **Setup**: 30 minutes
- **Scalability**: High
- **Integration**: Native AWS services

## 🎥 Demo Video

[Link to demo video showcasing the Business Analyst Agent]

## 📊 Evaluation Results (overview)

- **Framework Accuracy**: 92% (heuristic eval on internal set)
- **Actionability**: 88% (expert-judged)
- **Structured Output**: 95% (XML compliance)
- **Business Relevance**: 90%

## 🤝 Contributing

Contributions welcome! Open issues or PRs.

## 📄 License

Apache-2.0

## 🙏 Acknowledgments

- **Base Model**: Qwen2.5-3B-Instruct by Alibaba Cloud
- **Training Framework**: TRL by Hugging Face
- **Dataset**: Wildstash/OrgStrategy-Reasoning-1k
- **Built for**: AWS AI Agent Global Hackathon

## 📞 Support

- **Discussions**: [Hugging Face Discussions](https://huggingface.co/Wildstash/business-analyst-agent/discussions)

---

**Hugging Face**: [@Wildstash](https://huggingface.co/Wildstash)

**Built with ❤️ for the AWS AI Agent Global Hackathon**