<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Epigraph Based Multilevel Optimization (EMO) for Enhancing Chain-of-Thought Reasoning Capabilities</title></titleStmt>
			<publicationStmt>
				<publisher>IEEE</publisher>
				<date>04/06/2025</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10586475</idno>
					<idno type="doi">10.1109/ICASSP49660.2025.10889376</idno>
					
					<author>Songtao Lu</author><author>Yanna Ding</author><author>Lior Horesh</author><author>Jianxi Gao</author><author>Malik Magdon-Ismail</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Chain-of-thought (CoT) reasoning applies to complex tasks with multiple intermediate steps, a key feature of large language models. Recent studies have revealed CoT as a composition of in-context filtering and learning. This paper proposes a unified framework for CoT optimization that exploits the nested problem structure to formulate training as multilevel optimization. Each intermediate reasoning step is a distinct optimization level. We develop an epigraph-based multilevel optimization (EMO) method to iteratively find the optimal solution for this class of problems. Experiments using GPT-2 show that the proposed EMO achieves the lowest generalization errors across all intermediate steps compared to state-of-the-art, highlighting the importance of nested optimization approaches for CoT reasoning.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">INTRODUCTION</head><p>Large language models (LLMs) with transformer architectures <ref type="bibr">[1,</ref><ref type="bibr">2]</ref> demonstrate complex reasoning that captures dependencies over long sequences <ref type="bibr">[3]</ref>. LLMs excel at in-context learning, meaning that once pre-trained, they can implicitly fine-tune based on new prompts and generate high-quality sentences without updating the model parameters <ref type="bibr">[4,</ref><ref type="bibr">5]</ref>. Self-attention is the mechanism that prioritizes relevant features from the prompt, aligning them with learned features to produce predictions <ref type="bibr">[6]</ref><ref type="bibr">[7]</ref><ref type="bibr">[8]</ref>.</p><p>LLM reasoning is enhanced when step-by-step instructions are given <ref type="bibr">[9]</ref>. For example, to learn the relationship y = (2x) 2 , a composition of 2x and x 2 , a prompt like p : (x = 1, y = 4) leaves the mapping from x to y ambiguous. If intermediate steps are given, p : (x = 1, s = 2x = 2, y = s 2 = 4), the relationship is easier to learn due to the reduced ambiguity. The richer prompt makes the model predictions more accurate and informative with clear in-context meaning. A reasoner's ability to reveal intermediate steps is referred to as chain-of-thought (CoT) reasoning <ref type="bibr">[9]</ref>. Circuit complexity results <ref type="bibr">[10]</ref> show that CoT prompting is necessary for complex problems, such as dynamic programming (bounded-depth Transformers fail unless the model size grows super-polynomially in input length). By increasing the number of intermediate steps Transformers become more expressive <ref type="bibr">[11]</ref>, e.g., Boolean circuits of size K can be represented using O(K) CoT steps <ref type="bibr">[12]</ref>.</p><p>Even though the reasoning capability can be enhanced by the CoT-style recursive decoding process, Transformer-based models are still trained using traditional methods. As discussed in the existing literature <ref type="bibr">[13]</ref>, CoT model training primarily focuses on minimizing the sum of inference errors at each step, neglecting the chain structure of the reasoning process. Motivated by the decoding procedure, it is more reasonable to formulate CoT as a multilevel programming problem, as the quality of each step depends on all preceding ones. Therefore, the accuracy of the first step is more critical than that of subsequent steps, with the same logic applying to the second, third, and so on. However, solving multilevel optimization (MLO) problems is challenging. Due to the nested structure, computing the derivatives at each level requires higher-order information from all lower-level loss functions <ref type="bibr">[14]</ref>, such as Jacobian or Hessian inverse matrices, even in the bilevel case <ref type="bibr">[15]</ref>. Several approaches, including approximate implicit differentiation <ref type="bibr">[16]</ref>, recursive matrix inversion-based gradient descent <ref type="bibr">[17]</ref>, the penalty-based method <ref type="bibr">[18]</ref>, and the primal-dual method <ref type="bibr">[19]</ref>, have been developed to solve bilevel optimization problems. However, when applying these methods to MLO, it becomes necessary to compute complex implicit gradients using second-order information from the loss functions <ref type="bibr">[20,</ref><ref type="bibr">21]</ref>, which makes the algorithms impractical for large-scale problems due to increased computational complexity. Additionally, the nested structure in MLO may cause the conditions required by existing methods to fail, e.g., penalty methods. To the best of our knowledge, none of the existing methods rely solely on first-order information to solve MLO problems.</p><p>In this paper, we propose a nested structured training framework to improve CoT reasoning capabilities. By leveraging constrained optimization techniques, we introduce an epigraph-based multilevel optimization (EMO) algorithm to solve this problem, applying subgradient descent only to the maximum loss function across all levels. Theoretical discussions show that EMO effectively addresses nested multilevel model training problems, where the loss functions at all levels are nonconvex and smooth, while providing theoretical guarantees of convergence. Numerical experiments with GPT-2 demonstrate that when trained using this nested structure with EMO, the model accurately outputs all intermediate inference steps for both in-distribution and out-of-distribution (OOD) prompts, outperforming the traditional single-level empirical risk minimization strategy. The major contributions of this work are highlighted as follows:</p><p>nested framework for CoT model training with immediate reasoning steps is established based on an MLO problem. &#8621; Our proposed epigraph subgradient algorithm is the first method that finds an &#969;-approximate solution to the reformulated MLO problem with K levels in O(log K (1/&#969;)/&#969; 4 ) iterations. &#8621; Experiments show EMO achieves the best efficiency and test errors compared to the state-of-the-art.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">PROBLEM FORMULATION OF COT</head><p>We use the CoT setup in <ref type="bibr">[13]</ref>. The ground truth target function is a reasoning chain that maps from features {xi} to labels {yi}, denoted as F , where</p><p>In a standard learning setup, the prompt containing the n training data points plus the test query is given by p = {(x1, y1), . . . , (xn, yn), (xq, ?)}, where yi = F (xi). In the CoT setup, the training data also contains the labels of the intermediate functions and the in-context prompt becomes p = {(x1, s1), . . . , (xn, sn), (xq, ?)},</p><p>where the vector si = [s 1 i , . . . , s K i ] contains the labels at every level of the ground truth CoT target F for input xi. Let s 0 i = xi. Then,</p><p>Here, that s k i represents the kth intermediate step in the CoT, yi = s K i , and the function F k at the kth step is in some function class F k .</p><p>We approximate F by a Transformer TF &#969; having parameters &#949;. The Transformer predicts on input xi to get &#349;1 i , then on input (xi, &#349;1 i ) to get &#349;2 i and so on until it gets &#349;K</p><p>To recover &#949;, we minimize a loss. Unlike in <ref type="bibr">[13]</ref>, we define a loss that exploits the multilevel structure of the CoT process. Intuitively, we want to match every intermediate step of the ground truth, that is to minimize </p><p>and &#949; &#949; k are the parameters that attain the minimum in the constrained optimization above. As seen in ( <ref type="formula">5</ref>), the model learns the intermediate steps level by level. Indeed, the model with parameters &#949; &#949; k approximates intermediate steps 1, . . . , k. The full learned model is &#949;&#949; = &#949; &#949; K . Note that learning the level-k model &#949; &#949; k while requiring that all earlier levels are optimal is a stringent constraint, especially if the model TF &#969; lacks sufficient expressiveness. By adding some slack to this constraint, in the next section we reformulate a relaxed version of the problem allowing us to develop an efficient method to find an approximate solution using only gradients.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">NESTED MULTILEVEL OPTIMIZATION</head><p>Directly solving (5) is nontrivial even for the bilevel case. Instead, we can relax this inequality to fj(&#949;) &#8595; Ej &#8596; &#982;, where &#982; &gt; 0 is the relaxation variable, such that there exists an interior point satisfying this constraint, i.e., the Slater condition always holds <ref type="bibr">[22]</ref>.</p><p>By recursively applying this property backward from the Kth to the 1st level, the original MLO problem (5) can be reformulated as</p><p>where inequality constraint functions</p><p>) Note that unless the optimal solution sets of these multilevel problems overlap, classic single-level constrained problems are fundamentally different from multilevel ones. We impose an order in the optimization process, where the kth-level optimization depends on the (k &#8595; 1)th-level. Major Challenge. One of the most straightforward approaches might be the penalty method, which simply penalizes the constraints in the objective, transforming the problem into a single-level optimization problem. This method works well for constrained optimization or even bilevel optimization, but it may face challenges in selecting an appropriate step size if it is adopted for solving MLO. The reason is that when there are multiple levels of constraints, for example, three levels, the penalized objective can involve higher-order terms of the penalty parameters. In this case, the objective might take the form f3(&#949;) + &#1009;g2(&#949;) + &#1009; 2 g1(&#949;), which affects the gradient Lipschitz constant of the loss function. This, in turn, results in the step-size requirement for ensuring convergence of gradient descent-type algorithms being on the order of O(1/&#1009; k ). It is evident that when &#1009; &gt; 1, the required step size will be very small, which hinders the learning process. New Algorithm. We propose an epigraph reformulation <ref type="bibr">[22]</ref> of this problem by introducing a slack variable as follows.</p><p>min</p><p>s.t. . . . , s.t. g1(&#949;) &#8596; 0. (8b) Rather than minimize the original loss function, we minimize an upper bound. Using the epigraph form, we rewrite min &#969;,z z, s.t. g(&#949;, z) &#8596; 0 as minz z, s.t. min &#969; g(&#949;, z) &#8596; 0 [23, Theorem 3], which corresponds to the original form of the problem as min z&#8593;0 z (9a) s.t. min &#969; gK&#8594;1(&#949;) &#8619; max{gK&#8594;1(&#949;), fK (&#949;) &#8595; z} &#8596; 0, (9b) s.t. gK&#8594;2(&#949;) &#8596; 0, . . . s.t. g1(&#949;) &#8596; 0.</p><p>Recursively applying this rule forward from level 1 up to K gives min</p><p>Update of &#949;. The last level optimization problem finds a &#949; such that the maximum function value among g1(&#949;), . . . , g k (&#949;) &#8595; K&#8594;1 i=k zi, and fK (&#949;)</p><p>i=k zi, . . . , fK (&#949;) &#8595; K&#8594;1 i=1 zi} be the index of the loss function that has the maximum value. One of the most computationally efficient algorithms for optimizing the maximum of a set of functions is the (stochastic) subgradient descent method. Let &#962;f (&#8226;) denote the subdifferential of f (&#8226;). Since E k is not a function of &#949;, we can update the variables by applying the k &#949; (&#949; (r) )th-level loss function as follows:</p><p>where r indexes the iterations, &#966; is the learning rate,</p><p>Update of {z k , &#8599;k}. Once the above optimization process is complete (i.e., either when the maximum value of all loss functions is less than 0 for (z1, . . . , zK&#8594;1), or the maximum number of iterations is reached), we can further adjust the values of {z k , &#8599;k} such that &#949; can be optimized for all levels of the loss functions. One issue here is that E k is generally unknown; however, a bisection algorithm can be applied to find z k for all k and ensure convergence. Specifically, we initialize z</p><p>K&#8594;1 with large positive values. After updating &#949; (for several epochs), we check if condition (10c) is satisfied (or if the maximum number of iterations is reached) and bisect the interval [0, z</p><p>We alternate between updating &#949; and bisecting zK&#8594;1 until the stopping criterion is met. Then, we move to the next level and repeat the process. The complete algorithm is summarized in Algorithm 1.</p><p>k , &#8599;k} for Choose z1 by the bisection algorithm do for ... do for Choose zK&#8594;1 by the bisection algorithm do while condition (10c) is not satisfied or max iterations reached do Select k &#949; (&#949; (r) ) based on g(&#949; (r) ) Update &#949; (r+1) by ( <ref type="formula">11</ref>) end end end end Iteration Complexity Analysis of EMO. The complexity of EMO is of the same order as that of the standard subgradient optimization algorithm, up to a logarithmic factor, making it well-suited for solving large-scale problems. Specifically, we present the following theoretical results. Theorem 1. Assume that the loss functions are smooth and convex. Suppose that the sequence {&#949; (r) } T r=0 is generated by the EMO algorithm and the learning rate is &#966; &#8771; O(1/ &#8656; T ). Then, EMO achieves a nearly &#969;-stationary point of problem <ref type="bibr">(10)</ref> if the total number of iterations T satisfies T &#8658; O(log K (1/&#8637;)/&#969; 4 ), where &#8637; is the tolerance error required in the stopping criterion of the bisection oracle. Proof (Sketch) Bisection achieves error &#8637; in O(log(1/&#8637;)) iterations in each level, hence K &#8595; 1 levels requires O(log K (1/&#8637;)) iterations. For smooth loss functions with learning rate &#966; &#8771; O(1/ &#8656; T ), subgradient algorithms achieve &#969;-stationary points in O(1/&#969; 4 ) iterations <ref type="bibr">[24]</ref>. Multiplying these two complexities gives Theorem 1. Reduction of Computational Complexity. One simple way to reduce the complexity is to set all z k to a single variable z, so that problem <ref type="bibr">(10)</ref> reduces to the following bilevel problem.</p><p>which directly decreases the complexity from O(log K (1/&#969;)/&#969; 4 ) to O(log(1/&#969;)/&#969; 4 ) with &#8637; = &#969;. Note that the term (K &#8595; k)z still maintains the nested structure of this problem, emphasizing the priority of enforcing the constraint at the (k &#8595; 1)th level compared to the kth level.</p><p>Variants of EMO. The proposed EMO can also be adapted in other ways. For example, using a Moreau envelope-based reformulation of the loss functions at each level results in a variant of EMO as follows.</p><p>EMO-M. Some recent works on bilevel optimization introduce a Moreau envelope-based reformulation <ref type="bibr">[25,</ref><ref type="bibr">26]</ref> for the lower-level loss function, which provides an alternative approach to estimating the minimum value E k while preserving the nested structure of the original problem. Specifically, we can revise the kth level problem as</p><p>&#8593;&#8640; &#8595; &#949;&#8593; 2 . When &#8641; is small, this loss function becomes strongly convex with respect to &#8640;, allowing us to easily obtain v &#977; k (&#949;) by applying several steps of gradient descent on &#8640;. The advantage is that it eliminates the need for a bisection search for z, while the downside is the additional computational burden of the inner loop oracle required to obtain E &#977; k (&#949;), which is only estimated approximately.</p><p>EMO-G. Instead of evaluating function values in condition (10c), we can use the size of the gradient as a metric to determine which block should be updated, i.e., k &#949; (&#949;) = arg max k {&#8593;&#8657; &#969; f1(&#949;)&#8593;, . . . , &#8593;&#8657; &#969; fK (&#949;)&#8593;} <ref type="bibr">[24]</ref>. This approach eliminates the need to search for z, but it loses the nested structure of the original problem, reducing it to a switching gradient method for solving nonlinear constrained optimization problems. We term this algorithm EMO-G, to serve as a baseline.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">EXPERIMENTS</head><p>We empirically evaluate the performance of applying EMO and its variants for CoT inference problems compared to the vanilla single-level training strategy (also known as CoT-I <ref type="bibr">[13]</ref>), CoT-I/O with the sum of all step-wise loss functions <ref type="bibr">[13]</ref>, and the penalty-based method. During inference, given the prompt xq (from either the in-distribution or OOD dataset) as input, the learned model, optimized with parameter &#949;&#949;, recursively outputs all intermediate steps as follows: TF &#969;&#969; (xq, &#349;1 , . . . , &#349;k&#8594;1 ) = &#349;k for all k.</p><p>Datasets. We generate chains using 3-layer MLPs with input xi &#8600; R d where d = 10, hidden features s 1 i , s 2 i &#8600; R q with q = 4, and output yi &#8600; R. Here,</p><p>, and yi = F3(s 2 i ) &#8619; w &#8595; 3 s 2 i for some weight matrices W1 &#8600; R q&#8596;d , W2 &#8600; R q&#8596;q , and w3 &#8600; R q . The reasoning chain is the composition of the three functions, i.e., yi = F (xi) = w &#8595; 3 ReLU(W2ReLU(W1xi)). The distribution of the feature vectors and task parameters is zero-mean Gaussian: xi i.i.d.</p><p>&#8771; N(0, I d ); each entry of Wi is randomly sampled from N (0, 2/q) and w3 &#8771; N (0, Iq) for each prompt.</p><p>In addition to the in-distribution test dataset, we create OOD data samples to evaluate the robustness of the optimization algorithms against distribution shifts. For the training and in-distribution test datasets, the covariance matrix is fixed to the identity matrix. For the OOD dataset, we draw the in-context input vectors from xq &#8771; N (0, c!), where ! is diagonal with &#955;i i.i.d.</p><p>&#8771; Exponential(1) and c = 4, following <ref type="bibr">[7]</ref>.</p><p>Training. All the experiments use the GPT-2 model <ref type="bibr">[27]</ref> with three transformer blocks. We adopt Adam <ref type="bibr">[28]</ref> to optimize the model over 50k epochs with batch size 64. For each prompt, n feature vectors are randomly sampled and then labeled by a set of randomly generated task parameters. During training, n increases from 1 to 100 to cover varying prompt lengths. We report the square loss as our metric for step-wise error, i.e., &#977;(&#349; k i , (a) Step 1 Test Error 1 2 3 # in-context samples (n) 0 50 100 (b) Step 2 0.5 1.0 1.5 2.0 2.5 # in-context samples (n) 0 50 100 (c) Step 3 0 5 10 # in-context samples (n) 0 50 100 Fig. 2: Performance comparison of EMO, EMO-M, EMO-G, vanilla training, CoT-I/O, penalty method in terms of in-distribution test errors. (a) Step 1 OOD Error 2 4 6 # in-context samples (n) 0 50 100 (b) Step 2 2 3 4 5 # in-context samples (n) 0 50 100 (c) Step 3 0 20 40 60 # in-context samples (n) 0 50 100 Fig. 3: Performance comparison of EMO, EMO-M, EMO-G, vanilla training, CoT-I/O, penalty method in terms of OOD test errors.</p><p>Numerical Results. The performance for training, testing, and OOD scenarios is demonstrated in Figure <ref type="figure">1</ref>, Figure <ref type="figure">2</ref>, Figure <ref type="figure">3</ref>, respectively. As shown in Figure <ref type="figure">1</ref>, EMO achieves the lowest training error at all levels and maintains a competitive convergence rate compared to other baseline methods. EMO-M, while showing relatively worse performance in terms of achievable training errors compared to the other methods, still outperforms the penalty method, particularly for the first reasoning step. Due to the page limit, we omit the test error vs. epochs and instead include the test error vs. prompt length n, which better reflects the generalization performance of the nested machine models, consistent with the experiment in <ref type="bibr">[13]</ref>. It is observed that as the prompt length increases, CoT performs better, particularly EMO, achieving the lowest test error. This improvement is attributed to the nested training structure, which emphasizes minimizing the loss function level by level, or equivalently, step by step. After a certain n, the test errors for all methods stabilize as n increases, which is consistent with existing theoretical generalization analyses <ref type="bibr">[13,</ref><ref type="bibr">29]</ref>.</p><p>Interestingly, the OOD errors obtained by all methods, except the vanilla one, exhibit a slight U-curve pattern, indicating that inference error accumulates beyond a certain prompt length due to the mismatch between the training and test prompts. It can also be observed that in this scenario, both EMO and EMO-M show significant improvement over the other baselines, underscoring the importance of step-wise model parameter optimization over the vanilla summation formulation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.">CONCLUDING REMARKS</head><p>We proposed a unified nested MLO framework for CoT inference. To the best of our knowledge, this is the first mathematical formulation established for designing CoT-structured machine learning models, where each level of the optimization process enhances the quality of the subsequent step prediction, enabling step-by-step inference. We further introduce an epigraph-based MLO reformulation for this class of problems to design a first-order method that can find stationary points of this problem with provable convergence guarantees. Our numerical results on the GPT-2 language model demonstrate that the proposed nested training strategy maintains high CoT inference quality at each step and outperforms all baseline models in terms of overall training speed and generalization performance.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>Authorized licensed use limited to: The Libraries at Rensselaer Polytechnic Institute. Downloaded on April 18,2025 at 22:00:56 UTC from IEEE Xplore. Restrictions apply.</p></note>
		</body>
		</text>
</TEI>
