A large-scale reasoning model thought chain compression method, a training method and a device
By constructing a reasoning trajectory dataset for overthinking detection and redundancy removal, and combining supervised fine-tuning and redundancy-aware composite reward optimization of the large language model, the problem of redundancy within the thinking interval is solved, and training efficiency and reasoning accuracy are improved.
Patent Information
- Application Number
- CN202611348025.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-01
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, large language models neglect the redundancy of reasoning trajectories within the thinking interval during training, resulting in low training efficiency and excessive lexical consumption during the reasoning phase, which affects the task's reasoning efficiency.
By constructing a reasoning trajectory dataset, overthinking detection and redundancy removal are performed. The model is optimized using supervised fine-tuning and redundancy-aware composite rewards, including chunk-level overthinking detection, compression, and targeted rewriting of the reasoning chain, as well as group-relative policy optimization based on redundancy awareness.
It improves the efficiency and accuracy of model inference, reduces inference overhead and detection time, and enhances the continuity and stability of the model training process.
Smart Images

Figure CN123180347A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, training method and device for compressing the thought chain of a large-scale reasoning model. Background Technology
[0002] In related technologies, the mainstream approach to improving the reasoning ability of large language models is to extend the length of the slow-thinking reasoning chain. However, in practical applications, it has been found that during training, the focus is mostly on eliminating redundancy in the answer output interval, while the redundancy problem of the reasoning trajectory within the thinking interval is systematically ignored. The systematic redundancy in the reasoning trajectory within the thinking interval of large language models leads to problems such as low training efficiency and excessive lexical consumption during the reasoning phase, thus affecting the efficiency of task reasoning.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention
[0004] The main objective of this application is to propose a method, training method, and device for compressing the thought chain of a large-scale reasoning model, which can improve the efficiency of model reasoning.
[0005] To achieve the above objectives, one aspect of this application proposes a method for compressing the thought chain of a large-scale reasoning model, the method comprising: Construct a reasoning trajectory dataset; the reasoning trajectory dataset includes queries, reasoning chains, and answers; Overthinking detection is performed on the inference chain to obtain the detection results; Based on the detection results, the inference trajectory dataset is compressed and redundancy is removed to obtain a compressed dataset. The compressed dataset is input into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model. Based on the redundancy-aware composite reward, the fine-tuning model is optimized using a group-relative policy to obtain the target large-scale inference model.
[0006] In some embodiments, the overthinking detection of the reasoning chain to obtain a detection result includes the following steps: The inference chain is segmented to obtain an ordered sequence of semantic units, and the ordered sequence of semantic units is aggregated to obtain inference blocks; Multidimensional feature extraction is performed on the reasoning block to obtain five-dimensional features; The five-dimensional features are combined and scored to obtain the total score for block redundancy; The detection result is obtained by comparing and judging the total redundancy score of the blocks according to a preset threshold.
[0007] In some embodiments, the step of compressing and redundancy removal of the inference trajectory dataset based on the detection results to obtain a compressed dataset includes the following steps: Based on the detection results, the inference trajectory dataset is input into a large model. The large model then scans the inference blocks in the inference trajectory dataset segment by segment and outputs the judgment results of the inference blocks. When the determination result is compression processing, the inference block is marked as a redundant mode, and the target redundancy interval is constructed based on the pre-set type label. The inference trajectory dataset and the target redundancy interval are input into the large model, and the large model is rewritten in a targeted semantic manner according to the preset prompt constraints to obtain the rewriting result. The inference blocks and the rewritten results are input into the large model for comparison and scoring to obtain a scoring result. The rewritten results and the inference trajectory dataset are assembled based on the scoring results to obtain the compressed dataset.
[0008] In some embodiments, inputting the compressed dataset into an initial large-scale inference model for supervised fine-tuning to obtain a fine-tuned model includes the following steps: The compressed dataset is input into the initial large-scale inference model for autoregressive inference to obtain the inference results; The model loss is obtained by calculating the loss of the inference results according to the preset loss function; The parameters of the initial large-scale inference model are updated based on the model loss to obtain the fine-tuned model.
[0009] In some embodiments, the step of performing group-relative policy optimization on the fine-tuned model based on redundancy-aware composite rewards to obtain the target large-scale inference model includes the following steps: Input the query from the compressed dataset into the fine-tuning model, and randomly extract multiple generated results from the probability distribution output by the fine-tuning model; The reward is calculated for each generated result according to the preset composite reward function to obtain multiple composite rewards; The fine-tuned model is updated with parameters based on the composite reward and group relative policy optimization objective to obtain the target large-scale inference model.
[0010] In some embodiments, the step of calculating a reward for each generated result according to a preset composite reward function to obtain multiple composite rewards includes the following steps: A correctness reward is obtained by calculating a reward based on the actual labels of the generated results. An efficiency bonus is obtained by calculating the economic efficiency based on the correctness and relative length of the generated result. Obtain the inference chain corresponding to the generated result, and divide the inference chain into a block sequence; Redundancy type determination is performed on the block sequence, and process integral accumulation calculation is performed based on the determined redundancy type to obtain process redundancy penalty; A composite reward function is constructed based on the correctness reward, the efficiency reward, and the process redundancy penalty to calculate the reward for the generated result, thereby obtaining the composite reward.
[0011] To achieve the above objectives, another aspect of this application proposes a training method for a large-scale inference model, the training method comprising: Obtain the task data to be inferred; The task data to be reasoned is input into a large-scale reasoning model, and the task reasoning result is output; wherein, the large-scale reasoning model is obtained by processing using the large-scale reasoning model thought chain compression method as described in claim 1; Based on the task reasoning results, the parameters of the large-scale reasoning model are adjusted to obtain the trained large-scale reasoning model.
[0012] To achieve the above objectives, another aspect of this application proposes a large-scale reasoning model thought chain compression device, the device comprising: The data acquisition module is used to construct the inference trajectory dataset; the inference trajectory dataset includes queries, inference chains, and answers; The overthinking detection module is used to detect overthinking in the reasoning chain and obtain the detection result. The data compression module is used to compress and remove redundancy from the inference trajectory dataset based on the detection results to obtain a compressed dataset. The supervised fine-tuning module is used to input the compressed dataset into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model. The strategy optimization module is used to perform group relative strategy optimization on the fine-tuned model based on redundancy-aware composite rewards to obtain the target large-scale inference model.
[0013] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0014] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods described above.
[0015] The embodiments of this application include at least the following beneficial effects: This application provides a method, training method, and device for compressing the thought chain of a large-scale reasoning model. This scheme detects overthinking in the reasoning chain and obtains detection results. It can quantitatively detect chunk-level overthinking in the reasoning chain based on rule scoring, reducing reasoning overhead and detection time. Furthermore, this scheme compresses the reasoning trajectory dataset based on the detection results to obtain a compressed dataset. It can quickly release high-quality chunks without redundancy and rewrite redundant reasoning chunks in a targeted manner, improving the model's reasoning accuracy. In addition, this scheme optimizes the fine-tuned model using a group relative policy based on redundancy-aware composite rewards to obtain the target large-scale reasoning model. It can first perform supervised fine-tuning on the compressed dataset to establish an initial distribution of concise reasoning, and then further optimize it through a redundancy-aware reinforcement learning algorithm, improving the continuity and stability of the model training process, thereby improving the efficiency of task reasoning. Attached Figure Description
[0016] Figure 1 This is a schematic diagram of an implementation environment provided in the embodiments of this application; Figure 2 This is a flowchart of a large-scale reasoning model thought chain compression method provided in an embodiment of this application; Figure 3 yes Figure 2 The flowchart of step S202 in the document; Figure 4 This is a flowchart of the overall model training process provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a large-scale reasoning model thinking chain compression device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0018] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0019] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0021] Before providing a detailed description of the embodiments of this application, some of the nouns and terms involved in the embodiments of this application will be explained first. The nouns and terms involved in the embodiments of this application are subject to the following interpretations.
[0022] 1) Large Reasoning Model (LRM): A deep thinking-oriented large language model that is specifically optimized for complex multi-step reasoning ability through supervised fine-tuning or reinforcement learning. Its core feature is "think first, then answer".
[0023] 2) Think Block: The internal reasoning process generated by the large language model in slow thinking mode, located within the `...` <think> ...< / think> ` inside the tag.
[0024] 3) Answer Block: The final answer output by the model, located after the `` label.
[0025] 4) Chain-of-Thought (CoT): The process by which a model arrives at a final conclusion through step-by-step reasoning.
[0026] 5) Overthinking: Redundancy in the reasoning process, including ineffective reflection, repetitive derivation, and mechanical enumeration.
[0027] 6) Supervised Fine-Tuning (SFT): Supervised parameter tuning of a pre-trained model using labeled data.
[0028] 7) Group Relative Policy Optimization (GRPO): A reinforcement learning algorithm based on the calculation of relative advantages within a group.
[0029] In related technologies, the mainstream approach to improving the reasoning ability of large language models is to extend the length of the slow thinking reasoning chain. Representative works include large-scale reasoning models such as DeepSeek-V4, GLM-5.1, and Kimi-K2.6. Their core paradigm is to introduce an explicit thinking interval during the model's reasoning phase. Within this interval, the model performs self-analytical reasoning—starting from analyzing user input, it gradually thinks, derives formulas, reflects, verifies, and tries multiple paths, ultimately providing a conclusion in the answer block. However, the focus of related technologies on the model training process is mostly concentrated on eliminating redundancy in the answer block, while the redundancy of the reasoning trajectory within the thinking interval is systematically ignored.
[0030] For example, redundant reasoning steps in the model introduce a large amount of low information entropy, leading to attention dilution and wasted computational resources. Furthermore, after learning redundant patterns, the model forces lengthy reasoning even on simple problems, unnecessarily lengthening the reasoning chain and increasing the risk of error accumulation. When faced with novel, concise logic problems or multi-step complex problems, the model cannot escape the redundant framework and lacks logical extrapolation ability.
[0031] In view of this, this application provides a method, training method, and device for compressing the thought chain of a large-scale reasoning model. This scheme constructs and formats a reasoning trajectory dataset, performs chunk-level overthinking detection based on rules, and performs chunk adaptive compression based on semantic fidelity constraints. This improves the effective reasoning information density while ensuring the teachability of the reasoning trajectory. Furthermore, this scheme performs supervised fine-tuning of the model based on the compressed thought chain and trains the model using a group-relative policy optimization based on redundancy-aware composite rewards. Through a two-stage training paradigm, the model generates a more concise thought chain during the reasoning phase, effectively avoiding redundant and excessively long outputs, thus improving model performance and training efficiency.
[0032] This application provides a method, training method, and device for compressing the thought chain of a large-scale inference model, relating to the field of artificial intelligence technology. The method and training method for compressing the thought chain of a large-scale inference model provided in this application can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or in-vehicle terminal, etc., but is not limited to these; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application implementing the method and training method for compressing the thought chain of a large-scale inference model, etc., but is not limited to the above forms.
[0033] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0034] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.
[0035] Figure 1 This is a schematic diagram illustrating the implementation environment of a method provided in an embodiment of this application. (Refer to...) Figure 1 The main hardware and software components of this implementation environment include a terminal 101 and a server 102, which are communicatively connected. The method can be executed based on the interaction between the terminal 101 and the server 102. Furthermore, the terminal 101 and the server 102 can be nodes in a blockchain; this embodiment does not specifically limit this.
[0036] Figure 2 This is an optional flowchart of a large-scale reasoning model thought chain compression method provided in the embodiments of this application. Figure 2 The method may include, but is not limited to, steps S201 to S205.
[0037] Step S201: Construct a reasoning trajectory dataset; the reasoning trajectory dataset includes queries, reasoning chains, and answers; Step S202: Perform overthinking detection on the inference chain and obtain the detection result; Step S203: Based on the detection results, the inference trajectory dataset is compressed and redundancy is removed to obtain a compressed dataset; Step S204: Input the compressed dataset into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model; Step S205: Based on the redundant perception composite reward, perform group relative policy optimization on the fine-tuned model to obtain the target large-scale inference model.
[0038] Steps S201 to S205 of this embodiment involve constructing an inference trajectory dataset, which includes the user-input query, the inference chain performed by the model, and the model's output answer. This embodiment compresses the model's inference trajectory based on rule detection and semantic fidelity constraints. Specifically, it performs quantitative overthinking detection on each block of the inference chain, outputting discrete judgment results. These discrete judgment results are used to determine whether there are redundant steps in the model's inference process. If redundant steps exist, the inference chain is compressed to obtain a compressed dataset. Then, a two-stage training method based on redundancy-aware composite rewards is used. The initial large-scale inference model is supervised and fine-tuned based on the compressed dataset, and then the model is optimized based on a group-relative strategy using redundancy-aware composite rewards to obtain the target large-scale inference model.
[0039] One of the above technical solutions has the following advantages or beneficial effects: The embodiments of this application perform block-level overthinking quantitative detection on the reasoning chain based on rule scoring, which reduces reasoning overhead and detection time. Furthermore, a two-stage training method based on redundancy perception composite reward is used for model training, which improves the continuity and stability of the model training process, thereby improving the efficiency of task reasoning.
[0040] In step S201 of some embodiments, an inference trajectory dataset is constructed; the inference trajectory dataset includes queries, inference chains, and answers.
[0041] In this embodiment, the inference trajectory dataset includes queries, inference chains, and answers. Queries are user-input data, which can be voice or text data. The inference chain is the process by which the model arrives at a final conclusion through step-by-step reasoning, and the answer is the content output by the model during inference. During training, the format of the inference trajectory dataset is initialized, given the original dataset. The learning objective (Response) for each sample is formatted as follows: ; in, To consider the content of the interval, Output the range of contents for the answer. and The pre-defined marker terms are then used. The content of the thought interval is then... Consider it as an ordered sequence of reasoning steps Thus constructing triples We obtained the complete training samples, among which, This indicates the input query. Represents a chain of reasoning. This represents the answer output by the model.
[0042] Please see Figure 3 In step S202 of some embodiments, the overthinking detection of the inference chain to obtain the detection result includes the following steps: Step S301: The inference chain is segmented to obtain an ordered semantic unit sequence, and the ordered semantic unit sequence is aggregated to obtain an inference block; Step S302: Perform multi-dimensional feature extraction on the reasoning block to obtain five-dimensional features; Step S303: Combine and score the five-dimensional features to obtain the block redundancy total score; Step S304: Compare and judge the total redundancy score of the block according to the preset threshold to obtain the detection result.
[0043] In this embodiment, the redundant patterns in the reasoning trajectory possess highly regularizable textual features—they manifest as high-frequency occurrence of specific redundant signal words, structural repetition of text paragraphs, and computable signals such as the premature appearance of the answer conclusion in the reasoning chain. These redundant patterns can include repetitive derivation, invalid reflection, mechanical restatement, and continuing to generate answers after premature conclusions. This embodiment quantitatively detects overthinking in each block of the reasoning chain and outputs discrete judgment results.
[0044] In step S301 of some embodiments, the inference chain is segmented to obtain an ordered sequence of semantic units, and the ordered sequence of semantic units is aggregated to obtain inference blocks. In this application embodiment, the inference chain... Divide into an ordered sequence of semantic units: ; The partitioning is selected in descending order of the natural hierarchy of the data structure: ; in, Use double newlines as delimiters. Use single line breaks as separators. The sentence-ending punctuation is used as a separator. These segmentation methods are used to divide the inference chain into an ordered sequence of semantic units. This application also sets an upper limit on the number of words in a block, and uses a greedy strategy to aggregate inference units into blocks, thus obtaining inference blocks.
[0045] The greedy strategy is as follows: ; In the formula, This indicates configurable parameters for each inference block. satisfy Furthermore, the original timing of the reasoning units is strictly maintained.
[0046] In step S302 of some embodiments, multi-dimensional feature extraction is performed on the reasoning block to obtain five-dimensional features; in the embodiments of this application, multi-dimensional feature extraction is performed on each reasoning block to obtain five-dimensional features, wherein the five-dimensional features include redundant signal word weighted density, self-correction / recalculation density, second half signal word clustering ratio, text repetition rate, and premature conclusion location.
[0047] Specifically, embodiments of this application predefine a redundant signal vocabulary. ,in For regular expression mode, As weight, Category.
[0048] For each reasoning block The text within is matched against each signal word pattern to obtain the number of hits. The weighted density is calculated as follows: ; In the formula, This represents the weighted density of redundant signal words, i.e., the number of weighted redundant signal word hits per 10,000 tokens. Indicates the length of each word.
[0049] Then, the weighted hits of the two signal words "self-correction" and "restart recalculation" obtained from each reasoning block are statistically analyzed: ; In the formula, This indicates the self-correcting / recalculating density.
[0050] The set of token positions for all signal word hits is defined as Calculate the hit ratio for the set of locations: ; In the formula, This indicates the clustering ratio of signal words in the latter half of the block, i.e., the proportion of hit positions that fall in the latter half of the block.
[0051] This application embodiment divides the block text into standardized units, and the normalized dimension length is... The ratio of completely repeated units to words in the original text is set to 1. The similarity between adjacent Jaccard tokens exceeds The logarithmic percentage is set as ,but: ; in, Indicates the text repetition rate. The coefficient for complete repeatability scoring can be set to 160; The coefficient for repeated scoring of adjacent scores can be set to 80. This represents the threshold for triggering a complete repetition rate, which can be set to 0.1; This represents the Jaccard similarity threshold between adjacent units, which can be set to 0.1.
[0052] This application's embodiments calculate the location of premature conclusions by detecting the relative position of the first occurrence of the answer's conclusive statement in the reasoning text: ; In the formula, This indicates premature conclusions or positioning. This indicates the location where the concluding statement of the answer first appears.
[0053] In step S303 of some embodiments, the five-dimensional features are combined and scored to obtain a total block redundancy score; the contributions of the five-dimensional features are weighted, truncated, and summed to obtain the total block redundancy score. ; In the formula, Represents the total score of block redundancy. Among them, each sub-item It follows a unified paradigm of superthreshold linear mapping and upper bound truncation: ; in, The maximum contribution score for this dimension is used to prevent a single dimension from dominating. This is the scaling factor; The mapping function from features to scores can be a linear or logarithmic function; This is the trigger condition.
[0054] The specific configurations for each dimension are shown in Table 1 below:
[0055] Table 1 Mapping Table In step S304 of some embodiments, the total block redundancy score is compared and judged according to a preset threshold to obtain the detection result. In this embodiment, a first threshold and a second threshold can be set to perform a three-level discrete judgment on the total block redundancy score, and the judgment formula is as follows: ; In the formula, Indicates the detection result, first threshold Second threshold 60, keep indicates that there is no obvious redundancy signal under the current rule, and the original text is retained; review indicates that there is redundancy signal, and the LLM auxiliary compression process is entered; suspicious indicates high redundancy risk, and compression processing is prioritized.
[0056] In some embodiments, the step of compressing and redundancy removal of the inference trajectory dataset based on the detection results to obtain a compressed dataset includes the following steps: Based on the detection results, the inference trajectory dataset is input into a large model. The large model then scans the inference blocks in the inference trajectory dataset segment by segment and outputs the judgment results of the inference blocks. When the determination result is compression processing, the inference block is marked as a redundant mode, and the target redundancy interval is constructed based on the pre-set type label. The inference trajectory dataset and the target redundancy interval are input into the large model, and the large model is rewritten in a targeted semantic manner according to the preset prompt constraints to obtain the rewriting result. The inference blocks and the rewritten results are input into the large model for comparison and scoring to obtain a scoring result. The rewritten results and the inference trajectory dataset are assembled based on the scoring results to obtain the compressed dataset.
[0057] In this embodiment, for blocks determined to be "review" or "suspicious," the inference trajectory dataset is input into a large model, and semantic-fidelity compression assisted by the large model is performed. This embodiment further identifies specific redundancy types and performs targeted compression using LLM to determine which inference blocks require compression. It adopts a two-stage strategy of location-rewrite, with LLM making semantic compression decisions.
[0058] Specifically, in the embodiments of this application, the unprocessed blocks in the inference trajectory dataset are... Together , Original query The data is fed into the LLM, which instructs it to scan the chunk content segment by segment according to a predefined overthinking type and output a binary determination of whether the chunk needs to be compressed. s and redundant target interval set : ; The LLM prompt explicitly states that the default decision is "no compression," and the target interval is only marked when a high-confidence redundancy pattern is identified. The output structure is as follows: ; in, This indicates that the detected redundant segments are in the block. The range of token offsets within the range, Indicates the severity of redundancy; This indicates the corresponding overthinking type label. This indicates the key reasoning facts that need to be retained within this interval as coverage anchors for subsequent quality review. The overthinking type label can be divided into multiple types, each corresponding to a different compression action. The types of the overthinking type label are shown in Table 2 below:
[0059] Table 2. Types of Overthinking It should be noted that if or If the chunk does not need to be compressed, the original text can be retained directly. This mechanism ensures that high-quality chunks can pass with only one LLM call, which can improve the efficiency of processing large-scale data.
[0060] Then, in this embodiment of the application, the inference trajectory dataset and the constructed target redundancy interval are input into the large model, and the large model is subjected to targeted semantic rewriting according to preset hint constraints to obtain the rewriting result. In this embodiment of the application, the chunked original text... Target redundancy interval and inquiries Send to LLM, instructing it to only target Redundant intervals marked in the code should be simplified and rewritten. Modification of any content outside the target interval is strictly prohibited. ; For each target interval LLM output compression action and the corresponding results, among which, This indicates that the simplified replacement text will be output. Preserve the reasoning framework and key anchor points, and remove redundant expressions; This indicates that the interval will be completely deleted, only affecting... Furthermore, it applies to intervals without subsequent dependencies. This application imposes the following constraints on the LLM Prompt: maintain the reasoning sequence, retain key facts in the anchor points, do not generate answer summary outputs, and must retain the reasoning process rather than just the conclusion.
[0061] Based on the rewriting results output by LLM, embodiments of this application can use deterministic rules to assemble the compressed text and the original text of non-target regions into the final chunks: ; The rendering logic is as follows: Non-target intervals strictly retain the original text; for target intervals... The text is in Replacement, for the target interval The text is directly removed. This step is a pure code operation and does not involve LLM calls, which improves the determinism of the output.
[0062] Meanwhile, since compression operations may lead to the accidental loss of key information in the inference trajectory, to prevent this risk, this application embodiment calls LLM again as an independent reviewer for each rewritten block to compare and review the text before and after compression: ; In the formula, The prompt words indicate that the compression quality is scored from the following dimensions, with each dimension outputting a score in the range [0, 1]. The meanings of the dimension indicators and examples of passing conditions are as follows: AnchorCoverage represents the recoverability rate of all marked key fact anchors in the compressed text; NonTargetPreserved represents the complete retention rate of the non-target interval text, meaning no changes are allowed to the non-target interval; ChronologyPreserved represents the temporal correctness of the reasoning steps; AnswerBranchConsistency represents the consistency of the answer derivation path before and after compression; Contradictions represents the set of logical contradictions between the compressed text and the original text, which must be an empty set. This application embodiment performs cyclical repair processing; if the quality gate fails, it will... The review report, indicating which anchor points are missing and which dimensions fail to meet the standards, serves as feedback. The rewritten module is then called back for repairs, with a maximum of one cycle. Second-rate, It can be set to 2; there is no restriction here. If it still fails after repair, the block will fall back to the original text to ensure that the output is not inferior to the input. The loop process is as follows: ; Finally, the final text of all chunks after quality gating is concatenated in its original order to construct the compressed dataset. Ultimately, the rewritten results and inference trajectory dataset can be assembled based on the scoring results to obtain the compressed dataset.
[0063] In some embodiments, inputting the compressed dataset into an initial large-scale inference model for supervised fine-tuning to obtain a fine-tuned model includes the following steps: The compressed dataset is input into the initial large-scale inference model for autoregressive inference to obtain the inference results; The model loss is obtained by calculating the loss of the inference results according to the preset loss function; The parameters of the initial large-scale inference model are updated based on the model loss to obtain the fine-tuned model.
[0064] In this embodiment, a compressed dataset is input into an initial large-scale inference model for autoregressive inference, and the policy network of the initial large-scale inference model is trained in a standard autoregressive manner. The loss function is defined as follows: ; in, Represents the loss function. This indicates a compressed dataset. Represents the complete target sequence. For the p-th token, For the front A prefix consisting of individual tokens.
[0065] The embodiments of this application enable the model to learn from compressed, high-information-density reasoning trajectories, avoid fitting redundant reasoning patterns, and establish an initial behavioral distribution for concise reasoning.
[0066] In some embodiments, the step of performing group-relative policy optimization on the fine-tuned model based on redundancy-aware composite rewards to obtain the target large-scale inference model includes the following steps: Input the query from the compressed dataset into the fine-tuning model, and randomly extract multiple generated results from the probability distribution output by the fine-tuning model; The reward is calculated for each generated result according to the preset composite reward function to obtain multiple composite rewards; The fine-tuned model is updated with parameters based on the composite reward and group relative policy optimization objective to obtain the target large-scale inference model.
[0067] In this embodiment, the query input from the compressed dataset is used to fine-tune the model, and multiple generated results are randomly selected from the probability distribution output by the fine-tuned model. The expression for the generated results is as follows: ; Calculate the compound reward for each output generated. And calculate the relative advantage based on in-group normalization: ; in, is the numerical stability constant.
[0068] GRPO strategy optimization objective: ; in: Importance sampling ratio; For PPO-clip parameters; Here is the KL divergence regularization coefficient; For each token, the KL divergence term; This is the fine-tuning model obtained during the supervised fine-tuning phase.
[0069] In some embodiments, the step of calculating a reward for each generated result according to a preset composite reward function to obtain multiple composite rewards includes the following steps: A correctness reward is obtained by calculating a reward based on the actual labels of the generated results. An efficiency bonus is obtained by calculating the economic efficiency based on the correctness and relative length of the generated result. Obtain the inference chain corresponding to the generated result, and divide the inference chain into a block sequence; Redundancy type determination is performed on the block sequence, and process integral accumulation calculation is performed based on the determined redundancy type to obtain process redundancy penalty; A composite reward function is constructed based on the correctness reward, the efficiency reward, and the process redundancy penalty to calculate the reward for the generated result, thereby obtaining the composite reward.
[0070] In this embodiment of the application, the expression for the composite reward function is as follows: ; in, Represents the composite reward function; and These are the balance coefficients, which are set to 0.3 and 0.2 by default. Rewards are given for correct answers; Indicates a reward for efficiency; This indicates a penalty for process redundancy.
[0071] Specifically, for tasks with verifiable answers, such as reasoning tasks involving mathematics, logic, and coding, a definition based on real labels is defined. The discrete score is used to calculate the correctness reward: ; in, Task-specific decision functions are used to perform numerical equivalence checks on mathematical problems, test case pass rates on coding problems, and propositional equivalence verification on logic problems.
[0072] This application also incorporates an economic reward that considers both correctness and relative length, serving as an efficiency reward. The efficiency reward means that, assuming the answer is correct, a shorter reasoning chain with shorter thought intervals yields a higher economic reward; if the answer is incorrect, the economic reward is zero, preventing the model from sacrificing accuracy by shortening the reasoning to obtain a reward.
[0073] First, normalize the relative length within the group by defining it: ; ; In this embodiment, the output with the correct answer and the shortest reasoning within the group receives the maximum reward. The output obtained when the answer is correct but the reasoning is the longest is... There is no penalty but no reward; the economic reward for an incorrect answer is 0, and there is no benefit from short reasoning.
[0074] This application embodiment also incorporates the discrete judgment results of chunk-level overthinking detection into the reinforcement learning signal to achieve closed-loop alignment of training data compression and RL rewards. By segmenting the generated inference chain into chunk sequences, a lightweight LLM or the aforementioned rule-based chunk-level overthinking detection is called for redundancy type determination for each chunk. ; in, This indicates that the reasoning is valid and without redundancy. This indicates the existence of ineffective reflection, over-analysis, and repeated verification. This indicates the existence of repeated generation, cyclic derivation, and mechanical enumeration. Then, a discrete penalty is assigned to each label, with values of 0, -1, and -2, followed by process integration and accumulation. ; In the formula, Indicates process redundancy penalty, This represents the discrete penalty for the label. The embodiments of this application train the model using a composite reward function, enabling the process supervision signal to have an adaptive gradient contribution within the group relative framework, reducing training instability caused by absolute penalty values.
[0075] To achieve the above objectives, another aspect of this application proposes a training method for a large-scale inference model, the training method comprising: Obtain the task data to be inferred; The task data to be reasoned is input into a large-scale reasoning model, and the task reasoning result is output; wherein, the large-scale reasoning model is obtained by processing using the large-scale reasoning model thought chain compression method as described in claim 1; Based on the task reasoning results, the parameters of the large-scale reasoning model are adjusted to obtain the trained large-scale reasoning model.
[0076] In this embodiment, task data to be inferred can be obtained by acquiring text or voice data input by the user. For example, if the user inputs the text "Query today's weather," this text can be input into a large-scale inference model processed by the thought chain compression method, and the task inference result can be output. This large-scale inference model is obtained by processing using the aforementioned large-scale inference model thought chain compression method. Then, based on the task inference result, the model error can be calculated, thereby adjusting the model parameters to obtain a trained large-scale inference model.
[0077] The solutions of this application embodiment will be described in detail and explained below with reference to specific application examples: This application's embodiments are applied in the fields of artificial intelligence and natural language processing technology, specifically involving the optimization of reasoning capabilities of large language models, including thought chain training data compression, supervised fine-tuning, and the design of reinforcement learning reward mechanisms. This application's embodiments can efficiently train thought chains for large-scale reasoning models and are suitable for scenarios requiring complex reasoning capabilities, such as mathematical reasoning, code generation, and logical reasoning. Please refer to... Figure 4 This application embodiment obtains the original inference trajectory dataset, compresses the inference chains in the dataset, firstly segments and aggregates the inference units to obtain inference blocks, then performs rule-based block-level overthinking detection to determine whether the inference block needs compression. If compression is required, it is performed to locate and rewrite the block, resulting in a compressed dataset. This application embodiment performs supervised fine-tuning training on a large-scale inference model on the compressed dataset, and then uses redundancy-aware composite rewards for group relative policy optimization reinforcement learning training, outputting a large-scale inference model with efficient inference capabilities.
[0078] Please see Figure 5 This application also provides a large-scale reasoning model thought chain compression device, which can implement the above-mentioned large-scale reasoning model thought chain compression method. The device includes: Data acquisition module 501 is used to construct a reasoning trajectory dataset; the reasoning trajectory dataset includes queries, reasoning chains, and answers; The overthinking detection module 502 is used to perform overthinking detection on the reasoning chain and obtain the detection result. Data compression module 503 is used to compress and remove redundancy from the inference trajectory dataset based on the detection results to obtain a compressed dataset; The supervised fine-tuning module 504 is used to input the compressed dataset into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model. The strategy optimization module 505 is used to perform group relative strategy optimization on the fine-tuning model based on redundant perception composite reward to obtain the target large-scale inference model.
[0079] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0080] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0081] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0082] Please see Figure 6 , Figure 6 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 601 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 602 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 602 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 602 and is called and executed by the processor 601. The input / output interface 603 is used to implement information input and output; The communication interface 604 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 605 transmits information between various components of the device (e.g., processor 601, memory 602, input / output interface 603, and communication interface 604); The processor 601, memory 602, input / output interface 603, and communication interface 604 are connected to each other within the device via bus 605.
[0083] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0084] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0085] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0086] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0087] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0088] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0089] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0090] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0091] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0092] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0093] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0094] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0095] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0096] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for compressing the thought chain in a large-scale reasoning model, characterized in that, The method includes the following steps: Construct a reasoning trajectory dataset; the reasoning trajectory dataset includes queries, reasoning chains, and answers; Overthinking detection is performed on the inference chain to obtain the detection results; Based on the detection results, the inference trajectory dataset is compressed and redundancy is removed to obtain a compressed dataset. The compressed dataset is input into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model. Based on the redundancy-aware composite reward, the fine-tuning model is optimized using a group-relative policy to obtain the target large-scale inference model.
2. The method according to claim 1, characterized in that, The process of performing overthinking detection on the inference chain to obtain the detection result includes the following steps: The inference chain is segmented to obtain an ordered sequence of semantic units, and the ordered sequence of semantic units is aggregated to obtain inference blocks; Multidimensional feature extraction is performed on the reasoning block to obtain five-dimensional features; The five-dimensional features are combined and scored to obtain the total score for block redundancy; The detection result is obtained by comparing and judging the total redundancy score of the blocks according to a preset threshold.
3. The method according to claim 1, characterized in that, The step of compressing and redundancy-removing the inference trajectory dataset based on the detection results to obtain a compressed dataset includes the following steps: Based on the detection results, the inference trajectory dataset is input into a large model. The large model then scans the inference blocks in the inference trajectory dataset segment by segment and outputs the judgment results of the inference blocks. When the determination result is compression processing, the inference block is marked as a redundant mode, and the target redundancy interval is constructed based on the pre-set type label. The inference trajectory dataset and the target redundancy interval are input into the large model, and the large model is rewritten in a targeted semantic manner according to the preset prompt constraints to obtain the rewriting result. The inference blocks and the rewritten results are input into the large model for comparison and scoring to obtain a scoring result. The rewritten results and the inference trajectory dataset are assembled based on the scoring results to obtain the compressed dataset.
4. The method according to claim 1, characterized in that, The process of inputting the compressed dataset into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model includes the following steps: The compressed dataset is input into the initial large-scale inference model for autoregressive inference to obtain the inference results; The model loss is obtained by calculating the loss of the inference results according to the preset loss function; The parameters of the initial large-scale inference model are updated based on the model loss to obtain the fine-tuned model.
5. The method according to claim 1, characterized in that, The process of optimizing the fine-tuned model using a group-relative policy based on redundancy-aware composite rewards to obtain the target large-scale inference model includes the following steps: Input the query from the compressed dataset into the fine-tuning model, and randomly extract multiple generated results from the probability distribution output by the fine-tuning model; The reward is calculated for each generated result according to the preset composite reward function to obtain multiple composite rewards; The fine-tuned model is updated with parameters based on the composite reward and group relative policy optimization objective to obtain the target large-scale inference model.
6. The method according to claim 5, characterized in that, The step of calculating rewards for each generated result according to a preset composite reward function to obtain multiple composite rewards includes the following steps: A correctness reward is obtained by calculating a reward based on the actual labels of the generated results. An efficiency bonus is obtained by calculating the economic efficiency based on the correctness and relative length of the generated result. Obtain the inference chain corresponding to the generated result, and divide the inference chain into a block sequence; Redundancy type determination is performed on the block sequence, and process integral accumulation calculation is performed based on the determined redundancy type to obtain process redundancy penalty; A composite reward function is constructed based on the correctness reward, the efficiency reward, and the process redundancy penalty to calculate the reward for the generated result, thereby obtaining the composite reward.
7. A training method for a large-scale inference model, characterized in that, The training method includes: Obtain the task data to be inferred; The task data to be reasoned is input into a large-scale reasoning model, and the task reasoning result is output; wherein, the large-scale reasoning model is obtained by processing using the large-scale reasoning model thought chain compression method as described in claim 1; Based on the task reasoning results, the parameters of the large-scale reasoning model are adjusted to obtain the trained large-scale reasoning model.
8. A large-scale reasoning model thought chain compression device, characterized in that, The device includes: The data acquisition module is used to construct the inference trajectory dataset; the inference trajectory dataset includes queries, inference chains, and answers; The overthinking detection module is used to detect overthinking in the reasoning chain and obtain the detection result. The data compression module is used to compress the inference trajectory dataset based on the detection results to obtain a compressed dataset; The supervised fine-tuning module is used to input the compressed dataset into the initial large-scale inference model for supervised fine-tuning to obtain the fine-tuned model. The strategy optimization module is used to perform group relative strategy optimization on the fine-tuned model based on redundancy-aware composite rewards to obtain the target large-scale inference model.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.
