Large language model optimization method and system based on inference tree bifurcation points and semantic gating
By using an optimization method based on inference tree bifurcation points and semantic gating, a structured inference tree is generated and fine-grained supervision is performed, which solves the problems of low learning efficiency and high computational cost in large language models and achieves efficient and stable model optimization results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIVERSTIY INFORMATION ENG SCHOOL
- Filing Date
- 2026-01-20
- Publication Date
- 2026-04-28
Smart Images

Figure CN121936601A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, specifically to a method and system for optimizing large language models based on inference tree bifurcation points and semantic gating. Background Technology
[0002] In recent years, artificial intelligence technologies, represented by Large Language Models (LLMs), have made groundbreaking progress and demonstrated great potential in fields requiring complex reasoning abilities, such as mathematical problem-solving, code generation, and scientific literature analysis. To further improve the performance of these models on these tasks, various optimization methods have been proposed, mainly categorized into two types: reinforcement learning-based optimization and search algorithm-based optimization. Reinforcement learning-based optimization methods, such as the Proximal Policy Optimization (PPO) algorithm, typically assign a uniform reward or penalty to the entire reasoning chain based on the correctness of the final reasoning result. However, this result-based supervision method suffers from a serious "credit allocation" problem. Specifically, when a reasoning chain containing multiple steps ultimately leads to an incorrect answer, this method penalizes all steps in the chain, failing to accurately locate and correct which specific step has a logical error. This results in low model learning efficiency and slow convergence speed.
[0003] On the other hand, optimization methods based on search algorithms, such as Monte Carlo Tree Search (MCTS), can explore multiple possible paths during inference to select the optimal solution. However, such methods require large-scale real-time searches during the inference phase, which incurs huge computational overhead and excessively high response latency, making them difficult to deploy in online service scenarios requiring rapid response. Therefore, how to effectively combine the advantages of both approaches to achieve fine-grained supervision of the model's inference process without introducing high inference costs, thereby accurately correcting specific errors in the model's inference process, has become a pressing technical challenge in the field of large language model optimization. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for optimizing large language models based on inference tree bifurcation points and semantic gating, so as to solve the problems mentioned in the background art.
[0005] The present invention provides the following technical solution: a method for optimizing a large language model based on inference tree bifurcation points and semantic gating, comprising the following steps: Step S1: Perform system initialization and define a computational model that includes a teacher model, a student model, and a semantic representation model.
[0006] Preferably, the teacher model is used to provide the ability to explore reasoning paths and generate original training data; Student model: Used to improve performance by learning the reasoning logic of the teacher model; Semantic representation model: used to transform text sequences into high-dimensional semantic vectors, providing a foundation for subsequent semantic similarity calculation.
[0007] Step S2: Input the target problem text to be solved, and construct a reasoning tree based on Monte Carlo tree search using the preset teacher model.
[0008] Preferably, the specific implementation process includes: for each target problem text to be solved input in the target domain, the processor uses a preset teacher large language model to perform offline reasoning calculations through the Monte Carlo tree search algorithm. This process generates a structured reasoning tree, which fully records all exploration paths starting from the initial question, including successful paths leading to the correct answer and failed paths leading to the incorrect answer. Each node in the reasoning tree represents a historical reasoning context, and its set of child nodes represents all possible next reasoning steps starting from that context.
[0009] Preferably, offline reasoning computation using the Monte Carlo tree search algorithm includes: the system uses the target problem text to be solved as the root node, and generates a structured reasoning tree through a cyclical iteration of four stages: selection, expansion, simulation, and backtracking; during the generation process, the processor outputs content in a structured step format by prompting the engineering constraint teacher model, which facilitates subsequent node segmentation of the reasoning chain; for each reasoning tree, the system sets a search budget to ensure that the reasoning tree contains multiple different paths from the root node to the leaf nodes. These paths are marked as leaf nodes leading to the correct answer or leaf nodes leading to the incorrect answer, depending on the correctness of the final answer; the generated reasoning tree is serialized into structured data and stored in the database, with each node containing a unique identifier, text content, parent node reference, and path result label.
[0010] Step S3: Perform node traversal and candidate sample pairing on the inference tree.
[0011] Preferably, the processor reads the stored inference tree and traverses each non-leaf node in the inference tree; for each node, the system obtains the set of all its direct child nodes, and the processor performs full permutation or combination of the child nodes in the set to pair them up to generate a series of candidate sample pairs.
[0012] Step S4: Perform preliminary screening of sample pairs based on the differences in results.
[0013] Step S5: Introduce semantic similarity verification for the initially screened sample pairs and use semantic gating mechanism for further filtering.
[0014] Step S6: Train the student model based on the selected key bifurcation point dataset and construct a contrastive loss function.
[0015] Preferably, semantic similarity verification is introduced for the selected sample pairs. A semantic gating mechanism is introduced, in which the processor calls the preloaded semantic representation model to calculate the text semantic vectors of the positive sample step and the negative sample step respectively, and then calculates the cosine similarity between the two vectors.
[0016] Preferably, constructing the comparative loss function includes: based on the selected key bifurcation point dataset, the processor trains the student model, and for each training triplet, the processor constructs a specific comparative loss function; the loss function maximizes the log probability difference between the steps of generating positive samples and generating negative samples at a given historical node; and a length normalization mechanism is introduced to eliminate the influence of steps of different lengths on the loss calculation.
[0017] Step S7: Finally, perform multi-task joint optimization and parameter update.
[0018] Preferably, the multi-task joint optimization and parameter update includes: adopting a multi-task joint optimization strategy, the processor weightedly fuses the calculated contrastive loss with the standard supervised fine-tuning loss to calculate the total loss function; the processor uses the backpropagation algorithm to calculate the gradient of the total loss function with respect to the student model parameters, and uses the optimizer to update the parameters; this process is iterated on the training dataset until the model converges.
[0019] On the other hand, the present invention also provides an electronic device, which serves as a physical carrier for large language model optimization. At the hardware level, the electronic device includes a processor, a memory, and a communication interface. The memory stores a computer program, and when the processor is configured to execute the computer program, it implements a large language model optimization method based on inference tree bifurcation points and semantic gating.
[0020] On the other hand, the present invention also provides a large language model optimization system based on inference tree bifurcation points and semantic gating, and executes a large language model optimization method based on inference tree bifurcation points and semantic gating, including: Reasoning tree generation module: used to perform Monte Carlo tree search on the target problem, generate a structured reasoning tree containing successful reasoning paths and failed reasoning paths, and serialize and store the reasoning tree in the database; Key bifurcation point identification module: used to generate candidate sample pairs, and sequentially perform preliminary screening based on result differences and semantic gating filtering, outputting a key bifurcation point dataset; Model training module: used to calculate the step-level contrastive loss function including a length normalization term, and to weight and fuse this loss with the supervised fine-tuning loss, and to update the network parameters of the student model using the backpropagation algorithm.
[0021] Compared with the prior art, the beneficial effects achieved by the present invention are: (1) Precise credit allocation: This invention achieves fine-grained supervision of the reasoning process by identifying and focusing on the "key bifurcation points" that lead to differences in results, directly locating and correcting individual error steps, effectively solving the credit allocation problem in traditional reinforcement learning methods, and significantly improving the learning efficiency and convergence speed of the model.
[0022] (2) Avoiding pattern collapse and protecting problem-solving diversity: The "semantic gating" mechanism introduced in this invention ensures that comparative learning is only performed between steps with similar semantic intent, avoiding the impact of different problem-solving approaches (such as...). Error penalties for algebraic and geometric methods. This effectively prevents the risk of "pattern collapse"—the loss of methodological diversity due to training bias—and enhances the model's generalization ability and robustness.
[0023] (3) Balancing high efficiency and high performance: This invention adopts an "offline search, online distillation" paradigm, placing the computationally intensive MCTS search process in the offline data preparation stage, while eliminating the need for large-scale searches during model training and online service. This allows the model to learn the rich process information brought by the search process while avoiding the high latency during online inference, achieving an organic combination of high performance and high efficiency.
[0024] (4) Stable and reliable training process: The step-level comparison loss function designed in this invention includes a length normalization mechanism, which effectively addresses the situation where the text lengths of the inference steps are not uniform, making gradient calculation and parameter updates more stable and ensuring the reliability of the entire optimization process. Attached Figure Description
[0025] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating the steps of a large language model optimization method based on inference tree bifurcation points and semantic gating provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the process of selecting key bifurcation points based on a reasoning tree, provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of an ablation experiment provided by an embodiment of the present invention; Figure 4This is a schematic diagram of the composition of a large language model optimization system based on inference tree bifurcation points and semantic gating provided in an embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] Example 1 In this embodiment, the present invention provides an electronic device that serves as the physical carrier of a large language model optimization device. At the hardware level, the electronic device includes a processor (such as a central processing unit (CPU) or a graphics processing unit (GPU), a memory, and a communication interface. The memory stores a computer program, and the processor is configured to execute the computer program to implement a large language model optimization method based on inference tree bifurcation points and semantic gating. Considering the computational power requirements of large language model training, as a preferred embodiment, the processor is preferably a GPU cluster equipped with high-performance computing units (such as an NVIDIA A100 or H800 cluster), and the memory is preferably a combination of high-speed video memory and NVMe SSD to meet the requirements of large-scale tensor operations and data throughput.
[0028] Example 2 Combination Figures 1-3 As shown, the present invention provides a technical solution: a method for optimizing a large language model based on inference tree bifurcation points and semantic gating, comprising the following steps: Step S1: System initialization and model definition.
[0029] In this embodiment, the present invention utilizes the processor to load and initialize three core computing modules in memory, which respectively include: Teacher Model (also known as the first pre-trained model): This is a generative large language model with a large number of parameters and strong reasoning ability (as an unrestricted example, Llama-3-70B-Instruct can be used). Its main technical function is to provide high-quality reasoning path exploration capabilities for generating original training data.
[0030] Student Model (also known as the second pre-trained model or the model to be optimized): This is a model with relatively few parameters and fast inference speed, but whose inference ability still needs to be improved (as a non-limiting example, Llama-3-70B-Instruct can be used). It is the target object of the final optimization of this invention, and its performance is improved by learning the inference logic of the teacher model.
[0031] Semantic Representation Model: This is a lightweight vectorization model (as a non-restrictive example, all-MiniLM-L6-v2 can be used) to transform text sequences into high-dimensional semantic vectors, providing a foundation for subsequent semantic similarity calculations.
[0032] Step S2: Enter the text of the target problem to be solved. We construct a reasoning tree based on Monte Carlo Tree Search (MCTS) using a pre-defined teacher large language model.
[0033] For example, for each target problem text input in the target domain (such as the math competition dataset MATH or the code generation dataset MBPP) The processor utilizes a pre-defined teacher-centric large language model and performs offline reasoning computation using an improved Monte Carlo Tree Search (MCTS) algorithm based on a divide-and-conquer strategy. This process generates a structured reasoning tree that fully records all exploration paths starting from the initial question, including successful paths leading to the correct answer and failed paths leading to incorrect answers. Each non-leaf node in the tree... Each represents a historical reasoning context, and its set of child nodes. This represents all possible next steps in the reasoning process based on that context. Finally, the complete tree structure data, containing information such as node ID, node text, parent node ID, and whether a leaf node is a correct solution, is stored for subsequent processing.
[0034] For example, to address the problem that traditional greedy decoding cannot cover diverse error paths, this invention employs the Monte Carlo Tree Search (MCTS) algorithm for path exploration. The specific implementation process includes: The system uses the target problem text to be solved. Using the root node as the argument, a structured reasoning tree is generated through iterative cycles of four stages: selection, expansion, simulation, and backpropagation. The implementation of the four stages specifically includes: Selection Phase: The system starts from the root node of the reasoning tree (i.e., the target problem) and, based on statistical information of the nodes in the tree structure (such as the number of visits), selects the appropriate node. Value rating The algorithm uses strategies such as upper confidence bound (UCB) to select an optimal path until it reaches a leaf node that has not yet been fully expanded.
[0035] Expansion Phase: For the selected leaf node (representing the current inference context), the processor invokes the teacher model to generate a new node based on Top-k sampling or Beam Search. The candidate "Next Step". The newly generated step text is instantiated as a new child node and added to the reasoning tree.
[0036] Simulation Phase: Starting from the newly expanded child nodes, the teacher model is used to perform complete reasoning (Rollout) until the final solution is generated. The generated answer is then compared with the ground truth. If the answer is correct, a positive reward is given to that path (e.g., ...). If the answer is wrong, a negative or zero reward is given (e.g., ).
[0037] Backpropagation: The system propagates the reward value V obtained in the simulation phase back along the path to the root node, updating the visit count and average value estimate of all parent nodes on the path.
[0038] By setting a fixed search budget (such as N iterations), the system eventually generates a reasoning tree containing multiple complete paths from the question to the answer, including successful path branches leading to the correct answer and failed path branches leading to the incorrect answer.
[0039] Furthermore, to achieve precise segmentation of inference chain nodes, during the generation process, the processor constrains the teacher model to output content in a structured step format (e.g., "Step 1:...\nStep 2:...") through prompt engineering, facilitating subsequent node segmentation of the inference chain. For each inference tree, the system sets a search budget (e.g., 32 simulations) to ensure that the tree contains multiple different paths from the root node to the leaf nodes. These paths are marked as successful inference paths (i.e., leaf nodes leading to the correct answer) or failed inference paths (i.e., leaf nodes leading to the incorrect answer) based on the correctness of the final answer. Finally, the generated inference tree is serialized into structured data (such as JSON format) and stored in the database. Each node contains a unique identifier (NodeID), text content, a parent node reference, and a path result label.
[0040] Step S3: Traverse the inference tree and pair it with candidate samples.
[0041] In this embodiment, after data generation is completed, the system enters the critical bifurcation point mining stage. In order to solve the problem of "credit assignment" caused by the uniform reward and punishment of the entire inference path in traditional reinforcement learning, this invention uses fine-grained node traversal to accurately locate the specific time when the error occurs.
[0042] For example, the processor reads the stored inference tree T and traverses every non-leaf node in the tree. .node This represents a specific historical context in the reasoning process. For each node... The system obtains the set of all its direct child nodes. These child nodes represent different next steps that the teacher model attempted to explore within the same historical context, namely, the processor's approach to the set. The child nodes in the sample are permuted or combined in pairs to generate a series of candidate sample pairs. These pairings represent different branch choices at the same decision point, forming the basis for subsequent comparative learning.
[0043] Step S4: Preliminary screening based on result differences.
[0044] In this embodiment, after obtaining candidate sample pairs, the processor first performs result-oriented filtering, meaning that the comparison between two branches only has clear gradient guidance significance when they ultimately lead to drastically different results. The processor then queries the final state value of the subsequent path of each child node. ,generally, This indicates that the path ultimately leads to the correct answer. This indicates an incorrect answer. The system selects sample pairs that meet the following conditions: Step S5: Fine-grained filtering based on semantic gating In this embodiment, addressing the technical problem in existing technologies where simple contrastive learning often forcibly narrows the gap between the model and positive samples while widening the gap with negative samples, leading to mode collapse (i.e., if positive samples use an "algebraic method" while negative samples use a "geometric method" and only have a computational error, forcibly penalizing the "geometric method" will cause the model to mistakenly believe that the "geometric method" itself is a flawed approach, thus losing the diversity of problem-solving methods), this invention, to prevent the model from experiencing mode collapse (i.e., losing the diversity of problem-solving methods) due to penalizing negative samples with completely different problem-solving approaches from positive samples, selects sample pairs... Semantic similarity verification is introduced, along with a semantic gating mechanism. The processor calls a pre-loaded semantic representation model to calculate the positive sample steps. and negative sample steps Text semantic vectors and Then calculate the cosine similarity between the two vectors: Step S6: Construct and calculate the ratio loss function. In this embodiment, based on the selected key bifurcation point dataset, the processor begins training the student model, for each training triplet... The processor constructs a specific contrastive loss function. The purpose of this loss function is to maximize the model's performance given a history. The following generation With generation To prevent probability discrepancies between short texts (such as simple confirmation statements) and long texts (such as detailed logical derivations) due to length differences, this invention introduces a length normalization mechanism. The specific loss calculation logic is as follows: historical context Input the student model and obtain the current hidden state.
[0045] Calculate the conditional log probability of each Token in the positive sample step s+ and the negative sample step s- respectively.
[0046] right Sum the logarithmic probabilities and divide by its length ,right Similarly, the normalized score is obtained.
[0047] Subtract the two fractions and multiply by the temperature coefficient. It is then mapped through the Sigmoid function and finally the negative logarithm is taken.
[0048] Contrast loss function The calculation method is as follows: ,in, As a historical juncture for fathers, For positive sample steps, For negative sample steps, This represents the Sigmoid function. The strategy for representing the target large language model, , s+ and respectively The corresponding word sequence, , For its length, the loss function uses length-normalized log probabilities to eliminate the influence of different length steps on the loss calculation.
[0049] For example, the system only retains those that meet the requirements. The sample pairs are used as the final "critical bifurcation points". Set a semantic threshold (e.g., 0.85). The beneficial effect of this step is to ensure... and They are highly similar in semantic intent (e.g., both attempt to solve problems using algebra), but they differ in execution details (e.g.) In this way, the model only learns how to correct specific execution errors (in case of numerical errors), without rejecting different problem-solving strategies.
[0050] Step S7: Multi-task joint optimization and parameter update.
[0051] In this embodiment, to ensure that the student model does not lose its basic language generation ability and correct path fitting ability while learning error correction capabilities, the present invention adopts a multi-task joint optimization strategy. The processor uses the contrastive loss calculated above. Compared with standard supervision and fine-tuning loss (i.e., for positive samples) The Next TokenPrediction loss is weighted and fused. The total loss function is calculated as follows: in, This is a balancing coefficient (preferably set to 0.5), used to adjust the proportion of contrastive learning in the total gradient. This is an indicator function; its value is 1 when the semantic gating condition is met, and 0 otherwise. The processor calculates using the backpropagation algorithm. Regarding student model parameters The gradient is calculated, and the parameters are updated using an optimizer (such as AdamW). This process is performed iteratively on the training dataset until the model converges.
[0052] Example 3 Combination Figure 4 As shown, in this embodiment, the present invention provides a large language model optimization system based on inference tree bifurcation points and semantic gating, comprising: Inference Tree Generation Module: This module is configured to initialize the teacher model, perform Monte Carlo Tree Search (MCTS) on the target problem, generate a structured inference tree containing successful and failed inference paths, and serialize and store the inference tree in the database; Key bifurcation point identification module: This module is configured to traverse the non-leaf nodes of the reasoning tree to generate candidate sample pairs, and sequentially perform preliminary screening based on result differences and fine-grained filtering based on semantic gating, thereby outputting a high-quality key bifurcation point dataset. Model Training Module: This module is configured to build training batches based on the key bifurcation point dataset and compute a step-level contrastive loss function that includes a length normalization term. And compare this loss with the monitoring and fine-tuning loss. We perform weighted fusion and use the backpropagation algorithm to update the network parameters of the student model.
[0053] During runtime, the aforementioned modules, as logical functional units, are loaded by the processor of the electronic device and execute the computer program instructions in the memory to collaboratively complete the optimization method described in this invention. These modules can be distributed on a single computing node or deployed in a distributed manner across multiple computing nodes (such as GPU clusters) connected via a network to achieve large-scale parallel processing.
[0054] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0055] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for optimizing large language models based on inference tree bifurcation points and semantic gating, characterized in that: The following steps are included: Step S1: Perform system initialization and define a computational model including a teacher model, a student model, and a semantic representation model; Step S2: Input the target problem text to be solved, and construct a reasoning tree based on Monte Carlo tree search using the preset teacher model; Step S3: Traverse the nodes of the inference tree and pair them with candidate samples; Step S4: Perform preliminary screening of sample pairs based on the differences in results; Step S5: Introduce semantic similarity verification for the initially screened sample pairs and use semantic gating mechanism for further filtering; Step S6: Train the student model based on the selected key bifurcation point dataset and construct a contrastive loss function; Step S7: Finally, perform multi-task joint optimization and parameter update.
2. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 1, characterized in that: In step S1: Teacher model: Used to provide the ability to explore reasoning paths and generate raw training data; Student model: Used to improve performance by learning the reasoning logic of the teacher model; Semantic representation model: used to transform text sequences into high-dimensional semantic vectors, providing a foundation for subsequent semantic similarity calculation.
3. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 2, characterized in that: The implementation of step S2 specifically includes: For each target problem text input in the target domain, the processor uses a pre-defined teacher large language model to perform offline reasoning calculations using the Monte Carlo tree search algorithm. This process generates a structured reasoning tree that fully records all exploration paths starting from the initial question, including successful paths leading to the correct answer and failed paths leading to the incorrect answer. Each node in the reasoning tree represents a historical reasoning context, and its set of child nodes represents all possible next reasoning steps starting from that context.
4. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 3, characterized in that: Offline inference calculations using the Monte Carlo tree search algorithm include: The system uses the target problem text to be solved as the root node and generates a structured reasoning tree through a cyclical iteration of four stages: selection, expansion, simulation, and backtracking. During the generation process, the processor outputs content in a structured step-by-step manner by prompting the teacher model to meet engineering constraints; Set a search budget for each reasoning tree to ensure that the reasoning tree contains multiple different paths from the root node to the leaf node. These paths are marked as leaf nodes leading to the correct answer or leaf nodes leading to the wrong answer, depending on the correctness of the final answer. The generated reasoning tree is serialized into structured data and stored in the database. Each node contains a unique identifier, text content, parent node reference, and path result marker.
5. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 4, characterized in that: The node traversal and candidate sample pairing of the inference tree includes: The processor reads the stored inference tree and traverses each non-leaf node in the inference tree. For each node, the system obtains a set of all its direct child nodes. The processor performs permutations or combinations of the child nodes in the set to pair them up and generate a series of candidate sample pairs.
6. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 5, characterized in that: In step S5, semantic similarity verification is introduced for the selected sample pairs. A semantic gating mechanism is introduced, and the preloaded semantic representation model is called by the processor to calculate the text semantic vectors of the positive sample step and the negative sample step respectively, and then the cosine similarity between the two vectors is calculated.
7. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 6, characterized in that: In step S6, constructing the ratio loss function includes: Based on the selected key bifurcation point dataset, the processor trains the student model. For each training triplet, the processor constructs a specific contrastive loss function. The loss function maximizes the log probability difference between the steps of generating positive samples and generating negative samples at a given historical node. A length normalization mechanism is introduced to eliminate the impact of steps of different lengths on loss calculation.
8. The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in claim 7, characterized in that: Multi-task joint optimization and parameter updates include: A multi-task joint optimization strategy is adopted, in which the processor performs a weighted fusion of the calculated contrastive loss and the standard supervised fine-tuning loss to calculate the total loss function; The processor uses the backpropagation algorithm to calculate the gradient of the total loss function with respect to the student model parameters, and uses the optimizer to update the parameters; This process is repeated iteratively on the training dataset until the model converges.
9. An electronic device, characterized in that: The electronic device, serving as the physical carrier for large language model optimization, includes a processor, a memory, and a communication interface at the hardware level. The memory stores a computer program, and the processor is configured to execute the computer program to implement the large language model optimization method based on inference tree bifurcation points and semantic gating as described in any one of claims 1-8.
10. A large language model optimization system based on inference tree bifurcation points and semantic gating, characterized in that, The method for optimizing a large language model based on inference tree bifurcation points and semantic gating as described in any one of claims 1-8 includes: Inference Tree Generation Module: Used to perform Monte Carlo tree search on the target problem, generate a structured inference tree containing successful inference paths and failed inference paths, and serialize and store the inference tree in the database; Key bifurcation point identification module: used to generate candidate sample pairs, and sequentially perform preliminary screening based on result differences and semantic gating filtering, outputting a key bifurcation point dataset; Model training module: used to calculate the step-level contrastive loss function including a length normalization term, and to weight and fuse this loss with the supervised fine-tuning loss, and to update the network parameters of the student model using the backpropagation algorithm.