File size: 1,394 Bytes
9c7d316
eaeee8b
9c7d316
 
 
 
 
 
 
 
 
8ad5054
 
647e1be
9c7d316
 
eaeee8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Stock Prediction Explanation
emoji: πŸ’¬
colorFrom: yellow
colorTo: purple
sdk: gradio
sdk_version: 5.42.0
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_scopes:
- inference-api
license: apache-2.0
short_description: AI that predicts stock moves from news and explains why
---

# Explainable Stock Prediction with GRPO + RAG

---

## About this Space  
This demo showcases a **financial NLP model** that predicts stock market reactions to news events while also providing a **natural language explanation**.  

Unlike standard classifiers (which only output UP/DOWN/NEUTRAL), this model combines:  
- **GRPO (Group Relative Policy Optimization)** β†’ reinforcement learning to refine predictions through self-reflection.  
- **RAG (Retrieval-Augmented Generation)** β†’ retrieving past financial events to ground explanations in historical context.  

The result: **predictions that are both accurate and interpretable**.

---

## How it works  
1. **Input** β†’ A financial news headline or event description.  
2. **GRPO loop** β†’ The model generates a prediction and, if wrong, reflect to improve future reasoning.  
3. **RAG retrieval** β†’ Relevant historical events are retrieved to enrich the explanation.  
4. **Output** β†’  
   - Chosen Stock  
   - Price Prediction (UP/DOWN or percentage change)  
   - Explanation (short and clear, grounded in past events)

---