Spaces:
Running
Running
| 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 |