Spaces:
Running
Running
File size: 4,766 Bytes
7247224 c60aec7 7247224 e6970ed 29999bf 7247224 3ffe872 e6970ed 3ffe872 e6970ed 70b9505 e6970ed 3ffe872 e6970ed 3ffe872 29999bf | 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 | ---
title: Retro Alpha
emoji: ๐บ
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
tags:
- track:wood
- sponsor:nvidia
- sponsor:modal
- achievement:offgrid
- achievement:welltuned
- achievement:offbrand
- achievement:llama
- achievement:sharing
- achievement:fieldnotes
license: mit
---
# Retro Alpha
**A 90s CRT-style Indian stock market survival game (1994โ2004), powered by a fine-tuned NVIDIA Nemotron-3-Nano 4B model.**
Built for the [๐ค Build Small Hackathon](https://huggingface.co/build-small-hackathon).
---
## ๐ Links
| | |
|---|---|
| ๐ฎ **Play (main)** | [build-small-hackathon/retro](https://huggingface.co/spaces/build-small-hackathon/retro) |
| ๐ฎ **Play (alpha)** | [sankalphs/retro-alpha](https://huggingface.co/spaces/sankalphs/retro-alpha) |
| ๐ **Build Blog** | [sankalphs.blogspot.com/2026/06/retro-alpha.html](https://sankalphs.blogspot.com/2026/06/retro-alpha.html) |
| ๐ **GitHub** | [github.com/sankalphs/retro](https://github.com/sankalphs/retro) |
| โถ๏ธ **Video Demo** | [youtu.be/OLJDXhos0Iw](https://youtu.be/OLJDXhos0Iw) |
| ๐ฆ **Social Post** | [x.com/sankalphs/status/2066602928350359694](https://x.com/sankalphs/status/2066602928350359694) |
---
## ๐ฎ How to Play
| Step | Action |
|------|--------|
| **Goal** | Turn โน10,00,000 into โน20,00,000 over 10 years (120 months) |
| **Review** | Check the Market Watch for asset prices & trends |
| **Trade** | Buy/Sell any asset as a % of your portfolio using the Order Pad |
| **Advance** | Press Advance Month to trigger real historical events & market moves |
| **Analyze** | Ask the AI Advisor about your portfolio or strategy |
| **Review** | Get a Year-End Mentor Review for a sarcastic roast & investment lesson |
### Historical Events
Asian Financial Crisis, Pokhran-II nuclear tests, Dot-com bubble, 9/11, 2004 Indian elections, and more โ all influencing asset prices based on real historical data.
---
## ๐ Badges Earned
| Badge | How |
|-------|-----|
| **Off-Brand** | Custom CRT terminal UI built from scratch (no Gradio default) |
| **Well-Tuned** | Fine-tuned Nemotron-3-Nano 4B on 1,500+ synthetic market scenarios |
| **Nemotron** | Uses fine-tuned NVIDIA Nemotron-3-Nano-4B (Q4_K_M GGUF) |
| **Off the Grid** | Fully self-contained Docker Space with on-device inference |
| **Sharing is Caring** | Infrastructure-as-code scripts open-sourced on GitHub |
| **Field Notes** | Detailed build log & methodology documented |
---
## ๐งฑ Tech Stack
```
Frontend โ Custom CRT terminal UI (vanilla HTML/CSS/JS) served via ASGI
Backend โ Python simulation engine + Gradio API
Model โ Fine-tuned NVIDIA Nemotron-3-Nano 4B (Q4_K_M GGUF)
Inference โ Modal GPU cloud endpoint (A10G) with deterministic fallbacks
Data โ 1,500+ synthetic Indian market scenarios via zenmux API
CI/CD โ GitHub Actions โ HF Spaces auto-deploy
```
---
## ๐ Running Locally
```bash
pip install -r requirements.txt
MOCK_LLM=1 python app.py
```
For LLM-powered features, set one of:
- `MODAL_INFERENCE_URL` โ Modal cloud endpoint
- `HF_API_URL` + `HF_TOKEN` โ Hugging Face Inference API
---
## ๐ Project Structure
```
โโโ app.py # Gradio app entrypoint (ASGI)
โโโ agents.py # LLM inference wrapper
โโโ engine.py # Market simulation engine
โโโ events.py # Historical event triggers
โโโ mentor.py # AI mentor review generator
โโโ modal_app.py # Modal GPU inference endpoint
โโโ download_model.py # GGUF model downloader
โโโ Dockerfile # HF Space container
โโโ requirements.txt # Runtime dependencies
โโโ requirements-train.txt # Training dependencies
โโโ config/
โ โโโ assets.json # Asset definitions
โโโ static/ # Frontend (CSS, JS, HTML)
โโโ schemas/ # JSON schemas for dataset validation
โโโ data/ # Training datasets
โโโ scripts/ # Dataset generation & validation
โโโ training/ # Modal LoRA fine-tuning scripts
โโโ tests/ # Test suite
```
---
## ๐ง Model
The game uses a LoRA fine-tune of **NVIDIA Nemotron-3-Nano-4B** on a custom dataset of 1,500+ Indian market scenarios covering:
- **Agent decisions** (730 examples) โ institutional, retail, and tech-permabull personas
- **News impacts** (281 examples) โ historical event market reactions
- **Mentor reviews** (255 examples) โ year-end portfolio roasts with Sharpe ratios
- **Guardrails** (180 examples) โ safety and formatting guidelines
Fine-tuned on Modal A100 40GB โ exported as GGUF Q4_K_M for efficient inference.
---
## ๐ License
MIT |