Skip to content

feat(hslm): [I] Ternary 3-Phase LR Schedule — φ-decaying cycles #338

Description

@gHashTag

Parent: #329 — Fully Ternary Transformer

Level 0 (no dependencies) | ~60 LOC | New: src/hslm/ternary_schedule.zig

Description

3-phase learning rate schedule (warmup/cruise/cooldown) repeated 3 times with φ-decaying max LR: cycle 1 = max_lr, cycle 2 = max_lr × 0.618, cycle 3 = max_lr × 0.382.

Implementation

  • TernarySchedule.getLR(step: u64, total: u64) → f32 — 3 phases × 3 cycles = 9 transitions
  • getLRDecaying(step: u64, total: u64, max_lr: f32) → f32 — with φ^(-cycle) decay
  • Phase boundaries: warmup 10%, cruise 60%, cooldown 30% per cycle

tri CLI

tri hslm lr-schedule

Tests

  • 9 transitions: correct phase at each boundary
  • LR bounds: never > max_lr, never < 0
  • Decaying sum: cycle2_total < cycle1_total (by φ ratio)

Blocks

  • Issue L (Integration — trainer.zig uses ternary schedule)

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions