Skip to content

feat(tui): phase-aware chart (per-phase autoscale at checkpoints) + events.jsonl in file mode - #123

Closed
vxfemboy wants to merge 5 commits into
mainfrom
emry-phase-chart
Closed

feat(tui): phase-aware chart (per-phase autoscale at checkpoints) + events.jsonl in file mode#123
vxfemboy wants to merge 5 commits into
mainfrom
emry-phase-chart

Conversation

@vxfemboy

Copy link
Copy Markdown
Member

Curriculum training cycles through phases with different loss scales (reasoning ~1.0, personality ~2.5, …), so one shared y-axis makes a healthy run look like it diverges at every phase transition. This makes the chart phase-aware.

Two parts

  1. events.jsonl in file mode (EventLogTailer). emry watch --run-dir only tailed metrics.jsonl, so checkpoints/phase-changes/alerts/metric-names never showed in file mode. Now polled alongside metrics — checkpoint markers finally appear in file mode, and they're the source of phase boundaries.
  2. Per-segment autoscale chart. Split the x-axis at checkpoint steps, scale each segment to its own range, connected sub-curves with a labeled title (labels from the checkpoint path: reasoning │ knowledge │ current). chart::render_braille_segments + Segment; ui::Checkpoint{step,label} + build_segments. Baseline overlay omitted in segmented mode (can't share per-segment scales).

Verified against the real kitby-v2 run at 150×40 — each phase renders as its own readable curve instead of one mangled cumulative mess.

Notes

Gate green (fmt, clippy, tests, ≥90% coverage).

vxfemboy added 5 commits July 30, 2026 00:17
The chart set its y-axis to the union of the live curve and the
--compare baseline. A baseline with a much larger range (e.g. prior-run
loss 0.001..5.5 vs a current run at 0.6..2.0) crushed the live curve into
a thin band and filled the panel with the baseline's noise — the live
line looked broken/scattered, and sparse series (val_loss, 4 pts) became
invisible.

Now the y-axis scales to the live curve's own range; the baseline is
drawn only where it overlaps that range (off-scale points hidden, not
clamped to the border), and the title says 'baseline off-scale' when the
whole baseline is out of range. Adds chart_yscale + unit tests using the
real-world value shapes.
The real cause of the 'broken' chart: per-step training loss is very
noisy (oscillates across its full range every step), and the chart
plotted every raw point via a spike-preserving min/max band, so it
rendered as confetti filling the panel. Verified against the user's
actual run (loss bounces 0.6..2.0 step-to-step).

Now the displayed curve is an EMA trend line (adaptive span ~8% of the
visible points, clamped 3..64) — like wandb/tensorboard. Baseline is
smoothed the same way for a like-for-like overlay. Adds ema_smooth +
adaptive_ema_span with tests.

Combined with the prior commit (scale to the live curve, hide off-scale
baseline), the loss/val_loss charts render as clean lines again.
The real cause of the 'confetti' chart: the renderer placed each column's
point independently (min/max per step-column + flat carry-forward) and
never joined consecutive points. At low panel heights adjacent points
land close so it looked connected; at tall heights the step-to-step
wiggle spreads points across many rows -> disconnected dots = confetti.
Reproduced from the user's real run rendered at 150x40 (live curve alone
was already confetti, so it was neither the baseline nor the y-scale).

Now render_braille_steps_scaled interpolates a value at each dot column
and bridges it to the previous column's row, drawing a continuous line
(interp_at helper). Verified against the real data at 150x40: a connected
descending curve instead of scatter. Smoothing (EMA) still applies on top.
emry watch --run-dir only tailed metrics.jsonl, so the file-mode
dashboard never saw checkpoints, phase/stage changes, alerts, or the
metric-name table. Add EventLogTailer (same offset-polling as the metric
tailer, parses each line as an Event) and poll it alongside metrics in
spawn_run_dir_tailer. Checkpoint markers now appear in file mode, and
this is the source of phase boundaries for the upcoming segmented chart.
Curriculum runs cycle through phases with different loss scales, so one
shared y-axis makes a healthy run look like it diverges at each phase
transition. Now the chart splits the x-axis at checkpoint steps (which
mark phase boundaries) and scales each segment to its OWN range, drawn as
connected sub-curves with a labeled title (labels from the checkpoint
path, e.g. 'reasoning | knowledge | current').

- chart::render_braille_segments + Segment (per-segment scale, breaks the
  line at boundaries for a visual divider).
- ui: Checkpoint{step,label} (was bare step) + checkpoint_label() +
  build_segments(); render_chart segments when checkpoints split the
  window, else the single-scale path. Baseline overlay omitted in
  segmented mode (can't share per-segment scales).

Verified against the real kitby-v2 run at 150x40: reasoning|knowledge|
current segments each render as their own readable curve. Builds on the
connected-line renderer (#122) and the events.jsonl tailer.
@vxfemboy

Copy link
Copy Markdown
Member Author

Landed on main via v0.2.2 (rebased onto canonical vxug main as commits d2c49f2 / c7fafb2 / 84e0756 / a77c5a3 / 62980b4). Closing this GitHub-side PR; the work is shipped.

@vxfemboy vxfemboy closed this Jul 30, 2026
@vxfemboy
vxfemboy deleted the emry-phase-chart branch July 30, 2026 22:31
vxfemboy added a commit that referenced this pull request Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant