Skip to content

Logit Lens

Plotly visualization for LogitLens results.

Renders the standard logit-lens heatmap: rows are layers, columns are input token positions, cell values are the argmax probability at that (layer, position), and cell text is the predicted token.

Requires the plot extra (install with pip install murano-interp[plot]).

def plot_logit_lens(result: LogitLensResult, input_index: int = 0, title: str = 'Logit Lens', color_scale: str = 'RdYlBu_r') -> go.Figure:

Render a logit-lens heatmap for a single input.

Args:

  • result: LogitLensResult produced by the LogitLens step.
  • input_index: Which prompt to plot (default: first).
  • title: Plot title.
  • color_scale: Plotly colorscale name. Defaults to "RdYlBu_r" to
  • match the conventional logit-lens visualization.

Returns:

  • A plotly.graph_objects.Figure with a heatmap trace; cell text
  • shows the predicted token at each (layer, position).