fix(tui): smooth noisy chart curves (EMA) + scale to the live run - #122
Merged
Conversation
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.
vxfemboy
added a commit
that referenced
this pull request
Jul 30, 2026
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
added a commit
that referenced
this pull request
Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
TUI loss/val_loss charts render as scattered confetti (or invisible), not a readable line — worse with a
--comparebaseline.Root cause (reproduced from the user's real run over SSH)
Two issues, in priority order:
1.44, 0.65, 1.12, 0.86, 0.71…). The chart plotted every raw point via a spike-preserving min/max band, so the noise filled the whole panel as confetti.Fix
ema_smooth,adaptive_ema_span+ tests.)chart_yscale+ tests.)Verified locally against the actual run data: raw = confetti (matches the report), EMA = clean descending line. Full rust gate green (fmt, clippy, tests, ≥90% coverage).