Hyperparam delivery: env vars vs compile-time constants #30

Closed
opened 2026-08-17 19:48:25 +02:00 by SirStone · 1 comment
Owner

Parent: #29

Question

How should tunable hyperparameters be delivered to PPO_Bot at runtime?

Options:

  1. Env vars — LLM sets env, restarts PPO_Bot. No recompile, no syntax-error risk, faster iteration cycle (~1s restart vs ~5s compile+restart). Downside: boilerplate env-var parsing in Nim at startup.
  2. Compile-time constants — LLM edits source, recompiles, restarts. User said "compile is ok." Downside: slower cycle, risk of introducing syntax errors, LLM needs to know exact file locations.
  3. Config file (JSON/TOML) — middle ground, no recompile, structured. Downside: adds a parser dependency or manual parsing.

Context:

  • The "easy" hyperparams (lr, clipEpsilon, entropyCoeff, epochs, miniBatchSize, gamma, lam, maxGradNorm) are all default function arguments in training.nim — straightforward to override from any source.
  • The LLM supervisor will run unsupervised, so compile errors from source editing are a real risk.
  • PPO_Bot is Nim — getEnv() / parsefloat() are stdlib, zero deps.
Parent: #29 ## Question How should tunable hyperparameters be delivered to PPO_Bot at runtime? **Options:** 1. **Env vars** — LLM sets env, restarts PPO_Bot. No recompile, no syntax-error risk, faster iteration cycle (~1s restart vs ~5s compile+restart). Downside: boilerplate env-var parsing in Nim at startup. 2. **Compile-time constants** — LLM edits source, recompiles, restarts. User said "compile is ok." Downside: slower cycle, risk of introducing syntax errors, LLM needs to know exact file locations. 3. **Config file** (JSON/TOML) — middle ground, no recompile, structured. Downside: adds a parser dependency or manual parsing. **Context:** - The "easy" hyperparams (lr, clipEpsilon, entropyCoeff, epochs, miniBatchSize, gamma, lam, maxGradNorm) are all default function arguments in `training.nim` — straightforward to override from any source. - The LLM supervisor will run unsupervised, so compile errors from source editing are a real risk. - PPO_Bot is Nim — `getEnv()` / `parsefloat()` are stdlib, zero deps.
SirStone added the wayfinder:grilling label 2026-08-17 19:48:25 +02:00
Author
Owner

Resolution

Decision: flat env vars with stdlib defaults.

  • Delivery mechanism: environment variables, one per hyperparameter
  • Prefix + naming: PPOB_ + SCREAMING_SNAKE (PPOB_LR, PPOB_CLIP_EPSILON, PPOB_ENTROPY_COEFF, PPOB_EPOCHS, PPOB_MINI_BATCH_SIZE, PPOB_GAMMA, PPOB_LAM, PPOB_MAX_GRAD_NORM)
  • Each param has a sensible default hardcoded in Nim; getEnv + parseFloat from stdlib, zero deps
  • LLM supervisor sets env vars and restarts — no recompile, no syntax-error risk in unsupervised runs

Rejected alternatives:

  • Compile-time constants: syntax-error risk in unsupervised LLM editing
  • Config file (JSON/TOML): adds parser dependency for no gain over flat env vars
## Resolution **Decision: flat env vars with stdlib defaults.** - Delivery mechanism: environment variables, one per hyperparameter - Prefix + naming: `PPOB_` + SCREAMING_SNAKE (`PPOB_LR`, `PPOB_CLIP_EPSILON`, `PPOB_ENTROPY_COEFF`, `PPOB_EPOCHS`, `PPOB_MINI_BATCH_SIZE`, `PPOB_GAMMA`, `PPOB_LAM`, `PPOB_MAX_GRAD_NORM`) - Each param has a sensible default hardcoded in Nim; `getEnv` + `parseFloat` from stdlib, zero deps - LLM supervisor sets env vars and restarts — no recompile, no syntax-error risk in unsupervised runs Rejected alternatives: - Compile-time constants: syntax-error risk in unsupervised LLM editing - Config file (JSON/TOML): adds parser dependency for no gain over flat env vars
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SirStone/SirRoboGarage#30