\centering
\fontsize{8pt}{6pt}\selectfont % Adjust the font size as needed
\begin{algorithmic}[1]
\LineComment{ $\mathbf{T}$: Sequence Length}
\LineComment{ $\mathbf{s}^{[1:T]}$: Sequence of States | $s^{1}, s_{2}, \ldots, s^{T}$}
\LineComment{ $\mathbf{a}^{[1:T]}$: Sequence of Actions | $a^{0}, a^{1}, \ldots, a^{T - 1}$}
\LineComment{ $\mathbf{E}_{a_{masked}}^{[1:T]}$: Sequence of Masked Action Tokens (Embeddings)}
\LineComment{ $\mathbf{I}$: Locations of Intentionally Masked Tokens.}
\LineComment{ $\mathbf{Stack}$: Stack $s^{[1:T]}$, $E_{a_{masked}}^{[1:T]}$ Sequences $\gets s^{1}, E_{a_{masked}}^{0}, s^{2}, E_{a_{masked}}^{1}, \ldots, s^{T}, E_{a_{masked}}^{T - 1}$}
\LineComment{ $\mathbf{Squeezer}$: Squeezer Network for Intermediate Context Representations}
\LineComment{ $\mathbf{ContextGPT}$: GPT2-like Transformer}
\LineComment{ $\mathbf{ContextDecoder}$: Decoder Network}
\Procedure{ContextGPTLoss}{$s^{[1:T]}$, $E_{a_{masked}}^{[1:T]}$, $a^{[1:T]}$, $I$}
    \StateComment{Project masked state into intermediate context representations.}
    \State $\mathbf{c_{s}}^{[1:T]} \gets \mathbf{Squeezer}(s_{masked}^{[1:T]})$
    \StateComment{Stack the intermediate context representations and action embeddings.}
    \State $\mathbf{c_{sa}}^{[1:T]} \gets \mathbf{Stack}(c_{s}^{[1:T]}, E_{a_{masked}}^{[1:T]})$
    \StateComment{Predict the transitions context from a sequence of intermediate context representations.}
    \State $\mathbf{c_{tr}}^{[1:T]} \gets \mathbf{ContextGPT}(c_{sa}^{[1:T]})$
    \StateComment{Initialize Context-GPT loss.}
    \State $\mathbf{loss} \gets 0$
    \StateComment{Computation of Context-GPT loss at masked locations.}
    \For{$l$ in $I$}
        \IStateComment{Retrieve the masked action at ($l$) using the context at ($l$).}
        \State $\mathbf{\hat{a}}^{[l]} \gets \mathbf{ContextDecoders}(c_{tr}^{[l]})$
        \IStateComment{Accumulate the discrepancy measure between $a^{[l]}$ and $\hat{a}^{[l]}$.}
        \State $\mathbf{loss} \gets \mathbf{loss} + \mathbf{ActionPredictionLoss}(a^{[l]}, \hat{a}^{[l]})$
    \EndFor
\EndProcedure
\end{algorithmic}