tuned-lens
tuned-lens copied to clipboard
Implement first order differences of prediction trajectories
This feature will be removed in #63. It would be nice to reimplement this so that we can not only see which tokens have a high probability at each layer but directly visualize how that probability changes from layer to layer. If we denote a layer of the prediction trajectory as $p_\ell$ than this new first order difference trajectory would be:
$$\Delta p_\ell = p_{\ell+1} - p_{\ell}$$
In addition, the TrajectoryStatistic
derived from this model should not include “input” labels since it no longer make sense after the difference is preformed. This may require refactoring the way the y-axis labels are created.
The feature would function like this:
pred_traj: PredictionTrajectory
assert pred_traj.num_layers == n
diff_pred_traj: PredictionTrajectory = pred_traj.difference()
assert diff_pred_traj.num_layers == n - 1