Skip to content

fix(hslm): add STE gradient estimator to trainer #282

@gHashTag

Description

@gHashTag

Task

Add Straight-Through Estimator (STE) for ternary quantization gradients in src/hslm/trainer.zig.

Files

  • src/hslm/trainer.zig — add STE backward pass
  • src/hslm/ste.zig — new file with STE implementation (already exists as stub)

Details

The STE approximates gradients through the ternary quantization step function.
During forward pass: quantize to {-1, 0, +1}
During backward pass: pass gradients through unchanged (identity)

Acceptance

  • zig build passes
  • STE functions are called in trainer backward pass
  • Tests verify gradient passthrough

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions