AdmiralTaco Claude Opus 4.8 commited on
Commit
5d3de39
Β·
1 Parent(s): 751e6bb

Serve fine-tuned ttw-trader-0.5b on the Space (Well-Tuned + tinier Tiny Titan)

Browse files

- serve.py: bake TTW_MODEL/TTW_MODEL_REVISION into the image env so the chosen
model actually reaches the container (a local deploy-time env var does not
propagate into Modal on its own). Deployed with TTW_MODEL=AdmiralTaco/ttw-trader-0.5b.
- README: document the fine-tuned 0.5B (distilled from cleaned 3B traces;
0% self-buy, 100% valid offers, one-sixth the size) and link the model.
- .gitignore: ignore generated scripts/finetune/sft.jsonl.

Live endpoint verified serving the tuned model: self_buy 0%, valid_offer 100%.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (3) hide show
  1. .gitignore +3 -0
  2. README.md +7 -3
  3. serve.py +11 -1
.gitignore CHANGED
@@ -5,6 +5,9 @@
5
  # Generated trace artifact (published to a separate HF dataset, not the app repo)
6
  traces.jsonl
7
 
 
 
 
8
  __pycache__/
9
  *.pyc
10
  .pytest_cache/
 
5
  # Generated trace artifact (published to a separate HF dataset, not the app repo)
6
  traces.jsonl
7
 
8
+ # Generated fine-tuning set (built from traces; not part of the app repo)
9
+ scripts/finetune/sft.jsonl
10
+
11
  __pycache__/
12
  *.pyc
13
  .pytest_cache/
README.md CHANGED
@@ -19,13 +19,17 @@ widening wealth gap emerge on their own.
19
 
20
  ## Read more
21
  - πŸ““ **Field notes** (what I built and what I learned): [Hugging Face article](https://huggingface.co/blog/build-small/thousand-token-wood-sim) | [Medium](https://medium.com/@LesterLeong/thousand-token-wood-emergent-market-drama-from-3-billion-parameter-agents-22545d5982bf)
 
22
  - πŸ“‘ **Open agent traces** on the Hub: [dataset](https://huggingface.co/datasets/build-small-hackathon/thousand-token-wood-traces)
23
 
24
  ## Why "small" is load-bearing
25
  A living economy needs *many* agents thinking *many* times. Frontier models are
26
- too slow and costly for that. A 3B model makes a real-time multi-agent simulation
27
- possible, and that is the whole point. The agents run on **Qwen2.5-3B-Instruct**,
28
- served with vLLM on **Modal**; this Gradio app is just the window onto the wood.
 
 
 
29
 
30
  ## What you can do
31
  - **Step / Auto-run** the simulation and watch the market move.
 
19
 
20
  ## Read more
21
  - πŸ““ **Field notes** (what I built and what I learned): [Hugging Face article](https://huggingface.co/blog/build-small/thousand-token-wood-sim) | [Medium](https://medium.com/@LesterLeong/thousand-token-wood-emergent-market-drama-from-3-billion-parameter-agents-22545d5982bf)
22
+ - 🧠 **Fine-tuned model** powering the agents: [AdmiralTaco/ttw-trader-0.5b](https://huggingface.co/AdmiralTaco/ttw-trader-0.5b)
23
  - πŸ“‘ **Open agent traces** on the Hub: [dataset](https://huggingface.co/datasets/build-small-hackathon/thousand-token-wood-traces)
24
 
25
  ## Why "small" is load-bearing
26
  A living economy needs *many* agents thinking *many* times. Frontier models are
27
+ too slow and costly for that, so the whole thing runs on a **fine-tuned 0.5B
28
+ model** ([ttw-trader-0.5b](https://huggingface.co/AdmiralTaco/ttw-trader-0.5b)).
29
+ It was distilled from cleaned traces of a 3B teacher (self-buy mistakes stripped),
30
+ so a model one-sixth the size trades *more* cleanly than its teacher: zero self-buys,
31
+ 100% valid offers. Served with vLLM on **Modal**; this Gradio app is the window
32
+ onto the wood.
33
 
34
  ## What you can do
35
  - **Step / Auto-run** the simulation and watch the market move.
serve.py CHANGED
@@ -24,7 +24,17 @@ image = (
24
  "vllm==0.6.6",
25
  "huggingface_hub[hf_transfer]==0.26.2",
26
  )
27
- .env({"HF_HUB_ENABLE_HF_TRANSFER": "1", "VLLM_DO_NOT_TRACK": "1"})
 
 
 
 
 
 
 
 
 
 
28
  )
29
 
30
  # Persist the HF cache across cold starts so we download the model once.
 
24
  "vllm==0.6.6",
25
  "huggingface_hub[hf_transfer]==0.26.2",
26
  )
27
+ # Bake the chosen model into the image env so the CONTAINER sees it. A local
28
+ # `TTW_MODEL=... modal deploy serve.py` env var does NOT propagate into the
29
+ # Modal container on its own (it re-imports fresh), so capture it here.
30
+ .env(
31
+ {
32
+ "HF_HUB_ENABLE_HF_TRANSFER": "1",
33
+ "VLLM_DO_NOT_TRACK": "1",
34
+ "TTW_MODEL": MODEL,
35
+ "TTW_MODEL_REVISION": MODEL_REVISION,
36
+ }
37
+ )
38
  )
39
 
40
  # Persist the HF cache across cold starts so we download the model once.