Skip to content

Phase 2: Temperature STE + EMA shadow weights + bfloat16 (+15-25% speedup) #294

Closed

Description

@gHashTag

Task Description

Goal

Phase 2 training optimizations after Phase 1 (#293). Cumulative +15-25% speedup.

Tasks

1. Temperature-Annealed STE Quantization

  • Start with tau=5.0, anneal to tau=0.1 over training
  • Soft ternary during forward, hard ternary during inference
  • Expected: 10-15% convergence improvement

2. EMA Shadow Weights

  • Maintain exponential moving average of weights (decay=0.999)
  • Use EMA weights for evaluation/inference
  • Expected: 5-8% PPL improvement

3. bfloat16 Shadow Weights

  • Keep shadow copies in bfloat16 for gradient accumulation
  • Quantize to ternary after update step
  • Reduces memory, enables larger models

4. RMSNorm Before Linear Layers

  • From BitNet b1.58: critical for ternary network stability
  • Add RMSNorm before every linear projection

Depends on

Priority

P1 - days 3-5

Files to modify

  • src/tri-api/ (STE, EMA, optimizer)
  • src/vsa.zig (quantization, RMSNorm)

Verification steps

  1. zig build test passes
  2. Temperature annealing shows smooth loss curve
  3. EMA weights give lower eval PPL than raw weights
  4. RMSNorm stabilizes training at larger learning rates

Activity

  1. github-actions commented on Mar 12, 2026

    @github-actions
    Contributor

    🚀 Agent container spawned! Deploying on Railway. Tracking in this issue.

  2. github-actions commented on Mar 12, 2026

    @github-actions
    Contributor

    🚀 Agent container spawned! Deploying on Railway. Tracking in this issue.

  3. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent | 2026-03-12T05:56:45Z
    📋 Step: 1/8 — Authenticating with GitHub
    🔄 Status: AWAKENING
    ⏱️ Elapsed: 0s

  4. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent Dashboard — Issue #294

    Field Value
    Status AWAKENING
    Step 1/8
    Detail Authenticating with GitHub
    Elapsed 0s
    Container agent-294
    Updated 2026-03-12T05:56:45Z
  5. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent | 2026-03-12T05:56:46Z
    📋 Step: 1/8 — Authenticating with GitHub
    🔄 Status: AWAKENING
    ⏱️ Elapsed: 0s

  6. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent | 2026-03-12T05:56:47Z
    📋 Step: 1/8 — Authenticating with GitHub
    🔄 Status: AWAKENING
    ⏱️ Elapsed: 0s

  7. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent Dashboard — Issue #294

    Field Value
    Status AWAKENING
    Step 1/8
    Detail Authenticating with GitHub
    Elapsed 0s
    Container agent-294
    Updated 2026-03-12T05:56:46Z
  8. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent Dashboard — Issue #294

    Field Value
    Status AWAKENING
    Step 2/8
    Detail Creating worktree from bare repository
    Elapsed 4s
    Container agent-294
    Updated 2026-03-12T05:56:49Z
  9. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    ☠️ Trinity Agent | 2026-03-12T05:56:48Z
    📋 Step: 2/8 — Container terminated by signal
    🔄 Status: KILLED
    ⏱️ Elapsed: 1s

  10. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    ☠️ Trinity Agent | 2026-03-12T05:56:48Z
    📋 Step: 2/8 — Container terminated by signal
    🔄 Status: KILLED
    ⏱️ Elapsed: 1s

  11. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    ☠️ Trinity Agent Dashboard — Issue #294

    Field Value
    Status KILLED
    Step 2/8
    Detail Container terminated by signal
    Elapsed 1s
    Container agent-294
    Updated 2026-03-12T05:56:48Z
  12. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent Dashboard — Issue #294

    Field Value
    Status AWAKENING
    Step 2/8
    Detail Creating worktree from bare repository
    Elapsed 4s
    Container agent-294
    Updated 2026-03-12T05:56:50Z
  13. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    ☠️ Trinity Agent Dashboard — Issue #294

    Field Value
    Status KILLED
    Step 2/8
    Detail Container terminated by signal
    Elapsed 1s
    Container agent-294
    Updated 2026-03-12T05:56:48Z
  14. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    ☠️ Trinity Agent | 2026-03-12T05:56:52Z
    📋 Step: 3/8 — Container terminated by signal
    🔄 Status: KILLED
    ⏱️ Elapsed: 6s

  15. 86 remaining items

  16. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🧪 Trinity Agent | 2026-03-12T22:12:50Z
    📋 Step: 5/8 — and finally commit the message referencing the issue. number.I need to verify everything works corre
    🔄 Status: TESTING
    ⏱️ Elapsed: 738s

  17. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    💥 Trinity Agent | 2026-03-12T22:12:52Z
    📋 Step: 6/8 — if tests fail, I can diagnose and root cause by reading test output or looking at error messages.
    🔄 Status: ERROR
    ⏱️ Elapsed: 740s

  18. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🧪 Trinity Agent | 2026-03-12T22:12:55Z
    📋 Step: 7/8 — verification passes. and zig build test passes, and zig fmt src/ && zig build, to see the change
    🔄 Status: TESTING
    ⏱️ Elapsed: 743s

  19. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    💥 Trinity Agent | 2026-03-12T22:13:08Z
    📋 Step: 15/8 — and that I didn't see immediate errors or issues during this coding review that."
    🔄 Status: ERROR
    ⏱️ Elapsed: 756s

  20. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🔍 Trinity Agent | 2026-03-12T22:13:15Z
    📋 Step: 5/8 — Self-review (advisory)
    🔄 Status: REVIEWING
    ⏱️ Elapsed: 763s

  21. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🔧 Trinity Agent | 2026-03-12T22:13:19Z
    📋 Step: 6/8 — Compilation failed, auto-repair attempt 1/3
    🔄 Status: REPAIRING
    ⏱️ Elapsed: 767s

  22. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent | 2026-03-12T22:13:29Z
    📋 Step: 1/8 — Authenticating with GitHub
    🔄 Status: AWAKENING
    ⏱️ Elapsed: 0s

  23. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent Dashboard — Issue #294

    Field Value
    Status AWAKENING
    Step 1/8
    Detail Authenticating with GitHub
    Elapsed 0s
    Container agent-294
    Updated 2026-03-12T22:13:29Z
  24. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🌅 Trinity Agent Dashboard — Issue #294

    Field Value
    Status AWAKENING
    Step 2/8
    Detail Creating worktree from bare repository
    Elapsed 4s
    Container agent-294
    Updated 2026-03-12T22:13:33Z
  25. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    📖 Trinity Agent | 2026-03-12T22:13:38Z
    📋 Step: 3/8 — Reading issue #294
    🔄 Status: READING
    ⏱️ Elapsed: 9s

  26. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    📖 Trinity Agent Dashboard — Issue #294

    Field Value
    Status READING
    Step 3/8
    Detail Reading issue #294
    Elapsed 9s
    Container agent-294
    Updated 2026-03-12T22:13:38Z
  27. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    ⚡ Trinity Agent | 2026-03-12T22:13:43Z
    📋 Step: 4/8 — Claude Code running (timeout: 3600s)
    🔄 Status: CODING
    ⏱️ Elapsed: 14s

  28. gHashTag commented on Mar 12, 2026

    @gHashTag
    OwnerAuthor

    🤖 Agent: trinity-agent | 2026-03-12
    📋 Step: 1/5 — Exploring codebase and starting Phase 2 implementation
    🔄 Status: ACTING
    Thought: Need to implement 4 Phase 2 optimizations: Temperature-Annealed STE, EMA Shadow Weights, bfloat16 Shadow Weights, RMSNorm before linear layers.
    Action: Analyzed ste.zig, trainer.zig, model.zig, trinity_block.zig, constants.zig
    Result: Found existing STE implementation with vanilla/TWN/progressive modes. Training loop uses AdamW/LAMB. RMSNorm already exists in model.zig.
    Next: Implement temperature-annealed STE quantization with soft ternary forward, hard ternary inference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:spawnAuto-spawn agent containerenhancementNew feature or request

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions