Method and system for giving implicit thinking to large language model
By introducing a latent token encoder and a dedicated attention mask into a large language model, and combining KL divergence and cross-entropy optimization, latent inference is performed directly in the vocabulary column space, solving the problems of high computational cost and privacy exposure in existing technologies, and achieving efficient and stable latent inference results.
Patent Information
- Application Number
- CN202511540797.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-01-09
AI Technical Summary
Existing large-scale language models suffer from high computational costs, privacy exposure risks, and poor deployability in explicit chain-like reasoning. Furthermore, existing latent reasoning methods are difficult to align with hidden states and word embedding spaces, have poor expressive efficiency, and high engineering complexity, making it difficult to meet the requirements of high accuracy, low latency, and controllability.
By introducing a latent token encoder and a dedicated attention mask to generate latent tokens and constraining them to the vocabulary column space, and combining the joint objective optimization of KL divergence and cross-entropy, stable and efficient generation of latent inference is achieved. A two-stage learning and lexical probability superposition technique is adopted to perform inference directly in the vocabulary column space.
It achieves significant inference chain compression, reduces token costs and latency, while maintaining or improving inference accuracy, and provides measurable and controllable evaluation metrics to meet the needs of high efficiency, stability and controllability for large-scale inference deployment.
Smart Images

Figure CN121303355A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of generative artificial intelligence and natural language processing, and in particular to a latent reasoning method and system for reducing the overhead of explicit chain-of-thought (CoT) reasoning while maintaining or improving reasoning performance. Background Technology
[0002] Existing large language models (LLMs) often rely on explicit CoT (Cooperation of Reasoning) to improve accuracy in mathematical and logical tasks. However, explicit reasoning significantly increases the length of the reasoning chain and computation / token costs, and introduces problems such as privacy exposure and poor deployability. Therefore, academia and industry have begun to explore solutions for reasoning in the latent space, that is, to complete thinking and decision-making without outputting explicit intermediate steps, in order to simultaneously achieve "efficiency, accuracy, and privacy".
[0003] Regarding "latent reasoning," existing technologies can be broadly categorized into two types: training-based latent reasoning methods and training-free latent reasoning methods. The core of both types is to modify the structure or objective function along the decoding path of "hidden state - token embedding - language model head" to replace or compress the intermediate tokens of explicit CoT.
[0004] (1) Training-based Latent Reasoning
[0005] These methods modify the "hidden state - token embedding - language model head" chain during training, enabling the model to complete thinking and generate answers without outputting explicit chain-of-thought (CoT). A representative work, COCONUT, focuses on "using the last hidden state directly as the input to the next step, skipping the LM head," inserting a fixed number of latent steps into the autoregressive decoding to advance reasoning in the hidden state space. This approach pioneered a latent reasoning paradigm, but its performance is limited due to the lack of explicit alignment between the latent and token embedding spaces and the fixed number of latent steps. CCOT further alleviates the expressiveness limitations caused by the fixed number of steps by implementing variable-length latent reasoning trajectories using "continuous contemplation" tokens, but the structural mismatch between the hidden state and token embeddings still exists. To address the mismatch problem, COD introduces a multilayer perceptron (MLP) mapping head between the hidden state and word embeddings, and employs teacher-student distillation to align the latent model with the explicit model across multiple hidden states up to the final token, significantly improving alignment quality and task performance. However, the addition of mapping and distillation increases training and deployment complexity. CoLaR directly predicts the compressed embedding distribution by setting a latent head and combines it with reinforcement learning (RL) training to maintain consistency between the latent space and word embedding space in the training objective, achieving a relatively good level of latent inference at the time. However, it still lags behind supervised fine-tuning (SFT) and is more complex to train. Overall, training methods have evolved along the path of "filling in alignment gaps → strengthening latent space structuring," but they generally rely on additional mappings / latent heads and distillation or RL, resulting in high implementation and stability costs. More importantly, they usually infer in the "unstructured hidden state space" first and then align to the vocabulary probability or embedding space afterward, which naturally leads to alignment difficulties and insufficient controllability.
[0006] (2) Training-free Latent Reasoning
[0007] The training-free approach achieves latent inference with minimal modifications. A representative work is Soft Thinking, which directly uses the probability distribution of the next token to linearly superimpose word embeddings to obtain a "soft" latent representation. This representation is then used as input to the next model step, advancing the reasoning process without adding new modules or training. This path is simple to implement, easy to deploy, and has almost zero intrusion into existing Large Language Models (LLMs). However, due to the lack of task-specific training signals and structured constraints, the latent representation is often equivalent to a local greedy approximation, making it difficult to systematically explore multiple inference paths and globally optimal trajectories. Related analyses indicate that such methods are essentially variations of greedy decoding, thus exhibiting significant performance gaps compared to explicit CoT or strong SFT on complex inference tasks. Overall, the advantages of training-free methods lie in their simplicity and rapid deployment, but their expressiveness, stability, and controllability are limited, making it difficult to meet the demands for high-precision and interpretable latent inference.
[0008] Existing latent reasoning methods suffer from four common defects. First, spatial mismatch: most training-based methods first "think" in an unstructured hidden state space, and then align it to the word embedding / vocabulary probability space afterward with the help of a mapping head / latent head or distillation. This leads to unstable training, uncontrollable alignment, and complex deployment, which contradicts the structural constraint of this invention, "direct reasoning in the vocabulary column space." Second, poor trade-off between expression and efficiency: fixed or heuristic latent step settings can easily result in difficulty in reasoning if too short, and increased overhead if too long. While training-free methods are lightweight, they are essentially close to greedy decoding, making it difficult to express the superposition of multiple paths, which is inconsistent with the global parallelism and compressibility goals of the "vocabulary probability superposition and collapse" mechanism of this invention. Third, cost and maintainability issues: introducing additional mapping heads, RL, or multi-layer distillation increases the implementation and parameter tuning costs, and raises the threshold for migration and deployment. This invention simplifies the engineering process by completing latent reasoning learning natively within the original model through two-stage learning (dedicated attention mask + KL / CE joint objective). Fourth, lack of measurement and controllability: existing work generally lacks unified and interpretable efficiency-expressive power standards, making it difficult to guide strategy selection and online evaluation; this invention proposes effective compression rate and effective global parallelism indicators to fill the evaluation loop.
[0009] In summary, existing technologies either have difficulty in alignment and poor steady-state performance, or weak expression and difficulty in multi-path implementation, or are engineering-intensive and difficult to implement, making it difficult to simultaneously meet the industrialization requirements of "high precision, low latency, and strong controllability". Summary of the Invention
[0010] To address the problems commonly encountered in existing latent reasoning schemes in large language models (LLMs), such as mismatch between hidden state and word embedding space, unstable training, high engineering complexity, and difficulty in achieving both efficiency and accuracy while also being challenging to quantify and control, a latent reasoning training and reasoning method and system based on the superposition of word list column spaces (Latent-SFT) is proposed.
[0011] In a first aspect, embodiments of this application provide a method for endowing a large language model with implicit thinking, the method comprising:
[0012] Latent token generation and supervision steps: For training data samples with explicit inference chains of large language models, a latent token encoder is introduced that isomorphically initialized with the base model. Key information in the explicit inference chain is collected through a dedicated attention mask to generate latent tokens. The latent tokens are then restricted to the vocabulary column space by lexical probability superposition. The dedicated attention mask includes a latent token induction mask and a latent token supervision mask. Each latent token is represented as a linear superposition of lexical probability distributions on word embeddings.
[0013] The latent token autonomous generation steps are as follows: discard the latent token encoder, train the basic large language model LLM to autonomously generate latent tokens, and use the joint objective of KL divergence and cross-entropy to stabilize the optimization objective, so that the latent reasoning collapses into the explicit answer at the end of the reasoning.
[0014] Answer generation steps: Given a question, the Large Language Model (LLM) generates a latent sequence internally and then collapses it into the final answer, thus hiding the intermediate reasoning content from the outside.
[0015] In this embodiment of the invention, the method for endowing large language models with implicit thinking further includes:
[0016] Evaluation and parameter tuning steps: The single-path compression degree and multi-path superposition / parallel thinking ability are evaluated by effectively compressing ratio and effectively global parallelism, respectively, and the optimal parameter tuning is carried out by forming a control interface through multiple hyperparameters.
[0017] In this embodiment of the invention, the above-mentioned potential token generation and supervision establishment steps include:
[0018] A latent token encoder is used to segment the explicit inference chain of the training data of a large language model into multiple sub-segments. A latent token placeholder is inserted after each sub-segment, and a latent token inducement mask is applied so that when calculating the hidden state of the latent token placeholder, only the historical information of the explicit inference chain is considered, so as to shield future explicit segments from other latent bits.
[0019] The word logarithmic value is obtained by projecting the hidden state of the latent token occupant to the word column space using the language model head. The word probability distribution is obtained by normalizing the temperature value. The latent representation is reconstructed in the embedding space based on the word probability distribution. The latent representation in the embedding space is generated linearly by the columns of the embedding matrix and is located in the word column space.
[0020] By introducing a latent token supervision mask, constructing a prefix, and allowing only the prefix to decode the explicit reasoning chain, a local supervision is formed for each latent bit, extracting semantically compact, semantically compatible, and semantically correct latent semantics from the explicit thought sequence.
[0021] In this embodiment of the invention, the above-mentioned potential token generation and supervision establishment steps further include:
[0022] The preferred alternating optimization steps are: first, freeze the LLM and update only the latent token encoder to allow the latent bits to quickly converge to a stable semantic representation; then freeze the latent token encoder and update only the LLM to adapt to the conditional decoding of the latent bits; and briefly combine the LLM and latent token encoder for fine-tuning to eliminate residual mismatches.
[0023] In this embodiment of the invention, the above-mentioned LLM autonomous generation of potential tokens step includes:
[0024] Discard the latent token encoder in use, retain only the LLM, and let the LLM autonomously generate vocabulary probability distributions at latent locations;
[0025] During training, the calculated word probability distribution is used as soft labels for latent positions, while standard word labels are used for explicit positions;
[0026] Temperature scaling is applied to both teacher and student distributions, and soft labels are normalized after top-k sparsification.
[0027] In this embodiment of the invention, the above explicit inference chain is segmented by either a fixed compression ratio or by adaptive determination by a semantic boundary detector.
[0028] Implicit thinking cessation strategies include: setting a fixed number of potential steps, or adaptively terminating based on the entropy of the potential bit distribution, the convergence of the answer confidence, or external validation signals;
[0029] The projection of the vocabulary column space includes: calculating on the full vocabulary softmax, or solving it first in the sub-vocabulary and then mapping it back to the full vocabulary;
[0030] Attention masks include: employing global causal constraints, or superimposing local windows or multi-head routing to improve the efficiency of long sequences and multi-path parallel representation.
[0031] Secondly, embodiments of this application provide a system for endowing large language models with implicit thinking, employing the method described above for endowing large language models with implicit thinking. The system includes:
[0032] The latent token generation and supervision module is designed for training data samples with explicit inference chains in large language models. It introduces a latent token encoder that is isomorphically initialized with the base model and collects key information in the explicit inference chain through a dedicated attention mask to generate latent tokens. The latent tokens are then restricted to the vocabulary column space by lexical probability superposition. The dedicated attention mask includes a latent token induction mask and a latent token supervision mask. Each latent token is represented as a linear superposition of lexical probability distributions on word embeddings.
[0033] Latent token autonomous generation module: Discard the latent token encoder, train the basic large language model LLM to autonomously generate latent tokens, and use the joint objective of KL divergence and cross-entropy to stabilize the optimization objective, so that the latent reasoning collapses into the explicit answer at the end of the reasoning.
[0034] Answer generation module: Given a question as input to the Large Language Model (LLM), the LLM internally generates a latent sequence, which is then collapsed into the final answer, thus hiding the intermediate reasoning content from the outside.
[0035] In this embodiment of the invention, the system that endows large language models with implicit thinking further includes:
[0036] Evaluation and parameter tuning module: It quantifies the degree of single-path compression and the ability of multi-path superposition / parallel thinking by using effective compression ratio and effective global parallelism respectively, and optimizes the parameters by forming a control interface through multiple hyperparameters.
[0037] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements steps for imbuing a large language model with implicit thinking methods.
[0038] Fourthly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement steps such as the implicit thinking method of a large language model.
[0039] Compared with existing technologies, it has the following outstanding advantages:
[0040] 1) The method and system proposed in this invention (Vocabulary-Column-Space Constrained Soft-Embedding): This invention directly represents each latent token as "a linear superposition of the lexical probability distribution and the token embedding", so that the latent representation is naturally constrained by the vocabulary column space (spanned by the columns of the embedding matrix), and extracts semantically compact, semantically compatible and semantically correct latent semantics from the explicit thought sequence using a dedicated attention mask (including a latent token inducement mask and a latent token supervision mask);
[0041] Technical Results: This approach resolves the mismatch between the hidden state and the word embedding space at the source, achieving stable alignment without additional mapping heads or complex distillation. This reduces engineering complexity and deployment costs, and enables the decoder to more reliably utilize latent information, maintaining / improving accuracy while compressing the inference chain and reducing token overhead. Practical experience shows that this constraint allows the model's accuracy to remain consistent with explicit inference, while reducing the required inference chain length by up to 4 times.
[0042] 2) The method and system of this invention propose a two-stage training with KL / CE joint loss: The invention adopts a two-stage training: Stage 1 uses a latent token encoder initialized isomorphically with the base LLM to generate latent tokens and provide soft labels (probability distribution) under mask constraints; Stage 2 discards the encoder and trains only the base LLM to generate latent tokens autonomously, and uses KL divergence to constrain latent bits and cross-entropy (CE) to constrain explicit bits (with temperature scaling and top-k sparsity configurable), to achieve stable convergence and controllable training;
[0043] Technical Results: This eliminates reliance on external modules during inference, resulting in a simpler chain, lower latency, and while significantly compressing the inference chain and reducing token costs, it maintains or approximates the accuracy of explicit SFT. Furthermore, it allows for flexible setting of latent steps and stopping strategies based on task and computing power budgets. Practical application shows that joint optimization enables the model to stably learn the implicit inference process, achieving an average performance improvement of 3.2% compared to non-joint optimization.
[0044] 3) The method and system of this invention propose measurable and controllable latent reasoning: This invention proposes two indicators, effective compression rate and effective global parallelism, to quantify the "single-path compression degree" and "multi-path superposition / parallel thinking ability" respectively, and forms a control interface of "efficiency-accuracy-parallelism" through mask design, loss weights (λ, β), temperature and top-k hyperparameters; the output mechanism of "collapse into the eigenstate of the explicit answer" at the end of the inference process enhances interpretability.
[0045] Technical Results: This establishes a unified and interpretable evaluation and parameter tuning closed loop, enabling developers to make fine trade-offs between accuracy and cost based on metrics, explicitly improving multi-path exploration capabilities, reducing the upper limit of greedy approximation, and providing standardized and reusable engineering basis for deployment and A / B testing. Practice shows that these two metrics effectively measure the learning performance of implicit inference, providing better feedback compared to accuracy alone, with an average performance improvement of 1.6%. Attached Figure Description
[0046] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0047] Figure 1 A schematic diagram illustrating the implicit thinking method of the large language model in this invention;
[0048] Figure 2 This is a flowchart of the Latent-SFT method according to an embodiment of the present invention;
[0049] Figure 3 A schematic diagram illustrating the implicit thinking system of the large language model in this invention;
[0050] Figure 4 This is a schematic diagram of the computer hardware of the present invention. Detailed Implementation
[0051] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.
[0052] It should also be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.
[0053] It should also be understood that, in various embodiments of the present invention, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0054] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units 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 device, 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 devices or units may be electrical, mechanical, or other forms.
[0055] The units described 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.
[0056] In addition, the functional units in the various embodiments of the present invention 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.
[0057] If a function 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 invention, or the part that contributes to the prior art, or a 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 several 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 described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0058] To make the above-mentioned features and effects of the present invention clearer and easier to understand, specific embodiments are described below in conjunction with the accompanying drawings. This specification discloses one or more embodiments incorporating the features of the present invention. The disclosed embodiments are merely illustrative. The scope of protection of the present invention is not limited to the disclosed embodiments, but is defined by the appended claims.
[0059] The following are system embodiments corresponding to the above method embodiments. This embodiment can be implemented in conjunction with the above embodiments. The relevant technical details mentioned in the above embodiments are still valid in this embodiment, and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above embodiments.
[0060] This invention aims to propose a latent reasoning training and inference method and system based on the superposition of vocabulary column spaces (Latent-SFT). This method directly constrains the latent representation to the vocabulary column space (spanned by the columns of the word embedding matrix) and combines a dedicated attention mask with two-stage learning (KL+CE joint loss) to resolve space mismatch at the source, stably learn usable latent tokens, and finally "collapse" into an explicit answer at the end of the inference process. This achieves significant inference chain compression, low latency, and low token cost, while maintaining or approaching the accuracy of supervised-tuning (SFT). Furthermore, a new metric enables measurable and controllable "compression and parallelization" of latent reasoning.
[0061] In its research on accelerating and protecting the privacy of Large Language Model (LLM) reasoning, this invention discovered that the root cause of the unstable performance and alignment difficulties of existing latent reasoning methods lies in the fact that mainstream solutions generally "think" within an unstructured hidden state space or directly skip the language model head (LM head) to advance the latent steps, only considering the autoregressive evolution of the hidden state without fully considering the structural alignment and supervised signals with the word embedding / vocabulary probability space. This leads to "hidden state-word embedding" mismatch, training oscillations, and strong dependence on the number of latent steps. Furthermore, training-free methods are equivalent to greedy advancement, making it difficult to represent multi-path superposition and global parallelism. To address this technical challenge, the inventors, through systematic experiments and ablation studies, discovered that by directly constraining the latent representation to the vocabulary column space (spanned by the word embedding matrix columns) and providing learnable "soft labels" for the latent positions, the mismatch can be resolved at its source, and training can be stabilized.
[0062] Based on this, a two-stage Latent-SFT technical solution is proposed: In stage one, a latent token encoder is introduced, isomorphically initialized with the base model. Key information from explicit thinking is collected through latent token induction masks and latent token supervision masks (collectively referred to as "dedicated attention masks"), generating semantically compact, semantically compatible, and semantically correct latent tokens. These latent tokens are then constrained to the vocabulary column space using lexical probability superposition. In stage two, the latent token encoder is discarded, and only the base LLM is trained to autonomously generate latent tokens. A joint objective stability optimization using KL divergence (soft labels for latent bits) and cross-entropy (for explicit bits) is employed, causing latent inference to "collapse" into explicit answers at the end of the inference process, while simultaneously achieving significant chain length compression and multi-path superposition representation. This process is completed on the existing autoregressive decoding framework, with clear improvements (spatial constraints + masking mechanism + two-stage supervision), representing a structured improvement and engineering-ready solution on the existing paradigm.
[0063] The system of this application embodiment will be described in detail below with reference to specific embodiments:
[0064] Example 1
[0065] like Figure 1 and Figure 2 As shown in the embodiments of this application, a method for endowing a large language model with implicit thinking is proposed. The method includes:
[0066] Latent token generation and supervision step 101: For training data samples with explicit inference chains of large language models, a latent token encoder is introduced that isomorphically initialized with the base model. Key information in the explicit inference chain is collected through a dedicated attention mask to generate latent tokens. The latent tokens are then restricted to the word list column space by lexical probability superposition. The dedicated attention mask includes a latent token induction mask and a latent token supervision mask. Each latent token is represented as a linear superposition of lexical probability distributions on word embeddings.
[0067] Specifically, in specific embodiments of the present invention, the overall technical solution aims to achieve efficient, stable, and controllable latent reasoning in large-scale language models (LLMs). Training data uses samples with explicit chain-of-thought (CoT) structures, uniformly represented as X = [Q, <think> , T, < / think> [Q, T], where Q is the question, T is the explicit reasoning text, and Answer is the answer. The word embedding matrix of the model is denoted as E, and the weights of the language model head (LM head) are denoted as W. Weight sharing (W=E) is preferably used to ensure geometric consistency. To directly constrain the latent representation to the vocabulary column space, this invention defines latent tokens as a probabilistically weighted superposition of embeddings throughout the entire training and inference process, thus addressing the mismatch between the hidden state and the word embedding space at its source.
[0068] Latent token autonomous generation step 102: Discard the latent token encoder, train the basic large language model LLM to autonomously generate latent tokens, and use the joint objective of KL divergence and cross-entropy to stabilize the optimization objective, so that the latent reasoning collapses into the explicit answer at the end of the reasoning.
[0069] Answer generation step 103: For a given question input into a large language model (LLM), the LLM generates a latent sequence internally, which is then collapsed into the final answer, thus hiding the intermediate reasoning content from the outside.
[0070] In this embodiment of the invention, the method for endowing large language models with implicit thinking further includes:
[0071] Evaluation and parameter tuning step 104: Quantitatively evaluate the single-path compression degree and multi-path superposition / parallel thinking ability by using effective compression ratio and effective global parallelism respectively, and optimize the parameter tuning by forming a control interface through multiple hyperparameters.
[0072] In this embodiment of the invention, the above-mentioned potential token generation and supervision establishment step 101 includes:
[0073] A latent token encoder is used to segment the explicit inference chain of the training data of a large language model into multiple sub-segments. A latent token placeholder is inserted after each sub-segment, and a latent token inducement mask is applied so that when calculating the hidden state of the latent token placeholder, only the historical information of the explicit inference chain is considered, so as to shield future explicit segments from other latent bits.
[0074] The word logarithmic value is obtained by projecting the hidden state of the latent token occupant to the word column space using the language model head. The word probability distribution is obtained by normalizing the temperature value. The latent representation is reconstructed in the embedding space based on the word probability distribution. The latent representation in the embedding space is generated linearly by the columns of the embedding matrix and is located in the word column space.
[0075] By introducing a latent token supervision mask, constructing a prefix, and allowing only the prefix to decode the explicit reasoning chain, a local supervision is formed for each latent bit, extracting semantically compact, semantically compatible, and semantically correct latent semantics from the explicit thought sequence.
[0076] Specifically, in a specific embodiment of the present invention, in the step of generating potential tokens and establishing supervision in stage one, the explicit reasoning chain T is first segmented to obtain T = { }_{i=1..N}. In each sub-segment Then insert a potential token placeholder. And apply a Latent Token Induction Mask (LTIM) to make the computation Hidden state At that time, only [Q, <think>, , …, The historical information of the [] is strictly shielded from future explicit fragments and other potential bits. This ensures that each potential bit only carries explicit semantics "up to the present", and no non-causal information leakage occurs between potential bits.
[0077] Subsequently, the language model head was used to... Projection yields the logarithmic value of the vocabulary. = W · The word probability distribution α = softmax( ) is obtained by applying softmax at temperature t>0. / t), and reconstruct the latent representation z = E · α in the embedding space accordingly. Since z is linearly generated by the columns of the embedding matrix, it naturally resides in the vocabulary column space, ensuring semantic compatibility and facilitating reliable use by subsequent decoders. To ensure that the latent bits possess the semantic correctness of "being able to decode subsequent explicit segments until the answer," this invention introduces a Latent Token Supervision Mask (LTSuM) to construct a prefix. = [Q, <think>, , , , …, ], and only allow Dededecoding = [ , …, ,< / think> [Answer] forms a local supervision for each potential bit. The objective function of stage one is to minimize the standard cross-entropy under the above mask constraints, stably "extracting-aligning-verifying" the semantic compactness, compatibility and correctness of the potential tokens.
[0078] Considering that the strong constraints of LTIM / LTSuM increase the optimization difficulty, the preferred optimization schedule for Phase 1 is an alternating approach: first, freeze the LLM and update only the latent token encoder to allow the latent bits to quickly converge to a stable semantic representation; then, freeze the encoder and update only the LLM to adapt to the conditional decoding of the latent bits; finally, briefly perform joint fine-tuning to eliminate residual mismatches. This schedule can achieve stable and repeatable training convergence without introducing complex distillation or reinforcement learning.
[0079] In this embodiment of the invention, the above-mentioned potential token generation and supervision establishment step 102 further includes:
[0080] The preferred alternating optimization steps are: first, freeze the LLM and update only the latent token encoder to allow the latent bits to quickly converge to a stable semantic representation; then freeze the latent token encoder and update only the LLM to adapt to the conditional decoding of the latent bits; and briefly combine the LLM and latent token encoder for fine-tuning to eliminate residual mismatches.
[0081] In this embodiment of the invention, the above-mentioned LLM autonomous generation of potential tokens step includes:
[0082] Discard the latent token encoder in use, retain only the LLM, and let the LLM autonomously generate vocabulary probability distributions at latent locations;
[0083] During training, the calculated word probability distribution is used as soft labels for latent positions, while standard word labels are used for explicit positions;
[0084] Temperature scaling is applied to both teacher and student distributions, and soft labels are normalized after top-k sparsification.
[0085] Specifically, in a specific embodiment of the present invention, in the stage two LLM autonomous latent token generation step, the latent token encoder used in stage one is discarded, and only the basic LLM is retained, allowing it to autonomously generate vocabulary probability distributions at latent positions. During training, α obtained in stage one is used as the soft label p for the latent position, while the standard word label is still used for the explicit position. Optionally, temperature scaling can be applied to both teacher and student distributions, and p can be top-k sparsified and normalized to further reduce computational cost and improve numerical stability. After Phase Two is completed, deployment requires only the basic LLM: given a problem Q, the model first internally generates latent sequences […]. , …, The solution then "collapses" to the final answer; the entire process outputs no results. <think> …< / think> The explicit link reduces tokens and latency while avoiding the exposure of intermediate inference content.
[0086] In this embodiment of the invention, the above explicit inference chain is segmented by either a fixed compression ratio or by adaptive determination by a semantic boundary detector.
[0087] Implicit thinking cessation strategies include: setting a fixed number of potential steps, or adaptively terminating based on the entropy of the potential bit distribution, the convergence of the answer confidence, or external validation signals;
[0088] The projection of the vocabulary column space includes: calculating on the full vocabulary softmax, or solving it first in the sub-vocabulary and then mapping it back to the full vocabulary;
[0089] Attention masks include: employing global causal constraints, or superimposing local windows or multi-head routing to improve the efficiency of long sequences and multi-path parallel representation.
[0090] To enhance the flexibility and robustness of implementation, this invention provides several equivalent or compatible implementation variations for key aspects. For example, segmentation can use a fixed compression ratio or be adaptively determined by the semantic boundary detector; the stopping strategy can set a fixed number of potential steps or adaptively terminate based on the entropy of the potential bit distribution, the convergence of the answer confidence, or external verification signals; the projection of the vocabulary column space can be calculated directly on the full vocabulary softmax or solved first in the sub-vocabulary and then mapped back to the full vocabulary; the attention mask can use global causal constraints or superimpose local windows or multi-head routing to improve the efficiency of long sequences and multi-path parallel expression. These variations all maintain the core technical features of "column space constraints + mask constraints + two-stage KL / CE joint training" and can achieve the same technical effect as the main solution under different task scales, computing budgets, and deployment environments. In summary, this invention achieves a closed-loop process from latent token generation to autonomous latent inference by using the structural constraint of "performing latent inference in the vocabulary column space" in conjunction with the learnable supervision of LTIM / LTSuM and two-stage bootstrapping training. Ultimately, it significantly compresses the inference chain, reduces tokens and latency while ensuring accuracy, and provides a measurable and controllable engineering interface to adapt to large-scale industrial deployment.
[0091] As described above, the method of the present invention can be implemented well.
[0092] Compared with the prior art, the present invention has the following outstanding advantages and beneficial effects:
[0093] Compared with existing technologies, this invention (Latent-SFT, a latent inference method and system based on the superposition of vocabulary column spaces) achieves comprehensive improvements in efficiency, accuracy, stability, and engineering feasibility. Specifically, it significantly reduces the length of the inference chain and the cost of tokens. On low-difficulty mathematical inference tasks, Latent-SFT achieves an average #L≈5.44 at a compression ratio r=4, and obtains the best comprehensive efficiency index Pass@1 / #L=9.37 while maintaining high accuracy; at r=2, the average #L≈9.87, which is still significantly shorter than explicit CoT-SFT (e.g., CoT-SFT has an average #L≈21.4 across multiple datasets). Second, it achieves or exceeds the accuracy of explicit SFT on several datasets while maintaining a high compression ratio. For example, Latent-SFT (r=2) outperforms CoT-SFT in Pass@1 on GSM8k-Aug and MultiArith, and reduces the average inference chain length by about 1 / 4. Simultaneously, it achieves higher Pass@1 and shorter #L on lower-difficulty tasks compared to mainstream latent methods (such as COCONUT, CODI, and CoLaR), demonstrating better task performance with the same or lower computing power budget. Third, the definition of soft embedding brings robust gains across difficulty levels. On high-difficulty MATH-500 and AIME24, compared to the "last hidden state" representation, soft embedding improves Pass@1 by approximately 12.0% and 11.4%, respectively, while maintaining a significantly shorter inference chain (#L is an order of magnitude lower than explicit CoT-SFT), verifying the universal effectiveness of "latent representations being limited by the vocabulary column space." Fourth, training stability and interpretability are enhanced. Ablation analysis results show that removing the Latent Token Induced Mask (LTIM) or the Supervisory Mask (LTSuM) leads to significant performance degradation, proving that the mask design of this invention can stably extract semantically compact, compatible, and correct latent tokens. The proposed metrics of "effective compression ratio" and "effective global parallelism" provide a measurable and controllable optimization loop for development and deployment. Fifth, the engineering process is simplified, and latency and cost are reduced. Two-stage learning does not require retaining the encoder or additional mapping head / RL during inference, reducing parameters and dependencies, shortening end-to-end latency, and reducing memory and computational overhead. In privacy-compliant scenarios, the absence of an explicit intermediate thought chain reduces the risk of exposing sensitive intermediate content. In summary, this invention has significant and well-documented beneficial effects in saving "raw materials" (token / computation), improving efficiency (latency / #L), and demonstrating better performance (Pass@1 / robustness / interpretability), meeting the industrialization requirements of efficient, stable, and controllable large-scale inference deployments.
[0094] Example 2
[0095] like Figure 3 As shown, this application provides a system for endowing large language models with implicit thinking, employing the method described above. The system includes:
[0096] The latent token generation and supervision module 201: For training data samples with explicit inference chains of large language models, a latent token encoder is introduced that isomorphically initialized with the base model. Key information in the explicit inference chain is collected through a dedicated attention mask to generate latent tokens. The latent tokens are then restricted to the word list column space by lexical probability superposition. The dedicated attention mask includes a latent token induction mask and a latent token supervision mask. Each latent token is represented as a linear superposition of lexical probability distributions on word embeddings.
[0097] Latent Token Autonomous Generation Module 202: Discard the latent token encoder, train the basic large language model LLM to autonomously generate latent tokens, and use the joint objective of KL divergence and cross-entropy to stabilize the optimization objective, so that the latent reasoning collapses into the explicit answer at the end of the reasoning.
[0098] Answer generation module 203: For a given question input to a large language model (LLM), the LLM generates a latent sequence internally and then collapses it into the final answer, thus hiding the intermediate reasoning content from the outside.
[0099] In this embodiment of the invention, the system that endows large language models with implicit thinking further includes:
[0100] Evaluation and parameter tuning module 204: It quantifies the single-path compression degree and multi-path superposition / parallel thinking ability by using effective compression ratio and effective global parallelism respectively, and optimizes the parameter tuning by forming a control interface through multiple hyperparameters.
[0101] Example 3
[0102] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a method for endowing large language models with implicit thinking.
[0103] Example 4
[0104] This application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the method for endowing a large language model with implicit thinking as described above.
[0105] In addition, combined Figure 1 The method for endowing a large language model with implicit thinking, as described in the embodiments of this application, can be implemented by an electronic device, such as a computer device. Figure 4 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of this application.
[0106] In some embodiments, the computer device may further include a communication interface 83 and a bus 80. For example, Figure 4 As shown, the processor 81, memory 82, and communication interface 83 are connected through bus 80 and complete communication with each other.
[0107] Specifically, the processor 81 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0108] The memory 82 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program instructions executed by the processor 81.
[0109] The processor 81 reads and executes computer program instructions stored in the memory 82 to implement any of the methods described above for endowing the large language model with implicit thinking.
[0110] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0111] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.< / think>
Claims
1. A method for endowing large language models with implicit thinking, characterized in that, The method includes: The latent token generation and supervision steps are as follows: For training data samples with explicit inference chains of a large language model, a latent token encoder is introduced that isomorphically initialized with the base model. Key information in the explicit inference chain is collected through a dedicated attention mask to generate latent tokens. The latent tokens are then restricted to the vocabulary column space by lexical probability superposition. The dedicated attention mask includes a latent token induction mask and a latent token supervision mask. Each latent token is represented as a linear superposition of lexical probability distributions on word embeddings. The latent token autonomous generation step is as follows: discard the latent token encoder, train the basic large language model LLM to autonomously generate latent tokens, and use the joint objective of KL divergence and cross-entropy to stabilize and optimize the objective, so that the latent reasoning collapses into the explicit answer at the end of the reasoning. Answer generation steps: Given a question, the Large Language Model (LLM) generates a latent sequence internally and then collapses it into the final answer, thus hiding the intermediate reasoning content from the outside.
2. The method for endowing large language models with implicit thinking according to claim 1, characterized in that, The method further includes: Evaluation and parameter tuning steps: The single-path compression degree and multi-path superposition / parallel thinking ability are evaluated by effectively compressing ratio and effectively global parallelism, respectively, and the optimal parameter tuning is carried out by forming a control interface through multiple hyperparameters.
3. The method for endowing large language models with implicit thinking according to claim 1 or 2, characterized in that, The potential token generation and supervision steps include: A latent token encoder is used to segment the explicit inference chain of the training data of a large language model to obtain multiple sub-segments. A latent token placeholder is inserted after each sub-segment, and a latent token inducement mask is applied so that when calculating the hidden state of the latent token placeholder, only the historical information of the explicit inference chain is considered, so as to shield future explicit segments and other latent bits. The hidden state of the potential token occupant is projected onto the vocabulary column space by the language model head to obtain the vocabulary logarithm. The vocabulary probability distribution is obtained by normalizing the temperature value. The potential representation is reconstructed in the embedding space according to the vocabulary probability distribution. The potential representation in the embedding space is generated linearly by the columns of the embedding matrix and is located in the vocabulary column space. By introducing a latent token supervision mask, constructing a prefix, and allowing only the prefix to decode the explicit reasoning chain, a local supervision is formed for each latent bit, extracting semantically compact, semantically compatible, and semantically correct latent semantics from the explicit thought sequence.
4. The method for endowing large language models with implicit thinking according to claim 3, characterized in that, The potential token generation and supervision establishment steps also include: The preferred alternating optimization steps are as follows: first, freeze the LLM and update only the latent token encoder to make the latent bits quickly converge to a stable semantic representation; then freeze the latent token encoder and update only the LLM to adapt to the conditional decoding of the latent bits; briefly combine the LLM and the latent token encoder for fine-tuning to eliminate residual mismatches.
5. The method for endowing large language models with implicit thinking according to claim 3, characterized in that, The LLM autonomously generates potential tokens step includes: Discard the latent token encoder in use, retain only the LLM, and allow the LLM to autonomously generate a vocabulary probability distribution at the latent positions; During training, the calculated word probability distribution is used as a soft label for latent positions, while standard word labels are used for explicit positions; Temperature scaling is applied to both teacher and student distributions, and the soft labels are normalized after top-k sparsification.
6. The method for endowing large language models with implicit thinking according to claim 3, characterized in that, The explicit inference chain is segmented using either a fixed compression ratio or adaptively determined by the semantic boundary detector. The implicit thinking cessation strategy includes: setting a fixed number of potential steps, or adaptively terminating based on the entropy of the potential position distribution, the convergence of the answer confidence, or external verification signals; The projection of the vocabulary column space includes: calculating on the full vocabulary softmax, or solving it first in the sub-vocabulary and then mapping it back to the full vocabulary; The attention mask includes: employing global causal constraints, or superimposing local windows or multi-head routing to improve the efficiency of long sequences and multi-path parallel expression.
7. A system for endowing a large language model with implicit thinking, employing the method for endowing a large language model with implicit thinking as described in any one of claims 1-6, characterized in that, The system includes: The latent token generation and supervision module is designed for training data samples with explicit inference chains in a large language model. It introduces a latent token encoder initialized isomorphically to the base model and uses a dedicated attention mask to collect key information from the explicit inference chain to generate latent tokens. The latent tokens are then confined to the vocabulary column space using lexical probability superposition. The dedicated attention mask includes a latent token induction mask and a latent token supervision mask, where each latent token is represented as a linear superposition of lexical probability distributions with respect to word embeddings. Latent token autonomous generation module: Discard the latent token encoder, train the basic large language model LLM to autonomously generate latent tokens, and use the joint objective of KL divergence and cross-entropy to stabilize and optimize the objective, so that the latent reasoning collapses into the explicit answer at the end of the reasoning. Answer generation module: Given a question as input to the large language model LLM, the LLM generates a latent sequence internally, which is then collapsed into the final answer, thus hiding the intermediate reasoning content from the outside.
8. The system for endowing large language models with implicit thinking according to claim 7, characterized in that, The system also includes: Evaluation and parameter tuning module: It quantifies the degree of single-path compression and the ability of multi-path superposition / parallel thinking by using effective compression ratio and effective global parallelism respectively, and optimizes the parameters by forming a control interface through multiple hyperparameters.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method for endowing a large language model with implicit thinking as described in any one of claims 1-6.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method for endowing a large language model with implicit thinking as described in any one of claims 1-6.
Citation Information
Cited By
Psychological pollution name classification method based on multi-agent self-correction and thinking chain distillation
CN122196187A
Method for classifying psychological stigma based on multi-agent self-correction and thought chain distillation
CN122196187B