SlowGuess commited on
Commit
61df2ee
·
verified ·
1 Parent(s): 59b6328

Add Batch fd9e6ba1-15f8-4cc4-8d0f-60948efa8fa7

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. ameloastableframeworkforarenabasedllmevaluation/485ae2a8-1fc5-402d-9e71-4d6939418c63_content_list.json +3 -0
  2. ameloastableframeworkforarenabasedllmevaluation/485ae2a8-1fc5-402d-9e71-4d6939418c63_model.json +3 -0
  3. ameloastableframeworkforarenabasedllmevaluation/485ae2a8-1fc5-402d-9e71-4d6939418c63_origin.pdf +3 -0
  4. ameloastableframeworkforarenabasedllmevaluation/full.md +403 -0
  5. ameloastableframeworkforarenabasedllmevaluation/images.zip +3 -0
  6. ameloastableframeworkforarenabasedllmevaluation/layout.json +3 -0
  7. any4learned4bitnumericrepresentationforllms/aed8248d-b454-44ef-a338-4bc6daba1424_content_list.json +3 -0
  8. any4learned4bitnumericrepresentationforllms/aed8248d-b454-44ef-a338-4bc6daba1424_model.json +3 -0
  9. any4learned4bitnumericrepresentationforllms/aed8248d-b454-44ef-a338-4bc6daba1424_origin.pdf +3 -0
  10. any4learned4bitnumericrepresentationforllms/full.md +483 -0
  11. any4learned4bitnumericrepresentationforllms/images.zip +3 -0
  12. any4learned4bitnumericrepresentationforllms/layout.json +3 -0
  13. egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/dabdc8cf-f6a6-4355-a6eb-b0bb1e491482_content_list.json +3 -0
  14. egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/dabdc8cf-f6a6-4355-a6eb-b0bb1e491482_model.json +3 -0
  15. egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/dabdc8cf-f6a6-4355-a6eb-b0bb1e491482_origin.pdf +3 -0
  16. egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/full.md +0 -0
  17. egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/images.zip +3 -0
  18. egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/layout.json +3 -0
  19. idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/65055bae-2509-400e-8ce0-3845df4dd036_content_list.json +3 -0
  20. idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/65055bae-2509-400e-8ce0-3845df4dd036_model.json +3 -0
  21. idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/65055bae-2509-400e-8ce0-3845df4dd036_origin.pdf +3 -0
  22. idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/full.md +499 -0
  23. idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/images.zip +3 -0
  24. idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/layout.json +3 -0
  25. in2vbringingtransductivenodeembeddingstoinductivegraphs/ec3b92d6-d965-474b-8dbc-c6cd2382d329_content_list.json +3 -0
  26. in2vbringingtransductivenodeembeddingstoinductivegraphs/ec3b92d6-d965-474b-8dbc-c6cd2382d329_model.json +3 -0
  27. in2vbringingtransductivenodeembeddingstoinductivegraphs/ec3b92d6-d965-474b-8dbc-c6cd2382d329_origin.pdf +3 -0
  28. in2vbringingtransductivenodeembeddingstoinductivegraphs/full.md +0 -0
  29. in2vbringingtransductivenodeembeddingstoinductivegraphs/images.zip +3 -0
  30. in2vbringingtransductivenodeembeddingstoinductivegraphs/layout.json +3 -0
  31. polybasicspeculativedecodingthroughatheoreticalperspective/c209dea3-671d-40ba-8304-63ed84180a96_content_list.json +3 -0
  32. polybasicspeculativedecodingthroughatheoreticalperspective/c209dea3-671d-40ba-8304-63ed84180a96_model.json +3 -0
  33. polybasicspeculativedecodingthroughatheoreticalperspective/c209dea3-671d-40ba-8304-63ed84180a96_origin.pdf +3 -0
  34. polybasicspeculativedecodingthroughatheoreticalperspective/full.md +418 -0
  35. polybasicspeculativedecodingthroughatheoreticalperspective/images.zip +3 -0
  36. polybasicspeculativedecodingthroughatheoreticalperspective/layout.json +3 -0
  37. rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/89161b7c-6df7-4137-b941-fe2dd4396dd2_content_list.json +3 -0
  38. rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/89161b7c-6df7-4137-b941-fe2dd4396dd2_model.json +3 -0
  39. rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/89161b7c-6df7-4137-b941-fe2dd4396dd2_origin.pdf +3 -0
  40. rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/full.md +791 -0
  41. rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/images.zip +3 -0
  42. rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/layout.json +3 -0
  43. scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/48fbbc80-0e7b-4115-954d-1fc9c1c533d4_content_list.json +3 -0
  44. scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/48fbbc80-0e7b-4115-954d-1fc9c1c533d4_model.json +3 -0
  45. scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/48fbbc80-0e7b-4115-954d-1fc9c1c533d4_origin.pdf +3 -0
  46. scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/full.md +492 -0
  47. scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/images.zip +3 -0
  48. scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/layout.json +3 -0
  49. scsslbenchbenchmarkingselfsupervisedlearningforsinglecelldata/e3272a7b-9b2d-4675-9e7c-9b951557e63e_content_list.json +3 -0
  50. scsslbenchbenchmarkingselfsupervisedlearningforsinglecelldata/e3272a7b-9b2d-4675-9e7c-9b951557e63e_model.json +3 -0
ameloastableframeworkforarenabasedllmevaluation/485ae2a8-1fc5-402d-9e71-4d6939418c63_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb50db766cfc3d27805fa43ed1b637ff8916d94428d15d1afe1bb32d611e5497
3
+ size 85281
ameloastableframeworkforarenabasedllmevaluation/485ae2a8-1fc5-402d-9e71-4d6939418c63_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46a965a0c4168c8796f2d5a9c79c05a0b5831d511ac9ea0c5e42229262b9342f
3
+ size 108494
ameloastableframeworkforarenabasedllmevaluation/485ae2a8-1fc5-402d-9e71-4d6939418c63_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3d85563c43f1a41fb544b3890634a6d2cb0adee181d5fad93b258b4e77f89f4
3
+ size 596592
ameloastableframeworkforarenabasedllmevaluation/full.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Zirui Liu<sup>1</sup> Jiatong Li<sup>1</sup> Yan Zhuang<sup>1</sup> Qi Liu *<sup>1,2</sup> Shuanghong Shen<sup>2</sup> Jie Ouyang<sup>1</sup> Mingyue Cheng<sup>1</sup> Shijin Wang<sup>1,3</sup>
2
+
3
+ # Abstract
4
+
5
+ Arena-based evaluation is a fundamental yet significant evaluation paradigm for modern AI models, especially large language models (LLMs). Existing framework based on ELO rating system suffers from the inevitable instability problem due to ranking inconsistency and the lack of attention to the varying abilities of annotators. In this paper, we introduce a novel stable arena framework to address these issues by enhancing the ELO Rating System. Specifically, we replace the iterative update method with a Maximum Likelihood Estimation (MLE) approach, m-ELO, and provide theoretical proof of the consistency and stability of the MLE approach for model ranking. Additionally, we proposed the am-ELO, which modify the Elo Rating's probability function to incorporate annotator abilities, enabling the simultaneous estimation of model scores and annotator reliability. Experiments demonstrate that this method ensures stability, proving that this framework offers a more robust, accurate, and stable evaluation method for LLMs.
6
+
7
+ # 1. Introduction
8
+
9
+ The rapid advancement of large language models (LLMs) (Jin et al., 2024b; Ouyang et al., 2025; Cheng et al., 2025) has led to the proliferation of "model arenas"—platforms designed to compare and evaluate multiple models, identifying their relative strengths and weaknesses (Chiang et al., 2024). These arenas play a critical role in driving innovation and shaping the deployment of cutting-edge LLMs across diverse applications. The ELO rating system (Elo, 1967), a well-established methodology for quantitatively
10
+
11
+ $^{1}$ State Key Laboratory of Cognitive Intelligence, University of Science and Technology of China, Hefei, China $^{2}$ Institute of Artificial Intelligence, Hefei Comprehensive National Science Center, Hefei, China $^{3}$ iFLYTEK Co., Ltd, Hefei, China. Correspondence to: Qi Liu <qiliuql@ustc.edu.cn>.
12
+
13
+ Proceedings of the $42^{nd}$ International Conference on Machine Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).
14
+
15
+ ![](images/eec39451a21d29c2cd4095500fb92db07423906b63b9ffdf5468f6f409de525c.jpg)
16
+ Figure 1. An example of ELO score. The error bar represents the standard deviation and the error line represents the difference between the maximum or minimum value and the mean value. The line chart represents the ELO scores estimated from the records of the specific annotator.
17
+
18
+ assessing the relative capabilities of competitors in games, forms the theoretical foundation for the evaluation systems in most existing model arenas (Bai et al., 2022; Boubdir et al., 2023).
19
+
20
+ A significant issue with the current ELO method is its instability, which can be attributed to two main factors: 1) From an algorithmic perspective, the existing ELO method treats the data as dynamic, making the results highly sensitive to the order in which the data is presented (Aldous, 2017; Li et al., 2024; Zhang et al., 2024a). In other words, when the same records are shuffled and re-evaluated, the ELO method often yields inconsistent scores. For instance, as shown in Figure 1, the significant error (highlighted in gray) complicates the comparison of models with similar abilities. 2) The judgment of human annotators varies across different aspects such as quality, relevance, and importance of texts. For example, in the line chart in Figure 1, different annotators provide inconsistent ELO scores for each model. However, the arena-based evaluation paradigm, which involves human participation, overlooks these individual differences among humans (Welinder & Perona, 2010; Raykar & Yu, 2011).
21
+
22
+ Ignoring this variability introduces biases and instability into the evaluation process, further undermining the credibility of both the results and the decisions derived from
23
+
24
+ ![](images/e932662433623135f527ebce1baa93cca3f1de2a14bb9a63c5d3c658ebe66399.jpg)
25
+ Figure 2. The traditional iterative ELO method and our proposed am-ELO method based on MLE.
26
+
27
+ them (Eickhoff, 2018). These instabilities diminish the interpretability and practical value of ELO scores, eroding confidence in the conclusions drawn from such evaluations, particularly when they are used to inform high-stakes decisions regarding model deployment or research directions.
28
+
29
+ In this work, we propose a novel stable arena framework to address these shortcomings. As illustrated in Figure 2, to mitigate the inconsistencies in ELO scores, we introduce a maximum likelihood estimation (MLE)-driven ELO rating method, referred to as m-ELO. By deriving the theoretical properties of this reformulation, we demonstrate that the proposed method produces consistent results without altering the fundamental principles of the original ELO method. Furthermore, to account for variability in annotator performance, we propose an annotator ability-aware enhancement method for ELO (am-ELO), grounded in psychometrics (Morizot et al., 2009; Furr, 2021). By modifying the ELO probability function, we estimate the annotator's ability and adjust their contribution accordingly, leading to a more accurate and equitable aggregation of evaluation results.
30
+
31
+ Through experiments on real-world datasets, we demonstrate that our framework effectively models annotators while ensuring the consistency of ELO scores. Furthermore, in simulation experiments, our method not only identifies anomalous annotators but also reduces the inconsistency of ELO scores to $30\%$ compared to the traditional ELO method. This indicates that our approach effectively mitigates the instability inherent in the traditional ELO method.
32
+
33
+ # 2. Background and Related Work
34
+
35
+ Arena-based evaluation is an important subfield within the broader domain of LLM evaluation. Unlike traditional evaluation paradigms (Zellers et al., 2019; Hendrycks et al., 2020; Cobbe et al., 2021; Liang et al., 2022; Jin et al., 2024a), which typically assess a model's performance against predefined benchmarks, arena-based evaluation involves models
36
+
37
+ competing directly with others. Current research in this area can generally be divided into three key categories: Battle Scenarios, Annotators, and Ranking Systems.
38
+
39
+ **Battle Scenario** The classic battle scenario is exemplified by the Chatbot Arena (Chiang et al., 2024), in which models respond to the same question and annotators compare their outputs. However, this approach are susceptible to the inherent biases of the annotators. To address this issue, several studies have incorporated multiple models working collaboratively to generate and evaluate responses, enabling iterative improvements (Zhao et al., 2024). Notable examples of this approach include LLMChain (Bouchiha et al., 2024) and ChatEval (Chan et al., 2024). While such strategies offer increased fairness, they come with trade-offs, including higher computational costs and potential instability.
40
+
41
+ Annotator In arena-based evaluation, the comparison of results typically involves human annotators (Cheng et al., 2024) or highly capable LLMs, such as GPT-4 (Achiam et al., 2023) and Claude (Anthropic). Additionally, some researchers have explored the use of specialized referee models for this task, such as PandaLM (Wang et al., 2023), JudgeLM (Zhu et al., 2023), and Auto-J (Li et al., 2023), which are designed to enhance the evaluation process.
42
+
43
+ Ranking Systems for LLM Evaluation Ranking systems play a crucial role in arena-based LLM evaluation (Busa-Fekete et al., 2014; Szörenyi et al., 2015; Chernoff, 1992). Among the existing approaches, many arena-based methods rely on the ELO Rating System to model LLMs' capabilities (Coulom, 2007; Pelanek, 2016). The ELO rating system, grounded in the Bradley-Terry model (Hunter, 2004; Rao & Kupper, 1967), is widely used in competitive games (Sismanis, 2010; Ebtekar & Liu, 2021) to predict the likelihood of one competitor outperforming another based on their relative abilities. However, due to its dynamic nature, which is tailored for traditional competitive games, the ELO system introduces instability in LLM evaluation. To mitigate this instability, existing approaches typically perform multiple random shuffles of the annotated dataset and calculate ELO scores for each iteration (Sismanis, 2010). The statistical summary, such as the mean or variance of the scores across these shuffles, is then used as the final evaluation metric. Although this strategy provides a practical solution, it does not fundamentally resolve the inconsistency introduced by the sequential updates in the ELO method.
44
+
45
+ # 3. Preliminary
46
+
47
+ Arena-based Evaluation is a highly anticipated method in LLMs evaluation, where models are compared head-to-head on benchmarks or datasets and the results are annotated by evaluators. Let $S = \{(i,j,k,W_{ij})|i,j\in [N],k\in [M]\}$
48
+
49
+ Algorithm 1 The Traditional ELO Rating System
50
+ Input: Dataset $S$ , Scaling Factor $K$ , Init Score $R_{init}$
51
+ Initialize: Set of Scores $RS_{i}\gets \emptyset$ , Score of Models
52
+ $R_{i}\gets R_{init}$
53
+ Calculate ELO Score:
54
+ for $(i,j,W_{ij})\in S$ do
55
+ $R_i^{\prime}\gets R_i + K\cdot (W_{ij} - P(R_i,R_j))$ $R_j^\prime \gets R_j + K\cdot (W_{ji} - P(R_j,R_i))$
56
+ end for
57
+ Output: ELO Score $(R_1,\dots ,R_N)$
58
+
59
+ represent the comparative dataset we have collected, where $N$ is the number of models and $M$ is the number of annotators. Each element $(i,j,k,W_{ij})\in S$ indicates that model $i$ and model $j$ engaged in a battle, and annotator $k$ provided the result $W_{ij}$ . Specifically, $W_{ij} = 1$ indicates that model $i$ won the battle, $W_{ij} = 0$ indicates that model $j$ won, and $W_{ij} = 0.5$ indicates a tie. The goal of the arena-based evaluation is to estimate the ranking scores $R = (R_1,\dots ,R_N)$ for the models based on the record $S$ .
60
+
61
+ ELO Rating System The ELO rating system is a widely used method for ranking competitors based on pairwise comparisons. In the ELO system, each competitor (or model) is assigned a rating $R$ , which represents its relative strength. When two models, $i$ and $j$ , compete, their respective ratings, $R_i$ and $R_j$ , are used to calculate the expected probability of each outcome: $P(R_i, R_j) = P(W_{ij} = 1) = \frac{1}{1 + e^{-C(R_i - R_j)}}$ , where $C$ is a constant that scales the difference in ratings. After observing the actual outcome of the match, the ratings are updated as follows:
62
+
63
+ $$
64
+ \begin{array}{l} R _ {i} ^ {\prime} = R _ {i} + K \cdot \left(W _ {i j} - P \left(R _ {i}, R _ {j}\right)\right), \\ R _ {j} ^ {\prime} = R _ {j} + K \cdot \left(W _ {j i} - P \left(R _ {j}, R _ {i}\right)\right), \tag {1} \\ \end{array}
65
+ $$
66
+
67
+ where $K$ is a scaling factor that controls the magnitude of rating changes. The pseudo-code for this process is shown in Algorithm 1. However, the existing ELO method is iterative and highly sensitive to the order of the data. This is irrational for LLMs' evaluation because evaluation can be seen as a static process (Zhan et al., 2024). Specifically, the errors introduced by the ELO method arise from the algorithm's dynamics rather than the data itself, which undermines the statistical significance of the ELO scores for many models.
68
+
69
+ Moreover, current algorithms do not account for differences in annotator abilities. They treat all annotators as if they have the same ability $C$ , mixing annotation records randomly. This assumption can introduce bias and instability into the evaluation process.
70
+
71
+ # 4. Better Performance estimation with ELO
72
+
73
+ Earlier, we introduced the traditional ELO method and highlighted its key challenges, including ranking inconsistencies and the lack of consideration for annotator variability. To address these issues, this section presents a stable arena framework with improvements to the ELO method.
74
+
75
+ # 4.1. MLE for ELO (m-ELO) Estimation
76
+
77
+ The traditional ELO rating estimation method is based on an iterative algorithm, and the results are highly dependent on the order of the samples. This explains why ELO ratings often lack consistency. Inspired by the insensitivity of maximum likelihood estimation (MLE) to the sample order, we propose an MLE-driven ELO estimation algorithm, termed m-ELO. Specifically, for the record dataset $S$ , its log-likelihood function can be expressed as follows:
78
+
79
+ $$
80
+ \ln L = \sum_ {(i, j, W _ {i j}) \in S} W _ {i j} \ln P \left(R _ {i}, R _ {j}\right) + W _ {j i} \ln P \left(R _ {j}, R _ {i}\right), \tag {2}
81
+ $$
82
+
83
+ where $P(R_{i},R_{j}) = \frac{1}{1 + e^{-C(R_{i} - R_{j})}}$ . The result of the MLE method, $(R_1^*,R_2^*,\ldots ,R_N^*)$ , can be obtained by solving the extreme point of the log-likelihood function using gradient descent. Specifically, for any given model $n\in [N]$ , the gradient of the log-likelihood function with respect to its rating $R_{n}$ is:
84
+
85
+ $$
86
+ \frac {\partial \ln L}{\partial R _ {n}} = \sum_ {(n, j, W _ {n j}) \in S} C \left(W _ {n j} - P \left(R _ {n}, R _ {j}\right)\right), \tag {3}
87
+ $$
88
+
89
+ By comparing Equations 1 and 3, we observe that the two formulas share a consistent structure. This highlights the essence of the ELO algorithm: it performs gradient descent with a learning rate of $\frac{K}{C}$ on the MLE for each annotated sample. Gradient descent based on individual samples rarely converges, which reveals a key shortcoming of the traditional ELO method.
90
+
91
+ Convergence Analysis Although the estimation results of the MLE method are not influenced by the sample order, another important consideration is whether the log-likelihood function has only one extreme point. If multiple extreme points exist, it could still lead to inconsistencies in the ELO rankings. Unfortunately, because ELO scores are relative, it is clear that if $(R_1^*, R_2^*, \ldots, R_N^*)$ is an extreme point, then $(R_1^* + \epsilon, R_2^* + \epsilon, \dots, R_N^* + \epsilon)$ is also an extreme point. Thus, the extreme points of the log-likelihood function are not unique. However, when we fix the score of one of the models, we obtain the following theorem (Zermelo, 1929):
92
+
93
+ Theorem 4.1. Assume $R_0 = 0$ and $|S|$ is sufficiently large, then the log-likelihood function $\ln L$ with respect to $(R_2, \dots, R_N)$ is a concave function and has at most one extreme point.
94
+
95
+ Drawing from Theorem 4.1, we can assert that the ELO score obtained through the MLE method is relatively stable between models, meaning that the difference in ability between any two models remains stable.
96
+
97
+ Replacing the iterative method with the MLE approach makes the ELO method more flexible. Additionally, it allows us to model annotator abilities during the evaluation process. In the next section, we will adopt ideas from psychometrics to propose a feasible modeling approach and analyze its interpretability.
98
+
99
+ # 4.2. Annotator Modeling m-ELO (am-ELO) Estimation
100
+
101
+ Although ability modeling is not commonly seen in LLM evaluation, many ability modeling methods have been developed in education and psychometrics (Liu et al., 2021; Wang et al., 2022; Zhang et al., 2024b; Zhuang et al., 2022; Liu et al., 2024). One prominent method is Item Response Theory (IRT) (Embretson & Reise, 2013; Zhu et al., 2022; Nguyen & Zhang, 2022; Polo et al., 2024). IRT posits that an examinee's performance on a test depends solely on its ability $\theta$ and the properties of the questions. The standard model is the two-parameter logistic (2PL) model, defined as: $P_{j}(\theta) = P(y_{j} = 1) = \frac{1}{1 + e^{-a_{j}(\theta - b_{j})}}$ , where $y_{j} = 1$ indicates a correct response to question $j$ , and $a_{j}$ and $b_{j} \in \mathbb{R}$ represent the discrimination and difficulty of question $j$ .
102
+
103
+ As noted, the parameter $a$ in IRT can be interpreted as the discrimination parameter. Similarly, in the ELO method, the fixed value $C$ can also be understood as the discrimination parameter. To account for annotator variability, we replace the fixed value $C$ in the probability density estimation with a parameter $\theta_{k}$ that is specific to annotator $k$ :
104
+
105
+ $$
106
+ P \left(R _ {i}, R _ {j} \mid \theta_ {k}\right) = \frac {1}{1 + e ^ {- \theta_ {k} \left(R _ {i} - R _ {j}\right)}}, \tag {4}
107
+ $$
108
+
109
+ This new formulation has the following properties:
110
+
111
+ - Maintain symmetry: The symmetry to the model's abilities $R_{i}$ and $R_{j}$ is preserved even after modifying the constant $C$ to an annotator-related parameter $\theta_{k}$ , such that $P(R_{i}, R_{j}|\theta_{k}) + P(R_{j}, R_{i}|\theta_{k}) = 1$
112
+ - Discriminative ability ( $\theta_{k} > 0$ ): When the abilities of two models are identical, the change in win probability caused by small variations in ability values is positively correlated with annotator's ability $\theta_{k} = 4\frac{\partial P(R_{i},r)}{\partial R_{i}}\big|_{R_{i} = r}$ . Therefore, the annotator's ability $\theta_{k}$ represents the maximum discriminative ability.
113
+ - Anomalous annotator $(\theta_{k} < 0)$ : When the discriminative ability $\theta_{k}$ , it is observed that for any model $i$ with greater ability than model $j$ , annotator $k$ perceives the probability of model $i$ winning as less than 0.5. This indicates that it is an anomalous annotator.
114
+
115
+ To estimate the parameters of the probability function, we consider its logarithmic likelihood function similarly:
116
+
117
+ $$
118
+ \sum_ {(i, j, k, W _ {i j}) \in S} W _ {i j} \ln P \left(R _ {i}, R _ {j} \mid \theta_ {k}\right) + W _ {j i} \ln P \left(R _ {j}, R _ {i} \mid \theta_ {k}\right). \tag {5}
119
+ $$
120
+
121
+ After modifying the probability function, we need to account for both the ELO scores of the models $R = (R_{1},\dots ,R_{N})$ and the abilities of the annotators $\Theta = (\theta_{1},\ldots ,\theta_{M})$ during gradient descent. For a model $n\in [N]$ and annotator $m\in [M]$ , the gradients of $\ln L$ to them can be expressed as:
122
+
123
+ $$
124
+ \frac {\partial \ln L}{\partial R _ {n}} = \sum_ {(x, j, k, W _ {n j}) \in S} \theta_ {k} \left(W _ {n j} - P \left(R _ {n}, R _ {j} \mid \theta_ {k}\right)\right),
125
+ $$
126
+
127
+ $$
128
+ \frac {\partial \ln L}{\partial \theta_ {m}} = \sum_ {(i, j, m, W _ {i j}) \in S} \left(R _ {i} - R _ {j}\right) \left(W _ {i j} - P \left(R _ {i}, R _ {j} \mid \theta_ {m}\right)\right). \tag {6}
129
+ $$
130
+
131
+ This method allows us to simultaneously estimate the annotators' abilities during the MLE process. Beyond the concept of discrimination introduced by the improved probability function, we should also explore the practical significance of this ability estimation in the context of the arena. Through analysis, we find that the estimated annotator ability $\theta_{k}$ exhibits the following two properties:
132
+
133
+ Theorem 4.2. Given that $\theta$ represents the ability of annotators estimated by am-ELO, the following conclusions can be drawn:
134
+
135
+ (1) If two annotators label the same set of samples $W_{ij}$ , $W_{ij}'$ with abilities $\theta_1$ and $\theta_2$ ( $\theta_2 > \theta_1$ ), then:
136
+
137
+ $$
138
+ \sum_ {(i, j, W _ {i j}) \in S ^ {\prime}} (R _ {i} - R _ {j}) W _ {i j} < \sum_ {(i, j, W _ {i j} ^ {\prime}) \in S ^ {\prime}} (R _ {i} - R _ {j}) W _ {i j} ^ {\prime}.
139
+ $$
140
+
141
+ (2) If $\theta_{k} < 0$ , for each positive sample $(i,j,k,1)$ of annotator $k$ , its loss $\frac{\partial\ln l}{\partial R_i} < 0$ , and for each negative sample $(i,j,k,0)$ of annotator $k$ , $\frac{\partial\ln l}{\partial R_i} > 0$ .
142
+
143
+ From Theorem 4.2, it is evident that the annotator abilities derived from MLE have practical significance. Specifically, $\sum_{(i,j,W_{ij})\in S}(R_i - R_j)W_{ij}$ can be interpreted as the correlation between the annotations $W_{ij}$ and the rankings $R_i - R_j$ . Theorem 4.2 (1) implies that a higher annotator ability corresponds to a greater value of $\sum_{(i,j,W_{ij})\in S'}(R_i - R_j)W_{ij}$ , meaning that a larger $\theta_k$ indicates that the annotations from annotator $k$ are more consistent with the overall rankings. Meanwhile, Theorem 4.2 (2) suggests that an annotator with negative ability might annotate inconsistently or arbitrarily, and am-ELO can identify these anomalous annotators.
144
+
145
+ Normalization Although this method has strong interpretability for modeling annotators, it is not difficult to observe that, for such an optimization problem, if $(R_1^*,\dots ,R_N^*,\theta_1^*,\dots ,\theta_M^*)$ is an extreme point, then
146
+
147
+ Algorithm 2 The am-ELO Rating System
148
+ Input: Dataset $S$ , Learning Rate $\alpha$ , Epoch Epoch
149
+ Initialize: Score of Models $R$ and annotators' ability $\Theta$
150
+ for $t = 1$ to Epoch do Calculate MLE: $\ln L\gets \mathrm{MLE}(R,\Theta ,S)$ Optimize: $R\gets R + \alpha \frac{\partial\ln L}{\partial R},\Theta \gets \Theta +\alpha \frac{\partial\ln L}{\partial\Theta}$ Normalization: $\Theta \leftarrow \frac{\Theta}{\mathbf{1}^T\cdot\Theta}$
151
+ end for
152
+ Output: ELO Score and annotators' ability $(R,\Theta)$
153
+
154
+ Algorithm 3 The Stable Arena framework
155
+ Input: Learning Rate $\alpha$ , Epoch Epoch, Ability Threshold $\epsilon$ .
156
+ Initialize: Dataset $S \gets \emptyset$ , Data quantity threshold $\delta$ .
157
+ while True do
158
+ $S \gets S \cup S_{new}$
159
+ for $k = 1$ to $M$ do
160
+ $\delta_k = |\{(i,j,x,W_{ij})|x = k\}|$
161
+ end for
162
+ $S' \gets \{(i,j,k,W_{ij})|\delta_k > \delta\}$ $(R,\Theta) \gets \text{am-ELO}(S',\alpha, \text{Epoch})$ $(R_1, \dots, R_N) = R$
163
+ Output: ELO Score $(R_1, \dots, R_N)$ $(\theta_1, \dots, \theta_N) = \Theta$
164
+ Filter annotators: $S \gets \{(i,j,k,W_{ij})|\theta_k > \epsilon\}$
165
+ end while
166
+
167
+ $(\alpha R_1^*, \dots, \alpha R_N^*, \frac{1}{\alpha} \theta_1^*, \dots, \frac{1}{\alpha} \theta_M^*)$ is also an extreme point. Thus, when $\alpha < 0$ , the model score ranking will be completely reversed, leading to potential instability. To mitigate this issue, we impose a constraint on the annotator's ability:
168
+
169
+ $$
170
+ \theta_ {1} + \theta_ {2} + \dots + \theta_ {M} = 1. \tag {7}
171
+ $$
172
+
173
+ From Theorem 4.2 (2), we know that $\theta_{k} > 0$ corresponds to users who annotate normally. The significance of this normalization operation is essentially based on the assumption that the majority of annotators in the group are labeling responsibly (Nowak & Rüger, 2010). Based on this assumption, we determine whether the model rankings should follow the original order or be reversed.
174
+
175
+ # 4.3. Stable Arena Framework
176
+
177
+ Algorithm 2 presents the pseudo-code for the am-ELO algorithm. The am-ELO algorithm performs gradient descent (Ruder, 2016) on the negative log-likelihood function over the entire dataset to find the extreme point, ultimately returning both the model scores and annotator abilities. Specifically, when considering only the m-ELO algorithm, the concavity of its log-likelihood function enables the use of Newton's method (Galantai, 2000; Kelley, 2003) during optimization. This allows for dynamic adjustment of the learning rate, thereby improving convergence efficiency.
178
+
179
+ Building on the improvements to the ELO method discussed earlier, we introduce the Stable Arena Framework, a novel paradigm for arena-based evaluation, as detailed in Algorithm 3. To ensure more robust evaluations, we carefully screen the annotated data both before and after applying the am-ELO method. Specifically, upon incorporating new annotation samples, we first filter out annotators who have fewer than $\delta$ annotation records. This is crucial because annotators with fewer records tend to produce less reliable results. However, this does not imply permanent exclusion; once such annotators accumulate a sufficient number of annotations, their records will be reconsidered.
180
+
181
+ After evaluating both models and annotators, we further refine the process by filtering annotators based on their estimated abilities. Annotators with negative ability values, or those with ability values below a threshold $\epsilon$ , are deemed detrimental to the evaluation process. For these annotators, we either issue warnings or exclude them entirely from further evaluations. Moreover, since a higher $\theta$ indicates greater consistency between the annotations and the overall ranking, the LLM evaluation platform can reward annotators proportionally to their demonstrated abilities.
182
+
183
+ # 5. Experiments
184
+
185
+ In this section, we introduce and compare the performance of our proposed method with the traditional ELO method in predicting annotation results, highlighting the superior modeling capability of am-ELO. Additionally, we demonstrate the limitations of the traditional ELO method through a comparison of model rankings produced by various ELO methods and a case study. Next, we validate the convergence of the ELO rankings generated by our method, further reinforcing the validity of our approach for evaluating LLMs. Finally, to assess the stability of the ELO method, we apply four different strategies to perturb the annotators. Our results show that our method not only maintains stability in the tests but also effectively identifies anomalous annotators, emphasizing the superiority of our approach.
186
+
187
+ # 5.1. Dataset
188
+
189
+ We conduct experiments on a real annotation dataset, Chatbot (Zheng et al., 2023), which was collected from 13,000 distinct IP addresses in the Chatbot Arena between April and June 2023. The dataset consists of 33,000 curated conversations with pairwise human preferences. Each entry includes a question ID, the names of two models, their full conversation transcripts, the annotator's vote, and its ID. Due to the requirement for MLE in this experiment, individual samples may introduce instability. Consequently, we excluded annotator samples with fewer than 50 annotated records. The statistical information of the filtered dataset is shown in Table 1.
190
+
191
+ ![](images/0fe525e622853c1af579a3b01315f43f9033f849c76d15564f2a6ddad802554b.jpg)
192
+ Figure 3. The result of each LLMs on different evaluation method. Specifically, the line chart represents the normalized ELO scores $\uparrow$ (ranging from 0 to 1) of each LLM under different evaluation methods. The bar chart represents the Loss $\downarrow$ (log-likelihood function) of each LLM's match records under different evaluation methods.
193
+
194
+ Table 1. Statistics of the dataset
195
+
196
+ <table><tr><td>Dataset</td><td>Chatbot</td></tr><tr><td>#Annotators</td><td>42</td></tr><tr><td>#Models</td><td>20</td></tr><tr><td>#Response logs</td><td>4321</td></tr><tr><td>#Response logs per annotator</td><td>102.88</td></tr><tr><td>#Response logs per model</td><td>216.05</td></tr><tr><td>#Response logs per model pair</td><td>22.74</td></tr></table>
197
+
198
+ # 5.2. Setting
199
+
200
+ In this experiment, we consider a baseline model, the traditional ELO method, alongside two methods we proposed: m-ELO and am-ELO. For the iterative ELO method, we perform repeated experiments by shuffling the dataset 1000 times and averaging the results. The MLE is solved using the gradient descent (GD) approach with a learning rate of 0.1 and a fixed number of 2000 iterations. The code can be found in the github: https://github.com/bigdata-ustc/am-ELO.
201
+
202
+ # 5.3. Result and Case Study
203
+
204
+ The bar chart in Figure 3 presents the mean log-likelihood loss for each method. As shown, the loss difference between m-ELO and ELO, which share the same probability function, is minimal, while the loss for am-ELO is significantly lower than the other two methods. This indicates that am-ELO demonstrates better fitting ability. Furthermore, as shown in Table 2, am-ELO significantly outperforms the other two baseline models in prediction tasks, suggesting that am-ELO exhibits superior generalization ability. This
205
+
206
+ Table 2. The Performance of ELO method for prediction.
207
+
208
+ <table><tr><td>Method</td><td>MSE↓</td><td>AUC↑</td></tr><tr><td>ELO</td><td>0.1238±0.0031</td><td>0.7492±0.0068</td></tr><tr><td>m-ELO</td><td>0.1234±0.0029</td><td>0.7503±0.0066</td></tr><tr><td>am-ELO</td><td>0.1208±0.0034</td><td>0.7581±0.0067</td></tr></table>
209
+
210
+ ![](images/ff6c7ce42c0132139aee0383d64c6b5195a88cf206a05c0905c8daaa5717c346.jpg)
211
+ Figure 4. The heatmap shows the number of victories in battles between various models (Three models with similar abilities, koala-13b, vicuna-7b, gpt-13b, and the better or worse models than them). Each number in the figure represents the times the row model wins the column model in the battle.
212
+
213
+ also demonstrates that the improved probability function effectively models the annotators.
214
+
215
+ Meanwhile, the line chart in Figure 3 illustrates the ELO scores obtained from the three ELO methods. It is clear that the ranking trends of our proposed methods align closely with the traditional ELO method. However, there are some differences in the rankings of specific models, such as koala-13b, vicuna-7b, and gpt-13b.
216
+
217
+ To analyze these models with similar abilities, we categorize
218
+
219
+ ![](images/7d3dcfd6d7cf318329f3af91bcd42de4cfa41aee7b7ae934f171954272cf86bf.jpg)
220
+ Figure 5. The Loss and Consistency of the evaluation method at each epoch on the Chatbot dataset.
221
+
222
+ the remaining models into two groups based on their ELO scores: "Better" and "Worse", representing models that are better or worse than the aforementioned models. We visualize the number of matches between these models. As shown in Figure 4, each number represents the number of times the model in the row defeated the model in the column. For example, the first row and third column indicate that vicuna-7b lost to "Better" models 148 times. From this, we observe that although the head-to-head records between koala-13b and vicuna-7b do not differentiate their abilities, both models defeated the same number of "Better" models. Meanwhile, vicuna-7b lost to fewer "Better" and "Worse" models. Based on this result, we conclude that vicuna-7b is stronger than koala-13b, which aligns with the rankings provided by both am-ELO and m-ELO.
223
+
224
+ However, due to Koala-13B's large number of victories over "Worse" models, the traditional ELO method disproportionately weighs these victories during the scoring process, ultimately ranking Koala-13B higher than Vicuna-7B. This issue suggests that avoiding strong opponents and repeatedly defeating weaker ones could artificially inflate a model's ranking, which is an undesirable outcome.
225
+
226
+ # 5.4. The Convergence and Efficiency of ELO Methods
227
+
228
+ In this subsection, we discuss the convergence and efficiency of the proposed am-ELO. Our comparison methods not only three mentioned model but also am-ELO (w/o Norm), where normalization is not performed during training. To analyze the convergence and efficiency of the results obtained by each evaluation method, we record the loss (Loss) during the gradient descent process. Additionally, we perform five random initializations of the model parameters and calculate the consistency of the rankings (Consistency) (Hastie & Tibshirani, 1997) of the ELO scores output by these five models at each epoch. It should be noted that the iterative process of the traditional ELO method differs from the gradient descent approach of MLE. Therefore, we directly record the final output loss and consistency for the traditional ELO method. The results are shown in Figure 5.
229
+
230
+ As observed from the loss, the three MLE-based methods
231
+
232
+ all converge to a local minimum within a limited number of iterations. The loss at convergence for m-ELO is nearly identical to that of the traditional ELO, which is expected since both methods share the same probability estimation function. This once again demonstrates that m-ELO and traditional ELO are essentially equivalent. Moreover, amELO (w/o Norm) converges the fastest, followed by amELO, with m-ELO being the slowest. This is because amELO has more adjustable parameters compared to m-ELO, and am-ELO (w/o Norm) benefits from fewer constraints during the gradient descent process. However, as seen from the consistency, am-ELO (w/o Norm) quickly converges to different local minima, and its consistency stabilizes at 0.4. This suggests that the five outputs of this method exhibit two ordered sequences and three reversed sequences $\left(\frac{C_2^2 + C_3^2}{C_5^2} = 0.4\right)$ . On the other hand, am-ELO not only achieves stable rankings after sufficient gradient descent iterations but does so more efficiently than m-ELO. This demonstrates that the proposed am-ELO method strikes a balance between convergence and efficiency.
233
+
234
+ # 5.5. The Stability of Various ELO Methods
235
+
236
+ Since directly verifying the stability of the am-ELO method during the evaluation process is challenging, we use simulation experiments to introduce perturbation to the annotators. Specifically, we perturb the annotators' results using four strategies to simulate the presence of anomalous annotators that may occur during testing:
237
+
238
+ - Random: If model A wins, the result will have a $50\%$ chance of being changed to "Tie" and a $50\%$ chance of being changed to "model B wins", vice versa.
239
+ - Equal: All results are changed to "Tie".
240
+ - Flip: If model A wins, the result will be flipped to "model B wins", and vice versa. The outcome "Tie" remains unchanged.
241
+ - Mixed: A random selection is made from the first three perturbation strategies for each instance.
242
+
243
+ These perturbations mimic scenarios where intentional mislabeling occurs in annotations. Considering that the majority of annotators in the arena will annotate normally, the number of perturbations in our simulation experiment will not exceed half of the total number of annotators. We expect a stable scoring method to have two key properties: (1) it should produce ELO rankings consistent with those without perturbations, and (2) it should identify the anomalous annotators. The ground truth for the consistency of the ELO score is the pairwise comparison between the ELO rankings with and without perturbations, and the ground truth for identifying anomalous annotators is the F1-score
244
+
245
+ ![](images/bc6b542566994e5af2185ab974b5ee8cb370b5eeb974970901d4e40b206c2d09.jpg)
246
+ Figure 6. This figure contains four line charts and four scatter plots, corresponding to the ELO score consistency under the four types of perturbation, as well as the changes in annotator abilities obtained from am-ELO as the level of perturbation increases.
247
+
248
+ ![](images/3546ccdc4e6a4a7c61681b7ae84d785e09cc9918681cb7d2ead93cf70d0ccc3f.jpg)
249
+ Figure 7. The line chart of F1-score for outlier detection at different thresholds under the four types of perturbation.
250
+
251
+ (Chen & Lin, 2006) of the annotators' abilities obtained from am-ELO. A higher F1-score indicates better accuracy in detecting the perturbations.
252
+
253
+ The line charts in Figure 6 show the relationship between the ratio of perturbations and the consistency of ELO scores. We observe that am-ELO maintains higher consistency across various types of perturbations. Specifically, aside from the fact that the "Equal" perturbation itself is unlikely to affect rankings, leading to high consistency across all ELO methods, in the other three perturbation scenarios, am-ELO reduces the inconsistency rate to $30\%$ compared to m-ELO or traditional ELO. Meanwhile, the scatter plot at the bottom of Figure 6 shows the changes in annotator abilities under each perturbation. Red dots represent annotators who were normal, while green dots represent those who were anomalous. It is clear that nearly all anomalous annotators
254
+
255
+ have ability scores below 0, indicating they are identified as noise points. Additionally, Figure 7 presents the F1-scores for detecting perturbations under thresholds of 0 and 0.005. Under different perturbations, the recognition accuracy reached $90\%$ when $\epsilon = 0$ , and even up to $95\%$ when $\epsilon = 0.005$ . These results demonstrate that our method effectively detects perturbations, models the annotators, and maintains the consistency of results, thereby alleviating the problem of ELO inconsistency.
256
+
257
+ # 6. Conclusion
258
+
259
+ In this study, we explored the instability of the ELO method in the context of LLM evaluation, emphasizing its impact on the reliability of evaluation outcomes. To address this issue, we introduced the Stable Arena Framework, which utilizes the MLE approach for ELO rating estimation and incorporates annotator ability parameters into the probability function. Our experiments demonstrated that am-ELO not only achieves more stable convergence but also effectively identifies anomalous annotators, resulting in rankings that are more aligned with human intuition. These findings suggest that our approach can significantly reduce the instability of ELO, enhancing the credibility and robustness of LLM evaluation, while providing a more stable and easily implementable framework for arena-based evaluation.
260
+
261
+ However, our method has certain limitations. Specifically, the dimensions of annotator modeling are somewhat simplistic, as it primarily captures the annotator's discriminatory ability and consistency with other annotators. This makes it challenging to fully capture the annotator's broader capabilities. In future work, we aim to refine the design of annotator ability dimensions to better leverage crowdsourcing for arena-based evaluation.
262
+
263
+ # Acknowledgements
264
+
265
+ This research was supported by grants from the National Key Research and Development Program of China (Grant No. 2024YFC3308200), the National Natural Science Foundation of China (62337001), the Key Technologies R & D Program of Anhui Province (No. 202423k09020039), China Postdoctoral Science Foundation (Grant No. 2024M760725) and the Fundamental Research Funds for the Central Universities.
266
+
267
+ # Impact Statement
268
+
269
+ This paper presents work whose goal is to advance the field of Machine Learning. There are many potential societal consequences of our work, none which we feel must be specifically highlighted here.
270
+
271
+ # References
272
+
273
+ Achiam, J., Adler, S., Agarwal, S., Ahmad, L., Akkaya, I., Aleman, F. L., Almeida, D., Altenschmidt, J., Altman, S., Anadkat, S., et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
274
+ Aldous, D. Elo ratings and the sports model: A neglected topic in applied probability? 2017.
275
+ Anthropic, S. Model card addendum: Claude 3.5 haiku and upgraded claude 3.5 sonnet. URL https://api-semanticscholar.org/CorpusID:273639283.
276
+ Bai, Y., Jones, A., Ndousse, K., Askell, A., Chen, A., Das-Sarma, N., Drain, D., Fort, S., Ganguli, D., Henighan, T., et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.
277
+ Boubdir, M., Kim, E., Ermis, B., Hooker, S., and Fadaee, M. Elo uncovered: Robustness and best practices in language model evaluation. arXiv preprint arXiv:2311.17295, 2023.
278
+ Bouchiha, M. A., Telnoff, Q., Bakkali, S., Champagnat, R., Rabah, M., Coustaty, M., and Ghamri-Doudane, Y. Llmchain: Blockchain-based reputation system for sharing and evaluating large language models. In 2024 IEEE 48th Annual Computers, Software, and Applications Conference (COMPSAC), pp. 439-448, 2024. doi: 10.1109/COMPSAC61105.2024.00067.
279
+ Boyd, S. and Vandenberghe, L. Convex optimization. Cambridge university press, 2004.
280
+ Busa-Fekete, R., Hüllermeier, E., and Szörenyi, B. Preference-based rank elicitation using statistical mod
281
+
282
+ els: The case of mallows. In International conference on machine learning, pp. 1071-1079. PMLR, 2014.
283
+ Chan, C., Chen, W., Su, Y., Yu, J., Xue, W., Zhang, S., Fu, J., and Liu, Z. Chateval: Towards better llm-based evaluators through multi-agent debate. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=FQepisCUWu.
284
+ Chen, Y.-W. and Lin, C.-J. Combining svms with various feature selection strategies. Feature extraction: foundations and applications, pp. 315-324, 2006.
285
+ Cheng, M., Zhang, H., Yang, J., Liu, Q., Li, L., Huang, X., Song, L., Li, Z., Huang, Z., and Chen, E. Towards personalized evaluation of large language models with an anonymous crowd-sourcing platform. In Companion Proceedings of the ACM Web Conference 2024, pp. 1035-1038, 2024.
286
+ Cheng, M., Luo, Y., Ouyang, J., Liu, Q., Liu, H., Li, L., Yu, S., Zhang, B., Cao, J., Ma, J., et al. A survey on knowledge-oriented retrieval-augmented generation. arXiv preprint arXiv:2503.10677, 2025.
287
+ Chernoff, H. Sequential design of experiments. Springer, 1992.
288
+ Chiang, W., Zheng, L., Sheng, Y., Angelopoulos, A. N., Li, T., Li, D., Zhu, B., Zhang, H., Jordan, M. I., Gonzalez, J. E., and Stoica, I. Chatbot arena: An open platform for evaluating llms by human preference. In Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=3MW8GKNyzI.
289
+ Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
290
+ Coulom, R. Computing "elo ratings" of move patterns in the game of go. ICGA journal, 30(4):198-208, 2007.
291
+ Ebtekar, A. and Liu, P. An elo-like system for massive multiplayer competitions. arXiv preprint arXiv:2101.00400, 2021.
292
+ Eickhoff, C. Cognitive biases in crowdsourcing. In Proceedings of the eleventh ACM international conference on web search and data mining, pp. 162-170, 2018.
293
+ Elo, A. E. The proposed uscf rating system, its development, theory, and applications. *Chess life*, 22(8):242-247, 1967.
294
+
295
+ Embretson, S. E. and Reise, S. P. Item response theory. Psychology Press, 2013.
296
+ Furr, R. M. Psychometrics: an introduction. SAGE publications, 2021.
297
+ Galantai, A. The theory of newton's method. Journal of Computational and Applied Mathematics, 124(1-2):25-44, 2000.
298
+ Hastie, T. and Tibshirani, R. Classification by pairwise coupling. Advances in neural information processing systems, 10, 1997.
299
+ Hendrycks, D., Burns, C., Basart, S., Zou, A., Mazeika, M., Song, D., and Steinhardt, J. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020.
300
+ Hunter, D. R. Mm algorithms for generalized bradley-terry models. The annals of statistics, 32(1):384-406, 2004.
301
+ Jin, Y., Choi, M., Verma, G., Wang, J., and Kumar, S. Mmsoc: Benchmarking multimodal large language models in social media platforms. In ACL, 2024a.
302
+ Jin, Y., Zhao, Q., Wang, Y., Chen, H., Zhu, K., Xiao, Y., and Wang, J. Agentreview: Exploring peer review dynamics with llm agents. In EMNLP, 2024b.
303
+ Johnson, C. R. Positive definite matrices. The American Mathematical Monthly, 77(3):259-264, 1970.
304
+ Kelley, C. T. Solving nonlinear equations with Newton's method. SIAM, 2003.
305
+ Li, C., Shi, L., Zhou, C., Huan, Z., Tang, C., Zhang, X., Wang, X., Zhou, J., and Liu, S. A merge sort based ranking system for the evaluation of large language models. In Bifet, A., Krilavicius, T., Miliou, I., and Nowaczyk, S. (eds.), Machine Learning and Knowledge Discovery in Databases. Applied Data Science Track, pp. 240-255, Cham, 2024. Springer Nature Switzerland. ISBN 978-3-031-70378-2.
306
+ Li, J., Sun, S., Yuan, W., Fan, R.-Z., Zhao, H., and Liu, P. Generative judge for evaluating alignment. arXiv preprint arXiv:2310.05470, 2023.
307
+ Liang, P., Bommasani, R., Lee, T., Tsipras, D., Soylu, D., Yasunaga, M., Zhang, Y., Narayanan, D., Wu, Y., Kumar, A., et al. Holistic evaluation of language models. arXiv preprint arXiv:2211.09110, 2022.
308
+ Liu, Q., Huang, Z., Yin, Y., Chen, E., Xiong, H., Su, Y., and Hu, G. Ekt: Exercise-aware knowledge tracing for student performance prediction. IEEE Transactions on Knowledge and Data Engineering, 33(1):100-115, 2021.
309
+
310
+ Liu, Z., Yan, Z., Liu, Q., Li, J., Zhang, Y., Huang, Z., Wu, J., and Wang, S. Computerized adaptive testing via collaborative ranking. In Neural Information Processing Systems, 2024. URL https://api_semanticscholar.org/CorpusID:276259892.
311
+ Morizot, J., Ainsworth, A. T., and Reise, S. P. Toward modern psychometrics. Handbook of research methods in personality psychology, 407, 2009.
312
+ Nguyen, D. and Zhang, A. Y. A spectral approach to item response theory. In Koyejo, S., Mohamed, S., Agarwal, A., Belgrave, D., Cho, K., and Oh, A. (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 38818-38830. Curran Associates, Inc., 2022.
313
+ Nowak, S. and Rüger, S. How reliable are annotations via crowdsourcing: a study about inter-annotator agreement for multi-label image annotation. In Proceedings of the international conference on Multimedia information retrieval, pp. 557-566, 2010.
314
+ Ouyang, J., Pan, T., Cheng, M., Yan, R., Luo, Y., Lin, J., and Liu, Q. Hoh: A dynamic benchmark for evaluating the impact of outdated information on retrieval-augmented generation, 2025. URL https://arxiv.org/abs/2503.04800.
315
+ O'Meara, O. T. Introduction to quadratic forms, volume 117. Springer, 2013.
316
+ Pelánek, R. Applications of the elo rating system in adaptive educational systems. Computers & Education, 98:169-179, 2016.
317
+ Polo, F. M., Weber, L., Choshen, L., Sun, Y., Xu, G., and Yurochkin, M. tinybenchmarks: evaluating llms with fewer examples. In *Forty-first International Conference on Machine Learning*, ICML 2024, Vienna, Austria, July 21-27, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=qAml3FpfhG.
318
+ Rao, P. and Kupper, L. L. Ties in paired-comparison experiments: A generalization of the bradley-terry model. Journal of the American Statistical Association, 62(317): 194-204, 1967.
319
+ Raykar, V. C. and Yu, S. Ranking annotators for crowdsourced labeling tasks. Advances in neural information processing systems, 24, 2011.
320
+ Ruder, S. An overview of gradient descent optimization algorithms. ArXiv, abs/1609.04747, 2016. URL https://api(semanticscholar.org/CorpusID:17485266.
321
+ Shi-gu, J. Application of lagrange mean value theorem. 2014. URL https://api-semanticscholar.org/CorpusID:124971556.
322
+
323
+ Sismanis, Y. How i won the" chess ratings-elo vs the rest of the world" competition. arXiv preprint arXiv:1012.4571, 2010.
324
+ Szörenyi, B., Busa-Fekete, R., Paul, A., and Hüllermeier, E. Online rank elicitation for plackett-luce: A dueling bandits approach. Advances in neural information processing systems, 28, 2015.
325
+ Thacker, W. C. The role of the hessian matrix in fitting models to measurements. Journal of Geophysical Research: Oceans, 94(C5):6177-6196, 1989.
326
+ Wang, F., Liu, Q., Chen, E., Huang, Z., Yin, Y., Wang, S., and Su, Y. Neuralcd: a general framework for cognitive diagnosis. IEEE Transactions on Knowledge and Data Engineering, 2022.
327
+ Wang, Y., Yu, Z., Zeng, Z., Yang, L., Wang, C., Chen, H., Jiang, C., Xie, R., Wang, J., Xie, X., et al. Pandalm: An automatic evaluation benchmark for llm instruction tuning optimization. arXiv preprint arXiv:2306.05087, 2023.
328
+ Welinder, P. and Perona, P. Online crowdsourcing: rating annotators and obtaining cost-effective labels. In 2010 IEEE Computer Society Conference on Computer Vision and Pattern Recognition-Workshops, pp. 25-32. IEEE, 2010.
329
+ Zellers, R., Holtzman, A., Bisk, Y., Farhadi, A., and Choi, Y. Hellaswag: Can a machine really finish your sentence? arXiv preprint arXiv:1905.07830, 2019.
330
+ Zermelo, E. Die berechnung der turnier-ergebnisse als ein maximumproblem der wahrscheinlichkeitsrechnung. Mathematische Zeitschrift, 29(1):436-460, 1929.
331
+ Zhan, J., Wang, L., Gao, W., Li, H., Wang, C., Huang, Y., Li, Y., Yang, Z., Kang, G., Luo, C., et al. Evaluatology: The science and engineering of evaluation. BenchCouncil Transactions on Benchmarks, Standards and Evaluations, 4(1):100162, 2024.
332
+ Zhang, Y., Zhang, M., Yuan, H., Liu, S., Shi, Y., Gui, T., Zhang, Q., and Huang, X. Llmeval: A preliminary study on how to evaluate large language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 19615-19622, 2024a.
333
+ Zhang, Z., Wu, L., Liu, Q., Liu, J.-Y., Huang, Z., Yin, Y., Yan, Z., Gao, W., and Chen, E. Understanding and improving fairness in cognitive diagnosis. Sci. China Inf. Sci., 67, 2024b. URL https://api-semanticscholar.org/CorpusID:269473652.
334
+
335
+ Zhao, Q., Wang, J., Zhang, Y., Jin, Y., Zhu, K., Chen, H., and Xie, X. Competeai: Understanding the competition behaviors in large language model-based agents. In ICML, 2024.
336
+ Zheng, L., Chiang, W.-L., Sheng, Y., Zhuang, S., Wu, Z., Zhuang, Y., Lin, Z., Li, Z., Li, D., Xing, E. P., Zhang, H., Gonzalez, J. E., and Stoica, I. Judging llm-as-a-judge with mt-bench and chatbot arena, 2023.
337
+ Zhu, L., Wang, X., and Wang, X. Judgelm: Fine-tuned large language models are scalable judges. arXiv preprint arXiv:2310.17631, 2023.
338
+ Zhu, Z., Arthur, D., and Chang, H.-H. A new person-fit method based on machine learning in cdm in education. British Journal of Mathematical and Statistical Psychology, 75(3):616-637, 2022.
339
+ Zhuang, Y., Liu, Q., Huang, Z., Li, Z., Shen, S., and Ma, H. Fully adaptive framework: Neural computerized adaptive testing for online education. In Proceedings of the AAAI conference on artificial intelligence, volume 36, pp. 4734-4742, 2022.
340
+
341
+ # A. Proofs of Theorem 4.1
342
+
343
+ Proof. Assume $R_{1} = 0$ and consider the remaining variables $(R_{2},\dots ,R_{N})$ . For each sample $(i,j,W_{ij})$ , consider the log-likelihood function $\ln l$ for this sample is given by:
344
+
345
+ $$
346
+ \ln l = W _ {i j} \ln P \left(R _ {i}, R _ {j}\right) + W _ {j i} \ln P \left(R _ {j}, R _ {i}\right).
347
+ $$
348
+
349
+ The second-order partial derivatives of $\ln l$ are:
350
+
351
+ $$
352
+ \frac {\partial^ {2} \ln l}{\partial R _ {i} ^ {2}} = - C ^ {2} P (R _ {i}, R _ {j}) (1 - P (R _ {i}, R _ {j})), i \neq 1,
353
+ $$
354
+
355
+ $$
356
+ \frac {\partial^ {2} \ln l}{\partial R _ {i} \partial R _ {j}} = C ^ {2} P (R _ {i}, R _ {j}) (1 - P (R _ {i}, R _ {j})), i, j \neq 1,
357
+ $$
358
+
359
+ Now, let the number of matches between model $i$ and model $j$ be $\delta_{ij}$ and define $a_{ij} = \delta_{ij}C^2 P(R_i,R_j)(1 - P(R_i,R_j))$ . For the Hessian matrix (Thacker, 1989) of the log-likelihood function $\frac{\partial^2\ln L}{\partial\mathbf{R}\partial\mathbf{R}^T}$ , its quadratic form (O'Meara, 2013) can be expressed as:
360
+
361
+ $$
362
+ \mathbf {x} \frac {\partial^ {2} \ln L}{\partial \mathbf {R} \partial \mathbf {R} ^ {T}} \mathbf {x} ^ {T} = - \sum_ {i = 2} ^ {N} \sum_ {j = 2} ^ {N} a _ {i j} (x _ {i} - x _ {j}) ^ {2} - \sum_ {i = 2} ^ {N} a _ {i 1} x _ {i} ^ {2} - \sum_ {j = 2} ^ {N} a _ {1 j} x _ {j} ^ {2}.
363
+ $$
364
+
365
+ Note that $a_{ij} \geq 0$ , therefore:
366
+
367
+ $$
368
+ \mathbf {x} \frac {\partial^ {2} \ln L}{\partial \mathbf {R} \partial \mathbf {R} ^ {T}} \mathbf {x} ^ {T} \leq 0.
369
+ $$
370
+
371
+ The equality holds if and only if $x_{i} = x_{j} = 0$ , i.e. $\mathbf{x} = \mathbf{0}$ . Since the quadratic form is strictly negative for all non-zero vectors $\mathbf{x}$ , the Hessian matrix $\frac{\partial^2\ln L}{\partial\mathbf{R}\partial\mathbf{R}^T}$ is negative definite (Johnson, 1970). This implies that the log-likelihood function $\ln L$ is concave. Therefore, $\ln L$ can have at most one extreme point (Boyd & Vandenberghe, 2004), ensuring the uniqueness of the maximum likelihood solution.
372
+
373
+ # B. Proofs of Theorem 4.2
374
+
375
+ Proof. (1) For annotators 1 and 2, the following formula can be obtained from Equation 6:
376
+
377
+ $$
378
+ \frac {\partial \ln L}{\partial \theta_ {1}} = \sum_ {(i, j, W _ {i j}) \in S ^ {\prime}} (R _ {i} - R _ {j}) \left(W _ {i j} - P \left(R _ {i}, R _ {j} \mid \theta_ {1}\right)\right)
379
+ $$
380
+
381
+ $$
382
+ \frac{\partial\ln L}{\partial\theta_{2}} = \sum_{(i,j,W^{\prime}_{ij})\in S^{\prime}}(R_{i} - R_{j})(W^{\prime}_{ij} - P(R_{i},R_{j}|\theta_{2}))
383
+ $$
384
+
385
+ Since $\frac{\partial\ln L}{\partial\theta_1} = \frac{\partial\ln L}{\partial\theta_2} = 0$ , the difference between the two equations can be obtained:
386
+
387
+ $$
388
+ \sum_ {(i, j, W _ {i j}) \in S ^ {\prime}} (R _ {i} - R _ {j}) \left(W _ {i j} - W _ {i j} ^ {\prime}\right) = \sum_ {(i, j, W _ {i j} ^ {\prime}) \in S ^ {\prime}} (R _ {i} - R _ {j}) \left(P \left(R _ {i}, R _ {j} \mid \theta_ {1}\right) - P \left(R _ {i}, R _ {j} \mid \theta_ {2}\right)\right)
389
+ $$
390
+
391
+ According to the Lagrange mean value theorem (Shi-gu, 2014), the following derivation can be derived:
392
+
393
+ $$
394
+ = \sum_ {(i, j, W _ {i j} ^ {\prime}) \in S ^ {\prime}} (R _ {i} - R _ {j}) ^ {2} P _ {i j} (\xi_ {i j}) (1 - P _ {i j} (\xi_ {i j})) (\theta_ {1} - \theta_ {2})
395
+ $$
396
+
397
+ Due to $P_{ij}(\xi_{ij})(1 - P_{ij}(\xi_{ij})) > 0$ and $\theta_1 < \theta_2$ :
398
+
399
+ $$
400
+ \sum_ {(i, j, W _ {i j}) \in S ^ {\prime}} (R _ {i} - R _ {j}) \left(W _ {i j} - W _ {i j} ^ {\prime}\right) < 0
401
+ $$
402
+
403
+ (2) Because of $0 < P(R_{i}, R_{j} | \theta_{k}) < 1$ and $\theta_{k} < 0$ , for each positive sample $(i, j, k, 1)$ of annotator $k$ , we have $\frac{\partial \ln l}{\partial R_{i}} = \theta_{k} (1 - P(R_{i}, R_{j} | \theta_{k})) < 0$ . Similarly, for each negative sample $(i, j, k, 0)$ of annotator $k$ , we have $\frac{\partial \ln l}{\partial R_{i}} = \theta_{k} (0 - P(R_{i}, R_{j} | \theta_{k})) > 0$ .
ameloastableframeworkforarenabasedllmevaluation/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d1dfbd7dd7ceb4deb103027106025769ee26288d8ff4c9e2d368b7e29c3eea7
3
+ size 498703
ameloastableframeworkforarenabasedllmevaluation/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:046dfb8f81246f541e32c76cf794d0a0e038bb216f859f0af6f1e92be16e2173
3
+ size 504027
any4learned4bitnumericrepresentationforllms/aed8248d-b454-44ef-a338-4bc6daba1424_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56b75a134546068a62ce0e36969b548874ff39cfd8237a4c639431b820a01e80
3
+ size 117069
any4learned4bitnumericrepresentationforllms/aed8248d-b454-44ef-a338-4bc6daba1424_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f387f235d5ff34fb2718fc92b8f6db0762091071eba735b2ed9d00e962b64ffa
3
+ size 140190
any4learned4bitnumericrepresentationforllms/aed8248d-b454-44ef-a338-4bc6daba1424_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f804dd9c79b0a743ba4407f49fad5d221171a56f98a61ab9b587b103a674060c
3
+ size 521408
any4learned4bitnumericrepresentationforllms/full.md ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Mostafa Elhoushi $^{*1}$ Jeff Johnson $^{*1}$
2
+
3
+ # Abstract
4
+
5
+ We present any4, a learned 4-bit weight quantization solution for large language models (LLMs) providing arbitrary numeric representations without requiring pre-processing of weights or activations. any4 yields higher accuracy compared to other related 4-bit numeric representation types: int4, fp4 and nf4, as evaluated on a range of model sizes, generations and families (Llama 2, Llama 3, Mistral and Mixtral). While any4 does not require preprocessing of weights or activations, it is also competitive with orthogonal techniques that require such preprocessing (e.g., AWQ and GPTQ). We also experiment with any3 and any2 and show competitiveness at lower bits. Additionally, we show that we can calibrate using a single curated diverse sample rather than hundreds of samples from a dataset as done in most quantization approaches. We also open source tinygemm, a latency optimized GPU matrix multiplication library for LLMs, that implements any4 using a GPU-efficient lookup table strategy along with other common quantization methods. We open source our code at https://github.com/facebookresearch/any4.
6
+
7
+ # 1. Introduction
8
+
9
+ Reduced neural network parameter sizes are important for efficient inference, whether at datacenter scale, where accelerators can be provisioned based more upon arithmetic throughput rather than memory requirements, or with edge devices, where smaller, slower memories could be used improving battery lifetime while meeting performance constraints. Given training is typically done in high dynamic range floating point arithmetic, techniques to lossily compress weights must deal with the possibility of varying scale factors and outliers. Various weight numeric formats, such
10
+
11
+ ![](images/17fefaa940dbe7dd7e03f45a47a6ebffe86ea434f55c5abffcc67f9e6a1b73db.jpg)
12
+ Figure 1: Perplexity by quantizing various Llama3 model sizes. Our proposed any4 is the most accurate across numeric formats.
13
+
14
+ as 4-bit integer (int4), floating point (fp4), or custom distributions such as NormalFloat4 (nf4) (Dettmers et al., 2023)) along with quantization grouping (Dai et al., 2021) are used to increase accuracy. Pre-processing weights and/or activations (e.g., AWQ (Lin et al., 2024), GPTQ (Frantar et al., 2023), or weight Hadamard transforms (Ashkboos et al., 2024b; Liu et al., 2024) can aid with accuracy as well. In this paper, we present a new learned numeric representation, any4, that does not require online or offline modification of weights or activations. any4 quantization accuracy outperforms other numeric representation types, and is competitive with orthogonal quantization algorithms that preprocess weights and/or activations (orthogonality implying that some of these techniques can be applied together with any4 representation). Accuracy was evaluated on a wide range of model sizes, generations and families.
15
+
16
+ # 2. Background
17
+
18
+ Trained neural network weights tend to be roughly Gaussian in nature but with heavier tails (Goodfellow et al., 2016). In attempting to lossily compress weights via quantization (yielding fewer reproduction values than the original do
19
+
20
+ main), being able to closely match the weight distribution with post-quantization possible reproduction values is important for accuracy.
21
+
22
+ # 2.1. Uniform Integer Quantization
23
+
24
+ Some of the first neural network quantization works concerned uniform integer quantization (Jacob et al., 2018). Given a set of values to quantize, we obtain the maximum absolute value, and set that to the extreme value (e.g., -128 / +127 for int8 and -8 / +7 for int4 quantization), with zero being preserved (int8/int4 zero dequantizes to original domain zero). Each increment between int8/int4 values corresponds to a fixed increment (scale) in the original floating point domain.
25
+
26
+ This allows for more efficient (chip area and power) hardware circuits, as integer multiply-add is much simpler than floating point multiply-add. However, uniform integer quantization is best suited to representing samples from a uniform distribution, which is a mismatch with neural network properties. Increased bitwidth (more dense uniform samples) is needed for accuracy due to the expected distribution mismatch, indicating that there is waste in memory storage.
27
+
28
+ # 2.2. Floating Point Quantization
29
+
30
+ Floating point quantization (reducing fractional precision and dynamic range via rounding) is another mechanism. Unlike integer quantization, reproduction values are now non-uniformly spaced. Floating point arithmetic is a piecewise linear distribution of values: the steps between floating point exponents are geometric in nature (multiply or divide by 2 each increment), but within a given exponent value, the spacing of reproduction values is linear (as given by the significand bits). This is slightly closer mapping as a Gaussian distribution with zero mean has most of the mass of the distribution at smaller exponent values more densely sampled by floating point than linear distributions on the number line, while within an exponent the spacing of values is still linear.
31
+
32
+ Such quantization makes sense with hardware support for reduced bit width floating point types (e.g., fp8 formats with Nvidia's H100 GPU and fp4 with Nvidia's B100 GPU). In lieu of native conversion instructions, bit manipulation can usually convert or round a $n$ -bit fpn value to the nearest standard fp16/bf16 value (thus, fp4 can be emulated on devices with higher bit width floating point support).
33
+
34
+ # 2.3. Grouped Quantization
35
+
36
+ As the bitwidth (and thus the number of possible quantization reproduction values) decreases, it can be useful to introduce metadata pertaining to groups of values to the quantization to improve accuracy, with metadata storage
37
+
38
+ cost amortized across many values (Darvish Rouhani et al., 2020). Grouped quantization is an attempt at this. Instead of forcing a single scalar value itself to be the entire representation, we can define groups of contiguous values along a row or column of the matrix. A common offset and scale factor is defined for a group of values such that the reconstruction error is improved, with typical group sizes in practice being 32 - 256. Other variants include Shared Microexponents (Rouhani et al., 2023), providing a group-wise shared exponent value (multiplicative scale) to adjust per-scalar 4 bit floating point values (MX4) in lieu of a scale and offset.
39
+
40
+ # 2.4. Non-Uniform Quantization
41
+
42
+ Thus far we have discussed uniform (linear) and floating-point (log/linear) distributions. But we can go further and have quantization reproduction values match the seen distributions more closely.
43
+
44
+ NormalFloat4 (nf4) (Dettmers et al., 2023) attempts to do exactly this by having the reproduction values (fixed ahead of time) match a Gaussian distribution exactly. However, with an even number of reproduction values (e.g., $2^{n}$ for $n$ bits), we cannot represent a Gaussian symmetrically if we wish to preserve zero. So nf4 is asymmetric, using one of the 16 values to represent zero. This results in higher accuracy, especially for partially sparse matrices.
45
+
46
+ AbnormalFloat4 (af4) (Yoshida, 2023) is a variant of nf4 which adjusts the distribution based on quantization group size. The larger the quantization group, the larger the expected maximum absolute value of Gaussian distribution samples, but the mass of the distribution would still be close to 0. Mapping the nf4 distribution based on the seen absolute maximum value would result in much of the mass of the distribution (values closer to the mean) not being as accurately represented. af4 adjusts the distribution based on group size to take this into account.
47
+
48
+ # 2.4.1. ARBITRARY NON-UNIFORM QUANTIZATION: ANY4
49
+
50
+ Instead of trying to match an a priori data distribution as nf4/af4 do, we can instead learn the distribution from the seen data itself. This was explored in signal processing (Lloyd, 1982a; Max, 1960) and any4 explores this for LLMs. For each set of values along each row of a matrix, we can perform k-means (Lloyd, 1982b; MacQueen et al., 1967) or neural network-based clustering, so each row of the matrix has its own 4-bit quantization code, providing indices into a per-row codebook or lookup table (LUT) containing arbitrary floating point dequantization values. This adds little overhead to quantization: for each row of a $\mathbf{M} \times 4096$ matrix, any4 will add 16 bfloat16/float16 values, for an overhead of $(16 \times \text{sizeof}([b]\text{float}16) \times 8\text{bits/byte}) / 4096$ columns $= 0.0625$ bits for each matrix entry. Like existing
51
+
52
+ 4-bit techniques, for higher accuracy we add quantization groups (e.g., each set of $g$ contiguous row values has a shared 16-bit scale and zero point). Thus, per-scalar quantization group overhead for $g = 128$ in our example would be $((4096 / 128) \times (2 \times 16)) / 4096 = 0.25$ bits, yielding $0.0625 + 0.25 + 4 = 4.3125$ bits for any4 representation. Note that standard int4 grouped quantization is already 4.25 bits/entry here, with extension to any4 only adding 0.0625 bits/entry of LUT overhead.
53
+
54
+ In addition, the likely most efficient way to implement nf4 and af4 in software itself is via the same mechanism as any4: using a LUT, as there is no efficient programmatic way to convert a 4-bit integer to an nf4/af4 value using a small number of instructions. To support nf4/af4, our CUDA implementation also allows using a single 16 entry any4 LUT for an entire matrix instead of a LUT per each matrix row. This paper solely evaluates the latter.
55
+
56
+ # 2.5. Quantization Process
57
+
58
+ Vanilla quantization happens in 2 steps: scaling followed by rounding.
59
+
60
+ # 2.5.1. SCALING
61
+
62
+ Numeric formats have different numeric ranges, and high precision numeric formats usually have orders of magnitude larger ranges from low precision numeric formats, e.g., fp32 ranges from $-3.4 \times 10^{38}$ to $+3.4 \times 10^{38}$ while int4 ranges from -7 to +8. Moreover, the numeric range of a given tensor could be orders of magnitude different from a low precision format (e.g., most weight values range from -0.01 to +0.01 while int4 ranges from -7 to +8). Hence, directly rounding each element in a tensor to its nearest value in a numeric format will waste most of the bits and lead to high reconstruction error.
63
+
64
+ Instead, most approaches scale a tensor, or a subset of a tensor, to the range of lower precision numeric format. Given a weight tensor $\pmb{w}$ , and an index $i$ , the scaled weight tensor, $\pmb{w}_S$ , can be expressed as:
65
+
66
+ $$
67
+ w _ {S _ {i}} = \frac {w _ {i} - \beta_ {i}}{\alpha_ {i}} \tag {1}
68
+ $$
69
+
70
+ Scale factors $\alpha$ and $\beta$ , are high precision scalar values that are calculated for each group of indices, $G$ . For asymmetric quantization<sup>1</sup>:
71
+
72
+ $$
73
+ \begin{array}{l} \alpha_ {j \in G} = \frac {\operatorname* {m a x} \left(w _ {j \in G}\right) - \operatorname* {m i n} \left(w _ {j \in G}\right)}{Q _ {\text {m a x}} - Q _ {\text {m i n}}} \tag {2} \\ \beta_ {j \in G} = \min (w _ {j \in G}) \\ \end{array}
74
+ $$
75
+
76
+ For symmetric quantization:
77
+
78
+ $$
79
+ \alpha_ {j \in G} = \frac {\operatorname* {m a x} \left(\operatorname {a b s} \left(w _ {j \in G}\right)\right)}{Q _ {\text {m a x}}} \tag {3}
80
+ $$
81
+
82
+ $$
83
+ \beta = 0
84
+ $$
85
+
86
+ where $G$ is a set of indices of a tensor, $\alpha$ and $\beta$ are scaling factors, $Q_{min}$ and $Q_{max}$ are the minimum and maximum values of the lower precision numeric format.
87
+
88
+ Scaling could be applied at different granularities:
89
+
90
+ - Tensorwise: where $G$ is the set of all indices of the tensor. Hence, all elements in tensor, $\mathbf{w}$ , share the same scale factors: $\alpha_{i,j} = \alpha$ , $\beta_{i,j} = \beta$ , $\forall i,j$ .
91
+ - Rowwise: where $G$ is the set of all indices of a row. Elements in each row of a tensor share the same scale factors: $\alpha_{i,j} = \alpha_i, \beta_{i,j} = \beta_i, \forall j$ .
92
+ - Columnwise: where $G$ is the set of all indices of a column. Elements in each column of a tensor share the same scale factors: $\alpha_{i,j} = \alpha_j, \beta_{i,j} = \beta_j, \forall i$ .
93
+ - Groupwise: where $G$ is the set of non-overlapping consecutive indices along a row (or column), of size $1 \times g$ , where group size, $g$ , is a scalar hyperparameter. Elements in each group, $G_{k}$ , share the same scale factors: $\alpha_{i,j} = \alpha_{i,G_k}, \beta_{i,j} = \beta_{i,G_k}, \forall j$ s.t. $kg \leq j < k(g + 1)$ . Values of 64 or 128 for $g$ usually provide a sweet spot between accuracy and overhead for 4-bit quantization.
94
+ - Blockwise: where $G$ is the set of indices within a two-dimensional block of size $b \times b$ , where, $b$ , is a scalar hyperparameter. Elements in each block, $G_{k,l}$ , of a tensor share the same scale factors: $\alpha_{i,j} = \alpha_{G_{k,l}}$ , $\beta_{i,j} = \beta_{G_{k,l}}$ , $\forall i, j$ s.t. $kb \leq i < k(b + 1)$ , $lb \leq j < l(b + 1)$ .
95
+
96
+ In our work, we focus on weight-only groupwise quantization (along the reduction dimension) and, unless stated otherwise, use a default group size $g$ of 128.
97
+
98
+ # 2.5.2. ROUNDING
99
+
100
+ After scaling, the next step is to round the scaled value to the nearest value in the low-precision quantization format:
101
+
102
+ $$
103
+ w _ {Q} = \operatorname {r o u n d} _ {Q} (w _ {S}) \tag {4}
104
+ $$
105
+
106
+ And to dequantize: $\mathrm{dequant}(w_{Q}) = \alpha w_{Q} + \beta$ .
107
+
108
+ # 3. Related Work
109
+
110
+ Quantization has long been researched to run on CPUs and custom chips (Xie & Jabri, 1992). Various techniques can be categorized into:
111
+
112
+ Weights vs. Activations vs. Gradients vs. Optimizer States Quantization can be applied on weights only (AWQ (Lin et al., 2024), GPTQ (Frantar et al., 2023)), weights and activations (SmoothQuant (Xiao et al., 2023), LLM.int8() (Dettmers et al., 2022a)), KV cache (KVQuant (Hooper et al., 2024)), and can be applied to gradients for training (TinyScript (Fu et al., 2020)) and optimization states (8-bit Optimizers (Dettmers et al., 2022b)). Auto-regressive decoding with batch size 1 and sequence length 1 is a highly memory bound process (a big portion of compute time is spent in loading weights compared to processing activations), thus 4-bit weight only quantization leads to better speedup than 8-bit weight and 8-bit activation quantization (PyTorch, 2024). Moreover, 4-bit weight only quantization leads to a better accuracy-speed tradeoff compared to 4-bit weight and 4-bit activation quantization. In this research, we focus on quantizing weights only.
113
+
114
+ Post-Training Quantization (PTQ) vs. Quantization Aware Training (QAT) PTQ refers to quantization on a trained model without the need for further training. QAT refers to quantization during training, whether training a model from scratch, e.g., FP8-LM (Peng et al., 2023), or continually training or finetuning a trained model, e.g., QLoRA (Dettmers et al., 2023). This work falls under PTQ as it does not require further training of a model.
115
+
116
+ Numeric Representation While integer quantization is the most commonly used numeric representation, other numeric representations, that have been explained above, are also used for inference and/or training: fp8 (Wang et al., 2018), fp6 (Gernigon et al., 2023), fp4 (Sun et al., 2020), nf4, and af4 (Yoshida, 2023).
117
+
118
+ Lookup Table (LUT) Representation While most research quantize to pre-defined numeric formats, other approaches use a dynamic format that is specified for each tensor or subset of elements of a tensor using a look-up-table (LUT) (a.k.a. codebook). In scalar quantization techniques, e.g., DeepCompression for CNNs (Han et al., 2016), GOBO for BERT (Zadeh et al., 2020), SqueezeLLM for LLMs (Kim et al., 2023), LUTs map scalar quantized values to scalar high precision values. In vector quantization techniques (Stock et al. for CNNs (Stock et al., 2020), AQLM for LLMs (Egiazarian et al., 2024)), LUTs map vectors of quantized values to vectors of high precision values.
119
+
120
+ Preserving Outlier/Sensitive Values LLM.int8() (Dettmers et al., 2022a) found that keeping $< 0.1\%$ of outlier activations and their corresponding weights in high precision minimizes drop in accuracy. SqueezeLLM (Kim et al., 2023) found that keeping $0.40\%$ outlier weights and an additional $0.05\%$ sensitive weights, determined by a Hessian metric, minimizes accuracy drops. In this work, we quantize all values and keep no outlier/sensitive values in higher precision.
121
+
122
+ Pre-processing Weights and/or Activations While many quantization algorithms simply round each high precision value to a value in the quantized set of possible values (Round to Nearest (RTN), stochastic rounding (Xia et al., 2021), or adaptive rounding (Nagel et al., 2020)), other algorithms perform some offline or online processing of weights and/or activations. Instead of keeping outlier activations or sensitive weights, AWQ (Lin et al., 2024) and SmoothQuant (Xiao et al., 2023) mitigate their effects by dividing outlier channels by a scaling factor and compensating by multiplying weights with the same factor. Other quantization approaches mitigate outliers by applying matrix transformations on weights and activations, e.g., QuIP (Chee et al., 2023), QuaRot (Ashkboos et al., 2024a) and Spin-Quant (Liu et al., 2024). Another line of research follows an iterative procedure of quantizing weights in subsets, modifying unquantized elements to mitigate the errors introduced after quantizing each subset, e.g., GPTQ (Frantar et al., 2023).
123
+
124
+ A common trend is to use a combination of techniques. QuIP cascades incoherence processing with adaptive rounding, QTIP (Tseng et al., 2024) uses Hadamard transforms to remove outliers, vector quantization for numeric representation and other techniques, while SqueezeLLM preserves a portion of outlier/sensitive values in high precision and applies scalar quantization. In this work, we opt for a one-shot quantization algorithm that does not require any online or offline pre-processing or transformations on weights and/or activations, and focus on the aspect of learning quantization from data with efficient inference in hardware, achieving SOTA accuracies compared to other numeric format approaches and is competitive with orthogonal approaches that pre-process weights and activations. We leave it to future work to combine any4 with such orthogonal techniques.
125
+
126
+ # 4. Proposed Solution
127
+
128
+ # 4.1. any4 Algorithm
129
+
130
+ In any4 quantization, we first apply group-wise scaling, then try to find the optimal numeric representation for each row of a weight matrix. Naively applying K-means clustering on scaled weights will lead to a sub-optimal quantization scheme. This is because K-means clustering will minimize the reconstruction error of the weight matrix rather than the output of multiplying weights with sample inputs, and even for weight reconstruction, K-means clustering will minimize the reconstruction error of the scaled weight matrix rather than the original weight matrix.
131
+
132
+ We denote a weight matrix with dimensions of $N\times K$ as $\pmb{w}$ , an input vector with dimensions $M\times K$ , where $M = 1$ without loss of generality, as $\pmb{x}$ , and the output vector with dimensions $M\times N$ as $\pmb{y}$ . Matrix multiplication in high
133
+
134
+ precision can be expressed as:
135
+
136
+ $$
137
+ \boldsymbol {y} = \boldsymbol {w x} \tag {5}
138
+ $$
139
+
140
+ and matrix multiplication with quantized weights as:
141
+
142
+ $$
143
+ \hat {\boldsymbol {y}} = \operatorname {d e q u a n t} \left(\boldsymbol {w} _ {Q}\right) \boldsymbol {x} \tag {6}
144
+ $$
145
+
146
+ For the $i$ th element of output $\pmb{y}$ , this is equivalent to:
147
+
148
+ $$
149
+ y _ {i} = \sum_ {\forall j} w _ {i, j} x _ {j} \tag {7}
150
+ $$
151
+
152
+ $$
153
+ \hat {y} _ {i} = \sum_ {\forall j} \operatorname {d e q u a n t} \left(w _ {Q _ {i, j}}\right) x _ {j} \tag {8}
154
+ $$
155
+
156
+ Our goal is to find the set of $2^{n}$ quantized values for row $i$ :
157
+
158
+ $$
159
+ Q _ {i} = \left\{w _ {Q _ {i} ^ {0}}, w _ {Q _ {i} ^ {1}}, \dots , w _ {Q _ {i} ^ {2 n - 1}} \right\} \tag {9}
160
+ $$
161
+
162
+ for $n$ -bit quantization (anyn) that will minimize the expected mean square error in output activations for possible input activations:
163
+
164
+ $$
165
+ \min _ {Q _ {i}} \mathbb {E} \| \hat {\boldsymbol {y}} - \boldsymbol {y} \| \tag {10}
166
+ $$
167
+
168
+ We choose a greedy approach to minimize the mean of Frobenius norm of the error of the output activation vector by minimizing the absolute error of each of its elements:
169
+
170
+ $$
171
+ \begin{array}{l} \min _ {Q _ {i}} \mathbb {E} | \hat {y} _ {i} - y _ {i} | = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} w _ {i, j} x _ {j} - \sum_ {\forall j} \operatorname {d e q u a n t} \left(w _ {Q _ {i, j}}\right) x _ {j} \right| \\ = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} \left(w _ {i, j} - \operatorname {d e q u a n t} \left(w _ {Q _ {i, j}}\right)\right) x _ {j} \right| \tag {11} \\ \end{array}
172
+ $$
173
+
174
+ This way, we can focus on dealing with finding the optimal quantization configuration for each row $i$ of the weight matrix. (Note that GPTQ opts to minimize output activations error in a different way such that all rows of the weight matrix are co-optimized together). Expanding the right hand side of the equation:
175
+
176
+ $$
177
+ \min _ {Q _ {i}} \mathbb {E} | \hat {y} _ {i} - y _ {i} | = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} \left(w _ {i, j} - \left(\alpha_ {i, j} w _ {Q _ {i, j}} + \beta_ {i, j}\right)\right) x _ {j} \right| \tag {12}
178
+ $$
179
+
180
+ The high precision weights are mathematically equivalent to applying scaling factors on scaled weights (i.e., re-arrange Eqn. 1 to expand $w_{i,j}$ into $w_{i,j} = \alpha_{i,j}w_{S_{i,j}} + \beta_{i,j}$ ):
181
+
182
+ $$
183
+ \begin{array}{l} \min _ {Q _ {i}} \mathbb {E} | \hat {y} _ {i} - y _ {i} | \\ = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} \left(\alpha_ {i, j} w _ {S _ {i, j}} + \beta_ {i, j} - \left(\alpha_ {i, j} w _ {Q _ {i, j}} + \beta_ {i, j}\right)\right) x _ {j} \right| \\ = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} \left(\alpha_ {i, j} \left(w _ {S _ {i, j}} - w _ {Q _ {i, j}}\right) x _ {j} \right. \right| \tag {13} \\ \end{array}
184
+ $$
185
+
186
+ The offset factors, $\beta_{i,j}$ , cancel each other out. Hence, we have:
187
+
188
+ $$
189
+ \min _ {Q _ {i}} \mathbb {E} | \hat {y} _ {i} - y _ {i} | = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} \left(\alpha_ {i, j} w _ {S _ {i, j}} x _ {j} - \alpha_ {i, j} w _ {Q _ {i, j}} x _ {j}\right) \right| \tag {14}
190
+ $$
191
+
192
+ We now proceed to solve this by a K-Means-style alternating optimization procedure:
193
+
194
+ 0. Initialize: for $i$ th row of a weight matrix, randomly initialize a set $Q_{i}$ to a random set of $2^{n}$ values:
195
+
196
+ $$
197
+ Q _ {i} = \left\{w _ {Q _ {i} ^ {0}}, w _ {Q _ {i} ^ {1}}, \dots , w _ {Q _ {i} ^ {2 ^ {n} - 1}} \right\} \tag {15}
198
+ $$
199
+
200
+ 1. E-Step: Given $Q_{i}$ and the row of scaled weights:
201
+
202
+ $$
203
+ \{w _ {S _ {i, j}} \} _ {\forall j} = \left\{w _ {S _ {i, 0}}, w _ {S _ {i, 1}}, \dots , w _ {S _ {i, M - 1}} \right\} \tag {16}
204
+ $$
205
+
206
+ we would like to deduce the best $w_{Q_{i,j}}$ for each corresponding $w_{S_{i,j}}$ that will minimize the expression defined in Eq. 14. Since in this step, the possible values in $Q_{i}$ are fixed and we are merely selecting from a set of discrete values, we apply a local minimization step and re-write Eq. 14 to:
207
+
208
+ $$
209
+ \begin{array}{l} w _ {Q _ {i, j}} = \min _ {w _ {Q _ {i, j}} \in Q _ {i}} \left(\alpha_ {i, j} w _ {S _ {i, j}} x _ {j} - \alpha_ {i, j} w _ {Q _ {i, j}} x _ {j}\right) ^ {2} \\ = \alpha_ {i, j} x _ {j} \min _ {w _ {Q _ {i, j}} \in Q _ {i}} \left(w _ {S _ {i, j}} - w _ {Q _ {i, j}}\right) ^ {2} \tag {17} \\ \end{array}
210
+ $$
211
+
212
+ Again since $\alpha_{i,j}x_{j}$ are fixed in this step and are independent of $w_{Q_{i,j}}$ , we can drop that term:
213
+
214
+ $$
215
+ w _ {Q _ {i, j}} = \min _ {w _ {Q _ {i, j}} \in Q _ {i}} \left(w _ {S _ {i, j}} - w _ {Q _ {i, j}}\right) ^ {2} \tag {18}
216
+ $$
217
+
218
+ 2. M-Step: After applying the E-Step above, each $w_{Q_{i,j}}$ will be set to one of the $2^n$ values in the set $Q_i$ . We refer to each set of indices $i, j$ that are associated with a specific quantized value $Q_i^q$ as a cluster. We can rewrite Eq. 14 to create a separate sum term for elements in each cluster:
219
+
220
+ $$
221
+ \begin{array}{l} \min _ {Q _ {i}} \mathbb {E} \left| \hat {y} _ {i} - y _ {i} \right| \\ = \min _ {Q _ {i}} \mathbb {E} \left| \sum_ {\forall j} \sum_ {\forall q \in Q _ {i} ^ {q}} \left(\alpha_ {i, j} w _ {S _ {i, j}} x _ {j} - \alpha_ {i, j} w _ {Q _ {i} ^ {q}} x _ {j}\right) \right| \tag {19} \\ \end{array}
222
+ $$
223
+
224
+ To minimize the term, we can aim to set the difference for elements for each cluster to 0:
225
+
226
+ $$
227
+ \mathbb {E} \left| \sum_ {\forall q \in Q _ {i} ^ {q}} \left(\alpha_ {i, j} w _ {S _ {i, j}} x _ {j} - \alpha_ {i, j} w _ {Q _ {i} ^ {q}} x _ {j}\right) \right| = 0 \tag {20}
228
+ $$
229
+
230
+ The expression inside the expectation operation is a scalar value. Moreover, except for input activations $x$ , all the other variables are deterministic and known offline. Hence, the expectation operator is only needed to be applied on input activations:
231
+
232
+ $$
233
+ \sum_ {\forall q \in Q _ {i} ^ {q}} \left(\alpha_ {i, j} w _ {S _ {i, j}} \mathbb {E} | x _ {j} | - \alpha_ {i, j} w _ {Q _ {i} ^ {q}} \mathbb {E} | x _ {j} |\right) = 0 \tag {21}
234
+ $$
235
+
236
+ Re-writing:
237
+
238
+ $$
239
+ \begin{array}{l} \sum_ {\forall q \in Q _ {i} ^ {q}} \alpha_ {i, j} w _ {S _ {i, j}} \mathbb {E} | x _ {j} | = \sum_ {\forall q \in Q _ {i} ^ {q}} \alpha_ {i, j} w _ {Q _ {i} ^ {q}} \mathbb {E} | x _ {j} | (22) \\ = w _ {Q _ {i} ^ {q}} \sum_ {\forall q \in Q _ {i} ^ {q}} \alpha_ {i, j} \mathbb {E} | x _ {j} | (22) \\ \end{array}
240
+ $$
241
+
242
+ Re-arranging:
243
+
244
+ $$
245
+ w _ {Q _ {i} ^ {q}} = \frac {\sum_ {\forall q \in Q _ {i} ^ {q}} \alpha_ {i , j} w _ {S _ {i , j}} \mathbb {E} \left| x _ {j} \right|}{\sum_ {\forall q \in Q _ {i} ^ {q}} \alpha_ {i , j} \mathbb {E} \left| x _ {j} \right|} \tag {23}
246
+ $$
247
+
248
+ Eqn. 23 states that the optimal value to represent a group of scaled weights within a cluster is their average weighted by the product of the scaling factor of a weight element and mean of the norm of activations applied to that element.
249
+
250
+ We alternate between the E-Step and M-Step till the values of $Q_{i}$ converge.
251
+
252
+ The equation of E-Step is equivalent to the cluster assignment step of K-means clustering, while the equation of M-Step is equivalent to the centroid update step of weighted K-means. Hence, our mathematical formulations guide us to creating the LUT of each row of a scaled weight matrix by the algorithm depicted in Alg. 1. We also summarize our algorithm in Fig. 2. We speedup the process by parallelizing the loop over each linear weight's rows, enabling us to quantize Llama3 8B in 10 minutes.
253
+
254
+ While most quantization papers use a dataset like C4 to obtain a set of calibration activations, we hand curate a single calibration sample, as shown in Listing. 1, that covers diverse set of topics, and then obtain the mean of absolute of activations along the channel axis to represent $\mathbb{E}|x|$
255
+
256
+ - Fiction: "Once upon a time, a girl named Alice was living alone on an island. One day, she met a wizard ..."
257
+ - News: "The United Nations held its General Assembly meeting this year amid multiple world crises and wars. In his speech, the General Secretary called for ...
258
+ - Code: ~public static void main(String[] args)
259
+ \~ System.out.println("Hello world!");
260
+ - Math: $(5.2 + 2.7) / 0.6 - 1.9 * 2.2 =$
261
+ - Facts: "The capital of Egypt is Cairo. It is the largest city in the region and is home to...
262
+
263
+ ![](images/63e274c71beb9067655811e77eb36b7d72d2a85bf40df3b24b8d3810c938dadd.jpg)
264
+ Listing 1: Calibration sample used to generate LUTs.
265
+
266
+ ![](images/bd796224bdc0787d72e79398f5bc862df7c9ce8679b7e0eeb1e7f6b928aa6e88.jpg)
267
+
268
+ ![](images/4382acf45fada2f7da105a39529239b22ae85f60842909cc0a481be85d51fe58.jpg)
269
+ Figure 2: any4 quantization process
270
+
271
+ # 4.2. tinygemm Library
272
+
273
+ As part of this paper, we present tinygemm, a GEMM library optimized for low-latency LLM inference at small batch sizes (1 to 16) for Nvidia GPU Ampere generation and later architectures. For a matrix multiplication $\pmb{y} = \pmb{x}\pmb{w}^T$ where $\pmb{x}$ is of size $M\times K$ and $\pmb{w}$ is of size $N\times K$ ( $M$ and $N$ being the outer dimensions and $K$ being the reduction dimension), in linear layers, the product of batch size
274
+
275
+ <table><tr><td colspan="11">Llama3.2 1B</td></tr><tr><td rowspan="2"></td><td colspan="4">Perplexity ↓</td><td colspan="6">Tasks ↑</td></tr><tr><td>WikiText-2</td><td>C4</td><td>PTB</td><td>CodeParrot</td><td>HumanEval Pass@1</td><td>MBPP Pass@1</td><td>MMLU</td><td>HellaSwag</td><td>GSM8K</td><td>BBH</td></tr><tr><td>FP16</td><td>9.76</td><td>12.77</td><td>16.56</td><td>3.49</td><td>16.46%</td><td>21.4%</td><td>36.1%</td><td>47.7%</td><td>6.60%</td><td>31.1%</td></tr><tr><td>INT4</td><td>11.89</td><td>15.74</td><td>20.32</td><td>4.08</td><td>9.76%</td><td>11.4%</td><td>30.1%</td><td>44.7%</td><td>3.18%</td><td>26.2%</td></tr><tr><td>FP4</td><td>13.01</td><td>17.11</td><td>21.89</td><td>4.28</td><td>8.54%</td><td>5.8%</td><td>29.3%</td><td>43.6%</td><td>2.27%</td><td>23.3%</td></tr><tr><td>NF4</td><td>10.99</td><td>14.63</td><td>18.78</td><td>3.82</td><td>13.4%</td><td>13.8%</td><td>33.3%</td><td>45.8%</td><td>2.65%</td><td>26.8%</td></tr><tr><td>ANY4</td><td>10.63</td><td>13.95</td><td>17.94</td><td>3.71</td><td>11.0%</td><td>18.6%</td><td>32.9%</td><td>46.7%</td><td>3.71%</td><td>29.0%</td></tr><tr><td colspan="11">Llama3 8B</td></tr><tr><td>FP16</td><td>6.14</td><td>8.93</td><td>10.59</td><td>2.54</td><td>29.3%</td><td>41.4%</td><td>62.0%</td><td>60.1%</td><td>50.7%</td><td>62.8%</td></tr><tr><td>INT4</td><td>6.87</td><td>9.89</td><td>11.37</td><td>2.83</td><td>23.2%</td><td>35.4%</td><td>59.6%</td><td>58.6%</td><td>40.6%</td><td>58.5%</td></tr><tr><td>FP4</td><td>7.10</td><td>10.22</td><td>11.81</td><td>2.89</td><td>22.0%</td><td>36.8%</td><td>57.1%</td><td>58.5%</td><td>35.0%</td><td>53.2%</td></tr><tr><td>NF4</td><td>6.63</td><td>9.52</td><td>11.14</td><td>2.72</td><td>23.2%</td><td>39.2%</td><td>60.7%</td><td>59.1%</td><td>41.1%</td><td>59.0%</td></tr><tr><td>ANY4</td><td>6.51</td><td>9.40</td><td>11.07</td><td>2.68</td><td>21.3%</td><td>39.2%</td><td>61.0%</td><td>59.5%</td><td>41.7%</td><td>59.2%</td></tr><tr><td colspan="11">Llama3 70B</td></tr><tr><td>FP16</td><td>2.86</td><td>6.77</td><td>8.16</td><td>1.91</td><td>17.7%</td><td>60.8%</td><td>75.4%</td><td>66.3%</td><td>80.6%</td><td>82.4%</td></tr><tr><td>INT4</td><td>3.63</td><td>7.97</td><td>8.86</td><td>2.21</td><td>18.3%</td><td>45.0%</td><td>73.0%</td><td>66.2%</td><td>73.9%</td><td>78.4%</td></tr><tr><td>FP4</td><td>3.94</td><td>7.76</td><td>8.99</td><td>2.17</td><td>22.0%</td><td>50.8%</td><td>71.9%</td><td>65.6%</td><td>75.3%</td><td>77.9%</td></tr><tr><td>NF4</td><td>3.43</td><td>7.67</td><td>8.84</td><td>2.15</td><td>18.9%</td><td>39.6%</td><td>73.7%</td><td>66.1%</td><td>75.9%</td><td>79.3%</td></tr><tr><td>ANY4</td><td>3.20</td><td>7.01</td><td>8.33</td><td>1.99</td><td>17.1%</td><td>57.4%</td><td>75.1%</td><td>66.1%</td><td>78.5%</td><td>81.8%</td></tr></table>
276
+
277
+ Table 1: Quantizing Llama3 models with various numeric formats. Results for Llama2 and Mistral/Mixtral are in the Appendix.
278
+
279
+ and sequence length corresponds to matrix dimension $M$ . At $M \leq 8$ , activation $x$ is itself much smaller than tensor core tile sizes ( $m = 16, n = 8, k = 16$ ) for 16-bit float Ampere+ mma "tensor core" fixed-function matrix multiplication instructions. In this case, each $8 \times 16$ tile of $w$ (weights) is only used once (no data reuse). Thus, multistage asynchronous pipelining and data reuse concerns in typical high-performance GPU GEMM kernels are reduced, as the problem is largely memory latency (or bandwidth) limited. Tensor cores still outperform manual (scalar) matrix multiplication at $M = 1$ (GEMV / matrix-vector multiplication) per our analysis. An early version of tinygemm, largely focused on int4 grouped quantization for small batch sizes, has been part of core PyTorch since late 2023, subsequently utilized by gpt-fast (PyTorch, 2023), torchao (PyTorch, 2024), and Hugging Face Transformers (Wolf et al., 2020).
280
+
281
+ Many inference works (especially in open source) concentrate on $M = 1$ performance, where latency is a concern. Even in this case, where we would be using only $\frac{1}{8}$ or $\frac{1}{16}$ of tensor core throughput, we improve latency by laying out matrices in main (global) memory in the exact format that mma expects per tile rather than standard row-major / column-major format. Typical tensor core GEMM kernels use shared memory (a small, high-speed user-controllable scratchpad memory) to transpose tiles of matrices into the desired format before multiplication can proceed. We avoid this by performing the transposition in advance, allowing matrix data to pass directly from global memory to registers.
282
+
283
+ As there is little to no weight reuse opportunity for small batch sizes, and loads into registers can be asynchronous as they generally do not stall execution until the point of first use, tinygemm does not use shared memory in many cases. This strategy improves performance at small batch sizes, but is not applicable for larger sizes. To improve efficiency, when $M \leq 8$ , we maintain weights on the left to use the $16 \times 16$ tile, computing $\mathbf{y} = (\mathbf{w}\mathbf{x}^T)^T$ flipping the order of matrices presented to mma with transpositions performed on the fly, and if $M > 8$ , we maintain weights on the right for the $8 \times 16$ tile $(\mathbf{y} = \mathbf{x}\mathbf{w}^T)$ .
284
+
285
+ To implement int4, nf4, or any4 GEMM, we dequantize weights on the fly before mma multiplication. Speed is improved by always ensuring that we can load matrix data using vectorized 16 byte loads in coalesced and contiguous fashion across the warp from global memory. In cases where a single thread's quantized tile data is less than 16 bytes (a m16n8k16 "B" tensor core layout with quantized 4-bit values only needs 2 bytes loaded prior to dequantization per CUDA thread per mma), multiple tiles along the reduction dimension (" $k$ -tiles" in tinygemm terminology) can be packed together to ensure that wide data loads can be used in all cases.
286
+
287
+ Instead of typical int4-to-float dequantization (converting an integer in $[-8, 7]$ to floating point via native instructions or bit manipulation), we can use a 16-entry LUT per row containing arbitrary floating point values. In tinygemm, this LUT is held in a single register with lookup provided using
288
+
289
+ <table><tr><td colspan="9">Llama3 8B</td></tr><tr><td></td><td>Quantization Algorithm</td><td>Numeric Format</td><td>WikiText-2 Perplexity ↓</td><td></td><td>Numeric Format</td><td>WikiText-2 Perplexity ↓</td><td></td><td>Numeric Format WikiText-2 Perplexity ↓</td></tr><tr><td></td><td>FP16</td><td colspan="7">6.1</td></tr><tr><td rowspan="5">4-bits</td><td>RTN</td><td>INT4</td><td>6.9</td><td rowspan="5">3-bits</td><td>INT3</td><td>17.1</td><td rowspan="5">2-bits</td><td>INT2</td></tr><tr><td>GPTQ</td><td>INT4</td><td>6.5</td><td>INT3</td><td>8.2</td><td>INT2</td></tr><tr><td>AWQ</td><td>INT4</td><td>6.6</td><td>INT3</td><td>8.2</td><td>INT2</td></tr><tr><td>QuIP</td><td>INT4</td><td>6.5</td><td>INT3</td><td>7.5</td><td>INT2</td></tr><tr><td>RTN</td><td>ANY4</td><td>6.5</td><td>ANY3</td><td>8.0</td><td>ANY2</td></tr></table>
290
+
291
+ <table><tr><td colspan="10">Llama3 70B</td></tr><tr><td colspan="3">FP16</td><td colspan="7">2.9</td></tr><tr><td rowspan="5">4-bits</td><td>RTN</td><td>INT4</td><td>3.6</td><td rowspan="5">3-bits</td><td>INT3</td><td>11.8</td><td rowspan="5">2-bits</td><td>INT2</td><td>4.6E5</td></tr><tr><td>GPTQ</td><td>INT4</td><td>3.3</td><td>INT3</td><td>5.2</td><td>INT2</td><td>11.9</td></tr><tr><td>AWQ</td><td>INT4</td><td>3.3</td><td>INT3</td><td>4.8</td><td>INT2</td><td>1.7E6</td></tr><tr><td>QuIP</td><td>INT4</td><td>3.4</td><td>INT3</td><td>4.7</td><td>INT2</td><td>13.0</td></tr><tr><td>RTN</td><td>ANY4</td><td>3.2</td><td>ANY3</td><td>4.6</td><td>ANY2</td><td>253.8</td></tr></table>
292
+
293
+ Table 2: Quantizing Llama3 models with various quantization algorithms for different bit widths.
294
+
295
+ GPU warp shuffle functionality, with the 4-bit quantization codes used as LUT indices. An alternative strategy would be to use a shared memory LUT containing all possible $16 \times 16 = 256$ pairs of any4 reproduction values so that two packed any4 values (in a byte) can be dequantized per lookup. While this amount of shared memory usage will likely not affect performance (via occupancy) that much, it does suffer shared memory bank conflict penalties in many circumstances.
296
+
297
+ # 5. Results
298
+
299
+ We quantize weights of all linear modules of all transformer layers: key, query, value, and output projections, up, down projections and gate for feed-forward networks (FFN). Following most quantization papers, we keep weights of embedding and final classification layers high-precision.
300
+
301
+ We evaluate both perplexity and downstream tasks. For perplexity, we ported the implementation of GPTQ for WikiText-2 (Merit et al., 2017), C4 (Raffel et al., 2019), and Penn Treebank (Marcus et al., 1993) that is used by codebases of other quantization papers. To add coding domain, we added perplexity on CodeParrot (CodeParrot).
302
+
303
+ For downstream tasks, we used Eleuther Harness (Gao et al., 2024) for natural language tasks, and BigCode Harness (Ben Allal et al., 2022) for coding tasks. Accuracies on downstream tasks tend to be noisy (Wang et al., 2024), while perplexity is a less noisy indicator of a model's performance.
304
+
305
+ Comparison with Other Numeric Representations We first compare accuracy of any4 with other numeric formats: int4, fp4, nf4. We use group-wise scaling with group size 128, and asymmetric scaling for all models, except for Llama3 70B where we found symmetric scaling leads to
306
+
307
+ better results.
308
+
309
+ We ran on different model families (Llama (Touvron et al., 2023a) and Mistral (Jiang et al., 2023)), different generations (Llama2 (Touvron et al., 2023b) and Llama3 (Grattafori et al., 2024)), and different sizes (from 1B all the way to 70B). We provide results of Llama3 in Table 1, Llama2 in Table A1, and Mistral in Table A2. Our results show any4 has the best accuracies across all models.
310
+
311
+ Speed Comparisons We benchmark matrix multiplication of vector activation and square weight tensors from 1K to 16K on A100 80GB GPU using PyTorch 2.3.0 and provide the speedups of our tinygemm library in Fig. 3. int4, nf4, and any4 were implemented using our tinygemm library. int4 kernels have the highest speedup, reaching close to $3 \times$ . nf4 and any4 speedups reach up to $2 \times$ ; lower than int4 because of the overhead of looking up the LUTs. Nevertheless, any4 has almost the same speedup as nf4, despite the latter requiring a single LUT for a whole tensor and the former requiring a separate LUT for each row in the weight matrix.
312
+
313
+ Comparison with Orthogonal Quantization Techniques As explained in the Related Works section, our work proposes a new numeric representation applying RTN (round-to-nearest). Despite our work being orthogonal to others that transforms weights and/or activations to make them more rounding or quantization friendly, we compare any4 to GPTQ, AWQ, and QuIP that use int4 in Table 2. Results of AWQ, GPTQ, and QuIP are obtained from (Huang et al., 2024). In 4-bit the results show that any4 has either the best or competitive performance. For future work, we can evaluate these orthogonal techniques together, replacing the int4 representation with any4.
314
+
315
+ 3-bit and 2-bit Quantization Although our main goal was 4-bit representation, we ran experiments to see how any3 and
316
+
317
+ <table><tr><td colspan="7">Llama3.2 1B</td></tr><tr><td rowspan="2"></td><td rowspan="2">Calibration Data</td><td rowspan="2">Number of Samples</td><td rowspan="2">Sequence Length per Sample</td><td rowspan="2">WikiText-2</td><td colspan="2">Perplexity ↓</td></tr><tr><td>C4</td><td>PTB</td></tr><tr><td>FP16</td><td></td><td></td><td></td><td>9.76</td><td>12.77</td><td>16.56</td></tr><tr><td>ANY4</td><td>WikiText-2</td><td>128</td><td>2048</td><td>10.70</td><td>14.08</td><td>18.02</td></tr><tr><td>ANY4</td><td>Pile</td><td>128</td><td>2048</td><td>10.70</td><td>13.99</td><td>18.26</td></tr><tr><td>ANY4</td><td>C4</td><td>128</td><td>4096</td><td>10.74</td><td>14.14</td><td>18.10</td></tr><tr><td>ANY4</td><td>C4</td><td>128</td><td>2048</td><td>10.67</td><td>14.05</td><td>17.97</td></tr><tr><td>ANY4</td><td>C4</td><td>128</td><td>512</td><td>10.62</td><td>13.96</td><td>18.03</td></tr><tr><td>ANY4</td><td>Handwritten Prompt</td><td>1</td><td>-</td><td>10.63</td><td>13.95</td><td>17.94</td></tr></table>
318
+
319
+ ![](images/af5b4ca1d8f17fa11775935ee0ae739793049b3e5013195cf383d11234aa2340.jpg)
320
+ Figure 3: Speedup of our tinygemm CUDA kernels on 80GB A100 on matrix multiplication of $1 \times K$ input by $K \times K$ weight, w.r.t PyTorch's bfloat16 implementation.
321
+
322
+ any2 perform compared to the prior orthogonal quantization techniques (Table 2). For 3-bit, any3 is either the best or competitive with other approaches. For 2-bit, QuIP is the best, while any2 is better than AWQ and competitive with GPTQ.
323
+
324
+ # 5.1. Ablation Studies
325
+
326
+ # Calibration Data
327
+
328
+ In Table 3 we ablate with different calibration datasets to calculate sample weighting in Eqn. 23 of our any4 algorithm. The results show that our proposed handwritten sample performs better than commonly used datasets in literature, despite being significantly smaller in number of tokens. Note that the handwritten sample or prompt has a fixed number of words that translates to different numbers of tokens depending on the tokenizer that changes with different models. Our prompt has 88 words only, which will in worst case translate to a few hundred tokens. These results may indicate that a single data sample with diverse topics could be enough or better to calibrate than using many long sample sequences. Our evaluation sequence length is 2048 (following Lin et al., 2024; Frantar et al., 2023)), calibration is on training split of each dataset, and evaluation is on the validation or
329
+
330
+ test split.
331
+
332
+ Group Size In Table 4 we ablate quantization group size from 64 to 1024. any4 always has the lowest perplexity across other 4-bit representations across all group sizes. It is noteworthy that fp4 and nf4 perplexity degenerates for large group sizes at 1024, while any4 only increases marginally.
333
+
334
+ Table 3: any4 quantization with different calibration data.
335
+
336
+ <table><tr><td colspan="6">Llama3.2 1B</td></tr><tr><td></td><td colspan="5">Group Size</td></tr><tr><td></td><td>64</td><td>128</td><td>256</td><td>512</td><td>1024</td></tr><tr><td>FP16</td><td></td><td></td><td>12.77</td><td></td><td></td></tr><tr><td>FP4</td><td>16.19</td><td>17.11</td><td>18.12</td><td>20.43</td><td>2.3E6</td></tr><tr><td>NF4</td><td>14.27</td><td>14.63</td><td>14.98</td><td>15.38</td><td>7.8E5</td></tr><tr><td>ANY4</td><td>13.75</td><td>13.95</td><td>14.09</td><td>14.24</td><td>14.34</td></tr></table>
337
+
338
+ Table 4: C4 perplexity after quantizing with different group sizes.
339
+
340
+ # 6. Conclusion & Future Work
341
+
342
+ We have presented any4, an algorithm to find an optimal low-bit numeric representation for each row in a weight matrix, as well as tinygamm, a matrix multiplication library for low-latency, low-bit inference. We have shown that accuracy of any4 is superior to other 4-bit numeric formats with low memory overhead, and competitive with various orthogonal quantization techniques that involve further preprocessing. We would like to explore combining with these orthogonal techniques in the future.
343
+
344
+ # Acknowledgements
345
+
346
+ We would like to thank Newsha Ardalani for help in running experiments; Daniel Haziza, Francisco Massa, Luca Wehrstedt, Bram Wasti, Steven Li, and Lin Xiao for discussions.
347
+
348
+ # Impact Statement
349
+
350
+ This paper presents a work that quantizes pretrained models. The input to the algorithm is a model's pretrained weights,
351
+
352
+ architecture, and a calibration dataset (which in our case was a single hand-written prompt). We have not evaluated if the quantization algorithm increases or decreases any societal impact of the underlying model. One factor that may introduce bias into the model is the calibration dataset. We leave it for future work to analyze the effect of different calibration datasets (or prompts in our case) on bias and truthfulness.
353
+
354
+ # References
355
+
356
+ Arthur, D. and Vassilvitskii, S. k-means++: the advantages of careful seeding. In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '07, pp. 1027-1035, USA, 2007. Society for Industrial and Applied Mathematics. ISBN 9780898716245.
357
+ Ashkboos, S., Mohtashami, A., Croci, M. L., Li, B., Cameron, P., Jaggi, M., Alistarh, D., Hoefler, T., and Hensman, J. Quarot: Outlier-free 4-bit inference in rotated LLMs. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024a. URL https://openreview.net/forum?id=dfqsW38v1X.
358
+ Ashkboos, S., Mohtashami, A., Croci, M. L., Li, B., Cameron, P., Jaggi, M., Alistarh, D., Hoefer, T., and Hensman, J. Quarot: Outlier-free 4-bit inference in rotated llms, 2024b. URL https://arxiv.org/abs/2404.00456.
359
+ Ben Allal, L., Muennighoff, N., Kumar Umapathi, L., Lipkin, B., and von Werra, L. A framework for the evaluation of code generation models. https://github.com/bigcode-project/bigcode-evaluation-harness, 2022.
360
+ Chee, J., Cai, Y., Kuleshov, V., and Sa, C. D. QuIP: 2-bit quantization of large language models with guarantees. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=xrk9g5vcXR.
361
+ CodeParrot. Codeparrot/codeparrot-clean. URL https: //huggingface.co/datasets/codeparrot /codeparrot-clean.
362
+ Dai, S., Venkatesan, R., Ren, M., Zimmer, B., Dally, W., and Khailany, B. Vs-quant: Per-vector scaled quantization for accurate low-precision neural network inference. In Smola, A., Dimakis, A., and Stoica, I. (eds.), Proceedings of Machine Learning and Systems, volume 3, pp. 873-884, 2021. URL https://proceedings.mlsys.org/paper_files/paper/2021/file/48a6431f04545e11919887748ec5cb52-Paper.pdf.
363
+
364
+ Darvish Rouhani, B., Lo, D., Zhao, R., Liu, M., Fowers, J., Ovtcharov, K., Vinogradsky, A., Massengill, S., Yang, L., Bittner, R., Forin, A., Zhu, H., Na, T., Patel, P., Che, S., Chand Koppaka, L., SONG, X., Som, S., Das, K., T, S., Reinhardt, S., Lanka, S., Chung, E., and Burger, D. Pushing the limits of narrow precision inferencing at cloud scale with microsoft floating point. In Larochelle, H., Ranzato, M., Hadsell, R., Balcan, M., and Lin, H. (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 10271-10281. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/747e32ab0fea7fbd2ad9ec03daa3f840-Paper.pdf.
365
+ Dettmers, T., Lewis, M., Belkada, Y., and Zettlemoyer, L. Gpt3.int8(): 8-bit matrix multiplication for transformers at scale. In Koyejo, S., Mohamed, S., Agarwal, A., Belgrave, D., Cho, K., and Oh, A. (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 30318-30332. Curran Associates, Inc., 2022a. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/c3ba4962c05c49636d4c6206a97e9c8a-Paper-Conference.pdf.
366
+ Dettmers, T., Lewis, M., Shleifer, S., and Zettlemoyer, L. 8-bit optimizers via block-wise quantization. In International Conference on Learning Representations, 2022b. URL https://openreview.net/forum?id=shpkpVXzo3h.
367
+ Dettmers, T., Pagnoni, A., Holtzman, A., and Zettlemoyer, L. Qlora: Efficient finetuning of quantized llms. In Oh, A., Naumann, T., Globerson, A., Saenko, K., Hardt, M., and Levine, S. (eds.), Advances in Neural Information Processing Systems, volume 36, pp. 10088-10115. Curran Associates, Inc., 2023. URL https://proceedings.neurips.cc/paper_files/paper/2023/file/1feb87871436031bdc0f2beaa62a049b-Paper-Conference.pdf.
368
+ Egiazarian, V., Panferov, A., Kuznedev, D., Frantar, E., Babenko, A., and Alistarh, D. Extreme compression of large language models via additive quantization. In *Forty-first International Conference on Machine Learning*, 2024. URL https://openreview.net/forum?id=5mCaITRTmo.
369
+ Frantar, E., Ashkboos, S., Hoefler, T., and Alistarh, D. OPTQ: Accurate quantization for generative pre-trained transformers. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id= tcbBPnfwxsS.
370
+ Fu, F., Hu, Y., He, Y., Jiang, J., Shao, Y., Zhang, C., and Cui, B. Don't waste your bits! Squeeze activations and gradients for deep neural networks via TinyScript. In
371
+
372
+ III, H. D. and Singh, A. (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 3304-3314. PMLR, 13-18 Jul 2020. URL https://proceedings.mlr.press/v119/fu20c.html.
373
+ Gao, L., Tow, J., Abbasi, B., Biderman, S., Black, S., DiPofi, A., Foster, C., Golding, L., Hsu, J., Le Noac'h, A., Li, H., McDonell, K., Muennighoff, N., Ociepa, C., Phang, J., Reynolds, L., Schoelkopf, H., Skowron, A., Sutawika, L., Tang, E., Thite, A., Wang, B., Wang, K., and Zou, A. A framework for few-shot language model evaluation, 07 2024. URL https://zenodo.org/records/1 2608602.
374
+ Gernigon, C., Filip, S.-I., Sentieys, O., Coggiola, C., and Bruno, M. Low-precision floating-point for efficient onboard deep neural network processing, 2023. URL https://arxiv.org/abs/2311.11172.
375
+ Goodfellow, I., Bengio, Y., and Courville, A. Deep Learning. MIT Press, 2016. URL http://www.deeplearningbook.org. Book in preparation for MIT Press.
376
+ Grattaftori, A., Dubey, A., Jauhri, A., Pandey, A., Kadian, A., Al-Dahle, A., Letman, A., Mathur, A., Schelten, A., Vaughan, A., Yang, A., Fan, A., Goyal, A., Hartshorn, A., Yang, A., Mitra, A., Sravankumar, A., Korenev, A., Hinsvark, A., Rao, A., Zhang, A., Rodriguez, A., Gregerson, A., Spataru, A., Roziere, B., Biron, B., Tang, B., Chern, B., Caucheteux, C., Nayak, C., Bi, C., Marra, C., McConnell, C., Keller, C., Touret, C., Wu, C., Wong, C., Ferrer, C. C., Nikolaidis, C., Allonsius, D., Song, D., Pintz, D., Livshits, D., Wyatt, D., Esiobu, D., Choudhary, D., Mahajan, D., Garcia-Olano, D., Perino, D., Hupkes, D., Lakomkin, E., AlBadawy, E., Lobanova, E., Dinan, E., Smith, E. M., Radenovic, F., Guzmán, F., Zhang, F., Synnaeve, G., Lee, G., Anderson, G. L., Thattai, G., Nail, G., Mialon, G., Pang, G., Cucurell, G., Nguyen, H., Korevaar, H., Xu, H., Touvron, H., Zarov, I., Ibarra, I. A., Kloumann, I., Misra, I., Evtimov, I., Zhang, J., Copet, J., Lee, J., Geffert, J., Vranes, J., Park, J., Mahadeokar, J., Shah, J., van der Linde, J., Billock, J., Hong, J., Lee, J., Fu, J., Chi, J., Huang, J., Liu, J., Wang, J., Yu, J., Bitton, J., Spisak, J., Park, J., Rocca, J., Johnstun, J., Saxe, J., Jia, J., Alwala, K. V., Prasad, K., Upasani, K., Plawiak, K., Li, K., Heafield, K., Stone, K., El-Arini, K., Iyer, K., Malik K. Chiu K. Bhalla K. Lakhotia K. Rantala-Yeary L. van der Maaten L. Chen L. Tan L. Jenkins L. Martin L. Madaan L. Malo L. Blecher L. Landzaat L. de Oliveira L. Muzzi M. Pasupuleti M. Singh M. Paluri M. Kardas M. Tsimpoukelli M. Oldham M. Rita M. Pavlova M. Kambadur M. Lewis M. Si M. Singh M. K. Hassan M. Goyal N. Torabi N. Bashlykov N. Bogoychev N. Chatterji N. Zhang N. Duchenne O. Celebi O. Alrassy P. Zhang P. Li P
377
+
378
+ Vasic, P., Weng, P., Bhargava, P., Dubal, P., Krishnan, P., Koura, P. S., Xu, P., He, Q., Dong, Q., Srinivasan, R., Ganapathy, R., Calderer, R., Cabral, R. S., Stojnic, R., Raileanu, R., Maheswari, R., Girdhar, R., Patel, R., Sauvestre, R., Polidoro, R., Sumbaly, R., Taylor, R., Silva, R., Hou, R., Wang, R., Hosseini, S., Chennabasappa, S., Singh, S., Bell, S., Kim, S. S., Edunov, S., Nie, S., Narang, S., Raparthy, S., Shen, S., Wan, S., Bhosale, S., Zhang, S., Vandenhende, S., Batra, S., Whitman, S., Sootla, S., Collot, S., Gururangan, S., Borodinsky, S., Herman, T., Fowler, T., Sheasha, T., Georgiou, T., Scialom, T., Speckbacher, T., Mihaylov, T., Xiao, T., Karn, U., Goswami, V., Gupta, V., Ramanathan, V., Kerkez, V., Gonguet, V., Do, V., Vogeti, V., Albiero, V., Petrovic, V., Chu, W., Xiong, W., Fu, W., Meers, W., Martinet, X., Wang, X., Wang, X., Tan, X. E., Xia, X., Xie, X., Jia, X., Wang, X., Goldschlag, Y., Gaur, Y., Babaei, Y., Wen, Y., Song, Y., Zhang, Y., Li, Y., Mao, Y., Coudert, Z. D., Yan, Z., Chen, Z., Papakipos, Z., Singh, A., Srivastava, A., Jain, A., Kelsey, A., Shajnfeld, A., Gangidi, A., Victoria, A., Goldstand, A., Menon, A., Sharma, A., Boesenberg, A., Baevski, A., Feinstein, A., Kallet, A., Sangani, A., Teo, A., Yunus, A., Lupu, A., Alvarado, A., Caples, A., Gu, A., Ho, A., Poulton, A., Ryan, A., Ramchandani, A., Dong, A., Franco, A., Goyal, A., Saraf, A., Chowdhury, A., Gabriel, A., Bharambe, A., Eisenman, A., Yazdan, A., James, B. Maurer, B. Leonhardi, B. Huang B. Loyd B. Paola B.D. ParanjapeB.LiuB.WuB.NiB.Hancock B. Wasti B. Spence B. Stojkovic B.Gamido B. Montalvo B. Parker C. Burton C.Mejia C. Liu C. WangC.KimC.ZhouC.HuC.-H.CaiC. Tindal C. Feichtenhofer C. Gao C.Civin D.Beaty D.KreymerD.LiD.AdkinsD.XuD.Testuggine D. David D.Parikh D. Liskovich D.Foss D.Wang D.Le,D.Holland D.DowlingE.Jamil E.Montgomery,E.PresaniE.HahnE.WoodE.LeE.-T. Brinkman E. Arcaute E.Dunbar E.Smothers E.Sun F.Kreuk F.Tian F.Kokkinos F.Ozgenel F.Caggioni F. Kanayet F.Seide F.FlorezG.M.Schwarz G.Badeer G.Swee G.Halpern G.Herman G.Sizov G.Guangyi Zhang Lakshminarayanan G.Inan H. Shojanazeri H.Zou H.Wang H.Zha H.Habeeb H. Rudolph H. Suk H.Aspegren H.Goldman H.Zhan H.Damlaj I.Molybog I.Tufanov I.Leontiadis I. Veliche I.-E.Gat I.Weissman J.Geboski J.Kohli J.Lam J.Asher J.Gaya J-B.Marcus J.TangJ Chan J.Zhen J.Reizenstein J.Teboul J.Zhong J Jin J.Yang J.Cummings J.Carvill J.Shepard J McPhie J.Torres J.Ginsburg J.Wang J.WuK.U K.H.Saxena K.Khandelwal K.Zand K.Matosich K.Veeraraghavan K.Michelena K.Li K.Jagadeesh K.Huang K.Chawla K.Huang K.Chen L.Garg L.A.L Silva L.Bell L.Zhang L.Guo L.Yu L. Moshkovich L.Wehrstedt L.Khabsa M.Avalani M
379
+
380
+ Bhatt, M., Mankus, M., Hasson, M., Lennie, M., Reso, M., Groshev, M., Naumov, M., Lathi, M., Keneally, M., Liu, M., Seltzer, M. L., Valko, M., Restrepo, M., Patel, M., Vyatskov, M., Samvelyan, M., Clark, M., Macey, M., Wang, M., Hermoso, M. J., Metanat, M., Rastegari, M., Bansal, M., Santhanam, N., Parks, N., White, N., Bawa, N., Singhal, N., Egebo, N., Usunier, N., Mehta, N., Laptev, N. P., Dong, N., Cheng, N., Chernoguz, O., Hart, O., Salpekar, O., Kalinli, O., Kent, P., Parekh, P., Saab, P., Balaji, P., Rittner, P., Bontrager, P., Roux, P., Dollar, P., Zvyagina, P., Ratanchandani, P., Yuvraj, P., Liang, Q., Alao, R., Rodriguez, R., Ayub, R., Murthy, R., Nayani, R., Mitra, R., Parthasarathy, R., Li, R., Hogan, R., Battey, R., Wang, R., Howes, R., Rinott, R., Mehta, S., Siby, S., Bondu, S. J., Datta, S., Chugh, S., Hunt, S., Dhillon, S., Sidorov, S., Pan, S., Mahajan, S., Verma, S., Yamamoto, S., Ramaswamy, S., Lindsay, S., Lindsay, S., Feng, S., Lin, S., Zha, S. C., Patil, S., Shankar, S., Zhang, S., Zhang, S., Wang, S., Agarwal, S., Sajuyigbe, S., Chintala, S., Max, S., Chen, S., Kehoe, S., Satterfield, S., Govindaprasad, S., Gupta, S., Deng, S., Cho, S., Virk, S., Subramanian, S., Choudhury, S., Goldman, S., Remez, T., Glaser, T., Best, T., Koehler, T., Robinson, T., Li, T., Zhang, T., Matthews, T., Chou, T., Shaked, T., Vontimitta, V., Ajayi, V., Montanez, V., Mohan, V., Kumar, V. S., Mangla, V., Ionescu, V., Poenaru, V., Mihailescu, V. T., Ivanov, V., Li, W., Wang, W., Jiang, W., Bouaziz, W., Constable, W., Tang, X., Wu, X., Wang, X., Wu, X., Gao, X., Kleinman, Y., Chen, Y. Hu Y. Jia Y. QiY.LiY.ZhangY.ZhangY.AdiY.NamY.Yu Wang,ZhaoY.HaoY.QianY.LiY.HeY.Rait Z.DeVitoZ.RosnbrickZ.WenZ.YangZ.Zhao Z.and MaZ.The llama 3 herd of models2024. URL https://arxiv.org/abs/2407.21783.
381
+ Han, S., Mao, H., and Dally, W. J. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. International Conference on Learning Representations (ICLR), 2016.
382
+ Hooper, C. R. C., Kim, S., Mohammadzadeh, H., Mahoney, M. W., Shao, S., Keutzer, K., and Gholami, A. KVQuant: Towards 10 million context length LLM inference with KV cache quantization. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. URL https://openreview.net/forum?id=OLXotew9Du.
383
+ Huang, W., Zheng, X., Ma, X., Qin, H., Lv, C., Chen, H., Luo, J., Qi, X., Liu, X., and Magno, M. An empirical study of llama3 quantization: From llms to mllms, 2024. URL https://arxiv.org/abs/2404.14047.
384
+ Jacob, B., Kligys, S., Chen, B., Zhu, M., Tang, M., Howard, A., Adam, H., and Kalenichenko, D. Quantization
385
+
386
+ and training of neural networks for efficient integer-arithmetic-only inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
387
+ Jiang, A. Q., Sablayrolles, A., Mensch, A., Bamford, C., Chaplot, D. S., de las Casas, D., Bressand, F., Lengyel, G., Lample, G., Saulnier, L., Lavaud, L. R., Lachaux, M.-A., Stock, P., Scao, T. L., Lavril, T., Wang, T., Lacroix, T., and Sayed, W. E. Mistral 7b, 2023. URL https://arxiv.org/abs/2310.06825.
388
+ Kim, S., Hooper, C., Gholami, A., Dong, Z., Li, X., Shen, S., Mahoney, M., and Keutzer, K. Squeezeellm: Dense-and-sparse quantization. arXiv, 2023.
389
+ Lin, J., Tang, J., Tang, H., Yang, S., Chen, W.-M., Wang, W.-C., Xiao, G., Dang, X., Gan, C., and Han, S. Awq: Activation-aware weight quantization for llm compression and acceleration. In MLSys, 2024.
390
+ Liu, Z., Zhao, C., Fedorov, I., Soran, B., Choudhary, D., Krishnamoorthi, R., Chandra, V., Tian, Y., and Blankevoort, T. Spinquant: Lm quantization with learned rotations, 2024. URL https://arxiv.org/abs/2405.16406.
391
+ Lloyd, S. Least squares quantization in pmc. IEEE Transactions on Information Theory, 28(2):129-137, 1982a. doi: 10.1109/TIT.1982.1056489.
392
+ Lloyd, S. Least squares quantization in pmc. IEEE transactions on information theory, 28(2):129-137, 1982b.
393
+ MacQueen, J. et al. Some methods for classification and analysis of multivariate observations. In Proceedings of the fifth Berkeley symposium on mathematical statistics and probability, volume 1, pp. 281-297. Oakland, CA, USA, 1967.
394
+ Marcus, M. P., Marcinkiewicz, M. A., and Santorini, B. Building a large annotated corpus of english: the penn treebank. Comput. Linguist., 19(2):313-330, June 1993. ISSN 0891-2017.
395
+ Max, J. Quantizing for minimum distortion. IRE Transactions on Information Theory, 6(1):7-12, 1960. doi: 10.1109/TIT.1960.1057548.
396
+ Merit, S., Xiong, C., Bradbury, J., and Socher, R. Pointer sentinel mixture models. In International Conference on Learning Representations, 2017. URL https://open review.net/forum?id=Byj72udxe.
397
+ Nagel, M., Amjad, R. A., Van Baalen, M., Louizos, C., and Blankevoort, T. Up or down? adaptive rounding for post-training quantization. In Proceedings of the 37th International Conference on Machine Learning, ICML'20. JMLR.org, 2020.
398
+
399
+ Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournaepau, D., Brucher, M., Perrot, M., and Duchesnay, E. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825-2830, 2011.
400
+ Peng, H., Wu, K., Wei, Y., Zhao, G., Yang, Y., Liu, Z., Xiong, Y., Yang, Z., Ni, B., Hu, J., Li, R., Zhang, M., Li, C., Ning, J., Wang, R., Zhang, Z., Liu, S., Chau, J., Hu, H., and Cheng, P. Fp8-lm: Training fp8 large language models, 2023.
401
+ PyTorch. gpt-fast, 2023. URL https://github.com/pytorch-labs/gpt-fast.
402
+ PyTorch.torchao,2024. URL https://github.com/pytorch/ao.
403
+ Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., and Liu, P. J. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv e-prints, 2019.
404
+ Rouhani, B., Zhao, R., Elango, V., Shafipour, R., Hall, M., Mesmakhosroshahi, M., More, A., Melnick, L., Golub, M., Varatkar, G., Shao, L., Kolhe, G., Melts, D., Klar, J., L'Heureux, R., Perry, M., Burger, D., Chung, E., Deng, Z., Naghshineh, S., Park, J., and Naumov, M. With shared microexponents, a little shifting goes a long way, 2023. URL https://arxiv.org/abs/2302.08007.
405
+ Stock, P., Joulin, A., Gribonval, R., Graham, B., and Jégou, H. And the bit goes down: Revisiting the quantization of neural networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=rJehVyrKwH.
406
+ Sun, X., Wang, N., Chen, C.-Y., Ni, J., Agrawal, A., Cui, X., Venkataramani, S., El Maghraoui, K., Srinivasan, V. V., and Gopalakrishnan, K. Ultra-low precision 4-bit training of deep neural networks. In Larochelle, H., Ranzato, M., Hadsell, R., Balcan, M., and Lin, H. (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1796-1807. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/13b919438259814cd5be8cb45877d577-Paper.pdf.
407
+ Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M.-A., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., Rodriguez, A., Joulin, A., Grave, E., and Lample, G. Llama: Open and efficient foundation language models, 2023a. URL https://arxiv.org/abs/2302.13971.
408
+
409
+ Touvron, H., Martin, L., Stone, K., Albert, P., Almahairi, A., Babaei, Y., Bashlykov, N., Batra, S., Bhargava, P., Bhosale, S., Bikel, D., Blecher, L., Ferrer, C. C., Chen, M., Cucurull, G., Esiobu, D., Fernandes, J., Fu, J., Fu, W., Fuller, B., Gao, C., Goswami, V., Goyal, N., Hartshorn, A., Hosseini, S., Hou, R., Inan, H., Kardas, M., Kerkez, V., Khabsa, M., Kloumann, I., Korenev, A., Koura, P. S., Lachaux, M.-A., Lavril, T., Lee, J., Liskovich, D., Lu, Y., Mao, Y., Martinet, X., Mihaylov, T., Mishra, P., Molybog, I., Nie, Y., Poulton, A., Reizenstein, J., Rungta, R., Saladi, K., Schelten, A., Silva, R., Smith, E. M., Subramanian, R., Tan, X. E., Tang, B., Taylor, R., Williams, A., Kuan, J. X., Xu, P., Yan, Z., Zarov, I., Zhang, Y., Fan, A., Kambadur, M., Narang, S., Rodriguez, A., Stojnic, R., Edunov, S., and Scialom, T. Llama 2: Open foundation and fine-tuned chat models, 2023b. URL https://arxiv.org/abs/2307.09288.
410
+ Tseng, A., Sun, Q., Hou, D., and Sa, C. D. QTIP: Quantization with trellises and incoherence processing. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. URL https://openreview.net/forum?id=7sdkLVuYCU.
411
+ Wang, N., Choi, J., Brand, D., Chen, C.-Y., and Gopalakrishnan, K. Training deep neural networks with 8-bit floating point numbers. In Bengio, S., Wallach, H., Larochelle, H., Grauman, K., Cesa-Bianchi, N., and Garnett, R. (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper_files/paper/2018/file/335d3d1cd7ef05ec77714a215134914c-Paper.pdf.
412
+ Wang, S. I., Gu, A., Madaan, L., Hupkes, D., Liu, J., Wei, Y., Jain, N., Lai, Y., Sootla, S., Press, O., Rozière, B., and Synnaeve, G. Eval-Arena: noise and errors on llm evaluations. https://github.com/cruz-eval/eval-arena, 2024.
413
+ Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., Davison, J., Shleifer, S., von Platen, P., Ma, C., Jernite, Y., Plu, J., Xu, C., Scao, T. L., Gugger, S., Drame, M., Lhoest, Q., and Rush, A. M. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38-45, Online, October 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/2020.emnlp-demos.6.
414
+ Xia, L., Anthonissen, M., Hochstenbach, M., and Koren, B. A simple and efficient stochastic rounding method for training neural networks in low precision, 2021. URL https://arxiv.org/abs/2103.13445.
415
+
416
+ Xiao, G., Lin, J., Seznec, M., Wu, H., Demouth, J., and Han, S. SmoothQuant: Accurate and efficient post-training quantization for large language models. In Proceedings of the 40th International Conference on Machine Learning, 2023.
417
+ Xie, Y. and Jabri, M. Analysis of the effects of quantization in multilayer neural networks using a statistical model. IEEE Transactions on Neural Networks, 3(2):334-338, 1992. doi: 10.1109/72.125876.
418
+ Yoshida, D. Nf4 isn't information theoretically optimal (and that's good), 2023. URL https://arxiv.org/abs/s/2306.06965.
419
+ Zadeh, A. H., Edo, I., Awad, O. M., and Moshovos, A. GOBO: Quantizing Attention-Based NLP Models for Low Latency and Energy Efficient Inference. In 2020 53rd Annual IEEE/ACM International Symposium on Microarchitecture (MICRO), pp. 811-824, Los Alamitos, CA, USA, October 2020. IEEE Computer Society. doi: 10.1109/MICRO50266.2020.00071. URL https://doi.ieeecomputersociety.org/10.1109/MICRO50266.2020.00071.
420
+
421
+ # Appendix
422
+
423
+ # A. Solution Details
424
+
425
+ We provide here more details about our proposed any4 algorithm.
426
+
427
+ # A.1. Algorithm
428
+
429
+ We summarize our any4 quantization algorithm in Alg. 1.
430
+
431
+ Algorithm 1 any4 quantization algorithm.
432
+ ```python
433
+ module2input = calibrate(model, sample_data)
434
+ for module in model:
435
+ w = module.weight()
436
+ wQ = torch.zeros_like(w)
437
+ alpha = []
438
+ beta = []
439
+ for i in range(w.shape[0]):
440
+ wSi, alpha, betai = scale(w[i,:])
441
+ xi = module2input优惠政策[i]
442
+ wQ[i,:] = kmeans(
443
+ samples=wSi,
444
+ sample_weight=alpha*abs(xi.mean())
445
+ )
446
+ alpha.append(alpha)
447
+ beta.append(betai)
448
+ module.weight.data = wQ
449
+ module.alpha = alpha
450
+ module.beta = beta
451
+ ```
452
+
453
+ # B. Further Results
454
+
455
+ # B.1. Comparison with Other Numeric Formats
456
+
457
+ We compare our any4 numeric format with other numeric formats for the Llama2 family of models in Table A1 and for Mistral-7B and Mixtral-7B in Table A2.
458
+
459
+ <table><tr><td colspan="9">Mistral-7B Instruct v0.2</td></tr><tr><td rowspan="2"></td><td rowspan="2">WikiText-2</td><td colspan="3">Perplexity ↓</td><td colspan="4">Tasks ↑</td></tr><tr><td>C4</td><td>PTB</td><td>CodeParrot</td><td>MMLU</td><td>HellaSwag</td><td>GSM8K</td><td>BigBench</td></tr><tr><td>FP16</td><td>5.95</td><td>8.82</td><td>21.77</td><td>2.63</td><td>58.7%</td><td>66.1%</td><td>41.7%</td><td>51.7%</td></tr><tr><td>INT4</td><td>6.14</td><td>9.03</td><td>22.02</td><td>2.70</td><td>57.1%</td><td>65.1%</td><td>39.7%</td><td>50.4%</td></tr><tr><td>FP4</td><td>6.19</td><td>9.10</td><td>21.62</td><td>2.70</td><td>56.6%</td><td>64.7%</td><td>38.2%</td><td>47.7%</td></tr><tr><td>NF4</td><td>6.06</td><td>8.93</td><td>24.72</td><td>2.66</td><td>58.0%</td><td>65.5%</td><td>38.5%</td><td>51.8%</td></tr><tr><td>ANY4</td><td>6.00</td><td>8.85</td><td>23.24</td><td>2.64</td><td>58.6%</td><td>65.4%</td><td>41.1%</td><td>51.7%</td></tr><tr><td colspan="9">Mixtral-8x7B Instruct v0.1</td></tr><tr><td>FP16</td><td>4.14</td><td>7.18</td><td>16.47</td><td>2.20</td><td>68.2%</td><td>67.6%</td><td>64.8%</td><td>68.1%</td></tr><tr><td>INT4</td><td>4.45</td><td>7.45</td><td>16.84</td><td>2.26</td><td>66.5%</td><td>66.3%</td><td>57.8%</td><td>61.8%</td></tr><tr><td>FP4</td><td>4.46</td><td>7.48</td><td>18.42</td><td>2.27</td><td>66.8%</td><td>66.5%</td><td>59.4%</td><td>62.8%</td></tr><tr><td>NF4</td><td>4.30</td><td>7.32</td><td>15.00</td><td>2.24</td><td>67.6%</td><td>67.2%</td><td>61.0%</td><td>66.5%</td></tr><tr><td>ANY4</td><td>4.27</td><td>7.27</td><td>16.14</td><td>2.22</td><td>67.7%</td><td>67.1%</td><td>62.8%</td><td>65.8%</td></tr></table>
460
+
461
+ Table A2: Quantizing Mistral and Mixtral with various numeric formats.
462
+
463
+ <table><tr><td colspan="11">Llama2 7B</td></tr><tr><td rowspan="2"></td><td colspan="4">Perplexity ↓</td><td colspan="6">Tasks ↑</td></tr><tr><td>WikiText-2</td><td>C4</td><td>PTB</td><td>CodeParrot</td><td>HumanEval Pass@1</td><td>MBPP Pass@1</td><td>MMLU</td><td>HellaSwag</td><td>GSM8K</td><td>BBH</td></tr><tr><td>FP16</td><td>5.47</td><td>6.97</td><td>20.83</td><td>2.54</td><td>17.1%</td><td>20.0%</td><td>41.3%</td><td>57.2%</td><td>13.6%</td><td>39.8%</td></tr><tr><td>INT4</td><td>5.74</td><td>7.30</td><td>24.00</td><td>2.63</td><td>10.4%</td><td>18.2%</td><td>38.1%</td><td>56.4%</td><td>10.6%</td><td>36.5%</td></tr><tr><td>FP4</td><td>5.83</td><td>7.37</td><td>22.57</td><td>2.65</td><td>11.0%</td><td>16.8%</td><td>36.5%</td><td>56.6%</td><td>11.2%</td><td>35.5%</td></tr><tr><td>NF4</td><td>5.66</td><td>7.19</td><td>22.82</td><td>2.60</td><td>11.6%</td><td>19.2%</td><td>37.4%</td><td>56.8%</td><td>12.0%</td><td>36.8%</td></tr><tr><td>ANY4</td><td>5.59</td><td>7.10</td><td>21.23</td><td>2.57</td><td>14.0%</td><td>18.4%</td><td>40.3%</td><td>56.7%</td><td>12.7%</td><td>36.9%</td></tr><tr><td colspan="11">Llama2 13B</td></tr><tr><td>FP16</td><td>4.88</td><td>6.47</td><td>28.93</td><td>2.40</td><td>19.5%</td><td>18.4%</td><td>50.5%</td><td>60.0%</td><td>23.2%</td><td>47.4%</td></tr><tr><td>INT4</td><td>5.05</td><td>6.65</td><td>30.79</td><td>2.45</td><td>15.2%</td><td>16.4%</td><td>48.8%</td><td>59.3%</td><td>20.8%</td><td>44.2%</td></tr><tr><td>FP4</td><td>5.07</td><td>6.67</td><td>30.96</td><td>2.46</td><td>15.2%</td><td>16.2%</td><td>49.5%</td><td>59.3%</td><td>19.3%</td><td>43.0%</td></tr><tr><td>NF4</td><td>4.99</td><td>6.58</td><td>31.17</td><td>2.43</td><td>15.9%</td><td>16.0%</td><td>49.9%</td><td>59.9%</td><td>22.1%</td><td>44.6%</td></tr><tr><td>ANY4</td><td>4.97</td><td>6.55</td><td>28.83</td><td>2.42</td><td>15.2%</td><td>18.0%</td><td>49.3%</td><td>59.5%</td><td>21.6%</td><td>44.6%</td></tr><tr><td colspan="11">Llama2 70B</td></tr><tr><td>FP16</td><td>3.32</td><td>5.52</td><td>14.44</td><td>2.11</td><td>31.7%</td><td>37.4%</td><td>65.2%</td><td>64.8%</td><td>53.3%</td><td>67.1%</td></tr><tr><td>INT4</td><td>3.46</td><td>5.61</td><td>14.71</td><td>2.14</td><td>26.8%</td><td>37.8%</td><td>64.4%</td><td>64.7%</td><td>51.4%</td><td>65.0%</td></tr><tr><td>FP4</td><td>3.53</td><td>5.67</td><td>14.34</td><td>2.16</td><td>28.0%</td><td>30.6%</td><td>64.1%</td><td>64.0%</td><td>51.6%</td><td>65.0%</td></tr><tr><td>NF4</td><td>3.44</td><td>5.61</td><td>14.65</td><td>2.14</td><td>29.9%</td><td>37.2%</td><td>64.5%</td><td>63.9%</td><td>50.6%</td><td>65.4%</td></tr><tr><td>ANY4</td><td>3.40</td><td>5.58</td><td>14.64</td><td>2.13</td><td>26.8%</td><td>35.8%</td><td>64.8%</td><td>64.5%</td><td>51.6%</td><td>66.6%</td></tr></table>
464
+
465
+ # C. Further Ablation Studies
466
+
467
+ # C.1. Minimization Terms
468
+
469
+ In Table A3 we ablate on using different terms to minimize when learning (using K-means clustering) the LUT of each row in the weight matrix. First row shows the results of optimizing weights directly. The other 2 rows show the results of using the 2 additional terms of Equation 14 in our paper, i.e., multiplying with activations and scales. These results confirm that our derivation that lead to all the terms of Equation 14 is essential for optimal accuracy.
470
+
471
+ Table A1: Quantizing Llama2 models with various numeric formats.
472
+
473
+ <table><tr><td colspan="6">Llama3.2 1B</td></tr><tr><td></td><td>Term to Minimize</td><td colspan="4">Perplexity ↓</td></tr><tr><td></td><td></td><td>WikiText-2</td><td>C4</td><td>PTB</td><td>CodeParrot</td></tr><tr><td>Weights Only</td><td>(wSi,j - wQi,j)</td><td>6.680</td><td>9.619</td><td>11.186</td><td>2.751</td></tr><tr><td>Weights × Activations</td><td>(wSi,j xj - wQi,j xj)</td><td>6.496</td><td>9.375</td><td>11.055</td><td>2.675</td></tr><tr><td>Weights × Activations × Group Scales</td><td>(αi,jwSi,jxj - αi,jwQi,jxj)</td><td>6.487</td><td>9.366</td><td>11.034</td><td>2.680</td></tr><tr><td>[Ours]</td><td></td><td></td><td></td><td></td><td></td></tr></table>
474
+
475
+ Table A3: Perplexity after quantizing Llama3.2 1B with LUTs created by minimizing different terms.
476
+
477
+ # C.2. K-Means Initialization
478
+
479
+ We use scikit (Pedregosa et al., 2011) to implement K-means clustering, that is core to any4's quantization algorithm. By default, scikit initializes cluster centroids using k-means++ algorithm (Arthur & Vassilvitskii, 2007), but it also supports random initialization, as well as initializing with a vector of pre-defined values. In Table A4 we ablate K-means initialization on Llama 3.2 1B by evaluating k-means++ and random initialization, as well as seeding with uniform int4 values (i.e., integer values -7 to 8), and nf4 values (ranging from -1 to +1). We see that k-means++ performs clearly the best, while uniform int4 initialization performs the worst.
480
+
481
+ <table><tr><td colspan="5">Llama3.2 1B</td></tr><tr><td></td><td rowspan="2">K-Means Initialization</td><td colspan="3">Perplexity ↓</td></tr><tr><td></td><td>WikiText-2</td><td>C4</td><td>PTB</td></tr><tr><td>FP16</td><td></td><td>9.76</td><td>12.77</td><td>16.56</td></tr><tr><td>ANY4</td><td>k-means++</td><td>10.63</td><td>13.95</td><td>17.94</td></tr><tr><td>ANY4</td><td>random</td><td>10.66</td><td>13.97</td><td>18.17</td></tr><tr><td>ANY4</td><td>int4</td><td>10.83</td><td>14.21</td><td>18.69</td></tr><tr><td>ANY4</td><td>nf4</td><td>10.65</td><td>13.96</td><td>18.21</td></tr></table>
482
+
483
+ Table A4: any4 quantization with K-means clustering initialized with different algorithms and values.
any4learned4bitnumericrepresentationforllms/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e89c9b25ba600c2c0a2b6a254ef7bdf944a0bee2b9a1eb842ef7d82cd721e70
3
+ size 797784
any4learned4bitnumericrepresentationforllms/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f60ff2a13d2a1e1c7c4bfebe34685e532077c06b0df7249dff739405c16db758
3
+ size 535826
egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/dabdc8cf-f6a6-4355-a6eb-b0bb1e491482_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee247cb4c27eab3a034187e589c4c74e951a7d0b299f45eb2e854fbffc92c7e7
3
+ size 179852
egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/dabdc8cf-f6a6-4355-a6eb-b0bb1e491482_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f99c13f8272544eb50a5c0226b729f1199a95fa1ba7ff102f95bbba1b8e7a65c
3
+ size 212300
egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/dabdc8cf-f6a6-4355-a6eb-b0bb1e491482_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac0fc12a97b04730efdd558c55a47b0f1e2a31ecee56b308343eb6ff0e24d197
3
+ size 1874064
egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/full.md ADDED
The diff for this file is too large to render. See raw diff
 
egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1ef11ab1d1cd114ad3ba95826680c1128e769dfc7345588c8ac2a91495360e5
3
+ size 1493033
egaievaluebasedgeneralizedinvestingforonlinefalsediscoveryratecontrol/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6065aa35753b85385d873638bf8da6100aafcac12c576eb9d7b1e2f6394328ae
3
+ size 1336155
idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/65055bae-2509-400e-8ce0-3845df4dd036_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1a4b973b0a2857a5e0359247ee0e1e8d3c47c8af0ae7067a941fa57cfe2c408
3
+ size 138259
idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/65055bae-2509-400e-8ce0-3845df4dd036_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:673d81d7cca540e3250bf61e118e91ffd7aadbb95e2ca697c6b6238c2731f3e5
3
+ size 163443
idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/65055bae-2509-400e-8ce0-3845df4dd036_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e67e970cd5466b4aef11eb6d5f543a2244c310dd345e99a1b6a1eab715cbbd8
3
+ size 3681202
idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/full.md ADDED
@@ -0,0 +1,499 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # iDPA: Instance Decoupled Prompt Attention for Incremental Medical Object Detection
2
+
3
+ Huahui Yi<sup>1</sup> Wei Xu<sup>2</sup> Ziyuan Qin<sup>3</sup> Xi Chen<sup>45</sup> Xiaohu Wu<sup>6</sup> Kang Li<sup>17†</sup> Qicheng Lao<sup>6†</sup>
4
+
5
+ # Abstract
6
+
7
+ Existing prompt-based approaches have demonstrated impressive performance in continual learning, leveraging pre-trained large-scale models for classification tasks; however, the tight coupling between foreground-background information and the coupled attention between prompts and image-text tokens present significant challenges in incremental medical object detection tasks, due to the conceptual gap between medical and natural domains. To overcome these challenges, we introduce the iDPA framework, which comprises two main components: 1) Instance-level Prompt Generation (IPG), which decouples fine-grained instance-level knowledge from images and generates prompts that focus on dense predictions, and 2) Decoupled Prompt Attention (DPA), which decouples the original prompt attention, enabling a more direct and efficient transfer of prompt information while reducing memory usage and mitigating catastrophic forgetting. We collect 13 clinical, cross-modal, multi-organ, and multi-category datasets, referred to as ODinM-13, and experiments demonstrate that iDPA outperforms existing SOTA methods, with FAP improvements of $5.44\%$ , $4.83\%$ , $12.88\%$ , and $4.59\%$ in full data, 1-shot, 10-shot, and 50-shot settings, respectively. Code is available at https://github.com/HarveyYi/iDPA.git.
8
+
9
+ <sup>1</sup>West China Biomedical Big Data Center, West China Hospital, Sichuan University <sup>2</sup>School of Biomedical Engineering, Division of Life Sciences and Medicine, University of Science and Technology of China <sup>3</sup>Case Western Reserve University <sup>4</sup>Sports Medicine Center, Department of Orthopedics and Orthopedic Research Institute, West China Hospital, West China School of Medicine, Sichuan University <sup>5</sup>Department of Orthopedics and Orthopedic Research Institute, West China Hospital, Sichuan University <sup>6</sup>Beijing University of Posts and Telecommunications <sup>7</sup>Sichuan University Pittsburgh Institute. Correspondence to: Kang Li <likang@wchscu.cn>, Qicheng Lao <qicheng.lao@bupt.edu.cn>.
10
+
11
+ Proceedings of the $42^{nd}$ International Conference on Machine Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).
12
+
13
+ # 1. Introduction
14
+
15
+ ![](images/7b2276b59705de2d2d8c3d7b795443938eb88ceae949e2a8c32e89da653ff614.jpg)
16
+ Figure 1: Comparison of our method (iDPA) with prior methods, highlighting improved object localization and recognition through instance-level prompt generation and decoupled prompt attention for medical detection tasks.
17
+
18
+ Vision Language Object Detection (VLOD) (Li et al., 2022; Liu et al., 2023a; Cheng et al., 2024), a paradigm that enables recognition of novel categories and scenes, has advanced object detection (OD) by integrating a language branch and leveraging large-scale image-text datasets. While these models demonstrate strong zero-shot capabilities in general domains, they struggle in the medical domain due to the degradation of medical object localization and recognition. However, neither fine-tuning separate OD models for each task nor jointly training a single model for all tasks is practical, as maintaining multiple models is inefficient and predefining all medical concepts is infeasible. Instead, Continual Learning (CL) (Li & Hoiem, 2017; Rebuffi et al., 2017; Wang et al., 2022c) is essential for adapting to emerging medical concepts while retaining prior knowledge. It must balance stability and plasticity to enable continuous learning and improve healthcare outcomes.
19
+
20
+ Recently, prompt-based CL approaches (Wang et al., 2022c;b;a; Smith et al., 2023) have gained popularity for encoding knowledge into prompt sets, enabling a frozen pre-trained model to handle sequential tasks. Compared to previous methods, these approaches not only achieve remarkable performance but also offer key advantages for continual learning. By keeping the base model unchanged and tuning only the prompt vectors, training efficiency is enhanced while eliminating the need for exemplar storage,
21
+
22
+ reducing both memory overhead and computational costs.
23
+
24
+ However, these methods are primarily designed for classification tasks and are not well-suited for OD. Unlike classification, which relies on global information, object detection demands finer-grained instance information. In previous prompt-based CL methods, as shown at the top of Fig. 1, global prompt learning incorporates both foreground and background information, which can interfere with detection tasks. Furthermore, excessive background information can confuse category recognition, especially when task modalities are similar, leading to misclassification. Additionally, prepending prompts directly to the image and text tokens dilutes the prompt information because the length of imagetext tokens far exceeds those of prompts, coupling the two and hindering task-specific learning.
25
+
26
+ Given the complex attention interactions between vision and language in VLOD, the prepending approach introduces further interference between vision and text prompts. Lastly, inserting prompts into pre-trained model, i.e., at the backbone level, limits the effectiveness of tuning, as fine-grained reasoning for detection occurs post-backbone, i.e., at the fusion level.
27
+
28
+ In response to these challenges, we propose a framework called instance Decoupled Prompt Attention (iDPA) for incremental medical object detection. iDPA integrates Instance-level Prompt Generation (IPG) for generating fine-grained object knowledge and Decoupled Prompt Attention (DPA) to enhance prompt decoupling and precise knowledge injection during the multimodal fusion process, as shown at the bottom of Fig. 1. In the IPG module, instance features are decoupled from images, and using cross-attention to query the concept buried in the instance can separate and integrate knowledge across tasks. The DPA module decouples the originally coupled attention between prompts and tokens in previous methods, retaining three key components: vision-language mutual enhancement $(V\leftrightarrow T)$ , prompt-to-vision $(P_{t}\rightarrow V)$ , and prompt-to-text $(P_{v}\rightarrow T)$ knowledge injection. Additionally, instead of injecting knowledge only at the backbone level, we also innovatively apply knowledge injection during the multimodal fusion encoder.
29
+
30
+ Consequently, iDPA incorporates three key strategies. First, by decoupling instance features from background information and incorporating fine-grained visual details into the prompt vectors, iDPA enhances object localization and recognition precision compared to randomly initialized prompts. It also effectively mitigates category confusion by focusing on the target entities and reducing spurious correlations with the background. Second, the decoupled prompt attention approach, which separates prompt vectors from token representations, accelerates knowledge injection, making it more effective for localizing and recognizing medical concepts. This also mitigates catastrophic forgetting
31
+
32
+ by preserving the original category distribution. Finally, it strategically employs the fusion encoder as the optimal knowledge injection position, which is critical for learning new medical concepts and further enhances efficiency.
33
+
34
+ In this paper, our contributions are summarized in threefold:
35
+
36
+ - We propose a novel prompt-based framework iDPA to effectively address incremental medical object detection (IMOD). It decouples instance-level knowledge and efficiently injects it into VLOD models through DPA.
37
+ - To evaluate the effectiveness of our method, we compile medical data from 13 datasets covering multiple modalities and organs, forming ODinM-13 for the IMOD task.
38
+ - Extensive experiments demonstrate the effectiveness of our proposed approach, achieving state-of-the-art performance with only $1.4\%$ of the trained parameters in both full-data and few-shot settings.
39
+
40
+ # 2. Related Work
41
+
42
+ Vision Language Object Detection. Vision-Language Models (VLMs) enhance generalization by aligning visual and textual features through large-scale image-text learning. CLIP (Radford et al., 2021) and ALIGN (Li et al., 2021) leverage contrastive learning to associate images with text, inspiring GLIP (Li et al., 2022) to unify phrase grounding and object detection. Building on GLIP, MQ-Det (Xu et al., 2024) integrates a multimodal query encoder, while Grounding DINO (Liu et al., 2023a) employs a DETR-like (Carion et al., 2020) head for improved scalability. For MOD tasks, existing methods adapt pre-trained natural-domain VLOD models to the medical domain, such as MIU-VL (Qin et al.) with prompt engineering, Guo et al. (Guo et al., 2023) with prompt fusion. However, they struggle with generalization across tasks and domains.
43
+
44
+ Continual Learning. Continual Learning (CL) mitigates catastrophic forgetting when learning new tasks through three primary approaches. Regularization-based methods (Li & Hoiem, 2017; Kirkpatrick et al., 2017; Aljundi et al., 2018; Ding et al., 2022; Lao et al., 2021b) constrain loss functions to retain prior knowledge while adapting to new data. Architecture-based methods (Douillard et al., 2022; Li et al., 2019; Yoon et al., 2017; Mallya & Lazebnik, 2018) assign dedicated parameters for each task to prevent interference. Rehearsal-based methods (Rolnick et al., 2019; Lopez-Paz & Ranzato, 2017; Shin et al., 2017; Rebuffi et al., 2017; Lao et al., 2021a) replay stored exemplars or generate pseudo-samples to mitigate forgetting. With the rise of large-scale pre-trained models, prompt-based continual learning, an architecture-based approach, has gained prominence. L2P (Wang et al., 2022c) first introduced a prompt pool for continual learning, with DualPrompt (Wang et al., 2022b) further partitioning knowledge into general
45
+
46
+ and expert components. S-Prompt (Wang et al., 2022a) enables domain-adaptive prompt learning, while CODA-Prompt (Smith et al., 2023) improves prompt selection via attention mechanisms. DIKI (Tang et al., 2025) reduces task interference with residual tuning, and NoRGa (Le et al., 2024) models prompts as a Mixture-of-Experts with adaptive weighting. Eclipse (Kim et al., 2024) enables efficient continual panoptic segmentation via visual prompt tuning, avoiding retraining and reducing forgetting. Recently, continual learning in medical has gained increasing attention for its flexibility and adaptability to downstream tasks (Yi et al., 2023; Ye et al., 2024), offering a more practical fit for clinical use than all-in-one models like Medical SAM (Zhu et al., 2024; Ma et al., 2024).
47
+
48
+ Continual Object Detection. Continual Object Detection (COD) extends object detection to new categories while retaining prior knowledge. ILOD (Shmelkov et al., 2017) first introduced COD, followed by CL-DETR (Liu et al., 2023b), which improved incremental detection with distillation and memory. ZiRa (Deng et al., 2024) was the first to adapt pre-trained VLOD models for COD, mitigating forgetting through regularization and reparameterization. However, most COD research focuses on natural domains, leaving its effectiveness in data-scarce medical applications uncertain, making this an open challenge.
49
+
50
+ # 3. Preliminary
51
+
52
+ # 3.1. Task Definition
53
+
54
+ Incremental Medical Object Detection (IMOD) involves incrementally detecting and localizing medical objects (e.g., lesions, tumors, organs) in medical imaging data (e.g., CT, MRI, X-ray, PET scans) over time. The task requires sequential learning from multiple tasks $\left[\mathcal{T}_1,\mathcal{T}_2,\dots ,\mathcal{T}_N\right]$ , where each task $\mathcal{T}_i$ consists of a dataset $\mathcal{D}_i = \{x_i^j,y_i^j\}_{j = 1}^{N_i}$ , with $x_{i}^{j}$ representing images and $y_{i}^{j}$ including bounding boxes and class labels. Each task also includes a class name set $C_i = \{c_i^j\}_{j = 1}^{N_{C_i}}$ , linking label indices to category names used by the text encoder of VLOD models. The main challenge in IMOD, particularly in class-incremental learning, is to adapt to new object classes introduced in each task without forgetting previously learned ones, allowing the model to handle an expanding range of medical objects while maintaining detection accuracy across all learned classes. This work is developed based on pre-trained VLOD models (such as GLIP (Li et al., 2022)). When training task $t$ , the task's classes encompass the current task's classes along with the previous tasks' classes.
55
+
56
+ # 3.2. Vision Language Object Detection
57
+
58
+ To better achieve IMOD, this work builds upon pre-trained VLOD models in natural domains, providing a strong foun
59
+
60
+ dation for improving generalization and robustness in data-scarce scenarios, making them highly suitable for practical medical settings. Unlike traditional object detectors, VLOD models replace the classification head with a textual encoder, such as BERT (Devlin, 2018), and introduce a cross-modality fusion encoder that enhances the model's ability to detect medical objects across different imaging modalities. VLOD models for object detection consist of four key components: 1) Visual Encoder $\Phi_v$ , 2) Textual Encoder $\Phi_t$ , 3) Cross-Modality Fusion Encoder $\Phi_f$ , and 4) Localization Head $\Phi_{\mathrm{loc}}$ .
61
+
62
+ $$
63
+ f _ {v} = \Phi_ {\mathbf {v}} (\operatorname {I m g}), \quad f _ {t} = \Phi_ {\mathbf {t}} (\text {T e x t}), \tag {1}
64
+ $$
65
+
66
+ $$
67
+ f _ {v} ^ {\prime}, f _ {t} ^ {\prime} = \Phi_ {\mathrm {f}} \left(f _ {v}, f _ {t}\right), \tag {2}
68
+ $$
69
+
70
+ $$
71
+ p _ {\mathrm {l o c}} = \Phi_ {\mathrm {l o c}} \left(f _ {v} ^ {\prime}\right), \quad p _ {\mathrm {c l s}} = f _ {v} ^ {\prime} \cdot \left(f _ {t} ^ {\prime}\right) ^ {\mathrm {T}}. \tag {3}
72
+ $$
73
+
74
+ The workflow is as follows: First, visual and textual features are extracted using $\Phi_v$ and $\Phi_t$ (Eq. (1)). These features are then fused through the cross-modality fusion encoder $\Phi_f$ (Eq. (2)). Finally, localization $p_{\mathrm{loc}}$ and classification $p_{\mathrm{cls}}$ predictions are generated (Eq. (3)), where $\cdot$ denotes matrix multiplication. The fusion of these features enhances object localization and recognition accuracy.
75
+
76
+ # 3.3. Prompt-Based Continual Learning
77
+
78
+ Prompt-based CL, a type of CL method based on prompting pre-trained models, incrementally learns and stores a lightweight, learnable parameter (known as a prompt) for each task, gradually building a "prompt pool" $P = \{p_1, p_2, \dots, p_N\}$ , where $p_i \in \mathbb{R}^{l \times d}$ . Here, $N$ represents the number of tasks, $l$ is the prompt length, and $d$ is the feature embedding dimension. At inference time, a selected prompt from the prompt pool is appended to the frozen pre-trained model to restore learned knowledge. Given the feature embeddings $f_e \in \mathbb{R}^{L \times d}$ for a transformer layer, the input is formed by concatenating the selected prompt $p_s \in \mathbb{R}^{l \times d}$ with $f_e$ as follows:
79
+
80
+ $$
81
+ \operatorname {T r a n s f o r m e r} \left(\left[ p _ {s}; f _ {e} \right]\right), \quad \text {w h e r e} \left[ p _ {s}; f _ {e} \right] \in \mathbb {R} ^ {(l + L) \times d}, \tag {4}
82
+ $$
83
+
84
+ where $p_s$ is the selected prompt embedding. The prompt selection process relies on query-key matching, with feature centroids $\mathbb{K} = \{K_i\}_{i=1}^N$ learned during training via cosine similarity or clustering. For a test sample $x$ , the most relevant centroid $K_s$ is identified by:
85
+
86
+ $$
87
+ K _ {s} = \arg \max _ {K _ {i} \sim \mathbb {K}} \left\langle \Phi_ {\mathbf {v}} (x), K _ {i} \right\rangle . \tag {5}
88
+ $$
89
+
90
+ Currently, prompt-based CL methods focus on global, mixed knowledge, which suffices for classification tasks. However, for IMOD, fine-grained knowledge is crucial for precise localization and understanding of medical objects. Therefore, adapting prompt-based CL for IMOD requires focusing on learning and preserving specific, fine-grained knowledge to address the unique challenges of IMOD.
91
+
92
+ ![](images/f6cbba02b62858ab18a83ed4e6c574024b5cb524698126080511adfbc36309be.jpg)
93
+
94
+ ![](images/2f1b38fb5a8c2840bd02d7a51efd4dcfaf6127b0b442a175b83066ec58842e29.jpg)
95
+
96
+ ![](images/81ccd66d5522fedb1f7763e6c264acbdd6511822f88f5d230c73db4179f69cc1.jpg)
97
+
98
+ ![](images/ca077dc581a408111ab12d884587578a194abb0c5ac0c5c62ca945159f699d20.jpg)
99
+ Figure 2: Overview of iDPA. Based on a frozen pre-trained VLOD model with visual-language interaction modules (e.g., GLIP (Li et al., 2022)), iDPA integrates Instance-level Prompt Generation (IPG) and Decoupled Prompt Attention (DPA) to enhance object localization and recognition, optimizing knowledge transfer for medical detection tasks.
100
+
101
+ # 4. Methodology
102
+
103
+ # 4.1. Overview of iDPA
104
+
105
+ To effectively achieve the IMOD goal, our core idea is to decouple fine-grained instance-level knowledge, generate enriched concept prompts, and optimize the Prompt Attention (PA) mechanism by retaining key attention components, enabling efficient knowledge injection into the pre-trained model while mitigating class forgetting issues. This reliable, robust approach helps the model focus on essential localization and recognition for clinical medical object detection. Thus, we propose iDPA, an efficient, scalable IMOD framework, as shown in Fig. 2.
106
+
107
+ To realize this design, iDPA integrates Instance-level Prompt Generation (IPG, Sec. 4.2) and Decoupled Prompt Attention (DPA, Sec. 4.3) to enhance robust, scalable incremental learning. First, IPG extracts fine-grained, adaptive instance-level features from the training set and generates rich, diverse, stable instance-specific prompt knowledge. This contextual knowledge is then injected into the frozen, pretrained model through DPA, enabling the model to retain focus on reliable, critical, task-specific details while effectively mitigating interference from previous tasks. Through this streamlined process, iDPA facilitates efficient, precise and seamless fine-grained knowledge transfer, which is essential for accurate IMOD performance.
108
+
109
+ # 4.2. Instance-Level Prompt Generation
110
+
111
+ Inspired by prior research (Wu et al., 2023; Xu et al., 2024), we first use a pre-trained model to extract image features from the training set, then focus on target regions via bounding boxes. To refine these features, we apply cross-attention to disentangle and clarify different concepts, as demonstrated in (Alayrac et al., 2022; Xu et al., 2024).
112
+
113
+ Decoupling Instance Features for Prompt Construction. For each task $\mathcal{T}_i$ , prior to model training, we decouple the instance-level representations $\mathcal{L}_i$ for each of the $|C_i|$ categories from the training data as follows:
114
+
115
+ $$
116
+ v _ {c} ^ {(j)} = \operatorname {R o I P o o l} (\Phi (\operatorname {I m g}, \text {T e x t}), \gamma b), \quad j = 1, 2, \dots , M, \tag {6}
117
+ $$
118
+
119
+ $$
120
+ \mathcal {I} _ {i} = \left\{\mathbf {v} _ {c} \mid \mathbf {v} _ {c} = \left\{v _ {c} ^ {(j)} \right\} _ {j = 1} ^ {M} \right\} _ {c = 1} ^ {| C _ {s} |}, \tag {7}
121
+ $$
122
+
123
+ where each $\mathbf{v}_c\in \mathbb{R}^M$ consists of $M$ instance-level representations of each category, which are encoded by the image encoder $\Phi_{\mathbf{v}}$ or the fusion encoder $\Phi_{\mathbf{f}}$ . These representations are extracted before the attention layers, which correspond to the attention layers where prompt learning is applied. Specifically, given an instance from the $c$ -th category with bbox $b\in \mathbb{R}^4$ in an image, an RoI pooler (Ren, 2015) is used to extract the corresponding region feature $v_{c}^{(j)}\in \mathbb{R}^{d}$ . The scaling factor $\gamma = 1.3^2$ increases the region size to capture additional contextual information. During training, for each class, we query the $M$ instance representations to decouple the $l$ concepts (note that $l$ is the prompt length
124
+
125
+ defined in Eq. (4)) contained within them, which are then used to form the prompt for the current task. In practice, we set $M = 1000$ for full-data settings to ensure diverse concept coverage. For few-shot learning, we set $M = m$ , where $m$ is the number of available shots per class.
126
+
127
+ Continual Concept Perception and Knowledge Integration (CCPKI). Given the instance-level representations $\mathcal{I}_i = \{\mathbf{v}_c\mid |\mathbf{v}_c| = K\}_{c = 1}^{|C_i|}$ , extracted from the training data of the current task for each category, the CCPKI module decouples the concepts from these instances using a Query-Answer framework. Specifically, the generation of the $i$ -th prompt $\hat{p}_i$ can be expressed as follows:
128
+
129
+ $$
130
+ \dot {p _ {i}} = \operatorname {s o f t m a x} \left(\frac {p _ {i} \left(\mathcal {W} _ {k} \mathcal {I} _ {i}\right)}{\sqrt {d}}\right) \left(\mathcal {W} _ {v} \mathcal {I} _ {i}\right); \ddot {p _ {i}} = p _ {i} + \alpha \cdot \sigma (\tau \cdot \dot {p _ {i}}). \tag {8}
131
+ $$
132
+
133
+ To generate task-specific prompts from instance features, we adopt the following attention-based formulation. Here, $p_i \in \mathbb{R}^{l \times d}$ represents the initial prompt for the $i$ -th task, consisting of $l$ learnable concept components that serve as queries. The instance-level representations $\mathcal{I}_i$ are projected into key and value vectors using learnable matrices $\mathcal{W}_k$ and $\mathcal{W}_v$ , respectively. A cross-attention mechanism is then applied to extract task-relevant conceptual knowledge from the instances. Since different tasks may involve different concepts, a learnable scaling factor $\tau \in \mathbb{R}^{l \times 1}$ is used to dynamically modulate the concept weights, followed by a nonlinear activation function $\sigma(\cdot)$ (e.g., tanh) to filter and enhance the meaningful components. Finally, the activated concepts are scaled by $\alpha \in \mathbb{R}^{1 \times d}$ and added to the initial prompt via a residual connection.
134
+
135
+ To transfer knowledge effectively, it is common for previous tasks to assist in learning subsequent ones. Inspired by this, the CCPKI for the $i$ -th task is initialized with the parameters from the previous CCPKI, i.e., $\Phi_i^{CCPKI} \gets \Phi_{i-1}^{CCPKI}$ . In this way, our approach retains the generated concept knowledge $\hat{p}_i$ from the decoupled instances in the prompt pool after training, resulting in a dynamically evolving prompt pool. This design enhances scalability and flexibility, making it particularly well-suited for IMOD tasks.
136
+
137
+ # 4.3. Decoupled Prompt Attention
138
+
139
+ Instead of training a series of prepended prompt vectors for each task, we focus on modifying the attention mechanism to learn multimodal knowledge efficiently. Specifically, we decouple the PA mechanism into two components: the original attention and the attention with prompt knowledge injection. These components are then integrated through a residual connection. This decoupling process is referred to as the DPA mechanism. Compared to PA, DPA accelerates instance-level knowledge learning, reduces task interference, and lowers computational complexity, resulting in reduced memory usage during training.
140
+
141
+ The following outlines the derivation from PA to DPA, using the visual-language interaction module $X$ -Attn (Li et al., 2022; Liu et al., 2025) as an example. The input multimodal tokens $f_{v} \in \mathbb{R}^{L_{v} \times d}$ (for vision) and $f_{t} \in \mathbb{R}^{L_{t} \times d}$ (for text) are fed into $X$ -Attn, where the mutual enhancement of multimodal knowledge produces updated $\widetilde{f}_{v}$ and $\widetilde{f}_{t}$ :
142
+
143
+ $$
144
+ \begin{array}{l} \left\{\widetilde {f} _ {t}, \widetilde {f} _ {v} \right\} = X - \operatorname {A t t n} \left(f _ {t}, f _ {v}\right) \\ = \left\{f _ {t} + \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right), f _ {v} + \operatorname {A t t n} _ {t \rightarrow v} \left(f _ {t}, f _ {v}\right)\right\} \\ = \left\{f _ {t} + \bar {f} _ {t}, f _ {v} + \bar {f} _ {v} \right\}. \tag {9} \\ \end{array}
145
+ $$
146
+
147
+ In Eq. (9), $\mathrm{Attn}_{v\to t}(f_v,f_t)$ represents the vision-to-text knowledge transfer, denoted as $\bar{f}_t$ , and vice versa for the text-to-vision transfer $\bar{f}_v$ . Inspired by (He et al., 2021),
148
+
149
+ ![](images/b63309358f4db90dd8280cc226973b1314a761e22f56e4df5445a4305bf242c9.jpg)
150
+
151
+ ![](images/89b2b93e85b78d1475041c502766cb6fed222c68e35f1384c8cb952efa8b0e33.jpg)
152
+ Figure 3: Comparison between Decoupled Prompt Attention (DPA) and Original Prompt Attention.
153
+
154
+ we analyze the role of prompt tuning in multimodal fusion through formal derivation. We derive an equivalent formulation to closely examine the prompt's role in $\mathrm{Attn}_{v\rightarrow t}$ (For simplicity, we focus on $\mathrm{Attn}_{v\rightarrow t}$ , which can similarly be extended to $\mathrm{Attn}_{t\rightarrow v}$ ), providing an alternative perspective of multimodal prompt tuning:
155
+
156
+ $$
157
+ \begin{array}{l} [ \bar {p} _ {t}; \bar {f} _ {t} ] = \operatorname {A t t n} _ {v \rightarrow t} ([ p _ {v}; f _ {v} ], [ p _ {t}; f _ {t} ]) \\ = \left[\left(1 - \lambda \left(p _ {t}\right)\right) \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, p _ {t}\right) + \lambda \left(p _ {t}\right) \operatorname {A t t n} _ {v \rightarrow t} \left(p _ {v}, p _ {t}\right); \right. \\ (1 - \lambda (f _ {t})) \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right) + \lambda (f _ {t}) \operatorname {A t t n} _ {v \rightarrow t} \left(p _ {v}, f _ {t}\right) ], \tag {10} \\ \end{array}
158
+ $$
159
+
160
+ where $p_{\{v,t\}} \in \mathbb{R}^{l \times d}$ represent vision and text prompts, respectively. These prompts are prepended to the visual and textual features $f_v$ and $f_t$ before being fed into $\mathrm{Attn}_{v \to t}$ .
161
+
162
+ By examining Eq. (10), we introduce the DPA mechanism, which decouples the knowledge transfer processes $p_v \rightarrow f_t$ and $f_v \rightarrow f_t$ in PA. This is achieved through: 1) discarding the learning of $[\bar{p}_t]$ similar to VPT-Deep (Jia et al., 2022), which can be replaced by new trainable prompts in subsequent $X$ -Attn layers to reduce computational complexity
163
+
164
+ Table 1: Performance of various continual learning methods on the ODinM-13 benchmark under the full data setting. FAP (%): Final Average AP. CAP (%): Cumulative Average AP. FFP (%): Final Forgetting Percentage of old tasks.
165
+
166
+ <table><tr><td>Methods</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCOD</td><td>CPM-17</td><td>BreastC</td><td>TBX11k</td><td>KidneyT</td><td>Lumal6</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3k</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>Zero-shot</td><td>4.60</td><td>12.30</td><td>3.20</td><td>3.70</td><td>0.10</td><td>1.00</td><td>0.00</td><td>1.30</td><td>0.00</td><td>0.00</td><td>4.40</td><td>4.50</td><td>5.50</td><td>3.12</td><td>-</td><td>-</td></tr><tr><td>SAM2.1</td><td>0.06</td><td>1.71</td><td>0.00</td><td>8.83</td><td>18.00</td><td>0.15</td><td>0.00</td><td>0.67</td><td>0.23</td><td>0.00</td><td>12.54</td><td>0.08</td><td>0.22</td><td>3.27</td><td>-</td><td>-</td></tr><tr><td>MedSAM-2*</td><td>4.15</td><td>5.34</td><td>4.53</td><td>13.83</td><td>22.44</td><td>1.54</td><td>0.00</td><td>1.56</td><td>4.32</td><td>0.04</td><td>18.56</td><td>2.96</td><td>3.45</td><td>5.02</td><td>-</td><td>-</td></tr><tr><td>FT (Oracle)</td><td>51.74</td><td>76.70</td><td>79.78</td><td>62.63</td><td>37.45</td><td>54.08</td><td>36.76</td><td>66.73</td><td>38.52</td><td>49.22</td><td>75.35</td><td>45.39</td><td>61.72</td><td>56.62</td><td>-</td><td>-</td></tr><tr><td>Joint (Upper)</td><td>46.82</td><td>72.19</td><td>78.70</td><td>61.74</td><td>37.18</td><td>53.34</td><td>35.35</td><td>65.72</td><td>34.03</td><td>47.97</td><td>73.90</td><td>43.89</td><td>59.90</td><td>54.67</td><td>-</td><td>-</td></tr><tr><td colspan="17">Non-Prompt-based CL</td></tr><tr><td>Sequential</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>3.18</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>32.84</td><td>0.00</td><td>0.00</td><td>21.18</td><td>4.40</td><td>15.87</td><td>57.81</td></tr><tr><td>WiSE-FT</td><td>10.47</td><td>45.93</td><td>1.21</td><td>16.23</td><td>7.52</td><td>6.59</td><td>0.20</td><td>10.25</td><td>0.13</td><td>0.03</td><td>13.11</td><td>14.65</td><td>13.06</td><td>10.72</td><td>26.18</td><td>18.60</td></tr><tr><td>ER</td><td>34.86</td><td>60.04</td><td>54.07</td><td>55.72</td><td>15.49</td><td>40.90</td><td>17.33</td><td>48.23</td><td>13.45</td><td>43.93</td><td>65.49</td><td>22.15</td><td>47.14</td><td>39.91</td><td>48.73</td><td>19.25</td></tr><tr><td>ZiRa</td><td>0.14</td><td>0.13</td><td>0.00</td><td>0.71</td><td>0.10</td><td>0.42</td><td>0.00</td><td>0.00</td><td>0.00</td><td>26.85</td><td>0.00</td><td>0.15</td><td>19.02</td><td>3.66</td><td>16.37</td><td>49.67</td></tr><tr><td colspan="17">Prompt-based CL</td></tr><tr><td>L2P</td><td>42.11</td><td>70.16</td><td>46.58</td><td>57.67</td><td>1.62</td><td>48.09</td><td>26.96</td><td>54.60</td><td>27.36</td><td>38.05</td><td>25.58</td><td>29.44</td><td>50.25</td><td>39.88</td><td>46.04</td><td>8.24</td></tr><tr><td>DualPrompt</td><td>44.26</td><td>40.47</td><td>17.73</td><td>34.03</td><td>0.59</td><td>37.03</td><td>5.91</td><td>31.29</td><td>23.12</td><td>42.30</td><td>15.58</td><td>33.57</td><td>49.63</td><td>28.89</td><td>42.24</td><td>20.57</td></tr><tr><td>S-Prompt</td><td>43.48</td><td>63.02</td><td>47.49</td><td>35.52</td><td>8.37</td><td>39.51</td><td>27.96</td><td>57.79</td><td>25.82</td><td>40.67</td><td>65.02</td><td>29.61</td><td>48.97</td><td>41.02</td><td>46.70</td><td>8.87</td></tr><tr><td>CODA</td><td>42.01</td><td>70.63</td><td>58.78</td><td>41.96</td><td>4.51</td><td>47.62</td><td>26.50</td><td>58.36</td><td>22.48</td><td>32.99</td><td>65.71</td><td>27.04</td><td>48.39</td><td>42.08</td><td>49.78</td><td>2.80</td></tr><tr><td>DKTI</td><td>46.91</td><td>75.91</td><td>54.14</td><td>55.12</td><td>0.74</td><td>47.57</td><td>32.63</td><td>62.03</td><td>29.21</td><td>43.29</td><td>16.02</td><td>34.35</td><td>54.77</td><td>42.51</td><td>49.12</td><td>7.74</td></tr><tr><td>NoRGa</td><td>44.62</td><td>75.87</td><td>58.44</td><td>57.73</td><td>1.07</td><td>51.76</td><td>29.71</td><td>63.48</td><td>29.53</td><td>44.54</td><td>37.56</td><td>34.11</td><td>54.46</td><td>44.84</td><td>49.90</td><td>4.92</td></tr><tr><td>iDPA(Ours)</td><td>47.09</td><td>73.76</td><td>66.85</td><td>60.29</td><td>36.54</td><td>50.98</td><td>32.69</td><td>64.98</td><td>31.15</td><td>44.42</td><td>57.20</td><td>34.65</td><td>53.03</td><td>50.28</td><td>54.10</td><td>2.48</td></tr></table>
167
+
168
+ Notes: SAM2.1 denotes auto-segmentation using the SAM2.1-L model, while MedSAM-2* incorporates MedSAM-2's memory bank based on SAM2.1.
169
+
170
+ and memory usage; and 2) re-normalizing the attention weights through the weight adjustment scalar $\lambda(f_t)$ , which aims to remove the coupling between the visual features $f_v$ and the visual prompt $p_v$ :
171
+
172
+ $$
173
+ \lambda \left(f _ {t}\right) = \frac {\sum_ {i} \exp \left(\frac {f _ {t} \mathcal {W} _ {q} \left(p _ {v} \mathcal {W} _ {k}\right) ^ {\mathrm {T}}}{d}\right) _ {i}}{\sum_ {i} \exp \left(\frac {f _ {t} \mathcal {W} _ {q} \left(p _ {v} \mathcal {W} _ {k}\right) ^ {\mathrm {T}}}{d}\right) _ {i} + \sum_ {j} \exp \left(\frac {f _ {t} \mathcal {W} _ {q} \left(f _ {v} \mathcal {W} _ {k}\right) ^ {\mathrm {T}}}{d}\right) _ {j}} \tag {11}
174
+ $$
175
+
176
+ where $\mathcal{W}_{\{q,v\}}\in \mathbb{R}^{d\times d}$ are projection layers. Our proposed DPA mechanism is shown in Fig. 3, and the process of knowledge transfer and fusion for the enhanced text features $\bar{f}_t$ (note that $\bar{p}_t$ is omitted) is then updated to as follows:
177
+
178
+ $$
179
+ \begin{array}{l} \bar {f} _ {t} = \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right) + \frac {\lambda \left(f _ {t}\right)}{1 - \lambda \left(f _ {t}\right)} \operatorname {A t t n} _ {v \rightarrow t} \left(p _ {v}, f _ {t}\right), (12) \\ = \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right) + \lambda \operatorname {A t t n} _ {v \rightarrow t} \left(p _ {v}, f _ {t}\right), (13) \\ \end{array}
180
+ $$
181
+
182
+ where $\lambda \in \mathbb{R}^{1\times d}$ is a learnable parameter, initialized to 0, ensuring that the additional information in $p_v\rightarrow f_t$ does not affect the original branch $f_{v}\to f_{t}$ before training on downstream datasets. For $\lambda (f_t)$ , we argue that in object detection tasks, $f_{v}$ is typically much larger than $p_v$ (e.g., $f_{v}$ may exceed 10,000 tokens, while $p_v$ is typically set to 10), causing the prompt information overshadowed by the input features, reducing learning efficiency. This imbalance in the original PA hinders the model's effective use of the prompts, impeding knowledge transfer and task performance. Compared to PA, DPA reduces the interference between prompt information and the pretrained model by lowering their coupling. Specifically, the normalized attention weight $1 - \lambda (f_t)$ before $\mathrm{Attn}_{v\to t}(f_v,f_t)$ is removed, preserving the full pre-trained model information.
183
+
184
+ The weight $\lambda(f_t)$ before $\mathrm{Attn}_{v \to t}(p_v, f_t)$ is replaced with a learnable scaling factor, providing greater flexibility in learning prompt knowledge and enabling the model to capture more precise and richer downstream information. Additionally, the decoupling process also reduces the computational complexity and memory usage of attention, as shown in 5.4.
185
+
186
+ # 5. Experiments
187
+
188
+ # 5.1. Experimental Setup
189
+
190
+ Benchmark. To ensure a comprehensive evaluation, we collected 13 MOD tasks (Jha et al., 2020; Boccardi et al., 2015; Cassidy et al., 2021; Liu et al., 2020; Gong et al., 2021; Setio et al., 2017; Vu et al., 2019) from publicly available datasets for IMOD, named ODinM-13. This benchmark evaluates model performance in real medical scenarios, covering 8 imaging modalities across 9 organs. Each task is assessed in both full and few-shot settings ( $k = 1$ , 10, 50), ensuring each class has at least $k$ objects. To further evaluate generalizability, we supplement ODinM-13 with a domain-incremental benchmark constructed from four polyp datasets (Ji et al., 2022; Jha et al., 2020; Bernal et al., 2015; Ngoc Lan et al., 2021) across different medical centers. For more details, please see the appendix.
191
+
192
+ Evaluation Metric. To evaluate the model's continual learning and forgetting mitigation, we use Final Average AP (FAP) for final performance, Cumulative Average AP (CAP) for overall performance, and Final Forgetting Percentage (FFP) to measure resistance to forgetting old tasks. The prediction performance for task $\hat{i}$ after learning task $i$ is denoted as $\mathrm{AP}_{i,\hat{i}}$ , where Average Precision (AP) is the standard
193
+
194
+ Table 2: Overall performance of various continual learning methods on the ODinM-13 benchmark under few-shot data settings.
195
+
196
+ <table><tr><td rowspan="2">Method</td><td colspan="3">1-shot</td><td colspan="3">10-shot</td><td colspan="3">50-shot</td></tr><tr><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>Joint (Upper)</td><td>20.03</td><td>-</td><td>-</td><td>36.68</td><td>-</td><td>-</td><td>46.07</td><td>-</td><td>-</td></tr><tr><td>Sequential</td><td>1.24</td><td>11.49</td><td>23.43</td><td>1.66</td><td>13.67</td><td>36.51</td><td>3.38</td><td>14.95</td><td>46.86</td></tr><tr><td>WiSE-FT</td><td>6.16</td><td>14.62</td><td>9.25</td><td>9.47</td><td>21.03</td><td>12.98</td><td>10.24</td><td>23.34</td><td>16.03</td></tr><tr><td>ZiRa</td><td>6.98</td><td>13.59</td><td>11.68</td><td>10.90</td><td>16.19</td><td>15.12</td><td>3.49</td><td>15.78</td><td>37.28</td></tr><tr><td>L2P</td><td>3.25</td><td>7.18</td><td>3.14</td><td>5.16</td><td>9.63</td><td>4.48</td><td>27.91</td><td>35.20</td><td>5.66</td></tr><tr><td>DualPrompt</td><td>7.36</td><td>13.30</td><td>7.93</td><td>5.95</td><td>13.99</td><td>11.34</td><td>20.44</td><td>34.94</td><td>16.91</td></tr><tr><td>S-Prompt</td><td>3.34</td><td>8.90</td><td>5.66</td><td>8.39</td><td>12.98</td><td>4.36</td><td>22.76</td><td>30.86</td><td>7.92</td></tr><tr><td>CODA</td><td>6.89</td><td>13.96</td><td>4.57</td><td>4.41</td><td>14.20</td><td>12.60</td><td>31.75</td><td>40.86</td><td>4.37</td></tr><tr><td>DIKI</td><td>5.67</td><td>13.09</td><td>3.88</td><td>6.46</td><td>15.34</td><td>9.78</td><td>34.06</td><td>42.27</td><td>5.85</td></tr><tr><td>NoRGa</td><td>6.02</td><td>11.09</td><td>5.17</td><td>5.36</td><td>11.90</td><td>8.14</td><td>32.09</td><td>39.12</td><td>5.70</td></tr><tr><td>iDPA (Ours)</td><td>12.19</td><td>18.03</td><td>3.58</td><td>23.78</td><td>29.68</td><td>4.75</td><td>38.65</td><td>45.03</td><td>3.93</td></tr></table>
197
+
198
+ Table 3: Comparison on four polyp datasets under the continual domain setting.
199
+
200
+ <table><tr><td>Methods</td><td>Sun</td><td>Kvasir</td><td>BKAI</td><td>ClinicDB</td><td>FAP ↑</td><td>CAP ↑</td><td>FFP ↓</td></tr><tr><td>L2P</td><td>59.22</td><td>70.01</td><td>73.16</td><td>69.24</td><td>67.91</td><td>68.69</td><td>0.35</td></tr><tr><td>DualPrompt</td><td>62.64</td><td>71.76</td><td>75.43</td><td>72.63</td><td>70.62</td><td>69.77</td><td>1.53</td></tr><tr><td>iDPA (ours)</td><td>66.10</td><td>74.33</td><td>78.77</td><td>77.93</td><td>74.28</td><td>70.92</td><td>-0.03</td></tr></table>
201
+
202
+ COCO metric (Lin et al., 2014). The average AP across all tasks after learning task $i$ is given by $\mathrm{AP}_i = \frac{1}{i}\sum_{\hat{i} = 1}^i\mathrm{AP}_{i,\hat{i}}$ . After completing all $N$ tasks, the final AP for each task is denoted as $\mathrm{AP}_{N,\cdot}$ , and the final average performance is computed as $\mathrm{FAP} = \mathrm{AP}_N$ , which serves as the primary metric for CL performance. To assess historical performance, we calculate $\mathrm{CAP} = \frac{1}{N}\sum_{i = 1}^{N}\mathrm{AP}_i$ , and the Final Forgetting Percentage as $\mathrm{FFP} = \frac{1}{N - 1}\sum_{i = 1}^{N - 1}(\mathrm{AP}_{i,i} - \mathrm{AP}_{N,i})$ , extending the Forgetting Percentage Point (FPP) introduced by CL-DETR (Liu et al., 2023b).
203
+
204
+ Comparison Methods. We compare our iDPA with both non-prompt-based and prompt-based CL methods. For non-prompt-based CL, we select Sequential, ER (Rollnick et al., 2019), WiSE-FT (Wortsman et al., 2022), and ZiRa (Deng et al., 2024). For prompt-based CL, we include L2P (Wang et al., 2022c), DualPrompt (Wang et al., 2022b), CODA (Smith et al., 2023), S-Prompt (Wang et al., 2022a), DIKI (Tang et al., 2025), and NoRGa (Le et al., 2024), which follow a similar task-specific parameter training approach to our iDPA. Note that L2P, DualPrompt, CODA, and NoRGa are originally designed for vision tasks; we extend them to multimodal tasks for fair comparison. For the all-in-one style foundation model, we compared Zero-shot GLIP, SAM2.1 (Ravi et al., 2024), and MedSAM-2 (Zhu et al., 2024). More details on reproduction can be found in the appendix.
205
+
206
+ Implementation Details. We use the GLIP (Liu et al., 2023a) model with Swin-T (Liu et al., 2021), pre-trained
207
+
208
+ ![](images/1ae1377575c33cc2caf13e3983132c7758977eafbc8482405160a5ef9fd02370.jpg)
209
+
210
+ ![](images/6e859cb297997b7e85445e754add81a161a58ccba76abe026093786f9a0549d9.jpg)
211
+
212
+ ![](images/c403a541f26a86a318d696b42eab09230ca2b09e40ce05612751697b8ed65721.jpg)
213
+ Figure 4: Performance variation of different CL methods in full-data and few-shot settings.
214
+
215
+ ![](images/4688f9595712a02d67da6fd0c3b0f95c8ae4659c91457588f4900d852cad9cbd.jpg)
216
+
217
+ on Object365 (Shao et al., 2019), GoldG (Liu et al., 2023a), and Cap4M (Liu et al., 2023a), as a robust starting point. All experiments employ AdamW (Loshchilov, 2017) with a multistep learning rate scheduler. The learning rate is set to 0.1, and weight decay is set to 1e-4. The experiments run on 4 GPUs with a batch size of 1 per GPU for 5 epochs, with a learning rate decay of 0.1 at epoch 3. All results are averaged over 3 random seeds, with the task order determined by the seed. All comparison methods are re-implemented based on their official implementations. For more details, please refer to the appendix.
218
+
219
+ # 5.2. Main Results
220
+
221
+ Full Data Setting. Tab. 1 presents the final performance for each task on ODinM-13 under full data training, along with the FAP, CAP, and FFP scores to evaluate the model's final performance, overall performance, and resistance to forgetting. The "Zero-shot" results represent the starting point, derived by leveraging the original GLIP weights for each task. The "FT" results indicate the model's oracle performance, which is achieved by training on a single task and testing on the corresponding task. The "Joint" results represent the model trained on the datasets of all tasks, serving as the upper bound in continual learning.
222
+
223
+ As indicated by the bold values, iDPA achieves the best final performance on 9 out of 13 tasks compared to other methods. It outperforms the previous prompt-based SOTA method, NoRGa (Le et al., 2024), by $5.44\%$ in FAP, $4.20\%$ in CAP, and reduces FFP by $2.44\%$ . It also outperforms the previous non-prompt-based SOTA method, ER (Rolnick et al., 2019), which requires extra data (10-shot per class) for rehearsal and full model tuning, by $10.37\%$ in FAP, $5.37\%$ in CAP, and reduces FFP by $16.77\%$ . Furthermore, iDPA uses only $1.4\%$ of the trainable parameters and does not require additional data for rehearsal. Compared to ZiRa (Deng et al.,
224
+
225
+ Table 4: Ablation study of key components in iDPA.
226
+
227
+ <table><tr><td>Method</td><td>FAP ↑</td><td>CAP ↑</td><td>FFP ↓</td><td>#Params↓</td><td>#Memory↓</td></tr><tr><td>Naïve</td><td>44.99</td><td>49.86</td><td>4.31</td><td>1.24M</td><td>7200M</td></tr><tr><td>IPG (w/ T)</td><td>48.65</td><td>52.69</td><td>3.71</td><td>3.21M</td><td>7285M</td></tr><tr><td>DPA</td><td>47.10</td><td>51.04</td><td>3.73</td><td>1.37M</td><td>6496M</td></tr><tr><td>IPG (w/o T) + DPA</td><td>50.17</td><td>53.89</td><td>2.54</td><td>3.22M</td><td>6590M</td></tr><tr><td>IPG (w/ T) + DPA</td><td>50.28</td><td>54.10</td><td>2.48</td><td>3.22M</td><td>6590M</td></tr></table>
228
+
229
+ Notes: FAP (%): Final Average AP. CAP (%): Cumulative Average AP. FFP (%): Final Forgetting Percentage of old tasks. #Params: The number of trainable parameters used during training. #Memory: Memory usage during training with $1024 \times 1024$ input and batch size 1. #Time: Training time on ODinM-13using 1 GPU, batch size 1, for 5 epochs. w/ T: Indicates the presence of weight transfer between tasks. w/o T: Indicates the absence of weight transfer between tasks.
230
+
231
+ Table 5: Comparison of iDPA at different positions.
232
+
233
+ <table><tr><td>Φv</td><td>Φt</td><td>Φf</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td><td>#Params↓</td><td>#Memory↓</td><td>#Time↓</td></tr><tr><td>✓</td><td>X</td><td>X</td><td>47.44</td><td>51.78</td><td>2.91</td><td>4.36M</td><td>7622M</td><td>7h40m</td></tr><tr><td>X</td><td>✓</td><td>X</td><td>38.44</td><td>44.89</td><td>7.53</td><td>6.89M</td><td>7177M</td><td>7h36m</td></tr><tr><td>✓</td><td>✓</td><td>X</td><td>48.41</td><td>53.56</td><td>4.38</td><td>11.26M</td><td>8295M</td><td>9h10m</td></tr><tr><td>X</td><td>X</td><td>✓</td><td>50.28</td><td>54.10</td><td>2.48</td><td>3.22M</td><td>6590M</td><td>6h28m</td></tr><tr><td>✓</td><td>✓</td><td>✓</td><td>51.56</td><td>56.25</td><td>3.17</td><td>14.48M</td><td>8945M</td><td>9h32m</td></tr></table>
234
+
235
+ ![](images/244c404a4f2c2a86d131ea68e319095c24db02ea2f70e776af1b451358fa6f38.jpg)
236
+ (a) Different context knowledge
237
+
238
+ ![](images/594d58efab3f715c3e905fc0ba3e9aa690d7a5a93d17f23289c5df1687eed801.jpg)
239
+ (b) Different scale types
240
+
241
+ ![](images/8cf68182e31a15e7a4e69bbcef58e46a98588e04dd97d1a61efcf54c63e6d50b.jpg)
242
+ (c) Different learning rate
243
+ Figure 5: Impact of context knowledge, scale types, learning rate, and prompt length on model performance.
244
+
245
+ ![](images/7374b83eb434d5fcb554d69a39877677fcdba0ffea70782225da83d2ba32d7c1.jpg)
246
+ (d) Prompt length
247
+
248
+ Table 6: Comparison of iDPA with varying layers in ${\Phi }_{\mathbf{f}}$ .
249
+
250
+ <table><tr><td>Layers</td><td>FAP↑</td><td>FAP50↑</td><td>FAP75↑</td><td>#Params ↓</td><td>#Memory ↓</td></tr><tr><td>1</td><td>45.53</td><td>75.07</td><td>46.78</td><td>0.54M</td><td>6054M</td></tr><tr><td>2</td><td>48.16</td><td>77.72</td><td>50.89</td><td>1.07M</td><td>6162M</td></tr><tr><td>4</td><td>49.94</td><td>79.12</td><td>53.34</td><td>2.15M</td><td>6371M</td></tr><tr><td>6 (all)</td><td>50.28</td><td>79.47</td><td>54.29</td><td>3.22M</td><td>6590M</td></tr></table>
251
+
252
+ 2024), which is designed for incremental VLOD learning, iDPA surpasses it by $46.62\%$ in FAP, $37.73\%$ in CAP, and reduces FFP by $47.19\%$ . This is due to the substantial gap between the medical and natural domains, along with the large differences across modalities, organs, and categories, which makes it difficult for ZiRa to regularize and reconfigure parameters to learn a shared space. Additionally, compared to the upper bound, iDPA is only $4.39\%$ lower in FAP. These results demonstrate the effectiveness of using a prompt-based CL method for the comprehensive MOD task. Our method maintains excellent performance while ensuring data independence, parameter efficiency, model resistance to forgetting, scalability, and flexibility.
253
+
254
+ Few-Shot Data Setting. To simulate the challenging real-world scenario of limited data annotation in clinical settings, we also conduct experiments in the few-shot setting on ODinM-13, as shown in Tab. 2. In the 1-shot setting, our iDPA outperforms the best alternative by $4.38\%$ in FAP, and $4.07\%$ in CAP, with only a $0.44\%$ increase in FFP. In the 10-shot setting, iDPA outperforms the best result by $12.88\%$ in FAP, $8.65\%$ in CAP, and exhibits a minimal $0.39\%$ increase in FFP. In the 50-shot setting, iDPA outperforms the best result by $4.59\%$ in FAP, $2.76\%$ in CAP, and reduces FFP by $0.44\%$ . These results highlight the strong knowledge
255
+
256
+ Table 7: Impact of scaling factor $\gamma$ in Eq. 7 on performance.
257
+
258
+ <table><tr><td>γ</td><td>FAP ↑</td><td>AP↑</td><td>FFP ↓</td></tr><tr><td>1.00</td><td>50.07</td><td>54.01</td><td>2.57</td></tr><tr><td>1.30</td><td>50.28</td><td>54.10</td><td>2.48</td></tr><tr><td>1.50</td><td>49.99</td><td>53.40</td><td>2.77</td></tr></table>
259
+
260
+ Table 8: Comparison between the Naïve baseline and iDPA on $(\Phi_v + \Phi_t)$ .
261
+
262
+ <table><tr><td>(Φv + Φt)</td><td>FAP ↑</td><td>CAP ↑</td><td>FFP ↓</td></tr><tr><td>Naïve</td><td>41.72</td><td>47.30</td><td>8.57</td></tr><tr><td>iDPA (ours)</td><td>48.41</td><td>53.56</td><td>4.38</td></tr><tr><td>Δ</td><td>6.69</td><td>6.26</td><td>4.19</td></tr></table>
263
+
264
+ transfer capability of our approach, which, by decoupling instance-level knowledge and leveraging DPA, greatly improves model performance and efficiency, particularly in data-scarce environments.
265
+
266
+ Domain Continual Setting. iDPA achieves the best performance across all four polyp datasets under the continual domain setting, outperforming L2P and DualPrompt in FAP, CAP, and FFP. These results demonstrate the superior generalizability and stability of iDPA in handling domain shifts.
267
+
268
+ Visualization. Fig. 4 shows the AP variation of different CL methods on ODinM-13. Our method outperforms existing ones throughout the incremental learning process, not just at the end. More qualitative results are provided in Fig. 7 in the appendix showing that iDPA produces more accurate bounding boxes with higher confidence for various MOD tasks
269
+
270
+ than Zero-shot and the L2P method (Wang et al., 2022c), using enhanced knowledge transfer.
271
+
272
+ # 5.3. Ablation Study
273
+
274
+ We conduct ablation studies of the proposed modules in iDPA on ODinM-13 under the full data setting, as shown in Tab. 4. Compared to the Naïve prompt method, adding the IPG module improves FAP by $3.66\%$ , CAP by $2.83\%$ , and reduces FFP by $0.60\%$ . Adding the DPA module increases FAP by $2.11\%$ , CAP by $1.18\%$ , and reduces FFP by $0.58\%$ . Moreover, DPA reduces both gradient backpropagation computation and memory usage, while introducing only a minimal number of additional parameters. When both modules are combined, FAP increases by $5.29\%$ , CAP by $4.24\%$ , and FFP decreases by $1.83\%$ . These results demonstrate that decoupling instance knowledge from images effectively enhances object recognition and localization. By decoupling PA, DPA enables more efficient learning and better injection of prompt knowledge. Furthermore, since the two modules are orthogonal, combining them improves the model's ability to complete the IMOD task. Additionally, we investigate knowledge transfer across medical tasks. When IPG is not used for weight transfer, performance slightly decreases. However, despite the substantial differences between medical tasks, knowledge sharing still occurs. This is especially evident when reducing the number of training epochs, where weight transfer significantly boosts learning efficiency. For further details, please refer to the appendix.
275
+
276
+ # 5.4. Empirical Analysis
277
+
278
+ Impact of Knowledge Injection Position. As shown in Tab. 5, we compare different positions for prompt knowledge injection in VLOD models. The Fusion Encoder achieves the best balance between performance and cost.
279
+
280
+ Impact of Context Knowledge. In Fig. 5a, we compare four types of context knowledge: Gaussian noise, image knowledge, instance-level knowledge from different layers (denoted as 'Instances*'), and instance-level knowledge from the corresponding layer (denoted as 'Instances'). Our experiments demonstrate that context-aware knowledge enhances the IMOD task, with the best performance achieved by instance knowledge from the corresponding layer.
281
+
282
+ Impact of Scale $\lambda$ in DPA. We test four types of scale $\lambda$ in DPA: constant (1.0), gate mechanism, task-level ( $\lambda \in \mathbb{R}^{1 \times 1}$ ), and dim-level ( $\lambda \in \mathbb{R}^{1 \times d}$ ). As shown in Fig. 5b, dim-level $\lambda$ yields the best performance.
283
+
284
+ Impact of Learning Rate. A grid search over the range [1e-5, 0.1] reveals that a learning rate of 0.01 provides the best performance. Results for iDPA at different learning rates are shown in Fig. 5c.
285
+
286
+ Impact of Prompt Length. We compare prompt lengths in
287
+
288
+ full data and few-shot settings (Fig. 5d). A prompt length of 10 offers balanced performance and is chosen as the default.
289
+
290
+ Impact of $X$ -Attn Layer Count. We conduct experiments with different numbers of $X$ -Attn layers (1, 2, 4, and 6) and find that incorporating all layers achieves the best performance, as shown in Tab. 6.
291
+
292
+ Impact of scaling factor $\gamma$ in Eq. 7. As shown in Tab. 7, the model achieves the best performance when the scaling factor $\gamma$ is set to 1.30, yielding the highest FAP and AP, and the lowest FFP. This suggests that moderately enlarging the RoI region helps capture more useful contextual information.
293
+
294
+ Fairness of Naïve Baseline Comparison. As shown in Tab. 8, iDPA outperforms the Naïve baseline when prompts are injected into both $\Phi_v$ and $\Phi_t$ , achieving gains of 6.69 FAP and 6.26 CAP, and reducing FFP by 4.19, demonstrating the effectiveness of our design.
295
+
296
+ # 6. Conclusion
297
+
298
+ This study presents iDPA for IMOD learning without catastrophic forgetting. iDPA efficiently generates and injects instance-level knowledge, reducing computational complexity and memory usage. It decouples target instance features and employs a continual concept perception mechanism to create and integrate concept prompts into the multimodal fusion process. Additionally, iDPA refines prompt attention into three key interaction steps, focusing on continual learning for efficient knowledge injection while preserving the original knowledge. For the evaluation, we introduce a new IMOD benchmark, ODinM-13, with 13 MOD datasets. Experiments show that iDPA outperforms previous SOTA methods in both full-data and few-shot settings. Our analysis also demonstrates that our method can be more efficient and memory-friendly compared to previous CL methods.
299
+
300
+ # Impact Statement
301
+
302
+ This paper presents work whose goal is to advance the field of Machine Learning. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here.
303
+
304
+ # Acknowledgments
305
+
306
+ The authors would like to thank the GLIP team and the developers of other continual learning methods for making their code and models publicly available, which greatly facilitated this work. We also acknowledge the contributions of individuals and organizations who have shared open-source medical imaging datasets. We are grateful to the anonymous reviewers and program chairs for their valuable and constructive feedback.
307
+
308
+ # References
309
+
310
+ Alayrac, J.-B., Donahue, J., Luc, P., Miech, A., Barr, I., Hasson, Y., Lenc, K., Mensch, A., Millican, K., Reynolds, M., et al. Flamingo: a visual language model for few-shot learning. Advances in neural information processing systems, 35:23716-23736, 2022.
311
+ Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrbach, M., and Tuytelaars, T. Memory aware synapses: Learning what (not) to forget. In Proceedings of the European conference on computer vision (ECCV), pp. 139-154, 2018.
312
+ Bernal, J., Sánchez, F. J., Fernández-Esparrach, G., Gil, D., Rodríguez, C., and Vilarino, F. Wm-dova maps for accurate polyp highlighting in colonoscopy: Validation vs. saliency maps from physicians. Computerized medical imaging and graphics, 43:99-111, 2015.
313
+ Boccardi, M., Bocchetta, M., Morency, F. C., Collins, D. L., Nishikawa, M., Ganzola, R., Grothe, M. J., Wolf, D., Redolfi, A., Pievani, M., et al. Training labels for hippocampal segmentation based on the eadc-adni harmonized hippocampal protocol. *Alzheimer's & Dementia*, 11(2):175-183, 2015.
314
+ Carion, N., Massa, F., Synnaeve, G., Usunier, N., Kirillov, A., and Zagoruyko, S. End-to-end object detection with transformers. In European conference on computer vision, pp. 213-229. Springer, 2020.
315
+ Cassidy, B., Reeves, N. D., Pappachan, J. M., Gillespie, D., O'Shea, C., Rajbhandari, S., Maiya, A. G., Frank, E., Boulton, A. J., Armstrong, D. G., et al. The dfuc 2020 dataset: Analysis towards diabetic foot ulcer detection. *touchREVIEW* in Endocrinology, 17(1):5, 2021.
316
+ Cheng, T., Song, L., Ge, Y., Liu, W., Wang, X., and Shan, Y. Yolo-world: Real-time open-vocabulary object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16901-16911, 2024.
317
+ Deng, J., Zhang, H., Ding, K., Hu, J., Zhang, X., and Wang, Y. Zero-shot generalizable incremental learning for vision-language object detection. arXiv preprint arXiv:2403.01680, 2024.
318
+ Devlin, J. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
319
+ Ding, Y., Liu, L., Tian, C., Yang, J., and Ding, H. Don't stop learning: Towards continual learning for the clip model. arXiv preprint arXiv:2207.09248, 2022.
320
+ Douillard, A., Ramé, A., Couairon, G., and Cord, M. Dytox: Transformers for continual learning with dynamic token
321
+
322
+ expansion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9285-9295, 2022.
323
+ Gong, H., Chen, G., Wang, R., Xie, X., Mao, M., Yu, Y., Chen, F., and Li, G. Multi-task learning for thyroid nodule segmentation with thyroid region prior. In 2021 IEEE 18th International Symposium on Biomedical Imaging (ISBI), pp. 257-261. IEEE, 2021.
324
+ Guo, M., Yi, H., Qin, Z., Wang, H., Men, A., and Lao, Q. Multiple prompt fusion for zero-shot lesion detection using vision-language models. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 283-292. Springer, 2023.
325
+ He, J., Zhou, C., Ma, X., Berg-Kirkpatrick, T., and Neubig, G. Towards a unified view of parameter-efficient transfer learning. arXiv preprint arXiv:2110.04366, 2021.
326
+ Jha, D., Smedsrud, P. H., Riegler, M. A., Halvorsen, P., Lange, T. d., Johansen, D., and Johansen, H. D. Kvasir-seg: A segmented polyp dataset. In International Conference on Multimedia Modeling, pp. 451-462. Springer, 2020.
327
+ Ji, G.-P., Xiao, G., Chou, Y.-C., Fan, D.-P., Zhao, K., Chen, G., and Van Gool, L. Video polyp segmentation: A deep learning perspective. Machine Intelligence Research, 19 (6):531-549, 2022.
328
+ Jia, M., Tang, L., Chen, B.-C., Cardie, C., Belongie, S., Hariharan, B., and Lim, S.-N. Visual prompt tuning. In European Conference on Computer Vision, pp. 709-727. Springer, 2022.
329
+ Kim, B., Yu, J., and Hwang, S. J. Eclipse: Efficient continual learning in panoptic segmentation with visual prompt tuning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3346-3356, 2024.
330
+ Kirkpatrick, J., Pascanu, R., Rabinowitz, N., Veness, J., Desjardins, G., Rusu, A. A., Milan, K., Quan, J., Ramalho, T., Grabska-Barwinska, A., et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521-3526, 2017.
331
+ Lao, Q., Jiang, X., Havaei, M., and Bengio, Y. A two-stream continual learning system with variational domain-agnostic feature replay. IEEE Transactions on Neural Networks and Learning Systems, 33(9):4466-4478, 2021a.
332
+ Lao, Q., Mortazavi, M., Tahaei, M., Dutil, F., Fevens, T., and Havaei, M. Focl: Feature-oriented continual learning for generative models. Pattern Recognition, 120:108127, 2021b.
333
+
334
+ Le, M., Nguyen, A., Nguyen, H., Nguyen, T., Pham, T., Van Ngo, L., and Ho, N. Mixture of experts meets prompt-based continual learning. arXiv preprint arXiv:2405.14124, 2024.
335
+ Li, J., Selvaraju, R., Gotmare, A., Joty, S., Xiong, C., and Hoi, S. C. H. Align before fuse: Vision and language representation learning with momentum distillation. Advances in neural information processing systems, 34: 9694-9705, 2021.
336
+ Li, L. H., Zhang, P., Zhang, H., Yang, J., Li, C., Zhong, Y., Wang, L., Yuan, L., Zhang, L., Hwang, J.-N., et al. Grounded language-image pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10965-10975, 2022.
337
+ Li, X., Zhou, Y., Wu, T., Socher, R., and Xiong, C. Learn to grow: A continual structure learning framework for overcoming catastrophic forgetting. In International conference on machine learning, pp. 3925-3934. PMLR, 2019.
338
+ Li, Z. and Hoiem, D. Learning without forgetting. IEEE transactions on pattern analysis and machine intelligence, 40(12):2935-2947, 2017.
339
+ Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollar, P., and Zitnick, C. L. Microsoft coco: Common objects in context. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740-755. Springer, 2014.
340
+ Liu, S., Zeng, Z., Ren, T., Li, F., Zhang, H., Yang, J., Li, C., Yang, J., Su, H., Zhu, J., et al. Grounding dino: Marrying dino with grounded pre-training for open-set object detection. arXiv preprint arXiv:2303.05499, 2023a.
341
+ Liu, S., Zeng, Z., Ren, T., Li, F., Zhang, H., Yang, J., Jiang, Q., Li, C., Yang, J., Su, H., et al. Grounding dino: Marrying dino with grounded pre-training for open-set object detection. In European Conference on Computer Vision, pp. 38-55. Springer, 2025.
342
+ Liu, Y., Wu, Y.-H., Ban, Y., Wang, H., and Cheng, M.-M. Rethinking computer-aided tuberculosis diagnosis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2646-2655, 2020.
343
+ Liu, Y., Schiele, B., Vedaldi, A., and Rupprecht, C. Continual detection transformer for incremental object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 23799-23808, 2023b.
344
+
345
+ Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., and Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 10012-10022, 2021.
346
+ Lopez-Paz, D. and Ranzato, M. Gradient episodic memory for continual learning. Advances in neural information processing systems, 30, 2017.
347
+ Loshchilov, I. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
348
+ Ma, J., He, Y., Li, F., Han, L., You, C., and Wang, B. Segment anything in medical images. Nature Communications, 15(1):654, 2024.
349
+ Mallya, A. and Lazebnik, S. Packet: Adding multiple tasks to a single network by iterative pruning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 7765-7773, 2018.
350
+ Ngoc Lan, P., An, N. S., Hang, D. V., Long, D. V., Trung, T. Q., Thuy, N. T., and Sang, D. V. Neounet: Towards accurate colon polyp segmentation and neoplasm detection. In Advances in visual computing: 16th international symposium, ISVC 2021, virtual event, October 4-6, 2021, proceedings, part II, pp. 15-28. Springer, 2021.
351
+ Qin, Z., Yi, H., Lao, Q., and Li, K. Medical image understanding with pretrained vision language models: A comprehensive study. In The Eleventh International Conference on Learning Representations.
352
+ Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748-8763. PMLR, 2021.
353
+ Ravi, N., Gabeur, V., Hu, Y.-T., Hu, R., Ryali, C., Ma, T., Khedr, H., Radle, R., Rolland, C., Gustafson, L., et al. Sam 2: Segment anything in images and videos. arXiv preprint arXiv:2408.00714, 2024.
354
+ Rebuffi, S.-A., Kolesnikov, A., Sperl, G., and Lampert, C. H. icarl: Incremental classifier and representation learning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 2001-2010, 2017.
355
+ Ren, S. Faster r-cnn: Towards real-time object detection with region proposal networks. arXiv preprint arXiv:1506.01497, 2015.
356
+ Rolnick, D., Ahuja, A., Schwarz, J., Lillicrap, T., and Wayne, G. Experience replay for continual learning. Advances in neural information processing systems, 32, 2019.
357
+
358
+ Setio, A. A. A., Traverso, A., De Bel, T., Berens, M. S., Van Den Bogaard, C., Cerello, P., Chen, H., Dou, Q., Fantacci, M. E., Geurts, B., et al. Validation, comparison, and combination of algorithms for automatic detection of pulmonary nodules in computed tomography images: the luna16 challenge. Medical image analysis, 42:1-13, 2017.
359
+ Shao, S., Li, Z., Zhang, T., Peng, C., Yu, G., Zhang, X., Li, J., and Sun, J. Objects365: A large-scale, high-quality dataset for object detection. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 8430-8439, 2019.
360
+ Shin, H., Lee, J. K., Kim, J., and Kim, J. Continual learning with deep generative replay. Advances in neural information processing systems, 30, 2017.
361
+ Shmelkov, K., Schmid, C., and Alahari, K. Incremental learning of object detectors without catastrophic forgetting. In Proceedings of the IEEE international conference on computer vision, pp. 3400-3409, 2017.
362
+ Smith, J. S., Karlinsky, L., Gutta, V., Cascante-Bonilla, P., Kim, D., Arbelle, A., Panda, R., Feris, R., and Kira, Z. Coda-prompt: Continual decomposed attention-based prompting for rehearsal-free continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11909-11919, 2023.
363
+ Tang, L., Tian, Z., Li, K., He, C., Zhou, H., Zhao, H., Li, X., and Jia, J. Mind the interference: Retaining pre-trained knowledge in parameter efficient continual learning of vision-language models. In European Conference on Computer Vision, pp. 346-365. Springer, 2025.
364
+ Vu, Q. D., Graham, S., Kurc, T., To, M. N. N., Shaban, M., Qaiser, T., Koohbanani, N. A., Khurram, S. A., Kalpathy-Cramer, J., Zhao, T., et al. Methods for segmentation and classification of digital microscopy tissue images. Frontiers in bioengineering and biotechnology, pp. 53, 2019.
365
+ Wang, Y., Huang, Z., and Hong, X. S-prompts learning with pre-trained transformers: An occam's razor for domain incremental learning. Advances in Neural Information Processing Systems, 35:5682-5695, 2022a.
366
+ Wang, Z., Zhang, Z., Ebrahimi, S., Sun, R., Zhang, H., Lee, C.-Y., Ren, X., Su, G., Perot, V., Dy, J., et al. Dualprompt: Complementary prompting for rehearsal-free continual learning. In European Conference on Computer Vision, pp. 631-648. Springer, 2022b.
367
+ Wang, Z., Zhang, Z., Lee, C.-Y., Zhang, H., Sun, R., Ren, X., Su, G., Perot, V., Dy, J., and Pfister, T. Learning to prompt for continual learning. In Proceedings of the
368
+
369
+ IEEE/CVF conference on computer vision and pattern recognition, pp. 139-149, 2022c.
370
+ Wortsman, M., Ilharco, G., Kim, J. W., Li, M., Kornblith, S., Roelofs, R., Lopes, R. G., Hajishirzi, H., Farhadi, A., Namkoong, H., et al. Robust fine-tuning of zero-shot models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 7959-7971, 2022.
371
+ Wu, S., Zhang, W., Jin, S., Liu, W., and Loy, C. C. Aligning bag of regions for open-vocabulary object detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 15254-15264, 2023.
372
+ Xu, Y., Zhang, M., Fu, C., Chen, P., Yang, X., Li, K., and Xu, C. Multi-modal queried object detection in the wild. Advances in Neural Information Processing Systems, 36, 2024.
373
+ Ye, Y., Xie, Y., Zhang, J., Chen, Z., Wu, Q., and Xia, Y. Continual self-supervised learning: Towards universal multi-modal medical data representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11114-11124, 2024.
374
+ Yi, H., Qin, Z., Lao, Q., Xu, W., Jiang, Z., Wang, D., Zhang, S., and Li, K. Towards general purpose medical ai: Continual learning medical foundation model. arXiv preprint arXiv:2303.06580, 2023.
375
+ Yoon, J., Yang, E., Lee, J., and Hwang, S. J. Lifelong learning with dynamically expandable networks. arXiv preprint arXiv:1708.01547, 2017.
376
+ Zhu, J., Hamdi, A., Qi, Y., Jin, Y., and Wu, J. Medical sam 2: Segment medical images as video via segment anything model 2. arXiv preprint arXiv:2408.00874, 2024.
377
+
378
+ # A. Theoretical Analysis
379
+
380
+ This section presents a theoretical analysis demonstrating the superior efficiency of DPA over traditional prompt learning.
381
+
382
+ # A.1. Overall Analysis
383
+
384
+ $$
385
+ \begin{array}{l} f _ {1} = \operatorname {C o n c a t} [ (1 - \lambda (p _ {t})) \operatorname {A t t n} _ {v \rightarrow t} (f _ {v}, p _ {t}) + \lambda (p _ {t}) \operatorname {A t t n} _ {v \rightarrow t} (p _ {v}, p _ {t}); \\ (1 - \lambda (f _ {t})) \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right) + \lambda (f _ {t}) \operatorname {A t t n} _ {v \rightarrow t} \left(p _ {v}, f _ {t}\right), \tag {14} \\ = \operatorname {C o n c a t} [ A, B ] \\ \end{array}
386
+ $$
387
+
388
+ where $p_{v,t} \in \mathbb{R}^{l \times d}$ represent the vision and text prompts, and $f_v, f_t$ are the visual and textual features before being fed into $\mathrm{Attn}_{v \to t}$ .
389
+
390
+ $$
391
+ f _ {2} = \left(1 - \lambda \left(f _ {t}\right)\right) \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right) + \lambda \left(f _ {t}\right) \operatorname {A t t n} _ {v \rightarrow t} \left(p _ {v}, f _ {t}\right) = B, \tag {15}
392
+ $$
393
+
394
+ If $\mathrm{Attn}_{v\to t}(\cdot ,\cdot)\in \mathbb{R}^{L\times d}$ , then the two terms $A(p_{t})$ and $A(f_{t})$ each belong to $\mathbb{R}^{L\times d}$ and $f_{1}\in \mathbb{R}^{L\times 2d}$ . In contrast, $f_{2}\in \mathbb{R}^{L\times d}$ .
395
+
396
+ $$
397
+ f _ {2} = \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v}, f _ {t}\right) + \lambda \left(f _ {t}\right) \Delta , \tag {16}
398
+ $$
399
+
400
+ where we have defined $\Delta = \mathrm{Attn}_{v\to t}(p_v,f_t) - \mathrm{Attn}_{v\to t}(f_v,f_t)$ .
401
+
402
+ $$
403
+ \frac {\partial f _ {2}}{\partial \theta} = \frac {\partial \operatorname {A t t n} _ {v \rightarrow t} \left(f _ {v} , f _ {t}\right)}{\partial \theta} + \lambda \left(f _ {t}\right) \frac {\partial \Delta}{\partial \theta}. \tag {17}
404
+ $$
405
+
406
+ This indicates that $f_{2}$ has a lower-dimensional structure, residual components, and a more direct gradient flow.
407
+
408
+ # A.2. Computation Cost
409
+
410
+ Lemma A.1. $f_{2}$ is computational light than $f_{1}$
411
+
412
+ Proof. The overall $f_1$ is $f_1 = \operatorname{Concat}[A; B]$ . However, $f_2$ uses only the $B$ branch, $f_2 = B$ . The computation cost of branch $A$ is roughly $\mathcal{O}_A = \mathcal{O}(f_v, p_t) + \mathcal{O}(p_v, p_t) = \mathcal{O}(A + B)$ for $B \mathcal{O}_{f_2} = \mathcal{O}(B)$ . $\mathcal{O}_{f_1} > \mathcal{O}_{f_2}$ .
413
+
414
+ # A.3. convergence benefit analysis
415
+
416
+ Lemma A.2. Let $f_{1}$ and $f_{2}$ be our models. Assume both models have converged to any local minima and there be an optimal representation $f^{*} = B$ . Suppose further output of $f_{1}$ is locally linear around the optimum, then $f_{2}$ achieves the same performance as $f_{1}$ at the local convergence.
417
+
418
+ Proof. The loss function $\mathcal{L}(f_{\mathrm{out}})$ , For $f$ , the output $y_{1} = h(\mathrm{Concat}[A;B])$ , and $y_{2} = h(B)$ . At convergence: $\nabla \mathcal{L}(f_1) = 0$ and $\nabla \mathcal{L}(f_2) = 0$ . There exists an optimal representation $f^{*}$ such that it is sufficient to have $f^{*} = B$ .
419
+
420
+ Assume $h$ is locally linear at the optima, then there exists a matrix $M$ such that
421
+
422
+ $$
423
+ h \left(\operatorname {C o n c a t} [ A; B ]\right) = M \binom {A} {B} = M _ {1} A + M _ {2} B. \tag {18}
424
+ $$
425
+
426
+ Under convergence, $M_1A = 0$ , thus
427
+
428
+ $$
429
+ h \left(\operatorname {C o n c a t} [ A; B ]\right) = M _ {2} B = h ^ {\prime} (B). \tag {19}
430
+ $$
431
+
432
+ $$
433
+ y _ {1} = h \left(\operatorname {C o n c a t} [ A; B ]\right) = h ^ {\prime} (B) = y _ {2}. \tag {20}
434
+ $$
435
+
436
+ Thus $f_{2}$ performs as well as $f_{1}$ after convergence to local minima.
437
+
438
+ # B. More Implementation Details
439
+
440
+ Benchmark. We collected 13 public datasets from the internet: DFUC-2020 (DFUC) (Cassidy et al., 2021), Kvasir (Jha et al., 2020), OpticNerv (OpticN) $^{1}$ , BCCD $^{2}$ , CPM-17 (Vu et al., 2019), Breast Cancer (BreastC) $^{3}$ , TBX11K (Liu et al., 2020), Kidney Tumor (KidneyT) $^{4}$ , Luna16 (Setio et al., 2017), ADNI (Boccardi et al., 2015), Meningioma (Meneng) $^{5}$ , Breast Tumor (BreastT) $^{6}$ , and TN3K (Gong et al., 2021). Among them, OpticN, BCCD, BreastC, KidneyT, Meneng, and BreastT are from the Roboflow $^{7}$ website. These datasets include eight different modalities: Photography, Endoscopy, Light Microscopy, Histopathology, X-ray, CT, MRI, and Ultrasound, covering nine different organs: Foot, Colorectal, Nerve, Blood/Cell, Lung, Brain, Breast, Kidney, and Thyroid. The random seed used for few-shot data generation is kept consistent with the one used during training. $k$ -shot means ensuring that each class in the current dataset contains at least $k$ instances. Three different orders were used during training. The dataset order and corresponding random seed are shown in the Tab. 9.
441
+
442
+ Table 9: Task order under different random seeds. The table shows the dataset sequences used during training for three different random seeds (0, 5, and 10).
443
+
444
+ <table><tr><td>Order</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td></tr><tr><td>Seed 0</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Luna16</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3K</td></tr><tr><td>Seed 5</td><td>OpticN</td><td>BCCD</td><td>BreastT</td><td>Meneng</td><td>TN3K</td><td>Kvasir</td><td>TBX11K</td><td>KidneyT</td><td>DFUC</td><td>Luna16</td><td>BreastC</td><td>CPM-17</td><td>ADNI</td></tr><tr><td>Seed 10</td><td>CPM-17</td><td>BreastC</td><td>Luna16</td><td>Kvasir</td><td>OpticN</td><td>Meneng</td><td>TN3K</td><td>BCCD</td><td>BreastT</td><td>KidneyT</td><td>TBX11K</td><td>DFUC</td><td>ADNI</td></tr></table>
445
+
446
+ Implementation. The proposed method is implemented in Python using the PyTorch library and runs on a PC. The code is based on the official GLIP (Li et al., 2022) implementation $^{8}$ , and its environment requirements remain unchanged. For full-data training, we use four NVIDIA 3090 GPUs with a batch size of 4, while for few-shot training, we use a single NVIDIA 3090 GPU with a batch size of 1. Unless otherwise specified, all experiments are trained for 5 epochs, with the learning rate reduced by a factor of 0.1 after 3 epochs. For all prompt-based CL methods (Wang et al., 2022c; b; Smith et al., 2023; Wang et al., 2022a; Tang et al., 2025; Le et al., 2024), the initial learning rate is set to 1e-2, whereas ZiRa (Deng et al., 2024) uses an initial learning rate of 1e-3. Standard fine-tuning (FT), joint training, sequential training, WiSE-FT (Wortsman et al., 2022), and experience replay (ER) (Rolnick et al., 2019) use an initial learning rate of 1e-4. The learning rates are determined via grid search within the range of [1e-5, 0.1]. To ensure reproducibility, all experiments are conducted with three different random seeds (0, 5, 10), and the dataset order is adjusted accordingly. The final results are reported as the average over three runs.
447
+
448
+ Reproduction. We reproduce other prompt-based methods on GLIP by prompting all layers of both the vision and text encoders, whereas the original papers typically use only the embedding layer or a few initial layers (e.g., the first five layers). This discrepancy may lead to suboptimal performance on the IMOD task. The vision backbone is used as the query function, and the mean feature representation from its last layer is utilized to identify the task ID. For L2P (Wang et al., 2022c), we set the prompt length to 5. During inference, the top-5 prompts are selected from the prompt pool, following the official implementation. In the original L2P paper, updated prompts are selected via a key-matching mechanism during training, with diversity maintained using a frequency-based weighting technique. However, in the official code repository, specific prompts are masked for different tasks. We follow the implementation provided in the official code. For DualPrompt (Wang et al., 2022b), we set the prompt length to 10 for both key and value prompts. Two layers are designated as G(eneral)-Prompt, while the remaining 10 layers serve as E(xpert)-Prompt. For CODA (Smith et al., 2023), we set the prompt length to 8 and
449
+
450
+ ```txt
451
+ 1https://universe.roboflow.com/neurosurgery/optic-nerv
452
+ 2https://public.roboflow.com/object-detection/bccd
453
+ 3https://universe.roboflow.com/tez-m06pk/breast-cancer-tbwa9
454
+ 4https://universe.roboflow.com/east-delta-university-rpdgs/kidney_tumor-tke8k
455
+ 5https://universe.roboflow.com/mem-g72lg/manengioma
456
+ 6https://universe.roboflow.com/qidiliu/breast-tumor-detection-nsikz
457
+ 7https://roboflow.com/
458
+ 8https://github.com/microsoft/GLIP
459
+ ```
460
+
461
+ additionally add an extra key to learn the task identity, following the official implementation. For S-Prompt (Wang et al., 2022a), DIKI (Tang et al., 2025), and NoRGa (Le et al., 2024), we set the prompt length to 10. S-Prompt employs K-Means to generate 5 prototypes for task identification. All reproductions adhere to the implementation in the official code.
462
+
463
+ # C. Additional Results
464
+
465
+ Tab. 10 compares the impact of weight transfer between tasks when training for 3 epochs. The results show that enabling weight transfer improves continual learning performance under limited training time. Tab. 11 presents a detailed comparison of iDPA with different knowledge injection positions. The best performance is observed when knowledge is injected simultaneously into the vision, text, and fusion encoders. However, this setting leads to a higher forgetting rate compared to injecting knowledge only in the fusion encoder. Fig. 6 visualizes the performance dynamics across different knowledge injection positions. Tab. 12, Tab. 13, and Tab. 14 report the performance of iDPA compared with other continual learning methods under 1-shot, 10-shot, and 50-shot settings, respectively. Tab. 15 shows that iDPA achieves the lowest parameter count (3.34M), reduced FLOPs, and significantly lower memory consumption and training time compared to all baselines. While maintaining competitive inference speed (5.93 FPS), it offers the best overall efficiency among the evaluated continual learning methods. Tab. 16 demonstrates that iDPA consistently improves performance across 13 datasets under 1-shot, 5-shot, and 10-shot settings, with low variance indicating strong stability and generalization. Fig. 7 provides qualitative comparisons between iDPA, Ground Truth, Zero-shot, and L2P (Wang et al., 2022c), the pioneering prompt-based continual learning method. iDPA shows superior localization accuracy, more precise classification, and higher confidence scores.
466
+
467
+ Table 10: Performance of using weight transfer over 3 epochs. FAP (%): Final Average AP. CAP (%): Cumulative Average AP.
468
+
469
+ <table><tr><td>Transfer</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Luna16</td><td>ADNI</td><td>Mengeng</td><td>BreastT</td><td>TN3k</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>W/O</td><td>46.86</td><td>73.69</td><td>63.61</td><td>60.25</td><td>29.88</td><td>50.68</td><td>30.59</td><td>57.88</td><td>30.58</td><td>42.80</td><td>50.84</td><td>19.23</td><td>51.28</td><td>46.78</td><td>51.87</td><td>3.98</td></tr><tr><td>W</td><td>46.34</td><td>71.05</td><td>66.86</td><td>60.33</td><td>30.65</td><td>49.16</td><td>29.39</td><td>63.78</td><td>28.16</td><td>39.99</td><td>56.97</td><td>27.10</td><td>52.36</td><td>47.86</td><td>52.06</td><td>2.47</td></tr></table>
470
+
471
+ Table 11: Comparison of performance with different knowledge injection positions. FAP (%): Final Average AP. CAP (%): Cumulative Average AP. FFP (%): Final Forgetting Percentage of old tasks.
472
+
473
+ <table><tr><td>Φv</td><td>Φt</td><td>Φf</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Lumal6</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3k</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>✓</td><td>✗</td><td>✗</td><td>42.28</td><td>72.53</td><td>66.30</td><td>58.94</td><td>27.08</td><td>49.73</td><td>30.25</td><td>62.38</td><td>27.51</td><td>38.23</td><td>56.00</td><td>32.98</td><td>52.46</td><td>47.44</td><td>51.78</td><td>2.91</td></tr><tr><td>✗</td><td>✓</td><td>✗</td><td>40.92</td><td>70.24</td><td>29.61</td><td>47.24</td><td>26.08</td><td>42.09</td><td>20.45</td><td>55.47</td><td>23.58</td><td>22.92</td><td>56.93</td><td>26.13</td><td>38.10</td><td>38.44</td><td>44.89</td><td>7.53</td></tr><tr><td>✓</td><td>✓</td><td>✗</td><td>46.57</td><td>73.05</td><td>59.51</td><td>59.82</td><td>34.62</td><td>47.35</td><td>32.15</td><td>62.24</td><td>29.69</td><td>41.98</td><td>58.83</td><td>29.51</td><td>54.01</td><td>48.41</td><td>53.56</td><td>4.38</td></tr><tr><td>✗</td><td>✗</td><td>✓</td><td>47.09</td><td>73.76</td><td>66.85</td><td>60.29</td><td>36.54</td><td>50.98</td><td>32.69</td><td>64.98</td><td>31.15</td><td>44.42</td><td>57.20</td><td>34.65</td><td>53.03</td><td>50.28</td><td>54.10</td><td>2.48</td></tr><tr><td>✓</td><td>✓</td><td>✓</td><td>49.40</td><td>76.04</td><td>66.40</td><td>60.91</td><td>33.15</td><td>53.12</td><td>36.43</td><td>65.73</td><td>32.19</td><td>45.94</td><td>58.15</td><td>35.67</td><td>57.19</td><td>51.56</td><td>56.25</td><td>3.17</td></tr></table>
474
+
475
+ ![](images/b48698ab3da1b23049f7d255b5e6056dfae6459d228edf474db61093313c86ec.jpg)
476
+ Figure 6: Performance variation of iDPA in different location.
477
+
478
+ Table 12: Performance of various continual learning methods on the ODinM-13 benchmark under the 1-shot setting. FAP (%): Final Average AP. CAP (%): Cumulative Average AP. FFP (%): Final Forgetting Percentage of old tasks.
479
+
480
+ <table><tr><td>Methods</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Lumal6</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3k</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>Joint (Upper)</td><td>7.99</td><td>51.35</td><td>24.88</td><td>33.54</td><td>36.28</td><td>9.18</td><td>1.94</td><td>22.43</td><td>4.20</td><td>1.54</td><td>46.18</td><td>12.35</td><td>8.48</td><td>20.03</td><td>-</td><td>-</td></tr><tr><td colspan="17">Non-Prompt-based CL</td></tr><tr><td>Sequential</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>8.70</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.06</td><td>0.00</td><td>1.87</td><td>0.00</td><td>5.54</td><td>1.24</td><td>11.49</td><td>23.43</td></tr><tr><td>WiSE-FT</td><td>4.63</td><td>26.75</td><td>0.32</td><td>9.04</td><td>9.75</td><td>0.32</td><td>0.08</td><td>6.33</td><td>0.03</td><td>0.00</td><td>11.37</td><td>7.89</td><td>3.52</td><td>6.16</td><td>14.62</td><td>9.25</td></tr><tr><td>ZiRa</td><td>6.17</td><td>26.87</td><td>2.40</td><td>3.62</td><td>12.34</td><td>7.66</td><td>0.56</td><td>4.57</td><td>0.00</td><td>0.01</td><td>19.42</td><td>4.85</td><td>2.23</td><td>6.98</td><td>13.59</td><td>11.68</td></tr><tr><td colspan="17">Prompt-based CL</td></tr><tr><td>L2P</td><td>1.56</td><td>2.16</td><td>0.00</td><td>10.46</td><td>12.45</td><td>1.14</td><td>0.21</td><td>3.69</td><td>0.25</td><td>0.00</td><td>7.91</td><td>0.43</td><td>1.99</td><td>3.25</td><td>7.18</td><td>3.14</td></tr><tr><td>DualPrompt</td><td>6.20</td><td>32.05</td><td>1.01</td><td>9.64</td><td>11.00</td><td>0.48</td><td>0.00</td><td>3.61</td><td>0.23</td><td>0.10</td><td>19.63</td><td>6.20</td><td>5.49</td><td>7.36</td><td>13.30</td><td>7.93</td></tr><tr><td>S-Prompt</td><td>2.24</td><td>7.94</td><td>3.55</td><td>6.68</td><td>8.72</td><td>2.35</td><td>0.42</td><td>3.25</td><td>0.02</td><td>0.00</td><td>5.69</td><td>1.00</td><td>1.53</td><td>3.34</td><td>8.90</td><td>5.66</td></tr><tr><td>CODA</td><td>0.76</td><td>2.69</td><td>7.19</td><td>24.02</td><td>20.42</td><td>0.34</td><td>0.92</td><td>0.69</td><td>1.03</td><td>0.13</td><td>14.95</td><td>5.73</td><td>10.68</td><td>6.89</td><td>13.96</td><td>4.57</td></tr><tr><td>DIKI</td><td>0.54</td><td>11.07</td><td>3.44</td><td>16.95</td><td>16.22</td><td>2.41</td><td>0.62</td><td>8.71</td><td>0.01</td><td>0.01</td><td>6.89</td><td>3.54</td><td>3.30</td><td>5.67</td><td>13.09</td><td>3.88</td></tr><tr><td>NoRGa</td><td>1.00</td><td>5.73</td><td>13.86</td><td>17.62</td><td>11.24</td><td>0.64</td><td>0.56</td><td>7.31</td><td>0.09</td><td>0.01</td><td>8.50</td><td>8.13</td><td>3.57</td><td>6.02</td><td>11.09</td><td>5.17</td></tr><tr><td>iDPA(Ours)</td><td>6.66</td><td>43.04</td><td>14.62</td><td>20.55</td><td>31.13</td><td>5.33</td><td>2.15</td><td>7.38</td><td>0.30</td><td>0.39</td><td>17.34</td><td>6.17</td><td>3.45</td><td>12.19</td><td>18.03</td><td>3.58</td></tr></table>
481
+
482
+ Table 13: Performance of various continual learning methods on the ODinM-13 benchmark under the 10-shot setting. FAP (%): Final Average AP. CAP (%): Cumulative Average AP. FFP (%): Final Forgetting Percentage of old tasks.
483
+
484
+ <table><tr><td>Methods</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Luna16</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3k</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>Joint (Upper)</td><td>32.60</td><td>60.99</td><td>56.07</td><td>56.14</td><td>41.01</td><td>33.29</td><td>10.49</td><td>44.17</td><td>13.38</td><td>10.55</td><td>67.57</td><td>20.77</td><td>29.76</td><td>36.68</td><td>-</td><td>-</td></tr><tr><td colspan="17">Non-Prompt-based CL</td></tr><tr><td>Sequential</td><td>3.84</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.36</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>8.19</td><td>0.00</td><td>1.92</td><td>7.33</td><td>1.66</td><td>13.67</td><td>36.51</td></tr><tr><td>WiSE-FT</td><td>7.13</td><td>41.13</td><td>1.45</td><td>12.68</td><td>16.91</td><td>1.91</td><td>0.13</td><td>8.98</td><td>0.06</td><td>0.04</td><td>16.31</td><td>10.68</td><td>5.69</td><td>9.47</td><td>21.03</td><td>12.98</td></tr><tr><td>ZiRa</td><td>6.07</td><td>30.71</td><td>1.32</td><td>11.14</td><td>16.38</td><td>9.18</td><td>0.53</td><td>7.00</td><td>0.44</td><td>0.57</td><td>40.70</td><td>8.74</td><td>8.96</td><td>10.90</td><td>16.19</td><td>15.12</td></tr><tr><td colspan="17">Prompt-based CL</td></tr><tr><td>L2P</td><td>2.92</td><td>16.65</td><td>2.46</td><td>17.90</td><td>11.04</td><td>4.08</td><td>0.09</td><td>4.34</td><td>0.02</td><td>0.02</td><td>3.86</td><td>1.03</td><td>2.72</td><td>5.16</td><td>9.63</td><td>4.48</td></tr><tr><td>DualPrompt</td><td>1.95</td><td>6.19</td><td>0.06</td><td>14.48</td><td>7.17</td><td>0.91</td><td>0.06</td><td>0.76</td><td>0.06</td><td>0.06</td><td>36.14</td><td>6.63</td><td>2.91</td><td>5.95</td><td>13.99</td><td>11.34</td></tr><tr><td>S-Prompt</td><td>8.20</td><td>16.33</td><td>9.13</td><td>9.12</td><td>10.23</td><td>5.53</td><td>0.43</td><td>8.01</td><td>0.25</td><td>0.13</td><td>37.67</td><td>1.13</td><td>2.95</td><td>8.39</td><td>12.98</td><td>4.36</td></tr><tr><td>CODA</td><td>5.23</td><td>0.23</td><td>1.33</td><td>25.57</td><td>3.34</td><td>0.28</td><td>0.22</td><td>2.10</td><td>0.01</td><td>0.01</td><td>7.78</td><td>4.49</td><td>6.78</td><td>4.41</td><td>14.20</td><td>12.60</td></tr><tr><td>DIKI</td><td>0.97</td><td>19.66</td><td>0.25</td><td>27.92</td><td>5.83</td><td>1.27</td><td>1.51</td><td>9.31</td><td>0.08</td><td>0.01</td><td>6.11</td><td>7.20</td><td>3.86</td><td>6.46</td><td>15.34</td><td>9.78</td></tr><tr><td>NoRGa</td><td>2.60</td><td>11.19</td><td>2.96</td><td>24.84</td><td>3.01</td><td>1.42</td><td>0.18</td><td>0.69</td><td>0.01</td><td>0.01</td><td>14.49</td><td>6.51</td><td>1.80</td><td>5.36</td><td>11.90</td><td>8.14</td></tr><tr><td>iDPA(Ours)</td><td>21.37</td><td>50.20</td><td>29.20</td><td>39.11</td><td>38.33</td><td>19.65</td><td>6.03</td><td>27.06</td><td>6.23</td><td>3.15</td><td>39.42</td><td>15.34</td><td>14.02</td><td>23.78</td><td>29.68</td><td>4.75</td></tr></table>
485
+
486
+ Table 14: Performance of various continual learning methods on the ODinM-13 benchmark under the 50-shot setting. FAP (%): Final Average AP. CAP (%): Cumulative Average AP. FFP (%): Final Forgetting Percentage of old tasks.
487
+
488
+ <table><tr><td>Methods</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Luna16</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3k</td><td>FAP↑</td><td>CAP↑</td><td>FFP↓</td></tr><tr><td>Joint (Upper)</td><td>39.56</td><td>66.52</td><td>64.41</td><td>59.26</td><td>41.78</td><td>43.82</td><td>26.48</td><td>52.90</td><td>22.61</td><td>66.40</td><td>72.93</td><td>25.61</td><td>47.92</td><td>48.48</td><td>-</td><td>-</td></tr><tr><td colspan="17">Non-Prompt-based CL</td></tr><tr><td>Sequential</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>5.51</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>22.19</td><td>0.00</td><td>0.00</td><td>16.20</td><td>3.38</td><td>14.95</td><td>46.86</td></tr><tr><td>WiSE-FT</td><td>8.18</td><td>43.77</td><td>1.29</td><td>13.05</td><td>14.99</td><td>2.93</td><td>0.11</td><td>10.59</td><td>0.08</td><td>0.05</td><td>21.55</td><td>10.08</td><td>6.44</td><td>10.24</td><td>23.34</td><td>16.03</td></tr><tr><td>ZiRa</td><td>2.07</td><td>5.58</td><td>0.39</td><td>5.45</td><td>4.89</td><td>3.56</td><td>0.23</td><td>0.78</td><td>0.45</td><td>3.03</td><td>4.85</td><td>5.51</td><td>8.58</td><td>3.49</td><td>15.78</td><td>37.28</td></tr><tr><td colspan="17">Prompt-based CL</td></tr><tr><td>L2P</td><td>29.13</td><td>54.05</td><td>34.74</td><td>38.00</td><td>35.61</td><td>38.23</td><td>6.41</td><td>34.59</td><td>13.33</td><td>2.74</td><td>46.20</td><td>10.18</td><td>19.67</td><td>27.91</td><td>35.20</td><td>5.66</td></tr><tr><td>DualPrompt</td><td>24.84</td><td>27.49</td><td>25.44</td><td>47.18</td><td>27.36</td><td>29.17</td><td>3.33</td><td>21.87</td><td>13.09</td><td>6.57</td><td>16.32</td><td>9.28</td><td>13.82</td><td>20.44</td><td>34.94</td><td>16.91</td></tr><tr><td>S-Prompt</td><td>23.79</td><td>39.45</td><td>33.67</td><td>16.90</td><td>8.74</td><td>29.77</td><td>6.00</td><td>28.24</td><td>8.38</td><td>4.78</td><td>61.73</td><td>13.08</td><td>21.40</td><td>22.76</td><td>30.86</td><td>7.92</td></tr><tr><td>CODA</td><td>27.42</td><td>65.27</td><td>31.74</td><td>40.66</td><td>25.85</td><td>36.81</td><td>17.28</td><td>43.72</td><td>16.37</td><td>6.93</td><td>54.25</td><td>20.55</td><td>25.91</td><td>31.75</td><td>40.86</td><td>4.37</td></tr><tr><td>DIKI</td><td>34.26</td><td>68.82</td><td>34.05</td><td>53.26</td><td>33.02</td><td>38.06</td><td>13.93</td><td>50.27</td><td>20.74</td><td>5.42</td><td>48.16</td><td>8.17</td><td>34.70</td><td>34.06</td><td>42.27</td><td>5.85</td></tr><tr><td>NoRGa</td><td>30.69</td><td>58.17</td><td>39.23</td><td>53.81</td><td>28.12</td><td>38.82</td><td>15.31</td><td>46.16</td><td>15.21</td><td>6.76</td><td>44.04</td><td>18.96</td><td>21.87</td><td>32.09</td><td>39.12</td><td>5.70</td></tr><tr><td>iDPA(Ours)</td><td>34.79</td><td>59.03</td><td>52.64</td><td>58.12</td><td>39.33</td><td>37.35</td><td>14.78</td><td>52.77</td><td>22.70</td><td>24.55</td><td>56.32</td><td>10.99</td><td>39.10</td><td>38.65</td><td>45.03</td><td>3.93</td></tr></table>
489
+
490
+ Table 15: Efficiency comparison of different continual learning methods. Metrics include the number of parameters, floating point operations (FLOPs), memory consumption, total training time, and inference speed. Our method achieves the best trade-off with the lowest parameter count and competitive inference performance.
491
+
492
+ <table><tr><td>Methods</td><td>#Params↓</td><td>#FLOPs↓</td><td>#Memory↓</td><td>#Time↓</td><td>Inference Speed↑</td></tr><tr><td>Joint (Upper)</td><td>231.76M</td><td>488.03 GMac</td><td>13129M</td><td>9h55min</td><td>6.18 FPS</td></tr><tr><td>Sequential</td><td>231.76M</td><td>488.03 GMac</td><td>13129M</td><td>9h55min</td><td>6.18 FPS</td></tr><tr><td>WiSE-FT</td><td>231.76M</td><td>488.03 GMac</td><td>13129M</td><td>9h55min</td><td>6.18 FPS</td></tr><tr><td>ER</td><td>231.76M</td><td>488.03 GMac</td><td>13129M</td><td>11h15min</td><td>6.18 FPS</td></tr><tr><td>ZiRa</td><td>10.23M</td><td>490.15 GMac</td><td>8377M</td><td>6h25min</td><td>6.11 FPS</td></tr><tr><td>L2P</td><td>6.97M</td><td>601.50 GMac</td><td>10288M</td><td>7h50min</td><td>5.08 FPS</td></tr><tr><td>DualPrompt</td><td>4.83M</td><td>583.82 GMac</td><td>9417M</td><td>7h36min</td><td>5.25 FPS</td></tr><tr><td>S-Prompt</td><td>2.73M</td><td>590.89 GMac</td><td>5366M</td><td>8h24min</td><td>5.13 FPS</td></tr><tr><td>CODA-Prompt</td><td>10.97M</td><td>583.82 GMac</td><td>9803M</td><td>9h03min</td><td>5.26 FPS</td></tr><tr><td>DIKI</td><td>8.76M</td><td>583.82 GMac</td><td>9754M</td><td>7h49min</td><td>5.16 FPS</td></tr><tr><td>NoRGa</td><td>8.76M</td><td>583.82 GMac</td><td>9963M</td><td>8h07min</td><td>5.17 FPS</td></tr><tr><td>iDPA(Ours)</td><td>3.34M</td><td>506.00/501.00 GMac</td><td>6590M</td><td>5h46min</td><td>5.93 FPS</td></tr></table>
493
+
494
+ Table 16: Mean performance across 13 datasets under 1-shot, 5-shot, and 10-shot settings. $\sigma$ denotes the average improvement of our iDPA method over the baseline. Variance results are included to illustrate the stability across multiple runs.
495
+
496
+ <table><tr><td>Methods</td><td>DFUC</td><td>Kvasir</td><td>OpticN</td><td>BCCD</td><td>CPM-17</td><td>BreastC</td><td>TBX11K</td><td>KidneyT</td><td>Lum6</td><td>ADNI</td><td>Meneng</td><td>BreastT</td><td>TN3k</td></tr><tr><td>1</td><td>6.66</td><td>43.04</td><td>14.62</td><td>20.55</td><td>31.13</td><td>5.33</td><td>2.15</td><td>7.38</td><td>0.30</td><td>0.39</td><td>17.34</td><td>6.17</td><td>3.45</td></tr><tr><td>σ</td><td>2.55</td><td>0.95</td><td>4.89</td><td>3.86</td><td>1.71</td><td>0.93</td><td>0.00</td><td>1.55</td><td>0.14</td><td>0.03</td><td>2.18</td><td>2.46</td><td>1.31</td></tr><tr><td>5</td><td>21.37</td><td>50.20</td><td>29.20</td><td>39.11</td><td>38.33</td><td>19.65</td><td>6.03</td><td>27.06</td><td>6.23</td><td>3.15</td><td>39.42</td><td>15.34</td><td>14.02</td></tr><tr><td>σ</td><td>1.62</td><td>0.86</td><td>3.70</td><td>3.24</td><td>2.63</td><td>1.24</td><td>0.01</td><td>0.02</td><td>1.68</td><td>1.26</td><td>1.34</td><td>1.58</td><td>3.80</td></tr><tr><td>10</td><td>34.79</td><td>59.03</td><td>52.64</td><td>58.12</td><td>39.33</td><td>37.35</td><td>14.78</td><td>52.77</td><td>22.70</td><td>24.55</td><td>56.32</td><td>10.99</td><td>39.10</td></tr><tr><td>σ</td><td>2.92</td><td>1.89</td><td>3.75</td><td>4.16</td><td>3.76</td><td>2.34</td><td>0.00</td><td>0.25</td><td>0.40</td><td>0.05</td><td>2.47</td><td>0.51</td><td>4.07</td></tr></table>
497
+
498
+ ![](images/d575ac10c08b47552e4f5e781c2894bda4f6a4372fd78492161dad4be0bc7d27.jpg)
499
+ Figure 7: Visualization results of iDPA compared with L2P and Zero-shot at the end of training with random seed 0 on ODinM-13.
idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e8c9c5290bc59778ef7ac8ccd20aca2857dd7ca0e26d318fa6de6e5d5dd82e0
3
+ size 1683960
idpainstancedecoupledpromptattentionforincrementalmedicalobjectdetection/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a66b1f03d016040b164e16440a84e995871d8acb8f67f2c427da8bef42025497
3
+ size 677145
in2vbringingtransductivenodeembeddingstoinductivegraphs/ec3b92d6-d965-474b-8dbc-c6cd2382d329_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0fd2f54e017c09dc53697dcf2b0d0371da92ebd7419bb1987d3ad6321db28f6
3
+ size 212881
in2vbringingtransductivenodeembeddingstoinductivegraphs/ec3b92d6-d965-474b-8dbc-c6cd2382d329_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3432a187fd4bc12f29371371140c128c5c0aba75fee1e4d77ed9566dfa2b4ebf
3
+ size 236783
in2vbringingtransductivenodeembeddingstoinductivegraphs/ec3b92d6-d965-474b-8dbc-c6cd2382d329_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71fb6a800e326acae2084899662b1ef5423982ff36ba3b5846b97c61ea7fb9a5
3
+ size 785586
in2vbringingtransductivenodeembeddingstoinductivegraphs/full.md ADDED
The diff for this file is too large to render. See raw diff
 
in2vbringingtransductivenodeembeddingstoinductivegraphs/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49721ce54cd9fd3ee6fecfa63eba0c64de89e6cc00089aae332759f18c8302df
3
+ size 3745476
in2vbringingtransductivenodeembeddingstoinductivegraphs/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:408f69a01ba9738868afc8f748167dbdb726000949969abe3a77d4b2d9e59601
3
+ size 654678
polybasicspeculativedecodingthroughatheoreticalperspective/c209dea3-671d-40ba-8304-63ed84180a96_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9245c7ed6e768826e6cdca5b63b504d87df6222488eec88c8962938f06aa81c
3
+ size 84065
polybasicspeculativedecodingthroughatheoreticalperspective/c209dea3-671d-40ba-8304-63ed84180a96_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f12c2a78571de494ec5171993fca3195392038ea3ea909bd0d3020ce779a2bc
3
+ size 105526
polybasicspeculativedecodingthroughatheoreticalperspective/c209dea3-671d-40ba-8304-63ed84180a96_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a033e7e90146cba7156e1f23e57b262bb45c34946b6e63f304a5e1b9ad1474bf
3
+ size 1542711
polybasicspeculativedecodingthroughatheoreticalperspective/full.md ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Polybasic Speculative Decoding Through a Theoretical Perspective
2
+
3
+ Ruilin Wang<sup>1</sup> Huixia Li<sup>2</sup> Yuexiao Ma<sup>1,2</sup> Xiawu Zheng<sup>1,3,4</sup> Fei Chao<sup>1</sup> Xuefeng Xiao<sup>2</sup> Rongrong Ji<sup>1,3</sup>
4
+
5
+ # Abstract
6
+
7
+ Inference latency stands as a critical bottleneck in the large-scale deployment of Large Language Models (LLMs). Speculative decoding methods have recently shown promise in accelerating inference without compromising the output distribution. However, existing work typically relies on a dualistic draft-verify framework and lacks rigorous theoretical grounding. In this paper, we introduce a novel polybasic speculative decoding framework, underpinned by a comprehensive theoretical analysis. Specifically, we prove a fundamental theorem that characterizes the optimal inference time for multi-model speculative decoding systems, shedding light on how to extend beyond the dualistic approach to a more general polybasic paradigm. Through our theoretical investigation of multi-model token generation, we expose and optimize the interplay between model capabilities, acceptance lengths, and overall computational cost. Our framework supports both standalone implementation and integration with existing speculative techniques, leading to accelerated performance in practice. Experimental results across multiple model families demonstrate that our approach yields speedup ratios ranging from $3.31 \times$ to $4.01 \times$ for LLaMA2-Chat 7B, up to $3.87 \times$ for LLaMA3-8B, up to $4.43 \times$ for Vicuna7B and up to $3.85 \times$ for Qwen2-7B—all while preserving the original output distribution. We release our theoretical proofs and implementation code to facilitate further investigation into polybasic speculative decoding.
8
+
9
+ # 1. Introduction
10
+
11
+ Large Language Models (LLMs) have substantially advanced Natural Language Processing (NLP), achieving leading performance in a wide range of tasks. Yet their exceptional capabilities are tempered by significant computational demands, particularly in low-latency scenarios. Among multiple acceleration techniques, speculative decoding (Stern et al., 2018; Leviathan et al., 2023; Xia et al., 2023; Chen et al., 2023a; Anonymous, 2025b;a; Teng et al., 2024; Zhang et al., 2024b) has emerged as a strategy to speed up inference while preserving output fidelity.
12
+
13
+ The current speculative decoding ecosystem largely hinges on draft-then-verify paradigms, which spawn various subdirections such as the design of lightweight draft models (Leviathan et al., 2023; Xia et al., 2023; Chen et al., 2023a; Kim et al., 2024a; Svirschevski et al., 2024; Yin et al., 2024; Sadhukhan et al., 2024), hierarchical token structures (Stern et al., 2018; Miao et al., 2024; Du et al., 2024), and unified architectures (Yi et al., 2024; Cai et al., 2024). Verification strategies typically follow three approaches: greedy sampling, speculative sampling (Leviathan et al., 2023), and typical acceptance (Cai et al., 2024). Despite these efforts, current strategies remain limited by a dualistic relationship between draft and target models (Qin et al., 2024; Liu et al., 2024; Gui et al., 2024; Khisti et al., 2024), affecting key parameters such as acceptance length due to inherent capacity disparities between the two models. While some recent works (Chen et al., 2023b; Kim et al.; Spector & Ré, 2023) investigate multi-level drafts, they still employ a singular top-level target model. Moreover, the field has hitherto lacked an overarching theoretical framework to guide system design and provide robust performance guarantees.
14
+
15
+ In this paper, we introduce a principled polybasic speculative decoding framework that uses multiple interconnected models, grounded in a thorough theoretical analysis. Our investigation yields two central insights. First, we derive a fundamental relationship between the number of forward passes and average acceptance lengths that dictates optimal system-level inference speed. This relationship allows us to precisely quantify potential inference speedups when adding additional models. Second, we establish the capacity of speculative sampling to enhance stability in acceptance lengths. By optimizing sampling parameters, we can reduce
16
+
17
+ variance in token acceptance to achieve more predictable performance.
18
+
19
+ Building on these insights, we propose a unified architecture for polybasic speculative decoding wherein multiple draft models coordinate with each other and with a single target model. Our implementation guidelines detail how to select models, set speculation lengths, and implement multi-stage verification procedures that maximize throughput. Experimental evaluations demonstrate that this approach outperforms typical dualistic methods on diverse tasks including MT-bench (Zheng et al., 2023), translation, summarization, QA, mathematical reasoning, and Retrieval-Augmented Generation (RAG). Our empirical results indicate that the proposed polybasic framework maintains output fidelity while delivering speedup ratios from $3 \times$ to over $4 \times$ across a range of widely used LLMs (e.g., Vicuna-7B, LLaMA2-Chat 7B, LLaMA3-8B).
20
+
21
+ The main contributions of this work are summarized as follows:
22
+
23
+ - We develop a formal theoretical framework for polybasic speculative decoding, identifying the system-level dependencies between model forward-pass cost, acceptance lengths, and stable acceleration performance.
24
+ - We prove a fundamental theorem that provides a rigorous expression for optimal inference time in multi-model speculative decoding, highlighting conditions under which additional models improve speedups.
25
+ - We show that speculative sampling significantly reduces variance in token acceptance lengths for multi-model settings, increasing stability and improving inference throughput.
26
+ - Our empirical investigation demonstrates the effectiveness of the proposed polybasic approach, achieving notable speedups (up to $4.43 \times$ ) on widely used LLMs across various tasks, while preserving the target model's output distribution.
27
+
28
+ # 2. Related Work
29
+
30
+ The concept of speculative decoding originated from blockwise parallel decoding (Stern et al., 2018), showcasing the viability of partially parallel language generation. More recently, research on speculative decoding (Stewart et al., 2024; Zafrir et al., 2024) has coalesced around two dimensions: drafting strategies for token prediction and verification mechanisms for ensuring correctness.
31
+
32
+ Drafting Strategies. Drafting approaches typically follow either independent or self-drafting protocols. Independent drafting involves utilizing smaller or more efficient models
33
+
34
+ to propose candidate tokens, later verified by a larger model. Methods range from training specialized drafters (Leviathan et al., 2023; Xia et al., 2023; Chen et al., 2023a; Kim et al., 2024a; Metel et al., 2024) to zero-shot usage of pre-existing models (Spector & Ré, 2023). Self-drafting employs the same model at intermediate stages, as in blockwise decoding (Stern et al., 2018; Xiao et al., 2024), early exiting (Yang et al., 2023), or mask-predict (Zhao et al., 2024), aiming to amortize computation within the same architecture.
35
+
36
+ Verification Mechanisms. Verification primarily ensures that proposed tokens maintain consistency with the target distribution. Greedy verification (Kim et al., 2024a; Xia et al., 2023; Agrawal et al., 2024) is conceptually straightforward but may hinder speedups for certain tasks. Speculative sampling (Leviathan et al., 2023) introduces a probabilistic acceptance rule that adaptively filters tokens while retaining a high acceptance length. Token-tree-based verification (Miao et al., 2024; Spector & Ré, 2023; Lu et al., 2024; Gao et al., 2024) provides hierarchical checks, which can be beneficial for highly parallel architectures.
37
+
38
+ Recent Advances and Limitations. Recent work on cascade or multi-level drafting (Chen et al., 2023b; Sun et al., 2024) has partially moved beyond the dualistic draft-target scheme. TRIFORCE (Sun et al., 2024) tackles long sequence generation by introducing a two-level hierarchy with retrieval-based drafting and partial KV cache as an intermediate layer, achieving up to $2.31 \times$ speedup for Llama2-7B-128K. CS Drafting (Chen et al., 2023b), on the other hand, employs vertical and horizontal cascades to eliminate neural autoregressive generation and optimize time allocation in drafting, resulting in up to $81\%$ additional speedup over standard speculative decoding. While TRIFORCE focuses on memory efficiency in long-context scenarios through KV cache optimization, CS Drafting targets general inference optimization through cascade structures and statistical drafting.
39
+
40
+ However, these approaches usually rely on empirical heuristics without a unified theoretical framework to guide model selection, acceptance-length control, and stability analysis. Our work explicitly addresses these gaps by introducing a comprehensive theoretical treatment of polybasic speculative decoding and validating the resulting system design empirically.
41
+
42
+ # 3. Polybasic Speculative Decoding Framework
43
+
44
+ Although speculative decoding has been demonstrated as an effective technique for single-model verification, its acceleration potential remains capped by the inherent draft-target capacity gap in dualistic paradigms. We propose a polybasic speculative decoding framework, which systematically
45
+
46
+ ![](images/72a0591a80329cff2aebed5690c834da63d693ce248e661e6758dd5e69f6118b.jpg)
47
+ (a) Dualistic speculative decoding
48
+
49
+ ![](images/575380489b5fae0510ebbb13d039eebf3073a4345a06774fffaa57836ea24167.jpg)
50
+ (b) Polybasic speculative decoding
51
+ Figure 1. Comparison of speculative decoding frameworks. (a) Traditional dualistic approach with a single draft model. (b) Our polybasic framework with multiple draft models achieves superior performance ( $4 \times$ speedup and 8-10 tokens acceptance length) while maintaining good generalization ability. The framework demonstrates significant improvements over the dualistic baseline.
52
+
53
+ employs multiple models to increase parallelism and acceptance length while preserving fidelity to the final target distribution. Below, we detail the core problem setting, theoretical foundations, and practical instantiations.
54
+
55
+ # 3.1. Problem Formulation
56
+
57
+ Let us consider a chain of models $\mathcal{M} = \{M_1, \ldots, M_n\}$ , where $M_1$ is the final target model we wish to replicate in distribution, and $M_2, \ldots, M_n$ act as drafters at progressively lower capacity (higher index indicates a smaller or faster model). Let $\mathcal{V}$ be the vocabulary, and $p_i(x \mid x_{\leq t}) = M_i(x_{\leq t})$ the distribution over $\mathcal{V}$ given context $x_{\leq t}$ .
58
+
59
+ At each decoding step $t$ , $M_{n}$ drafts a block of $K$ tokens, verified in ascending order by $M_{n-1}, M_{n-2}, \ldots, M_{1}$ . Tokens are accepted if they do not exceed a certain mismatch criterion, reflecting speculative sampling, greedy matching, or another verification rule. Define:
60
+
61
+ $$
62
+ L _ {i} = \mathbb {E} [ (\# \text {o f c o n s e c u t i v e t o k e n s a c c e p t e d b y} M _ {i}) ], \tag {1}
63
+ $$
64
+
65
+ i.e., the expected block length accepted when verifying with model $M_{i}$ . Denoting by $F_{i}$ the number of forward passes that $M_{i}$ must perform, our goal is to minimize the total inference time
66
+
67
+ $$
68
+ T = \sum_ {i = 1} ^ {n} F _ {i} \cdot T _ {i}, \tag {2}
69
+ $$
70
+
71
+ where $T_{i}$ is the cost of a single forward pass for model $M_{i}$ .
72
+
73
+ # 3.2. Theoretical Foundations
74
+
75
+ We establish fundamental properties of multi-model (polybasic) speculative decoding that govern how additional models
76
+
77
+ impact computational cost and acceptance lengths. Our analysis focuses on two main aspects: (i) optimal inference time and (ii) stability of acceptance lengths.
78
+
79
+ Optimal Inference Time. In a conventional dualistic system with one draft model $(M_2)$ and a single target $(M_1)$ , the total inference time is approximately equal to $\frac{N}{L_1} T_1 + \beta \frac{N}{L_1} T_2$ , where $N$ is the sequence length and $\beta$ is a system-dependent scaling factor reflecting the final draft model's capability. In a polybasic setting with $n > 2$ models, additional drafting layers can bring more tokens per verification cycle if acceptance lengths between intermediate pairs are high. However, each additional model also introduces its own forward-pass costs. Formally, we have:
80
+
81
+ Lemma 3.1 (Optimal Inference Time). For an $n$ -model polybasic system generating $N$ tokens, the total inference time $T$ can be expressed as:
82
+
83
+ $$
84
+ T = \sum_ {i = 1} ^ {n - 1} \frac {N}{L _ {i}} \cdot T _ {i} + \beta \cdot \frac {N}{L _ {n - 1}} T _ {n}, \tag {3}
85
+ $$
86
+
87
+ where $L_{i}$ is the expected acceptance length for verification by $M_{i}$ , and $\beta$ is a system-dependent scaling factor reflecting the final draft model's capability.
88
+
89
+ Sketch of Proof. We segment the total generation length $N$ into accepted blocks validated by pairs $(M_i, M_{i+1})$ . Each model $M_i$ must run as many forward passes as needed to accept $N$ tokens in total. A more detailed version of the proof incorporates the block acceptance process for each adjacency $(M_i, M_{i+1})$ , culminating in the time decomposition of Equation (3).
90
+
91
+ Model Selection Criterion. The next question is whether introducing a new model $M_{\mathrm{new}}$ between $M_{i}$ and $M_{i+1}$ improves $T$ . The improvement depends on whether the reduced cost from higher acceptance length outweighs the additional forward-pass overhead. Formally:
92
+
93
+ Theorem 3.2 (Model Insertion Efficiency). Adding $M_{\mathrm{new}}$ between $M_{i}$ and $M_{i+1}$ decreases total inference time if and only if it achieves a sufficiently large increase in acceptance lengths, balanced against its forward-pass cost $T_{\mathrm{new}}$ . Concretely, if $L_{\mathrm{new}}$ is the acceptance length when verifying tokens from $M_{\mathrm{new}}$ against $M_{i}$ , and $L_{i+1}'$ is the acceptance length from $M_{i+1}$ 's perspective, then improvement occurs if:
94
+
95
+ $$
96
+ \frac {T _ {\text {n e w}}}{T _ {i}} < L _ {\text {n e w}} \left(\frac {1}{L _ {i}} - \frac {1}{L _ {i - n e w}}\right) \quad o r
97
+ $$
98
+
99
+ $$
100
+ \frac {T _ {\mathrm {n e w}}}{T _ {i + 1}} < \beta \left(\frac {L _ {\mathrm {n e w} - (i + 1)}}{L _ {i}} - 1\right)
101
+ $$
102
+
103
+ Proof. First, we prove the case for three models:
104
+
105
+ For $i = 2$
106
+
107
+ $$
108
+ T = \frac {N}{L _ {1}} \cdot T _ {1} + \beta \cdot \frac {N}{L _ {1}} \cdot T _ {2} \tag {4}
109
+ $$
110
+
111
+ For $i = 3$
112
+
113
+ $$
114
+ T = \frac {N}{L _ {1} ^ {\prime}} \cdot T _ {1} + \frac {N}{L _ {2} ^ {\prime}} \cdot T _ {2} ^ {\prime} + \beta \cdot \frac {N}{L _ {2} ^ {\prime}} \cdot T _ {3} ^ {\prime} \tag {5}
115
+ $$
116
+
117
+ where $T_{i}$ is the inference time of the $i$ -th model, $\alpha$ is considered to be equal in both equations, and $T_{2} = T_{3}^{\prime}$ , $L_{1}^{\prime} > L_{2}^{\prime} > L_{1}$ .
118
+
119
+ We can calculate the difference between Equation 4 and Equation 5:
120
+
121
+ $$
122
+ \begin{array}{l} N \cdot \left(\frac {1}{L _ {1} ^ {\prime}} - \frac {1}{L _ {1}}\right) \cdot T _ {1} + \frac {N}{L _ {2} ^ {\prime}} \cdot T _ {2} ^ {\prime} \\ + \beta \cdot N \cdot \left(\frac {1}{L _ {2} ^ {\prime}} - \frac {1}{L _ {1}}\right) \cdot T _ {2} < 0 \\ \end{array}
123
+ $$
124
+
125
+ The expression is less than 0 if either of the following conditions is met:
126
+
127
+ Condition 1: Sum of the first two terms is less than 0
128
+
129
+ $$
130
+ \begin{array}{l} N \cdot \left(\frac {1}{L _ {1} ^ {\prime}} - \frac {1}{L _ {1}}\right) \cdot T _ {1} + \frac {N}{L _ {2} ^ {\prime}} \cdot T _ {2} ^ {\prime} < 0 \\ \Leftrightarrow \frac {T _ {2} ^ {\prime}}{T _ {1}} < L _ {2} ^ {\prime} \cdot \left(\frac {1}{L _ {1}} - \frac {1}{L _ {1} ^ {\prime}}\right) \\ \end{array}
131
+ $$
132
+
133
+ OR
134
+
135
+ Condition 2: Sum of the last two terms is less than 0
136
+
137
+ $$
138
+ \begin{array}{l} \frac {N}{L _ {2} ^ {\prime}} \cdot T _ {2} ^ {\prime} + \beta \cdot N \cdot \left(\frac {1}{L _ {2} ^ {\prime}} - \frac {1}{L _ {1}}\right) \cdot T _ {2} < 0 \\ \Leftrightarrow \frac {T _ {2} ^ {\prime}}{T _ {2}} < \beta \cdot \left(\frac {L _ {2} ^ {\prime}}{L _ {1}} - 1\right) \\ \end{array}
139
+ $$
140
+
141
+ This result generalizes to inserting a new model at any position in a polybasic system. When inserting model $M_{new}$ between $M_i$ and $M_{i+1}$ , we can treat all models before the insertion point $(M_1 \text{ through } M_i)$ as a single composite model, and all models after the insertion point $(M_{i+1} \text{ through } M_k)$ as another composite model. This reduces the general case to the three-model case proven above, where the composite model before insertion corresponds to $M_1$ , the new model corresponds to $M_2'$ , and the composite model after insertion corresponds to $M_2$ .
142
+
143
+ Therefore, the same conditions for efficiency improvement apply at any insertion point in the model sequence, subject to the specified constraints on acceptance lengths.
144
+
145
+ Stability Analysis. Beyond achieving higher acceptance lengths, stability in acceptance is crucial for consistent speedups. We analyze speculative sampling with probability $p_i = 1 - \alpha$ to accept a token from $M_{i + 1}$ if it is likely under $M_{i}$ 's distribution. Let $\sigma_i^2$ be the variance of acceptance lengths. As shown below, for multi-model chaining, acceptance length variance grows with smaller $p_i$ , implying that high acceptance probability supports stable performance:
146
+
147
+ Theorem 3.3 (Sampling Stability). In the model chain using speculative sampling with acceptance probability $p_i = 1 - \alpha$ , the variance in acceptance length satisfies:
148
+
149
+ $$
150
+ \sigma^ {2} = \frac {\alpha [ 1 - (n ^ {2} - 1) \alpha^ {n} ] - (n ^ {2} - 1) \alpha^ {n + 1}}{(1 - \alpha) ^ {2}}.
151
+ $$
152
+
153
+ Proof. Let $p = 1 - \alpha$ be the probability of accepting a token. For a truncated geometric distribution of maximum $n$ trials, define:
154
+
155
+ $$
156
+ S = \sum_ {k = 1} ^ {n - 1} k \cdot (1 - p) ^ {k - 1}.
157
+ $$
158
+
159
+ Using standard manipulation (method of differences), one can show:
160
+
161
+ $$
162
+ S = \frac {1 - (1 - p) ^ {n - 1} - n (1 - p) ^ {n - 1} + (1 - p) ^ {n}}{p ^ {2}}.
163
+ $$
164
+
165
+ Hence, the expectation of the acceptance length, allowing up to $n$ tokens, is
166
+
167
+ $$
168
+ E [ N ] = \frac {1 - (1 - p) ^ {n}}{p}.
169
+ $$
170
+
171
+ We similarly compute
172
+
173
+ $$
174
+ E [ N ^ {2} ] = \sum_ {k = 1} ^ {n - 1} k ^ {2} \cdot p \cdot (1 - p) ^ {k - 1} + n ^ {2} \cdot (1 - p) ^ {n - 1}.
175
+ $$
176
+
177
+ After careful algebra (omitted for brevity), one obtains:
178
+
179
+ $$
180
+ \begin{array}{l} E [ N ^ {2} ] = \\ \frac {1 - (1 - p) ^ {n} (n ^ {2} + 2 n - 1) + 2 (1 - p) ^ {n + 1} (n - 1)}{p ^ {2}}. \\ \end{array}
181
+ $$
182
+
183
+ Thus,
184
+
185
+ $$
186
+ \operatorname {V a r} (N) = E [ N ^ {2} ] - (E [ N ]) ^ {2},
187
+ $$
188
+
189
+ leading to the formula stated in Theorem 3.3.
190
+
191
+ ![](images/9b29a2ff602114d007154c19cc00d5566d416d62bfd36b8f191b961aec212ea4.jpg)
192
+
193
+ Collectively, these results establish a principled foundation for polybasic speculative decoding. Given model inference times $T_{i}$ and acceptance probabilities, one can estimate the optimal system layout via Equation (3), gauge whether a new model confers net benefit (Theorem 3.2), and use speculative sampling to ensure stable acceptance lengths (Theorem 3.3).
194
+
195
+ # 3.3. Three-Model System Design
196
+
197
+ To illustrate practical deployment, we describe a three-model system ( $M_1$ : target, $M_2$ : intermediate, $M_3$ : lightweight) that exemplifies the design choices guided by our theory.
198
+
199
+ Architecture. Our reference system includes:
200
+
201
+ - $M_{1}$ (Target): A high-capacity model such as Vicuna7B or LLaMA2-Chat 7B.
202
+ - $M_2$ (Intermediate): A quantized 4-bit version of $M_1$ or a comparable mid-size model to bridge the capacity gap.
203
+ - $M_{3}$ (Draft): A lightweight, fast model (e.g., EA-GLE2(Li et al., 2024)) for initial token proposals.
204
+
205
+ By Theorem 3.2, $M_2$ should be inserted if it raises the acceptance length enough to offset its own forward-pass cost.
206
+
207
+ Staged Verification. Tokens first pass from $M_3$ to $M_2$ , whose verification is relatively fast. Accepted tokens are then periodically verified by $M_1$ . This two-stage verification acts as a filter, rapidly discarding problematic tokens at the cheaper $M_2$ stage. The threshold for passing tokens to $M_1$ is set to accumulate a small block (e.g., $\mu$ tokens) to amortize $M_1$ 's forward-pass overhead. This setup capitalizes on the fact that $M_3$ can generate numerous tentative tokens quickly, while $M_1$ only checks consolidated blocks of already moderately validated tokens.
208
+
209
+ Algorithm 1 Polybasic Speculative Decoding (Three Models)
210
+ 1: Input: Target model $M_1$ , intermediate model $M_2$ , draft model $M_3$
211
+ 2: Input: Context $x_{\leq t}$ , total length $N$
212
+ 3: Input: Draft length $K$ , threshold $\mu$
213
+ 4: Initialize: $t \gets |x_{\leq t}|$ , accepted $\gets \emptyset$ , cnt $\gets 0$
214
+ 5: while $t < N$ do
215
+ 6: // Draft and verify with $M_3$ and $M_2$
216
+ 7: $\widetilde{x}_{1:K} \gets M_3(x_{\leq t}) \quad //$ Draft
217
+ 8: $p_{1:K} \gets M_2(x_{\leq t}, \widetilde{x}_{1:K}) \quad //$ Verify
218
+ 9: for $i = 1$ to $K$ do
219
+ 10: if $\mathrm{VERIFY}(\widetilde{x}_i, p_i)$ then
220
+ 11: accepted.append( $\widetilde{x}_i$ )
221
+ 12: cnt $\gets$ cnt + 1
222
+ 13: else
223
+ 14: break
224
+ 15: end if
225
+ 16: end for
226
+ 17: // Check if threshold reached for $M_1$ verification
227
+ 18: if cnt $\geq \mu$ then
228
+ 19: v $\leftarrow M_1(x_{\leq t}, \text{accepted}) // \text{Verify}$
229
+ 20: if $\mathrm{VERIFY}(\text{accepted}, v)$ then
230
+ 21: $x_{t+1:t+cnt} \gets \text{accepted}$
231
+ 22: t $\leftarrow t + cnt$
232
+ 23: else
233
+ 24: x_t+1 $\leftarrow \text{SampleOne}(v_1) // \text{failback acceptance}$
234
+ 25: t $\leftarrow t + 1$
235
+ 26: end if
236
+ 27: accepted $\leftarrow \emptyset$
237
+ 28: cnt $\leftarrow 0$
238
+ 29: end if
239
+ 30: end while
240
+
241
+ Algorithm. Algorithm 1 details a generic procedure for polybasic speculative decoding with three models. The system accumulates tokens verified by $M_2$ until a threshold, then triggers verification by $M_1$ . Upon acceptance or partial acceptance, it appends tokens to the growing output sequence and advances $t$ . Simple or more sophisticated error handling (e.g., partial rollback) can be adopted if $M_1$ rejects tokens.
242
+
243
+ Such a staged design is representative rather than exhaustive. Model scaling, verification strategies, and drafting lengths can be adapted to different resource constraints or performance targets. Our theoretical framework offers explicit performance bounds, making the design space more transparent.
244
+
245
+ # 3.4. Generalization to Self-Drafting Methods
246
+
247
+ Our polybasic speculative decoding framework provides a general theoretical foundation that naturally extends to self-
248
+
249
+ drafting approaches, demonstrating the broad applicability of our theoretical principles. This generalization reveals new opportunities for designing efficient speculative decoding systems using model-internal components.
250
+
251
+ In self-drafting methods like FFN heads approaches (Cai et al., 2024) (Ankner et al., 2024) (Kim et al., 2024b) and early exiting (Elhoushi et al., 2024) techniques, multiple prediction sources are derived from the same model architecture. These can be viewed as the fundamental draft models in a polybasic system, with the original model serving as the target. For instance, in an FFN heads approach, each head functions as a base draft model capable of generating tokens in parallel, forming the lowest tier in our polybasic hierarchy. Similarly, early exit points at different layers can be treated as draft models with varying capabilities.
252
+
253
+ The optimization principles established in Section 3.2 remain applicable in this context, though they require careful algorithmic design to account for the shared computational paths in self-drafting approaches. The relationship between forward pass frequency and acceptance length provides guidance for optimal configuration of these systems, while our stability analysis (Theorem 3.3) informs the design of verification strategies.
254
+
255
+ This generalization demonstrates that our polybasic framework provides a unified theoretical foundation for speculative decoding, encompassing both independent draft models and self-drafting approaches. This suggests promising directions for developing new algorithmic techniques that fully exploit the parallel prediction capabilities inherent in these methods while maintaining the theoretical guarantees of our framework.
256
+
257
+ # 4. Experiments
258
+
259
+ We conduct comprehensive evaluations to validate our theoretical claims and to benchmark the proposed polybasic system against traditional dualistic strategies. Our experiments span various LLMs, tasks, and hyperparameter settings.
260
+
261
+ # 4.1. Setup and Metrics
262
+
263
+ Models and Tasks. We conducted experiments on Vicuna7B, LLaMA2-chat-7B, and LLaMA3-7B-Instruct. We evaluated our multi-model speculative system in SpecBench(Xia et al., 2024), across multiple tasks including multi-turn conversation, translation, summarization, question answering, mathematical reasoning, and retrieval-augmented generation, employing the MT-bench (Zheng et al., 2023), WMT14 DE-EN, CNN/Daily Mail (Nallapati et al., 2016), Natural Questions (Kwiatkowski et al., 2019), GSM8K (Cobbe et al., 2021), and DPR (Karpukhin et al., 2020). Speculative sampling (Leviathan et al., 2023) conducted experiments with a batch size of 1, similarly, the majority of our experiments
264
+
265
+ also adopted this setting.
266
+
267
+ Performance Metrics. Following previous speculative decoding studies, we focus on two metrics. Walltime speedup ratio $c$ : ratio of actual decoding time in our system vs. standard autoregressive decoding. Average acceptance length $\mu$ : mean number of consecutively accepted tokens per forward pass by the final (largest) model.
268
+
269
+ Quantization and Training Details. For the intermediate model, we adopt 4-bit quantization (Ma et al., 2024) with a group size of 128, balancing reduced inference cost against quality. Draft models are built following EAGLE2, trained on ShareGPT data. Our experiments run on NVIDIA A800 80G GPUs.
270
+
271
+ # 4.2. Theoretical Validation
272
+
273
+ To empirically validate Theorem 3.2, we conducted two targeted experiments evaluating the impact of inserting additional draft models into a polybasic system. We measured $T_{\mathrm{new}}$ , $L_{\mathrm{new}}$ , and the resultant speedup ratio. Results are summarized in Table 4.2.
274
+
275
+ Case 1: Non-Compliant Insertion We inserted a lightweight Vicuna-1B model between Vicuna-7B (target) and EAGLE2 (baseline drafter). Here, $T_{\mathrm{new}} / T_i = 0.80$ , while the acceptance-length improvement factor $L_{\mathrm{new}} \cdot (1 / L_i - 1 / L_{i\text{-new}}) = 0.117$ . Since $0.80 > 0.117$ , Theorem 3.2 predicts a performance degradation. Empirically, the speedup ratio dropped from $2.61 \times$ to $1.08 \times$ , confirming the theoretical prediction. This highlights the necessity of balancing model capacity and computational overhead when expanding the polybasic hierarchy.
276
+
277
+ Case 2: Compliant Insertion We inserted a quantized Vicuna-7B (W4A16) model between the original Vicuna-7B and EAGLE2. Here, $T_{\mathrm{new}} / T_i = 0.318$ and $L_{\mathrm{new}} \cdot (1 / L_i - 1 / L_{i\mathrm{-new}}) = 0.330$ . Since $0.318 < 0.330$ , Theorem 3.2 predicts a speedup improvement. Experimentally, the system achieved a $3.48 \times$ speedup, up from $2.61 \times$ . This demonstrates the theorem's utility in guiding effective model selection.
278
+
279
+ Case 3: Generalization To substantiate the universal theoretical guidance of Theorem 3.2 across diverse cascaded speculative sampling methodologies, we reproduced Cascade Speculative Drafting (Chen et al., 2023b) and conducted rigorous evaluations spanning multiple model scales including FLAN-T5-XXL, Base, and Small variants. We inserted FLAN-T5-base between FLAN-T5-XXL and FLAN-T5-small. The configuration yields $T_{\mathrm{new}} / T_i = 0.403$ with acceptance metric $L_{\mathrm{new}} \cdot (1 / L_i - 1 / L_{i - \mathrm{new}}) = 0.461$ , satisfying the acceleration criterion $0.403 < 0.461$ as shown in Table 1. The system exhibits statistically significant speedup improvement from $3.19 \times$ to $3.88 \times$ .
280
+
281
+ Table 1. Theoretical Validation via Model Insertion
282
+
283
+ <table><tr><td>Case</td><td>Ti (ms)</td><td>Li-new</td><td>Tnew (ms)</td><td>Lnew</td><td>Ti+1 (ms)</td><td>Li</td><td>Speedup</td></tr><tr><td>Non-compliant</td><td>22</td><td>3.83</td><td>17.61</td><td>3.77</td><td>4</td><td>4.34</td><td>2.61× → 1.08×</td></tr><tr><td>Compliant</td><td>22</td><td>6.26</td><td>7.00</td><td>4.67</td><td>4</td><td>4.34</td><td>2.61× → 3.48×</td></tr><tr><td>CS Drafting</td><td>47.52</td><td>3.50</td><td>19.16</td><td>3.02</td><td>12.42</td><td>2.28</td><td>3.19×→3.88×</td></tr></table>
284
+
285
+ These experiments directly corroborate Theorem 3.2, showing that the theoretical conditions on $T_{\mathrm{new}}$ and $L_{\mathrm{new}}$ are necessary for improving system performance. The results emphasize the framework's ability to rigorously guide model selection and hierarchy design, moving beyond heuristic-driven approaches.
286
+
287
+ # 4.3. Effectiveness
288
+
289
+ Figures 2 and 3 summarize speedup ratios on various tasks. Our polybasic approach demonstrates clear gains over dualistic baseline systems (including EAGLE2 and Speculative Sampling). Notably:
290
+
291
+ - Vicuna-7B achieves $3.16 \times$ on average and up to $4.43 \times$ in mathematical reasoning.
292
+ - LLaMA2-Chat 7B attains $3.66 \times$ overall, peaking at $4.10 \times$ in multi-turn conversation.
293
+ - LLaMA3-8B yields $3.31 \times -3.87 \times$ speedups, illustrating the method's adaptability to larger model sizes.
294
+ - qwen2-7B-Instruct demonstrates a $3.28 \times$ average speedup, which is approximately $69\%$ higher than EA-GLE2's $1.94 \times$ acceleration on the same model.
295
+
296
+ Our analysis also shows that average acceptance lengths range from 9.1 to over 10 tokens, significantly higher than typical dual-model methods. This corroborates our theoretical claim that multi-tiered speculation improves acceptance efficiency.
297
+
298
+ As shown in Figure 3, our method demonstrates substantial speedups across diverse tasks, with particularly strong performance in math reasoning (up to $4.43 \times$ ) and multi-turn conversation (up to $4.10 \times$ ). However, we observe relatively modest acceleration on summarization tasks, where the speedup ranges from $2.95 \times$ to $3.41 \times$ . This pattern can be attributed to the higher token generation requirements in summarization, which necessitates maintaining KV caches across multiple models in our polybasic speculative decoding framework. Despite this limitation, our approach is orthogonal to KV cache optimization techniques, suggesting potential for further improvements through the integration of cache-focused methods.
299
+
300
+ # 4.4. Scalability to Larger Models
301
+
302
+ To demonstrate the generalizability of our framework across model scales, we conducted additional experiments with Vicuna-13B and LLaMA-2-chat-70B models. As shown in Table 3, our polybasic approach maintains significant advantages over EAGLE baseline even when scaled to larger models. Specifically, we achieve $2.69 \times$ speedup with Vicuna-13B (vs. EAGLE2's $2.30 \times$ ) and $2.92 \times$ for LLaMA-70B (vs. $2.46 \times$ ), while maintaining substantially higher average acceptance lengths. These results confirm that our method's benefits are not limited to smaller models but extend to larger-scale LLMs. The slightly reduced absolute speedup ratios compared to 7B models align with expectations, as larger models naturally incur higher verification costs that partially offset drafting efficiency gains.
303
+
304
+ # 4.5. Ablation Study: Speculative vs. Greedy Sampling
305
+
306
+ To validate the impact of speculative sampling on stability, we compare acceptance-length variance from speculative vs. greedy verification. We sample 50 queries in a three-model setup and record acceptance-length distributions (Figure 4). As anticipated, speculative sampling yields smaller variance, indicating more stable acceptance lengths across diverse inputs. This result aligns with Theorem 3.3 and further justifies the use of speculative sampling in multi-tier verification.
307
+
308
+ # 4.6. Four-Model System Discussion and Limitations
309
+
310
+ While our theoretical analysis suggests the potential benefits of incorporating more models into the polybasic speculative decoding framework, empirical implementation of systems with four or more models faces practical challenges. Under our sufficient (though not necessary) condition for model insertion efficiency, it is currently difficult to find suitable off-the-shelf models that satisfy the theoretical requirements without additional training. This limitation primarily stems from the stringent balance needed between acceptance length improvements and computational overhead. However, we believe this barrier is not fundamental. Through future exploration of complementary optimization techniques, such as advanced KV cache management, model pruning, and quantization, we anticipate achieving breakthroughs in systems with four or more models, potentially
311
+
312
+ ![](images/966ea51507c7c206d16f91d8e8bdc5b63bb1f1d0e2821006f107d658ed8b6a22.jpg)
313
+ Figure 2. Speedup ratios for Vicuna-7B, LLaMA2-Chat 7B, LLaMA3-8B-Instruct and Qwen2-7B-Instruct on SpecBench. Our polybasic system consistently achieves the highest speedups $(3.16 \times -3.66 \times)$ , surpassing EAGLE2 and vanilla baselines.
314
+
315
+ Table 2. Average acceptance length $\left( \mu \right)$ and speedup ratio (c) on different tasks. V7B: Vicuna-7B, L3-8B: LLaMA3-8B-Instruct, L2-7B: LLaMA2-Chat-7B, Q2-7B: Qwen2-7B-Instruct.
316
+
317
+ <table><tr><td rowspan="2"></td><td rowspan="2">Model</td><td colspan="2">MT</td><td colspan="2">Trans.</td><td colspan="2">Sum.</td><td colspan="2">QA</td><td colspan="2">Math</td><td colspan="2">RAG</td><td colspan="2">Overall</td></tr><tr><td>c</td><td>μ</td><td>c</td><td>μ</td><td>c</td><td>μ</td><td>c</td><td>μ</td><td>c</td><td>μ</td><td>c</td><td>μ</td><td>c</td><td>μ</td></tr><tr><td rowspan="4">Our</td><td>V7B</td><td>3.77x</td><td>11.22</td><td>3.07x</td><td>7.76</td><td>3.01x</td><td>10.24</td><td>3.65x</td><td>9.53</td><td>4.43x</td><td>10.28</td><td>2.98x</td><td>10.30</td><td>3.48x</td><td>9.88</td></tr><tr><td>L3-8B</td><td>3.70x</td><td>9.97</td><td>3.39x</td><td>8.86</td><td>3.02x</td><td>9.38</td><td>3.16x</td><td>9.08</td><td>3.87x</td><td>10.08</td><td>2.71x</td><td>9.24</td><td>3.31x</td><td>9.44</td></tr><tr><td>L2-7B</td><td>4.10x</td><td>10.47</td><td>3.46x</td><td>9.15</td><td>3.41x</td><td>9.86</td><td>3.61x</td><td>9.49</td><td>4.02x</td><td>9.99</td><td>3.31x</td><td>10.08</td><td>3.66x</td><td>9.84</td></tr><tr><td>Q2-7B</td><td>3.65x</td><td>9.85</td><td>3.15x</td><td>8.65</td><td>2.95x</td><td>9.15</td><td>3.25x</td><td>8.95</td><td>3.85x</td><td>9.95</td><td>2.85x</td><td>9.35</td><td>3.28x</td><td>9.32</td></tr><tr><td rowspan="4">EAGLE2</td><td>V7B</td><td>3.19x</td><td>4.76</td><td>2.07x</td><td>3.22</td><td>2.59x</td><td>3.96</td><td>2.45x</td><td>3.71</td><td>3.19x</td><td>4.72</td><td>2.15x</td><td>3.95</td><td>2.61x</td><td>4.34</td></tr><tr><td>L3-8B</td><td>2.69x</td><td>3.99</td><td>2.37x</td><td>3.53</td><td>2.23x</td><td>3.58</td><td>2.21x</td><td>3.42</td><td>2.83x</td><td>4.20</td><td>2.23x</td><td>3.95</td><td>2.44x</td><td>3.82</td></tr><tr><td>L2-7B</td><td>3.04x</td><td>4.48</td><td>2.61x</td><td>3.96</td><td>2.50x</td><td>4.04</td><td>2.55x</td><td>4.05</td><td>3.04x</td><td>4.68</td><td>2.40x</td><td>4.19</td><td>2.70x</td><td>4.30</td></tr><tr><td>Q2-7B</td><td>2.40x</td><td>3.74</td><td>1.45x</td><td>2.45</td><td>1.59x</td><td>3.06</td><td>1.81x</td><td>2.91</td><td>2.63x</td><td>4.26</td><td>1.72x</td><td>3.27</td><td>1.94x</td><td>3.51</td></tr></table>
318
+
319
+ Table 3. Speedup Ratios and Acceptance Lengths on Larger Models
320
+
321
+ <table><tr><td>Method</td><td>Model</td><td>c</td><td>μ</td></tr><tr><td rowspan="2">Our</td><td>Vicuna-13B</td><td>2.69×</td><td>8.62</td></tr><tr><td>LLaMA-70B</td><td>2.92×</td><td>7.48</td></tr><tr><td rowspan="2">EAGLE</td><td>Vicuna-13B</td><td>2.30×</td><td>4.42</td></tr><tr><td>LLaMA-70B</td><td>2.46×</td><td>4.08</td></tr></table>
322
+
323
+ unlocking even greater acceleration benefits while maintaining inference quality.
324
+
325
+ Our polybasic framework, like other speculative decoding methods, can be limited by large KV cache footprints, which scale with text length. Thus, for tasks with extensive context, the overhead from additional models can be more
326
+
327
+ pronounced. As Figure 3 and Table 2 shows, we observe somewhat lower acceleration in summarization and RAG tasks than in shorter contexts. Addressing KV cache constraints via caching techniques (Xiao et al., 2023; Zhang et al., 2024c;a; Jin et al., 2024) is an active research avenue and remains a promising direction for future improvements.
328
+
329
+ # 5. Conclusion
330
+
331
+ We have presented a polybasic speculative decoding system that systematically extends beyond dualistic draft-target paradigms. By establishing a rigorous theoretical framework, we derived an expression for optimal inference time and showed how speculative sampling stabilizes acceptance lengths in multi-model systems. Extensive experiments spanning multiple tasks and model families corroborate our claims, demonstrating $4 \times$ speedups while preserving the
332
+
333
+ ![](images/f91841a46d1c1c54eeb26e73ed8ac7074f968dd1460fa47fc40a6a9aaa985134.jpg)
334
+
335
+ ![](images/386134e4d731081197fb49e064669e132d33dff1550a04115e444d652e6a9016.jpg)
336
+
337
+ ![](images/a161a8d8513ed833195c4c100aee5f695621218e2ed9d146e8bfed767581fed2.jpg)
338
+
339
+ ![](images/a8bb50be6d0378c3ff7785359663533bdb1b943a474452e493eb9d6b8619a26d.jpg)
340
+ Figure 3. Speedup by task. Our method excels in math tasks, reaching $4.43 \times$ with Vicuna-7B, while also maintaining strong accelerations in translation, QA, and multi-turn conversation.
341
+
342
+ ![](images/d99735118e9773746929ea26d308f73493445896b48f53ff9c32bb29ce6fa6f6.jpg)
343
+
344
+ ![](images/edbfa57e4e7cb16a0c6f339a4448f1ed5d2ee01dd5bb57e2678ac6f524f6e7a4.jpg)
345
+ Figure 4. Variance of acceptance length. Speculative sampling (blue) exhibits noticeably lower variance compared to greedy sampling (orange), aligning with our theoretical stability analysis.
346
+
347
+ ![](images/75dfbee8d1770c85bdcc34b322e3e7373e09e192f69971b6ec9ac455add2cc2a.jpg)
348
+
349
+ target model's output distribution.
350
+
351
+ In future work, we will extend our findings to more complex parallel computing scenarios by developing distributed speculative sampling systems. We also plan to explore more efficient caching strategies, implement dynamic adaptation of speculation lengths, and validate the framework's general
352
+
353
+ ity across models of varying scales (from billions to trillions of parameters), aiming to continuously push the boundaries of efficient LLM inference.
354
+
355
+ # Acknowledgements
356
+
357
+ This work was supported by the National Science Fund for Distinguished Young Scholars (No.62025603), the National Natural Science Foundation of China (No. U21B2037, No. U22B2051, No. U23A20383, No. 62176222, No. 62176223, No. 62176226, No. 62072386, No. 62072387, No. 62072389, No. 62002305 and No. 62272401), and the Natural Science Foundation of Fujian Province of China (No. 2021J06003, No.2022J06001).
358
+
359
+ # Impact Statement
360
+
361
+ This paper presents work whose goal is to advance the field of Machine Learning. There are many potential societal consequences of our work, none which we feel must be specifically highlighted here.
362
+
363
+ # References
364
+
365
+ Agrawal, S., Jeon, W., and Lee, M. Adaedl: Early draft stopping for speculative decoding of large language models via an entropy-based lower bound on token acceptance probability. arXiv preprint arXiv:2410.18351, 2024.
366
+ Ankner, Z., Parthasarathy, R., Nrusimha, A., Rinard, C., Ragan-Kelley, J., and Brandon, W. Hydra: Sequentially-dependent draft heads for medusa decoding. arXiv preprint arXiv:2402.05109, 2024.
367
+ Anonymous. Judge decoding: Faster speculative sampling requires going beyond model alignment. In The Thirteenth International Conference on Learning Representations, 2025a. URL https://openreview.net/forum?id=mtSSFiqW6y.
368
+ Anonymous. Towards optimal multi-draft speculative decoding. In The Thirteenth International Conference on Learning Representations, 2025b. URL https://openreview.net/forum?id=9KxnxWOBA5.
369
+ Cai, T., Li, Y., Geng, Z., Peng, H., Lee, J. D., Chen, D., and Dao, T. Medusa: Simple llm inference acceleration framework with multiple decoding heads. arXiv preprint arXiv: 2401.10774, 2024.
370
+ Chen, C., Borgeaud, S., Irving, G., Lespiau, J.-B., Sifre, L., and Jumper, J. Accelerating large language model decoding with speculative sampling. arXiv preprint arXiv:2302.01318, 2023a.
371
+ Chen, Z., Yang, X., Lin, J., Sun, C., Huang, J., and Chang, K. C.-C. Cascade speculative drafting for even faster llm inference. arXiv preprint arXiv:2312.11462, 2023b.
372
+ Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., et al. Training verifiers to solve math word problems, 2021. URL https://arxiv.org/abs/2110.14168, 2021.
373
+ Du, C., Jiang, J., Yuanchen, X., Wu, J., Yu, S., Li, Y., Li, S., Xu, K., Nie, L., Tu, Z., et al. Glide with a cape: A low-hassle method to accelerate speculative decoding. arXiv preprint arXiv:2402.02082, 2024.
374
+ Elhoushi, M., Shrivastava, A., Liskovich, D., Hosmer, B., Wasti, B., Lai, L., Mahmoud, A., Acun, B., Agarwal, S., Roman, A., et al. Layer skip: Enabling early exit inference and self-speculative decoding. arXiv preprint arXiv:2404.16710, 2024.
375
+ Gao, X., Xie, W., Xiang, Y., and Ji, F. Falcon: Faster and parallel inference of large language models through enhanced semi-autoregressive drafting and custom-designed decoding tree. arXiv preprint arXiv:2412.12639, 2024.
376
+
377
+ Gui, L., Xiao, B., Su, L., and Chen, W. Boosting lossless speculative decoding via feature sampling and partial alignment distillation. arXiv preprint arXiv:2408.15562, 2024.
378
+ Jin, H., Han, X., Yang, J., Jiang, Z., Liu, Z., Chang, C.-Y., Chen, H., and Hu, X. Llm maybe longlm: Self-extend llm context window without tuning. arXiv preprint arXiv:2401.01325, 2024.
379
+ Karpukhin, V., Oğuz, B., Min, S., Lewis, P., Wu, L., Edunov, S., Chen, D., and Yih, W.-t. Dense passage retrieval for open-domain question answering. arXiv preprint arXiv:2004.04906, 2020.
380
+ Khisti, A., Ebrahimi, M. R., Dbouk, H., Behboodi, A., Memisevic, R., and Louizos, C. Multi-draft speculative sampling: Canonical architectures and theoretical limits. arXiv preprint arXiv:2410.18234, 2024.
381
+ Kim, S., Mangalam, K., Moon, S., Malik, J., Mahoney, M. W., Gholami, A., and Keutzer, K. Speculative decoding with big little decoder. Advances in Neural Information Processing Systems, 36, 2024a.
382
+ Kim, T., Jung, H., and Yun, S.-Y. A unified framework for speculative decoding with multiple drafters as a bandit.
383
+ Kim, T., Suresh, A. T., Papineni, K. A., Riley, M., Kumar, S., and Benton, A. Exploring and improving drafts in blockwise parallel decoding. In Workshop on Efficient Systems for Foundation Models II@ ICML2024, 2024b.
384
+ Kwiatkowski, T., Palomaki, J., Redfield, O., Collins, M., Parikh, A., Alberti, C., Epstein, D., Polosukhin, I., Devlin, J., Lee, K., et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453-466, 2019.
385
+ Leviathan, Y., Kalman, M., and Matias, Y. Fast inference from transformers via speculative decoding. In International Conference on Machine Learning, pp. 19274-19286. PMLR, 2023.
386
+ Li, Y., Wei, F., Zhang, C., and Zhang, H. Eagle-2: Faster inference of language models with dynamic draft trees. arXiv preprint arXiv:2406.16858, 2024.
387
+ Liu, T., Li, Y., Lv, Q., Liu, K., Zhu, J., and Hu, W. Parallel speculative decoding with adaptive draft length. arXiv preprint arXiv:2408.11850, 2024.
388
+ Lu, X., Zeng, Y., Ma, F., Yu, Z., and Levorato, M. Improving multi-candidate speculative decoding. arXiv preprint arXiv:2409.10644, 2024.
389
+ Ma, Y., Li, H., Zheng, X., Ling, F., Xiao, X., Wang, R., Wen, S., Chao, F., and Ji, R. Affinequant: Affine transformation
390
+
391
+ quantization for large language models. arXiv preprint arXiv:2403.12544, 2024.
392
+ Metel, M. R., Lu, P., Chen, B., Rezagholizadeh, M., and Kobyzev, I. Draft on the fly: Adaptive self-speculative decoding using cosine similarity. arXiv preprint arXiv:2410.01028, 2024.
393
+ Miao, X., Oliaro, G., Zhang, Z., Cheng, X., Wang, Z., Zhang, Z., Wong, R. Y. Y., Zhu, A., Yang, L., Shi, X., et al. Specinfer: Accelerating large language model serving with tree-based speculative inference and verification. In Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 3, pp. 932-949, 2024.
394
+ Nallapati, R., Zhou, B., Gulcehre, C., Xiang, B., et al. Abstractive text summarization using sequence-to-sequence rnns and beyond. arXiv preprint arXiv:1602.06023, 2016.
395
+ Qin, Z., Hu, Z., He, Z., Prakriya, N., Cong, J., and Sun, Y. Multi-token joint speculative decoding for accelerating large language model inference. arXiv e-prints, pp. arXiv-2407, 2024.
396
+ Sadhukhan, R., Chen, J., Chen, Z., Tiwari, V., Lai, R., Shi, J., Yen, I. E.-H., May, A., Chen, T., and Chen, B. Magicdec: Breaking the latency-throughput tradeoff for long context generation with speculative decoding. arXiv preprint arXiv:2408.11049, 2024.
397
+ Spector, B. and Ré, C. Staged speculative decoding: Exploiting large language model decoding inefficiencies for inference acceleration. arXiv preprint arXiv:2310.06334, 2023.
398
+ Stern, M., Shazeer, N., and Uszkoreit, J. Blockwise parallel decoding for deep autoregressive models. Advances in Neural Information Processing Systems, 31, 2018.
399
+ Stewart, L., Trager, M., Gonugondla, S. K., and Soatto, S. The n-grammys: Accelerating autoregressive inference with learning-free batched speculation. arXiv preprint arXiv:2411.03786, 2024.
400
+ Sun, H., Chen, Z., Yang, X., Tian, Y., and Chen, B. Triforce: Lossless acceleration of long sequence generation with hierarchical speculative decoding. arXiv preprint arXiv:2404.11912, 2024.
401
+ Svirschevski, R., May, A., Chen, Z., Chen, B., Jia, Z., and Ryabinin, M. Specexec: Massively parallel speculative decoding for interactive lmm inference on consumer devices. arXiv preprint arXiv:2406.02532, 2024.
402
+ Teng, Y., Shi, H., Liu, X., Ning, X., Dai, G., Wang, Y., Li, Z., and Liu, X. Accelerating auto-regressive text-to-image generation with training-free speculative jacobi decoding. arXiv preprint arXiv:2410.01699, 2024.
403
+
404
+ Xia, H., Ge, T., Wang, P., Chen, S.-Q., Wei, F., and Sui, Z. Speculative decoding: Exploiting speculative execution for accelerating seq2seq generation. In Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 3909-3925, 2023.
405
+ Xia, H., Yang, Z., Dong, Q., Wang, P., Li, Y., Ge, T., Liu, T., Li, W., and Sui, Z. Unlocking efficiency in large language model inference: A comprehensive survey of speculative decoding. arXiv preprint arXiv:2401.07851, 2024.
406
+ Xiao, G., Tian, Y., Chen, B., Han, S., and Lewis, M. Efficient streaming language models with attention sinks. In The Twelfth International Conference on Learning Representations, 2023.
407
+ Xiao, Z., Zhang, H., Ge, T., Ouyang, S., Ordonez, V., and Yu, D. Parallelspec: Parallel drafter for efficient speculative decoding. arXiv preprint arXiv:2410.05589, 2024.
408
+ Yang, Y., Li, Y., Zhang, K., Pu, J., Gao, M., Zhang, T., Shao, R., Wang, W., and Tao, D. Ppd: Prediction-permutation-decoding for fast large language model inference. arXiv preprint arXiv:2312.17344, 2023.
409
+ Yi, H., Lin, F., Li, H., Ning, P., Yu, X., and Xiao, R. Generation meets verification: Accelerating large language model inference with smart parallel auto-correct decoding. arXiv preprint arXiv:2402.11809, 2024.
410
+ Yin, M., Chen, M., Huang, K., and Wang, M. A theoretical perspective for speculative decoding algorithm. Advances in Neural Information Processing Systems, 37:128082-128117, 2024.
411
+ Zafrir, O., Margulis, I., Shteyman, D., and Boudoukh, G. Fastdraft: How to train your draft. arXiv preprint arXiv:2411.11055, 2024.
412
+ Zhang, P., Liu, Z., Xiao, S., Shao, N., Ye, Q., and Dou, Z. Soaring from 4k to 400k: Extending lvm's context with activation beacon. arXiv preprint arXiv:2401.03462, 2024a.
413
+ Zhang, S., Wang, H., Ma, D., Zhu, Z., Chen, L., Lan, K., and Yu, K. Adaeagle: Optimizing speculative decoding via explicit modeling of adaptive draft structures. arXiv preprint arXiv:2412.18910, 2024b.
414
+ Zhang, Z., Sheng, Y., Zhou, T., Chen, T., Zheng, L., Cai, R., Song, Z., Tian, Y., Ré, C., Barrett, C., et al. H2o: Heavy-hitter oracle for efficient generative inference of large language models. Advances in Neural Information Processing Systems, 36, 2024c.
415
+ Zhao, Y., Xie, Z., Liang, C., Zhuang, C., and Gu, J. Lookahead: An inference acceleration framework for large language model with lossless generation accuracy. In
416
+
417
+ Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 6344-6355, 2024.
418
+ Zheng, L., Chiang, W.-L., Sheng, Y., Zhuang, S., Wu, Z., Zhuang, Y., Lin, Z., Li, Z., Li, D., Xing, E., et al. Judging llm-as-a-judge with mt-bench and chatbot arena. Advances in Neural Information Processing Systems, 36: 46595-46623, 2023.
polybasicspeculativedecodingthroughatheoreticalperspective/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6fc879c4ed8889eda2f78ada50991ba55a3c393266fe22912b79fc0230a020c9
3
+ size 450183
polybasicspeculativedecodingthroughatheoreticalperspective/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46f6a2bd547c6f17012fef4b62d36b6eddd0ce9cb4cab6dab4b93a9c5f0b43dc
3
+ size 509632
rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/89161b7c-6df7-4137-b941-fe2dd4396dd2_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc5555eef51f9a9cd7067e467a3c4494beb6315cd70b8f1b589d405371bc18b1
3
+ size 156768
rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/89161b7c-6df7-4137-b941-fe2dd4396dd2_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df394b20eb3e7e5a0e25ea966bf7dd34f0b50ff23077e8a5a36e62f706d5b739
3
+ size 189701
rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/89161b7c-6df7-4137-b941-fe2dd4396dd2_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab591bfc6d2a38e9c107181eba7e617295a58374af05687e9f82dc9f496bf0ab
3
+ size 938387
rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/full.md ADDED
@@ -0,0 +1,791 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # rStar-Math: Small LLMs Can Master Math Reasoning with Self-Evolved Deep Thinking
2
+
3
+ Xinyu Guan $^{*12}$ Li Lyna Zhang $^{*1\dagger}$ Yifei Liu $^{31}$ Ning Shang $^{1}$ Youran Sun $^{14}$ Yi Zhu $^{1}$ Fan Yang $^{1}$ Mao Yang $^{1}$
4
+
5
+ # Abstract
6
+
7
+ We present rStar-Math to demonstrate that small language models (SLMs) can rival or even surpass the math reasoning capability of OpenAI o1, without distillation from superior models. rStarMath achieves this by exercising "deep thinking" through Monte Carlo Tree Search (MCTS), where a math policy SLM performs test-time search guided by an SLM-based process reward model. rStar-Math introduces three innovations to tackle the challenges in training the two SLMs: (1) a novel code-augmented CoT data synthesis method, which performs extensive MCTS rollouts to generate step-by-step verified reasoning trajectories used to train the policy SLM; (2) a novel process reward model training method that avoids naive step-level score annotation, yielding a more effective process preference model (PPM); (3) a self-evolution recipe in which the policy SLM and PPM are built from scratch and iteratively evolved to improve reasoning capabilities. Through 4 rounds of self-evolution with millions of synthesized solutions for 747k math problems, rStar-Math boosts SLMs' math reasoning to state-of-the-art levels. On MATH benchmark, it improves Qwen2.5-Math-7B from $58.8\%$ to $90.0\%$ , surpassing o1-preview by $+4.5\%$ . On the USA Math Olympiad (AIME), rStar-Math solves an average of $53.3\%$ (8/15) of problems, ranking among the top $20\%$ of the brightest high school math students. Code and data are available at https://github.com/microsoft/rStar.
8
+
9
+ *Equal contribution ¹Microsoft Research Asia ²Peking University ³University of Science and Technology of China ⁴Tsinghua University; Xinyu Guan, Yifei Liu and Youran Sun did this work during the internship at MSRA. Correspondence to: Li Lyna Zhang <lzhani@microsoft.com>.
10
+
11
+ Proceedings of the $42^{nd}$ International Conference on Machine Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).
12
+
13
+ <table><tr><td>Task (pass@1 Acc)</td><td>rStar-Math (Qwen-7B)</td><td>rStar-Math (Phi3-mini)</td><td>OpenAI o1-preview</td><td>OpenAI o1-mini</td><td>GPT-4o</td><td>DeepSeek-V3</td></tr><tr><td>MATH</td><td>90.0</td><td>88.6</td><td>85.5</td><td>90.0</td><td>76.6</td><td>90.2</td></tr><tr><td>AIME 2024</td><td>53.3</td><td>46.7</td><td>44.6</td><td>56.7</td><td>9.3</td><td>39.2</td></tr><tr><td>Olympiad Bench</td><td>65.6</td><td>60.3</td><td>-</td><td>65.3</td><td>43.3</td><td>55.4</td></tr><tr><td>College Math</td><td>60.5</td><td>59.3</td><td>-</td><td>57.8</td><td>48.5</td><td>58.9</td></tr><tr><td>Omni-Math</td><td>50.5</td><td>48.5</td><td>52.5</td><td>60.5</td><td>49.6</td><td>35.9</td></tr></table>
14
+
15
+ Table 1. rStar-Math enables frontier math reasoning in SLMs via deep thinking over 64 trajectories.
16
+
17
+ # 1 Introduction
18
+
19
+ Recent studies have demonstrated that large language models (LLMs) are capable of tackling mathematical problems (Team, 2024; Yang et al., 2024; Liu et al., 2024). However, the conventional approach of having LLMs generate complete solutions in a single inference - akin to System 1 thinking (Daniel, 2011) - often yields fast but error-prone results (Valmeekam et al., 2023; OpenAI, 2023). In response, test-time compute scaling (Snell et al., 2024; Qi et al., 2024) suggests a paradigm shift toward a System 2-style thinking, which emulates human reasoning through a slower and deeper thought process. In this paradigm, an LLM serves as a policy model to generate multiple math reasoning steps, which are then evaluated by another LLM acting as a reward model (OpenAI, 2024). The steps and solutions deemed more likely to be correct are selected. The process repeats iteratively and ultimately derives the final answer.
20
+
21
+ In the test-time compute paradigm, the key is to train a powerful policy model that generates promising solution steps and a reliable reward model that accurately evaluates them, both of which depend on high-quality training data. Unfortunately, it is well-known that off-the-shelf high-quality math reasoning data is scarce, and synthesizing high-quality math data faces fundamental challenges. For the policy model, it is challenging to distinguish erroneous reasoning steps from the correct ones, complicating the elimination of low-quality data. It is worth noting that in math reasoning, a correct final answer does not ensure the correctness of the entire reasoning trace (Lanham et al., 2023). Incorrect intermediate steps significantly decrease data quality. As for the reward model, process reward modeling (PRM) shows a great potential by providing fine-grained feedback on intermediate steps (Lightman et al., 2023). However, the training data is even scarcer in this regard: accurate step-by-step feedback
22
+
23
+ requires intense human labeling efforts and is impractical to scale, while those automatic annotation attempts show limited gains due to noisy reward scores (Luo et al., 2024; Chen et al., 2024). Due to the above challenges, existing distill-based data synthesis approaches to training policy models, e.g., scaling up GPT4-distilled CoT data (Tang et al., 2024; Huang et al., 2024), have shown diminishing returns and cannot exceed the capability of their teacher model; meanwhile, as of today, training reliable PRMs for math reasoning remains an open question.
24
+
25
+ In this work, we introduce rStar-Math, a self-evolvable System 2-style reasoning approach that achieves the state-of-the-art math reasoning, rivaling and sometimes even surpassing OpenAI o1 on challenging math competition benchmarks with a model size as small as 7 billion. Unlike solutions relying on superior LLMs for data synthesis, rStar-Math leverages smaller language models (SLMs) with Monte Carlo Tree Search (MCTS) to establish a self-evolutionary process, iteratively generating higher-quality training data. To achieve self-evolution, rStar-Math introduces three key innovations.
26
+
27
+ First, a novel code-augmented CoT data synthesis method, which performs extensive MCTS rollouts to generate step-by-step verified reasoning trajectories with self-annotated MCTS $Q$ -values. Specifically, math problem-solving is decomposed into multi-step generation within MCTS. At each step, the SLM serving as the policy model samples candidate nodes, each generating a one-step CoT and the corresponding Python code. To verify the generation quality, only nodes with successful Python code execution are retained, thus mitigating errors in intermediate steps. Moreover, extensive MCTS rollouts automatically assign a Q-value to each intermediate step based on its contribution: steps contributing to more trajectories that lead to the correct answer are given higher Q-values and considered higher quality. This ensures that the reasoning trajectories generated by SLMs consist of correct, high-quality intermediate steps.
28
+
29
+ Second, a novel method that trains an SLM acting as a process preference model, i.e., a PPM to implement the desired PRM, that reliably predicts a reward label for each math reasoning step. The PPM leverages the fact that, although Q-values are still not precise enough to score each reasoning step despite using extensive MCTS rollouts, the Q-values can reliably distinguish positive (correct) steps from negative (irrelevant/incorrect) ones. Thus the training method constructs preference pairs for each step based on Q-values and uses a pairwise ranking loss (Ouyang et al., 2022) to optimize PPM's score prediction for each reasoning step, achieving reliable labeling. This approach avoids conventional methods that directly use Q-values as reward labels (Luo et al., 2024; Chen et al., 2024), which are inherently noisy and imprecise in stepwise reward assignment.
30
+
31
+ Finally, a four-round self-evolution recipe that progressively builds both a frontier policy model and PPM from scratch. We begin by curating a dataset of 747k math word problems from publicly available sources. In each round, we use the latest policy model and PPM to perform MCTS, generating increasingly high-quality training data using the above two methods to train a stronger policy model and PPM for next round. Each round achieves progressive refinement: (1) a stronger policy SLM, (2) a more reliable PPM, (3) generating better reasoning trajectories via PPM-augmented MCTS, and (4) improving training data coverage to tackle more challenging competition-level math problems.
32
+
33
+ Extensive experiments across four SLMs (1.5B-7B) and seven math reasoning tasks demonstrate the effectiveness of rStar-Math. Remarkably, rStar-Math improves all four SLMs, matching or even surpassing OpenAI o1 on challenging math benchmarks. On MATH benchmark, with 8 search trajectories, rStar-Math boosts Qwen2.5-Math7B from $58.8\%$ to $89.4\%$ and Qwen2.5-Math-1.5B from $51.2\%$ to $87.8\%$ . With 64 trajectories, the scores rise to $90\%$ and $88.4\%$ , outperforming o1-preview by $4.5\%$ and $2.6\%$ and matching o1-mini's $90\%$ . On the Olympiad-level AIME 2024, rStar-Math solves on average $53.3\%$ (8/15) of the problems, exceeding o1-preview by $8.7\%$ and all other open-sourced LLMs. We further conduct comprehensive experiments to verify the superiority of step-by-step verified reasoning trajectories over state-of-the-art data synthesis baselines, as well as the PPM's effectiveness compared to outcome reward models and Q value-based PRMs.
34
+
35
+ # 2 Related Works
36
+
37
+ Math Data Synthesis. Advancements in LLM math reasoning have largely relied on curating high-quality CoT data, with most leading approaches being GPT-distilled, using frontier models like GPT-4 for synthesis (Wang et al., 2024b; Gou et al., 2023; Luo et al., 2023). Notable works include NuminaMath (Jia LI & Polu, 2024a) and MetaMath (Yu et al., 2023b). While effective, this limits reasoning to the capabilities of the teacher LLM. Hard problems that the teacher LLM cannot solve are excluded in the training set. Even solvable problems may contain error-prone intermediate steps, which are hard to detect. Although rejection sampling methods (Yuan et al., 2023; Brown et al., 2024) can improve data quality, they do not guarantee correct intermediate steps. As a result, naively scaling up CoT data generation using frontier LLMs yields diminishing returns, with performance gains approaching saturation.
38
+
39
+ Scaling Test-time Compute has introduced new scaling laws, allowing LLMs to improve performance across by generating multiple samples and using reward models for best-solution selection (Snell et al., 2024; Wu et al., 2024; Brown et al., 2024). Various search methods have been proposed (Kang et al., 2024; Wang et al., 2024a), including
40
+
41
+ ![](images/6e59b216179a83be8467e733e57061379ed9e6fe55912bfd8d9012b0c5a1147a.jpg)
42
+ (a) step-by-step verified reasoning trajectory
43
+
44
+ ![](images/4184f8d8262f4a612ddc5a669bbf76a6ea9716b8778169b01072306ed3ab9f69.jpg)
45
+ (c) 4 rounds of self-evolution
46
+ Figure 1. The overview of rStar-Math.
47
+
48
+ random sampling (Wang et al., 2023) and tree-search methods (Yao et al., 2024; Zhang et al., 2024a; Qi et al., 2024) like MCTS. However, open-source methods for scaling test-time compute have shown limited gains in math reasoning, often due to policy LLM or reward model limitations.
49
+
50
+ Reward Models are crucial for effective System 2 reasoning but are challenging to obtain. The major works include Outcome Reward Model (Yang et al., 2024; Yu et al., 2023a) and Process Reward Model (PRM) (Lightman et al., 2024). While PRMs offer promising dense, step-level reward signals for complex reasoning (Luo et al., 2024), collecting step-level annotations remains an obstacle. While (Kang et al., 2024; Wang et al., 2024a) rely on costly human-annotated datasets like PRM800k (Lightman et al., 2024), recent approaches (Wang et al., 2024c; Luo et al., 2024) explore automated annotation via Monte Carlo Sampling or MCTS. However, they struggle to generate precise reward scores, limiting performance gains. rStar-Math introduces a novel process preference reward (PPM) that eliminates the need for accurate step-level reward score annotation.
51
+
52
+ # 3 Methodology
53
+
54
+ In our work, we explore using two 7B SLMs to generate higher-quality training data. However, self-generating data presents significant challenges for SLMs. SLMs frequently fail to generate correct solutions, and even when the final answer is correct, the intermediate steps are often flawed or of poor quality. Moreover, SLMs solve fewer challenging problems compared to advanced models like GPT-4.
55
+
56
+ This section introduces our methodology, as illustrated in Fig. 1. To mitigate errors and low-quality intermediate steps, we introduce a code-augmented CoT synthetic method, which performs extensive MCTS rollouts to generate step-by-step verified reasoning trajectories, annotated with Q-values. To further improve SLM performance on challenging problems, we introduce a four-round self-evolution recipe. In each round, both the policy SLM and the reward model are updated to stronger versions, progressively tackling more difficult problems and generating higher-quality
57
+
58
+ training data. Finally, we present a novel process reward model training approach that eliminates the need for precise per-step reward annotations, yielding the more effective process preference model (PPM).
59
+
60
+ # 3.1 Step-by-Step Verified Reasoning Trajectory
61
+
62
+ Given a problem $x$ and a policy model $M$ , we use standard MCTS to incrementally construct a search tree for step-by-step solution exploration. As shown in Fig. 1(a), the root node represents question $x$ , and child nodes correspond to intermediate steps $s$ generated by $M$ . A root-to-leaf path ending at terminal node $s_d$ forms a trajectory $\mathbf{t} = x \oplus s_1 \oplus s_2 \oplus \ldots \oplus s_d$ , with each step $s_i$ assigned a Q-value $Q(s_i)$ . From the search tree $\mathcal{T}$ , we extract solution trajectories $\mathbb{T} = \{\mathbf{t}^1, \mathbf{t}^2, \dots, \mathbf{t}^n\} (n \geq 1)$ . Our goal is to select high-quality trajectories from $\mathcal{T}$ to construct the training set. To achieve this, we introduce code-augmented CoT synthesis method to filter out low-quality generations and perform extensive rollouts to improve the reliability of Q-value accuracy.
63
+
64
+ Code-augmented CoT Generation. Prior MCTS approaches primarily generate natural language (NL) CoTs (Qi et al., 2024; Zhang et al., 2024b). However, LLMs often suffer from hallucination, producing incorrect or irrelevant steps yet still arrive at the correct answer by chance (Lanham et al., 2023). These flawed steps are challenging to detect and eliminate. To address this, we propose a novel code execution augmented CoT. As shown in Fig. 2, the policy model generates a one-step NL CoT alongside its corresponding Python code, where the NL CoT is embedded as a Python comment. Only generations with successfully executed Python code are retained as valid candidates.
65
+
66
+ Specifically, starting from the root node $x$ , we perform multiple MCTS iterations through selection, expansion, simulation, and back-propagation. At step $i$ , we collect the latest reasoning trajectory $x \oplus s_1 \oplus s_2 \oplus \ldots \oplus s_{i-1}$ as the current state. Based on this state, we prompt (see Appendix A.4) the policy model to generate $n$ candidates $s_{i,0}, \ldots, s_{i,n-1}$ . Python code execution is then employed to filter valid nodes. As shown in Fig. 2, each generation
67
+
68
+ Question: Bill walks \(\$ 1\)/frac{1}{2}\( mile south, then \)_1\( frac{3}{4}\( mile east, and finally \)_1\( frac{1}{2}\( mile south. How many miles is he, in a direct line, from his starting point? Express your answer as a decimal to the nearest hundredth.
69
+
70
+ Step 1: Calculate the total distance walked south $\rightarrow$ NL CoT as Python Comment
71
+ total_south $= 1 / 2 + 1 / 2$
72
+ # Step 2: Calculate the total distance walked east
73
+ total_east $= 3 / 4$
74
+ # Step 3: Use the Pythagorean theorem to find the direct distance from the starting point
75
+ import math
76
+ direct_distance $=$ math.sqrt(total_south\*\*2+total_east\*\*2)
77
+ # Step 4: Round the direct distance to the nearest hundredth
78
+ direct_distance_rounded $=$ round(direct_distance,2
79
+ From the result, we can see that the direct distance from the starting point is \\boxed{1.25} m
80
+
81
+ Python code execution for step 1:
82
+
83
+ Step 1: Calculate the total distance walked south total_south $= 1 / 2 + 1 / 2$
84
+
85
+ Python code execution for step 2:
86
+
87
+ Step 1: Calculate the total distance walked south total_south $= 1 / 2 + 1 / 2$
88
+
89
+ Step 2: Calculate the total distance walked east total_east $= 3 / 4$
90
+
91
+ Figure 2. An example of Code-augmented CoT. To avoid syntax errors, the code at step $i$ is executed by concatenating it with code from all previous steps. For example, step 2 includes code from step 1 to ensure correct execution.
92
+
93
+ $s_{i,j}$ is concatenated with the code from all previous steps, forming $s_1\oplus s_2\oplus \ldots \oplus s_{i - 1}\oplus s_{i,j}$ . Candidates that execute successfully are retained as valid nodes and scored by the PPM, which assigns a Q-value $q(s_i)$ . Then, we use the well-known Upper Confidence bounds for Trees (UCT) (Kocsis & Szepesvári, 2006) to select the best node among the $n$ candidates. This selection is mathematically represented as:
94
+
95
+ $$
96
+ \mathrm {U C T} (s) = Q (s) + c \sqrt {\frac {\ln N _ {p a r e n t} (s)}{N (s)}}; \quad Q (s) = \frac {q (s)}{N (s)} \tag {1}
97
+ $$
98
+
99
+ where $N(s)$ denotes the number of visits to node $s$ , and $N_{\text{parent}}(s)$ is the visit count of $s$ 's parent node. The predicted reward $q(s)$ is provided by the PPM and will be updated through back-propagation. $c$ is a constant that balances exploitation and exploration.
100
+
101
+ We repeat the process until reaching a terminal node, either by arriving at a final answer or hitting the maximum tree depth. This is referred to as a rollout. Based on whether the rollout reaches the correct answer, we perform back-propagation to update the trajectory Q-value scores. We introduce the score annotation methods in next sections.
102
+
103
+ Extensive Rollouts for Q-value Annotation. Accurate Q-value $Q(s)$ annotation in Eq. 1 is crucial for guiding MCTS towards correct problem-solving paths and identifying high-quality steps within trajectories. Following AlphaGo (Silver et al., 2017) and rStar (Qi et al., 2024), we perform MCTS rollout to assign a Q-value to each step. However, insufficient rollouts can lead to spurious Q-value assignments, such as overestimating suboptimal steps. To mitigate this issue, we draw inspiration from Go players, who refine their evaluations for each move through repeated gameplay. Analogously, within each rollout, we update the Q-value of each step based on its contribution to achieving the correct final answer. Through extensive MCTS rollouts, steps consistently leading to correct answers achieve higher Q-values, occasional successes yield moderate Q-values, and consistently incorrect steps receive low Q-values. Specifically, we introduce two self-annotation methods to obtain these step-level Q-values. Fig. 1(c) shows the detailed setting in the four rounds of self-evolution.
104
+
105
+ Terminal-guided annotation. During the first two rounds,
106
+
107
+ when the PPM is unavailable or insufficiently accurate, we use terminal-guided annotation. Formally, let $q(s_i)^k$ denote the q value for step $s_i$ after back-propagation in the $k^{th}$ rollout, we score per-step Q-value as follows:
108
+
109
+ $$
110
+ q \left(s _ {i}\right) ^ {k} = q \left(s _ {i}\right) ^ {k - 1} + q \left(s _ {d}\right) ^ {k}; \tag {2}
111
+ $$
112
+
113
+ where the initial q value $q(s_i)^0 = 0$ in the first rollout. If this step frequently leads to a correct answer, its q value will increase; otherwise, it decreases. Terminal nodes (denoted as $s_d$ in Eq. 2) are scored as $q(s_d) = 1$ for correct answers and $q(s_d) = -1$ otherwise, as shown in Fig. 1.
114
+
115
+ PPM-augmented annotation. Starting from the third round, we use PPM to score each step for more effective generation. Compared to terminal-guided annotation, which requires multiple rollouts for a meaningful $q$ value, PPM directly predicts a non-zero initial $q$ value. PPM also helps the policy model to generate higher-quality steps, guiding solutions towards correct paths. Formally, for step $s_i$ , PPM predicts an initial $q(s_i)^0$ value based on the partial trajectory:
116
+
117
+ $$
118
+ q \left(s _ {i}\right) ^ {0} = P P M \left(x \oplus s _ {1} \oplus s _ {2} \oplus \dots \oplus s _ {i - 1} \oplus s _ {i}\right) \tag {3}
119
+ $$
120
+
121
+ This $q$ value will be updated based on terminal node's $q(s_d)$ value through MCTS back-propagation in Eq. 2. For terminal node $s_d$ , we do not use PPM for scoring during training data generation. Instead, we assign a more accurate score based on ground truth labels as terminal-guided rewarding.
122
+
123
+ # 3.2 Process Preference Model
124
+
125
+ Process reward models, which provide granular step-level reward signals, is highly desirable for solving challenging math problems. However, obtaining high-quality step-level training data remains an open challenge. Existing methods rely on human annotations (Lightman et al., 2023) or MCTS-generated scores (Zhang et al., 2024b; Chen et al., 2024) to label a score for each step. These scores then serve as training targets, with methods such as MSE loss (Chen et al., 2024) or pointwise loss (Wang et al., 2024c; Luo et al., 2024; Zhang et al., 2024b) used to minimize the difference between predicted and labeled scores. As a result, the precision of these annotated step-level scores determines the effectiveness of the final process reward model.
126
+
127
+ Unfortunately, precise per-step scoring remains a unsolved challenge. Although our extensive MCTS rollouts improve the reliability of Q-values, precisely evaluating fine-grained step quality presents a major obstacle. For instance, among a set of correct steps, it is difficult to rank them as best, second-best, or average and then assign precise scores. Similarly, among incorrect steps, differentiating the worst from moderately poor steps poses analogous challenges. Even expert human annotation struggles with consistency, particularly at scale, leading to inherent noise in training labels.
128
+
129
+ We introduce a novel training method that trains a process preference model (PPM) by constructing step-level positive-negative preference pairs. As shown in Fig. 1(b), instead of using Q-values as direct reward labels, we use them to select steps from MCTS tree for preference pair construction. For each step, we select two candidates with the highest Q-values as positive steps and two with the lowest as negative steps. Critically, the selected positive steps must lead to a correct final answer, while negative steps must lead to incorrect answers. For intermediate steps (except the final answer step), the positive and negative pairs share the same preceding steps. For the final answer step, where identical reasoning trajectories rarely yield different final answers, we relax this restriction. We select two correct trajectories with the highest average Q-values as positive examples and two incorrect trajectories with the lowest average Q-values as negative examples. Following (Ouyang et al., 2022), we define our loss function using the standard Bradley-Terry model with a pairwise ranking loss:
130
+
131
+ $$
132
+ \mathcal {L} _ {p p m} (\theta) = - \frac {1}{4} E _ {\left(x, y _ {i} ^ {p o s}, y _ {i} ^ {n e g} \in \mathbb {D}\right)} \left[ l o g \left(\sigma \left(r _ {\theta} \left(x, y _ {i} ^ {p o s}\right) - r _ {\theta} \left(x, y _ {i} ^ {n e g}\right)\right)\right) \right]
133
+ $$
134
+
135
+ when $i$ is not final answer step, $\left\{ \begin{array}{l}y_i^{pos} = s_1\oplus \ldots \oplus s_{i - 1}\oplus s_i^{pos};\\ y_i^{neg} = s_1\oplus \ldots \oplus s_{i - 1}\oplus s_i^{neg} \end{array} \right.$ (4)
136
+
137
+ $r_{\theta}(x,y_i)$ denotes the PPM output, where $x$ is the problem and $y$ is the trajectory from the first step to the $i^{th}$ step. $\sigma$ denotes the sigmoid function.
138
+
139
+ # 3.3 Self-Evolved Deep Thinking
140
+
141
+ Math Problems Collection. We collect a large dataset of 747k math word problems with ground-truth answers, primarily from NuminaMath (Jia LI & Polu, 2024a) and MetaMath (Yu et al., 2023b). Notably, only competition-level problems (e.g., Olympiads and AIME/AMC) from NuminaMath are included, as we observe that grade-school-level problems do not significantly improve LLM complex math reasoning. To augment the limited competition-level problems, we follow (Li et al., 2024) and use GPT-4 to synthesize new problems based on the seed problems in 7.5k MATH train set and 3.6k AMC-AIME training split. However, GPT-4 often generated unsolvable problems or incorrect solutions for challenging seed problems. To filter these, we prompt GPT-4 to generate 10 solutions per problem, retaining only those with at least 3 consistent solutions.
142
+
143
+ Table 2. Percentage of the 747k math problems correctly solved in each round. The first round uses DeepSeek-Coder-Instruct as the policy LLM, while later rounds use our fine-tuned 7B policy SLM.
144
+
145
+ <table><tr><td>#</td><td>models in MCTS</td><td>GSM-level</td><td>MATH-level</td><td>Olympiad-level</td><td>All</td></tr><tr><td>Round 1</td><td>DeepSeek-Coder-V2-Instruct</td><td>96.61%</td><td>67.36%</td><td>20.99%</td><td>60.17%</td></tr><tr><td>Round 2</td><td>policy SLM-r1</td><td>97.88%</td><td>67.40%</td><td>56.04%</td><td>66.60%</td></tr><tr><td>Round 3</td><td>policy SLM-r2, PPM-r2</td><td>98.15%</td><td>88.69%</td><td>62.16%</td><td>77.86%</td></tr><tr><td>Round 4</td><td>policy SLM-r3, PPM-r3</td><td>98.15%</td><td>94.53%</td><td>80.58%</td><td>90.25%</td></tr></table>
146
+
147
+ Reasoning Trajectories Collection. Instead of using the original solutions in the 747k math dataset, we conduct extensive MCTS rollouts (Sec. 3.1) to generate higher-quality step-by-step verified reasoning trajectories. In each self-evolution round, we perform 16 rollouts per math problem, which leads to 16 reasoning trajectories. Problems are then categorized by difficulty based on the correct ratio of the generated trajectories: easy (all solutions are correct), medium (a mix of correct and incorrect solutions) and hard (all solutions are incorrect). For hard problems with no correct trajectories, an additional MCTS with 16 rollouts is performed. After that, all step-by-step trajectories and their annotated Q-values are collected and filtered to train the policy SLM and process preference model.
148
+
149
+ Self-evolution Recipe. Due to the weaker capabilities of SLMs, we perform four rounds of self-evolution to progressively generate higher-quality data. Each round uses MCTS to generate step-by-step verified reasoning trajectories, which are then used to train the new policy SLM and PPM. The new models are then used in next round. Fig. 1(c) and Table 2 detail the models used for data generation in each round, along with the new trained models. Next, we outline the specific improvements targeted in each round.
150
+
151
+ $\diamond$ Round 1: Bootstrapping an initial strong policy SLM-r1. To enable SLMs to self-generate reasonably good training data, we perform a bootstrap round to fine-tune an initial strong policy model. As shown in Table 2, we run MCTS with DeepSeek-Coder-V2-Instruct (236B) to collect the SFT data. With no available reward model in this round, we use terminal-guided annotation for Q-values and limit MCTS to 8 rollouts for efficiency. For correct solutions, the top-2 trajectories with the highest average Q-values are selected as SFT data, which are then used to SFT the first policy SLM, denoted as SLM-r1.
152
+
153
+ $\diamond$ Round 2: Training a reliable PPM-r2. In this round, with the policy model updated to the 7B SLM-r1, we conduct extensive MCTS rollouts for more reliable Q-value annotation and train the first reliable reward model, PPM-r2. Specifically, we perform 16 MCTS rollouts per problem. The resulting step-by-step verified reasoning trajectories show significant improvements in both quality and Q-value precision. As shown in Appendix Table 10, PPM-r2 is notably more effective than in the bootstrap round.
154
+
155
+ Round 3: PPM-augmented MCTS to significantly improve data quality. With the reliable PPM-r2, we perform
156
+
157
+ PPM-augmented MCTS in this round to generate data, leading to significantly higher-quality trajectories. The generated reasoning trajectories and annotated Q-values are then used to train the new policy SLM-r3 and PPM-r3, both of which show significant improvements.
158
+
159
+ Round 4: Solving challenging problems. After the third round, while grade school and MATH problems achieve high success rates, only $62.16\%$ of Olympiad-level problems are included in the training set. This is NOT solely due to weak capabilities in our SLMs, as many Olympiad problems remain unsolved by GPT-4 or o1. To improve coverage, we adopt a straightforward strategy. For unsolved problems after 16 rollouts, we perform an additional 64 rollouts, and if needed, increase to 128. We also conduct multiple MCTS tree expansions with different random seeds. This boosts the success rate of Olympiad-level problems to $80.58\%$ .
160
+
161
+ After four rounds of self-evolution, $90.25\%$ of the 747k math problems are covered in the training set, as shown in Table 2. Among the remaining unsolved problems, most are synthetic. A manual review of a random sample of 20 problems reveals that 19 are incorrectly labeled. Thus, we conclude that the unsolved problems are of low quality and stop the self-evolution at round 4.
162
+
163
+ # 4 Evaluation
164
+
165
+ # 4.1 Setup
166
+
167
+ Evaluation Datasets. We evaluate rStar-Math on diverse mathematical benchmarks. In addition to the widely-used GSM8K (Cobbe et al., 2021), we include challenging benchmarks from multiple domains: (i) competition and Olympiad-level benchmarks, such as MATH-500 (Lightman et al., 2023), AIME 2024 (AI-MO, 2024a), AMC 2023 (AI-MO, 2024b) and Olympiad Bench (He et al., 2024). Specifically, AIME is the exams designed to challenge the brightest high school math students in America; (ii) college-level math problems from College Math (Tang et al., 2024) and (iii) out-of-domain math benchmark: GaoKao (Chinese College Entrance Exam) En 2023 (Liao et al., 2024).
168
+
169
+ Base Models and Setup. We use SLMs of different sizes as the base policy models: Qwen2.5-Math1.5B (Qwen, 2024b), Phi3-mini-Instruct (3B) (Abdin et al., 2024), Qwen2-Math-7B (Qwen, 2024a) and Qwen2.5-Math7B (Qwen, 2024c). Due to limited GPU resources, we performed 4 rounds of self-evolution exclusively on Qwen2.5-Math-7B, yielding 4 evolved policy SLMs (Table 9) and 4 PPMs (Table 10). For the other 3 policy models, we fine-tune them using step-by-step verified trajectories generated from Qwen2.5-Math-7B's 4th round. PPM from this round is then used as the reward model for the 3 policy SLMs.
170
+
171
+ Baselines. We compare against three strong baselines representing both System 1 and System 2 approaches: (i) Fron
172
+
173
+ tier LLMs, including GPT-4o, the latest Claude, OpenAI o1-preview and o1-mini. We measure their accuracy on AMC 2023, Olympiad Bench, College Math, Gaokao and GSM8K, with accuracy numbers for other benchmarks are taken from public technical reports (Team, 2024). (ii) Open-sourced superior reasoning models; (iii) Both System 1 and System 2 performance of the base models trained from the original models teams, including Instruct versions (e.g., Qwen2.5-Math-7B-Instruct) and Best-of-N (e.g., Qwen2.5-Math-72B-Instruct+Qwen2.5-Math-RM-72B). Notably, the reward model used for the three Qwen base models is a 72B ORM, significantly larger than our 7B PPM.
174
+
175
+ Evaluation Metric. We report Pass@1 accuracy for all baselines. For System 2 baselines, we use default evaluation settings, such as default thinking time for o1-mini and o1-preview. For Qwen models with Best-of-N, we re-evaluate MATH-500 and AIME/AMC accuracy; other benchmarks results are from their technical reports. For a fair comparison, rStar-Math run MCTS to generate the same number of solutions as Qwen. Specifically, we generate 16 trajectories for AIME/AMC and 8 for other benchmarks, using PPM to select the best solution. We also report performance with increased test-time computation using 64 trajectories, denoted as rStar-Math $^{64}$ .
176
+
177
+ # 4.2 Main Results
178
+
179
+ Results on diverse challenging math benchmarks. Table 3 shows the results of rStar-Math with comparing to state-of-the-art reasoning models. We highlight two key observations: (1) rStar-Math significantly improves SLMs math reasoning capabilities, achieving performance comparable to or surpassing OpenAI o1 with substantially smaller model size (1.5B-7B). For example, Qwen2.5-Math-7B, originally at $58.8\%$ accuracy on MATH, improved dramatically to $90.0\%$ with rStar-Math, outperforming o1-preview and Claude 3.5 Sonnet while matching o1-mini. On the College Math benchmark, rStar-Math exceeds o1-mini by $2.7\%$ . On AIME 2024, rStar-Math scored $53.3\%$ , ranking just below o1-mini, with the 7B model solving 8/15 problems in both AIME I and II, placing in the top $20\%$ of the brightest high school math students. Notably, 8 of the unsolved problems were geometry-based, requiring visual understanding, a capability rStar-Math currently does not support. (2) Despite using smaller policy models (1.5B-7B) and reward models (7B), rStar-Math significantly outperforms state-of-the-art System 2 baselines. Compared to Qwen Best-of-N baselines, which use the same base models (Qwen2-Math-7B, Qwen2.5-Math-1.5B/7B) but a $10\times$ larger reward model (Qwen2.5-Math-RM-72B), rStarMath consistently improves the reasoning accuracy of all base models to state-of-the-art levels. Even against Best-of-N with a $10\times$ larger Qwen2.5-Math-72B-Instruct policy model, rStar-Math surpasses it on all benchmarks except
180
+
181
+ Table 3. The results of rStar-Math and other frontier LLMs on the most challenging math benchmarks. rStar-Math reports Pass@1 accuracy when searching 16 trajectories for AIME/AMC and 8 for others. rStar-Math<sup>64</sup> shows results when sampling 64 trajectories.
182
+
183
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Method</td><td colspan="5">Competition and College Level</td><td colspan="2">OOD</td></tr><tr><td>MATH</td><td>AIME 2024</td><td>AMC 2023</td><td>Olympiad Bench</td><td>College Math</td><td>GSM8K</td><td>GaokaoEn 2023</td></tr><tr><td colspan="9">Frontier LLMs</td></tr><tr><td>GPT-4o</td><td>System 1</td><td>76.6</td><td>9.3</td><td>47.5</td><td>43.3</td><td>48.5</td><td>92.9</td><td>67.5</td></tr><tr><td>Claude3.5-Sonnet</td><td>System 1</td><td>78.3</td><td>16.0</td><td>-</td><td>-</td><td>-</td><td>96.4</td><td>-</td></tr><tr><td>GPT-o1-preview</td><td>-</td><td>85.5</td><td>44.6</td><td>90.0</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>GPT-o1-mini</td><td>-</td><td>90.0</td><td>56.7</td><td>95.0</td><td>65.3</td><td>57.8</td><td>94.8</td><td>78.4</td></tr><tr><td colspan="9">Open-Sourced Reasoning LLMs</td></tr><tr><td>DeepSeek-Coder-V2-Instruct</td><td>System 1</td><td>75.3</td><td>13.3</td><td>57.5</td><td>37.6</td><td>46.2</td><td>94.9</td><td>64.7</td></tr><tr><td>NuminaMath-72B-CoT</td><td>System 1</td><td>64.0</td><td>3.3</td><td>70.0</td><td>32.6</td><td>39.7</td><td>90.8</td><td>58.4</td></tr><tr><td>LLaMA3.1-70B-Instruct</td><td>System 1</td><td>65.4</td><td>23.3</td><td>50.0</td><td>27.7</td><td>42.5</td><td>94.1</td><td>54.0</td></tr><tr><td>Qwen2.5-Math-72B-Instruct</td><td>System 1</td><td>85.6</td><td>30.0</td><td>70.0</td><td>49.0</td><td>49.5</td><td>95.9</td><td>71.9</td></tr><tr><td>Qwen2.5-Math-72B-Instruct+72B ORM</td><td>System 2</td><td>85.8</td><td>36.7</td><td>72.5</td><td>54.5</td><td>50.6</td><td>96.4</td><td>76.9</td></tr><tr><td colspan="9">General Base Model: Phi3-mini-Instruct (3.8B)</td></tr><tr><td>Phi3-mini-Instruct (base model)</td><td>System 1</td><td>41.4</td><td>3.33</td><td>7.5</td><td>12.3</td><td>33.1</td><td>85.7</td><td>37.1</td></tr><tr><td>rStar-Math (3.8B SLM+7B PPM)</td><td>System 2</td><td>85.4</td><td>40.0</td><td>77.5</td><td>59.3</td><td>58.0</td><td>94.5</td><td>77.1</td></tr><tr><td>rStar-Math64(3.8B SLM+7B PPM)</td><td>System 2</td><td>86.4</td><td>43.3</td><td>80.0</td><td>60.3</td><td>59.1</td><td>94.7</td><td>77.7</td></tr><tr><td colspan="9">Math-Specialized Base Model: Qwen2.5-Math-1.5B</td></tr><tr><td>Qwen2.5-Math-1.5B (base model)</td><td>System 1</td><td>51.2</td><td>0.0</td><td>22.5</td><td>16.7</td><td>38.4</td><td>74.6</td><td>46.5</td></tr><tr><td>Qwen2.5-Math-1.5B-Instruct</td><td>System 1</td><td>60.0</td><td>10.0</td><td>60.0</td><td>38.1</td><td>47.7</td><td>84.8</td><td>65.5</td></tr><tr><td>Qwen2.5-Math-1.5B-Instruct+72B ORM</td><td>System 2</td><td>83.4</td><td>20.0</td><td>72.5</td><td>47.3</td><td>50.2</td><td>94.1</td><td>73.0</td></tr><tr><td>rStar-Math (1.5B SLM+7B PPM)</td><td>System 2</td><td>87.8</td><td>46.7</td><td>80.0</td><td>63.5</td><td>59.0</td><td>94.3</td><td>77.7</td></tr><tr><td>rStar-Math64(1.5B SLM+7B PPM)</td><td>System 2</td><td>88.6</td><td>46.7</td><td>85.0</td><td>64.6</td><td>59.3</td><td>94.8</td><td>79.5</td></tr><tr><td colspan="9">Math-Specialized Base Model: Qwen2-Math-7B</td></tr><tr><td>Qwen2-Math-7B (base model)</td><td>System 1</td><td>53.4</td><td>3.3</td><td>25.0</td><td>17.3</td><td>39.4</td><td>80.4</td><td>47.3</td></tr><tr><td>Qwen2-Math-7B-Instruct</td><td>System 1</td><td>73.2</td><td>13.3</td><td>62.5</td><td>38.2</td><td>45.9</td><td>89.9</td><td>62.1</td></tr><tr><td>Qwen2-Math-7B-Instruct+72B ORM</td><td>System 2</td><td>83.4</td><td>23.3</td><td>62.5</td><td>47.6</td><td>47.9</td><td>95.1</td><td>71.9</td></tr><tr><td>rStar-Math (7B SLM+7B PPM)</td><td>System 2</td><td>88.2</td><td>43.3</td><td>80.0</td><td>63.1</td><td>58.4</td><td>94.6</td><td>78.2</td></tr><tr><td>rStar-Math64(7B SLM+7B PPM)</td><td>System 2</td><td>88.6</td><td>46.7</td><td>85.0</td><td>63.4</td><td>59.3</td><td>94.8</td><td>79.2</td></tr><tr><td colspan="9">Math-Specialized Base Model: Qwen2.5-Math-7B</td></tr><tr><td>Qwen2.5-Math-7B (base model)</td><td>System 1</td><td>58.8</td><td>0.0</td><td>22.5</td><td>21.8</td><td>41.6</td><td>91.6</td><td>51.7</td></tr><tr><td>Qwen2.5-Math-7B-Instruct</td><td>System 1</td><td>82.6</td><td>6.0</td><td>62.5</td><td>41.6</td><td>46.8</td><td>95.2</td><td>66.8</td></tr><tr><td>Qwen2.5-Math-7B-Instruct+72B ORM</td><td>System 2</td><td>88.4</td><td>26.7</td><td>75.0</td><td>49.9</td><td>49.6</td><td>97.9</td><td>75.1</td></tr><tr><td>rStar-Math (7B SLM+7B PPM)</td><td>System 2</td><td>89.4</td><td>50.0</td><td>87.5</td><td>65.3</td><td>59.0</td><td>95.0</td><td>80.5</td></tr><tr><td>rStar-Math64(7B SLM+7B PPM)</td><td>System 2</td><td>90.0</td><td>53.3</td><td>87.5</td><td>65.6</td><td>60.5</td><td>95.2</td><td>81.3</td></tr></table>
184
+
185
+ Figure 3. Reasoning performance under scaling up the test-time compute.
186
+ ![](images/13e5b736600808c51302a8f045a014cccca9beb9ba79084a1dc7e11f686705a6.jpg)
187
+ o1-preview rStar-Math (7B SLM+7B PPM) Qwen2.5 Best-of-N (72B LLM+72B ORM) o1-mini Qwen2.5 Best-of-N (7B SLM+72B ORM)
188
+
189
+ ![](images/5118d7f94102e69cdf1c1190d21cff9f2579280b27b7d0ddd4bbd960a1ae56e9.jpg)
190
+
191
+ ![](images/70852d2347bcfe3f086e3bb378d7c3dcd1f71cfb756049c5bd893cb592f8fba6.jpg)
192
+
193
+ ![](images/98461371019cf064dc0a0c3efe3701c9ca4ac8fdfb767ba9c91d916cf45db931.jpg)
194
+
195
+ GSM8K, using the same number of sampled solutions.
196
+
197
+ Scaling up test-time computation. By increasing test-time computation, rStar-Math can explore more trajectories, potentially improving performance. In Fig. 3, we show the impact of test-time compute scaling by comparing the accuracy of the official Qwen Best-of-N across different numbers of sampled trajectories on four challenging math benchmarks. Sampling only one trajectory corresponds to the policy LLM's Pass@1 accuracy, indicating a fallback to System 1 reasoning. We highlight two key observations: (1) With only 4 trajectories, rStar-Math significantly outperforms Best-of-N baselines, exceeding o1-preview and approaching o1-mini, demonstrating its effectiveness. (2) Scaling test-time compute improves reasoning accuracy across all benchmarks, though with varying trends. On Math, AIME, and Olympiad Bench, rStar-Math shows saturation or slow improvement at 64 trajectories, while on College Math, performance continues to improve steadily.
198
+
199
+ # 4.3 Ablation Study and Analysis
200
+
201
+ Table 4. The continuously improved math reasoning capabilities via rStar-Math self-evolved deep thinking. Starting from round 2, the 7B base model powered by rStar-Math surpasses GPT-4o.
202
+
203
+ <table><tr><td>Round#</td><td>MATH</td><td>AIME</td><td>AMC</td><td>Olympiad
204
+ Bench</td><td>College
205
+ Math</td><td>GSM8K</td><td>Gaokao</td></tr><tr><td>GPT-4o</td><td>76.6</td><td>9.3</td><td>47.5</td><td>43.3</td><td>48.5</td><td>92.9</td><td>67.5</td></tr><tr><td>Base 7B model</td><td>58.8</td><td>0.0</td><td>22.5</td><td>21.8</td><td>41.6</td><td>91.6</td><td>51.7</td></tr><tr><td>rStar-Math Round 1</td><td>75.2</td><td>10.0</td><td>57.5</td><td>35.7</td><td>45.4</td><td>90.9</td><td>60.3</td></tr><tr><td>rStar-Math Round 2</td><td>86.6</td><td>43.3</td><td>75.0</td><td>59.4</td><td>55.6</td><td>94.0</td><td>76.4</td></tr><tr><td>rStar-Math Round 3</td><td>87.0</td><td>46.7</td><td>80.0</td><td>61.6</td><td>56.5</td><td>94.2</td><td>77.1</td></tr><tr><td>rStar-Math Round 4</td><td>89.4</td><td>50.0</td><td>87.5</td><td>65.3</td><td>59.0</td><td>95.0</td><td>80.5</td></tr></table>
206
+
207
+ The effectiveness of self-evolution. The impressive results in Table 3 are achieved after 4 rounds of rStar-Math self-evolved deep thinking. Table 4 details the performance across rounds, showing continuous accuracy improvements. In round 1, the main improvement comes from applying SFT to the base model. Round 2 brings a significant boost with the application of a stronger PPM in MCTS, which unlocks the full potential of System 2 deep reasoning. Notably, starting from round 2, rStar-Math outperforms GPT-4o. Rounds 3 and 4 show further improvements, driven by stronger System 2 reasoning through better policy SLMs and PPMs.
208
+
209
+ The effectiveness of step-by-step verified reasoning trajectory. rStar-Math generates step-by-step verified reasoning trajectories, which eliminate error intermediate steps and further expand training set with more challenging problems. To evaluate its effectiveness, we use the data generated from round 4 as SFT training data and compare it against three strong baselines: (i) GPT-distillation, which includes open-sourced CoT solutions synthesized using GPT-4, such as MetaMath (Yu et al., 2023b), NuminaMath-CoT (Jia LI & Polu, 2024b); (ii) Random sampling from self-generation, which use the same policy model (i.e., policy SLM-r3) to randomly generate trajectories; (iii) Rejection sampling,
210
+
211
+ where 32 trajectories are randomly sampled from the policy model, with high-quality solutions ranked by our trained ORM (appendix A.2). For fairness, we select two correct trajectories for each math problem in baseline (ii) and (iii). All SFT experiments use the same training recipe.
212
+
213
+ Table 5. Ablation study on the effectiveness of our step-by-step verified reasoning trajectories as the SFT dataset. We report the SFT accuracy of Qwen2.5-Math-7B fine-tuned with different datasets.
214
+
215
+ <table><tr><td></td><td>Dataset</td><td>MATH</td><td>AIME</td><td>Olympiad Bench</td><td>College Math</td></tr><tr><td>GPT-4o</td><td>-</td><td>76.6</td><td>9.3</td><td>43.3</td><td>48.5</td></tr><tr><td rowspan="2">GPT4-distillation (Open-sourced)</td><td>MetaMath</td><td>55.2</td><td>3.33</td><td>19.1</td><td>39.2</td></tr><tr><td>NuminaMath-CoT</td><td>69.6</td><td>10.0</td><td>37.2</td><td>43.4</td></tr><tr><td rowspan="3">Self-generation by policy SLM-r3</td><td>Random sample</td><td>72.4</td><td>10.0</td><td>41.0</td><td>48.0</td></tr><tr><td>Rejection sampling</td><td>73.4</td><td>13.3</td><td>44.7</td><td>50.8</td></tr><tr><td>Step-by-step verified (ours)</td><td>78.4</td><td>26.7</td><td>47.1</td><td>52.5</td></tr></table>
216
+
217
+ Table 5 shows the math reasoning accuracy of Qwen2.5-Math-7B fine-tuned on different datasets. We highlight two observations: (i) Fine-tuning with our step-by-step verified trajectories significantly outperforms all other baselines. This is primarily due to our PPM-augmented MCTS for code-augmented CoT synthesis, which provides denser verification during math solution generation. It proves more effective than both random sampling, which lacks verification, and rejection sampling, where ORM provides only sparse verification. (ii) Even randomly sampled code-augmented CoT solutions from our SLM yields comparable or better performance than GPT-4 synthesized NuminaMath and MetaMath datasets. This indicates that our policy SLMs, after rounds of self-evolution, can generate high-quality math solutions. These results demonstrate the huge potential of our method to self-generate higher-quality reasoning data without relying on advanced LLM distillation.
218
+
219
+ The effectiveness of PPM. We train both a strong ORM and Q-value score-based PRM (PQM) for comparison. To ensure a fair evaluation, we use the highest-quality training data: the step-by-step verified trajectories generated in round 4, with selected math problems matching those used for PPM training. Similar to PPM, we use step-level Q-values as to select positive and negative trajectories for each math problem. The ORM is trained using a pairwise ranking loss (Ouyang et al., 2022), while the PQM follows (Chen et al., 2024; Zhang et al., 2024b) to use Q-values as reward labels and optimize with MSE loss. Detailed training settings are provided in Appendix A.2.
220
+
221
+ Table 6. Ablation study on the reward model. Process reward models (PQM and PPM) outperform ORM, with PPM pushing the frontier of math reasoning capabilities.
222
+
223
+ <table><tr><td>RM</td><td>Inference</td><td>MATH</td><td>AIME</td><td>Olympiad Bench</td><td>College Math</td></tr><tr><td>ol-mini</td><td>-</td><td>90.0</td><td>56.7</td><td>65.3</td><td>55.6</td></tr><tr><td>ORM</td><td>Best-of-N</td><td>82.6</td><td>26.7</td><td>55.1</td><td>55.5</td></tr><tr><td>PQM</td><td>MCTS</td><td>88.2</td><td>46.7</td><td>62.9</td><td>57.6</td></tr><tr><td>PPM</td><td>MCTS</td><td>89.4</td><td>50.0</td><td>65.3</td><td>59.0</td></tr></table>
224
+
225
+ Table 6 compares the performance of ORM, PQM, and PPM for System 2 reasoning using our final round policy model. ORM provides reward signals only at the end of problem solving, so we use the Best-of-N, while PQM and PPM leverage MCTS-driven search. As shown in Table 6, both PQM and PPM outperform ORM by providing denser step-level reward signals, leading to higher accuracy on complex math reasoning tasks. However, PQM struggles on more challenging benchmarks, such as MATH and Olympiad Bench, due to the inherent imprecision of Q-values. In contrast, PPM constructs step-level preference data for training, enabling our 7B policy model to achieve comparable or superior performance to o1-mini across all benchmarks.
226
+
227
+ # 5 Conclusion
228
+
229
+ In this work, we present rStar-Math, a self-evolved System 2 deep thinking approach that significantly boosts the math reasoning capabilities of small LLMs, achieving state-of-the-art OpenAI o1-level performance. Extensive experiments across four different-sized SLMs and challenging math benchmarks demonstrate the superiority of rStar-Math, with achieving leading results while outperforming existing math reasoning LLMs and Best-of-N baselines. We observe that there can be further improvements with more challenging math problems, which we leave as future work.
230
+
231
+ # Impact Statement
232
+
233
+ This paper presents work whose goal is to advance the field of deep learning. While our research focuses on enhancing the mathematical reasoning capabilities of large language models, we acknowledge potential societal implications such as applications in education and automated problem-solving. There are many broader consequences of our work, none of which we feel must be specifically highlighted here.
234
+
235
+ # References
236
+
237
+ Inequality of arithmetic and geometric means. URL https://artofproblemsolving.com/wiki/index.php/AM-GM_Inequality.
238
+ Pythagorean theorem. URL https://en.wikipedia.org/wiki/Pythagorean_theorem.
239
+ Shoelace theorem. URL https://artofproblemsolving.com/wiki/index.php/Shoelace_Theorem.
240
+ Abdin, M., Jacobs, S. A., Awan, A. A., Aneja, J., Awadallah, A., Awadalla, H., Bach, N., Bahree, A., Bakhtiari, A., Behl, H., et al. Phi-3 technical report: A highly capable language model locally on your phone. arXiv preprint arXiv:2404.14219, 2024.
241
+ AI-MO. Aime 2024, 2024a. URL https://huggingface.co/datasets/AI-MO/aimo-validation-aime.
242
+
243
+ AI-MO. Amc 2023, 2024b. URL https://huggingface.co/datasets/AI-MO/aimo-validation-amc.
244
+ Brown, B., Juravsky, J., Ehrlich, R., Clark, R., Le, Q. V., Ré, C., and Mirhoseini, A. Large language monkeys: Scaling inference compute with repeated sampling. arXiv preprint arXiv:2407.21787, 2024.
245
+ Chen, G., Liao, M., Li, C., and Fan, K. Alphamath almost zero: process supervision without process, 2024.
246
+ Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
247
+ Daniel, K. Thinking, fast and slow. Macmillan, 2011.
248
+ Gou, Z., Shao, Z., Gong, Y., Yang, Y., Huang, M., Duan, N., Chen, W., et al. Tora: A tool-integrated reasoning agent for mathematical problem solving. arXiv preprint arXiv:2309.17452, 2023.
249
+ He, C., Luo, R., Bai, Y., Hu, S., Thai, Z. L., Shen, J., Hu, J., Han, X., Huang, Y., Zhang, Y., et al. Olympiadbench: A challenging benchmark for promoting agi with olympiad-level bilingual multimodal scientific problems. arXiv preprint arXiv:2402.14008, 2024.
250
+ Huang, J., Chen, X., Mishra, S., Zheng, H. S., Yu, A. W., Song, X., and Zhou, D. Large language models cannot self-correct reasoning yet. arXiv preprint arXiv:2310.01798, 2023.
251
+ Huang, Z., Zou, H., Li, X., Liu, Y., Zheng, Y., Chern, E., Xia, S., Qin, Y., Yuan, W., and Liu, P. O1 replication journey - part 2: Surpassing o1-preview through simple distillation big progress or bitter lesson? *Github*, 2024. URL https://github.com/GAIR-NLP/01-Journey.
252
+ Jia LI, Edward Beeching, L. T. B. L. R. S. S. C. H. K. R. L. Y. A. J. Z. S. Z. Q. B. D. L. Z. Y. F. G. L. and Polu, S. Numinamath. [https://github.com/project-numina/aimo-progress-prize](https://github.com/project-numina/aimo-progress-prize/blob/main/report/numina_dataset.pdf), 2024a.
253
+ Jia LI, Edward Beeching, L. T. B. L. R. S. S. C. H. K. R. L. Y. A. J. Z. S. Z. Q. B. D. L. Z. Y. F. G. L. and Polu, S. Numinamath cot, 2024b. URL https://huggingface.co/datasets/AI-MO/NuminaMath-CoT.
254
+ Kang, J., Li, X. Z., Chen, X., Kazemi, A., and Chen, B. Mindstar: Enhancing math reasoning in pre-trained llms at inference time. arXiv preprint arXiv:2405.16265, 2024.
255
+
256
+ Kocsis, L. and Szepesvári, C. Bandit based monte-carlo planning. volume 2006, pp. 282-293, 09 2006. ISBN 978-3-540-45375-8. doi: 10.1007/11871842_29.
257
+ Kumar, A., Zhuang, V., Agarwal, R., Su, Y., Co-Reyes, J. D., Singh, A., Baumli, K., Iqbal, S., Bishop, C., Roelofs, R., et al. Training language models to self-correct via reinforcement learning. arXiv preprint arXiv:2409.12917, 2024.
258
+ Lanham, T., Chen, A., Radhakrishnan, A., Steiner, B., Denison, C., Hernandez, D., Li, D., Durmus, E., Hubinger, E., Kernion, J., et al. Measuring faithfulness in chain-of-thought reasoning. arXiv preprint arXiv:2307.13702, 2023.
259
+ Li, C., Wang, W., Hu, J., Wei, Y., Zheng, N., Hu, H., Zhang, Z., and Peng, H. Common 7b language models already possess strong math capabilities. arXiv preprint arXiv:2403.04706, 2024.
260
+ Liao, M., Luo, W., Li, C., Wu, J., and Fan, K. Mario: Math reasoning with code interpreter output-a reproducible pipeline. arXiv preprint arXiv:2401.08190, 2024.
261
+ Lightman, H., Kosaraju, V., Burda, Y., Edwards, H., Baker, B., Lee, T., Leike, J., Schulman, J., Sutskever, I., and Cobbe, K. Let's verify step by step. arXiv preprint arXiv:2305.20050, 2023.
262
+ Lightman, H., Kosaraju, V., Burda, Y., Edwards, H., Baker, B., Lee, T., Leike, J., Schulman, J., Sutskever, I., and Cobbe, K. Let's verify step by step. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=v8L0pN6E0i.
263
+ Liu, A., Feng, B., Xue, B., Wang, B., Wu, B., Lu, C., Zhao, C., Deng, C., Zhang, C., Ruan, C., et al. Deepseek-v3 technical report. arXiv preprint arXiv:2412.19437, 2024.
264
+ Luo, H., Sun, Q., Xu, C., Zhao, P., Lou, J., Tao, C., Geng, X., Lin, Q., Chen, S., and Zhang, D. Wizardmath: Empowering mathematical reasoning for large language models via reinforced evol-instruct. arXiv preprint arXiv:2308.09583, 2023.
265
+ Luo, L., Liu, Y., Liu, R., Phatale, S., Lara, H., Li, Y., Shu, L., Zhu, Y., Meng, L., Sun, J., et al. Improve mathematical reasoning in language models by automated process supervision. arXiv preprint arXiv:2406.06592, 2024.
266
+ Noam Brown, I. A. and Lightman, H. Openai's noam brown, ilge akkaya and hunter lightman on o1 and teaching llms to reason better, 2024. URL https://www.youtube.com/watch?v=jPluSXJpdrA.
267
+ OpenAI. Gpt-4 technical report. 2023.
268
+
269
+ OpenAI. Openai o1 system card. preprint, 2024.
270
+ Ouyang, L., Wu, J., Jiang, X., Almeida, D., Wainwright, C., Mishkin, P., Zhang, C., Agarwal, S., Slama, K., Ray, A., et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730-27744, 2022.
271
+ Qi, Z., Ma, M., Xu, J., Zhang, L. L., Yang, F., and Yang, M. Mutual reasoning makes smaller llms stronger problem-solvers. arXiv preprint arXiv:2408.06195, 2024.
272
+ Qwen. Qwen2-math-7b, 2024a. URL https://huggingface.co/Qwen/Qwen2-Math-7B.
273
+ Qwen. Qwen2.5-math-1.5b, 2024b. URL https://huggingface.co/Qwen/Qwen2.5-Math-1.5B.
274
+ Qwen. Qwen2.5-math-7b, 2024c. URL https://huggingface.co/Qwen/Qwen2.5-Math-7B.
275
+ Renze, M. and Guven, E. Self-reflection in llm agents: Effects on problem-solving performance. arXiv preprint arXiv:2405.06682, 2024.
276
+ Shinn, N., Cassano, F., Gopinath, A., Narasimhan, K., and Yao, S. Reflection: Language agents with verbal reinforcement learning. Advances in Neural Information Processing Systems, 36, 2024.
277
+ Silver, D., Hubert, T., Schrittwieser, J., Antonoglou, I., Lai, M., Guez, A., Lanctot, M., Sifre, L., Kumaran, D., Graepel, T., et al. Mastering chess and shogi by self-play with a general reinforcement learning algorithm. arXiv preprint arXiv:1712.01815, 2017.
278
+ Snell, C., Lee, J., Xu, K., and Kumar, A. Scaling llm test-time compute optimally can be more effective than scaling model parameters. arXiv preprint arXiv:2408.03314, 2024.
279
+ Tang, Z., Zhang, X., Wan, B., and Wei, F. Mathscale: Scaling instruction tuning for mathematical reasoning. arXiv preprint arXiv:2403.02884, 2024.
280
+ Team, Q. Qwq: Reflect deeply on the boundaries of the unknown, November 2024. URL https://qwenlm.github.io/blog/qwq-32b-preview/.
281
+ Valmeekam, K., Sreedharan, S., Marquez, M., Olmo, A., and Kambhampati, S. On the planning abilities of large language models (a critical investigation with a proposed benchmark). arXiv preprint arXiv:2302.06706, 2023.
282
+ Wang, C., Deng, Y., Lv, Z., Yan, S., and Bo, A. Q*: Improving multi-step reasoning for llms with deliberative planning, 2024a.
283
+
284
+ Wang, K., Ren, H., Zhou, A., Lu, Z., Luo, S., Shi, W., Zhang, R., Song, L., Zhan, M., and Li, H. Math-coder: Seamless code integration in LLMs for enhanced mathematical reasoning. In The Twelfth International Conference on Learning Representations, 2024b. URL https://openreview.net/forum?id=z8TW0ttBPp.
285
+ Wang, P., Li, L., Shao, Z., Xu, R. X., Dai, D., Li, Y., Chen, D., Wu, Y., and Sui, Z. Math-shepherd: Verify and reinforce llms step-by-step without human annotations, 2024c.
286
+ Wang, X., Wei, J., Schuurmans, D., Le, Q. V., Chi, E. H., Narang, S., Chowdhery, A., and Zhou, D. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=1PL1NIMMrw.
287
+ Weisstein, E. W. Fermat's little theorem, a. URL https://mathworld.wolfram.com/FermatsLittleTheorem.html.
288
+ Weisstein, E. W. Vieta's formulas, from mathworld—a wolfram web resource, b. URL http://mathworld.wolfram.com/Tree.html.
289
+ Wu, Y., Sun, Z., Li, S., Welleck, S., and Yang, Y. An empirical analysis of compute-optimal inference for problem-solving with language models. arXiv preprint arXiv:2408.00724, 2024.
290
+ Xin, H., Guo, D., Shao, Z., Ren, Z., Zhu, Q., Liu, B., Ruan, C., Li, W., and Liang, X. Deepseek-prover: Advancing theorem proving in llms through large-scale synthetic data. arXiv preprint arXiv:2405.14333, 2024.
291
+
292
+ Yang, A., Zhang, B., Hui, B., Gao, B., Yu, B., Li, C., Liu, D., Tu, J., Zhou, J., Lin, J., et al. Qwen2. 5-math technical report: Toward mathematical expert model via self-improvement. arXiv preprint arXiv:2409.12122, 2024.
293
+ Yao, S., Yu, D., Zhao, J., Shafran, I., Griffiths, T., Cao, Y., and Narasimhan, K. Tree of thoughts: Deliberate problem solving with large language models. Advances in Neural Information Processing Systems, 36, 2024.
294
+ Yu, F., Gao, A., and Wang, B. Outcome-supervised verifiers for planning in mathematical reasoning. arXiv preprint arXiv:2311.09724, 2023a.
295
+ Yu, L., Jiang, W., Shi, H., Yu, J., Liu, Z., Zhang, Y., Kwok, J. T., Li, Z., Weller, A., and Liu, W. Metamath: Bootstrap your own mathematical questions for large language models. arXiv preprint arXiv:2309.12284, 2023b.
296
+ Yuan, Z., Yuan, H., Li, C., Dong, G., Lu, K., Tan, C., Zhou, C., and Zhou, J. Scaling relationship on learning mathematical reasoning with large language models. arXiv preprint arXiv:2308.01825, 2023.
297
+ Zhang, D., Li, J., Huang, X., Zhou, D., Li, Y., and Ouyang, W. Accessing gpt-4 level mathematical olympiad solutions via monte carlo tree self-refine with llama-3 8b. arXiv preprint arXiv:2406.07394, 2024a.
298
+ Zhang, D., Zhoubian, S., Hu, Z., Yue, Y., Dong, Y., and Tang, J. Rest-mcts*: Llm self-training via process reward guided tree search. arXiv preprint arXiv:2406.03816, 2024b.
299
+
300
+ # A Appendix
301
+
302
+ # A.1 Findings and Discussions
303
+
304
+ ![](images/894403e640bc1fef66707e8af0e7ce675bbb178fff059b7e9773297f1c66441b.jpg)
305
+ Figure 4. An example of intrinsic self-reflection during rStar-Math deep thinking.
306
+
307
+ The emergence of intrinsic self-reflection capability. A key breakthrough in OpenAI o1 is its intrinsic self-reflection capability. When the model makes an error, it recognizes the mistake and self-correct with a correct answer (Noam Brown & Lightman, 2024). Yet it has consistently been found to be largely ineffective in open-sourced LLMs. Thus, the community has actively explored various approaches, including self-correction (Huang et al., 2023; Kumar et al., 2024), self-reflection (Renze & Guven, 2024; Shinn et al., 2024), to explicitly train or prompt LLMs to develop such capability.
308
+
309
+ In our experiments, we unexpectedly observe that our MCTS-driven deep thinking exhibits self-reflection during problem-solving. As shown in Fig. 4, the model initially formalizes an equation using SymPy in the first three steps, which would lead to an incorrect answer (left branch). Interestingly, in the fourth step (right branch), the policy model recognizes the low quality of its earlier steps and refrains from continuing along the initial problem-solving path. Instead, it backtracks and resolves the problem using a new, simpler approach, ultimately arriving at the correct answer. An additional example of self-correction is provided in Appendix A.3. Notably, no self-reflection training data or prompt was included, suggesting that advanced System 2 reasoning can foster intrinsic self-reflection.
310
+
311
+ PPM shapes the reasoning boundary in System 2 deep thinking. Both the policy and reward models are crucial for System 2 deep reasoning. Our experiments show that different policy models achieve similar performance in System 2 reasoning (see Appendix A.2), with the PPM largely determines the upper performance limit. Fig. 5 summarizes the accuracy of policy models of different sizes and the accuracy achieved after applying reward models. We conclude that, despite differences in Pass@1 accuracy due to variations in training methods, data, and model size, the reward model is the key factor in System 2 reasoning. For instance, although the SFT accuracy of rStar-Math-7B is lower than Qwen2.5-Math-72B-Instruct, pairing it with our 7B PPM allows rStar-Math to outperform the 72B policy model with Qwen 72B ORM. Moreover, despite varying Pass@1 accuracy across our three policy SLM sizes, the final reasoning accuracy converges after applying the PPM.
312
+
313
+ Figure 5. Pass@1 accuracy of policy models and their accuracy after applying System 2 reasoning with various reward models, shows that reward models primarily determine the final performance.
314
+ ![](images/0d5ba75163cadebd8e0c8ac682c1ded76c7fe376c29dd0ac1c10f5fc9c45c870.jpg)
315
+ rStar 7B PPM improvement
316
+
317
+ ![](images/2c368553923f7d4e141c839dcb971223d5b09877973948340356b4e3beb0fb11.jpg)
318
+ rStar Policy model
319
+
320
+ ![](images/ee730008b88b892009770fba9116968b55ab6fe507eb8f5337a008da38430f44.jpg)
321
+ Qwen 72B Policy model
322
+
323
+ ![](images/1b56a0bfa2b4201d858129d552cbac205cec21591977eee2b0e618a1063bcec1.jpg)
324
+ Qwen 72B ORM improvement
325
+
326
+ ![](images/a735cc3b41ec4ce50bbc2dd1b0c234d9b0cabf855db9d7268cca30cc5e396772.jpg)
327
+
328
+ PPM spots theorem-application steps. When solving challenging math problems, identifying and applying relevant theorems or key conclusions often form the cornerstone of successful problem-solving (Xin et al., 2024). In our experiments, we find that during rStar-Math problem-solving, our PPM effectively identifies critical theorem-application intermediate steps within policy model's deep thinking process. These steps are predicted with high reward scores, guiding the policy model to the correct solution. Appendix A.3 provides examples where the PPM successfully identifies key theorems such as Fermat's little theorem (Weisstein, a), Vieta's formulas (Weisstein, b), the AM-GM inequality (amg), the Pythagorean theorem (pyt), and the Shoelace Theorem (sho), etc.
329
+
330
+ Generalization to theorem proving. rStar-Math is a generalizable tool to more challenging math tasks, such as theorem proving, though its current focus is on word problems due to dataset limitations. Nonetheless, rStar-Math demonstrates the ability to prove mathematical statements. As shown in Appendix A.3, it successfully proves an Olympiad-level problem involving Fermat's Little Theorem, providing a step-by-step correct proof through its deep reasoning process. This achievement is primarily due to the policy model's strong reasoning capabilities, as the current PPM, which lacks step-level proof training, cannot yet reliably evaluate intermediate steps. Future work will focus on creating step-level proof datasets to enable the PPM to better solve theorem proving tasks.
331
+
332
+ # A.2 Additional Experiments and Details
333
+
334
+ Data Generation Details. As detailed in Sec. 3.3, each round starts by self-generating step-by-step verified trajectories for $747\mathrm{k}$ math word problems. The maximum tree depth $d$ is set to 16, with 16 MCTS rollouts conducted per problem by default. At each step, we allow to explore 8 candidate nodes, and the constant $c$ in Eq. 1 is set to 2 to promote greater exploration. In the bootstrap round, due to the large size of the initial policy model (236B), we used smaller parameters: 8 rollouts and 5 candidate nodes per step. To improve the accuracy of solving challenging problems in round 4, we increase the number of candidate nodes to 16 and conduct 2 MCTS tree expansions per problem using different random seeds. Detailed prompts are available in Appendix A.4.
335
+
336
+ Training Details. In each round, we collect step-by-step verified trajectories to fine-tune the policy LLM and train the PPM. To reduce noise in synthetic math problems (e.g., incorrect ground-truth answers labeled by GPT-4), we remove synthetic problems with trajectories achieving less than $50\%$ accuracy. Based on our extensive experiments, the policy LLM is fine-tuned from the initial base model in each round, rather than training incrementally on the model from the previous round. All policy SLMs are trained for 2 epochs with a sequence length of 4096 tokens and a batch size of 128. We use AdamW optimizer with a linear learning rate scheduler, setting the initial learning rate to 7e-6 for Qwen models, and a cosine scheduler with an initial learning rate of 5e-6 for Phi3-mini-Instruct. The PPM is trained for 1 epoch with a batch size of 512 and an initial learning rate of 7e-6.
337
+
338
+ Table 7. Training cost per round
339
+
340
+ <table><tr><td></td><td>GPUs</td><td>Training time</td></tr><tr><td>Policy</td><td>8×MI300X</td><td>20 hours</td></tr><tr><td>PPM</td><td>8×MI300X</td><td>15 hours</td></tr></table>
341
+
342
+ Training PPM. The PPM is initialized from the fine-tuned policy model, with its next-token prediction head replaced by a scalar-value head consisting of a linear layer and a tanh function to constrain outputs to the range [-1, 1]. We filter out math problems where all solution trajectories are fully correct or incorrect. For problems with mixed outcomes, we select two positive and two negative examples for each step based on Q-values, which are used as preference pairs for training data.
343
+
344
+ Training the ORM and PQM. The Outcome Reward Model (ORM) and the Q-value-based Process Reward Model (PQM) share the same model architecture and training parameters with and our PPM. For ORM training, we filter trajectories from math problems containing both correct and incorrect solutions. Specifically, the two trajectories with the highest average Q-values are selected as positive examples, while the two with the lowest are chosen as negative examples. Following Qwen2.5-Math (Yang et al., 2024), we adopt the pairwise ranking loss (Ouyang et al., 2022) to optimize the ORM. To train the PQM, we follow (Chen et al., 2024) to use step-level Q-values as reward labels. Let $\mathbf{x} = x\oplus s_1\oplus s_2\oplus \ldots \oplus s_d$ be the trajectory, with annotated Q-values $\mathbf{Q} = (Q(s_{1}),Q(s_{1}),\dots,Q(s_{d}))$ and predicted Q-values $\mathbf{Q}' = (Q'(s_1),Q'(s_1),\dots,Q'(s_d))$ for each step. To stabilize PQM training, we treat each trajectory as a single training sample and predict Q-values for all steps simultaneously, rather than splitting it into individual per-step samples. Specifically, to predict the Q-value $Q^{\prime}(s_i)$ for step $s_i$ , PQM takes the trajectory from the question up to step $s_i$ (i.e., $x\oplus s_1\oplus s_2\oplus \ldots \oplus s_i$ ) as input and outputs a value between -1 and 1. We use a mean squared error (MSE) loss for PQM training:
345
+
346
+ $$
347
+ \mathcal {L} _ {p r m} (\mathbf {x}) = \left\| \mathbf {Q} - \mathbf {Q} ^ {\prime} \right\| ^ {2} \tag {5}
348
+ $$
349
+
350
+ Table 8. Inference costs of rStar-Math. We show the average number of generated tokens required to generate a trajectory for a given question.
351
+
352
+ <table><tr><td>MATH</td><td>AIME 2024</td><td>AMC 2023</td><td>Olympiad Bench</td><td>College Math</td><td>GSM8K</td><td>GaokaoEn 2023</td></tr><tr><td>5453</td><td>15693</td><td>14544</td><td>7889</td><td>4503</td><td>3299</td><td>6375</td></tr></table>
353
+
354
+ Table 9. Pass@1 accuracy of the resulting policy SLM in each round, showing continuous improvement until surpassing the bootstrap model.
355
+
356
+ <table><tr><td>Round#</td><td>MATH</td><td>AIME 2024</td><td>AMC 2023</td><td>Olympiad Bench</td><td>College Math</td><td>GSM8K</td><td>GaokaoEn 2023</td></tr><tr><td>DeepSeek-Coder-V2-Instruct (bootstrap model)</td><td>75.3</td><td>13.3</td><td>57.5</td><td>37.6</td><td>46.2</td><td>94.9</td><td>64.7</td></tr><tr><td>Base (Qwen2.5-Math-7B)</td><td>58.8</td><td>0.0</td><td>22.5</td><td>21.8</td><td>41.6</td><td>91.6</td><td>51.7</td></tr><tr><td>policy SLM-r1</td><td>69.6</td><td>3.3</td><td>30.0</td><td>34.7</td><td>44.5</td><td>88.4</td><td>57.4</td></tr><tr><td>policy SLM-r2</td><td>73.6</td><td>10.0</td><td>35.0</td><td>39.0</td><td>45.7</td><td>89.1</td><td>59.7</td></tr><tr><td>policy SLM-r3</td><td>75.8</td><td>16.7</td><td>45.0</td><td>44.1</td><td>49.6</td><td>89.3</td><td>62.8</td></tr><tr><td>policy SLM-r4</td><td>78.4</td><td>26.7</td><td>47.5</td><td>47.1</td><td>52.5</td><td>89.7</td><td>65.7</td></tr></table>
357
+
358
+ Table 10. The quality of PPM consistently improves across rounds. The policy model has been fixed with policy SLM-r1 for a fair comparison.
359
+
360
+ <table><tr><td>Round#</td><td>MATH</td><td>AIME 2024</td><td>AMC 2023</td><td>Olympiad Bench</td><td>College Math</td><td>GSM8K</td><td>GaokaoEn 2023</td></tr><tr><td>PPM-r1</td><td>75.2</td><td>10.0</td><td>57.5</td><td>35.7</td><td>45.4</td><td>90.9</td><td>60.3</td></tr><tr><td>PPM-r2</td><td>84.1</td><td>26.7</td><td>75.0</td><td>52.7</td><td>54.2</td><td>93.3</td><td>73.0</td></tr><tr><td>PPM-r3</td><td>85.2</td><td>33.3</td><td>77.5</td><td>59.5</td><td>55.6</td><td>93.9</td><td>76.6</td></tr><tr><td>PPM-r4</td><td>87.0</td><td>43.3</td><td>77.5</td><td>61.5</td><td>56.8</td><td>94.2</td><td>77.8</td></tr></table>
361
+
362
+ Inference Setting. In our evaluation, we run multiple MCTS to generate candidate solution trajectories. For each problem, we generate 32 candidate nodes at each step and use the PPM to score each node. Since the PPM is effective at providing step-level quality evaluations, we did not perform multiple MCTS rollouts to update per-step Q-values. After each MCTS finish, we select the trajectory with highest PPM score as the final answer. Table 8 presents the average number of tokens generated to produce a trajectory in MCTS.
363
+
364
+ Self-evolution Inference Costs. In the initial bootstrap round, we use DeepSeek-Coder-v2-Instruct (236B) as the policy model, using 10 nodes of $8 \times 80$ GB H100 GPUs with 8 MCTS rollouts. This required approximately two weeks to finish the
365
+
366
+ data generation. For rounds 2-4, using our fine-tuned 7B SLM as the policy model, data generation was performed on 15 nodes of $4 \times 40$ GB A100 GPUs, with each round completed in three days. In the final round, to include more challenging problems, we increased the number of MCTS rollouts to 64, extending the data generation time to one week.
367
+
368
+ Table 11. Pass@1 accuracy of our fine-tuned policy models for Phi3-mini, Qwen2.5-Math-1.5B, Qwen2-Math-7B and Qwen2.5-Math-7B.
369
+
370
+ <table><tr><td>Model</td><td>MATH</td><td>AIME 2024</td><td>AMC 2023</td><td>Olympiad Bench</td><td>College Math</td><td>GSM8K</td><td>GaokaoEn 2023</td></tr><tr><td colspan="8">General Base Model: Phi3-mini-Instruct (3.8B)</td></tr><tr><td>Phi3-mini-Instruct</td><td>41.4</td><td>3.33</td><td>7.5</td><td>12.3</td><td>33.1</td><td>85.7</td><td>37.1</td></tr><tr><td>Our policy model</td><td>68.0</td><td>10.0</td><td>37.5</td><td>36.6</td><td>48.7</td><td>87.9</td><td>53.2</td></tr><tr><td colspan="8">Math-Specialized Base Model: Qwen2.5-Math-1.5B</td></tr><tr><td>Qwen2.5-Math-1.5B</td><td>51.2</td><td>0.0</td><td>22.5</td><td>16.7</td><td>38.4</td><td>74.6</td><td>46.5</td></tr><tr><td>Qwen2.5-Math-1.5B-Instruct</td><td>60.0</td><td>10.0</td><td>60.0</td><td>38.1</td><td>47.7</td><td>84.8</td><td>65.5</td></tr><tr><td>Our policy model</td><td>74.8</td><td>13.3</td><td>47.5</td><td>42.5</td><td>50.1</td><td>83.1</td><td>58.7</td></tr><tr><td colspan="8">Math-Specialized Base Model: Qwen2-Math-7B</td></tr><tr><td>Qwen2-Math-7B</td><td>53.4</td><td>3.3</td><td>25.0</td><td>17.3</td><td>39.4</td><td>80.4</td><td>47.3</td></tr><tr><td>Qwen2-Math-7B-Instruct</td><td>73.2</td><td>13.3</td><td>62.5</td><td>38.2</td><td>45.9</td><td>89.9</td><td>62.1</td></tr><tr><td>Our policy model</td><td>73.8</td><td>16.7</td><td>45.0</td><td>43.9</td><td>52.0</td><td>88.3</td><td>65.2</td></tr><tr><td colspan="8">Math-Specialized Base Model: Qwen2.5-Math-7B</td></tr><tr><td>Qwen2.5-Math-7B</td><td>58.8</td><td>0.0</td><td>22.5</td><td>21.8</td><td>41.6</td><td>91.6</td><td>51.7</td></tr><tr><td>Qwen2.5-Math-7B-Instruct</td><td>82.6</td><td>6.0</td><td>62.5</td><td>41.6</td><td>46.8</td><td>95.2</td><td>66.8</td></tr><tr><td>Our policy model</td><td>78.4</td><td>26.7</td><td>47.5</td><td>47.1</td><td>52.5</td><td>89.7</td><td>65.7</td></tr></table>
371
+
372
+ ![](images/51cd0e1786ab23cf1fe745e12ac7446ab6ef1cedeab92ee5e352253e6b72e250.jpg)
373
+ Figure 6. Pass@N accuracy with random sampling from different policy models. Compared to the official Qwen instruct version, our policy model exhibits a stronger ability to sample correct solutions.
374
+
375
+ Pass@N. Table 11 compares the math reasoning performance of our policy models with the instruct versions developed by the original model team. Our policy models do not consistently outperform the instruct versions. For example, on the Qwen2.5-Math-7B base model, Qwen2.5-Math-7B-Instruct achieves $4.2\%$ higher accuracy on the MATH benchmark. However, the pass@1 accuracy alone does not fully reflect the reasoning capabilities for the policy model in System 2 deep thinking paradigm. To provide a more comprehensive evaluation, Fig.6 and Fig.7 present the pass@N accuracy. In this metric, the policy model generates $N$ solutions under two settings: random sampling (Fig.6) and PPM-augmented MCTS deep thinking (Fig.7). A problem is considered solved if one solution is correct. As shown in Figure 6, our policy model performs similarly to Qwen2.5-Math-7B-Instruct on the MATH benchmark's pass@64 and significantly outperforms it on others. This suggests that despite initial pass@1 accuracy differences, our policy model can generate correct solutions through multiple samples. Figure 7 further compares the pass@N accuracy of our four policy models (different sizes) after MCTS deep thinking under the same PPM guidance. We can observe that after generating 64 trajectories, the pass@N accuracy of different policy models becomes comparable.
376
+
377
+ Ablation on the MCTS search parameters. We perform additional analysis on the number of candidate nodes per step in MCTS. As shown in Table 12, increasing the number of candidate nodes generally improves accuracy, but beyond 32 nodes, performance saturates.
378
+
379
+ ![](images/8c88d10f71bae97b4f532cebc3c5b76515fbcfdae3355ba74322e6009c321da7.jpg)
380
+ Figure 7. Pass@N accuracy with PPM-augmented MCTS. Under the same PPM guidance, the four policy models of varying sizes demonstrate convergent capabilities in sampling correct solutions.
381
+
382
+ Table 12. Ablation study on the number of candidate nodes in MCTS.
383
+
384
+ <table><tr><td></td><td colspan="2">MATH-500</td><td colspan="2">AIME 2024</td></tr><tr><td></td><td>8 rollouts</td><td>64 rollouts</td><td>8 rollouts</td><td>64 rollouts</td></tr><tr><td>node=4</td><td>87.2</td><td>88.8</td><td>33.3</td><td>36.7</td></tr><tr><td>node=8</td><td>87.2</td><td>88.8</td><td>33.3</td><td>43.3</td></tr><tr><td>node=16</td><td>88.4</td><td>89.0</td><td>36.7</td><td>50.0</td></tr><tr><td>node=32</td><td>89.4</td><td>89.0</td><td>50.0</td><td>53.3</td></tr><tr><td>node=40</td><td>89.4</td><td>90.0</td><td>46.7</td><td>53.3</td></tr></table>
385
+
386
+ # A.3 Examples of Reasoning Trajectories
387
+
388
+ # Self-correction Example
389
+
390
+ Question: The coordinates of a parallelogram are (5, 3), (6, 8), (7, 4) and $(x,y)$ and $x > 7$ . What is the value of $x + y$
391
+
392
+ # Our trajectory:
393
+
394
+ < code >
395
+
396
+ # Import necessary libraries
397
+
398
+ import numpy as np
399
+
400
+ <end_of_step>
401
+
402
+ Define the coordinates of the parallelogram
403
+
404
+ A = np.array([5, 3])
405
+
406
+ B = np.array([6, 8])
407
+
408
+ C = np.array([7, 4])
409
+
410
+ <end_of_step>
411
+
412
+ Calculate the vector differences to find the missing coordinate D
413
+
414
+ # In a parallelogram, the vector difference between two adjacent sides is equal to the vector difference between the other two adjacent sides
415
+
416
+ We can use the formula: $\mathrm{D} = \mathrm{A} + (\mathrm{C} - \mathrm{B})$
417
+
418
+ $\mathrm{D} = \mathrm{A} + (\mathrm{C} - \mathrm{B})$
419
+
420
+ <end_of_step>
421
+
422
+ Since the coordinates provided are (5, 3), (6, 8), (7, 4) and (x, y), we can infer that the vector from B to C should be the same as the vector from A to the missing point (x, y)
423
+
424
+ This means: $(\mathrm{x - 5},\mathrm{y - 3}) = (1, - 4)$ because the vector from B to C is $(7 - 6,4 - 8) = (1, - 4)$
425
+
426
+ Solve for x and y
427
+
428
+ $\mathrm{x} = 5 + 1$
429
+
430
+ y $= 3 + (-4)$
431
+
432
+ <end_of_step>
433
+
434
+ Verify that the point $(\mathbf{x},\mathbf{y})$ exists and satisfies the condition $\mathrm{x}$ 7
435
+
436
+ Since $x = 6$ is not greater than 7, we need to use the correct formula that maintains the parallelogram property and $x$
437
+
438
+ # Correcting the formula to find the other possible D [Self-correction!]
439
+
440
+ $\mathrm{D} = \mathrm{C} + (\mathrm{B} - \mathrm{A})$
441
+
442
+ <end_of_step>
443
+
444
+ Solve for $x$ and $y$ again
445
+
446
+ $\mathrm{x} = 7 + (6 - 5)$
447
+
448
+ y = 4 + (8 - 3)
449
+
450
+ <end_of_step>
451
+
452
+ Verify that the point $(\mathrm{x},\mathrm{y})$ exists and satisfies the condition $\mathrm{x}\dot{\zeta} 7$
453
+
454
+ Since $x = 8$ is greater than 7, which satisfies the condition given, we can now find the sum of $x$ and $y$
455
+
456
+ x-plus_y=x+y
457
+
458
+ <end_of_step>
459
+
460
+ Now print the final answer
461
+
462
+ print(x_plus_y)
463
+
464
+ This should print the value of $x + y$
465
+
466
+ <end-of_code>
467
+
468
+ <output>17 <end_of_output>
469
+
470
+ <answer>The value of $\mathbf{x} + \mathbf{y}$ is $\boxed{17}$ < end_of_answer >
471
+
472
+ # Math statement proof using Fermat's little theorem
473
+
474
+ Question: If ( pt+a ) is a perfect square for some value of ( t ) , then ( a $\frac{p - 1}{2} - 1$ ) is divisible by ( p ) (where ( p ) is a prime number).
475
+
476
+ # Our trajectory for proving:
477
+
478
+ $< \text{code}>$
479
+
480
+ Step 1: Define the variables
481
+
482
+ from sympy import symbols, isprime, sqrt, modInverse
483
+
484
+ Define the variables
485
+
486
+ p,t,a $=$ symbols('p t a')
487
+
488
+ <end_of_step>
489
+
490
+ Step 2: Assume $\mathrm{p}^{*}\mathrm{t} + \mathrm{a}$ is a perfect square
491
+
492
+ This means there exists an integer $k$ such that $p^* t + a = k^2$ .
493
+
494
+ Rearrange to find a in terms of p, t, and k
495
+
496
+ a = k² - p* t
497
+
498
+ <end_of_step>
499
+
500
+ # Step 3: Use Fermat's Little Theorem
501
+
502
+ Fermat's Little Theorem states that if $p$ is a prime and $a$ is an integer not divisible by $p$ ,
503
+
504
+ then $\mathrm{a}^{(p - 1)} \equiv 1 (\mathrm{mod} \mathrm{p})$
505
+
506
+ We need to show that $\mathbf{a}^{((p - 1) / 2)} - 1$ is divisible by $p$ .
507
+
508
+ <end_of_step>
509
+
510
+ Step 4: Substitute $\mathrm{a} = \mathrm{k}^2 - \mathrm{p}^*\mathrm{t}$ into Fermat's Little Theorem
511
+
512
+ $\mathbf{a}^{((p - 1) / 2)} \equiv (\mathrm{k}^2 - \mathrm{p}^*\mathrm{t})^{((p - 1) / 2)} \pmod{\mathrm{p}}$
513
+
514
+ Since $\mathrm{p}^*\mathrm{t}$ is divisible by $\mathfrak{p}$ , $(\mathrm{k}^2 -\mathrm{p}^*\mathrm{t})^{((p - 1) / 2)}\equiv \mathrm{k}^{(p - 1)}$ (mod p)
515
+
516
+ By Fermat's Little Theorem, $\mathrm{k}^{(p - 1)}\equiv 1$ (mod p)
517
+
518
+ <end_of_step>
519
+
520
+ Step 5: Therefore, $\mathfrak{a}^{((p - 1) / 2)} \equiv 1$ (mod p)
521
+
522
+ This implies $\mathfrak{a}^{((p - 1) / 2)} - 1 \equiv 0 \, (\mathrm{mod} \, \mathfrak{p})$ .
523
+
524
+ Hence, $\mathrm{a}^{((p - 1) / 2)} - 1$ is divisible by $p$
525
+
526
+ <end_of_step>
527
+
528
+ Now print the final answer
529
+
530
+ print("The expression $\mathrm{a}^{((p - 1) / 2)} - 1$ is divisible by p.")
531
+
532
+ <end_of_code>
533
+
534
+ <output>
535
+
536
+ The expression $a^{((p - 1) / 2)} - 1$ is divisible by $p$ .
537
+
538
+ The statement is true.
539
+
540
+ <end_of_output>
541
+
542
+ # Problem-solving with application of the Vieta's formulas and the AM-GM inequality
543
+
544
+ Question: Let $a$ be a positive real number such that all the roots of
545
+
546
+ $$
547
+ x ^ {3} + a x ^ {2} + a x + 1 = 0
548
+ $$
549
+
550
+ are real. Find the smallest possible value of $a$ .
551
+
552
+ # Our trajectory for proving:
553
+
554
+ code
555
+
556
+ Step 1: Define the polynomial equation
557
+
558
+ from sympy import symbols, solve, Eq
559
+
560
+ Define the variable and the parameter
561
+
562
+ x, a = symbols('x a')
563
+
564
+ < end_of_step >[PPM Score: -0.46430]
565
+
566
+ Step 2: Define the polynomial equation
567
+
568
+ polynomial = x**3 + a*x**2 + a*x + 1
569
+
570
+ < end-of_step >[PPM Score: 0.53937]
571
+
572
+ Step 3: Use Vieta's formulas to relate the coefficients to the roots
573
+
574
+ Since the polynomial is monic (leading coefficient is 1), the sum of the roots (taken one at a time) is -a
575
+
576
+ The sum of the products of the roots taken two at a time is a
577
+
578
+ The product of the roots is -1
579
+
580
+ Since all roots are real, we can denote them as r1, r2, r3
581
+
582
+ From Vieta's formulas:
583
+
584
+ $\mathrm{r1 + r2 + r3 = -a}$
585
+
586
+ $\mathrm{r1^{*}r2 + r2^{*}r3 + r3^{*}r1 = a}$
587
+
588
+ r1\*r2\*r3=-1
589
+
590
+ < end_of_step >[PPM Score: 0.9989]
591
+
592
+ Step 4: Use the AM-GM inequality to find the minimum value of a
593
+
594
+ By AM-GM, $(\mathrm{r1}^{*}\mathrm{r2} + \mathrm{r2}^{*}\mathrm{r3} + \mathrm{r3}^{*}\mathrm{r1}) / 3 > = (\mathrm{r1}^{*}\mathrm{r2}^{*}\mathrm{r3})^{(2 / 3)}$
595
+
596
+ Substituting the known values:
597
+
598
+ $\mathrm{a} / 3 > = (-1)^{(2 / 3)}$
599
+
600
+ a/3>=1
601
+
602
+ a $> = 3$
603
+
604
+ $<$ end_of_step $>$ [PPM Score: 0.9999]
605
+
606
+ Step 5: Verify if $a = 3$ is achievable
607
+
608
+ If $\mathrm{a} = 3$ , then $\mathrm{r1} + \mathrm{r2} + \mathrm{r3} = -3$ and $\mathrm{r1}^* \mathrm{r2} + \mathrm{r2}^* \mathrm{r3} + \mathrm{r3}^* \mathrm{r1} = 3$
609
+
610
+ We need to check if there exist real roots that satisfy these conditions
611
+
612
+ Consider the case where $r1 = r2 = r3 = -1$
613
+
614
+ Then $\mathrm{r}1 + \mathrm{r}2 + \mathrm{r}3 = -3$ and $\mathrm{r}1^{*}\mathrm{r}2 + \mathrm{r}2^{*}\mathrm{r}3 + \mathrm{r}3^{*}\mathrm{r}1 = 3$ , and $\mathrm{r}1^{*}\mathrm{r}2^{*}\mathrm{r}3 = -1$
615
+
616
+ Thus, $a = 3$ is achievable with real roots
617
+
618
+ < end_of_step >[PPM Score: 1.0]
619
+
620
+ Step 6: Print the final answer print(3)
621
+
622
+ <end_of_code>
623
+
624
+ $<\text{output}>3 < \text{end\_of\_output}>$
625
+
626
+ <answer>The smallest possible value of a is $\boxed{3}$ .
627
+
628
+ <end_of_answer>
629
+
630
+ Problem-solving with application the Shoelace Theorem
631
+ Question: In the diagram, $D$ and $E$ are the midpoints of $\overline{AB}$ and $\overline{BC}$ respectively. Determine the area of quadrilateral DBEF. [asy] size(180); defaultpen(lenwidth(.7pt)+fontsize(10pt)); pair A, B, C, D, E, F; A=(0,6); B=(0,0); C=(8,0); D=(0,3); E=(4,0); F=(8/3,2); draw(E-A-C-D); draw(-1,0)-(10,0), EndArrow); draw((0,-1)-(0,8), EndArrow); label("A(0,6)", A, W); label("B(0,0)", B, SW); label("C(8,0)", C, S); label("D", D, W); label("E", E, S); label("F", F, SW); label("x", (10,0), dir(0)); label("y", (0,8), dir(90)); [/asy]
632
+ Our trajectory for proving:
633
+ $< \mathrm{code}>$
634
+ # Step 1: Define the coordinates of points A, B, C, D, and E
635
+ A = (0, 6)
636
+ B = (0, 0)
637
+ C = (8, 0)
638
+ D = (0, 3) # Midpoint of AB
639
+ E = (4, 0) # Midpoint of BC
640
+ $< \mathrm{end\_of\_step}>$ [PPM Score: -0.76639]
641
+ # Step 2: Define the coordinates of point F using the section formula (known to be (8/3, 2))
642
+ F = (8/3, 2)
643
+ $< \mathrm{end\_of\_step}>$ [PPM Score: 0.8429]
644
+ # Step 3: Use the Shoelace Theorem to find the area of quadrilateral DBEF
645
+ # Shoelace Theorem formula: Area = 0.5 * x1y2 + x2y3 + x3y4 + x4y1 - (y1x2 + y2x3 + y3x4 + y4x1)
646
+ # Coordinates of D, B, E, F are (0, 3), (0, 0), (4, 0), (8/3, 2) respectively
647
+ x1 , y1 = D
648
+ x2 , y2 = B
649
+ x3 , y3 = E
650
+ x4 , y4 = F
651
+ area = 0.5 * abs(x1*y2 + x2*y3 + x3*y4 + x4*y1 - (y1*x2 + y2*x3 + y3*x4 + y4*x1))
652
+ $< \mathrm{end\_of\_step}>$ [PPM Score: 0.9972]
653
+ # Step 4: Print the area of quadrilateral DBEF
654
+ print (area)
655
+ $< \mathrm{end\_of\_code}>$ $< output>8.0 < end\_of\_output>$ $< answer>\boxed{8}< end\_of\_answer>$
656
+
657
+ # A.4 Prompt Examples
658
+
659
+ MCTS Prompt for DeepSeek-V2-Coder-Instruct (bootstrap round)
660
+
661
+ You are a powerful agent with broad math knowledge and great python programming skills. You need to use python interpreter to do accurate calculation on math equations.
662
+
663
+ !!! Remember:
664
+
665
+ 1. Use code solve the problem step by step. The solution should include three parts: $<$ code $>$ , $<$ output $>$ , and $<$ answer $>$ .
666
+ 2. All calculations should be done in python code. Provide concise reasoning and thinking in the comments of the code.
667
+ 3. The most related python packages include 'math', 'sympy', 'scipy', and 'numpy'.
668
+ 4. Please use the following template:
669
+
670
+ Question: the input question
671
+
672
+ < code >Construct the code step by step. Use < end_of_step > to indicate the end of each step. Ensure your code can execute correctly(excluding < end_of_step >) and print the answer. Avoid undefined variables (NameError), unimported packages, or formatting errors (SyntaxError, TypeError). In the last step of the code, print the final answer and add a comment: Now print the final answer.< end_of_code >
673
+
674
+ $<$ output $>$ Execute the code in using the Python interpreter and display the printed results. $<$ end_of_output $>$
675
+
676
+ < answer >The concise answer without verbose context, put your final answer's numerical part (without unit, only focus on the numerical part if it's a choice question) in
677
+
678
+ boxed.< end_of_answer > Now! It's your turn.
679
+
680
+ Question: {input}
681
+
682
+ The following are 2 demonstration examples:
683
+
684
+ Question: Terrell usually lifts two 20-pound weights 12 times. If he uses two 15-pound weights instead, how many times must Terrell lift them in order to lift the same total weight?
685
+
686
+ $< \text{code}>$
687
+
688
+ Step 1: Calculate the total weight lifted with two 20-pound weights
689
+
690
+ total_weight_20 = 2 * 20 * 12
691
+
692
+ <end_of_step>
693
+
694
+ Step 2: Calculate the weight lifted per repetition with two 15-pound weights
695
+
696
+ weight_per_rep_15 = 2 * 15
697
+
698
+ <end-of_step>
699
+
700
+ Step 3: Calculate the number of repetitions needed to lift the same total weight with two 15-pound weights
701
+
702
+ reps_needed = total_weight_20 / weight_per_rep_15
703
+
704
+ <end-of_step>
705
+
706
+ Now print the final answer
707
+
708
+ print(reps_needed)
709
+
710
+ <end_of_code>
711
+
712
+ $<$ output $>16.0 <$ end_of_output $>$ < answer >From the result, we can see that Terrell must lift the 15-pound weights
713
+
714
+ boxed16 times to lift the same total weight.
715
+
716
+ < end_of_answer >,
717
+
718
+ Question: Find the value of $x$ that satisfies $\frac{\sqrt{3x + 5}}{2} = \frac{\sqrt{5}}{2}$ . Express your answer as a common fraction.
719
+
720
+ <code>
721
+
722
+ from sympy import symbols, Eq, solve, sqrt
723
+
724
+ Define the variable x
725
+
726
+ $\mathbf{x} =$ symbols('x')
727
+
728
+ <end-of_step>
729
+
730
+ Define the equation
731
+
732
+ equation $= \mathrm{Eq}(\mathrm{sqrt}(3^{*}\mathrm{x} + 5) / \mathrm{sqrt}(6^{*}\mathrm{x} + 5),\mathrm{sqrt}(5) / 3)$
733
+
734
+ <end-of_step>
735
+
736
+ Solve the equation for $x$
737
+
738
+ solution $=$ solve(equation, x)
739
+
740
+ <end-of_step>
741
+
742
+ Now print the final answer
743
+
744
+ print解决问题)
745
+
746
+ <end_of_code>
747
+
748
+ $<$ output $>$ [20/3]
749
+
750
+ $<$ end_of_output $>$ < answer $>$ From the result, we can see that the value of x is
751
+
752
+ <end_of_answer>
753
+
754
+ MCTS Prompt for our policy SLM
755
+ ```txt
756
+ MCTS prompt for next step generation:
757
+ <|user|>:
758
+ {input question}
759
+ <|assistant|>: Let's think step by step and solve the problem with code. {trajectory of previous steps}
760
+ SFT Prompt Example:
761
+ <|user|>:
762
+ How many numbers can you get by multiplying two or more distinct members of the set 1, 2, 3, 5, 11 together?
763
+ <|assistant|>: Let's think step by step and solve the problem with code. <code>
764
+ # Step 1: Create the set of numbers
765
+ numbers = {1, 2, 3, 5, 11}
766
+ <end_of_step>
767
+ # Step 2: Define a function to generate all possible products of two or more distinct members of the set
768
+ from itertools import combinations
769
+ def generate_products (numbers):
770
+ products = set()
771
+ for r in range(2, len(numbers) + 1):
772
+ # For combinations of 2, 3, 4, and 5 elements
773
+ for combo in combinations(numbers, r):
774
+ product = 1
775
+ for num in combo:
776
+ product *= num
777
+ products.add/product)
778
+ return products
779
+ </end_of_step>
780
+ # Step3: Calculate the productsize-products (numbers)
781
+ <end_of_step>
782
+ # Step 4: Calculate the number of unique products
783
+ num_unique-products = len(unique-products)
784
+ </end_of_step>
785
+ # Now print the final answer
786
+ print(num_unique-products)
787
+ <end_of_code>
788
+ <output>15</end_of_output>
789
+ <answer>From the result, we can see that there are 15 unique products.
790
+ </end_of_answer>
791
+ ```
rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1852cf1395f9478e7e278d8c7ab8c1b09368f48c5d32bdf40f9c8bc2568c6a8
3
+ size 983265
rstarmathsmallllmscanmastermathreasoningwithselfevolveddeepthinking/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ec0d2d0579140e04fdc0e8918e636499bd6fe35a569cabe3b119179989ec0ca
3
+ size 797338
scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/48fbbc80-0e7b-4115-954d-1fc9c1c533d4_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57e2024e4d7ac30a7fff9579bdbd3b7beab96f0568c727efc116157f5f0bd80b
3
+ size 125181
scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/48fbbc80-0e7b-4115-954d-1fc9c1c533d4_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bd2178cad0292dfdb19d8cb1ff9c4576ee5d82bb7bcf0ae2a1569d910d869b9
3
+ size 147072
scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/48fbbc80-0e7b-4115-954d-1fc9c1c533d4_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b62009b56373b68993bc400a54a37c562aed52023d7ab98803189aa1313a3bf6
3
+ size 8297401
scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/full.md ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # sciLaMA: A Single-Cell Representation Learning Framework to Leverage Prior Knowledge from Large Language Models
2
+
3
+ Hongru Hu $^{12}$ Shuwen Zhang $^{3}$ Yongin Choi $^{12}$ Venkat S. Malladi $^{4}$ Gerald Quon $^{12}$
4
+
5
+ # Abstract
6
+
7
+ Single-cell RNA sequencing (scRNA-seq) enables high-resolution exploration of cellular diversity and gene regulation, yet analyzing such data remains challenging due to technical and methodological limitations. Existing task-specific deep generative models like Variational AutoEncoder (VAE) and its variants struggle to incorporate external biological knowledge, while transformer-based foundational large Language Models (LLMs or large LaMs) face limitations in computational cost and applicability to tabular gene expression data. Here, we introduce sciLama (single-cell interpretable Language Model Adapter), a novel representation learning framework that bridges these gaps by integrating static gene embeddings from multimodal LLMs with scRNA-seq tabular data through a paired-VAE architecture. Our approach generates context-aware representations for both cells and genes and outperforms state-of-the-art methods in key single-cell downstream tasks, including batch effect correction, cell clustering, and cell-state-specific gene marker and module identification, while maintaining computational efficiency. sciLama offers a computationally efficient, unified framework for comprehensive single-cell data analysis and biologically interpretable gene module discovery. Source code is available at https://github.com/microsoft/sciLaMA
8
+
9
+ *Equal contribution $^{1}$ Department of Molecular and Cellular Biology, University of California, Davis, CA USA $^{2}$ Genome Center, University of California, Davis, CA USA $^{3}$ Department of Quantitative Health Sciences, Mayo Clinic, Rochester, MN USA $^{4}$ Health Futures, Microsoft Research, Redmond, WA USA. Correspondence to: Hongru Hu <hrhu@ucdavis.edu>, Venkat S. Malladi <vmalladi@microsoft.com>, Gerald Quon <gquan@ucdavis.edu>.
10
+
11
+ Proceedings of the $42^{nd}$ International Conference on Machine Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).
12
+
13
+ # 1. Introduction
14
+
15
+ Single-cell RNA sequencing (scRNA-seq) has revolutionized studies of cellular heterogeneity and transcriptome dynamics by providing gene expression profiles at single-cell resolution. Deep generative models, particularly Variational Autoencoders (VAE) (Kingma & Welling, 2014) and its variants, have become widely used for analyzing scRNA-seq data, which enable dimensionality reduction and representation learning by projecting cells from high-dimensional gene spaces to lower-dimensional embedding spaces (Gronbech et al., 2020; Lopez et al., 2018). These cell embeddings facilitate downstream tasks such as cell clustering, trajectory inference, and differential expression analysis (Chen et al., 2021; Kana et al., 2023; Yan et al., 2023). VAE's nonlinear representation capabilities allow them to effectively model complex cellular landscapes, making them well-suited for tabular data like gene expression matrices. However, scRNA-seq analysis remains challenging due to technical noise, sparse measurements, and batch effects, which often obscure true biological signals (Lähnemann et al., 2020). Incorporating external prior knowledge of genes, such as their functional annotations or molecular sequence data, has the potential to mitigate these challenges. However, the representation of input gene expression data as fixed-length vectors in traditional VAEs such as scVI-tools (Lopez et al., 2018) is not directly compatible with the different representations of prior gene knowledge, such as variable-length molecular sequences or text descriptions. This prevents prior gene knowledge from being directly incorporated into traditional VAE architectures.
16
+
17
+ Large Language Models (LLMs), on the other hand, have emerged as powerful tools for learning gene representations from various sources, including literature-based textual descriptions (Chen & Zou, 2024; Liu et al., 2023), molecular sequences (Elnaggar et al., 2022; Lin et al., 2023), and large-scale expression atlases (Cui et al., 2024; Theodoris et al., 2023). These models encode sequential data through tokenization and transformer architectures to create static gene embeddings that capture rich biological information. However, LLMs also face challenges: they are computationally expensive to train and inherently less suited for processing tabular data such as gene expression matrices, where VAEs
18
+
19
+ demonstrate superior performance (Kedzierska et al., 2023).
20
+
21
+ To bridge the complementary strengths of VAEs and LLMs, we propose sciLaMA (single cell interpretable Language Model Adapter), a novel representation learning framework that extends the siVAE (Choi et al., 2023) architecture to integrate precomputed static gene embeddings from pretrained multimodal LLMs with scRNA-seq tabular data. By combining the representation power of VAEs with the adaptable and knowledge-rich embeddings of LLMs, our approach projects static gene information into context-aware representations by aligning each dimension of gene and cell latent space within the unified paired-VAE framework (Section 3). This approach presents a unified framework that improves over state of the art methods in single-cell analysis in three tasks: (1) cell representation learning and batch effect correction, (2) gene expression imputation, and (3) discovery of biologically meaningful gene modules and cell-state-specific regulatory dynamics, all while maintaining computational efficiency.
22
+
23
+ Contributions: (1) We introduce a novel framework that incorporates external gene knowledge from pretrained LLMs with scRNA-seq data, facilitating context-aware cell and gene representation learning. (2) We demonstrate that our approach reduces computational requirements while improving performance compared to existing state-of-the-art methods across various single-cell tasks.
24
+
25
+ # 2. Related work
26
+
27
+ Deep generative approaches for single cell analysis. Deep generative models, particularly those based on variational autoencoders (VAEs), have advanced single-cell RNA sequencing (scRNA-seq) analysis. Methods such as scVI tools learn low-dimensional cell embeddings for cell-centric tasks such as visualization, clustering, and batch correction. Researchers have also further utilized feature attribution techniques to identify important genes in specific cell populations and infer gene modules (Janizek et al., 2023) by leveraging the learned cell embeddings. However, these approaches primarily focus on cell representations without inferring gene representations, and pipelines leveraging other tools are needed for gene-centric analyses such as marker identification and gene network discovery. To address this limitation, siVAE (Choi et al., 2023) introduced a unified framework for learning both cell and gene representations, enabling direct gene-centric analyses using the gene representations and therefore eliminating the need for explicit gene module inference via external tools. However, siVAE gene representation learning involves training an encoder whose number of input nodes scales with the number of cells, thus limiting its applications to large datasets. Moreover, scVI, siVAE, and most other VAE methods do not integrate external knowledge into scRNA-seq analysis due
28
+
29
+ to the representational challenges discussed above. Methods such as GLUE (Cao & Gao, 2022) incorporate external information about regulatory interactions among features in the form of feature variables, however, such approaches struggle to utilize information such as molecular sequences or natural language descriptions of genes.
30
+
31
+ Single-cell foundation language models. Transformer-based large language models (LLMs) have recently been applied for single-cell data analysis. Unlike VAE-based methods, which treat scRNA-seq data as a cell-by-gene matrix, models such as scGPT (Cui et al., 2024) represent expression profiles as sequences of tokens, drawing similarities to natural language and demonstrating a novel way to represent single-cell data. However, despite their promise, single-cell LLMs exhibit certain limitations. Their performance in zero-shot scenarios is often unreliable, and finetuning them requires extensive computational resources and technical expertise compared to task-specific small models (Kedzierska et al., 2023). These drawbacks emphasize the need for approaches that are computationally efficient and capable of bridging foundational knowledge with real-world single-cell tasks.
32
+
33
+ Applications of static gene embeddings in single-cell analysis. Gene embeddings derived from non-single-cell biological data modalities can complement information derived from single-cell data analysis. For instance, precomputed gene embeddings from protein language models (PLMs), such as ESM and ProtTrans (Elnaggar et al., 2022; Lin et al., 2023), capture gene molecular properties and have been applied in frameworks like SATURN (Rosen et al., 2024) to identify conserved master regulatory genes across species. Similarly, models such as GenePT (Chen & Zou, 2024) and scELMo (Liu et al., 2023) use embeddings derived from textual descriptions of gene functions and biological pathways via natural language models such as OpenAI text-embedding model (OpenAI, 2022). These applications demonstrate the feasibility of incorporating external static gene embeddings from various modalities into single-cell analysis frameworks. By integrating such embeddings, researchers are able to improve the robustness of single-cell analysis, facilitate gene module characterization, and uncover regulatory dynamics.
34
+
35
+ # 3. Methods
36
+
37
+ Conceptually, sciLaMA is an adapter framework that integrates pretrained gene embeddings from LLMs of different modalities, and tailors them for downstream single-cell analyses. Instead of learning gene representations de novo, sciLaMA adapts and contextualizes these precomputed static gene embeddings by incorporating context specific cell-level data (cell-by-gene expression matrix). In this section, we detail the technical components of the sciLaMA framework
38
+
39
+ and its application to single-cell analysis.
40
+
41
+ # 3.1. Input data processing and notation
42
+
43
+ The sciLaMA framework requires two inputs: (1) A set of gene expression inputs $\{c_i\}_{i = 1}^N$ , representing scRNA-seq data for $N$ cells (scaled log-normalized expression) drawn from a specific cell population. Each of the $N$ cell vectors $c_{i}$ has $M$ measurements corresponding to individual genes. (2) Static gene embeddings $\{g_j\}_{j = 1}^M$ , derived from a single pretrained language model (LaM). These embeddings provide $D$ -dimensional representations of $M$ genes, capturing their properties derived from external prior knowledge, where the number $D$ depends on the embedding dimensionality of the specific LLM.
44
+
45
+ # 3.2. sciLaMA architecture
46
+
47
+ sciLaMA is based on a paired encoder-decoder design, inspired by siVAE (Choi et al., 2023), a interpretable deep generative model that jointly learns sample (cell) and feature (gene) embeddings using a paired VAE design. siVAE only uses scRNA-seq data to learn both sets of embeddings, whereas sciLaMA uses external data to inform gene embeddings. sciLaMA consists of two encoder-decoders: one for cells and one for genes (Figure 1a).
48
+
49
+ # 3.2.1. CELL ENCODER AND DECODER
50
+
51
+ The cell encoder $f_{\phi^{\mathrm{cell}}}^{\mathrm{cell}}(\cdot)$ projects each cell $i$ 's expression profile $c_i$ , represented as an $M$ -dimensional gene expression vector, to parameters of a $K$ -dimensional variational posterior distribution with mean $\pmb{\mu}_i^{\mathrm{cell}} \in \mathbb{R}^k$ and variance $(\pmb{\sigma}_i^{\mathrm{cell}})^2 \in \mathbb{R}^k$ . A latent embedding $z_i^{\mathrm{cell}}$ is sampled via the reparameterization trick:
52
+
53
+ $$
54
+ \begin{array}{l} \left(\boldsymbol {\mu} _ {i} ^ {\text {c e l l}}, \boldsymbol {\sigma} _ {i} ^ {\text {c e l l}}\right) \leftarrow f _ {\phi^ {\text {c e l l}}} ^ {\text {c e l l}} (\boldsymbol {c} _ {i}) \\ \boldsymbol {z} _ {i} ^ {\text {c e l l}} = \boldsymbol {\mu} _ {i} ^ {\text {c e l l}} + \epsilon \odot \exp \left(0. 5 \cdot \log \left(\sigma_ {i} ^ {\text {c e l l}}\right) ^ {2}\right) (1) \\ \boldsymbol {h} _ {i} ^ {\text {c e l l}} = g _ {\psi^ {\text {c e l l}}} ^ {\text {c e l l}} \left(\boldsymbol {z} _ {i} ^ {\text {c e l l}}\right) (2) \\ \end{array}
55
+ $$
56
+
57
+ where $\epsilon \sim \mathcal{N}(\mathbf{0},\mathbf{I})$ and $\odot$ denotes element-wise multiplication. $g_{\psi^{\mathrm{cell}}}^{\mathrm{cell}}(\cdot)$ represents the cell decoder without a conventional final linear transformation layer, and outputs $h_i^{\mathrm{cell}}\in \mathbb{R}^l$ for cell $i$ .
58
+
59
+ # 3.2.2. GENE ENCODER AND DECODER
60
+
61
+ Similarly, the gene encoder $f_{\phi^{\mathrm{gene}}}^{\mathrm{gene}}(\cdot)$ maps each gene $j$ 's external static embedding $g_j \in \mathbb{R}^D$ , derived from a pretrained LLM, into the contextual embedding space by predicting the parameters of a $K$ -dimensional variational posterior distribution with mean $\pmb{\mu}_j^{\mathrm{gene}} \in \mathbb{R}^k$ and variance $(\pmb{\sigma}_j^{\mathrm{gene}})^2 \in \mathbb{R}^k$ . The gene-level decoder $g_{\psi^{\mathrm{gene}}}^{\mathrm{gene}}(\cdot)$ is then used to produce
62
+
63
+ output $h_j^{\mathrm{gene}}$ ..
64
+
65
+ $$
66
+ \begin{array}{l} \left(\boldsymbol {\mu} _ {j} ^ {\text {g e n e}}, \boldsymbol {\sigma} _ {j} ^ {\text {g e n e}}\right) \leftarrow f _ {\phi^ {\text {g e n e}}} ^ {\text {g e n e}} (\boldsymbol {g} _ {j}) \\ \boldsymbol {z} _ {j} ^ {\text {g e n e}} = \boldsymbol {\mu} _ {j} ^ {\text {g e n e}} + \epsilon \odot \exp \left(0. 5 \cdot \log \left(\sigma_ {j} ^ {\text {g e n e}}\right) ^ {2}\right) (3) \\ \boldsymbol {h} _ {j} ^ {\text {g e n e}} = g _ {\psi^ {\text {g e n e}}} ^ {\text {g e n e}} \left(\boldsymbol {z} _ {j} ^ {\text {g e n e}}\right) (4) \\ \end{array}
67
+ $$
68
+
69
+ # 3.2.3. SCILAMA RECONSTRUCTION OUTPUT
70
+
71
+ Similar to the siVAE framework (Choi et al., 2023), the output of sciLaMA is the reconstruction of the single cell expression data for gene $j$ in cell $i$ , denoted as $\hat{c}_{i,j}$ , via combining the respective cell and gene decoder outputs $h_i^{\mathrm{cell}}$ and $h_j^{\mathrm{gene}}$ :
72
+
73
+ $$
74
+ \hat {c} _ {i, j} = \left(\boldsymbol {h} _ {i} ^ {\text {c e l l}}\right) ^ {T} \times \boldsymbol {h} _ {j} ^ {\text {g e n e}} + b _ {j} \tag {5}
75
+ $$
76
+
77
+ # 3.3. Optimization
78
+
79
+ The optimization of the sciLaMA framework involves a stepwise training procedure designed for representation learning of both cells and genes (Appendix B), and the training objectives follow the evidence lower bound (ELBO) framework, combining reconstruction accuracy and regularization via Kullback-Leibler (KL) divergence.
80
+
81
+ Step 1: Pretraining the Cell Encoder and Decoder: We first pretrain the weights of the cell encoder and decoder $(\phi^{\mathrm{cell}}$ and $\psi^{\mathrm{cell}}$ , respectively) by treating the encoder-decoder as a VAE, where the objective function focuses on matching cell decoder outputs $h_i^{\mathrm{cell}}$ to the original expression vectors $c_{i}$ via a linear transformation with parameters $W^{\mathrm{cell}} \in \mathbb{R}^{l \times M}$ and $\pmb{b}$ . The loss function $\mathcal{L}_{\mathrm{cell}}$ for this step is defined as:
82
+
83
+ $$
84
+ \hat {\boldsymbol {c}} _ {i} ^ {\text {c e l l r e c o n}} = \left(\boldsymbol {h} _ {i} ^ {\text {c e l l}}\right) ^ {T} \times \boldsymbol {W} ^ {\text {c e l l}} + \boldsymbol {b} \tag {6}
85
+ $$
86
+
87
+ $$
88
+ \mathcal {L} _ {i} ^ {\text {c e l l r e c o n}} = \left(\boldsymbol {c} _ {i} - \hat {\boldsymbol {c}} _ {i} ^ {\text {c e l l r e c o n}}\right) ^ {T} \left(\boldsymbol {c} _ {i} - \hat {\boldsymbol {c}} _ {i} ^ {\text {c e l l r e c o n}}\right) \tag {7}
89
+ $$
90
+
91
+ $$
92
+ \mathcal {L} _ {\text {c e l l}} = \sum_ {i} \mathcal {L} _ {i} ^ {\text {c e l l r e c o n}} + \beta \cdot K L \left(\mathcal {N} \left(\boldsymbol {z} _ {i} ^ {\text {c e l l}} \mid \boldsymbol {\mu} _ {i} ^ {\text {c e l l}}, \boldsymbol {\sigma} _ {i} ^ {\text {c e l l}}\right) \| \mathcal {N} (\boldsymbol {0}, \boldsymbol {I})\right) \tag {8}
93
+ $$
94
+
95
+ where $\beta$ represents the weight of the KL divergence term in VAEs, and is tuned to prioritize accurate reconstruction during the early stages of training.
96
+
97
+ Step 2: Pretraining the Gene Encoder and Decoder: Once the cell encoder and decoder are pretrained, its parameters $(\phi^{\mathrm{cell}},\psi^{\mathrm{cell}},W^{\mathrm{cell}}$ ,and $b)$ are frozen, and we then pretrain the parameters $(\phi^{\mathrm{gene}},\psi^{\mathrm{gene}})$ of the gene encoder $f_{\phi^{\mathrm{gene}}}^{\mathrm{gene}}(\cdot)$ and decoder $g_{\psi^{\mathrm{gene}}}^{\mathrm{gene}}(\cdot)$ , respectively. The loss function $\mathcal{L}_{\mathrm{gene}}$ for this step is defined as:
98
+
99
+ $$
100
+ \mathcal {L} _ {i} ^ {\text {r e c o n}} = \left(\boldsymbol {c} _ {i} - \hat {\boldsymbol {c}} _ {i}\right) ^ {T} \left(\boldsymbol {c} _ {i} - \hat {\boldsymbol {c}} _ {i}\right) \tag {9}
101
+ $$
102
+
103
+ $$
104
+ \mathcal {L} _ {\text {g e n e}} = \sum_ {i} \mathcal {L} _ {i} ^ {\text {r e c o n}} + \beta \cdot K L \left(\mathcal {N} \left(z _ {j} ^ {\text {g e n e}} \mid \boldsymbol {\mu} _ {j} ^ {\text {g e n e}}, \sigma_ {j} ^ {\text {g e n e}}\right) \| \mathcal {N} (\boldsymbol {0}, I)\right) \tag {10}
105
+ $$
106
+
107
+ ![](images/cd2742fe0a2a480bcbb99302c62723d54ca8c76748a4fe1321e334f7c78aa1f7.jpg)
108
+ Figure 1. sciLaMA overview. (a) Diagram of the sciLaMA framework, which utilizes static gene embeddings generated from multimodal language models and employs paired encoder-decoders for both genes and cells. (b) Visualizations of cell and gene latent and last-hidden spaces and their operations for different components of the loss functions. (c) Illustrations of downstream applications using sciLaMA.
109
+
110
+ ![](images/9275a63fa0370beb62779c2c434303a15f20b7a2b4b1d87005ebdc494f2e0ee8.jpg)
111
+
112
+ ![](images/befca93e067c19c4d54d6613e86f27dde6796f9e6ca56fa10eb83873349078fd.jpg)
113
+
114
+ Note that unlike the reconstruction term $\mathcal{L}_i^{\mathrm{cellrecon}}$ from previous step (Equation (7)), this loss function operates on the outputs of the last hidden layers of both cell and gene decoders (Equation (5)). Because the inputs to the gene encoder are the prior LLM-defined gene embeddings $g_{j}$ and the output is reconstruction of the gene expression measurements $c_{i}$ , this pretraining serves to help adapt the LLM embeddings to the current (gene expression) context.
115
+
116
+ Step 3: Joint Optimization of sciLaMA: In the final step, all parameters of the sciLaMA framework are optimized to improve the reconstruction quality of the expression matrix. The loss function $\mathcal{L}_{\mathrm{sciLaMA}}$ for this step is:
117
+
118
+ $$
119
+ \hat {\boldsymbol {c}} _ {i, j} ^ {\text {a l i g n m e n t}} = \left(\boldsymbol {z} _ {i} ^ {\text {c e l l}}\right) ^ {T} \times \boldsymbol {z} _ {j} ^ {\text {g e n e}} + b _ {j} \tag {11}
120
+ $$
121
+
122
+ $$
123
+ \mathcal {L} _ {i} ^ {\text {a l i g n m e n t}} = \left(\boldsymbol {c} _ {i} - \hat {\boldsymbol {c}} _ {i} ^ {\text {a l i g n m e n t}}\right) ^ {T} \left(\boldsymbol {c} _ {i} - \hat {\boldsymbol {c}} _ {i} ^ {\text {a l i g n m e n t}}\right) \tag {12}
124
+ $$
125
+
126
+ $$
127
+ \begin{array}{l} \mathcal {L} _ {\mathrm {s c i L a M A}} = \sum_ {i} \mathcal {L} _ {i} ^ {\text {r e c o n}} + \gamma \cdot \mathcal {L} _ {i} ^ {\text {a l i g n m e n t}} \\ + \beta \cdot K L \left(\mathcal {N} \left(\boldsymbol {z} _ {i} ^ {\text {c e l l}} \mid \boldsymbol {\mu} _ {i} ^ {\text {c e l l}}, \boldsymbol {\sigma} _ {i} ^ {\text {c e l l}}\right) \| \mathcal {N} (\boldsymbol {0}, \boldsymbol {I})\right) \\ + \beta \cdot K L \left(\mathcal {N} \left(\boldsymbol {z} _ {j} ^ {\text {g e n e}} \mid \boldsymbol {\mu} _ {j} ^ {\text {g e n e}}, \boldsymbol {\sigma} _ {j} ^ {\text {g e n e}}\right) \| \mathcal {N} (\boldsymbol {0}, \boldsymbol {I})\right) \tag {13} \\ \end{array}
128
+ $$
129
+
130
+ where $\mathcal{L}_i^{\mathrm{alignment}}$ is a reconstruction-based regularization term that encourages alignment between the latent spaces of cells ( $z_i^{\mathrm{cell}}$ ) and genes ( $z_j^{\mathrm{gene}}$ ) by enforcing that the linear product of the embeddings approximates the original expression value of gene $j$ in cell $i$ ( $c_{i,j}$ ). This term, inspired by siVAE, serves as the interpretability term, ensuring that individual dimensions of the cell and gene embeddings ( $z^{\mathrm{cell}}$ and $z^{\mathrm{gene}}$ ) correspond meaningfully to each other. $\gamma$ is a scalar weight (default = 0.05) that determines the influence of $\mathcal{L}_i^{\mathrm{alignment}}$ term on the overall loss function. A small value prevents it from dominating the optimization process.
131
+
132
+ # 3.4. Inference and Embedding Extraction
133
+
134
+ After training the sciLaMA framework, the learned cell and gene embeddings can be extracted for downstream analyses. Given the trained encoders $f_{\phi^{\mathrm{cell}}}^{\mathrm{cell}}(\cdot)$ and $f_{\phi^{\mathrm{gene}}}^{\mathrm{gene}}(\cdot)$ , they can be used to project a cell expression profile $c^{(1)}$ or gene embedding $g^{(2)}$ into the cell $(z^{(1)})$ or gene $(z^{(2)})$ latent space for downstream visualization or analysis.
135
+
136
+ $$
137
+ \left(\boldsymbol {\mu} ^ {(1)}, \boldsymbol {\sigma} ^ {(1)}\right) \leftarrow f _ {\hat {\phi} ^ {\mathrm {c e l l}}} ^ {\mathrm {c e l l}} \left(\boldsymbol {c} ^ {(1)}\right) \tag {14}
138
+ $$
139
+
140
+ $$
141
+ \boldsymbol {z} ^ {(1)} \sim \mathcal {N} (\boldsymbol {\mu} ^ {(1)}, \boldsymbol {\sigma} ^ {(1)}) \tag {15}
142
+ $$
143
+
144
+ $$
145
+ \left(\boldsymbol {\mu} ^ {(2)}, \boldsymbol {\sigma} ^ {(2)}\right) \leftarrow f _ {\hat {\phi} ^ {\text {g e n e}}} ^ {\text {g e n e}} \left(\boldsymbol {g} ^ {(2)}\right) \tag {16}
146
+ $$
147
+
148
+ $$
149
+ \boldsymbol {z} ^ {(2)} \sim \mathcal {N} (\boldsymbol {\mu} ^ {(2)}, \boldsymbol {\sigma} ^ {(2)}) \tag {17}
150
+ $$
151
+
152
+ # 4. Experiments
153
+
154
+ The experiments evaluating sciLaMA are designed to assess its performance in single-cell analysis at both cell- and gene-level tasks. For cell-level tasks, sciLaMA is assessed by evaluating its capacity to generate cell embeddings that simultaneously preserve biological signals and remove batch effects, with performance measured by (1) cell clustering annotation accuracy, (2) cell type separation precision, and (3) the effectiveness of batch mixing. For gene-level tasks, sciLaMA is evaluated on its ability to impute gene expression, identify gene markers, infer developmental trajectories and discover temporal dynamic gene modules (Figure 1c). Detailed methodologies are listed in the Appendices C and D.
155
+
156
+ # 4.1. Prior Knowledge Improves Cell Representation Learning
157
+
158
+ We first evaluated cell-level tasks because gene-level analysis tasks are largely cell state-specific, and therefore rely on
159
+
160
+ ![](images/3d672d580555059636c0b1cc446f0f03ee866b97babb2f25e9c5bc39741708a2.jpg)
161
+
162
+ ![](images/8c628162c6bb9775efd278f5940fb237452f15caf706e1f3f5bf19395ea8c307.jpg)
163
+ Figure 2. Robust cell representation learning and integration with sciLaMA. (a) Quantitative performance comparison of models based on sciLaMA against other methods in preserving biological variance (blue and orange metrics) and removing batch effects (green metrics). (b-c) Scatter plot directly comparing sciLaMA-GPT (y-axis) to sciLaMA (s.i.) (x-axis, b) and fine-tuned scGPT (x-axis, c). (d) UMAP (McInnes et al., 2020) visualizations of cell embeddings with colors indicating cell types (top) and batch origins (bottom).
164
+
165
+ cell-level tasks such as accurate cell clustering and robust cell representations. To evaluate sciLaMA's performance and assess the impact of incorporating prior knowledge encoded as gene embeddings on cell-level tasks (Section 4), we benchmarked sciLaMA against the state-of-the-art (SOTA) model scVI (Lopez et al., 2018) and foundation models such as scGPT, CellPLM, and GenePT (Chen & Zou, 2024; Cui et al., 2024; Wen et al., 2023). Multiple variants of sciLaMA were created, each using a different set of gene embeddings precomputed using different prior knowledge databases to determine which prior knowledge is most relevant to single cell tasks: sciLaMA-GenePT, sciLaMA-ProtTrans, sciLaMA-CellPLM, sciLaMA-ChatGPT, and sciLaMA-ESM. To determine the extent to which the sciLaMA framework itself is superior to other models, we created the "self-informed" version of sciLaMA, sciLaMA (s.i.), to represent the framework when learning gene embeddings from the transposed single cell expression data itself solely (without prior LLM-derived knowledge). Celllevel tasks were evaluated using five pancreatic scRNA-seq datasets from different labs and sequencing platforms (Tran et al., 2020).
166
+
167
+ Across multiple standard integration metrics (Luecken et al., 2022), all sciLaMA variants robustly outperformed other models both individually (Figure 2a,d, Appendix E) as well as on average (Table 1), suggesting that the sciLaMA frame
168
+
169
+ Table 1. Cell representation learning and integration performance on human pancreatic datasets. Adjusted Rand Index (ARI) and Normalized Mutual Information (NMI) for cluster annotation accuracy; Average Silhouette Width (ASW) for cell type separation; batchASW and graph integration local inverse Simpson's Index (iLISI) for batch mixing quality.
170
+
171
+ <table><tr><td>Methods</td><td>ARI ↑</td><td>NMI ↑</td><td>ASW ↑</td><td>batchASW ↑</td><td>iLISI ↑</td></tr><tr><td>sciLaMA (avg.)</td><td>0.522</td><td>0.745</td><td>0.535</td><td>0.865</td><td>0.238</td></tr><tr><td>sciLaMA (s.i.)</td><td>0.436</td><td>0.698</td><td>0.539</td><td>0.832</td><td>0.210</td></tr><tr><td>scGPT fine-tuned</td><td>0.483</td><td>0.704</td><td>0.650</td><td>0.736</td><td>0.074</td></tr><tr><td>scVI-batch</td><td>0.447</td><td>0.718</td><td>0.499</td><td>0.744</td><td>0.115</td></tr><tr><td>scVI-raw</td><td>0.297</td><td>0.570</td><td>0.453</td><td>0.621</td><td>0.030</td></tr><tr><td>scGPT zero-shot</td><td>0.321</td><td>0.487</td><td>0.442</td><td>0.588</td><td>0.005</td></tr><tr><td>CellPLM zero-shot</td><td>0.330</td><td>0.516</td><td>0.421</td><td>0.492</td><td>1.11e-16</td></tr><tr><td>GenePT-w</td><td>0.022</td><td>0.079</td><td>0.192</td><td>0.553</td><td>0.121</td></tr></table>
172
+
173
+ work is a general, powerful framework for tackling cell-level tasks. For cell type clustering and annotation, sciLaMA achieved an average adjusted Rand index (ARI) of 0.522 and normalized mutual information (NMI) of 0.745, outperforming scVI (with batch variable consideration) by $16.78\%$ and $3.76\%$ , respectively, and fine-tuned scGPT by $8.07\%$ and $5.82\%$ . Additionally, its ARI and NMI values were approximately 1.5 times higher than those of the best zero-shot foundation models, showcasing its ability to generate well-defined cell clusters aligned with cell type annotations from the original studies. In cell type separation, sciLaMA achieved an average silhouette width (ASW) of 0.535 and a graph cell type local inverse Simpson's index (cLISI) of 0.9935, indicating precise separation of cell types with preserved biological variation. Furthermore, for batch effect correction, sciLaMA achieved the highest batch-ASW of 0.865 and a graph integration-LISI (iLISI) of 0.238, surpassing the next-best models by $16.26\%$ and $96.69\%$ , respectively. These results collectively highlight sciLaMA's robust ability to integrate cells across batches while maintaining accurate cell type representations and biological relevance.
174
+
175
+ Interestingly, the performance of sciLaMA (s.i.) without any external prior knowledge from LLMs is worse than all variants of sciLaMA with prior knowledge despite the diversity of prior knowledgebases, suggesting that incorporating prior knowledge of gene function is broadly acting to regularize sciLaMA and prevent overfitting (Figure 2b). These results are consistent with the observation across all tasks. sciLaMA outperformed scVI, another SOTA VAE-based model without external knowledge, again supporting that incorporating prior gene knowledge is beneficial to single cell analysis.
176
+
177
+ While our experiment above confirmed incorporating prior knowledge is helpful for single cell analysis, we also wondered whether with a framework inspired by paired VAEs, is sciLaMA the best framework for integrating prior knowledge? To explore this, we directly compared the transformer-based foundation model scGPT that was subsequently fine
178
+
179
+ Table 2. Comparison of runtime (in seconds) for modeling 14,767 human pancreatic cells sourced from five different origins on a single NVIDIA A100 80GB GPU. Due to memory limitations, the batch size for scGPT was set to 10, while siVAE and the various sciLaMA configurations utilized a batch size of 128.
180
+
181
+ <table><tr><td>Method</td><td>scGPT fine-tune</td><td>siVAE</td><td>sciLaMA (avg.)</td></tr><tr><td>Runtime (s) ↓</td><td>19,474</td><td>2,265</td><td>759</td></tr></table>
182
+
183
+ tuned on our training single cell data (scGPT-finetuned) with sciLaMA-scGPT (sciLaMA using pretrained scGPT gene embeddings). Both models are based on the same pretrained scGPT-whole-human as prior knowledge, but differ in how the pretrained embeddings are updated further. sciLaMA-scGPT outperformed fine-tuned scGPT by $6.82\%$ in cell type clustering and annotation task (ARI and NMI) (Figure 2c). Although the fine-tuned scGPT achieved marginally better results in silhouette width (ASW), its lower batch-ASW and integration-LISI (iLISI) scores (by $34.57\%$ on average) indicate poor batch integration. This comparison underscores the lightweight and well-designed nature of sciLaMA, which improves performance while being more computationally efficient, reducing runtime by 25-fold compared to fine-tuned scGPT (Table 2).
184
+
185
+ # 4.2. sciLaMA Reconstructs Gene Expression with High Accuracy
186
+
187
+ We next benchmarked sciLaMA accuracy on gene-level tasks, starting with the imputation of gene expression patterns. Gene imputation, the prediction of missing or masked gene expression levels based on other genes' profiles, is particularly beneficial for sparsely measured datasets, such as Multiplexed Error-Robust Fluorescence in situ Hybridization (MERFISH) or Antibody-Derived Tags (ADTs), where only a subset of genes is typically quantified in an experiment. We benchmarked sciLaMA against leading models for gene imputation accuracy, including scProjection, gimVI, uniPort and Tangram (Johansen et al., 2023; Lopez et al., 2019; Cao et al., 2022; Biancalani et al., 2021). The experimental setup employed a leave-one-gene-out strategy, where the expression of a single gene was masked across all cells, and the models were tasked with predicting its expression pattern based on the remaining genes.
188
+
189
+ Our results show that sciLaMA models consistently outperformed competing models in imputation accuracy (Figure 3a,b, and Table 3) on the spatial transcriptomics data (Codeluppi et al., 2018). sciLaMA achieved the highest scores across established metrics (Appendix D) (Li et al., 2022), outperforming the average performance of other benchmarked methods (Johansen et al., 2023; Lopez et al., 2019; Cao et al., 2022; Biancalani et al., 2021) by $27.39\%$ in Pearson Correlation Coefficient (PCC), $15.58\%$ in Spearman Correlation Coefficient (SCC), $32.86\%$ in 1-
190
+
191
+ ![](images/671c56b69b365b0d857ecbe0c2231ee5400313702e6d5ac815b4dac47a09df84.jpg)
192
+
193
+ ![](images/a12eb4f12ddff9ef9863ba114b1433f6ddfddb61f6302c513323bdc0158ade88.jpg)
194
+
195
+ ![](images/419bc8c36477ab82757d5b3177135c9c9c1bc28ce2d71475c902e28f479d558c.jpg)
196
+ Figure 3. Accurate imputation of unseen gene expression with sciLaMA. (a) Quantitative performance comparison of models based on sciLaMA against other methods for gene imputation task using leave-one-gene-out strategy. (b) Metric values for 30 genes from the spatial dataset across methods (color-coded). (c) Example visualizations of measured (left) and imputed (right) spatial gene expression patterns.
197
+
198
+ ![](images/54c9234f6cebb76ab890038a1103e9abbed0a39ddf6ab2d05db91f4e67aa88af.jpg)
199
+
200
+ Jensen-Shannon Divergence (1-JSD), and $3.32\%$ in 1/Root Mean Squared Error (1/RMSE) on average. These metrics indicate that its predictions were more aligned with true gene expression patterns compared to other models (Figure 3a). Notably, the results demonstrate the significance of incorporating external gene information gain, as evidenced by sciLaMA's performance superiority over the baseline sciLaMA (s.i.) model, as well as additional baseline sciLaMA (random) and sciLaMA (shuffled) (Appendix E). Unlike sciLaMA, these baseline models do not leverage meaningful prior knowledge derived from LLMs. Specifically, sciLaMA (s.i.) utilizes a transposed single-cell expression matrix, sciLaMA (random) employs a randomized input matrix for the gene encoder, and sciLaMA (shuffled) uses shuffled external gene embeddings to intentionally disrupt dimension alignment. Collectively, these comparisons emphasize the significance of leveraging structured, semantically meaningful gene embeddings derived from LLMs to enhance generalizability.
201
+
202
+ Figure 3c illustrates examples of measured versus imputed spatial patterns for genes such as $Cpne5$ and $Sox10$ and show sciLaMA accurately predicts expression while preserving spatial organization and region-specific heterogeneity of expression, which is crucial for understanding tissue spatial
203
+
204
+ ![](images/1a106982eb01beeae60d361dc910d09f25526bc8b29ca8a3057552a63822a4be.jpg)
205
+ Figure 4. Marker gene identification and validation using sciLaMA. (a) UMAP of human PBMC 3K dataset cell embedding using sciLaMA, with points representing cells colored by cell type and outlined by coarse cell classes using dashed circles. (b) Comparison of LLM-derived static gene embedding (top) and sciLaMA-derived contextual gene embedding (bottom) with points representing genes. Marker genes are colored by cell type specificity, and those from the same circle are relevant to the same broader cell classes. Color codes are consistent between (a) and (b). (c) A graph of a gene module identified through sciLaMA-based gene clustering, with Gene Ontology (GO) terms enriched for module-associated genes. The module includes PPBP gene, a known marker for Megakaryocytes. (d) Bar chat of the top six GO terms and significance (adjusted p-values). (e) UMAP visualization of sciLaMA contextual gene embedding on multi-source human pancreas datasets. Marker gene modules associated with different cell types are highlighted.
206
+
207
+ ![](images/5a5d9a8c0464e3389846af5c56343494adb3d490c50fad68e01089f513edd10a.jpg)
208
+
209
+ ![](images/d1913e4c87ec05c99ded744afe45477f3d42acfacd8d16953ea33d184f83099c.jpg)
210
+
211
+ ![](images/cee02e2fdfb7772920d2b1f69a9e9a5de1fdfef3031d79cf5b367c8b7d015ba2.jpg)
212
+
213
+ Table 3. Evaluation of gene expression imputation performance on spatial transcriptomics data across multiple methods using Pearson Correlation Coefficient (PCC), Spearman Correlation Coefficient (SCC), Jensen-Shannon Divergence (JSD), and Root Mean Square Error (RMSE). A leave-one-gene-out strategy was applied on 30 measured genes.
214
+
215
+ <table><tr><td>Methods</td><td>PCC (↑)</td><td>SCC (↑)</td><td>JSD (↓)</td><td>RMSE (↓)</td></tr><tr><td>sciLaMA (avg.)</td><td>0.222 ± 0.027</td><td>0.217 ± 0.028</td><td>0.283 ± 0.008</td><td>1.242 ± 0.022</td></tr><tr><td>scProjection</td><td>0.177 ± 0.029</td><td>0.207 ± 0.029</td><td>0.352 ± 0.032</td><td>1.277 ± 0.023</td></tr><tr><td>gimVI</td><td>0.224 ± 0.021</td><td>0.207 ± 0.024</td><td>0.580 ± 0.014</td><td>1.243 ± 0.017</td></tr><tr><td>uniPort</td><td>0.166 ± 0.027</td><td>0.184 ± 0.027</td><td>0.451 ± 0.017</td><td>1.287 ± 0.022</td></tr><tr><td>Tangram</td><td>0.130 ± 0.019</td><td>0.154 ± 0.018</td><td>0.458 ± 0.017</td><td>1.316 ± 0.015</td></tr></table>
216
+
217
+ structure.
218
+
219
+ # 4.3. sciLaMA Enables Marker Gene Identification
220
+
221
+ In single-cell studies, identifying and validating marker genes characteristic of individual cell types is another essential process for cell type annotation traditionally dependent on expert domain knowledge. Conventionally, bioinformaticians preprocess and integrate data, cluster cells, and then experts annotate these clusters using known biomarkers or gene signatures relevant to specific cell types (Butler et al., 2018; Wolf et al., 2018). Such division of labor is time-consuming and demands extensive collaboration. sciLaMA streamlines this process by simultaneously integrating cells and implicitly organizing genes into biologically meaningful modules within its contextual gene representation space. By analyzing gene embeddings, sciLaMA can identify groups of genes that are consistently co-expressed or show coordinated patterns within specific cell types. This goes beyond simply checking the expression levels of predefined markers such as CD4 for T-cells. Instead, it reveals potentially unknown gene modules that strongly correlate
222
+
223
+ with particular cellular states or types. sciLaMA not only reduces the manual labor involved in marker identification but also opens up possibilities for discovering new biological insights by detecting subtle, coordinated gene expression patterns that expert-driven methods might overlook.
224
+
225
+ To assess sciLaMA's efficacy in marker gene identification, we compared its contextual gene embeddings to static embeddings from the LLMs. sciLaMA's contextualization significantly improved the clustering of markers associated with the same cell states (Figure 4a-b). For example, in the static embeddings (Figure 4b, top), marker genes for the same cell type do not cluster as expected, while in the sciLaMA contextual embeddings (Figure 4b, bottom), markers for the same cell states group together, as indicated by the circles. Moreover, PPBP is a well-established marker for Megakaryocytes (platelet precursor cells) in human peripheral blood mononuclear cells (PBMCs) (Butler et al., 2018), and sciLaMA's contextual gene embedding presents a cluster that includes it. Neighboring genes within this cluster were linked to platelet-related biological processes, cellular components, and molecular functions, confirmed via Gene Ontology (GO) enrichment analysis (Figure 4c-d) (Subramanian et al., 2005). Many of these genes, though not previously annotated as Megakaryocyte markers from the original study, exhibit strong co-expression with PPBP and functional links to platelet biology. Their coordinated clustering in biologically meaningful modules indicates their relevance to Megakaryocyte identity.
226
+
227
+ Furthermore, sciLaMA robustly identified marker modules across multiple datasets, demonstrating its effectiveness even in the presence of batch effects (Figure 4e). Importantly, sciLaMA integrating LLM-derived priors gene knowledge outperformed the self-informed version sciL
228
+
229
+ ![](images/ec47023a67b5f8cd0d4e15b618593cf64b1c64559bee1e1db2f5d2425902a641.jpg)
230
+ a
231
+
232
+ ![](images/7bba547bd66338a53e248b9936ffce9d223d91cc653cd51712d08a0354489eef.jpg)
233
+ b
234
+
235
+ ![](images/311691ba5add1bf93c27b5aacf597c39a93c95c696a23fe467fee89f42141e01.jpg)
236
+ C
237
+ Figure 5. Enhanced developmental gene trajectory analysis with sciLaMA. (a) Overview of P0 mouse neurodevelopment data, with five cell types from early progenitors to mature excitatory neurons. (b) UMAP visualizations of cell embeddings using sciLaMA (top) and scVI (bottom) with a bar plot comparing cell type annotation and separation performance. (c) Pseudotime (x-axis) heatmap displaying the dynamic changes in gene expression across developmental stages. Rows represent ordered temporal specific genes. (d) UMAP visualizations of gene embeddings without (left) and with (right) embedding alignment using sciLaMA. Temporal specific genes (from (c)) are highlighted with color gradient.
238
+
239
+ aMA (s.i.) across clustering metrics (Table S7), which indicates the value of leveraging pretrained static gene embeddings. These findings highlight sciLaMA's potential to streamline single-cell studies by reducing reliance on manual annotation and revealing novel biological insights, which advances gene module discovery.
240
+
241
+ # 4.4. sciLaMA Enhances Trajectory Analysis by Unveiling Temporal Dynamics of Genes
242
+
243
+ Building upon its strength in identifying gene markers and modules across discrete cell types, sciLaMA also excels at capturing temporal dynamics in developmental processes. This capability enables the study of continuous gene expression changes across time and facilitates the analysis of cell differentiation and developmental trajectories.
244
+
245
+ To investigate sciLaMA's capability in this context, we conducted pseudotime trajectory analysis using cell embeddings learned by sciLaMA and compared them with those from scVI, a SOTA single-cell model. The analysis was applied to a dataset capturing P0 mouse cortex development (Figure 5a) (Chen et al., 2019). Pseudotime visualizations (Figure 5b, and Appendix E) illustrated that sciLaMA provided
246
+
247
+ Table 4. Cell representation learning performance on P0 mouse neurodevelopment dataset, with ARI and NMI quantifying cluster annotation accuracy, and ASW and cLISI quantifying cell type separation.
248
+
249
+ <table><tr><td>Methods</td><td>ARI ↑</td><td>NMI ↑</td><td>ASW ↑</td><td>cLISI ↑</td></tr><tr><td>sciLaMA</td><td>0.316</td><td>0.351</td><td>0.518</td><td>0.738</td></tr><tr><td>scVI</td><td>0.284</td><td>0.291</td><td>0.501</td><td>0.501</td></tr></table>
250
+
251
+ clearer transitions between developmental stages, such as the progression from intermediate progenitors (IPs) to layer-2-3 excitatory neurons (ExNs). sciLaMA outperformed scVI in trajectory clarity by $20.65\%$ overall (Table 4).
252
+
253
+ Pseudotime-aligned heatmaps of gene expression (Figure 5c, and Appendix E) highlighted temporal-specific genes with coordinated expression shifts corresponding to distinct stages of cell differentiation. Additionally, sciLaMA's contextual gene embeddings further illuminated temporal relationships between genes, offering insights into the sequential activation of developmental markers (Figure 5d). This analysis provides a comprehensive perspective on the dynamic interplay of genes during cell differentiation and development.
254
+
255
+ By accurately mapping cell lineages and identifying stage-specific gene modules, sciLaMA provides researchers with a powerful tool for understanding cell differentiation and developmental processes. When applied to organoid datasets, sciLaMA can also compare developmental trajectories of organoids with those of real tissues. For example, it can identify which gene modules from real tissues correspond to specific stages in organoid development, aiding in the assessment of organoid fidelity. This capability has significant implications for therapeutic strategies, enabling researchers to evaluate how organoids can model human diseases and inform potential treatment designs.
256
+
257
+ # 5. Conclusion
258
+
259
+ This study introduces sciLaMA, a novel framework that integrates external gene knowledge from language models with single-cell expression data to address critical challenges in single-cell analysis and enable comprehensive downstream tasks spanning both cell-level and gene-level analyses. Our experiments demonstrate the framework's effectiveness and performance superiority, and highlight the value of incorporating external gene knowledge through an innovative design. These findings establish sciLaMA as a powerful tool for advancing our understanding of cellular heterogeneity and gene regulation, and showcase how language models can be leveraged through a lightweight adapter framework.
260
+
261
+ # Acknowledgements
262
+
263
+ This work began during H.H.'s research internship at Microsoft Research and was supported by an NSF CAREER award (1846559, G.Q.). Additional funding came from the National Institutes of Health, including the Office of the Director/National Institute of Mental Health (DP2 MH129987, G.Q.) and the National Institute of Child Health and Human Development (P50 HD103526). We thank Erdal Cosgun, Shuangjia Lu, and the Microsoft Research Health Futures team for their guidance and technical insights.
264
+
265
+ # Impact Statement
266
+
267
+ This paper aims to integrate contextual and general knowledge about cells and genes to enhance single-cell data analysis. By leveraging large language models from different modalities, our methodology supports critical tasks with improved performance and computational efficiency. This approach has the potential to advance the field of Machine Learning in scientific research by facilitating the study of cellular heterogeneity, gene regulation, and developmental processes across various biological contexts. Furthermore, its ability to streamline analysis reduces reliance on extensive manual annotation and switching between disparate tools on various tasks. The implications of this approach include its contribution to biomedical research, where it may support therapeutic discovery and precision medicine. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here.
268
+
269
+ # References
270
+
271
+ Baron, M., Veres, A., Wolock, S. L., Faust, A. L., Gaujoux, R., Vetere, A., Ryu, J. H., Wagner, B. K., Shen-Orr, S. S., Klein, A. M., Melton, D. A., and Yanai, I. A single-cell transcriptomic map of the human and mouse pancreas reveals inter- and intra-cell population structure. Cell Systems, 3(4):346-360, 2016. doi: 10.1016/j.cels.2016.08.011.
272
+ Biancalani, T., Scalia, G., Buffoni, L., Avasthi, R., Lu, Z., Sanger, A., Tokcan, N., Vanderburg, C. R., Segerstolpe, Å., Zhang, M., et al. Deep learning and alignment of spatially resolved single-cell transcriptomes with tangram. Nature Methods, 18(11):1352-1362, 2021. doi: 10.1038/s41592-021-01264-7.
273
+ Butler, A., Hoffman, P., Smibert, P., Papalexi, E., and Satija, R. Integrating single-cell transcriptomic data across different conditions, technologies, and species. Nature Biotechnology, 36(5):411-420, 2018. doi: 10.1038/nbt.4096.
274
+ Cao, K., Gong, Q., Hong, Y., and Wan, L. A unified computational framework for single-cell data integration with optimal transport. Nature Communications, 13(1):7419, 2022. doi: 10.1038/s41467-022-35094-8.
275
+ Cao, Z.-J. and Gao, G. Multi-omics single-cell data integration and regulatory inference with graph-linked embedding. Nature Biotechnology, 40(10):1458-1466, 2022. doi: 10.1038/s41587-022-01284-4.
276
+ Chen, S., Lake, B. B., and Zhang, K. High-throughput sequencing of the transcriptome and chromatin accessibility in the same cell. Nature Biotechnology, 37(12): 1452-1457, 2019. doi: 10.1038/s41587-019-0290-0.
277
+ Chen, X., Xu, J., Zhou, R., Chen, W., Fang, J., and Liu, C. Trajvae: A variational autoencoder model for trajectory generation. Neurocomputing, 428:332-339, 2021. doi: 10.1016/j.neucom.2020.03.120.
278
+ Chen, Y. and Zou, J. Simple and effective embedding model for single-cell biology built from chatgpt. Nature Biomedical Engineering, 2024. doi: 10.1038/s41551-024-01284-6.
279
+ Choi, Y., Li, R., and Quon, G. sivae: Interpretable deep generative models for single-cell transcriptomes. Genome Biology, 24(1):29, 2023. doi: 10.1186/s13059-023-02850-y.
280
+ Codeluppi, S., Borm, L. E., Zeisel, A., La Manno, G., van Lunteren, J. A., Svensson, C. I., and Linnarsson, S. Spatial organization of the somatosensory cortex revealed by osmfish. Nature Methods, 15(11):932-935, 2018. doi: 10.1038/s41592-018-0175-z.
281
+
282
+ Cui, H., Wang, C., Maan, H., Pang, K., Luo, F., Duan, N., and Wang, B. scgt: Toward building a foundation model for single-cell multi-omics using generative ai. Nature Methods, 21(8):1470-1480, 2024. doi: 10.1038/s41592-024-02201-0.
283
+ Elnaggar, A., Heinzinger, M., Dallago, C., Rehawi, G., Wang, Y., Jones, L., Gibbs, T., Feher, T., Angerer, C., Steinegger, M., Bhowmik, D., and Rost, B. Protrans: Toward understanding the language of life through self-supervised learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 44(10):7112-7127, 2022. doi: 10.1109/TPAMI.2021.3095381.
284
+ Grønbech, C. H., Vording, M. F., Timshel, P. N., Sønderby, C. K., Pers, T. H., and Winther, O. scvae: Variational auto-encoders for single-cell gene expression data. Bioinformatics, 36(16):4415-4422, 2020. doi: 10.1093/bioinformatics/btaa293.
285
+ Janizek, J. D., Spiro, A., Celik, S., Blue, B. W., Russell, J. C., Lee, T.-I., Kaeberlin, M., and Lee, S.-I. Pause: Principled feature attribution for unsupervised gene expression analysis. Genome Biology, 24(1):81, 2023. doi: 10.1186/s13059-023-02901-4.
286
+ Johansen, N., Hu, H., and Quon, G. Projecting rna measurements onto single cell atlases to extract cell typespecific expression profiles using scprojection. Nature Communications, 14(1):5192, 2023. doi: 10.1038/s41467-023-40744-6.
287
+ Kana, O., Nault, R., Filipovic, D., Marri, D., Zacharewski, T., and Bhattacharya, S. Generative modeling of single-cell gene expression for dose-dependent chemical perturbations. *Patterns*, 4(8):100817, 2023. doi: 10.1016/j.patter.2023.100817.
288
+ Kedzierska, K. Z., Crawford, L., Amini, A. P., and Lu, A. X. Assessing the limits of zero-shot foundation models in single-cell biology. 2023. doi: 10.1101/2023.10.16.561085.
289
+ Kingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2014. doi: 10.48550/arXiv.1312.6114.
290
+ Lähnemann, D., Köster, J., Szczurek, E., McCarthy, D. J., Hicks, S. C., Robinson, M. D., Vallejos, C. A., Campbell, K. R., Beerenwinkel, N., Mahfouz, A., et al. Eleven grand challenges in single-cell data science. Genome Biology, 21(1):31, 2020. doi: 10.1186/s13059-020-1926-6.
291
+ Li, B., Zhang, W., Guo, C., Xu, H., Li, L., Fang, M., Hu, Y., Zhang, X., Yao, X., Tang, M., et al. Benchmarking spatial and single-cell transcriptomics integration methods for transcript distribution prediction and cell type
292
+
293
+ deconvolution. Nature Methods, 19(6):662-670, 2022. doi: 10.1038/s41592-022-01480-9.
294
+ Lin, Z., Akin, H., Rao, R., Hie, B., Zhu, Z., Lu, W., Smetanin, N., Verkuil, R., Kabeli, O., Shmueli, Y., et al. Evolutionary-scale prediction of atomic-level protein structure with a language model. 2023.
295
+ Liu, T., Chen, T., Zheng, W., Luo, X., and Zhao, H. scelmo: Embeddings from language models are good learners for single-cell data analysis. 2023.
296
+ Lopez, R., Regier, J., Cole, M. B., Jordan, M. I., and Yosef, N. Deep generative modeling for single-cell transcriptomics. Nature Methods, 15(12):1053-1058, 2018. doi: 10.1038/s41592-018-0229-2.
297
+ Lopez, R., Nazaret, A., Langevin, M., Samaran, J., Regier, J., Jordan, M. I., and Yosef, N. A joint model of unpaired data from scrna-seq and spatial transcriptomics for imputing missing gene expression measurements. arXiv preprint arXiv:1905.02269, 2019.
298
+ Luecken, M. D., Böttner, M., Chaichoompu, K., Danese, A., Interlandi, M., Mueller, M. F., Strobl, D. C., Zappia, L., Dugas, M., Colomé-Tatché, M., and Theis, F. J. Benchmarking atlas-level data integration in single-cell genomics. Nature Methods, 19(1):41-50, 2022. doi: 10.1038/s41592-021-01336-8.
299
+ McInnes, L., Healy, J., and Melville, J. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2020. doi: 10.48550/arXiv.1802.03426.
300
+ Muraro, M. J., Dharmadhikari, G., Grün, D., Groen, N., Dielen, T., Jansen, E., van Gurp, L., Engelse, M. A., Carlotti, F., de Koning, E. J. P., and van Oudenaarden, A. A single-cell transcriptome atlas of the human pancreas. Cell Systems, 3(4):385-394, 2016. doi: 10.1016/j.cels.2016.09.002.
301
+ OpenAI. New and improved embedding model: Text-embedding-ada-002. 2022. URL https://openai.com/index/new-and-improved-embedding-model/.
302
+ Rosen, Y., Brbic, M., Roohani, Y., Swanson, K., Li, Z., and Leskovec, J. Toward universal cell embeddings: Integrating single-cell rna-seq datasets across species with saturn. Nature Methods, 21(8):1492-1500, 2024. doi: 10.1038/s41592-024-02191-z.
303
+ Segerstolpe, Å., Palasantza, A., Eliasson, P., Andersson, E.-M., Andréasson, A.-C., Sun, X., Picelli, S., Sabirsh, A., Clausen, M., Bjursell, M. K., et al. Single-cell transcriptome profiling of human pancreatic islets in health and type 2 diabetes. Cell Metabolism, 24(4):593-607, 2016. doi: 10.1016/j.cmet.2016.08.020.
304
+
305
+ Subramanian, A., Tamayo, P., Mootha, V. K., Mukherjee, S., Ebert, B. L., Gillette, M. A., Paulovich, A., Pomeroy, S. L., Golub, T. R., Lander, E. S., and Mesirov, J. P. Gene set enrichment analysis: A knowledge-based approach for interpreting genome-wide expression profiles. Proceedings of the National Academy of Sciences, 102(43): 15545-15550, 2005. doi: 10.1073/pnas.0506580102.
306
+ Theodoris, C. V., Xiao, L., Chopra, A., Chaffin, M. D., Al Sayed, Z. R., Hill, M. C., Mantineo, H., Brydon, E. M., Zeng, Z., Liu, X. S., and Ellinor, P. T. Transfer learning enables predictions in network biology. Nature, 618(7965):616-624, 2023. doi: 10.1038/s41586-023-06139-9.
307
+ Tran, H. T. N., Ang, K. S., Chevrier, M., Zhang, X., Lee, N. Y. S., Goh, M., and Chen, J. A benchmark of batch-effect correction methods for single-cell rna sequencing data. Genome Biology, 21(1):12, 2020. doi: 10.1186/s13059-019-1850-9.
308
+ Wang, Y. J., Schug, J., Won, K.-J., Liu, C., Naji, A., Avrahami, D., Golson, M. L., and Kaestner, K. H. Single-cell transcriptomics of the human endocrine pancreas. Diabetes, 65(10):3028-3038, 2016. doi: 10.2337/db16-0405.
309
+ Wen, H., Tang, W., Dai, X., Ding, J., Jin, W., Xie, Y., and Tang, J. Cellplm: Pre-training of cell language model beyond single cells. 2023. doi: 10.1101/2023.10.03.560734.
310
+ Wolf, F. A., Angerer, P., and Theis, F. J. Scanpy: Large-scale single-cell gene expression data analysis. Genome Biology, 19(1):15, 2018. doi: 10.1186/s13059-017-1382-0.
311
+ Xin, Y., Kim, J., Okamoto, H., Ni, M., Wei, Y., Adler, C., Murphy, A. J., Yancopoulos, G. D., Lin, C., and Gromada, J. RNA sequencing of single human islet cells reveals type 2 diabetes genes. Cell Metabolism, 24(4):608-615, 2016. doi: 10.1016/j.cmet.2016.08.018.
312
+ Yan, J., Ma, M., and Yu, Z. bmvae: A variational autoencoder method for clustering single-cell mutation data. Bioinformatics, 39(1):btac790, 2023. doi: 10.1093/bioinformatics/btac790.
313
+ Zeisel, A., Muñoz-Manchado, A. B., Codeluppi, S., Lönnerberg, P., La Manno, G., Juréus, A., Marques, S., Munguba, H., He, L., Betsholtz, C., et al. Cell types in the mouse cortex and hippocampus revealed by single-cell rna-seq. Science, 347(6226):1138-1142, 2015. doi: 10.1126/science.aaa1934.
314
+
315
+ # Appendix sciLaMA: A Single-Cell Representation Learning Framework to Leverage Prior Knowledge from Large Language Models
316
+
317
+ # A. Model Input Processing:
318
+
319
+ # A.1. Cell Encoder Input
320
+
321
+ As mentioned in Section 3 Methods, the input for cell Encoder is the scRNA-seq data for specific cell population $c$ . Therefore, $c_{i,j}$ denotes the scaled log-normalized expression value of gene $j$ in cell $i$ .
322
+
323
+ The raw scRNA-seq expression matrix, $c^{\mathrm{raw}}$ , is a sparse count matrix. For use in sciLaMA, the data after quality control (QC) is processed through library size normalization and feature-wise z-score scaling to achieve zero mean and unit variance. Values beyond $\pm 10$ are clipped. Specifically, the normalized expression $c^{\mathrm{norm}}$ is calculated as:
324
+
325
+ $$
326
+ \boldsymbol {c} _ {i, j} ^ {\text {n o r m}} = \log_ {e} \left(1 + 1 0 ^ {4} \times \frac {\boldsymbol {c} _ {i , j} ^ {\text {r a w}}}{\sum_ {k = 1} ^ {m} \boldsymbol {c} _ {i , k} ^ {\text {r a w}}}\right)
327
+ $$
328
+
329
+ Here, $c_{i,j}^{\mathrm{raw}}$ represents the raw count value of gene $j$ in cell $i$ , and $\sum_{k=1}^{m} c_{i,k}^{\mathrm{raw}}$ is the total expression counts number for cell $i$ . The multiplication by $10^4$ ensures a standardized size factor for normalization. This normalization procedure adjusts for library size differences across cells and prepares the data for following analysis.
330
+
331
+ # A.2. Gene Encoder Input
332
+
333
+ In this study, sciLaMA integrated static gene embeddings from six external sources across three distinct modalities.
334
+
335
+ <table><tr><td>Source</td><td>Dimensionality</td><td>Modality</td></tr><tr><td>ChatGPT</td><td>1536</td><td>Text</td></tr><tr><td>GenePT (NCBI)</td><td>1536</td><td>Text</td></tr><tr><td>ESM</td><td>5120</td><td>Protein Sequence</td></tr><tr><td>ProtTrans</td><td>1024</td><td>Protein Sequence</td></tr><tr><td>scGPT</td><td>512</td><td>Single Cell</td></tr><tr><td>CellPLM</td><td>1024</td><td>Single Cell</td></tr></table>
336
+
337
+ Table S1. Gene Embedding Sources and Characteristics.
338
+
339
+ # A.2.1 Natural Language Embeddings
340
+
341
+ We acquired text description-based gene embeddings from two studies: GenePT and scELMo (Chen & Zou, 2024; Liu et al., 2023), utilizing the OpenAI text-embedding-ada-002 model (OpenAI, 2022). These embeddings were generated using two distinct text corpora: GPT-3.5 generated descriptions (referred to as ChatGPT) and National Center for Biotechnology Information (NCBI) gene card summaries (referred to as GenePT). We obtained 1,536-dimensional static embeddings for each gene ( $d = 1,536$ ).
342
+
343
+ # A.2.2 Protein Language Embeddings
344
+
345
+ We derived protein sequence-based gene embeddings from two protein language models: ESM2 t48_15B_UR50D with 5,120-dimensional embeddings per gene (Lin et al., 2023), and ProtXLNet from ProtTrans with 1,024-dimensional embeddings (Elnaggar et al., 2022) from the SATURN study (Rosen et al., 2024). These embeddings were generated using the amino acid sequences of each corresponding gene.
346
+
347
+ # A.2.3 Single-Cell Gene Language Embeddings
348
+
349
+ For single-cell foundation models, we retrieved static gene embeddings from two pretrained models: scGPT-whole-human (512-dimensional embeddings) (Cui et al., 2024) and cellPLM (1,024-dimensional embeddings) (Wen et al., 2023). The scGPT embeddings were obtained using the model's GitHub tutorial, while cellPLM embeddings were extracted from the embedder module's feature encoder parameters, as directed by the authors.
350
+
351
+ # B. Model Optimization Illustration:
352
+
353
+ The sciLaMA model optimization process, comprehensively described in Section 3 Methods, is illustrated through a stepwise training strategy visualization (Figure S1). The optimal hyperparameter values chosen for our experiments are scalar $\gamma = 0.05$ and latent dimensionality $K = 40$ , based on the evaluations presented in Table S8 and Table S9.
354
+
355
+ ![](images/cc9cbd21775efcb80c6e565a2d51edbc42638bd7a36bdcf0f4e9d20fe2350b0d.jpg)
356
+ Pretrain cellVAE
357
+
358
+ ![](images/153a167275beec006470f66ba8e2b6e23bad7ec6bf83edb7a74137a4117cb968.jpg)
359
+ Freeze cellVAE, pretrain geneVAE
360
+ Figure S1. Schematic representation of the progressive optimization workflow for the sciLaMA framework. (Box indicates freezing parameters.)
361
+
362
+ ![](images/3c79a395074846269e10f73777ea9294f4092c109fddbfaf4185ea3ea2f95268.jpg)
363
+ Jointly refine paired VAEs of sciLaMA
364
+
365
+ # C. Dataset Introduction:
366
+
367
+ # C.1. Experiment 1: Cell Representation Learning Benchmarking
368
+
369
+ This experiment benchmarks cell representation learning methods using a combination of single-cell RNA sequencing datasets derived from five studies focused on the pancreas. The data includes a total of 14,767 cells spanning 13,062 genes (after intersection with precomputed static gene embeddings).
370
+
371
+ Datasets Used: Baron et al.: 8,569 cells (Baron et al., 2016); Segerstolpe et al.: 2,127 cells (Segerstolpe et al., 2016); Muraro et al.: 2,122 cells (Muraro et al., 2016); Xin et al.: 1,492 cells (Xin et al., 2016); Wang et al.: 457 cells (Wang et al., 2016).
372
+
373
+ The aggregated dataset was a gold-standard benchmarking dataset originally analyzed in the context of batch-effect correction, as described in Tran et al., in 2020 (Tran et al., 2020). This benchmarking experiment evaluates the performance of cell representation learning in mitigating batch effects while preserving biological signal.
374
+
375
+ # C.2. Experiment 2: Gene Expression Imputation Benchmarking
376
+
377
+ This experiment evaluates the accuracy of gene expression imputation approaches by leveraging two complementary datasets (Zeisel et al., 2015; Codeluppi et al., 2018):
378
+
379
+ # Reference scRNA-seq Dataset (Zeisel et al., 2015):
380
+
381
+ Number of cells: 3,005
382
+ - Total genes: 19,972, with 3,654 highly variable genes selected for benchmarking.
383
+ Validation: A $10\%$ validation split is used for early stopping during model training.
384
+
385
+ # Spatial Transcriptomics Dataset (Codeluppi et al., 2018):
386
+
387
+ Number of spatial spots: 4,530
388
+
389
+ - Genes: 30, analyzed using a leave-one-gene-out approach to simulate imputation scenarios.
390
+
391
+ This setup allows for assessing the generalizability of gene imputation models.
392
+
393
+ # C.3. Experiment 3: Marker Gene Identification
394
+
395
+ This experiment focuses on identifying marker genes for distinct cell types using the human Peripheral Blood Mononuclear Cell (PBMC) 3K dataset from 10x Genomics, a legacy dataset widely utilized in tools like Seurat (Butler et al., 2018) and scanpy (Wolf et al., 2018) tutorials. The ground truth gene markers and cell type annotations were obtained from the tutorials (https://satijalab.org/seurat/articles/pbmc3k_tutorial, and https://scanpy.readthedocs.io/en/stable/tutorials/ basics/clustering-2017.html).
396
+
397
+ # Dataset Details:
398
+
399
+ - Initial Size: 2,700 cells $\times$ 32,738 genes
400
+
401
+ - Final Size: 2,700 cells $\times$ 9,540 genes (post-filtering and intersection with static gene embeddings).
402
+
403
+ <table><tr><td>Cell Type</td><td>Number of cells</td></tr><tr><td>CD4 T cells</td><td>1158</td></tr><tr><td>CD14 Monocytes</td><td>487</td></tr><tr><td>B cells</td><td>357</td></tr><tr><td>CD8 T cells</td><td>329</td></tr><tr><td>FCGR3A Monocytes</td><td>160</td></tr><tr><td>NK cells</td><td>160</td></tr><tr><td>Dendritic cells</td><td>36</td></tr><tr><td>Megakaryocytes</td><td>13</td></tr></table>
404
+
405
+ # C.4. Experiment 4: Trajectory Analysis and Temporal Dynamic Gene Discovery
406
+
407
+ This experiment investigates gene dynamics along developmental trajectories using the P0 mouse cortex dataset from the SNARE-seq study (Chen et al., 2019). The original SNARE-seq dataset includes both transcriptomic and epigenomic information from the same single cells, but we only utilized the transcriptomic data with 1,469 cells and 8,293 genes (after intersection with precomputed static gene embeddings). This experiment focuses on uncovering temporally dynamic genes critical for neurodevelopmental processes. The ground truth gene markers and cell type annotations were obtained from the original study.
408
+
409
+ Table S2. Cell Type Statistics of human PBMC 3K dataset
410
+
411
+ <table><tr><td>Cell Type</td><td>Number of cells</td></tr><tr><td>IP_Hmgn2</td><td>214</td></tr><tr><td>IP_Gadd45g</td><td>99</td></tr><tr><td>IP_Eomes</td><td>437</td></tr><tr><td>Ex23_Cntn2</td><td>177</td></tr><tr><td>Ex23_Cux1</td><td>542</td></tr></table>
412
+
413
+ Table S3. Cell Type Statistics of mouse P0 cortex dataset
414
+
415
+ # D. Benchmarking Metrics Introduction:
416
+
417
+ To comprehensively evaluate the performance of various methods, we employ metrics tailored to different aspects of single-cell data analysis, including cluster annotation accuracy, cell type separation, batch mixing quality, and predictive/imputation accuracy (Li et al., 2022; Luecken et al., 2022), briefly summarized below:
418
+
419
+ # D.1. Clustering and Annotation Accuracy
420
+
421
+ To assess the biological relevance of clustering and annotation based on the learned embeddings, we employ:
422
+
423
+ - Adjusted Rand Index (ARI): Measures the agreement between predicted and ground-truth cluster labels, adjusted for chance. A higher ARI indicates better alignment between predicted clusters and original biological annotations, reflecting more accurate and biologically meaningful clustering.
424
+ - Normalized Mutual Information (NMI): Quantifies the mutual dependence between predicted clusters and ground-truth cell type annotation labels, normalized to account for the total number of clusters. A higher NMI indicates better clustering accuracy.
425
+
426
+ # D.2. Cell Type Separation
427
+
428
+ To evaluate how well methods preserve separation between distinct cell types, we employ:
429
+
430
+ - Average Silhouette Width (ASW): Evaluates the cohesion within clusters and the separation between them. Higher ASW scores indicate that cells within the same cluster are more similar to each other than to cells in other clusters, signifying well-defined clusters.
431
+ - Graph Cell-Type Integration Local Inverse Simpson's Index (cLISI): Measures the local diversity of cell types within neighborhoods in an integrated graph representation. High cLISI values suggest better grouping of similar cell types in the embedding space.
432
+
433
+ # D.3. Batch-Effect Correction Quality
434
+
435
+ To evaluate batch effect removal while preserving biological variance, we apply:
436
+
437
+ - Batch-Adjusted Silhouette Width (batchASW): Evaluates the extent of batch mixing while penalizing over-mixing of unrelated cells. Higher batchASW scores indicate better batch integration without compromising biological separation.
438
+ - Graph Integration Local Inverse Simpson's Index (iLISI): Measures the diversity of batch labels within local neighborhoods of an integrated graph. Higher iLISI scores indicate more uniform batch mixing, reflecting better integration while preserving cell type integrity.
439
+
440
+ # D.4. Predictive Accuracy and Divergence Metrics
441
+
442
+ For imputation and gene expression prediction tasks, we employ:
443
+
444
+ - Pearson Correlation Coefficient (PCC): Assesses linear relationships between predicted and observed gene expression values, with higher values indicating stronger correlations.
445
+ - Spearman Correlation Coefficient (SCC): Evaluates rank-based relationships, capturing monotonic correlations between predicted and observed values, providing insights into the consistency of expression patterns.
446
+ - Jensen-Shannon Divergence (JSD): Measures the similarity between predicted and true gene expression distributions. Lower JSD values indicate better agreement between the two distributions.
447
+ - Root Mean Square Error (RMSE): Quantifies the average magnitude of errors between predicted and observed values. Lower RMSE scores reflect higher accuracy
448
+
449
+ D.5. Clustering Quality Metrics To evaluate the geometric coherence and separation of clusters in the learned gene embedding space, we include two additional metrics:
450
+ Davies-Bouldin Index (DBI): Quantifies the ratio of intra-cluster dispersion to inter-cluster separation. Lower DBI values indicate better-defined clusters with high intra-cluster similarity and distinct separation between clusters.
451
+ - Calinski-Harabasz Score (CHS): Measures the ratio of between-cluster dispersion to within-cluster dispersion. Higher CHS values reflect dense, well-separated clusters
452
+
453
+ # E. Supplementary Results:
454
+
455
+ <table><tr><td>Methods</td><td>w\ external knowledge</td><td>ARI ↑</td><td>NMI ↑</td><td>ASW ↑</td><td>batchASW ↑</td><td>iLISI ↑</td></tr><tr><td>sciLaMA-GenePT</td><td>✓</td><td>0.545</td><td>0.767</td><td>0.539</td><td>0.863</td><td>0.240</td></tr><tr><td>sciLaMA-CellPLM</td><td>✓</td><td>0.479</td><td>0.723</td><td>0.541</td><td>0.871</td><td>0.257</td></tr><tr><td>sciLaMA-ProtTrans</td><td>✓</td><td>0.547</td><td>0.749</td><td>0.538</td><td>0.864</td><td>0.229</td></tr><tr><td>sciLaMA-ChatGPT</td><td>✓</td><td>0.545</td><td>0.762</td><td>0.534</td><td>0.863</td><td>0.225</td></tr><tr><td>sciLaMA-scGPT</td><td>✓</td><td>0.522</td><td>0.746</td><td>0.526</td><td>0.867</td><td>0.223</td></tr><tr><td>sciLaMA-ESM</td><td>✓</td><td>0.494</td><td>0.722</td><td>0.529</td><td>0.864</td><td>0.253</td></tr><tr><td>sciLaMA (s.i.)</td><td>×</td><td>0.436</td><td>0.698</td><td>0.539</td><td>0.832</td><td>0.210</td></tr></table>
456
+
457
+ Table S4. Cell representation learning and integration performance on human pancreatic datasets across variants of sciLaMA models
458
+
459
+ <table><tr><td>Methods</td><td>cLISI ↑</td></tr><tr><td>sciLaMA-GenePT</td><td>0.995</td></tr><tr><td>sciLaMA-CellPLM</td><td>0.995</td></tr><tr><td>sciLaMA-ProtTrans</td><td>0.992</td></tr><tr><td>sciLaMA-ChatGPT</td><td>0.993</td></tr><tr><td>sciLaMA- scGPT</td><td>0.993</td></tr><tr><td>sciLaMA- ESM</td><td>0.993</td></tr><tr><td>sciLaMA (s.i.)</td><td>0.987</td></tr><tr><td>scGPT fine-tuned</td><td>0.998</td></tr><tr><td>scVI-batch</td><td>0.982</td></tr><tr><td>scVI-raw</td><td>0.972</td></tr><tr><td>scGPT zero-shot</td><td>0.951</td></tr><tr><td>CellPLM zero-shot</td><td>0.961</td></tr><tr><td>GenePT-w</td><td>0.838</td></tr></table>
460
+
461
+ Table S5. Graph Cell-Type Integration Local Inverse Simpson's Index (cLISI) scores across methods (listed as supplementary result due to the low variance of 0.001714)
462
+
463
+ <table><tr><td>Methods</td><td>w\external knowledge</td><td>PCC (↑)</td><td>SCC (↑)</td><td>JSD (↓)</td><td>RMSE (↓)</td></tr><tr><td>sciLaMA-GenePT</td><td>✓</td><td>0.220 ± 0.029</td><td>0.214 ± 0.031</td><td>0.280 ± 0.009</td><td>1.243 ± 0.023</td></tr><tr><td>sciLaMA-CellPLM</td><td>✓</td><td>0.222 ± 0.027</td><td>0.218 ± 0.028</td><td>0.286 ± 0.009</td><td>1.242 ± 0.022</td></tr><tr><td>sciLaMA-ProtTrans</td><td>✓</td><td>0.218 ± 0.026</td><td>0.211 ± 0.028</td><td>0.283 ± 0.009</td><td>1.246 ± 0.021</td></tr><tr><td>sciLaMA-ChatGPT</td><td>✓</td><td>0.219 ± 0.027</td><td>0.217 ± 0.027</td><td>0.282 ± 0.009</td><td>1.244 ± 0.022</td></tr><tr><td>sciLaMA-scGPT</td><td>✓</td><td>0.219 ± 0.027</td><td>0.217 ± 0.027</td><td>0.285 ± 0.009</td><td>1.244 ± 0.022</td></tr><tr><td>sciLaMA-ESM</td><td>✓</td><td>0.233 ± 0.026</td><td>0.227 ± 0.027</td><td>0.282 ± 0.009</td><td>1.233 ± 0.022</td></tr><tr><td>sciLaMA (s.i.)</td><td>×</td><td>0.202 ± 0.027</td><td>0.212 ± 0.025</td><td>0.286 ± 0.009</td><td>1.258 ± 0.022</td></tr><tr><td>sciLaMA (random)</td><td>×</td><td>0.051 ± 0.027</td><td>0.049 ± 0.031</td><td>0.289 ± 0.009</td><td>1.374 ± 0.020</td></tr><tr><td>sciLaMA (shuffled)</td><td>×</td><td>0.056 ± 0.036</td><td>0.043 ± 0.037</td><td>0.288 ± 0.009</td><td>1.366 ± 0.027</td></tr></table>
464
+
465
+ Table S6. Evaluation of gene expression imputation performance on spatial transcriptomics data across variants of sciLaMA models
466
+
467
+ <table><tr><td>Methods</td><td>w/ external knowledge</td><td>Davies-Bouldin Index (↓)</td><td>Calinski-Harabasz Score (↑)</td></tr><tr><td>sciLaMA-GenePT</td><td>✓</td><td>0.852</td><td>16.376</td></tr><tr><td>sciLaMA-CellPLM</td><td>✓</td><td>0.727</td><td>19.610</td></tr><tr><td>sciLaMA-ProtTrans</td><td>✓</td><td>0.802</td><td>19.947</td></tr><tr><td>sciLaMA-ChatGPT</td><td>✓</td><td>0.874</td><td>16.522</td></tr><tr><td>sciLaMA-scGPT</td><td>✓</td><td>0.780</td><td>17.973</td></tr><tr><td>sciLaMA-ESM</td><td>✓</td><td>0.780</td><td>16.920</td></tr><tr><td>sciLaMA (s.i.)</td><td>×</td><td>0.977</td><td>13.087</td></tr></table>
468
+
469
+ Table S7. Clustering performance comparison for marker gene identification across variants of sciLaMA models
470
+
471
+ <table><tr><td>γ</td><td>ARI mean</td><td>ARI std</td><td>NMI mean</td><td>NMI std</td><td>ASW mean</td><td>ASW std</td><td>cLISI mean</td><td>cLISI std</td></tr><tr><td>0</td><td>0.464</td><td>0.371</td><td>0.513</td><td>0.390</td><td>0.589</td><td>0.087</td><td>0.881</td><td>0.170</td></tr><tr><td>0.01</td><td>0.582</td><td>0.021</td><td>0.734</td><td>0.022</td><td>0.645</td><td>0.010</td><td>0.990</td><td>0.002</td></tr><tr><td>0.05</td><td>0.665</td><td>0.114</td><td>0.763</td><td>0.041</td><td>0.654</td><td>0.005</td><td>0.991</td><td>0.002</td></tr><tr><td>0.1</td><td>0.634</td><td>0.088</td><td>0.751</td><td>0.023</td><td>0.658</td><td>0.012</td><td>0.992</td><td>0.002</td></tr><tr><td>0.25</td><td>0.581</td><td>0.024</td><td>0.743</td><td>0.013</td><td>0.655</td><td>0.006</td><td>0.990</td><td>0.002</td></tr><tr><td>0.5</td><td>0.592</td><td>0.010</td><td>0.747</td><td>0.004</td><td>0.658</td><td>0.012</td><td>0.993</td><td>0.001</td></tr><tr><td>0.75</td><td>0.590</td><td>0.015</td><td>0.748</td><td>0.013</td><td>0.656</td><td>0.012</td><td>0.992</td><td>0.002</td></tr><tr><td>1</td><td>0.647</td><td>0.107</td><td>0.762</td><td>0.038</td><td>0.651</td><td>0.025</td><td>0.993</td><td>0.003</td></tr></table>
472
+
473
+ Table S8. Effect of scalar $\gamma$ on clustering performance across multiple metrics.
474
+
475
+ <table><tr><td>K</td><td>Latent dim</td><td>ARI mean</td><td>ARI std</td><td>NMI mean</td><td>NMI std</td><td>ASW mean</td><td>ASW std</td><td>cLISI mean</td><td>cLISI std</td></tr><tr><td>10</td><td>0.651</td><td>0.110</td><td>0.756</td><td>0.042</td><td>0.654</td><td>0.005</td><td>0.991</td><td>0.002</td><td></td></tr><tr><td>20</td><td>0.627</td><td>0.082</td><td>0.761</td><td>0.025</td><td>0.631</td><td>0.015</td><td>0.991</td><td>0.000</td><td></td></tr><tr><td>30</td><td>0.583</td><td>0.017</td><td>0.742</td><td>0.022</td><td>0.633</td><td>0.014</td><td>0.991</td><td>0.001</td><td></td></tr><tr><td>40</td><td>0.680</td><td>0.114</td><td>0.771</td><td>0.039</td><td>0.637</td><td>0.009</td><td>0.991</td><td>0.002</td><td></td></tr><tr><td>50</td><td>0.606</td><td>0.085</td><td>0.743</td><td>0.023</td><td>0.631</td><td>0.010</td><td>0.990</td><td>0.002</td><td></td></tr><tr><td>60</td><td>0.649</td><td>0.100</td><td>0.757</td><td>0.030</td><td>0.631</td><td>0.015</td><td>0.990</td><td>0.002</td><td></td></tr><tr><td>70</td><td>0.590</td><td>0.037</td><td>0.738</td><td>0.017</td><td>0.635</td><td>0.009</td><td>0.991</td><td>0.001</td><td></td></tr><tr><td>80</td><td>0.649</td><td>0.095</td><td>0.753</td><td>0.020</td><td>0.632</td><td>0.009</td><td>0.991</td><td>0.001</td><td></td></tr><tr><td>90</td><td>0.656</td><td>0.102</td><td>0.756</td><td>0.030</td><td>0.637</td><td>0.008</td><td>0.991</td><td>0.001</td><td></td></tr><tr><td>100</td><td>0.641</td><td>0.108</td><td>0.751</td><td>0.027</td><td>0.635</td><td>0.006</td><td>0.991</td><td>0.002</td><td></td></tr></table>
476
+
477
+ Table S9. Effect of varying latent dimension $K$ on clustering performance across multiple metrics.
478
+
479
+ ![](images/2384353210108ca106e8468a82d28025afb0bef59ce100ab6939c1b3ada7a15e.jpg)
480
+
481
+ ![](images/f04e281a6b311f55789035ed4b1b06f4318d38a046b733ce07a5b5763f93c931.jpg)
482
+
483
+ ![](images/24413e665a1115fd3fa6253299743600afcec905764741c1c85178c6392b0120.jpg)
484
+ Figure S2. Benchmark of cell representation learning. (a) Radar plot showing the performance across six established metrics, comparing single cell SOTA methods (scVI and scVI-batch), zero-shot models (GenePT-w, CellPLM, and scGPT), a fine-tuned model (scGPT), and comparable sciLaMA-based models (sciLaMA-GenePT/CellPLM/scGPT). (b-c) UMAP visualizations of cell embeddings derived from various models, with colors indicating cell types (top) and batch origins (bottom). (b) includes foundation models in zero-shot mode, while (c) presents sciLaMA-based models in additional to those from Figure 2c.
485
+
486
+ ![](images/b891357e46bfae6ffb86c34a59fb0d508bf3a28416ba8a503bef832df2d20c47.jpg)
487
+ Figure S3. Enhanced developmental cell trajectory analysis with sciLaMA. (a) UMAP visualizations of cell embeddings from sciLaMA (top) and scVI (bottom) colored by inferred pseudotime via Palantir. (b) Heatmaps of dynamic gene expression changes by pseudotime (x-axis) with genes ordered by temporal specificity (y-axis). Top shows sciLaMA-based pseudotime, bottom shows scVI results.
488
+
489
+ ![](images/67ba9ebb76f1d751a5f50b5b562a481a180964de7f7d00588eeb3648c4a10c4a.jpg)
490
+
491
+ ![](images/725c615026b594e233df1dc5ffc468224ca7efa300f8939e0f2767cdfa6437bb.jpg)
492
+ Figure S4. This visualization presents results from sciLaMA (with latent dimensionality $K = 2$ ) trained on an exemplar fetal liver dataset (Choi et al., 2023). The cell embeddings (middle-left; dots represent individual cells) are colored according to annotated cell types, while the contextual gene embeddings (middle-right; dots represent individual genes) show corresponding embedding dimensions. The top and bottom panels illustrate cell embeddings colored by expression levels of genes sampled from distinct regions of the contextual gene embedding space. We quantitatively assessed sciLaMA's interpretability by computing feature attribution scores using Integrated Gradients applied to the pretrained cell VAE encoder. This resulted in a gene-by-latent-node attribution matrix, which we summarized into a single gene vector by aggregating absolute attribution scores. To facilitate comparison, we projected sciLaMA's contextual gene embeddings into a comparable vector form using vector normalization. The strong correlations (Pearson $r = 0.43$ , Spearman $\rho = 0.46$ ) indicate that sciLaMA effectively captures key gene features in alignment with traditional stepwise attribution methods, yet does so within a more efficient, unified framework.
scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1315abb91d9c4bf166541f57c352be7cdbb76f47f1dc0cfc1f5105ebde320484
3
+ size 1291220
scilamaasinglecellrepresentationlearningframeworktoleveragepriorknowledgefromlargelanguagemodels/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af0606bc67e25749ecfb4477ea19626d849fac66c735a2696114982324068220
3
+ size 572883
scsslbenchbenchmarkingselfsupervisedlearningforsinglecelldata/e3272a7b-9b2d-4675-9e7c-9b951557e63e_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cf6748fc5aac679f7d2fe015da91f6c49b746d26d4ef7a259867b8ba06c6bf6
3
+ size 163851
scsslbenchbenchmarkingselfsupervisedlearningforsinglecelldata/e3272a7b-9b2d-4675-9e7c-9b951557e63e_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f92f16ef487a9b914164f93fe8dc830bbf12a94cfd3ec1433b051239b6624b43
3
+ size 191783