CN-121996788-A - Inference enhanced text classification method and system integrating large language model
Abstract
The invention relates to the technical field of text classification, and particularly discloses a method and a system for reasoning and enhancing text classification by fusing a large language model, wherein the method comprises the steps of generating chain type reasoning data comprising a gradual reasoning process from input text to classification labels for training samples of text classification tasks by utilizing the large language model; and for the text to be classified, generating a plurality of reasoning paths by using the text classification model after the fine adjustment, obtaining a final classification label by a majority voting mechanism based on classification results output by each reasoning path, and effectively improving the multi-step reasoning capacity and classification stability of the model by using mechanisms such as high-quality reasoning chain generation, lightweight fine adjustment based on the reasoning chain, multi-path consistency majority voting and the like, thereby overcoming the technical bottleneck of inconsistent reasoning blind points and results in the prior art.
Inventors
- HAN XIAOSONG
- DAI XINDI
- CHEN KE
- WANG HAO
- LIU YONGHAO
- FENG XIAOYUE
- GUAN RENCHU
Assignees
- 吉林大学
Dates
- Publication Date
- 20260508
- Application Date
- 20251013
Claims (7)
- 1. An inference enhanced text classification method fused with a large language model, the method comprising: generating chain type reasoning data comprising a gradual reasoning process from input text to classification labels for training samples of the text classification task by using a large language model; Based on the chained reasoning data, performing fine adjustment on the target large language model by adopting a LoRA-based lightweight fine adjustment method to obtain a text classification model; and for the text to be classified, generating a plurality of reasoning paths by utilizing the text classification model after fine adjustment, and obtaining a final classification label through a majority voting mechanism based on classification results output by all the reasoning paths.
- 2. The method for enhanced text classification by inference in combination with large language model according to claim 1, wherein the step of generating the chain type inference data comprising a stepwise inference process from the input text to the classification tag for the training sample of the text classification task by using the large language model specifically comprises: in response to receiving the training samples and correct labels thereof, adjusting the generation parameters of the large language model, and generating a plurality of diversified chained inference paths for a single training sample; performing quality screening on the generated chain type reasoning path, wherein the quality screening comprises logic consistency checking and/or label correctness checking; the chain type reasoning path passing through the quality screening is converted into a structured training data format, and chain type reasoning data comprising a gradual reasoning process from the input text to the classification labels is generated.
- 3. The method for inference enhanced text classification in combination with a large language model of claim 2, wherein the generation parameter comprises a sampling temperature.
- 4. The method for inference enhanced text classification in combination with a large language model of claim 2, the method is characterized in that the structured training data format is Alpaca format.
- 5. The method for classifying the inference enhanced text by fusing large language models according to claim 1, wherein the step of generating a plurality of inference paths for the text to be classified by using the text classification model after fine tuning, and obtaining a final classification label by a majority voting mechanism based on classification results output by each inference path specifically comprises: Using a preset chain type reasoning prompt template to guide the text classification model to generate K reasoning paths for the text to be classified, wherein K is an integer greater than 1; Analyzing each reasoning path and extracting a corresponding classification label; counting the occurrence frequency of each classified label, and taking the label with the highest frequency as the final classified label.
- 6. The method for inference enhanced text classification in accordance with claim 5 wherein said K inference paths are obtained by adjusting the generation parameters of said text classification model.
- 7. An inference-enhanced text classification system incorporating a large language model for implementing the inference-enhanced text classification method incorporating a large language model as set forth in any one of claims 1 to 6, the system comprising: the data set construction module is used for generating chain type reasoning data comprising a gradual reasoning process from input text to classification labels for training samples of the text classification task by using the large language model; The fine tuning module is used for fine tuning the target large language model by adopting a LoRA-based lightweight fine tuning method based on the chained inference data to obtain a text classification model; And the classification module is used for generating a plurality of reasoning paths for the text to be classified by utilizing the text classification model after fine adjustment, and obtaining a final classification label through a majority voting mechanism based on classification results output by all the reasoning paths.
Description
Inference enhanced text classification method and system integrating large language model Technical Field The invention relates to the technical field of text classification, in particular to an inference enhanced text classification method and system integrating a large language model. Background Text classification is one of the core tasks in natural language processing, and aims to assign the input text content to predefined categories according to the input text content, so that the text classification is widely applied to scenes such as news aggregation, public opinion analysis, medical document retrieval, legal document classification and the like. With the development of deep learning and pre-training technologies, the method gradually evolves from shallow models such as CNN, LSTM and the like to pre-training language models (such as BERT, roBERTa) based on a transducer, and then to Large Language Models (LLM) represented by GPT, LLaMA and the like. While LLM performs well in language understanding and generation, a "direct mapping" paradigm, i.e., one-step prediction from input to labels, is often employed in text classification tasks. This approach relies on implicit semantic representation of the model, which tends to skip necessary reasoning steps in complex scenarios, resulting in performance instability. In tasks requiring multi-step logic or causal reasoning, the model needs to build logical relationships across multiple semantic segments. For example, when an evaluation includes both positive and negative evaluations, matching by keywords alone may misjudge the overall emotion, subject switching exists in multiple paragraphs, accurate judgment can be made by integrating information across the paragraphs, and multiple evidences need to be integrated for distinguishing different pathological states under the same disease. The existing enhanced reasoning method is mainly Chain-of-thoughts (CoT), and is effective in tasks such as mathematical reasoning and the like by guiding and generating a reasoning Chain through a prompt model 'gradually thinking'. But applied directly in text classification, the inference chain quality is unstable and lacks targeted fine tuning. Disclosure of Invention The invention aims to provide an inference enhanced text classification method and system integrating a large language model, so as to solve the problems in the background technology. In order to achieve the above purpose, the present invention provides the following technical solutions: an inference enhanced text classification method fusing large language models, the method comprising: generating chain type reasoning data comprising a gradual reasoning process from input text to classification labels for training samples of the text classification task by using a large language model; Based on the chained reasoning data, performing fine adjustment on the target large language model by adopting a LoRA-based lightweight fine adjustment method to obtain a text classification model; and for the text to be classified, generating a plurality of reasoning paths by utilizing the text classification model after fine adjustment, and obtaining a final classification label through a majority voting mechanism based on classification results output by all the reasoning paths. As a further aspect of the present invention, the step of generating the chain type reasoning data including a stepwise reasoning process from the input text to the classification label for the training sample of the text classification task using the large language model specifically includes: in response to receiving the training samples and correct labels thereof, adjusting the generation parameters of the large language model, and generating a plurality of diversified chained inference paths for a single training sample; performing quality screening on the generated chain type reasoning path, wherein the quality screening comprises logic consistency checking and/or label correctness checking; the chain type reasoning path passing through the quality screening is converted into a structured training data format, and chain type reasoning data comprising a gradual reasoning process from the input text to the classification labels is generated. As a further aspect of the present invention, the generation parameter includes a sampling temperature. As a further aspect of the present invention, the structured training data format is Alpaca format. As a further scheme of the invention, the steps of generating a plurality of reasoning paths by utilizing the text classification model after fine adjustment for the text to be classified, and obtaining a final classification label by a majority voting mechanism based on classification results output by all the reasoning paths specifically comprise: Using a preset chain type reasoning prompt template to guide the text classification model to generate K reasoning paths for the text to be classified, wherein K i