Embedding Trajectory for Out-of-Distribution Detection in Mathematical Reasoning

Real-world data deviating from the independent and identically distributed (i.i.d.) assumption of in-distribution training data poses security threats to deep networks, thus advancing out-of-distribution (OOD) detection algorithms. Detection methods in generative language models (GLMs) mainly focus on uncertainty estimation and embedding distance measurement, with the latter proven to be most effective in traditional linguistic tasks like summarization and translation. However, another complex generative scenario mathematical reasoning poses significant challenges to embedding-based methods due to its high-density feature of output spaces, but this feature causes larger discrepancies in the embedding shift trajectory between different samples in latent spaces. Hence, we propose a trajectory-based method TV score, which uses trajectory volatility for OOD detection in mathematical reasoning. Experiments show that our method outperforms all traditional algorithms on GLMs under mathematical reasoning scenarios and can be extended to more applications with high-density features in output spaces, such as multiple-choice questions.

Paper

Similar papers

Peer review

Reviewer oehe7/10 · confidence 2/52024-07-12

Summary

This work studied the ODD detection in mathematical reasoning, which presents a new measurement, TV score, based on the observed pattern collapse property and early stabilization of GLMs. It seems the first discussion on the OOD detection in mathematical reasoning.

Strengths

This appears to be the first discussion on OOD detection in mathematical reasoning. The authors clearly explain why the trajectory works in an understandable and empirical manner. The manuscript is well-organized, and the methodology is both simple and effective.

Weaknesses

1. Additional metrics commonly used for ODD should be included for evaluation. 2. The writing requires improvement. 3. Further insight into the potential impact of over-smoothing on the setting of the critical parameter $k$ is necessary.

Questions

1. Is it true that the embedding dimension should be fixed across layers to compute the embedding difference between neighboring layers? 2. To better support the claim of choosing $k \leq 5$, it would be beneficial to provide a quantitative analysis of over-smoothing occurrence when $k$ is set to a larger value. 3. For testing the ODD performance, could you report the evaluation results in terms of AUPR and F1? 4. Which datasets were used for the analysis in Figure 3? 5. There are some grammatical mistakes that need fixing. Here are a few examples: (a) "we need ..., then computer ..." in Line 150. (b) The sentence in Lines 161-162. (c) "Outliers ..., then lead ..." in Lines 164-165.

Rating

7

Confidence

2

Soundness

3

Presentation

3

Contribution

3

Limitations

The authors adequately claimed the limitations of this work.

Reviewer A7h43/10 · confidence 3/52024-07-13

Summary

This paper presents a trajectory-based method for OOD detection in the mathematical reasoning setting. OOD detection is extensively studied in the text setting and image setting. The main motivation of this work is claimed to that mathematical reasoning poses significant challenges to embedding-based methods due to its high-density feature of output spaces, but this feature causes larger discrepancies in the embedding shift trajectory between different samples in latent spaces. The proposed method uses trajectory volatility for OOD detection in mathematical reasoning. Experiments are conducted to validate the performance of the proposed method.

Strengths

This paper studies OOD detection in the mathematical reasoning setting, which is less studied compared to text and image setting. This paper uses examples to illustrate the motivation and key idea. This improves the accessibility of this paper.

Weaknesses

The motivation is not strong and convincing. Figure 1 illustrates two challenges with respect to the input space and out space respectively. It is not convincing, and more evidence or data analysis should be provided to make these two challenges solid. I do not buy that pattern collapse is generally hold for all types of mathematical reasoning tasks. The example is just a special case. The output can take any value in the real line, and the collapse probability not that high. The idea of the proposed method is not convincing. I am not convinced that early stabilization is generally held for mathematical reasoning problems. More evidence should be provided to justify it. The writing is also not precise. For example, in Equation (1), the domain of f is not specified. The notation \phi is not defined. Also, the experiment is not solid. There is no experiment to justify that the performance improvement is due to addressing the challenges in the input space and output space posed in the Introduction.

Questions

See weakness.

Rating

3

Confidence

3

Soundness

2

Presentation

2

Contribution

2

Limitations

See weakness.

Reviewer KF5B6/10 · confidence 4/52024-07-15

Summary

This paper studies the OOD problem in GLMs under mathematical reasoning and found that the the patter collapse phenomena in the output space. The trajectory violation score is proposed to distinguish the ID and OOD samples. A thorough evaluation shows that the proposal can outperform traditional algorithms under offline detection, online detection, and quality estimation.

Strengths

(+) This paper is well structured and well-written. (+) The authors conduct a thorough evaluation of the proposed methods

Weaknesses

(-) The input data for the empirical study in Figure 3 is not introduced. Thus, whether it can reflect the scenario of mathematical reasoning is not clear. It lacks theoretical analysis. (-) The relationship of the pattern collapse (in Figure 1) and the early stabilization (in Figure 3) is not clearly illustrated. (-) The datasets for experiments are quite limited.

Questions

1. What is the internal relationship between the pattern collapse (in Figure 1) and the early stabilization (in Figure 3)?

Rating

6

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

The limitations are adequately addressed.

Reviewer SAjz5/10 · confidence 3/52024-07-18

Summary

This work discusses a novel method for out-of-distribution (OOD) detection in generative language models (GLMs), particularly in the context of mathematical reasoning tasks. The key insights are: 1) The high-density output space in mathematical reasoning leads to a "pattern collapse" that causes larger discrepancies in the embedding shift trajectory between different samples in latent spaces, 2) GLMs exhibit early stabilization for in-distribution (ID) samples in mathematical reasoning, while OOD samples do not show this behavior.

Strengths

The authors propose a novel trajectory-based method called "TV score" that leverages the unique characteristics of the high-density output space in mathematical reasoning tasks to effectively detect OOD samples. This approach goes beyond the traditional OOD detection methods focused on uncertainty estimation and embedding distance measurement, which struggle in the challenging mathematical reasoning domain. Robust OOD detection is crucial for the real-world deployment of generative language models, as these models are susceptible to performance degradation when faced with out-of-distribution inputs. The authors' work addresses a practical and important problem in the field, as mathematical reasoning tasks are increasingly incorporated into language models with high-stakes applications. The authors' analysis of the unique characteristics of the input and output spaces in mathematical reasoning tasks provides valuable theoretical insights into the challenges posed by this domain for OOD detection.

Weaknesses

The underlying mechanism of the TV score method and its relationship to the observed "pattern collapse" in the output space is not fully explained. Providing a more detailed analysis and visualization of the trajectory dynamics, as well as the intuition behind the choice of trajectory volatility as the detection metric, would enhance the interpretability of the approach. The computational complexity of the TV score method is not discussed, which is an important consideration for real-world deployment, especially in resource-constrained environments. Investigating the computational efficiency of the method and exploring potential optimizations or approximations would be valuable for improving its practical applicability. The paper does not address the robustness of the TV score method to adversarial attacks, which is a critical consideration for the security of generative language models. Evaluating the method's performance under different types of adversarial perturbations and developing strategies to improve its robustness would be a valuable extension of this work.

Questions

What is the underlying mechanism of the TV score method, and how does it relate to the observed "pattern collapse" in the output space? How can providing a more detailed analysis and visualization of the trajectory dynamics, as well as the intuition behind the choice of trajectory volatility as the detection metric, enhance the interpretability of the approach? How does the computational complexity of the TV score method impact its real-world deployment, especially in resource-constrained environments? What steps can be taken to investigate the computational efficiency of the method and explore potential optimizations or approximations to improve its practical applicability? How robust is the TV score method to adversarial attacks, and what are the critical considerations for the security of generative language models? What steps can be taken to evaluate the method's performance under different types of adversarial perturbations and develop strategies to improve its robustness?

Rating

5

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

NA

Authorsrebuttal2024-08-13

Thanks for reviewing & Invite feedback

Dear Reviewer SAjz, We want to express our sincere appreciation for your efforts and time spent reviewing our work and the constructive comments. During the rebuttal period, we have provided a detailed response to address all the concerns mentioned by you about **mechanism, complexity, and robustness**. With the reviewer-author discussion period ending in one day, we kindly invite you to give some feedback on our responses, and we really hope our responses adequately address your concerns. Best, Authors

Authorsrebuttal2024-08-14

Dear Reviewer SAjz, With the reviewer-author discussion period coming to an end, we really hope that we can get your feedback, and that our responses adequately address your concerns. Best, Authors

Authorsrebuttal2024-08-10

Thanks for reviewing & Invite feedback

Dear Reviewers, We want to express our sincere appreciation for your efforts and time spent reviewing our work and the insightful and constructive comments. During the rebuttal period, we have provided a detailed response to address all the concerns mentioned by all reviewers. With the reviewer-author discussion period half over, we kindly invite you to give some feedback on our responses, and we really hope our responses adequately address your concerns. Best, Authors

Reviewer A7h42024-08-12

Many thanks for the clarification. After reading the response, most of my concerns still remain such as consolidate the "Pattern Collapse" phenomenon, experiment finding, evaluation, etc. This paper presents some interesting idea, but it needs many ideas to make it solid. Given this, I like to maintain my score.

Authorsrebuttal2024-08-13

Thanks for response & Invite open discussion

Thanks for your response. Regarding *"consolidate the "Pattern Collapse" phenomenon, experiment finding, evaluation, etc."*, we have already provided a detailed response in the rebuttal stage, including clarification, statistics, visualizations, and quotations. Here we present some key evidence and conclusions again: --- ### 1. "Pattern Collapse" phenomenon (Evidence: Fact Clarification & Statistics) First, **we have clarified that the language model's modeling of mathematical expressions is based on tokenization**, so "pattern collapse" occurs at the discrete token level, not at the level of mathematical sense. Understanding "pattern collapse" in terms of the real number line is misconceived, and it goes against the way language models are modeled. Second, **we have given statistics** on seven different types of math tasks with different domains and difficulty levels, and have compared them to two classic text generation tasks, translation and summarization. We mainly focus on the number of token types and the duplication rate, which can reflect how much the model collapses at the token level when predicting. We again present the results as follows: |Types of Tasks|token number in dataset |token type number in dataset |Token Duplication Rate|Vocab Coverage| |---|---|---|---|---| |***Mathematical Reasoning***||||| |Arithmetic (primary difficulty)|16136|14|99.9%|0.04%| |Arithmetic (middle-school difficulty)|5663|16|99.7%|0.05%| |Algebra|5234|107|98.0%|0.33%| |Geometry|2615|75|97.1%|0.23%| |Counting and probability|2524|43|98.3%|0.13%| |number theory|2395|71|97.1%|0.22%| |precalculus|3388|84|97.5%|0.26%| |*Average* | *5422* | *58* | *98.9%*| *0.18%*| |***Text Generation***|||| |Translation|2500 |1065 | 57.4% | 3.32% | ||5000 | 1832| 63.3% | 5.10% | ||10000 | 2980 | 70.2% | 9.31% | || 15000 | 3494 | 76.7% | 10.61% | |*Average* | *5833* | *1959* | *66.4%*| *6.12%*| |***Summarization***|||| ||2500 |1265 | 49.4% | 4.01% | ||5000 | 1970 | 60.6% | 6.16% | ||10000 | 3192 | 68.0% | 9.98% | ||15000 | 3876 | 74.1% | 12.11% | |*Average* | *5833* | *2142* | *63.2%* | *6.69%*| **The average token duplication rate is up to 99% on all math tasks, and even a staggering 99.9% on some simple arithmetic tasks; The token duplication rate exceeded 97% on all seven math tasks of different difficulties and types. This demonstrates that the "pattern collapse" occurs on generally all types of mathematical reasoning tasks.** --- ### 2. "Early Stabilization" finding (Evidence: Visualization) In our GENERAL REBUTTAL, **we have given detailed visualizations** of trajectories across ten datasets of different domains and different difficulty levels in mathematical reasoning. We have also given the average volatility statistics for layers 1-31 (full layers), 20-31, and 26-31 on each dataset corresponding to the visualizations as follows: |Dataset |1-31 layers |20-31 layers | 26-31 layers| | --- | --- | --- | --- | | *ID Dataset* | | | | | | MultiArith | 6.53 | 14.84 | 10.89 | | *Near-shift OOD Dataset* | | | | | | GSM8K | 8.60 | 20.55| 26.43 | | SVAMP | 8.02 | 18.82 | 24.68 | | AddSub | 8.72 | 20.54 | 27.24 | | SingleEq | 8.14 | 19.26 | 22.42 | | SingleOp | 7.50 | 17.17 | 21.62 | | *Far-shift OOD Dataset* | | | | | | MATH-Algebra | 8.83 | 21.35 | 31.50 | | MATH-Geometry | 10.00 | 25.27 | 34.14 | | MATH-Count_and_Prob | 10.30 | 25.77 | 33.70 | | MATH-Number_Theory | 9.40 | 23.10 | 33.86 | **In all ten datasets, the phenomenon of "early stabilization" is significantly present, and it can be sufficiently demonstrated that "early stabilization" is universal in mathematical reasoning.** --- ### 3. Experiment Justification (Evidence: Quotation) **We have explained your misunderstanding** about the purpose of our paper by quoting from the original text: * The two "challenges" are faced by existing embedding-based methods that cannot be applied to mathematical reasoning, not by us. *As stated in lines 38-39, “However, embedding-based methods encounter challenges under mathematical reasoning scenario”.* * We aim to circumvent the two challenges faced by existing methods, not to address them. We are not improving on existing methods, but rather two different research ideas. *As stated in lines 47-48, “Therefore, we transform our perspective from the static embedding representation to the dynamic embedding shift trajectory in the latent space".* --- We strongly respect your concerns about the evidence we gave, and an open discussion always helps us to recognize our limited considerations. Unfortunately, we have not received targeted details of your concerns, can you tell us what it is about our evidence that you do not recognize? Your proposed valuable issues will largely help us to improve our paper quality, and we look forward to a more open discussion with you, thanks!

Reviewer KF5B2024-08-13

Thanks for the clarification, and my concerns have been mostly addressed. As it is a very important research problem and many illustrations and experiments have been supplemented, I'm happy to increase my score.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC