% Self-authored research presentation based on arXiv:2610.11287v1.
% Build: python3 build_slides.py slides.en.tex
\documentclass[aspectratio=169,11pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,graphicx,booktabs}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,calc}

\definecolor{AcademicBlue}{RGB}{26,57,86}
\definecolor{AcademicTeal}{RGB}{0,105,112}
\definecolor{MutedPurple}{RGB}{123,101,166}
\setbeamercolor{structure}{fg=AcademicBlue}
\setbeamercolor{frametitle}{fg=AcademicBlue,bg=white}
\setbeamercolor{title}{fg=AcademicBlue}
\setbeamercolor{alerted text}{fg=AcademicTeal}
\setbeamercolor{block title}{fg=white,bg=AcademicBlue}
\setbeamercolor{block body}{fg=black,bg=AcademicBlue!5}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{itemize items}[circle]
\setbeamertemplate{footline}{%
  \hfill\usebeamerfont{page number in head/foot}%
  \insertframenumber\,/\,\inserttotalframenumber\hspace{4mm}\vspace{3mm}}
\setbeamersize{text margin left=8mm,text margin right=8mm}
\setbeamerfont{frametitle}{size=\Large,series=\bfseries}
\setbeamerfont{title}{size=\LARGE,series=\bfseries}
\newcommand{\papersource}[1]{\par\medskip{\scriptsize\color{gray}#1\par}}
\newcommand{\remory}{\textsc{Remory}}
\newcommand{\KL}{D_{\mathrm{KL}}}
\setlength{\tabcolsep}{7pt}
\renewcommand{\arraystretch}{1.22}

\title[REMORY]{REMORY: Learning Residual Memory\\for Context Compaction}
\subtitle{Research paper discussion \;|\; 20--30 minutes}
\author[]{\small Paper authors: Hanchen Xia, Baoyou Chen, Yutang Ge, Naihao Deng,\\
Senqiao Yang, Zilong Dong, Weihao Yuan, and Siyu Zhu}
\date{\small arXiv:2610.11287v1 \;|\; Submitted October 8, 2026\\
Reading prepared October 13, 2026}

\begin{document}

% 1
\begin{frame}
  \titlepage
  \vspace{-3mm}
  \begin{center}
  \color{AcademicTeal}\normalsize
  Keep the summary; learn a continuous supplement for future decisions.
  \end{center}
\end{frame}

% 2
\begin{frame}{A readable checkpoint can lose future decision cues}
  \begin{block}{The problem}
    An agent must compact its history before it knows which details
    will matter later.
  \end{block}
  \medskip
  \begin{itemize}
    \item A summary retains the main thread of a task.
    \item Source associations and earlier tool feedback can become useful later.
    \item Exact records can still be retrieved through ordinary tools.
  \end{itemize}
  \medskip
  \alert{Research question:} can a learned, bounded supplement preserve
  useful access to history across compactions?
  \papersource{Paper, Sec. 1, PDF pp. 1--2.}
\end{frame}

% 3
\begin{frame}{The summary conditions the memory that follows it}
  \centering
  \begin{tikzpicture}[
      box/.style={draw=AcademicBlue,rounded corners=2pt,fill=AcademicBlue!4,
        minimum height=8mm,text width=37mm,align=center,font=\normalsize},
      flow/.style={-{Latex[length=2mm]},thick,draw=AcademicBlue}]
    \node[box] (history) at (-3.4,2.0) {Current history $H_i$};
    \node[box] (summary) at (-3.4,0.55) {Text summary $S_i$};
    \node[box,fill=AcademicTeal!9] (memory) at (3.4,0.55)
      {Memory network\\$M_i=\mathcal C_\phi(H_i;S_i)$};
    \node[box,text width=56mm] (actor) at (0,-1.0)
      {Frozen actor reads $[S_i;M_i]$};
    \node[box] (action) at (0,-2.25) {Next action};
    \draw[flow] (history) -- node[left,font=\small] {compact} (summary);
    \draw[flow] (history.east) -| (memory.north);
    \draw[flow] (summary.east) -- node[above,font=\small] {condition} (memory.west);
    \draw[flow] (summary.south) |- (actor.west);
    \draw[flow] (memory.south) |- (actor.east);
    \draw[flow] (actor) -- (action);
  \end{tikzpicture}
  \papersource{Schematic redrawn from Fig. 3(a,b), PDF p. 3. Persistent instructions and ordinary archive tools omitted from the diagram.}
\end{frame}

% 4
\begin{frame}{Memory is a sequence of actor-input vectors}
  \[
    M_i=\mathcal C_\phi(H_i;S_i),\qquad |M_i|\leq m,
    \qquad m=4{,}096.
  \]
  \begin{itemize}
    \item $H_i$: previous summary and memory, plus new interaction.
    \item $S_i$: the new textual summary at compaction boundary $i$.
    \item $M_i$: continuous vectors appended after the summary.
  \end{itemize}
  \medskip
  \begin{block}{A recurrent state across compaction boundaries}
    The next history includes the new summary, new memory, and subsequent
    interaction. The same process repeats.
  \end{block}
  \smallskip
  The residual is a \alert{predictive supplement along the sequence dimension}.
  \papersource{Paper, Sec. 2.1, Eq. (1), PDF p. 3.}
\end{frame}

% 5
\begin{frame}{Block compression bounds the final memory}
  \begin{center}
    \large Up to 1,024 source positions $\longrightarrow$ 64 soft tokens
  \end{center}
  \begin{itemize}
    \item Frozen actor features and learned queries predict vectors in parallel.
    \item Gated cross-attention makes construction summary-dependent.
    \item Hierarchical compression preserves source order and caps final slots.
  \end{itemize}
  \medskip
  \centering
  \begin{tabular}{lll}
    \toprule
    Actor & Memory architecture & Trainable parameters\\
    \midrule
    Qwen3.8-27B & Adapted DFlash & 1.94B\\
    GLM-5.3-Flash & Adapted DFlash-2 & 1.502B\\
    \bottomrule
  \end{tabular}
  \par\medskip
  \raggedright
  Source encoding and intermediate representations can exceed the final cap.
  \papersource{Paper, Sec. 2.1, PDF p. 3. DFlash-2 includes grouped dynamic convolutions.}
\end{frame}

% 6
\begin{frame}{Stage I teaches the frozen actor to read soft memory}
  \begin{columns}[T,onlytextwidth]
    \begin{column}{0.47\textwidth}
      \begin{block}{Teacher context}
        Source passage\\[2mm]
        + instruction to repeat it
      \end{block}
    \end{column}
    \begin{column}{0.47\textwidth}
      \begin{block}{Student context}
        Soft memory of the passage\\[2mm]
        + the same instruction
      \end{block}
    \end{column}
  \end{columns}
  \medskip
  \begin{itemize}
    \item Both predict the source text using the same frozen actor.
    \item Only the memory network learns to preserve source information.
    \item Data: text fields from MMFineReason-Full-2.3M.
  \end{itemize}
  \papersource{Paper, Sec. 2.2, PDF p. 4.}
\end{frame}

% 7
\begin{frame}{Stage II learns a supplement for continuation}
  \begin{columns}[T,onlytextwidth]
    \begin{column}{0.47\textwidth}
      \begin{block}{Teacher context}
        Original interaction history
      \end{block}
    \end{column}
    \begin{column}{0.47\textwidth}
      \begin{block}{Student context}
        Fixed summary + residual memory
      \end{block}
    \end{column}
  \end{columns}
  \medskip
  \begin{itemize}
    \item Both predict the \alert{same subsequent assistant response}.
    \item The memory encoder never sees that future response.
    \item Initialize from Stage I; order examples by preceding-context length.
  \end{itemize}
  \medskip
  Reasoning and coding trajectories include Open-PerfectBlend prompts,
  precomputed summaries, and Qwen-generated responses.
  \papersource{Paper, Sec. 2.2, PDF p. 4.}
\end{frame}

% 8
\begin{frame}{Reverse KL trains the interface through a frozen actor}
  \begin{align*}
    p_j &= p_\theta(\cdot\mid C_{\mathrm{full}},y_{<j}),\\
    q_j &= p_\theta(\cdot\mid C_{\mathrm{mem}},y_{<j}),\\[1mm]
    \mathcal L(\phi)&=\frac{\sum_j w_j\KL(q_j\Vert p_j)}{\sum_j w_j}.
  \end{align*}
  \begin{itemize}
    \item Same target prefix $y_{<j}$; full-vocabulary distributions $p_j,q_j$.
    \item Positive $w_j$ mildly emphasize early response positions.
    \item Update memory parameters $\phi$; keep actor parameters $\theta$ fixed.
  \end{itemize}
  \medskip
  Summary content can overlap with memory: the objective rewards
  matching future predictions.
  \papersource{Paper, Sec. 2.2, Eqs. (2)--(3), PDF p. 4. All contexts include persistent instructions.}
\end{frame}

% 9
\begin{frame}{Reconstruction initialization helps residual optimization}
  \begin{columns}[T,onlytextwidth]
    \begin{column}{0.47\textwidth}
      \centering
      \includegraphics[width=\linewidth,height=35mm,keepaspectratio]{figures/fig-03c-reconstruction.pdf}
    \end{column}
    \begin{column}{0.47\textwidth}
      \centering
      \includegraphics[width=\linewidth,height=35mm,keepaspectratio]{figures/fig-03d-residual.pdf}
    \end{column}
  \end{columns}
  \medskip
  \begin{itemize}
    \item Axes: training step and teacher--student top-1 agreement.
    \item Right panel: same residual objective and data order, different initialization.
    \item These are training-stream diagnostics; the two panels use different tasks.
  \end{itemize}
  \papersource{Paper, Fig. 3(c,d), PDF p. 3. Original vector panels, cropped with axes and legends retained.}
\end{frame}

% 10
\begin{frame}{Evaluation separates representation from agent behavior}
  \begin{tabular}{p{31mm}p{41mm}p{57mm}}
    \toprule
    Evaluation & Scale & What is controlled?\\
    \midrule
    SummHay & 92 queries, 10 collections & Same actor, query, summary, decoding; no retrieval\\
    Agent tasks & 4 benchmarks & Same actor, harness, tools, budgets, compaction policy\\
    Next action & 488 pairs from 100 trajectories & Same prompt and summary at the checkpoint\\
    \bottomrule
  \end{tabular}
  \medskip
  \begin{itemize}
    \item Agent runs allow exact-history retrieval in both conditions.
    \item Context windows: Qwen 262,144; GLM one million positions.
    \item Agent intervention: add up to 4,096 residual slots at compaction.
  \end{itemize}
  \papersource{Paper, Secs. 3.1--3.3, PDF pp. 4--6. Equal-position extra-text control is in SummHay.}
\end{frame}

% 11
\begin{frame}{SummHay gains are concentrated in source attribution}
  {\small Coverage measures insight recovery; citation F1 measures source attribution.\par}
  \smallskip
  \centering
  \begin{tabular}{lrrr}
    \toprule
    Representation & Coverage & Citation F1 & Joint score\\
    \midrule
    Raw context & 72.46 & 56.60 & 43.41\\
    Summary & 67.55 & 56.98 & 39.84\\
    Summary++ & 67.52 & 56.94 & 39.78\\
    Summary + \remory & 67.95 & \textbf{61.03} & \textbf{43.39}\\
    \bottomrule
  \end{tabular}
  \par\medskip\raggedright
  \begin{itemize}
    \item Summary++ adds generated text under the same extra-position budget.
    \item Reported gains: coverage +0.40; citation F1 +4.04; joint +3.55 points.
    \item Joint gain: paired collection-bootstrap 95\% interval $[+0.74,+6.21]$.
  \end{itemize}
  \papersource{Table 1 and Sec. 3.1, PDF pp. 4--5. Higher is better. Gains use unrounded values; the interval is conditional on generated and judged outputs.}
\end{frame}

% 12
\begin{frame}{Near-full joint score with 5.2\% of input positions}
  \centering
  \begin{tabular}{lrr}
    \toprule
    Representation & Mean input positions & Joint score\\
    \midrule
    Raw context & 96,872 & 43.41\\
    Summary & 1,393 & 39.84\\
    Summary + \remory & 5,024 & 43.39\\
    \bottomrule
  \end{tabular}
  \par\medskip
  \[
    \frac{5{,}024}{96{,}872}\approx 5.19\%
  \]
  \raggedright
  \begin{itemize}
    \item Relative to raw context: coverage is lower; citation F1 is higher.
    \item On 553 jointly covered insights, citation F1 rises 57.31 $\to$ 61.41.
    \item This pattern supports better links between recovered claims and evidence.
  \end{itemize}
  \papersource{Paper, Sec. 3.1, PDF p. 5. The position count includes summary and memory; it is not a measured speedup.}
\end{frame}

% 13
\begin{frame}{Workflow gains persist across five runs}
  \centering
  \begin{tabular}{lrrr}
    \toprule
    Qwen3.8-27B & Without memory & With memory & Gain\\
    \midrule
    AutomationBench & $35.5\pm1.3$ & $45.3\pm1.0$ & +9.8\\
    JobBench & $33.4\pm1.25$ & $41.0\pm1.41$ & +7.6\\
    \bottomrule
  \end{tabular}
  \par\bigskip\raggedright
  \begin{itemize}
    \item AutomationBench: 600 tasks, scored by task verifiers.
    \item JobBench: 65 tasks, evaluated by matched GPT-5.6-Sol judges.
    \item Values are mean $\pm$ standard deviation over five runs.
  \end{itemize}
  \papersource{Paper, Table 2 and Sec. 3.2, PDF p. 5. Scores are benchmark-specific; gains are score points.}
\end{frame}

% 14
\begin{frame}{A stronger actor with a larger window also benefits}
  \centering
  \begin{tabular}{llrrr}
    \toprule
    Actor & Benchmark & Without & With & Gain\\
    \midrule
    Qwen3.8-27B & Terminal-Bench 2.1 & 71.9 & 76.4 & +4.5\\
    Qwen3.8-27B & BrowseComp & 74.0 & 77.0 & +3.0\\
    GLM-5.3-Flash & Terminal-Bench 2.1 & 84.3 & 87.6 & +3.3\\
    GLM-5.3-Flash & BrowseComp & 84.9 & 89.0 & +4.1\\
    \bottomrule
  \end{tabular}
  \par\bigskip\raggedright
  \begin{itemize}
    \item Full task sets: 89 Terminal-Bench tasks; 1,266 BrowseComp tasks.
    \item One run per configuration for both actors.
    \item Published frontier references in Fig. 1 use different harnesses and protocols.
  \end{itemize}
  \papersource{Paper, Table 3, PDF p. 5; Fig. 1, PDF p. 2. Scores are percentages; gains are percentage points.}
\end{frame}

% 15
\begin{frame}{Repeated outputs and tool errors both decrease}
  \centering
  \begin{tabular}{llrr}
    \toprule
    Actor & Benchmark & Fewer repeats & Fewer errors\\
    \midrule
    Qwen & Terminal-Bench 2.1 & 17.9\% & 39.1\%\\
    Qwen & BrowseComp & 29.8\% & 49.7\%\\
    GLM & Terminal-Bench 2.1 & 28.1\% & 25.3\%\\
    GLM & BrowseComp & 29.8\% & 27.8\%\\
    \bottomrule
  \end{tabular}
  \par\medskip\raggedright
  \begin{itemize}
    \item Repeats: identical outputs from the same tool within a task;
      planning and polling excluded.
    \item Errors: failed commands or explicit tool errors.
    \item These are aggregate counts; trajectory lengths and actions also differ.
  \end{itemize}
  \papersource{Calculated from Table 3, PDF p. 5, as (without $-$ with)/without. Definitions: Sec. 3.2, PDF pp. 5--6.}
\end{frame}

% 16
\begin{frame}{Generation spend usually falls; total cost is unmeasured}
  \centering
  \begin{tabular}{lrrr}
    \toprule
    Actor / benchmark & Without & With & Change\\
    \midrule
    Qwen / AutomationBench & \$0.59 & \$0.53 & $-10.2\%$\\
    Qwen / JobBench & \$3.09 & \$3.21 & $+3.9\%$\\
    Qwen / Terminal-Bench & \$4.29 & \$2.86 & $-33.3\%$\\
    Qwen / BrowseComp & \$5.39 & \$4.69 & $-13.0\%$\\
    GLM / Terminal-Bench & \$3.27 & \$3.05 & $-6.7\%$\\
    GLM / BrowseComp & \$5.65 & \$5.00 & $-11.5\%$\\
    \bottomrule
  \end{tabular}
  \par\medskip\raggedright
  Mean API-equivalent USD per task, using September 2026 uncached rates.\\
  Residual positions count as actor input; source encoding, memory-network
  execution, and tools are excluded.
  \papersource{Paper, Tables 2--3, PDF p. 5; cost definition, PDF p. 6. Percentage changes calculated from reported costs.}
\end{frame}

% 17
\begin{frame}{With the checkpoint fixed, next actions are preferred}
  \centering
  \begin{tabular}{lrr}
    \toprule
    Residual action & Count & Share of all pairs\\
    \midrule
    \textcolor{AcademicTeal}{Win} & \textbf{345} & \textbf{70.7\%}\\
    Tie & 21 & 4.3\%\\
    Loss & 122 & 25.0\%\\
    \bottomrule
  \end{tabular}
  \par\bigskip\raggedright
  \begin{itemize}
    \item 488 paired next actions from 100 Qwen BrowseComp trajectories.
    \item Fixed prompt and summary; anonymized GPT-5.6-Sol comparison.
    \item Candidate reasoning withheld; counterfactual calls not executed.
  \end{itemize}
  \medskip
  \alert{Outcome measured:} judged quality of a proposed next action.
  \papersource{Paper, Sec. 3.3, PDF p. 6. Criteria were fixed from preceding history.}
\end{frame}

% 18
\begin{frame}{Fewer total compactions accompany fewer responses}
  \centering
  \includegraphics[width=0.94\linewidth,height=37mm,keepaspectratio]{figures/fig-04-trading.pdf}
  \par\medskip\raggedright
  \begin{itemize}
    \item Paper-trading responses: 5,336 $\to$ 3,013; compactions: 56 $\to$ 45.
    \item Per 1,000 responses, compactions rise: 10.5 $\to$ 14.9.
    \item The trace and interval statistics describe different time ranges.
  \end{itemize}
  \papersource{Paper, Fig. 4 and Sec. 3.4, PDF p. 6. Left: Sept. 22 trace. Right: Sept. 20--23 within-session intervals; two residual intervals lie above the plot range but enter the statistics.}
\end{frame}

% 19
\begin{frame}{The repair case combines memory with file retrieval}
  \begin{columns}[c,onlytextwidth]
    \begin{column}{0.43\textwidth}
      \centering
      \includegraphics[width=0.72\linewidth,height=28mm,keepaspectratio]{figures/fig-05a-cells-input.png}
      \par\small Task image
    \end{column}
    \begin{column}{0.43\textwidth}
      \centering
      \includegraphics[width=0.72\linewidth,height=28mm,keepaspectratio]{figures/fig-05b-cells-overlay.png}
      \par\small Observed mask overlay
    \end{column}
  \end{columns}
  \medskip
  \begin{itemize}
    \item A refactor deleted helpers; the summary retained the error and backup identity.
    \item The actor reread both files, restored helpers, and passed all nine tests.
    \item The trajectory does not identify which recovered details came from memory.
  \end{itemize}
  \papersource{Paper, Fig. 5 and Sec. 3.4, PDF pp. 6--7. Original PNG images, unchanged.}
\end{frame}

% 20
\begin{frame}{REMORY connects explicit checkpoints and learned states}
  \begin{tabular}{p{38mm}p{87mm}}
    \toprule
    Existing direction & Role in the paper's positioning\\
    \midrule
    Summaries + retrieval & Retain readable state and access exact records\\
    Continuous compression & Represent longer inputs with learned soft tokens\\
    Distribution matching & Judge compression by the actor's continuation behavior\\
    Recurrent memory & Carry updated state across successive boundaries\\
    \bottomrule
  \end{tabular}
  \medskip
  \begin{block}{Distinctive combination}
    Summary-conditioned memory, a frozen actor, two-stage training,
    and recurring compaction boundaries.
  \end{block}
  \papersource{Paper, Sec. 4, PDF p. 7. This slide summarizes the paper's related-work positioning.}
\end{frame}

% 21
\begin{frame}{The useful target is information for future behavior}
  \begin{enumerate}
    \item \textbf{Representation:} keep a readable summary and train a continuous supplement.
      \medskip
    \item \textbf{Evidence:} attribution improves, agent scores rise, and fixed-checkpoint
      next actions are more often preferred.
      \medskip
    \item \textbf{Trade-off:} final memory is bounded, but encoding and memory-network
      execution add unpriced computation.
  \end{enumerate}
  \medskip
  A matched, summary-independent memory baseline would help isolate the value
  of summary conditioning. \textcolor{gray}{\small (Discussion proposal.)}
  \papersource{Synthesis of Secs. 2--5, PDF pp. 3--7. Next-step proposal is reading analysis.}
\end{frame}

% 22
\begin{frame}{Primary reference and supporting material}
  Hanchen Xia, Baoyou Chen, Yutang Ge, Naihao Deng, Senqiao Yang,
  Zilong Dong, Weihao Yuan, and Siyu Zhu.
  \medskip

  \textbf{REMORY: Learning Residual Memory for Context Compaction.}\\
  arXiv:2610.11287v1, October 8, 2026.
  \medskip

  \href{https://arxiv.org/abs/2610.11287v1}{arxiv.org/abs/2610.11287v1}
  \quad
  \href{https://arxiv.org/pdf/2610.11287v1}{Versioned paper PDF}
  \bigskip

  \begin{itemize}
    \item Equations and all quantitative evidence are from this version.
    \item Source locators use PDF page numbers, matching printed pages.
    \item Backup slides: gradient path, metric interpretation, and case statistics.
  \end{itemize}
\end{frame}

\appendix

% 23
\begin{frame}{Backup: frozen weights still allow input gradients}
  Let $M\in\mathbb R^{k\times d}$ be the memory vectors, with actor width $d$.
  \[
    \nabla_\phi\mathcal L
    =\left(\frac{\partial M}{\partial\phi}\right)^\top
      \sum_j\left(\frac{\partial q_j}{\partial M}\right)^\top
      \frac{\partial\mathcal L}{\partial q_j}.
  \]
  \begin{itemize}
    \item The teacher distribution $p_j$ supplies a fixed target.
    \item Student predictions depend on memory through the frozen actor.
    \item No update to $\theta$ is needed to optimize the input interface.
  \end{itemize}
  \medskip
  \[
    \KL(q_j\Vert p_j)=\sum_{v\in\mathcal V}q_j(v)
        \log\frac{q_j(v)}{p_j(v)}
  \]
  \papersource{Teaching derivation from Eqs. (1)--(3), PDF pp. 3--4. $d$ and $k$ introduced for dimensions.}
\end{frame}

% 24
\begin{frame}{Backup: the three SummHay metrics use different averages}
  \begin{itemize}
    \item \textbf{Coverage and joint score:} average over all 621 reference insights.
      \medskip
    \item \textbf{Citation F1:} average over covered insights.
      \medskip
    \item \textbf{Shared subset:} attribution still improves on 553 insights
      covered under both summary conditions.
  \end{itemize}
  \medskip
  \begin{block}{Coverage and attribution move in opposite directions}
    Relative to raw context, summary + memory has coverage $-4.51$,
    citation F1 $+4.43$, and joint score $-0.02$ points.
  \end{block}
  The reported +4.04 citation gain over summary uses unrounded values;
  subtracting displayed values gives +4.05.
  \papersource{Paper, Table 1 and Sec. 3.1, PDF pp. 4--5. Differences to raw context calculated from displayed values.}
\end{frame}

% 25
\begin{frame}{Backup: the trading record mixes several changes}
  \centering
  \begin{tabular}{lrr}
    \toprule
    Record & Without memory & With memory\\
    \midrule
    Settled ROI & $-11.86\%$ & $+5.11\%$\\
    Logged generation cost & \$303.81 & \$170.30\\
    Responses & 5,336 & 3,013\\
    Completed compactions & 56 & 45\\
    Compactions / 1,000 responses & 10.5 & 14.9\\
    Mean live positions & 105,372 & 101,185\\
    \bottomrule
  \end{tabular}
  \par\medskip\raggedright
  Two concurrent paper-trading accounts; initial bankroll \$20,000.\\
  ROI uses resolved markets at the September 23 cutoff. Market choice and timing
  differ between the two trajectories.
  \papersource{Paper, Sec. 3.4, PDF p. 6. Live position count includes residual memory.}
\end{frame}

\end{document}
