iRaven

Paper · Agents and tools · Version v1

When to End, Which to Invoke Next: Transition-Aware Tokenized Procedural Memory for LLMs

First published: arXiv, . Original

Copyright the authors. Licensed under Creative Commons Attribution-ShareAlike 4.0 International.

This page holds the text of the paper, converted to HTML; figures may be left out.

One-Token Procedural Memory TokMem has recently emerged as a parameter-efficient paradigm for storing and reusing task-solving procedures in large language models (LLMs), where each procedure is encoded as a compact memory token. This paper investigates a more challenging scenario in which a LLM must reliably orchestrate a sequence of consecutive procedure recalls within a single generation. We identify a fundamental limitation of TokMem-style procedure chaining: while memory tokens provide explicit entry points to individual procedures, the transitions between procedures remain implicit. This overlooked handoff mechanism causes next-procedure selection to become increasingly fragile as procedural chains grow longer. To address this issue, we propose Transition-Aware Procedural Memory (TapMem), a lightweight framework that explicitly models inter-procedure handoffs. The key insight behind TapMem is to formulate each procedure transition as a boundary-conditioned selection problem. Since the next procedure should be selected only after the current procedure-guided span ends, TapMem first introduces Explicit Termination Signal, to make this completion boundary observable. Building on the resulting boundary representation, TapMem further incorporates a Transition-Conditioned Routing Adapter to generate a context-dependent correction over candidate memory-token logits. By intervening only at transition positions and only over memory-token logits, TapMem preserves the original full-vocabulary autoregressive generation process while improving the sparse procedural decisions required for reliable multi-step orchestration. Extensive experiments across diverse procedure-recall settings demonstrate that TapMem achieves promising performance.

Abstract

One-Token Procedural Memory (TokMem) has recently emerged as a parameter-efficient paradigm for storing and reusing task-solving procedures in large language models (LLMs), where each procedure is encoded as a compact memory token. This paper investigates a more challenging scenario in which a LLM must reliably orchestrate a sequence of consecutive procedure recalls within a single generation. We identify a fundamental limitation of TokMem-style procedure chaining: while memory tokens provide explicit entry points to individual procedures, the transitions between procedures remain implicit. This overlooked handoff mechanism causes next-procedure selection to become increasingly fragile as procedural chains grow longer. To address this issue, we propose Transition-Aware Procedural Memory (TapMem), a lightweight framework that explicitly models inter-procedure handoffs. The key insight behind TapMem is to formulate each procedure transition as a boundary-conditioned selection problem. Since the next procedure should be selected only after the current procedure-guided span ends, TapMem first introduces Explicit Termination Signal, to make this completion boundary observable. Building on the resulting boundary representation, TapMem further incorporates a Transition-Conditioned Routing Adapter to generate a context-dependent correction over candidate memory-token logits. By intervening only at transition positions and only over memory-token logits, TapMem preserves the original full-vocabulary autoregressive generation process while improving the sparse procedural decisions required for reliable multi-step orchestration. Extensive experiments across diverse procedure-recall settings demonstrate that TapMem achieves promising performance.

1 Introduction

Large language models (LLMs) (Grattafiori et al., 2024; Yang et al., 2025) are increasingly deployed in tasks where success depends not only on generating coherent responses, but also on executing structured task-solving procedures (Fang et al., 2026; Han et al., 2026). These tasks often require models to execute multiple interdependent procedures, such as invoking external tools, reasoning over intermediate results, verifying partial outputs, and formatting final responses (Liu et al., 2024a; Zhou et al., 2024; Deng et al., 2023; He et al., 2024). Such behaviors are inherently procedural: they specify how the model should act under a given context, rather than what factual content should be retrieved. As LLM-based applications become increasingly structured (Guo et al., 2024; Lu et al., 2025; Patil et al., 2025; Abdelaziz et al., 2024; Cai et al., 2024), a central challenge is not only to represent reusable procedures efficiently, but also to compose them reliably within a single generation.

Figure

(a) Toy example of transition-aware procedural memory.

Figure

(b) Comparison of transition error in sample level.

Figure

(c) Comparison of transition error in token level.

Figure 1: (a) A toy example of TokMem and TapMem (Ours). TokMem incorrectly selects the second procedure, while TapMem enables reliable procedure chaining through explicit transition modeling. (b)(c) TapMem achieves a larger reduction in sample-level and token-level transition errors, and this advantage grows as the number of calls increases. More details can be found in Appendix D.2.1.

To enable such capabilities, recent studies have investigated procedural memory, with related discussions provided in Appendix A. Among these approaches, tokenized procedural memory offers a promising paradigm for this goal. In its typical formulation, One-Token Procedural Memory (TokMem) (Wu et al., 2026) encodes each reusable procedure as a compact memory token, thereby casting procedural recall as a language-modeling problem, where invoking a procedure amounts to predicting its corresponding memory token. This design enables parameter-efficient invocation of individual procedures, but it does not explicitly model the transitions required when multiple procedures must be executed consecutively. In such scenarios, the memory-token prediction mechanism implicitly serves dual roles: identifying the completion of the current procedure and selecting the next procedure, which may cause compositional reliability to degrade as procedure chains grow longer. Figure 1(a) provides a toy example of this failure mode, where TokMem selects the first procedure correctly but fails at the subsequent transition. Figure 1(b) and Figure 1(c) further show that its transition errors become sharp with longer procedure chains, motivating explicit transition modeling for reliable next-procedure selection. This leads to our central question:

To answer this question, we propose Transition-Aware Procedural Memory (TapMem), a lightweight framework that augments tokenized procedural memory with explicit transition modeling. Our key insight is that reliable multi-step procedural orchestration requires separating two inherently different decisions during a procedure transition: determining when the current procedure has completed and selecting which procedure should be invoked next. TapMem therefore treats inter-procedure transitions as boundary-conditioned routing problems (Geng et al., 2023; Beurer-Kellner et al., 2023; Ross et al., 2025). Specifically, TapMem introduces an Explicit Termination Signal (ETS) to make procedure completion observable by requiring the model to emit a <EOC> token at the end of each procedure-guided span. This explicit boundary representation enables a Transition-Conditioned Routing Adapter (TCRA), which dynamically adjusts candidate memory-token logits based on the transition context for next-procedure selection. By restricting its intervention to transition positions and memory-token logits only, TapMem preserves the original full-vocabulary autoregressive generation process while enhancing the sparse procedural decisions required for reliable multi-step orchestration. Extensive experiments across standard, long-horizon, multi-turn execution, and continual procedural memory settings demonstrate that TapMem improves procedural orchestration over TokMem, with increasingly larger advantages on longer procedure chains.

Our main contributions are summarized as follows:

  • We identify the transition bottleneck in tokenized procedural memory, where procedure termination and next-procedure selection are implicitly coupled.
  • We propose TapMem, a transition-aware framework that explicitly models procedure boundaries and improves next-procedure routing with ETS and TCRA.
  • We evaluate TapMem across diverse procedural memory settings, including long-horizon orchestration, multi-turn execution, and continual extension, demonstrating improved reliability over TokMem and the potential for scalable procedural memory.

2 Methodology

2.1 Problem Formulation & Motivation

This paper studies tokenized procedural memory for multi-step procedure orchestration in LLMs. Following prior work on TokMem (Wu et al., 2026), a procedure is defined as a reusable context-response or task-solving routine that specifies how a model should act in a given context, such as task decomposition, tool invocation, and response formatting. To enable LLMs to manage and reuse such procedures efficiently, TokMem represents each reusable procedure with a compact memory token, which serves as a learned handle for eliciting the corresponding behavior from the language model. Formally, let fθ denote a pretrained LLM with the original vocabulary 𝒱, where θ denotes the backbone parameters. TokMem first augments the original vocabulary with K special procedural memory tokens:

𝒱~=𝒱∪𝒱M,𝒱M={m1,m2,…,mK},𝒱∩𝒱M=∅

here, 𝒱M extends the original language-model vocabulary with procedural memory tokens. Each memory token mi∈𝒱M is assigned a new token index in the augmented vocabulary 𝒱~ and is associated with a trainable embedding vector 𝐞i∈ℝd, where d is the embedding dimension. The trainable embeddings of all procedural memory tokens form a memory bank:

𝐄=[𝐞1⊤𝐞2⊤⋮𝐞K⊤]∈ℝK×d

Given an input query, the goal is to generate a response by invoking one or more appropriate procedures indexed by 𝒱M. Suppose that a training instance with J≥1 procedure calls is serialized as

𝐲=[𝐪,m(1),𝐚(1),m(2),𝐚(2),…,m(J),𝐚(J)]

where 𝐪 denotes the tokenized query, m(i)∈𝒱M is the memory token selected for the i-th procedure call, and 𝐚(i)=(a1(i),…,aLi(i)) denotes the ordinary response segment generated under that procedure.

TokMem optimizes the trainable memory bank 𝐄 using the standard autoregressive next-token prediction objective:

ℒAR(𝐲;𝐄)=−∑j=|𝐪|+1|𝐲|logpθ,𝐄(yj∣y<j)

where |𝐪|+1 is the position of the first generated token and j denotes a general token position in the sequence.

Discussions

The objective in Eq. 4 provides a compact and parameter-efficient mechanism for procedure invoking. However, we argue that it leaves a key part of compositional procedure orchestration under-modeled. From the perspective of sequence serialization, procedural memory token m(j) and ordinary response tokens \textbf{a}^{(j)} are optimized under the same next-token prediction objective in Eq. 4. After completing the j-th procedure invoking, TokMem directly predicts the next memory token as

pθ,𝐄(m(j+1)∣𝐪,m(1),𝐚(1),…,m(j),𝐚(j)),j<J

This formulation implicitly conflates two structurally distinct decisions: whether the current procedure has completed, and which procedure should be invoked next. Such an implicit transition mechanism may be sufficient for isolated procedure recall, but becomes fragile when J>1, where reliable procedure chaining requires accurate procedure completion and transition dependencies across multiple procedure calls. To address this challenge, we therefore reformulate tokenized procedural memory as a transition-aware procedure orchestration problem, where procedure termination and next-procedure routing are explicitly modeled rather than left to generic autoregressive prediction.

Figure

Figure 2: Overview of our TapMem approach. Given a query, the model selects a memory token from the memory bank to determine the current procedure, then generates the corresponding response, and finally emits <EOC> to mark the end of this procedure. At positions corresponding to memory token generation, TCRA performs routing correction on the LM output logits. The bottom panel shows a case of multi-step procedural orchestration.

2.2 TapMem: Transition-Aware Procedural Memory

To address the transition bottleneck identified in Section 2.1, we propose Transition-Aware Procedural Memory (TapMem). TapMem is built on a simple structural principle: the next procedure should only be selected after the completion of the current procedure-guided span. Instead of requiring a single memory-token prediction to implicitly determine both procedure termination and next-procedure selection, TapMem explicitly separates these two decisions. As shown in Figure 2, TapMem realizes this principle with two components: Explicit Termination Signal (ETS), and Transition-Conditioned Routing Adapter (TCRA), which refines candidate memory-token logits based on the exposed transition state. This design preserves standard autoregressive response generation within each procedure while strengthening the sparse transition decisions required for reliable multi-step orchestration.

2.2.1 When to End: Explicit Termination Signals

The first question in transition-aware procedural memory is when the current procedure should end. In TokMem-style chaining, procedure completion is not explicitly modeled and is inferred only from the next memory token, which implicitly serves two roles: terminating the current procedure and selecting the next one. This coupling leaves procedure boundaries under-specified, especially in multi-step procedural chaining.

To expose this boundary, TapMem introduces an Explicit Termination Signal (ETS) implemented as a reserved end-of-call token <EOC>. By inserting this signal after each procedure-guided span, TapMem transforms procedure completion into an explicit autoregressive prediction target, allowing the model to identify procedure boundaries directly rather than infer them from the subsequent memory token. Unlike ordinary textual delimiters or <EOS>, ETS marks the completion of the current procedure without terminating the overall generation sequence. Thus, ETS separates procedure-level completion from sequence-level termination while remaining compatible with standard autoregressive decoding. For convenience, we continue to use 𝒱~ to denote the augmented vocabulary containing the termination signal <EOC>. Formally, a single procedure call is serialized as

m,\mathbf{a},\texttt{<EOC>},

where m∈𝒱M is the memory token that selects the current procedure, and 𝐚 denotes the response span generated under that procedure. For a multi-step trajectory with J procedure calls, TapMem constructs the target sequence as

\mathbf{y}^{\prime}=\big[\mathbf{q},\,m^{(1)},\mathbf{a}^{(1)},\texttt{<EOC>},\,\ldots,\,m^{(J)},\mathbf{a}^{(J)},\texttt{<EOC>}\big],

where 𝐪 is the input query, m(j) is the memory token for the j-th procedure, and 𝐚(j) is the corresponding procedure-guided response span. ETS makes the completion of procedure observable through the generation of <EOC>. We define the set of inter-procedure boundary positions as

\mathcal{B}=\left\{b\in\{|\mathbf{q}|+1,\ldots,|\mathbf{y}^{\prime}|-1\}\,\middle|\,y^{\prime}_{b}=\texttt{<EOC>},\;y^{\prime}_{b+1}\in\mathcal{V}_{M}\right\}.

b∈ℬ is therefore the position of an <EOC> token that terminates the current procedure and is followed by the memory token of the next procedure.

2.2.2 Which to Invoke Next: Transition-Conditioned Routing Adapter

After ETS explicitly marks the end of the current procedure, the next question is which procedure should be invoked next. Although the original LM head can predict the next memory token, we argue that procedure selection differs structurally from ordinary response generation. At a procedure-selection position, the model should distinguish among candidate procedural memories, while natural-language and argument generation remain governed by the base LM. We therefore introduce the Transition-Conditioned Routing Adapter (TCRA) to strengthen memory-token selection without disturbing ordinary generation.

The initial procedure selection occurs at position |𝐪|+1, whereas each subsequent procedure selection occurs after a position in ℬ. Accordingly, we define the set of procedure-selection positions at which TCRA applies routing refinement as

ℛ={|𝐪|+1}∪{b+1∣b∈ℬ}.

where r=|𝐪|+1 denotes the position of the initial procedural memory token, and each r=b+1 for b∈ℬ denotes the position of the next procedural memory token following an <EOC> token. By construction, yr′∈𝒱M for every r∈ℛ.

As shown in Fig. 2, TCRA provides a routing adaptation at procedure-selection positions, where the model needs to choose among candidate procedure memories rather than continue ordinary response generation. Let 𝐡r−1∈ℝd denote the hidden state used to predict the procedural memory token at position r∈ℛ. TCRA maps this boundary representation to routing logits over the K candidate procedural memories:

𝐳rTCRA=gϕ(𝐡r−1)∈ℝK,r∈ℛ

where gϕ is a lightweight projection adapter and K is the number of memory tokens. The logits 𝐳rTCRA encode a transition-conditioned preference over candidate procedure memories, which is later injected only into memory-token logits, so ordinary vocabulary logits remain governed by the base LM head.

We then convert this routing preference into a logits adjustment relative to a uniform reference distribution. Let \bm{\pi}_{r}=\operatorname{softmax}(\mathbf{z}_{r}^{\mathrm{TCRA}}), where πr(k) denotes the probability assigned to memory token mk. For each mk∈𝒱M, we define the adjustment as

Δr(k)=logπr(k)−log(1/K),r∈ℛ,k∈{1,…,K}

where 1/K is the probability assigned to each candidate under the uniform distribution. If πr(k)=1/K for every k∈{1,…,K}, then Δr(k)=0 for every candidate memory token.

Taking a step further, let 𝐳rLM∈ℝ|𝒱~| denote the base logits over the augmented vocabulary used to predict yr′. At a procedure-selection position r∈ℛ, TapMem applies the adjustment only to procedural memory-token logits:

z~r,m={zr,mLM+αΔr(k),m=mk,mk∈𝒱M,zr,mLM,m∉𝒱M,r∈ℛ

where α≥0 controls the strength of the TCRA adjustment relative to the base logits. For positions r∉ℛ, TapMem directly predicts without adjustment. Therefore, TCRA strengthens procedure selection only at procedure-selection positions, while preserving ordinary full-vocabulary generation inside each procedure-guided span.

2.3 Training and Inference with TapMem

TapMem follows the autoregressive objective ℒAR defined above, but uses adjusted logits at procedure-selection positions. Specifically, for r∈ℛ, TCRA adjusts only candidate memory-token logits according to Eq. 12; at all other positions, the original logits are used unchanged.

Since procedure selection occurs only at sparse positions, ℒAR provides only indirect supervision for the routing adapter. We therefore add a supervised routing loss over the procedure-selection positions. For each r∈ℛ, let kr∈{1,…,K} denote the target procedure index satisfying yr′=mkr. The routing loss is

ℒroute=−1|ℛ|∑r∈ℛlogπr(kr)

Accordingly, the full training objective is

ℒ=ℒAR+γℒroute

where γ≥0 controls the strength of the routing supervision.

During training, the backbone LLM remains frozen, and we update only the added memory-token embeddings, the <EOC> embedding, and the routing adapter gϕ. Both ℒAR and ℒroute optimize gϕ, while gradients from TCRA are not propagated to its input hidden states. The memory-token embeddings and <EOC> embeddings remain trained through the autoregressive objective. This design lets ℒroute train the adapter to improve next-procedure selection, without directly reshaping hidden representations used for ordinary response generation. We demonstrate the effectiveness of this design in Figure 10.

During inference, the adapter is employed at procedure boundaries, and the correction it produces is added to the memory-token logits before the next token is selected. Detailed algorithms are provided in Appendix C.

3 Experiments

Due to space limitations, please refer to the Appendix D and E for a extended version.

Table 1: Compositional recall results on the APIGen dataset in terms of F1. † denotes training-free methods.

MethodTool SelectionArgument
2 calls3 calls4 callsAvg.2 calls3 calls4 callsAvg.
Llama 3.2 1B
ICL†2.01.00.01.41.40.40.00.9
RAG†15.13.80.08.99.72.10.05.5
TokMem83.2(±1.4)82.2(±1.2)76.4(±0.6)82.4(±1.2)67.6(±0.5)67.6(±1.4)55.2(±3.0)67.0(±0.7)
TapMem88.8(±0.9)89.6(±0.7)81.0(±2.0)88.8(±0.8)74.9(±0.1)74.1(±0.8)65.0(±2.0)74.0(±0.3)
Fine-Tuning84.2(±2.2)80.8(±1.4)73.7(±3.6)82.0(±1.7)79.3(±0.6)78.2(±0.2)64.7(±6.2)78.1(±0.6)
TokMem + adaptation98.2(±0.5)98.3(±0.1)96.1(±1.2)98.1(±0.3)84.3(±0.9)84.1(±0.4)74.8(±0.8)83.7(±0.6)
TapMem + adaptation98.4(±0.4)98.4(±0.2)97.2(±0.1)98.3(±0.2)85.8(±0.9)85.3(±0.9)79.0(±1.8)85.3(±0.7)
Llama 3.2 3B
ICL†59.461.856.960.448.449.844.148.9
RAG†80.477.183.679.055.153.148.553.8
TokMem73.6(±0.3)75.3(±1.3)70.3(±3.6)74.2(±0.7)59.7(±1.6)59.7(±4.1)52.1(±8.0)59.3(±3.0)
TapMem81.1(±0.8)82.7(±1.6)81.4(±0.9)81.9(±1.0)65.5(±3.0)65.4(±3.7)58.3(±3.1)65.1(±3.1)
Fine-Tuning97.7(±0.5)98.2(±0.5)94.4(±2.1)97.8(±0.4)87.2(±0.7)87.7(±0.5)79.2(±2.1)87.0(±0.2)
TokMem + adaptation98.2(±0.6)98.7(±0.2)97.5(±1.4)98.4(±0.3)86.6(±0.7)86.9(±0.5)79.4(±0.8)86.4(±0.5)
TapMem + adaptation98.9(±0.7)99.4(±0.3)98.6(±0.2)99.2(±0.5)88.0(±0.9)88.6(±0.7)82.5(±1.7)88.0(±0.7)
Llama 3.1 8B
ICL†57.763.652.360.349.655.249.752.3
RAG†79.078.274.178.460.160.755.160.1
TokMem84.9(±1.2)83.8(±1.3)74.3(±5.2)83.9(±0.2)71.2(±1.5)69.7(±1.2)62.6(±5.1)70.1(±1.0)
TapMem87.1(±0.7)86.5(±0.5)79.9(±2.2)86.4(±0.4)74.7(±1.6)74.3(±1.1)65.1(±3.3)74.0(±0.7)
Fine-Tuning92.7(±0.9)94.4(±0.9)89.3(±3.3)93.3(±0.9)83.2(±1.6)84.2(±0.4)78.4(±1.4)83.5(±0.8)
TokMem + adaptation97.8(±0.8)98.1(±0.1)97.9(±1.8)97.9(±0.4)84.9(±2.2)84.1(±0.9)82.2(±4.0)84.4(±1.6)
TapMem + adaptation98.1(±0.7)98.1(±0.5)96.6(±2.1)98.0(±0.6)86.3(±1.3)85.5(±0.9)81.1(±3.7)85.7(±0.9)

3.1 Experiments Setup

For a comprehensive evaluation, we organize our experiments into four progressive settings:

  • Standard setting. Following TokMem (Wu et al., 2026), we evaluate compositional recall on APIGen (Liu et al., 2024b), which requires multiple procedure calls within a single generation, and atomic recall on SNI (Wang et al., 2022), which requires a single procedure call.
  • Long-horizon setting. To evaluate longer generations involving more procedure calls, we conduct experiments on TaskBench (Shen et al., 2024) and TRAJECT-Bench (He et al., 2026), and extend APIGen to sequences of up to 10 procedure calls.
  • Multi-turn execution setting. To evaluate interactive procedure execution with interactions and environmental feedback, we conduct experiments on τ-bench (Yao et al., 2025) and InterCode-Bash (Yang et al., 2023).
  • Continual setting. To evaluate the incorporation of unseen procedures, we consider a continual setting with unseen procedures, explore training-based and several cold-start approaches.

For the standard, long-horizon and continual settings, we report Tool Selection F1 and Argument Prediction F1 to measure procedural memory selection and full function-call correctness, respectively. For the multi-turn execution setting, we report Task Success Rate on both τ-bench and InterCode-Bash. We additionally report Database Match Rate and Invalid Action Rate on τ-bench. Results are mainly averaged over 3 random seeds, with TokMem (Wu et al., 2026) as the baseline. The TCRA adapter is implemented as a linear projection layer. Detailed introductions are deferred to Appendix D.

Figure

(a) Results on TaskBench.

Figure

(b) Results on TRAJECT-Bench.

Figure 3: Compositional recall results on the TaskBench and TRAJECT-Bench in terms of F1.

3.2 Overall Performance

Results on Standard Setting. (1) Compositional Recall. Table 1 reports the results on APIGen. While TokMem provides a stronger baseline through tokenized procedural memory, its performance still degrades as the number of procedure calls increases. In contrast, our TapMem achieves better performance in both tool selection and argument generation, and shows a smaller drop as the number of calls increases, yielding average gains of 6.4% and 7.0%, respectively, on Llama 3.2 1B. We further observe average gains over TokMem of 7.4%/13.2% in Tool Selection F1/Argument Generation F1 on Qwen 3.5 4B, and 3.7%/9.5% on Qwen 3.5 9B (Team, 2026); detailed results are reported in Appendix E.1.1, demonstrating generalization across model families. TapMem also remains effective after adaptation, where the backbone is first fine-tuned on compositional recall data. (2) Atomic Recall. Table 5 reports the results on SNI (Wang et al., 2022), where TapMem also improves single-procedure selection, showing that its routing refinement remains effective beyond multi-step procedure orchestration.

Results on the Long-Horizon Setting. (1) TaskBench. Figure 3(a) reports the results on the compositional subset of TaskBench (Shen et al., 2024). Averaged across the 1B, 3B, and 8B backbones, TapMem improves Tool Selection F1 and Argument Generation F1 by 4.7% and 4.1%, respectively, demonstrating its effectiveness on long procedure chains with dependencies explicitly defined by a tool graph. (2) TRAJECT-Bench. Figure 3(b) reports the results on the compositional subset of TRAJECT-Bench (He et al., 2026). TapMem improves Tool Selection F1 and Argument Generation F1 by 5.0% and 5.7% on average across the three backbones, indicating that the gains extend to realistic trajectories with explicit inter-procedure dependencies. (3) More Procedure Calls. Figure 4 reports compositional recall results on APIGen with up to 10 procedure calls. TapMem’s advantage grows from 2.5% and 2.7% at two calls to 7.6% and 9.6% at ten calls for Tool Selection F1 and Argument Generation F1, respectively. Meanwhile, TokMem degrades more noticeably as the procedure sequence becomes longer, making TapMem’s benefit increasingly apparent on extended sequences. Taken together, these results show that TapMem better maintains the quality of procedure selection and argument generation as the procedure sequence becomes longer. Detailed setting and results on long-horizon setting are provided in Appendix D.3 and Appendix E.2.

Table 2: Ablation study on the effectiveness of ETS and TCRA in terms of F1

ETSTCRATool SelectionArgument
2 calls3 calls4 callsAvg.2 calls3 calls4 callsAvg.
83.282.276.482.467.667.655.267.0
✓83.685.375.884.068.070.754.868.6
✓87.186.980.286.671.069.962.470.0
✓✓88.889.681.088.874.974.165.074.0

Figure

Figure 4: Fine-grained performance comparison

Figure

Figure 5: Comparison of cold start methods

Figure

Figure 6: Results on InterCode-Bash.

Results on the Multi-Turn Execution Setting. (1) τ-bench. Figure 8 reports the results on τ-bench (Yao et al., 2025) subset. Compared with TokMem, TapMem improves task success rate from 29.28% to 35.94% and database match rate from 33.04% to 38.84%, while reducing invalid action rate from 5.86% to 3.24%. These improvements extend beyond action validity to better task completion and more accurate final database states. (2) InterCode-Bash. Figure 6 reports success rates with maximum execution budgets of 2, 3, 4, and 10 rounds. TapMem achieves higher success rates than TokMem at all four budgets. Results on both benchmarks demonstrate the effectiveness of TapMem in multi-turn procedure execution involving user interactions, stateful tools, and environmental feedback. Detailed experimental settings are provided in Appendix D.4.

3.3 Extension to Continual Setting

We further consider a continual setting where procedural memory expands as unseen procedures are introduced. This includes both training-based expansion and training-free cold-start initialization.

3.3.1 Training-Based Memory Expansion

We report the results of training-based expansion in Table 4. Following TokMem, we only train the parameters of new procedures. TapMem improves Tool Selection F1 and Argument Generation F1 over TokMem by 9.1% and 8.5%. These results demonstrate TapMem’s effectiveness in orchestrating newly introduced procedures alongside existing ones, highlighting its scalability as procedural memory expands.

3.3.2 Training-Free Memory Expansion

Retraining the model whenever an unseen procedure is added is impractical, which leads to a cold-start problem for unseen procedures. As an initial attempt to address this problem, we examine whether TapMem continues to outperform TokMem under six training-free methods from three categories: semantic-similarity weighting (T3-SM, T3-Cos, All-SM, and Pos-Cos), clustering (C-Mean), and regression (Ridge). Detailed methods are provided in Appendix D.5.2.

Figure 5 reports the results on both unseen and existing procedures. We draw the following conclusions: (1) Cold-start adaptation is a challenging setting for tokenized procedural memory. Across the six methods, TokMem achieves a maximum Argument Generation F1 of only 15.7% on unseen procedures. (2) TapMem remains effective in the continual setting. Across different cold-start methods, TapMem improves procedural recall in most comparisons. Under T3-SM, short for Top-3 Softmax, it improves Tool Selection F1 and Argument Generation F1 by 9.7% and 5.7%, respectively. Detailed results are provided in Appendix E.3.1.

Table 3: Results on training-based method in term of F1.

MethodTool SelectionArgument
TokMem64.7(±1.1)54.6(±2.2)
TapMem73.8(±2.0)63.1(±1.9)
\bm{\Delta}+9.1+8.5

Table 4: Tool Selection / Argument F1 for correct and incorrect first-procedure selections.

MethodFirst Procedure CorrectFirst Procedure Incorrect
TokMem97.4 / 80.953.9 / 41.0
TapMem98.6 / 82.859.8 / 45.3
\bm{\Delta}+1.2 / +1.9+5.9 / +4.3

Figure

Figure 7: Results on τ-bench.

Figure

Figure 8: Correct prefix length on APIGen.

3.4 Analysis of Sequential Procedure Orchestration

Sequential procedure orchestration requires correct initial selection and reliable subsequent transitions. To assess TapMem’s gains beyond the initial choice, we analyze generation performance separately for correct and incorrect first-procedure selections and measure correct prefix length.

3.4.1 Performance under Different Initial Selections

Table 4 reports results under correct and incorrect initial selections, which helps assess TapMem’s gains beyond the first choice. When the first procedure is correct, TapMem improves Tool Selection F1 and Argument Generation F1 by 1.2% and 1.9%, demonstrating the benefit of explicit transition modeling. When the first procedure is incorrect, the gains reach 5.9% and 4.3%, respectively, suggesting greater robustness to prefix errors. Detailed settings are provided in Appendix D.6.

3.4.2 Correct Prefix Length

Figure 8 reports correct prefix length, which measures how long models maintain consecutive correct procedure selections. TapMem increases the overall mean from 2.78 to 3.43. The average gain reaches 1.34 for sequences with 8-10 calls, compared with 0.24 for 2-4 calls. These results support the benefit of explicit transition modeling in sustaining correct procedure selection, particularly on longer chains.

3.5 Ablation Studies

We perform several ablation studies to test the effectiveness of our method. Detailed results are provided in Appendix E.4.

Ablation Study on Different Modules. Table 2 evaluates the contributions of ETS and TCRA to compositional recall on the 1B backbone. ETS alone improves both F1 scores by 1.6%. TCRA alone achieves larger gains, but combining both modules further improves Tool Selection F1 and Argument Generation F1 by 2.2% and 4.0% over TCRA alone, respectively. These results demonstrate the advantage on refining transition states into accurate next-procedure routing. More results can be found in Table 10.

Ablation Study on Hyper-Parameters. Figure 3.5 shows the ablation results for the logits scale α and the transition-conditioned routing loss weight γ on Llama 3.2 1B. For the logit scale, the sequence 0.1 → 0.5 → 1.0 leads to steady gains in both Tool Selection F1 and Argument Generation F1, while the scale of 2.0 breaks this trend. This result suggests that a small scale gives weak correction, whereas a large scale reduces the accuracy of argument generation. For the transition-conditioned routing loss weight, both tool selection and argument generation reach their best results at 0.1. This finding suggests that TCRA needs a routing strength that is strong enough to improve memory-token selection but not so strong that it harms normal next-token prediction.

Ablation study on gradient design. Figure 10 shows the results under different gradient designs. For Argument Generation F1, blocked gradient improves performance over gradient propagation, with a gain of nearly 8% on the 8B model. Meanwhile, Tool Selection F1 shows no drop in performance. The result suggests that propagating adapter gradients into token embeddings may distract the model from standard autoregressive learning and weaken its ability to complete the task.

Figure

Figure 9: Ablation results on logits scale α and transition-conditioned routing loss weight γ

Figure

Figure 10: Ablation results on gradient flow. Details are reported in Table 13

4 Conclusion

This paper studies multi-step procedural orchestration in LLMs and identifies an implicit transition bottleneck in tokenized procedural memory. We propose TapMem, a lightweight transition-aware framework that uses ETS to expose procedure boundaries and TCRA to improve next-procedure selection. ETS is implemented with <EOC> token, while TCRA corrects only candidate memory-token logits at procedure-selection positions. This design preserves ordinary full-vocabulary generation. Experiments on standard, long-horizon, multi-turn execution and continual settings show improvements over TokMem, highlighting explicit transition modeling as an important point for reliable tokenized procedural memory.

References

  • Abdelaziz et al. (2024) Ibrahim Abdelaziz, Kinjal Basu, Mayank Agarwal, Sadhana Kumaravel, Matthew Stallone, Rameswar Panda, Yara Rizk, G. P. Shrivatsa Bhargav, Maxwell Crouse, Chulaka Gunasekara, Shajith Ikbal, Sachindra Joshi, Hima Karanam, Vineet Kumar, Asim Munawar, Sumit Neelam, Dinesh Raghu, Udit Sharma, Adriana Meza Soria, Dheeraj Sreedhar, Praveen Venkateswaran, Merve Unuvar, David Cox, Salim Roukos, Luis A. Lastras, and Pavan Kapanipathi. Granite-function calling model: Introducing function calling abilities via multi-task learning of granular tasks. In Empirical Methods in Natural Language Processing, pp. 1131–1139, 2024.
  • Beurer-Kellner et al. (2023) Luca Beurer-Kellner, Marc Fischer, and Martin Vechev. Prompting is programming: A query language for large language models. Proceedings of the ACM on Programming Languages, 7(PLDI):1946–1969, 2023.
  • Borgeaud et al. (2022) Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, Diego de Las Casas, Aurelia Guy, Jacob Menick, Roman Ring, Tom Hennigan, Saffron Huang, Loren Maggiore, Chris Jones, Albin Cassirer, Andy Brock, Michela Paganini, Geoffrey Irving, Oriol Vinyals, Simon Osindero, Karen Simonyan, Jack W. Rae, Erich Elsen, and Laurent Sifre. Improving language models by retrieving from trillions of tokens. In International Conference on Machine Learning, pp. 2206–2240, 2022.
  • Brown et al. (2020) Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, 2020.
  • Cai et al. (2024) Tianle Cai, Xuezhi Wang, Tengyu Ma, Xinyun Chen, and Denny Zhou. Large language models as tool makers. In International Conference on Learning Representations, 2024.
  • Chhikara et al. (2025) Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. Mem0: Building production-ready AI agents with scalable long-term memory. In European Conference on Artificial Intelligence, pp. 2993–3000, 2025.
  • Deng et al. (2023) Xiang Deng, Yu Gu, Boyuan Zheng, Shijie Chen, Samuel Stevens, Boshi Wang, Huan Sun, and Yu Su. Mind2web: Towards a generalist agent for the web. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems, 2023.
  • Du (2026) Pengfei Du. Memory for autonomous llm agents: Mechanisms, evaluation, and emerging frontiers. arXiv preprint arXiv:2603.07670, 2026.
  • Fang et al. (2026) Runnan Fang, Yuan Liang, Xiaobin Wang, Jialong Wu, Shuofei Qiao, Pengjun Xie, Fei Huang, Huajun Chen, and Ningyu Zhang. Memp: Exploring agent procedural memory. In Association for Computational Linguistics, pp. 17490–17502, 2026.
  • Geng et al. (2023) Saibo Geng, Martin Josifoski, Maxime Peyrard, and Robert West. Grammar-constrained decoding for structured NLP tasks without finetuning. In Empirical Methods in Natural Language Processing, pp. 10932–10952, 2023.
  • Grattafiori et al. (2024) Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024.
  • Guo et al. (2024) Zhicheng Guo, Sijie Cheng, Hao Wang, Shihao Liang, Yujia Qin, Peng Li, Zhiyuan Liu, Maosong Sun, and Yang Liu. Stabletoolbench: Towards stable large-scale benchmarking on tool learning of large language models. In Association for Computational Linguistics, pp. 11143–11156, 2024.
  • Guu et al. (2020) Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Retrieval augmented language model pre-training. In International Conference on Machine Learning, pp. 3929–3938, 2020.
  • Han et al. (2026) Dongge Han, Camille Couturier, Daniel Madrigal Díaz, Xuchao Zhang, Victor Rühle, and Saravan Rajmohan. Legomem: Modular procedural memory for multi-agent LLM systems for workflow automation. In Autonomous Agents and Multiagent Systems, pp. 3116–3118, 2026.
  • Hao et al. (2023) Shibo Hao, Tianyang Liu, Zhen Wang, and Zhiting Hu. Toolkengpt: Augmenting frozen language models with massive tools via tool embeddings. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems, 2023.
  • He et al. (2024) Hongliang He, Wenlin Yao, Kaixin Ma, Wenhao Yu, Yong Dai, Hongming Zhang, Zhenzhong Lan, and Dong Yu. Webvoyager: Building an end-to-end web agent with large multimodal models. In Association for Computational Linguistics, pp. 6864–6890, 2024.
  • He et al. (2026) Pengfei He, Zhenwei Dai, Bing He, Hui Liu, Xianfeng Tang, Hanqing Lu, Juanhui Li, Jiayuan Ding, Subhabrata Mukherjee, Suhang Wang, et al. Traject-bench: a trajectory-aware benchmark for evaluating agentic tool use. In International Conference on Learning Representations, pp. 61766–61801, 2026.
  • Houlsby et al. (2019) Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for NLP. In International Conference on Machine Learning, pp. 2790–2799, 2019.
  • Hu et al. (2022) Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022.
  • Huang et al. (2022) Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pp. 9118–9147, 2022.
  • Karpukhin et al. (2020) Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Empirical Methods in Natural Language Processing, pp. 6769–6781, 2020.
  • Kingma & Ba (2015) Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
  • Lester et al. (2021) Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Empirical Methods in Natural Language Processing, pp. 3045–3059, 2021.
  • Lewis et al. (2020) Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, 2020.
  • Li & Liang (2021) Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Association for Computational Linguistics, pp. 4582–4597, 2021.
  • Lin (2004) Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pp. 74–81. Association for Computational Linguistics, 2004.
  • Lin et al. (2018) Xi Victoria Lin, Chenglong Wang, Luke Zettlemoyer, and Michael D. Ernst. Nl2bash: A corpus and semantic parser for natural language interface to the linux operating system. In International Conference on Language Resources and Evaluation, 2018.
  • Liu et al. (2022) Xiao Liu, Kaixuan Ji, Yicheng Fu, Weng Tam, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning: Prompt tuning can be comparable to fine-tuning across scales and tasks. In Association for Computational Linguistics, pp. 61–68, 2022.
  • Liu et al. (2024a) Xiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu, Xuanyu Lei, Hanyu Lai, Yu Gu, Hangliang Ding, Kaiwen Men, Kejuan Yang, et al. Agentbench: Evaluating llms as agents. In International Conference on Learning Representations, pp. 52989–53046, 2024a.
  • Liu et al. (2024b) Zuxin Liu, Thai Hoang, Jianguo Zhang, Ming Zhu, Tian Lan, Shirley Kokane, Juntao Tan, Weiran Yao, Zhiwei Liu, Yihao Feng, Rithesh Murthy, Liangwei Yang, Silvio Savarese, Juan Carlos Niebles, Huan Wang, Shelby Heinecke, and Caiming Xiong. Apigen: Automated pipeline for generating verifiable and diverse function-calling datasets. In Advances in Neural Information Processing Systems 37: Annual Conference on Neural Information Processing Systems, 2024b.
  • Loshchilov & Hutter (2019) Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
  • Lu et al. (2025) Jiarui Lu, Thomas Holleis, Yizhe Zhang, Bernhard Aumayer, Feng Nan, Haoping Bai, Shuang Ma, Shen Ma, Mengyu Li, Guoli Yin, Zirui Wang, and Ruoming Pang. Toolsandbox: A stateful, conversational, interactive evaluation benchmark for LLM tool use capabilities. In Nations of the Americas Chapter of the Association for Computational Linguistics, pp. 1160–1183, 2025.
  • Modarressi et al. (2023) Ali Modarressi, Ayyoob Imani, Mohsen Fayyaz, and Hinrich Schütze. Ret-llm: Towards a general read-write memory for large language models. arXiv preprint arXiv:2305.14322, 2023.
  • Packer et al. (2023) Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G Patil, Ion Stoica, and Joseph E Gonzalez. Memgpt: Towards llms as operating systems. arXiv preprint arXiv:2310.08560, 2023.
  • Patil et al. (2024) Shishir G. Patil, Tianjun Zhang, Xin Wang, and Joseph E. Gonzalez. Gorilla: Large language model connected with massive apis. In Advances in Neural Information Processing Systems 37: Annual Conference on Neural Information Processing Systems, 2024.
  • Patil et al. (2025) Shishir G. Patil, Huanzhi Mao, Fanjia Yan, Charlie Cheng-Jie Ji, Vishnu Suresh, Ion Stoica, and Joseph E. Gonzalez. The berkeley function calling leaderboard (BFCL): from tool use to agentic evaluation of large language models. In International Conference on Machine Learning, 2025.
  • Prabhakar et al. (2025) Akshara Prabhakar, Zuxin Liu, Ming Zhu, Jianguo Zhang, Tulika Manoj Awalgaonkar, Shiyu Wang, Zhiwei Liu, Haolin Chen, Thai Hoang, Juan Carlos Niebles, Shelby Heinecke, Weiran Yao, Huan Wang, Silvio Savarese, and Caiming Xiong. Apigen-mt: Agentic pipeline for multi-turn data generation via simulated agent-human interplay. In Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems, 2025.
  • Qin et al. (2024) Yujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu, Lan Yan, Yaxi Lu, Yankai Lin, Xin Cong, Xiangru Tang, Bill Qian, Sihan Zhao, Lauren Hong, Runchu Tian, Ruobing Xie, Jie Zhou, Mark Gerstein, Dahai Li, Zhiyuan Liu, and Maosong Sun. Toolllm: Facilitating large language models to master 16000+ real-world apis. In International Conference on Learning Representations, 2024.
  • Reimers & Gurevych (2019) Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bert-networks. In Empirical Methods in Natural Language Processing, pp. 3982–3992, 2019.
  • Ross et al. (2025) Hayley Ross, Ameya Sunil Mahabaleshwarkar, and Yoshi Suhara. When2call: When (not) to call tools. In Nations of the Americas Chapter of the Association for Computational Linguistics, pp. 3391–3409, 2025.
  • Schick et al. (2023) Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems, 2023.
  • Shen et al. (2023) Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving AI tasks with chatgpt and its friends in huggingface. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems, 2023.
  • Shen et al. (2024) Yongliang Shen, Kaitao Song, Xu Tan, Wenqi Zhang, Kan Ren, Siyu Yuan, Weiming Lu, Dongsheng Li, and Yueting Zhuang. Taskbench: Benchmarking large language models for task automation. In Advances in Neural Information Processing Systems 37: Annual Conference on Neural Information Processing Systems, 2024.
  • Team (2026) Qwen Team. Qwen3.5: Towards native multimodal agents, 2026. URL https://qwen.ai/blog?id=qwen3.5.
  • Wang et al. (2025a) Renxi Wang, Xudong Han, Lei Ji, Shu Wang, Timothy Baldwin, and Haonan Li. Toolgen: Unified tool retrieval and calling via generation. In International Conference on Learning Representations, 2025a.
  • Wang et al. (2020) Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. Minilm: Deep self-attention distillation for task-agnostic compression of pre-trained transformers. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, 2020.
  • Wang et al. (2022) Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Atharva Naik, Arjun Ashok, Arut Selvan Dhanasekaran, Anjana Arunkumar, David Stap, Eshaan Pathak, Giannis Karamanolakis, Haizhi Gary Lai, Ishan Purohit, Ishani Mondal, Jacob Anderson, Kirby Kuznia, Krima Doshi, Kuntal Kumar Pal, Maitreya Patel, Mehrad Moradshahi, Mihir Parmar, Mirali Purohit, Neeraj Varshney, Phani Rohitha Kaza, Pulkit Verma, Ravsehaj Singh Puri, Rushang Karia, Savan Doshi, Shailaja Keyur Sampat, Siddhartha Mishra, Sujan Reddy A, Sumanta Patro, Tanay Dixit, and Xudong Shen. Super-naturalinstructions: Generalization via declarative instructions on 1600+ NLP tasks. In Empirical Methods in Natural Language Processing, pp. 5085–5109, 2022.
  • Wang et al. (2024) Yu Wang, Yifan Gao, Xiusi Chen, Haoming Jiang, Shiyang Li, Jingfeng Yang, Qingyu Yin, Zheng Li, Xian Li, Bing Yin, Jingbo Shang, and Julian McAuley. MEMORYLLM: towards self-updatable large language models. In International Conference on Machine Learning, pp. 50453–50466, 2024.
  • Wang et al. (2025b) Zora Zhiruo Wang, Jiayuan Mao, Daniel Fried, and Graham Neubig. Agent workflow memory. In International Conference on Machine Learning, 2025b.
  • Wei et al. (2022) Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems, 2022.
  • Wu et al. (2025) Yaxiong Wu, Sheng Liang, Chen Zhang, Yichao Wang, Yongyue Zhang, Huifeng Guo, Ruiming Tang, and Yong Liu. From human memory to ai memory: A survey on memory mechanisms in the era of llms. arXiv preprint arXiv:2504.15965, 2025.
  • Wu et al. (2026) Zijun Wu, Yongchang Hao, and Lili Mou. TokMem: One-token procedural memory for large language models. In International Conference on Learning Representations, pp. 32460–32480, 2026.
  • Xu et al. (2025) Wujiang Xu, Zujie Liang, Kai Mei, Hang Gao, Juntao Tan, and Yongfeng Zhang. A-mem: Agentic memory for LLM agents. In Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems, 2025.
  • Yang et al. (2023) John Yang, Akshara Prabhakar, Karthik Narasimhan, and Shunyu Yao. Intercode: Standardizing and benchmarking interactive coding with execution feedback. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems, 2023.
  • Yang et al. (2025) Qwen: An Yang, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chengyuan Li, Dayiheng Liu, Fei Huang, Haoran Wei, Huan Lin, Jian Yang, Jianhong Tu, Jianwei Zhang, Jianxin Yang, Jiaxi Yang, Jingren Zhou, Junyang Lin, Kai Dang, Keming Lu, Keqin Bao, Kexin Yang, Le Yu, Mei Li, Mingfeng Xue, Pei Zhang, Qin Zhu, Rui Men, Runji Lin, Tianhao Li, Tianyi Tang, Tingyu Xia, Xingzhang Ren, Xuancheng Ren, Yang Fan, Yang Su, Yichang Zhang, Yu Wan, Yuqiong Liu, Zeyu Cui, Zhenru Zhang, and Zihan Qiu. Qwen2.5 technical report, 2025. URL https://arxiv.org/abs/2412.15115.
  • Yao et al. (2023) Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R. Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. In International Conference on Learning Representations, 2023.
  • Yao et al. (2025) Shunyu Yao, Noah Shinn, Pedram Razavi, and Karthik R. Narasimhan. τ-bench: A benchmark for tool-agent-user interaction in real-world domains. In International Conference on Learning Representations, 2025.
  • Yuan et al. (2025) Siyu Yuan, Kaitao Song, Jiangjie Chen, Xu Tan, Yongliang Shen, Kan Ren, Dongsheng Li, and Deqing Yang. EASYTOOL: enhancing llm-based agents with concise tool instruction. In Nations of the Americas Chapter of the Association for Computational Linguistics, pp. 951–972, 2025.
  • Zhang et al. (2026) Guibin Zhang, Muxin Fu, and Shuicheng Yan. Memgen: Weaving generative latent memory for self-evolving agents. In International Conference on Learning Representations, volume 2026, pp. 22555–22588, 2026.
  • Zhou et al. (2024) Shuyan Zhou, Frank F. Xu, Hao Zhu, Xuhui Zhou, Robert Lo, Abishek Sridhar, Xianyi Cheng, Tianyue Ou, Yonatan Bisk, Daniel Fried, Uri Alon, and Graham Neubig. Webarena: A realistic web environment for building autonomous agents. In International Conference on Learning Representations, 2024.
  • Zhu et al. (2023) Xizhou Zhu, Yuntao Chen, Hao Tian, Chenxin Tao, Weijie Su, Chenyu Yang, Gao Huang, Bin Li, Lewei Lu, Xiaogang Wang, et al. Ghost in the minecraft: Generally capable agents for open-world environments via large language models with text-based knowledge and memory. arXiv preprint arXiv:2305.17144, 2023.

Contents

Appendix A Related Work

A.1 Memory-Augmented Methods for LLMs

Memory augmentation allows LLMs to use task-relevant knowledge beyond the immediate input (Wu et al., 2025; Du, 2026). In in-context learning, demonstrations, instructions, and reasoning traces can serve as temporary textual memory in the prompt (Brown et al., 2020; Wei et al., 2022; Yao et al., 2023; Yuan et al., 2025). In retrieval-augmented generation, an external memory store provides relevant documents, examples, or tool descriptions at inference time (Karpukhin et al., 2020; Lewis et al., 2020; Borgeaud et al., 2022; Patil et al., 2024; Qin et al., 2024; Guu et al., 2020; Modarressi et al., 2023). Recent work on agent-based memory systems further extends text-based memory methods(Xu et al., 2025; Chhikara et al., 2025; Packer et al., 2023; Zhu et al., 2023; Wang et al., 2025b; Zhang et al., 2026; Shen et al., 2023). Some studies also place reusable behavior in trainable parameters or continuous representations, including adapters, soft prompts, prefix tuning, P-Tuning, and LoRA (Houlsby et al., 2019; Li & Liang, 2021; Lester et al., 2021; Liu et al., 2022; Hu et al., 2022; Wang et al., 2024). Although these designs provide useful forms of memory, they still have limitations for procedural reuse. Textual and retrieval-based memory requires extra context construction at each use (Wu et al., 2025), while behavior stored in parameters is hard to inspect and edit, and it lacks a clear discrete call interface. More importantly, it remains unclear how these memory mechanisms should guide a LLM from one reusable procedure to another within a single autoregressive generation, leaving multi-step procedural orchestration under-specified (Fang et al., 2026).

A.2 Tokenized Procedural Memory

Tokenized procedural memory (Wu et al., 2026; Hao et al., 2023; Wang et al., 2025a) provides a more compact formulation, where each reusable procedure is represented as a discrete trainable memory token. A representative example is TokMem (Wu et al., 2026), which compiles a procedure into a single memory token. The corresponding behavior is then called through standard language-model generation. Long procedure descriptions no longer need to be repeatedly added in the context, and procedure recall remains compatible with autoregressive decoding. However, TokMem still has a key limitation in compositional settings. When multiple procedures needed in sequence (Huang et al., 2022; Schick et al., 2023), the model has to decide when the current memory-guided span should end and which procedure should be selected next. In TokMem, the transition between procedures is left to standard next-token prediction, so procedure termination and next-procedure selection remain implicit and coupled. This makes procedural chaining less stable, especially when the number of procedure calls increases. TapMem is motivated by this missing transition mechanism: it keeps the memory-token form, while using explicit termination signals and transition-aware routing adapter to make procedure transitions explicit.

Appendix B Additional Examples for TapMem

In Figure 11, we present a real tool-use example. TokMem selects an incorrect procedure <binary_search> and terminates generation prematurely, whereas TapMem selects the correct procedure and generates all arguments accurately. The example shows that ETS, instantiated by <EOC>, and routing refinement can explicitly strengthen transition modeling, thereby improving the accuracy of procedure selection and argument generation.

Figure

Figure 11: A real example of compositional procedure recall

Appendix C Algorithm of TapMem

For clarity, we provide the pseudocode of our Transition-Aware Procedural Memory in Algorithm 1 and Algorithm 2.

Algorithm 1 Training TapMem

            1:


          Input: Frozen LLM f_{\theta}; training data \mathcal{D}; memory-token set \mathcal{V}_{M}=\{m_{k}\}_{k=1}^{K}; <EOC>; adapter g_{\phi}; \alpha,\gamma.



            2:


          Output: \mathbf{E}, \mathbf{e}_{\mathrm{eoc}}, and g_{\phi}.



            3:


          Initialize \mathbf{E}, \mathbf{e}_{\mathrm{eoc}}, and g_{\phi}.



            4:


          for each (\mathbf{q},\{m^{(j)},\mathbf{a}^{(j)}\}_{j=1}^{J})\in\mathcal{D} do



            5:


            \mathbf{y}^{\prime}\leftarrow[\mathbf{q},m^{(1)},\mathbf{a}^{(1)},\texttt{<EOC>},\ldots,m^{(J)},\mathbf{a}^{(J)},\texttt{<EOC>}]



            6:


            \mathcal{B}\leftarrow\{b\mid y^{\prime}_{b}=\texttt{<EOC>},\,y^{\prime}_{b+1}\in\mathcal{V}_{M}\},  \mathcal{R}\leftarrow\{|\mathbf{q}|+1\}\cup\{b+1\mid b\in\mathcal{B}\}



            7:


            Run f_{\theta} on \mathbf{y}^{\prime} to obtain \{\mathbf{h}_{t-1},\mathbf{z}_{t}^{\mathrm{LM}}\}, and set \widetilde{\mathbf{z}}_{t}\leftarrow\mathbf{z}_{t}^{\mathrm{LM}}.



            8:


            \triangleright Transition-conditioned routing



            9:


            for each r\in\mathcal{R} do



            10:


             \bm{\pi}_{r}\leftarrow\operatorname{softmax}\!\left(g_{\phi}(\operatorname{stopgrad}(\mathbf{h}_{r-1}))\right)



            11:


             \widetilde{\mathbf{z}}_{r,\mathcal{V}_{M}}\leftarrow\mathbf{z}^{\mathrm{LM}}_{r,\mathcal{V}_{M}}+\alpha\left(\log\bm{\pi}_{r}-\log(1/K)\right)



            12:


            end for


            13:


            \triangleright Joint optimization



            14:


            \mathcal{L}_{\mathrm{AR}}\leftarrow-\displaystyle\sum_{t=|\mathbf{q}|+1}^{|\mathbf{y}^{\prime}|}\log\left[\operatorname{softmax}(\widetilde{\mathbf{z}}_{t})\right]_{y^{\prime}_{t}}



            15:


            \mathcal{L}_{\mathrm{route}}\leftarrow-\displaystyle\frac{1}{|\mathcal{R}|}\sum_{r\in\mathcal{R}}\log\pi_{r}(k_{r}),\quad y^{\prime}_{r}=m_{k_{r}}



            16:


            \mathcal{L}\leftarrow\mathcal{L}_{\mathrm{AR}}+\gamma\mathcal{L}_{\mathrm{route}}



            17:


            Update \mathbf{E}, \mathbf{e}_{\mathrm{eoc}}, and \phi using \mathcal{L}.



            18:


          end for


            19:


          return \mathbf{E}, \mathbf{e}_{\mathrm{eoc}}, and g_{\phi}.

Algorithm 2 Inference with TapMem

            1:


          Input: Frozen LLM f_{\theta}; trained \mathbf{E}, \mathbf{e}_{\mathrm{eoc}}, and g_{\phi}; query \mathbf{q}; memory-token set \mathcal{V}_{M}=\{m_{k}\}_{k=1}^{K}; logit scale \alpha; maximum sequence length T.



            2:


          Output: Generated sequence \hat{\mathbf{y}}.



            3:


          \hat{\mathbf{y}}\leftarrow\mathbf{q}



            4:


          for r=|\mathbf{q}|+1 to T do



            5:


            Run f_{\theta} on \hat{\mathbf{y}}_{<r} to obtain \mathbf{h}_{r-1} and \mathbf{z}_{r}^{\mathrm{LM}}.



            6:


            \widetilde{\mathbf{z}}_{r}\leftarrow\mathbf{z}_{r}^{\mathrm{LM}}



            7:


            \triangleright Boundary-conditioned routing



            8:


            if r=|\mathbf{q}|+1 or \hat{y}_{r-1}=\texttt{<EOC>} then



            9:


             \mathbf{z}_{r}^{\mathrm{TCRA}}\leftarrow g_{\phi}(\mathbf{h}_{r-1})



            10:


             \bm{\pi}_{r}\leftarrow\operatorname{softmax}(\mathbf{z}_{r}^{\mathrm{TCRA}})



            11:


             for k=1,\ldots,K do



            12:


               \Delta_{r}(k)\leftarrow\log\pi_{r}(k)-\log(1/K)



            13:


               \widetilde{z}_{r,m_{k}}\leftarrow z_{r,m_{k}}^{\mathrm{LM}}+\alpha\Delta_{r}(k)



            14:


             end for


            15:


            end if


            16:


            \triangleright Full-vocabulary autoregressive decoding



            17:


            Decode \hat{y}_{r} from \operatorname{softmax}(\widetilde{\mathbf{z}}_{r}) over \widetilde{\mathcal{V}}.



            18:


            Append \hat{y}_{r} to \hat{\mathbf{y}}.



            19:


            if \hat{y}_{r}=\texttt{<EOS>} then



            20:


             return \hat{\mathbf{y}}.



            21:


            end if


            22:


          end for


            23:


          return \hat{\mathbf{y}}.

Appendix D Additional Experimental Setting

We organize the experiments in this paper into four settings, which together cover both the recall and the execution of procedural memory. (1) Standard setting follows TokMem (Wu et al., 2026) and contains two recall protocols: compositional recall on APIGen, where a single request needs 2–4 procedure calls and is evaluated on Llama 3.2 1B/3B, Llama 3.1 8B, Qwen 3.5 4B/9B, and atomic recall on SNI, where each input needs exactly one procedure and is evaluated on Qwen 2.5 0.5B, Llama 3.2 3B, and Llama 3.1 8B. (2) Long-horizon setting keeps the compositional recall protocol but increases the number of procedure calls, and contains three experiments: compositional recall on TaskBench, compositional recall on TRAJECT-Bench, and an APIGen extension with up to 10 procedure calls. (3) Multi-turn execution setting evaluates interactive procedure execution on τ-bench and InterCode-Bash, where the model interacts with an environment and receives execution feedback. We report Task Success Rate on both benchmarks, and additionally report Database Match Rate and Invalid Action Rate on τ-bench. (4) Continual setting studies memory expansion by adding 10 unseen procedures to the 50 existing ones through both training-based expansion and six training-free cold-start methods. We evaluate the orchestration of existing and newly introduced procedures using Tool Selection F1 and Argument Generation F1.

Implementation Details. In the main experiments, the training is conducted for 3 epochs on synthetic data from APIGen (Liu et al., 2024b) for compositional recall. Our main experiments use Llama 3.2 1B/3B and Llama 3.1 8B (Grattafiori et al., 2024), with additional evaluations on Qwen 3.5 4B/9B (Team, 2026) to examine cross-family generalization. The atomic-recall experiments use Qwen 2.5 0.5B (Yang et al., 2025), Llama 3.2 3B, and Llama 3.1 8B. Greedy decoding is employed for all evaluations. The main results are reported as the average over three random seeds. The learning rate for memory embedding is 5× 10*-3*, 4× 10*-3*, and 5× 10*-3* for the 1B, 3B, and 8B backbones. We adopt Adam with Weight Decay (AdamW) (Kingma & Ba, 2015; Loshchilov & Hutter, 2019) optimizer with a weight decay of 0.01. For all experiments, TokMem (Wu et al., 2026) serves as the baseline of tokenized procedural memory. The TCRA adapter is implemented as a linear projection layer. All experiments are conducted on a single NVIDIA-A100 80GB GPU using mixed-precision bfloat16 training.

The following itemized descriptions detail the evaluation protocol and the capability assessed in each setting:

  • Standard setting. The standard setting evaluates the basic reliability of procedural memory under the recall protocols considered by TokMem (Wu et al., 2026). We distinguish between compositional recall and atomic recall as they isolate different aspects of procedural memory.

    • Compositional recall. Compositional recall on APIGen is designed to assess whether procedural memory can support multi-step procedure generation when a single user request requires several procedures to be coordinated within one generation. Unlike atomic recall, this setting requires the model to correctly coordinate multiple procedures. It therefore provides evidence for the model’s ability to perform reliable multi-procedure orchestration, and for the usefulness of TapMem’s explicit procedure-boundary representation in supporting such compositional use of procedural memory.
    • Atomic recall. Atomic recall evaluates the single-procedure case, in which the model selects one procedural memory before generating the corresponding response. By removing the need to coordinate multiple procedures, this setting isolates the reliability of basic memory-token routing and procedure-conditioned generation. Improvements in this setting indicate that the proposed routing refinement is not only useful when modeling transitions in compositional trajectories, but also improves the selection of an individual procedural memory in isolation. Thus, this setting assesses the reliability of procedural recall independently of multi-step orchestration.
  • Long-horizon setting. Beyond the short compositional sequences considered in the standard setting, the long-horizon setting examines longer procedure sequences with stronger dependencies. As the length of procedure chaining increases, an early routing error can propagate to later calls, requiring the model to preserve relevant procedural information and make reliable procedure selections throughout the trajectory. Accordingly, the long-horizon setting asks whether the method can preserve the quality of procedure selection and generation as the sequence grows and intermediate errors become more consequential. In this way, the setting assesses whether the method’s effectiveness extends from short compositional cases to longer and more demanding procedure sequences.

  • Multi-turn execution setting. Multi-turn execution on τ-bench and InterCode-Bash evaluates procedural memory in an interactive environment where multiple procedure calls are interleaved with environmental feedback. On τ-bench, the model additionally interacts with a simulated user and invokes stateful tools, while InterCode-Bash focuses on command execution with feedback from the environment. Successful execution requires the model to preserve the task objective while adapting procedure selection to changes in the execution context. The evaluation therefore focuses on state-dependent procedure orchestration and feedback-conditioned adaptation, rather than procedural recall within a fixed generation.

  • Continual setting. The continual setting evaluates whether procedural memory can incorporate procedures unseen during training while retaining reliable recall of existing procedures. We consider both training-based memory expansion and training-free cold-start initialization. In training-based expansion, additional examples are provided to learn the parameters associated with new procedures, while the backbone and all existing procedural parameters remain frozen. Under a cold-start protocol, the memory-token embedding and corresponding TCRA parameters for each unseen procedure are initialized from the existing procedural memory without demonstrations or gradient updates, and performance is evaluated separately on unseen and existing procedures. This setting therefore measures training-free memory expansion and the robustness of procedure selection and generation as the set of stored procedures grows.

Taken together, these settings evaluate procedural memory at increasing levels of difficulty: reliable routing of an individual procedure, coordination of multiple procedures within one generation, reliable procedure selection and generation over longer sequences, feedback-conditioned procedure orchestration across multiple interaction steps, and extension to unseen procedures through training-based and training-free approaches while preserving recall of existing procedures.

D.1 Details of Competitors

Here, we provide a detailed summary of the representative baselines spanning textualized context engineering, retrieval-augmented memory, parameter-efficient fine-tuning, and tokenized procedural memory methods.

  • Textualized context engineering. Across all settings for compositional recall, the ICL baseline places the available tool descriptions in the prompt and lets the model produce the sequence of function-call arguments directly (Brown et al., 2020; Patil et al., 2024; Qin et al., 2024). As for atomic recall, the Base baseline directly provides the task instruction in text and asks the model to generate the answer without any trainable procedural memory (Wu et al., 2026).
  • Retrieval-augmented textual memory. Across all settings for compositional recall, RAG indexes the tool descriptions and retrieves a small set of candidate tools, e.g., top-k tools provided by benchmark itself, which are then placed in the prompt for generation (Lewis et al., 2020; Karpukhin et al., 2020; Patil et al., 2024; Qin et al., 2024). As for atomic recall, RAG builds a non-parametric retrieval index from Natural Instructions task demonstrations and retrieves the most similar demonstration according to the input query (Lewis et al., 2020; Karpukhin et al., 2020; Wang et al., 2022).
  • Parameter-efficient fine-tuning. We include LoRA as a parameter-efficient learning baseline for compositional tool invocation. LoRA adapts the frozen backbone through a small set of low-rank update matrices inserted into selected attention projections (Hu et al., 2022). This baseline evaluates whether reusable procedures can be captured by lightweight parametric adaptation alone. The LoRA learning rate is 5× 10*-5* for Llama 3.2 1B/3B and 8× 10*-6* for Llama 3.1 8B.
  • Tokenized Procedural Memory. We use TokMem as the baseline of tokenized procedural memory. It represents each procedure as a trainable token and invokes procedures through autoregressive token generation (Wu et al., 2026).

D.2 Detailed Standard Settings

Following TokMem (Wu et al., 2026), we conduct a variety of experiments under the standard setting, including compositional recall on APIGen with both the Llama and Qwen model families, as well as atomic recall on SNI.

D.2.1 Compositional Recall on APIGen

Dataset

For compositional recall, we use a multi-tool calling benchmark synthesized from APIGen (Liu et al., 2024b). APIGen is an automated data generation pipeline for constructing verifiable and diverse function-calling datasets. It collects 3,673 executable APIs across 21 categories and uses them to synthesize natural-language query–response pairs in a scalable and structured way. The released APIGen dataset contains 60,000 high-quality entries and covers multiple query styles, including simple, multiple, parallel, and parallel-multiple function-calling cases, making it a suitable resource for evaluating and training LLMs on tool selection and argument generation.

Data Construction

Following TokMem (Wu et al., 2026), we remove web-search-related tools from the dataset and select the 100 tools with the most samples. We use the first 50 tools to construct the training dataset for the adaptation stage and the remaining 50 tools to construct the dataset for the main training stage of TapMem. For TapMem with adaptation, the training data used in the second stage is the same as the training data used by TapMem without adaptation. We first split the original atomic examples into training and test sets. For each tool, we retain 50 examples from the training split as atomic training data. We then construct compositional examples separately within each split by randomly combining atomic examples from that split and joining their queries with conjunctions. Each compositional sample contains at least 2 calls and at most 4 calls. All samples in the test set are compositional samples. In total, 2,500 atomic samples and 2,500 compositional samples are included in the training set, while 500 samples are included in the test set.

Metrics

We report Tool Selection F1 and Arguments Generation F1. Tool Selection F1 compares sets of predicted and reference tools, while Arguments Generation F1 requires both the procedure and its generated arguments to be correct. These metrics do not account for call order or repeated identical calls. We compute F1 for each example and then average the scores across examples.

Transition Error

We evaluate transition errors at both the token level and the sample level. At the token level, each gold transition step is considered separately. The first procedure in an example is treated as the initial decision, whereas each subsequent procedure is treated as a transition decision because it requires the model to move from one procedure to the next. A token-level transition error occurs when the model predicts an incorrect procedure at any subsequent procedure-selection step. If the model stops early and misses a later gold procedure, that step is also counted as incorrect. Extra predicted procedures beyond the gold sequence are ignored under this metric. At the sample level, we examine whether an example contains any transition error. If any subsequent procedure-selection step is predicted incorrectly, the whole example is counted as having a transition error. Therefore, the sample-level metric measures how often a multi-procedure example contains at least one transition failure, whereas the token-level metric measures how many individual transition decisions are incorrect.

Table 5: Atomic recall results on the SNI dataset. This setting contains a single procedural memory selection per example. Results for TokMem and TapMem are reported as the mean followed by the sample standard deviation across three seeds. For the deterministic Base and RAG baselines, the standard deviation is not applicable. “–” denotes that the metric is not applicable. The champion and the runner-up within each model are highlighted in bold and underline, respectively.

ModelMetricBaseRAGTokMemTapMem
Qwen 2.5 0.5BRouting Accuracy––90.60 (±0.13)93.85 (±0.13)
Rouge-L40.4533.4346.68 (±0.06)46.75 (±0.13)
Llama 3.2 3BRouting Accuracy––95.58 (±0.19)97.15 (±0.14)
Rouge-L20.1540.2551.96 (±0.50)52.20 (±0.45)
Llama 3.1 8BRouting Accuracy––97.08 (±0.02)97.68 (±0.11)
Rouge-L21.8242.3357.66 (±0.16)57.89 (±0.21)

D.2.2 Compositional Recall on More Backbones

We additionally evaluate TapMem on the APIGen compositional recall benchmark with more backbones, namely Qwen 3.5 4B and Qwen 3.5 9B (Team, 2026), in order to examine whether the gains observed on the Llama family transfer across model families. This setting follows the APIGen compositional recall protocol described in Section D.2.1 and adopts the same configuration.

D.2.3 Atomic Recall on SNI

Dataset

Super-Natural Instructions (SNI) (Wang et al., 2022) is a large-scale collection of instruction-formatted NLP tasks. Each task consists of a natural-language definition, positive and negative examples, and multiple input-output instances. The dataset is commonly used to evaluate instruction following and cross-task generalization. It covers 1,616 tasks across 76 task types, where each task is treated as a reusable procedure and represented by a procedural memory token. Each input is associated with exactly one target procedure, so the model only needs to select a single memory token before generating the corresponding answer.

Metrics

For atomic memory recall, we use procedural memory token Routing Accuracy to measure the correctness of memory-token selection and ROUGE-L (Lin, 2004) to evaluate the quality of the generated textual response.

Data Construction

Following the process as TokMem, we first remove cross-lingual tasks from the SNI dataset. From the remaining tasks, we sample 700 tasks, with 80 training samples, 10 validation samples, and 20 test samples drawn from each task.

Table 6: Fine-grained atomic recall results for the top 20 categories by task count. Each category is shown as a paired comparison between TokMem and our method; Δ is computed by subtracting the displayed TokMem value from the displayed value of our method.

CategoryTasksMethodRouting Acc (%)Δ AccRouge-LΔ Rouge-L
Question Answering86TokMem75.64+5.1933.21+0.30
Ours80.8333.51
Program Execution71TokMem92.44+1.9331.27+2.04
Ours94.3733.31
Question Generation44TokMem85.80-2.9624.49+0.31
Ours82.8424.80
Sentiment Analysis43TokMem97.09+1.2869.00-2.75
Ours98.3766.25
Text Matching32TokMem93.13+0.4174.90-0.49
Ours93.5474.41
Text Categorization30TokMem95.89+1.8949.91+1.11
Ours97.7851.02
Toxic Language Detection23TokMem97.54+1.2358.23-1.48
Ours98.7756.75
Commonsense Classification22TokMem99.55+0.3753.01-0.28
Ours99.9252.73
Information Extraction18TokMem83.43+1.0143.96-0.95
Ours84.4443.01
Textual Entailment18TokMem90.46-0.7450.12-0.95
Ours89.7249.17
Wrong Candidate Generation16TokMem78.33+4.3821.91+2.59
Ours82.7124.50
Sentence Composition14TokMem80.71+5.4836.43+0.50
Ours86.1936.93
Text Completion14TokMem91.43+0.3625.92+2.09
Ours91.7928.01
Title Generation14TokMem76.55+3.0926.52+2.50
Ours79.6429.02
Misc.12TokMem63.89+4.1715.34+0.39
Ours68.0615.73
Question Understanding12TokMem94.72-0.2843.32+0.99
Ours94.4444.31
Answerability Classification10TokMem98.50+1.0070.39+1.64
Ours99.5072.03
Dialogue Generation10TokMem88.50+0.5021.94+0.34
Ours89.0022.28
Language Identification9TokMem92.04+4.4460.37+6.93
Ours96.4867.30
Summarization9TokMem73.33-5.1823.37+0.07
Ours68.1523.44

Table 7: Additional compositional recall results using Qwen 3.5 4B and 9B on the APIGen dataset in terms of F1. † denotes training-free methods.

MethodTool SelectionArgument
2 calls3 calls4 callsAvg.2 calls3 calls4 callsAvg.
Qwen 3.5 4B
ICL†75.970.970.073.264.261.862.963.0
RAG†87.283.487.285.367.262.565.364.8
TokMem87.4 (±1.3)84.0 (±0.5)75.9 (±7.9)85.2 (±0.9)59.6 (±1.0)56.2 (±1.9)44.4 (±3.0)57.2 (±1.4)
TapMem93.6 (±3.0)91.6 (±3.5)91.9 (±3.4)92.6 (±3.3)69.8 (±8.2)71.3 (±6.9)67.5 (±7.5)70.4 (±7.5)
TokMem + adaptation98.0 (±1.6)97.0 (±0.8)95.2 (±1.2)97.4 (±1.1)77.9 (±2.3)77.3 (±1.7)74.7 (±4.0)77.4 (±2.0)
TapMem + adaptation98.6 (±0.4)98.7 (±0.6)98.1 (±1.1)98.6 (±0.5)83.9 (±2.7)83.6 (±1.5)79.4 (±1.8)83.5 (±2.0)
Qwen 3.5 9B
ICL†77.374.273.975.668.267.372.968.0
RAG†87.581.779.784.371.567.262.269.0
TokMem93.9 (±2.1)89.8 (±1.4)89.3 (±4.8)91.7 (±1.5)71.9 (±4.6)67.4 (±3.6)62.6 (±6.7)69.3 (±3.8)
TapMem96.0 (±1.3)95.1 (±0.7)93.0 (±4.7)95.4 (±0.6)79.0 (±2.2)79.3 (±0.9)71.2 (±9.7)78.8 (±1.7)
TokMem + adaptation98.5 (±0.5)98.6 (±0.7)97.8 (±0.4)98.5 (±0.6)82.7 (±1.9)85.3 (±2.6)75.8 (±0.8)83.6 (±2.1)
TapMem + adaptation99.3 (±0.5)99.3 (±0.2)99.8 (±0.3)99.4 (±0.2)82.3 (±2.5)84.4 (±2.5)81.3 (±2.0)83.2 (±2.3)

D.3 Detailed Long-Horizon Setting

D.3.1 Compositional recall on TaskBench and TRAJECT-Bench

Beyond the standard setting following TokMem, we further conduct two additional experiments on TaskBench and TRAJECT-Bench and evaluate our method with more tool calls on APIGen. Following the APIGen setting, we use the same evaluation metrics for both benchmarks: Tool Selection F1 and Argument Generation F1.

Benchmarks

TaskBench (Shen et al., 2024) is a benchmark for evaluating LLMs on multi-step planning. It organizes tools as a tool graph, where nodes represent procedures and directed edges encode dependencies between them. Tasks are constructed from different graph structures, making it suitable for evaluating procedure orchestration under explicit dependency constraints. TRAJECT-Bench (He et al., 2026) evaluates LLMs on realistic trajectories across diverse application domains. It includes multi-step trajectories with varying lengths and dependency structures. We use its sequential trajectories to evaluate long-horizon procedure orchestration with explicit inter-procedure dependencies.

Data Construction

For TaskBench, we retain the node and chain examples from the DailyLife subset. Each node example contains one procedure, while each chain example contains several dependent procedures. For each chain example, we arrange the procedures in task_nodes using the dependency edges in task_links. The resulting order serves as the ground truth procedure sequence. As TaskBench contains repeated generated requests, so we keep examples with the same request in one data partition. Finally, we obtain 3,234 training examples and 809 test examples over 40 procedures. For TRAJECT-Bench, we select the sequential subset from the original data, remove invalid or incomplete tool steps while preserving the relative order of the remaining steps. We then iteratively filter the data so that each procedure occurs at least 12 times. Each retained trajectory is converted into an example consisting of a user request, an ordered procedure sequence, and the corresponding arguments, with minor formatting modifications to adapt the data to our setting. For data splitting, we group trajectories by domain, sequence name, and ordered tool list, and assign each group entirely to either training or test. Both APIGen and TRAJECT-Bench evaluate generalization within a shared set of tools.

Table 8: Detailed compositional recall results on TaskBench and TRAJECT-Bench in terms of F1. † denotes training-free methods.

BenchmarkModelMethodTool Selection (%)Argument (%)
TaskBenchLlama 3.2 1BICL†2.73.1
RAG†8.18.2
TokMem88.9(±0.9)66.6(±1.5)
TapMem93.8(±0.8)70.7(±1.1)
Llama 3.2 3BICL†46.243.0
RAG†60.557.0
TokMem85.0(±1.0)64.5(±1.1)
TapMem91.2(±0.6)69.5(±1.1)
Llama 3.1 8BICL†62.963.4
RAG†67.665.2
TokMem87.3(±0.7)66.2(±0.8)
TapMem90.3(±0.4)69.4(±1.0)
TRAJECT-BenchLlama 3.2 1BICL†24.01.8
RAG†49.54.3
TokMem76.7(±1.6)45.9(±5.9)
TapMem81.9(±2.5)52.6(±6.3)
Llama 3.2 3BICL†68.225.7
RAG†69.933.6
TokMem69.3(±6.8)40.2(±9.3)
TapMem73.0(±7.4)45.5(±9.1)
Llama 3.1 8BICL†86.352.7
RAG†79.945.4
TokMem80.8(±2.1)54.6(±2.7)
TapMem86.8(±0.3)59.7(±3.7)

D.3.2 Compositional Recall with More Tool Calls

For compositional recall with more tool calls, we further extend the synthetic dataset by using the same samples to construct longer samples. Each sample contains up to 10 calls. The training set includes 2,500 atomic samples and 5,500 compositional samples. Among the compositional samples, the proportions of samples with different numbers of tool calls are kept consistent.

D.4 Detailed Multi-Turn Execution Setting

D.4.1 τ-bench

Dataset and Training.

τ-bench (Yao et al., 2025) evaluates agents through user interactions and stateful tool execution. APIGen-MT (Prabhakar et al., 2025) provides synthetic multi-turn trajectories generated using the Airline and Retail environments of τ-bench. The data are generated through simulated interactions between agents and users. They include conversations, tool calls, and execution feedback. We use Llama 3.2 3B as the backbone. We select 300 Airline trajectories for backbone adaptation and 500 Retail trajectories for procedural memory training.

Evaluation.

At each decision step, the model conditions on the interaction history to select a tool call or a response action. Both methods share the same DeepSeek-Flash user simulator and response-generation module, while TokMem and TapMem control tool selection, arguments, and response timing. We use greedy decoding for the evaluated model, allow up to 30 decision steps, and run one rollout per task for each training seed. We report task success rate, database match rate, and invalid action rate. Database match rate measures exact agreement between the final and reference database states, while invalid action rate measures the proportion of decisions that fail action validation.

Metrics.

We report Task Success Rate, Database Match Rate, and Invalid Action Rate. Task Success Rate measures the proportion of tasks satisfying the benchmark’s completion criteria. Database Match Rate measures the proportion of tasks whose final database states exactly match the reference states. Invalid Action Rate measures the proportion of decisions that fail action validation. Higher values are better for the first two metrics, while lower values are better for the last.

D.4.2 InterCode-Bash

Dataset

InterCode-Bash (Yang et al., 2023) is an interactive coding benchmark in which a model solves Bash-based tasks by repeatedly issuing shell commands and receiving execution feedback from an environment. Each task consists of a natural-language instruction, an initial execution environment, and a target state that determines whether the task has been completed successfully. We use all 200 official InterCode-Bash tasks and define 62 fixed procedures covering the available shell operations. NL2Bash (Lin et al., 2018) is a dataset for natural-language-to-Bash translation, consisting of natural-language descriptions paired with corresponding Bash commands. We use NL2Bash to construct the training data for procedural memory.

Data Construction

Since InterCode-Bash is derived from NL2Bash, we construct the training data from NL2Bash and remove all source groups that overlap with or closely resemble the 200 official InterCode-Bash tasks. We then parse the remaining commands with bashlex to find the positions where a command can be safely split. Each procedure corresponds to one shell utility. We keep the utilities that occur frequently enough. The resulting data yields 62 procedures and 5,259 unique training examples. Each example pairs one instruction with its command, and the command itself is the training target. The procedural memory embedding is trained on this data and applied without modification in the multi-turn execution setting.

Interaction Protocol

At each interaction step, the model receives the original task instruction together with the execution feedback produced by the previous step, and then generates the next Bash command. The command is executed in the environment before the resulting feedback is returned to the model. We evaluate each task with a maximum of 2, 3, 4, or 10 command execution rounds. Greedy decoding is used throughout evaluation. A task is terminated when the model produces the right response or when the interaction budget is exhausted.

Metrics

We report task success rate as the benchmark does. The success rate is the proportion of evaluation tasks whose final environment state matches the target state.

D.5 Detailed Continual Setting

D.5.1 Training-Based Memory Expansion

Data and Training.

We start from Llama 3.2 1B checkpoints trained on 50 existing procedures and introduce 10 unseen procedures. Both the additional training data and the test data contain a mixture of existing and new procedures. TokMem updates only the new memory-token embeddings. TapMem additionally updates the corresponding TCRA parameters. The backbone and all existing procedural parameters remain frozen. Both methods are trained for three epochs with a learning rate of 5×10−2.

D.5.2 Training-Free Memory Expansion

Experimental setting.

All cold-start experiments start from the same Llama 3.1 8B checkpoint used in the standard compositional recall setting, where the first 50 procedures form the existing procedural memory. We then add 10 procedures that are never seen during training and evaluate on a mixed test set that contains both existing and unseen procedures, reporting Tool Selection F1 and Argument Generation F1 on the full set and separately on the two subsets. Throughout this process, we collect no demonstrations and perform no gradient updates, and the backbone together with all existing memory-token embeddings and TCRA parameters are kept frozen. Only the memory-token embedding and TCRA weight of an unseen procedure are synthesized. The same synthesis protocol and the same six cold-start methods are applied to TokMem and TapMem, so the comparison isolates how each base method accommodates an unseen procedure.

We define 𝒫exist={pi}i=1K for the existing procedures and 𝒫unseen={pu}u=1U for the unseen ones, then represent each procedure by its name and description. Using Sentence-BERT (Reimers & Gurevych, 2019; Wang et al., 2020) as the frozen sentence encoder qψ, we encode this information and normalize the resulting representation:

𝐝i=qψ(pi)‖qψ(pi)‖2,𝐝u=qψ(pu)‖qψ(pu)‖2

The semantic similarity between an unseen procedure pu and an existing procedure pi is computed as

sui=𝐝u⊤𝐝i

For each existing procedure, let 𝐞i denote its memory-token embedding and let 𝐰i denote its corresponding TCRA weight. The similarity-based methods and the clustering-based method first compute coefficients aui over the existing procedures and then synthesize

𝐞~u=∑i=1Kaui𝐞i,𝐰~u=∑i=1Kaui𝐰i

The same coefficients are used for the memory embedding and TCRA parameters, so that all components of an unseen procedure are initialized consistently.

Similarity-based methods. We consider four methods that differ in which existing procedures are used and how their semantic similarities are converted into weights.

Top-3 Softmax (T3-SM). For each unseen procedure, we first select the three existing procedures with the highest semantic similarities:

𝒩u=TopKi∈{1,…,K}(sui,3)

We then apply a temperature-scaled softmax over these three similarities:

aui=𝕀[i∈𝒩u]exp(sui/τ)∑j∈𝒩uexp(suj/τ),τ=0.1

where 𝕀[⋅] denotes the indicator function, which equals 1 when its argument is true and 0 otherwise. Thus, the memory embedding and routing parameters of a unseen procedure are synthesized primarily from the most similar existing procedure, while the other two selected procedures provide complementary information.

Top-3 Cosine (T3-Cos). Top-3 Cosine uses the same set 𝒩u, but directly normalizes the nonnegative cosine similarities instead of applying a softmax. Define

Zu(3)=∑j∈𝒩umax(suj,0)

When Zu(3)>0, the coefficients are

aui=𝕀[i∈𝒩u]max(sui,0)Zu(3)

If all three similarities are non-positive, the method assigns a uniform weight of 1/3 to each selected procedure. Compared with Top-3 Softmax, this method preserves the relative cosine similarities without sharpening their differences through temperature scaling.

All Softmax (All-SM). All Softmax applies the temperature-scaled softmax to all K existing procedures:

aui=exp(sui/τ)∑j=1Kexp(suj/τ),τ=0.1.

This method does not explicitly restrict the number of contributing procedures. Consequently, every existing procedure receives a nonzero weight, although procedures with lower semantic similarity contribute less.

Positive Cosine (Pos-Cos). Positive Cosine synthesizes the new parameters from all existing procedures that have positive semantic similarity to the unseen procedure. Unlike the previous methods, it uses neither Top-k selection nor softmax normalization. Let the set of positively similar procedures be

𝒮u+={i∣sui>0}.

The positive cosine similarities are normalized directly:

aui=𝕀[i∈𝒮u+]sui∑j∈𝒮u+suj.

Therefore, procedures with higher semantic similarity contribute more to the synthesized parameters, while procedures with non-positive similarity are excluded. If 𝒮u+ is empty, the method uses the uniform average of all existing procedures, with aui=1/K.

Clustering-based method: Clustering Mean (C-Mean).

Clustering Mean first groups the existing procedure representations using cosine K-means. We use C=5 clusters and at most 100 clustering iterations. Let \bm{\mu}_{c} denote the normalized centroid of cluster c. The cluster selected for a unseen procedure is

c_{u}^{*}=\text{argmax}_{c\in\{1,\ldots,C\}}\mathbf{d}_{u}^{\top}\bm{\mu}_{c}.

Let 𝒞cu∗ denote the set of existing procedures assigned to the selected cluster. Clustering Mean assigns equal weights to all procedures in this cluster:

aui=𝕀[i∈𝒞cu∗]|𝒞cu∗|.

Unlike the similarity-based methods, Clustering Mean uses the cluster structure of the existing procedure space rather than the individual similarity between pu and each existing procedure.

Regression-based method**: Ridge.** Ridge fits a single global linear map from the semantic representation of a procedure to its learned parameters, instead of weighting individual donors. Let 𝐃∈ℝK×d collect the existing representations and let \mathbf{\Theta}^{(g)} collect their parameters of type g, where g ranges over the memory embedding, and the TCRA weight. The map is obtained by ridge regression, which adds an ℓ2 penalty on the coefficients to the least-squares objective:

\widehat{\mathbf{B}}_{g}=\arg\min_{\mathbf{B}_{g}}\left\|\mathbf{D}\mathbf{B}_{g}-\mathbf{\Theta}^{(g)}\right\|_{F}^{2}+\lambda\left\|\mathbf{B}_{g}\right\|_{F}^{2},\qquad\lambda=0.1.

The parameter of an unseen procedure is then predicted as \widetilde{\bm{\theta}}_{u}^{(g)}=\mathbf{d}_{u}^{\top}\widehat{\mathbf{B}}_{g}.

Compared with the other five methods, Ridge does not select or average a subset of existing procedures; it predicts an unseen procedure’s parameters through a single global linear map.

Norm matching and model integration.

Following the renormalization used by TokMem (Wu et al., 2026) to stabilize newly added memories, we rescale every synthesized parameter vector to the mean norm of the corresponding existing parameter bank. The target norms are

ρE=1K∑i=1K‖𝐞i‖2,ρW=1K∑i=1K‖𝐰i‖2.

The final parameters are

𝐞u=ρE𝐞~umax(‖𝐞~u‖2,ϵ),𝐰u=ρW𝐰~umax(‖𝐰~u‖2,ϵ)

Each unseen procedure is synthesized independently using only the original K procedures. Its memory embedding and TCRA parameters are then appended to the trained model, while the backbone, existing memory embeddings, and existing TCRA parameters remain unchanged. Among the six methods, Top-3 Softmax provides the strongest overall cold-start performance in our comparison.

D.6 Detailed Setting for Initial Procedure Selection Analysis

We analyze Llama 3.2 1B predictions on APIGen. For each method and run, we divide examples into two groups according to whether the first predicted procedure is correct. Empty predictions are assigned to the incorrect group. Within each group, we compute Tool Selection F1 and Argument Generation F1 over the complete call sequence, including the first call. We average the scores across examples in each group and then across three runs.

D.7 Settings for Evaluation Cost

We evaluate TokMem and TapMem on APIGen with Llama 3.2 1B, using a single GPU for each run. (1) Measurements. We report routing accuracy, generation latency per batch, total generated tokens, throughput, and end-to-end time. (2) Protocol. Both methods use FP32 precision, the same prompting template, batch sizes of 1 and 256, and greedy decoding with at most 512 newly generated tokens. We perform two warm-up batches and average three timing repetitions using the same checkpoint and inference seed of 42. (3) Timing boundaries. Generation latency covers prefill and decoding from inputs ready on the GPU to generation completion. End-to-end time additionally includes input preparation and output parsing. Model loading, warm-up, accuracy scoring, and result saving are excluded.

D.8 Settings for Extended Evaluation of Procedure Orchestration

We supplement the set-based F1 metrics with procedure-level routing accuracy and Dependency Satisfaction Rate (DSR) to evaluate procedure order and dependency preservation.

Procedure-Level Routing Accuracy.

We evaluate the existing TaskBench and TRAJECT-Bench predictions from Llama 3.2 1B/3B and Llama 3.1 8B. Routing accuracy is the number of correct procedure predictions at matching positions divided by the total number of reference calls.

Dependency Satisfaction Rate.

The official revised TaskBench DailyLife DAG data and the node/chain data used for training are derived from the same underlying tool graph (Shen et al., 2024). We evaluate Llama 3.2 1B and Llama 3.1 8B on this DAG subset using the checkpoints from our main experiments. Models receive only the task instruction, without reference graphs or annotated steps. For example i, let Ei denote the reference dependency set and Si the number of satisfied dependencies. A dependency (u,v) is satisfied when both procedures appear and the first occurrence of u precedes that of v. We compute

DSR=1N∑i=1NSi|Ei|,

where N counts examples with at least one reference dependency. DSR measures the average fraction of satisfied dependencies while allowing equivalent valid call orders.

D.9 Settings for Additional Ablation Studies

We evaluate two additional variants on APIGen with Llama 3.2 1B. (1) TokMem*†* decouples the input and output memory-token embeddings to obtain a parameter budget comparable to TapMem. (2) TokMem*‡* further adds routing supervision to the output memory-token logits of TokMem*†*, without explicit boundary-conditioned routing. We follow the standard compositional recall setting and report mean Tool Selection F1 and Argument Generation F1 over three seeds.

Table 9: Results of compositional recall with more tool calls on Llama 3.2 1B across 2-to-10 procedure calls. Δ denotes the improvement of TapMem over TokMem.

CallsMethodTool Selection(%)Δ Tool Selection(%)Argument(%)Δ Argument(%)
2TokMem88.8+2.575.9+2.7
Ours91.378.6
3TokMem89.4+6.276.7+6.8
Ours95.683.5
4TokMem89.3+2.372.3+3.8
Ours91.676.1
5TokMem88.9+3.474.9+3.9
Ours92.378.8
6TokMem89.3+3.675.4+3.5
Ours92.978.9
7TokMem87.6+4.070.4+5.1
Ours91.675.5
8TokMem88.9+4.272.2+5.1
Ours93.177.3
9TokMem84.9+6.969.1+6.5
Ours91.875.6
10TokMem83.9+7.665.1+9.6
Ours91.574.7
Avg.TokMem88.2+4.273.0+4.9
Ours92.477.9

Table 10: Detailed ablation study on the effectiveness of ETS and TCRA in terms of F1.

ETSTCRATool SelectionArgument
2 calls3 calls4 callsAvg.2 calls3 calls4 callsAvg.
Llama 3.2 1B
83.282.276.482.467.667.655.267.0
✓83.685.375.884.068.070.754.868.6
✓✓88.889.681.088.874.974.165.074.0
Llama 3.2 3B
73.675.370.374.259.759.752.159.3
✓78.381.177.979.662.466.557.964.2
✓✓81.182.781.481.965.565.458.365.1

Appendix E Additional Experimental Results

E.1 Expanded Version of Results on Standard Setting

E.1.1 Detailed Results on More Backbones

Table 7 shows that TapMem improves the average Tool Selection and Argument Generation F1 over TokMem by 7.4% and 13.2% on Qwen 3.5 4B, and by 3.7% and 9.5% on Qwen 3.5 9B, respectively. Together with the results on the Llama backbones, these gains demonstrate that TapMem generalizes effectively across model families.

E.1.2 Detailed Results on Atomic Recall

Table 5 reports the results on the Atomic Recall setting, where TapMem improves Routing Accuracy over TokMem by 3.25%, 1.57% and 0.60% on the 0.5B, 3B, and 8B backbones, respectively, while slightly improving Rouge-L. The results show that TapMem also improves single-step procedure routing in this setting, and further supports the effectiveness of TapMem: beyond modeling transitions in compositional trajectories, its routing refinement also makes isolated memory-token selection more reliable. Table 6 compares TokMem and TapMem on the 20 categories with the largest number of samples. TapMem improves on most tasks, and the gains are relatively clear. On the two largest categories, it improves Routing Accuracy by 5.19% on Question Answering and by 1.93% on Program Execution.

E.2 Expanded Version of Results of Long-Horizon Setting

E.2.1 Detailed Results on TaskBench and TRAJECT-Bench

Table 8 reports the detailed results on TaskBench and TRAJECT-Bench. On TaskBench, TapMem improves Tool Selection F1 and Argument Generation F1 over TokMem by 4.7% and 4.1% on average, respectively. On TRAJECT-Bench, the corresponding improvements are 5.0% and 5.7%. Together, these results demonstrate the effectiveness of TapMem on long-horizon procedure orchestration across both graph-structured dependencies and realistic multi-procedure trajectories.

We further evaluate TokMem and TapMem with backbone adaptation on TaskBench. Table 11 reports the results, showing that TapMem improves both F1 scores across all three backbones. Argument Generation F1 improves by 1.2%–2.4%, with the largest gain on Llama 3.1 8B. These results show that explicitly modeling procedure transitions remains beneficial after backbone adaptation.

Table 11: TaskBench results across three backbone sizes with and without backbone adaptation.

ModelMethodTool Selection (%)Argument (%)
Llama 3.2 1BTokMem88.9(±0.9)66.6(±1.5)
TapMem93.8(±0.8)70.7(±1.1)
TokMem + adaptation95.5(±0.1)71.7(±0.2)
TapMem + adaptation96.9(±0.1)73.4(±0.2)
Llama 3.2 3BTokMem85.0(±1.0)64.5(±1.1)
TapMem91.2(±0.6)69.5(±1.1)
TokMem + adaptation96.0(±0.6)73.4(±0.7)
TapMem + adaptation97.3(±0.5)74.6(±0.4)
Llama 3.1 8BTokMem87.3(±0.7)66.2(±0.8)
TapMem90.3(±0.4)69.4(±1.0)
TokMem + adaptation94.8(±1.1)71.2(±1.3)
TapMem + adaptation96.0(±1.4)73.6(±0.7)

E.2.2 Detailed Results on More Tool Calls

Table 9 reports the detailed compositional recall results with 2 to 10 procedure calls. TapMem consistently outperforms TokMem across all call counts, with average improvements of 4.2% in Tool Selection F1 and 4.9% in Argument Generation F1. The advantage becomes pronounced at longer horizons. At 9 calls, TapMem improves Tool Selection F1 and Argument Generation F1 by 6.9% and 6.5%, respectively, and the gains further increase to 7.6% and 9.6% at 10 calls. Meanwhile, from 2 to 10 calls, TokMem drops from 88.8% to 83.9% in Tool Selection F1 and from 75.9% to 65.1% in Argument Generation F1, whereas TapMem changes from 91.3% to 91.5% and from 78.6% to 74.7%, respectively. These results show that TapMem better maintains both procedure selection and argument generation as procedure chains grow longer, supporting the effectiveness of explicit transition modeling for long-horizon procedural orchestration.

To examine whether these gains on longer procedure chains persist after backbone adaptation, we further evaluate TokMem and TapMem on APIGen using Llama 3.2 1B. Table 12 reports the overall results and results at selected call counts, showing improvements in both F1 scores. The Tool Selection F1 gain increases from 0.8% at three calls to 2.5% at ten calls, indicating a larger benefit for procedure selection on longer chains even after backbone adaptation.

Table 12: APIGen results with backbone adaptation on Llama 3.2 1B. Overall covers all examples with 2-10 procedure calls.

MethodTool SelectionArgument
3 call5 call10 callOverall3 call5 call10 callOverall
TokMem + adaptation98.197.593.697.386.284.078.782.6
TapMem + adaptation98.998.496.198.486.785.479.884.1

E.3 Expanded Version of Results on Continual Setting

Figure

Figure 12: Comparison of cold-start methods. The hatched extension above each bar denotes the gain of TapMem over TokMem.

E.3.1 Training-Free Memory Expansion

Figure 12 reports the cold-start results of the six synthesis methods on the unseen and the existing procedures. On Tool Selection, TapMem improves over TokMem for almost every synthesis method on both the unseen and the existing procedures, with gains of up to 18.4% on the unseen procedures and between 15.4% and 18.4% on the existing ones. On Argument F1, the advantage is consistent across all six methods, from 2.1% to 13.5% on the unseen procedures and from 5.2% to 8.3% on the existing ones. Under the best synthesis method, Top-3 Softmax, TapMem raises Tool Selection F1 from 33.5% to 44.4% and Argument F1 from 15.7% to 22.8% on procedures that are never seen during training. These results indicate that the benefit does not come from the cold-start strategy itself but from the transition mechanism that TapMem adds on top of tokenized procedural memory. This suggests that reliable procedure transitions remain valuable when procedural memory grows beyond the procedures seen during training.

E.4 Expanded Version of Results on Ablation Study

Ablation study on components. Table 10 presents the detailed ablation results of different modules in our method. The results show that setting with ETS outperforms the unmodified TokMem baseline in most call-count settings. TCRA further improves the performance and achieves the best results.

Table 13: Gradient-flow ablation results.

BackboneGradient DesignTool SelectionArgument
Llama 3.2 1BGradient Propagating87.572.1
Gradient Blocked89.774.3
Llama 3.2 3BGradient Propagating80.762.0
Gradient Blocked81.462.7
Llama 3.1 8BGradient Propagating84.666.7
Gradient Blocked86.774.7

Ablation study on gradient flow. Table 13 presents the results under two gradient designs across three backbones. Blocking gradients improves Tool Selection F1 by 2.2%, 0.7%, and 2.1%, and improves Argument F1 by 2.2%, 0.7%, and 8.0% on the 1B, 3B, and 8B models, respectively, demonstrating the effectiveness of our gradient design.

Ablation study on parameter budget and routing supervision. Table 14 shows that TokMem*†* and TokMem*‡* underperform TapMem despite comparable parameter budgets. TapMem also outperforms TCRA-only while using the same routing module and supervision. These results support the benefit of explicitly modeling procedure transitions beyond additional parameters or routing supervision alone.

Table 14: Additional ablation results on APIGen with Llama 3.2 1B.

ETSTCRAMethodAdditional Parameters (M)Tool SelectionArgument
(%)(%)
TokMem0.1082.467.0
TokMem*†*0.2087.568.9
TokMem*‡*0.2087.765.4
✓ETS-only0.1084.068.6
✓TCRA-only0.2086.670.0
✓✓TapMem0.2188.874.0

E.5 Comparison of Evaluation Cost

Table 15: Evaluation cost on APIGen with Llama 3.2 1B. Total generated tokens and end-to-end time cover all 500 test examples. Timing values are averaged over three repetitions using the same checkpoint.

Batch SizeMethodRouting Accuracy (%)Generation Latency (s/batch)Total Generated TokensThroughput (tasks/s)End-to-End Time (s)
1TokMem69.741.97355990.507986.51
1TapMem83.822.00359510.4981003.55
256TokMem69.7491.21355992.724183.57
256TapMem83.8292.90359512.674186.95

Table 15 compares evaluation cost under matched settings. TapMem improves routing accuracy from 69.74% to 83.82%, while per-task generation latency at batch size one increases from 1.97 to 2.00 seconds. At batch size 256, throughput changes from 2.724 to 2.674 tasks per second, and end-to-end time increases from 183.57 to 186.95 seconds. These results show that TapMem achieves higher routing accuracy with a small additional time cost in the evaluated setting.

E.6 Results of Extended Evaluation of Procedure Orchestration

Table 16: Procedure-level routing accuracy (%) on TaskBench and TRAJECT-Bench. Δ denotes the improvement of TapMem over TokMem.

BenchmarkBackboneTokMemTapMemΔ
TaskBenchLlama 3.2 1B61.1569.38+8.23
Llama 3.2 3B55.1962.92+7.73
Llama 3.1 8B53.3958.70+5.31
TRAJECT-BenchLlama 3.2 1B58.9268.40+9.48
Llama 3.2 3B51.9458.09+6.15
Llama 3.1 8B64.3876.97+12.59

Procedure-Level Routing Accuracy.

Table 16 reports routing accuracy by comparing the predicted and reference procedures at each step of the call sequence. TapMem improves routing accuracy across all three backbones on both benchmarks, with gains of 5.31%–8.23% on TaskBench and 6.15%–12.59% on TRAJECT-Bench. These results show that TapMem’s improvements extend beyond set-based F1 to more accurate procedure selection when call order and repeated calls are taken into account.

Table 17: Dependency Satisfaction Rate (%) on the official revised TaskBench DailyLife DAG data. Δ denotes the improvement of TapMem over TokMem.

MethodLlama 3.2 1BLlama 3.1 8B
TokMem39.0041.15
TapMem50.9154.23
\bm{\Delta}+11.91+13.08

Dependency Preservation.

Table 17 reports how well the generated calls satisfy the annotated dependencies. TapMem improves DSR by 11.91% and 13.08% on the 1B and 8B backbones, respectively. These results show that TapMem better preserves procedure dependencies even when evaluation allows equivalent valid call orders.

Appendix F Comparison of Parameter Count

In Table 18, we report the number of trainable parameters for the parameterized methods across models of different scales. Our method requires substantially fewer trainable parameters than fine-tuning. Although it has more trainable parameters than TokMem, it still follows a linear growth trend with the embedding dimension.

Table 18: Trainable parameter counts in the compositional recall experiment.

BackboneFine-tuningTokMemOurs
Llama 3.2 1B0.85M0.10M0.21M
Llama 3.2 3B2.29M0.15M0.31M
Llama 3.1 8B3.41M0.20M0.41M