TensorBoard
summary
updating issues
troubleshooting
machine learning

Why TensorBoard summary is not updating?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

When TensorBoard looks frozen, the problem is usually not TensorBoard itself. In most cases the event files are not being written, they are being written to a different log directory, or the summaries are missing a proper step value.

How TensorBoard Sees Your Data

TensorBoard watches event files inside the log directory you point it at. Those files are produced by your training process, not by TensorBoard. If the files stop changing, the UI has nothing new to display.

In TensorFlow 2.x, the modern workflow is based on tf.summary.create_file_writer. A writer must be active when you call summary functions, and the writer must eventually flush its buffered data to disk.

A minimal working example looks like this:

python
1from pathlib import Path
2import tensorflow as tf
3
4logdir = Path("logs/manual")
5writer = tf.summary.create_file_writer(str(logdir))
6
7for step in range(5):
8    loss = 1.0 / (step + 1)
9    with writer.as_default():
10        tf.summary.scalar("training_loss", loss, step=step)
11    writer.flush()
12
13print("Event files written to", logdir)

If you run that script and then start TensorBoard against logs, the scalar should appear. That makes it a good baseline when debugging a larger training loop.

The Most Common Causes

Missing or Wrong Step Values

TensorBoard organizes time-series data by step. If every write uses the same step, the graph appears stuck because newer points overwrite the same location. If the step jumps backward, the plots can look inconsistent.

In manual logging code, always pass a monotonically increasing step. In Keras callback-based training, that step management is handled for you.

Not Flushing the Writer

Summary writers buffer output for efficiency. During a short training run, you may not see new points immediately unless the writer flushes. Calling writer.flush() during debugging removes that uncertainty.

Logging to the Wrong Directory

This is more common than most people expect. The training script might write to runs/exp_03, while TensorBoard is pointed at runs/exp_02 or a parent directory that does not include the current run. Use absolute paths when you want to remove ambiguity.

Reusing Old Event Files

When several experiments write to the same directory, TensorBoard mixes their history. That can look like stale data or a graph that refuses to reset. A timestamped log directory per run is a better default.

Keras Callback Example

If you train with model.fit, the simplest route is usually the built-in callback.

python
1import numpy as np
2import tensorflow as tf
3
4X = np.random.randn(128, 4).astype("float32")
5y = (X.sum(axis=1) > 0).astype("float32")
6
7model = tf.keras.Sequential(
8    [
9        tf.keras.layers.Input(shape=(4,)),
10        tf.keras.layers.Dense(8, activation="relu"),
11        tf.keras.layers.Dense(1, activation="sigmoid"),
12    ]
13)
14model.compile(optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"])
15
16callback = tf.keras.callbacks.TensorBoard(log_dir="logs/keras", update_freq="batch")
17model.fit(X, y, epochs=2, batch_size=16, callbacks=[callback], verbose=0)

This approach avoids many manual writer mistakes. If summaries still do not appear, the issue is more likely to be log directory selection or how TensorBoard is launched.

A Practical Debugging Checklist

Work through the pipeline in order:

  1. Confirm that event files are being created under the expected directory.
  2. Confirm that file modification times are changing during training.
  3. Confirm that your summary calls run inside an active writer context.
  4. Confirm that the step value increases.
  5. Flush the writer during testing.
  6. Start TensorBoard on the exact log path you just inspected.

That sequence usually isolates the failure quickly.

Common Pitfalls

One common pitfall is mixing TensorFlow 1.x and 2.x summary code. Legacy FileWriter patterns and graph-mode assumptions often produce confusing results in modern code.

Another pitfall is launching TensorBoard once and forgetting that a notebook or script later switched to a different log directory. The UI may be fine while the path is wrong.

A third issue is browser caching or plugin sampling. In large runs, TensorBoard may downsample displayed steps for readability. That can make the update rate look slower than the actual write rate.

Summary

  • TensorBoard only shows what your training process has actually written to event files.
  • In TensorFlow 2.x, use tf.summary.create_file_writer or the Keras TensorBoard callback.
  • Always check the active log directory and step values first.
  • Flush the writer when debugging short runs.
  • Isolate problems with a tiny known-good example before blaming the full training loop.

Course illustration
Course illustration

All Rights Reserved.