Method and apparatus for extracting legal terms and conditions of open source software licenses

By employing knowledge distillation techniques from large-scale language models and soft-label training with multi-teacher models, the efficiency and accuracy issues in open-source software license compliance review are addressed. This enables the efficient and accurate extraction and structured output of legal clause information, supporting the execution of automated compliance processes.

CN120952011BActive Publication Date: 2026-01-30BEIJING LINX SOFTWARE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511483815.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-01-30
Estimated Expiration
2045-10-17

AI Technical Summary

Technical Problem

In existing technologies, compliance reviews of open-source software licenses are inefficient and inconsistent, and cannot effectively automate the accurate extraction of legal clause information.

Method used

A legal clause information extraction model is trained using knowledge distillation technology based on a large language model. The model is trained by obtaining the license text of open source software licenses and using a pre-set Prompt template and soft labels from a multi-teacher model. The model is then optimized by combining the loss function of hard labels and soft labels to achieve accurate extraction of legal clauses.

Benefits of technology

It improves the accuracy and completeness of extracting legal terms and conditions from open-source software licenses, enhances the generalization ability of the model, supports structured output, and facilitates the integration and execution of automated compliance processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120952011B_ABST
    Figure CN120952011B_ABST
Patent Text Reader

Abstract

This invention relates to a method and apparatus for extracting legal terms information from open-source software licenses, belonging to the field of computer technology. The method includes: obtaining the license text of an open-source software license containing complete semantic information related to the terms; inputting the license text into a pre-trained legal terms information extraction model, and outputting the legal terms information of the open-source software license; wherein the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for knowledge distillation training includes soft labels output by inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model. The method and apparatus for extracting legal terms information from open-source software licenses provided by this invention improve the accuracy and completeness of software license legal terms extraction and enhance generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for extracting legal terms information from open-source software licenses. Background Technology

[0002] In the modern software development industry, open-source software plays a crucial role. To accelerate development, reduce R&D costs, and leverage the collective wisdom of the community, both enterprise and individual developers widely use open-source components in their software projects. However, every open-source component comes with a legally binding license. These licenses are not simply authorization statements, but rather stipulate a series of conditions that users must adhere to, covering aspects such as software copying, distribution, modification, commercial use, and patent licensing.

[0003] If software developers or companies fail to comply with the license provisions when using open-source components, it may lead to serious legal risks, including but not limited to: being forced to disclose the source code of their own products, losing intellectual property rights to the software, facing infringement lawsuits and hefty compensation claims. Therefore, conducting accurate compliance reviews of the licenses of all open-source components in a project is an indispensable part of the software development lifecycle.

[0004] As software projects grow increasingly large and software supply chains become more complex, a large software project may rely on hundreds or even thousands of open-source components, involving dozens of different types of licenses. Traditional compliance review methods primarily rely on legal personnel or developers to manually read and interpret these components, which has the following inherent drawbacks:

[0005] Inefficient: Reading and understanding legal texts line by line is an extremely time-consuming and laborious task.

[0006] Poor consistency: Different people may have different understandings of the same clause, leading to inconsistent review standards.

[0007] Therefore, providing an automated method for extracting legal terms information from open-source software licenses to accurately extract such information has become an urgent problem to be solved. Summary of the Invention

[0008] Based on the above analysis, the embodiments of the present invention aim to provide a method and apparatus for extracting legal terms information of open source software licenses, thereby solving the problem of the lack of an automated method for accurately extracting legal terms information of open source software licenses.

[0009] On one hand, embodiments of the present invention provide a method for extracting legal terms information from open-source software licenses. The method includes: obtaining a license text containing complete semantic information related to the terms of the open-source software license; inputting the license text into a pre-trained legal terms information extraction model, and outputting the legal terms information of the open-source software license; wherein the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model.

[0010] The beneficial effects of the above technical solution are as follows: by obtaining the license text containing complete semantic information related to the terms of the open source software license, inputting the license text into the legal terms information extraction model trained by knowledge distillation based on a large language model, and outputting the legal terms information of the open source software license, the accuracy and completeness of the extraction of legal terms of the software license are improved, and the generalization ability is enhanced.

[0011] A further improvement to the above method is that, before inputting the license text into the legal clause information extraction model trained by knowledge distillation based on a large language model, the method further includes: training the legal clause information extraction model by knowledge distillation based on a large language model.

[0012] The beneficial effect of the above-mentioned further improvement scheme is that by pre-training the legal clause information extraction model based on a large-scale language model through knowledge distillation, the realization of extracting legal clause information using the legal clause information extraction model is guaranteed.

[0013] A further improvement to the above method involves training the legal clause information extraction model using knowledge distillation based on a large-scale language model. This includes: labeling the clause information of open-source software license training samples to obtain hard labels; wherein the hard labels include a set of Boolean labels indicating whether different types of legal clauses appear in the open-source software license training samples; inputting the open-source software license training samples and a preset Prompt template into at least one teacher model based on a large-scale language model, and integrating the outputs of the at least one teacher model to obtain soft labels; wherein the soft labels include a first prediction result of the at least one teacher model for the extraction and classification of legal clauses in the open-source software license training samples; inputting the open-source software license training samples, the Prompt template, the hard labels, and the soft labels into a student model based on a large-scale language model to obtain a second prediction result of the student model for the extraction and classification of legal clauses in the open-source software license training samples, and training the model using a first loss function based on the second prediction result to obtain the legal clause information extraction model.

[0014] The beneficial effects of the above-mentioned further improvement scheme are: by combining "hard constraints" and "soft guidance", the flexibility of training the legal clause information extraction model and the accuracy of model prediction are improved.

[0015] Based on a further improvement of the above method, the first loss function is a weighted sum of hard label loss and soft label loss; wherein, the hard label loss represents the degree of closeness between the second prediction result and the hard label, and the soft label loss represents the degree of closeness between the second prediction result and the first prediction result.

[0016] The beneficial effects of the above-mentioned further improvement scheme are: by training the model using a combination loss constructed from hard label loss and soft label loss, the accuracy and generalization ability of the legal clause information extraction model for extracting clause information are improved.

[0017] A further improvement to the above method involves training the legal clause information extraction model using knowledge distillation based on a large language model. This includes: inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model; integrating the outputs of the at least one teacher model to obtain soft labels; wherein the soft labels include a first prediction result from the at least one teacher model for the extraction and classification of legal clauses in the open-source software license training samples; inputting the open-source software license training samples, the Prompt template, and the soft labels into a student model based on a large language model to obtain a third prediction result from the student model for the extraction and classification of legal clauses in the open-source software license training samples; and training the model using a second loss function based on the third prediction result to obtain the legal clause information extraction model.

[0018] The beneficial effects of the above-mentioned further improvement scheme are: it realizes the knowledge distillation training of the legal clause information extraction model using only soft labels, and on the basis of simplification, it ensures the accuracy and generalization ability of the legal clause information extraction model in extracting legal clause information.

[0019] Based on a further improvement of the above method, the second loss function represents the degree of similarity between the third prediction result and the first prediction result.

[0020] The beneficial effects of the above-mentioned further improvement scheme are: by setting a second loss function to represent the degree of similarity between the third prediction result and the first prediction result, the learning ability of the student model to the reasoning process of the teacher model is improved, and the accuracy and generalization ability of the legal clause information extraction model in extracting legal clause information are further improved.

[0021] Based on a further improvement of the above method, the Prompt template includes task description information, a legal clause classification system, and output format constraint information; wherein, the task description information is used to limit the content of the legal clause information output by the teacher model and the student model, and the output format constraint information is used to limit the teacher model and the student model to output the legal clause information in a preset structured format based on the legal clause classification system.

[0022] The beneficial effects of the above-mentioned further improvement scheme are as follows: By setting the Prompt template to include task description information, legal clause classification system, and output format constraint information, the task description information is used to limit the content of legal clause information output by the teacher model and student model, and the output format constraint information is used to limit the teacher model and student model to output legal clause information in a preset structured format based on the legal clause classification system. This improves the accuracy and robustness of classification. The output results directly correspond to the core requirements of compliance review, are more intuitive and easy to understand, facilitate downstream system integration and human interpretation, and the generated results can be directly read and parsed by machines, seamlessly integrated into various automated compliance processes, and realize advanced functions such as automatic risk warning and automatic generation of compliance reports, which greatly enhances the capability and efficiency of automated compliance processes.

[0023] Based on a further improvement of the above method, the legal clause information includes the prediction results of the extraction and classification of legal clauses in the open-source software license training sample; the step of integrating the outputs of the at least one teacher model to obtain soft labels includes: performing voting processing or weighted average processing on the prediction results of the at least one teacher model for the extraction and classification of legal clauses in the open-source software license training sample to obtain the first prediction result; and obtaining the soft labels based on the first prediction result.

[0024] The beneficial effects of the above-mentioned further improvement scheme are: when predicting the results of extracting and classifying legal clauses in the training samples of open source software licenses, the determination of soft labels under the multi-teacher model architecture is realized, thus improving the accuracy of soft labels under the multi-teacher model architecture.

[0025] Based on a further improvement of the above method, the legal clause information includes the prediction results of the extraction and classification of legal clauses in the open-source software license training sample, the judgment basis of the prediction results, and the clause interpretation information; the step of integrating the outputs of the at least one teacher model to obtain soft labels includes: performing voting processing or weighted average processing on the prediction results of the at least one teacher model for the extraction and classification of legal clauses in the open-source software license training sample to obtain the first prediction result; integrating the judgment basis and clause interpretation information of the prediction results of the at least one teacher model that are consistent with the first prediction result to obtain the integrated result of the judgment basis and clause interpretation information; and obtaining the soft label based on the integrated result of the first prediction result and the judgment basis and clause interpretation information.

[0026] The beneficial effects of the above-mentioned further improvement scheme are: it realizes the determination of soft labels under the multi-teacher model architecture when the legal clause information includes the prediction results of the extraction and classification of legal clauses in the training samples of open source software licenses, as well as the judgment basis of the prediction results and the clause interpretation information, thereby improving the accuracy of soft labels under the multi-teacher model architecture.

[0027] On the other hand, embodiments of the present invention provide an open-source software license legal terms information extraction device, the device comprising: an acquisition module, configured to: acquire the license text of the open-source software license containing complete semantic information related to the terms; and an output module, configured to: input the license text into a pre-trained legal terms information extraction model, and output the legal terms information of the open-source software license; wherein the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model.

[0028] The open-source software license legal terms information extraction device provided by this invention obtains the license text containing complete semantic information related to the terms of the open-source software license, inputs the license text into the legal terms information extraction model trained by knowledge distillation based on a large language model, and outputs the legal terms information of the open-source software license, thereby improving the accuracy and completeness of software license legal terms extraction and enhancing generalization ability.

[0029] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, implements the open-source software license legal terms information extraction method as described above.

[0030] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the open-source software license legal terms information extraction method as described above.

[0031] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the open-source software license legal terms information extraction method as described above.

[0032] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0033] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0034] Figure 1 This is one of the flowcharts illustrating the method for extracting legal terms and conditions of open-source software licenses provided by this invention;

[0035] Figure 2 This is the second flowchart illustrating the method for extracting legal terms and conditions from open-source software licenses provided by this invention.

[0036] Figure 3 This is a schematic diagram of the open-source software license legal terms information extraction device provided by the present invention;

[0037] Figure 4 A schematic diagram of the physical structure of an electronic device is provided. Detailed Implementation

[0038] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0039] One method to automate the extraction of legal terms and conditions from licenses is to utilize NLP (Natural Language Processing) technology to automate the analysis of license text. This can be achieved through a pipelined processing flow: "text preprocessing -> deep learning model (such as Bi-LSTM) for sequence labeling or classification -> subsequent rule or model attribute determination."

[0040] To accommodate the Bi-LSTM and other models used, the aforementioned methods typically require pre-segmenting the complete license text into independent sentences. However, legal texts are semantically rigorous; a complete right, obligation, or prohibition clause often has its full definition, conditions, and exceptions distributed across multiple consecutive sentences or paragraphs. Therefore, this mandatory sentence segmentation severs the semantic connections within the clause, causing the model to lose crucial contextual information when analyzing individual sentences (e.g., the preceding sentence grants a right, and the following sentence immediately explains the preconditions for exercising that right). This lack of context directly leads to incorrect judgments about the nature and boundaries of the clause by the model, resulting in inaccurate output.

[0041] Furthermore, the performance of traditional deep learning models such as Bi-LSTM and ALBERT used in the above methods is highly dependent on the specific words, sentence structures, and expressions that appear in the training data. Therefore, when they encounter obscure licenses with novel expressions not covered in the training set, or updated versions of existing licenses, their recognition accuracy will drop significantly due to the lack of corresponding "pattern memory." This over-reliance on known patterns limits the applicability of automated tools and their sustainability in dynamic environments, resulting in insufficient generalization ability.

[0042] Figure 1 This is one of the flowcharts illustrating the method for extracting legal terms and conditions from open-source software licenses provided by this invention. For example... Figure 1 As shown, the method includes:

[0043] Step S1: Obtain the license text of the open source software license, which contains complete terms and semantic information.

[0044] This invention aims to provide a method for extracting clause information capable of handling long texts and understanding global context. By leveraging the powerful long text understanding capabilities of LLM (Large Language Model), this invention can directly perform end-to-end analysis of complete license texts, avoiding information loss caused by sentence segmentation. This allows the model to comprehensively consider semantic dependencies across sentences, thereby more accurately identifying and defining complete legal clauses, significantly improving the completeness and accuracy of clause identification. This invention also aims to enhance the model's generalization ability for unknown license texts through knowledge distillation techniques.

[0045] However, it's understandable that large language models may have limitations in terms of input text size, given their processing capabilities. In such cases, the license text can be segmented, and the context information of each segment can be recorded. This context information, along with the segmented license text, can then be input into the large language model. In this way, the semantic information of the complete license text can still be obtained by the large language model. A Retrieval-Augmented Generation (RAG) mechanism can be used to segment the full text and store it in quantized form. The model dynamically retrieves and incorporates semantic vectors from the relevant context when processing the current block, maintaining global consistency. Furthermore, to improve processing efficiency, only key paragraphs can be analyzed. Rules / small models can be used to first identify paragraphs that may contain clauses (such as sentences containing "shall" or "must"), and then only these key paragraphs can be analyzed in depth.

[0046] Step S2: Input the license text into a pre-trained legal terms information extraction model and output the legal terms information of the open source software license; wherein, the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open source software license training samples and preset Prompt templates into at least one teacher model based on a large language model.

[0047] The legal clause information extraction model is trained using knowledge distillation on a student model based on a large language model. The training data for knowledge distillation includes soft labels output by at least one teacher model based on a large language model, which is then fed with open-source software license training samples and a pre-defined Prompt template. This invention enhances the model's generalization ability to unknown license texts through knowledge distillation. By inputting the license text into the pre-trained legal clause information extraction model, the model outputs the legal clause information of the open-source software license. Even when faced with novel expressions not seen during training, the legal clause information extraction model can make reasonable judgments based on its deeper semantic understanding, effectively covering less common and novel licenses and expanding the breadth of automated analysis.

[0048] The method for extracting legal terms information from open-source software licenses provided by this invention obtains the license text containing complete semantic information related to the terms of the open-source software license, inputs the license text into a legal terms information extraction model trained by knowledge distillation based on a large language model, and outputs the legal terms information of the open-source software license. This improves the accuracy and completeness of extracting legal terms from software licenses and enhances the generalization ability.

[0049] According to the present invention, a method for extracting legal terms information from an open-source software license, before inputting the license text into a legal terms information extraction model trained by knowledge distillation based on a large language model, the method further includes: training the legal terms information extraction model by knowledge distillation based on a large language model.

[0050] Before inputting the license text into the legal clause information extraction model trained by knowledge distillation based on a large language model, it is necessary to first train the legal clause information extraction model by knowledge distillation based on the large language model.

[0051] The open-source software license legal terms information extraction method provided by this invention obtains a legal terms information extraction model in advance by training it through knowledge distillation based on a large language model, thus ensuring the realization of legal terms information extraction using the legal terms information extraction model.

[0052] According to a method for extracting legal terms information from open-source software licenses provided by the present invention, the method for obtaining the legal terms information extraction model by knowledge distillation training based on a large language model includes: labeling the terms information of open-source software license training samples to obtain hard labels; wherein the hard labels include a set of Boolean labels indicating whether different types of legal terms appear in the open-source software license training samples; inputting the open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model, and integrating the outputs of the at least one teacher model to obtain soft labels; wherein the soft labels include a first prediction result of the at least one teacher model for the extraction and classification of legal terms in the open-source software license training samples; inputting the open-source software license training samples, the Prompt template, the hard labels, and the soft labels into a student model based on a large language model to obtain a second prediction result of the student model for the extraction and classification of legal terms in the open-source software license training samples, and training the legal terms information extraction model based on the second prediction result using a first loss function.

[0053] In this embodiment, a legal clause information extraction model is trained based on both hard and soft labels.

[0054] This invention constructs a high-quality labeled dataset and employs a knowledge distillation strategy combining hard constraints and soft guidance to train a lightweight language model specifically designed for open-source license analysis. This model can automatically and accurately extract structured key clause information from complex license texts, thereby addressing the efficiency and accuracy bottlenecks of traditional manual review.

[0055] Hard labels are obtained by annotating the terms and conditions of open-source software license training samples. These hard labels consist of a set of Boolean labels indicating whether different types of legal terms appear in the training samples. Based on the industry-recognized SPDX (Software Package Data Exchange) license list, the complete legal texts of mainstream and common open-source licenses can be systematically collected and organized to obtain the original license texts for training. These texts are then meticulously manually annotated according to a predetermined classification framework, forming a structured dataset containing "hard labels."

[0056] An expert team with legal and software engineering backgrounds was organized to annotate each license text using the classification framework provided on choosealicense.com. This annotation is a Boolean (True / False) value, specifically determining whether the license contains the following sub-terms:

[0057] Must-haves include: such as Disclose source, License and copyright notice, Same license, and State changes.

[0058] Authorization (Can): such as Commercial use, Distribution, Modification, Patent use, etc.

[0059] Cannot include clauses such as Liability, Trademark use, and explicit denial of licensing clauses.

[0060] The above information is integrated into a structured dataset. Each data record contains: {the original license text, a set of Boolean labels for obligations, a set of Boolean labels for authorization, and a set of Boolean labels for prohibitions}.

[0061] By inputting open-source software license training samples and a pre-defined Prompt template into at least one teacher model based on a large language model, and integrating the outputs of at least one teacher model, soft labels are obtained; wherein, the soft labels include the first prediction results of at least one teacher model for the extraction and classification of legal clauses in the open-source software license training samples.

[0062] A powerful teacher model is used to generate "soft tags" for knowledge distillation. A top-performing large language model (e.g., Qwen3-235B-A22B-Thinking-2507, DeepSeek-R1, etc.) can be selected as the teacher model. A standardized instruction template is designed. Training samples of open-source software licenses and the pre-defined prompt template are input into at least one teacher model based on the large language model. The outputs of at least one teacher model are integrated to obtain the soft tags. There can be one or more teacher models. The teacher model not only outputs a structured result, but its powerful language capabilities also imply a deep semantic understanding and reasoning process of the legal text. These outputs generated by the teacher model, rich in contextual information, are called "soft tags." These soft tags may be richer than human Boolean tags, reflecting how the model "thinks" and "associates" text content with clause types.

[0063] A smaller, faster, and easier-to-deploy open-source language model can be chosen as the student model, such as Qwen / Qwen3-8B or Meta-Llama-3-8B. Knowledge distillation training is performed based on a "hard constraint-soft guidance" strategy, aiming to transfer the "knowledge" of the teacher model to a smaller, more efficient student model. The open-source software license training samples, Prompt templates, hard labels, and soft labels are input into the student model based on the large-scale language model. This yields a second prediction result for the student model's extraction and classification of legal clauses from the open-source software license training samples. Based on this second prediction result, a first loss function is used for training, resulting in a legal clause information extraction model. This legal clause information extraction model is a "distilled dedicated LLM model" for clause information extraction.

[0064] This invention utilizes a large, knowledgeable "teacher model" to generate deep semantic understanding information from a wide range of license texts, which is then used to guide a lightweight "student model" in learning. This allows the student model to not only memorize the specific rules in the labeled data but also learn the reasoning and generalization abilities of the teacher model. Furthermore, the teacher model can also employ the student model, that is, using the outputs of the same student model at different training stages as soft labels to iteratively optimize its performance.

[0065] The present invention provides a method for extracting legal terms information from open-source software licenses. This method involves labeling the terms information of open-source software license training samples to obtain hard labels, which include a set of Boolean labels indicating whether different types of legal terms appear in the original license text. The open-source software license training samples and a pre-defined Prompt template are input into at least one teacher model based on a large language model. The outputs of the at least one teacher model are integrated to obtain soft labels, which include a first prediction result from the at least one teacher model regarding the extraction and classification of legal terms in the open-source software license training samples. The open-source software license training samples, the Prompt template, the hard labels, and the soft labels are input into a student model based on a large language model to obtain a second prediction result from the student model regarding the extraction and classification of legal terms in the open-source software license training samples. Based on the second prediction result, a first loss function is used for training to obtain a legal terms information extraction model. This combination of "hard constraints" and "soft guidance" improves the flexibility of training the legal terms information extraction model and the accuracy of model prediction.

[0066] According to the method for extracting legal terms information of open source software licenses provided by the present invention, the first loss function is a weighted sum of hard label loss and soft label loss; wherein, the hard label loss represents the degree of closeness between the second prediction result and the hard label, and the soft label loss represents the degree of closeness between the second prediction result and the first prediction result.

[0067] When training student models, the optimization objective (i.e., the loss function) is composed of two weighted parts to achieve a combination of "hard constraints" and "soft guidance".

[0068] Define the hard constraint loss: This part involves forced learning. The student model's predictions are compared to manually labeled "hard labels." For example, for the term "Commercial use," if the student model predicts True while the hard label is False, a large loss is incurred. The hard label loss represents how close the second prediction is to the hard label; a larger loss indicates a less close match. This can be achieved using the standard cross-entropy loss function. This loss term ensures that the student model must learn to accurately match the explicitly labeled rules; it is called L_hard.

[0069] Define soft-guided loss: This part represents guided learning, requiring not only that the student model's final output is correct, but also that it learns the "thinking method" of the teacher model. Specifically, the probability distribution predicted by the student model can be fitted to the probability distribution corresponding to the "soft labels" generated by the teacher model. The soft label loss represents the closeness between the second and first predictions; a larger loss indicates a less close match. This can be achieved by calculating the Kullback-Leibler divergence between the two. This loss term guides the student model to mimic the teacher model's reasoning ability when dealing with fuzzy, complex, or unseen representations; it is called L_soft.

[0070] Training with a weighted combined loss function: the final total loss function L total It is the weighted sum of the two losses mentioned above:

[0071] ,

[0072] Among them, L total Let L represent the first loss function. hard L represents the hard-label loss. soft Let α represent the soft label loss, α represent the weight of the hard label loss, and β represent the weight of the soft label loss.

[0073] α and β are hyperparameters used to balance the importance of hard rule learning and soft knowledge transfer. By using this combined loss function on the constructed dataset, the student model is supervised fine-tuned, resulting in a lightweight, specialized model that is both accurate and generalizable.

[0074] The open-source software license legal terms information extraction method provided by this invention sets the first loss function as a weighted sum of hard label loss and soft label loss. The hard label loss represents the degree of closeness between the second prediction result and the hard label, and the soft label loss represents the degree of closeness between the second prediction result and the first prediction result. The model is trained by using the combined loss constructed from the hard label loss and the soft label loss, which improves the accuracy and generalization ability of the legal terms information extraction model for extracting terms information.

[0075] According to a method for extracting legal terms information from open-source software licenses provided by the present invention, the method for obtaining the legal terms information extraction model by knowledge distillation training based on a large language model includes: inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model, integrating the outputs of the at least one teacher model to obtain soft labels; wherein, the soft labels include a first prediction result of the at least one teacher model for the extraction and classification of legal terms in the open-source software license training samples; inputting the open-source software license training samples, the Prompt template, and the soft labels into a student model based on a large language model to obtain a third prediction result of the student model for the extraction and classification of legal terms in the open-source software license training samples, and training the legal terms information extraction model based on the third prediction result using a second loss function.

[0076] Knowledge distillation training can be performed using only soft labels, relying entirely on soft labels generated by the teacher model to train the student model, without mixing in artificial hard labels.

[0077] By inputting open-source software license training samples and a pre-defined Prompt template into at least one teacher model based on a large language model, and integrating the outputs of at least one teacher model, soft labels are obtained; wherein, the soft labels include the first prediction results of at least one teacher model for the extraction and classification of legal clauses in the open-source software license training samples.

[0078] A powerful teacher model is used to generate "soft tags" for knowledge distillation. A top-performing large language model (e.g., Qwen3-235B-A22B-Thinking-2507, DeepSeek-R1, etc.) can be selected as the teacher model. A standardized instruction template is designed. Training samples of open-source software licenses and the pre-defined prompt template are input into at least one teacher model based on the large language model. The outputs of at least one teacher model are integrated to obtain the soft tags. There can be one or more teacher models. The teacher model not only outputs a structured result, but its powerful language capabilities also imply a deep semantic understanding and reasoning process of the legal text. These outputs generated by the teacher model, rich in contextual information, are called "soft tags." These soft tags may be richer than human Boolean tags, reflecting how the model "thinks" and "associates" text content with clause types.

[0079] A smaller, faster, and easier-to-deploy open-source language model can be chosen as the student model, such as Qwen / Qwen3-8B or Meta-Llama-3-8B. Knowledge distillation training is performed based on a "hard constraint-soft guidance" strategy, aiming to transfer the "knowledge" of the teacher model to a smaller, more efficient student model. The open-source software license training samples, Prompt templates, and soft labels are input into the student model based on the large-scale language model. This yields a third prediction result for the student model's extraction and classification of legal clauses from the open-source software license training samples. Based on this third prediction result, a second loss function is used for training to obtain the legal clause information extraction model.

[0080] Alternatively, the teacher model can also use the student model, that is, use the output of the same student model at different training stages as soft labels to iteratively optimize its own performance.

[0081] The present invention provides a method for extracting legal terms information from open-source software licenses. This method involves inputting open-source software license training samples and a pre-defined Prompt template into at least one teacher model based on a large language model. The outputs of the teacher models are then integrated to obtain soft labels. These soft labels include a first prediction result from the teacher model regarding the extraction and classification of legal terms from the open-source software license training samples. The open-source software license training samples, the Prompt template, and the soft labels are then input into a student model based on the large language model to obtain a third prediction result. Based on this third prediction result, a second loss function is used for training to obtain a legal terms information extraction model. This method achieves knowledge distillation training of the legal terms information extraction model using only soft labels, ensuring the accuracy and generalization ability of the legal terms information extraction model while simplifying the solution.

[0082] According to the method for extracting legal terms information of open-source software licenses provided by the present invention, the second loss function represents the degree of similarity between the third prediction result and the first prediction result.

[0083] When using only soft labels for knowledge distillation training, only soft-guided loss is considered. This part is guided learning, which not only requires the student model's final output to be correct, but also aims to have it learn the "thinking method" of the teacher model. Specifically, the probability distribution predicted by the student model can be fitted to the probability distribution corresponding to the "soft labels" generated by the teacher model. The soft-label loss represents the closeness between the third prediction and the first prediction; a larger loss indicates a less close match, which can be achieved by calculating the Kullback-Leibler divergence between the two. This loss term guides the student model to mimic the teacher model's reasoning ability when dealing with fuzzy, complex, or unseen representations.

[0084] The open-source software license legal terms information extraction method provided by this invention improves the learning ability of the student model for the reasoning process of the teacher model by setting a second loss function to represent the closeness between the third prediction result and the first prediction result, and further improves the accuracy and generalization ability of the legal terms information extraction model in extracting legal terms information.

[0085] According to the present invention, a method for extracting legal terms information of open-source software licenses is provided. The Prompt template includes task description information, a legal terms classification system, and output format constraint information. The task description information is used to limit the content of the legal terms information output by the teacher model and the student model, and the output format constraint information is used to limit the teacher model and the student model to output the legal terms information in a preset structured format based on the legal terms classification system.

[0086] The Prompt template clearly defines the task description information, the legal clause classification system, and the output format constraints.

[0087] For example, a Prompt template can contain the following:

[0088] Role-playing: "You are a professional software intellectual property lawyer, and your task is to analyze a given open-source license text."

[0089] Legal clause classification system definition: Defines obligations, authorizations, prohibitions and their sub-clauses.

[0090] Task Description: "Based on the following legal clause classification system, extract all relevant obligations, authorizations, and prohibitions from the text, and provide the specific names and meanings of each type of clause and its subclasses."

[0091] Output format constraints: The model is required to output results in a predefined structured format (such as JSON format) according to the output paradigm.

[0092] The output examples include clause extraction results categorized into three legal effect categories: "Must," "Can," and "Cannot," and include fine-grained sub-clause tags such as "disclose_source" and "commercial_use." By combining the "legal clause classification system definition" with the "structured output format," the analysis results are both consistent with legal logic and intuition, and can be seamlessly integrated into downstream automated tools.

[0093] In addition, when outputting results in a preset structured format, other machine-readable formats such as XML / YAML / CSV / RST can also be used to adapt to the parsing needs of different downstream systems.

[0094] When using the legal clause information extraction model to extract legal clause information, the user or system inputs the open-source license text to be analyzed into the distilled dedicated LLM model. The dedicated model quickly analyzes the text and outputs structured clause information in a preset JSON format, clearly listing the obligations, authorizations, and prohibitions contained in the license.

[0095] This invention establishes a more robust and logically sound framework for classifying legal clauses. It innovatively proposes a three-tiered legal validity classification system based on "obligation-authorization-prohibition," and trains an LLM (Limited Language Management System) to directly understand the legal connotations of texts, categorizing them into these three main categories and their corresponding subcategories. The technical advantages are that it eliminates the fragile reliance on specific keywords, enables the understanding of more complex semantic expressions, and improves the accuracy and robustness of classification. Furthermore, its output directly addresses the core requirements of compliance review, making it more intuitive and easier to understand, facilitating downstream system integration and human interpretation.

[0096] Furthermore, this invention provides a clause extraction method capable of outputting fine-grained, standardized, and structured results. Through a carefully designed Prompt template and training objective, this invention forces the model to output in a unified structured format (such as JSON). This output not only clearly distinguishes between three main categories: "obligations," "authorizations," and "prohibitions," but also further annotates specific sub-clauses such as "disclose_source" (disclosure of source code) and "commercial_use" (commercial use). The technical advantage is that the generated results can be directly read and parsed by machines, seamlessly integrated into various automated compliance processes, and enables advanced functions such as automatic risk alerts and automatic compliance report generation, greatly enhancing the capability and efficiency of automated compliance processes.

[0097] The open-source software license legal terms information extraction method provided by this invention improves the accuracy and robustness of classification by setting a Prompt template that includes task description information, a legal terms classification system, and output format constraints. The task description information limits the content of the legal terms information output by the teacher and student models, while the output format constraints limit the output of legal terms information by the teacher and student models in a preset structured format based on the legal terms classification system. The output results directly correspond to the core requirements of compliance review, are more intuitive and easy to understand, and are convenient for downstream system integration and human interpretation. The generated results can be directly read and parsed by machines and seamlessly integrated into various automated compliance processes to achieve advanced functions such as automatic risk warning and automatic compliance report generation, greatly enhancing the capability and efficiency of automated compliance processes.

[0098] According to the present invention, a method for extracting legal terms information of open-source software licenses includes prediction results of the extraction and classification of legal terms in the training samples of the open-source software license; the legal terms include obligation clauses, authorization clauses, prohibition clauses, and their sub-clauses; the method of integrating the outputs of at least one teacher model to obtain soft labels includes: performing voting processing or weighted averaging processing on the prediction results of the at least one teacher model for the extraction and classification of legal terms in the training samples of the open-source software license to obtain the first prediction result; and obtaining the soft label based on the first prediction result.

[0099] The legal clause information includes prediction results for the extraction and classification of legal clauses from the open-source software license training samples. Specifically, the prediction results for the extraction and classification of obligation clauses, authorization clauses, prohibition clauses, and sub-clauses of obligation clauses, authorization clauses, and prohibition clauses are included. When integrating the outputs of at least one teacher model to obtain soft labels, the prediction results of at least one teacher model for the extraction and classification of legal clauses from the open-source software license training samples are subjected to voting or weighted averaging to obtain a first prediction result. The prediction result can include qualitative results regarding the occurrence of each clause. Voting adopts a majority-rule approach; for example, if the majority of teacher models predict that a clause has occurred, then that clause is considered to have occurred in the first prediction result. Weighted averaging can be achieved by weighting the prediction probabilities of each teacher model regarding the occurrence of each clause to obtain a weighted average of the prediction probabilities.

[0100] The method for extracting legal terms information from open-source software licenses provided by this invention processes the prediction results of at least one teacher model for the extraction and classification of legal terms in the training samples of open-source software licenses through voting or weighted averaging to obtain a first prediction result. Soft labels are then obtained based on the first prediction result. This method achieves accurate determination of soft labels under a multi-teacher model architecture when the legal terms information includes the prediction results for the extraction and classification of legal terms in the training samples of open-source software licenses, thereby improving the accuracy of soft labels under a multi-teacher model architecture.

[0101] According to the present invention, a method for extracting legal terms information of open-source software licenses includes prediction results of the extraction and classification of legal terms in the training samples of the open-source software license, the judgment basis of the prediction results, and the interpretation information of the terms. The legal terms include obligation clauses, authorization clauses, prohibition clauses, and their sub-clauses. The method of integrating the outputs of at least one teacher model to obtain soft labels includes: performing voting processing or weighted averaging processing on the prediction results of the at least one teacher model for the extraction and classification of legal terms in the training samples of the open-source software license to obtain a first prediction result; integrating the judgment basis and the interpretation information of the prediction results of the at least one teacher model that are consistent with the first prediction result to obtain an integrated result of the judgment basis and the interpretation information of the terms; and obtaining the soft label based on the integrated result of the first prediction result and the judgment basis and the interpretation information of the terms.

[0102] In this embodiment, to further enrich the content of the legal clause information, the legal clause information includes the prediction results of the extraction and classification of legal clauses in the open-source software license training sample, the basis for judging the prediction results, and the clause interpretation information. Specifically, the prediction results of the extraction and classification of legal clauses include the prediction results of the extraction and classification of obligation clauses, authorization clauses, prohibition clauses, and sub-clauses of obligation clauses, authorization clauses, and prohibition clauses.

[0103] When integrating the outputs of at least one teacher model to obtain soft labels, the prediction results of at least one teacher model for extracting and classifying legal clauses in the open-source software license training samples are subjected to voting or weighted averaging to obtain a first prediction result. The judgment criteria and clause interpretation information of the prediction results consistent with the first prediction result from at least one teacher model are integrated, such as through deduplication and merging, to obtain an integrated result of the judgment criteria and clause interpretation information. Soft labels are obtained based on the integrated result of the first prediction result and the judgment criteria and clause interpretation information. Soft labels include the integrated result of the first prediction result and the judgment criteria and clause interpretation information.

[0104] The method for extracting legal terms information from open-source software licenses provided by this invention involves voting or weighted averaging the prediction results of at least one teacher model for extracting and classifying legal terms from open-source software license training samples to obtain a first prediction result. The judgment criteria and clause interpretation information of the prediction results consistent with the first prediction result from at least one teacher model are then integrated to obtain an integrated result of the judgment criteria and clause interpretation information. Soft labels are obtained based on the first prediction result and the integrated result of the judgment criteria and clause interpretation information. This method achieves accurate determination of soft labels under a multi-teacher model architecture when the legal terms information includes the prediction results of extracting and classifying legal terms from open-source software license training samples, as well as the judgment criteria and clause interpretation information of the prediction results, thus improving the accuracy of soft labels under a multi-teacher model architecture.

[0105] Figure 2 This is the second flowchart illustrating the method for extracting legal terms and conditions from open-source software licenses provided by this invention. For example... Figure 2 As shown, the method includes:

[0106] Training phase:

[0107] By collecting the original SPDX license text, manually adding fine-grained annotations, and constructing a structured dataset, a hard-labeled dataset was obtained.

[0108] By inputting the original license text and the designed Prompt template into the teacher model, a soft-label dataset is generated through the teacher model's inference.

[0109] The student model is initialized and trained using a combination loss algorithm with both hard-labeled and soft-labeled datasets. This transfers the generalization ability and adherence to hard rules of the teacher model to the student model, resulting in a distilled, specialized LLM (Legal Clause Information Extraction Model). The student model not only learns the manually labeled hard rules (hard labels) but also internalizes the reasoning patterns (soft labels) of the teacher model for handling novel, complex, or ambiguous legal expressions. This enables the invention to make reasonable judgments based on deep semantic understanding even when faced with obscure licenses, novel licenses, or their variations not covered in the training data, effectively expanding the applicability and sustainability of automated analysis.

[0110] Application phase:

[0111] Input the text to be analyzed: Input the full text of any open-source license to be analyzed into the legal clause information extraction model (a type of large-scale language model). Through this end-to-end processing, the model can fully utilize contextual information spanning multiple sentences or even paragraphs to understand the logical relationships between clauses (such as the relationship between the granting of a right and its preconditions), thereby significantly improving the accuracy of clause boundary and nature judgment. The powerful long-text understanding capabilities of the large-scale language model (LLM) enable the model to capture semantic dependencies and logical connections spanning multiple sentences or even paragraphs (e.g., the relationship between the granting of a right and its preconditions). This avoids the problem of existing technologies fragmenting the semantics of complete clauses due to forced sentence segmentation, significantly improving the accuracy of clause boundary identification and nature judgment.

[0112] Model Inference: After inputting the text into a pre-trained legal clause information extraction model (a lightweight, task-specific LLM model), the model outputs the extracted legal clause information. Due to the small model size and task-specific optimization, this inference process is very fast.

[0113] Outputting Structured JSON Results: The legal clause information extraction model directly outputs a standardized JSON object. This object clearly lists the three main categories of identified clauses: must, can, and cannot, as well as the specific sub-clause names and their Chinese names within each category. This output can be automatically parsed and used by downstream compliance audit systems, software bill of materials (SBOM) analysis tools, and other programs, greatly improving the efficiency of compliance review in the software supply chain.

[0114] This invention innovatively constructs and trains a model that directly applies a three-tiered legal effect classification framework of "obligation-authorization-prohibition". The model classifies based on a direct understanding of the overall legal connotation of the text, rather than relying on fragile keyword rule chains. The classification system directly maps to the core concerns of software compliance review ("what I must do", "what I can do", "what I cannot do"), resulting in intuitive and easy-to-understand outputs that are easy for developers and legal personnel to comprehend and apply. LLM's powerful semantic understanding capabilities enable it to handle implicit expressions, complex sentence structures, or lexical variations, eliminating excessive reliance on explicit keywords (such as "must" and "not") and significantly improving classification accuracy and system robustness. The generated machine-readable results are fine-grained, standardized, and highly structured, allowing for direct parsing and utilization by downstream automated tools such as Software Bill of Materials (SBOM) tools, Continuous Integration / Continuous Deployment (CI / CD) pipelines, and compliance audit systems without secondary manual processing. This greatly facilitates the realization of end-to-end automated compliance processes and improves the efficiency and reliability of functions such as risk alerts and report generation.

[0115] Through the above steps, this invention provides an end-to-end automated solution that transforms the complex and time-consuming manual license review process into an efficient, accurate, and scalable technical workflow, providing strong technical support for the field of software intellectual property compliance. In summary, this invention, by leveraging the end-to-end capability of large language models to process full text, combining knowledge distillation strategies to enhance generalization, employing an intuitive and robust legal effect classification framework, and mandating structured output, significantly outperforms existing technical solutions in terms of clause recognition accuracy, model generalization ability, result usability, and automation integration, providing a more efficient, accurate, reliable, and easily integrated automated solution for the field of open-source software compliance.

[0116] The following describes the open-source software license legal terms information extraction device provided by the present invention. The open-source software license legal terms information extraction device described below can be referred to in correspondence with the open-source software license legal terms information extraction method described above.

[0117] Figure 3 This is a schematic diagram of the open-source software license legal terms information extraction device provided by the present invention. Figure 3 As shown, the device includes an acquisition module 10 and an output module 20, wherein: the acquisition module 10 is used to: acquire the license text of the open source software license containing complete semantic information related to the terms; the output module 20 is used to: input the license text into a pre-trained legal terms information extraction model, and output the legal terms information of the open source software license; wherein, the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open source software license training samples and a preset Prompt template into at least one teacher model based on a large language model.

[0118] The open-source software license legal terms information extraction device provided by this invention obtains the license text containing complete semantic information related to the terms of the open-source software license, inputs the license text into the legal terms information extraction model trained by knowledge distillation based on a large language model, and outputs the legal terms information of the open-source software license, thereby improving the accuracy and completeness of software license legal terms extraction and enhancing generalization ability.

[0119] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440, wherein the processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can invoke logical instructions in the memory 430 to execute a method for extracting legal terms information from open-source software licenses. This method includes: obtaining a license text containing complete semantic information related to the terms of the open-source software license; inputting the license text into a pre-trained legal terms information extraction model, and outputting the legal terms information of the open-source software license; wherein the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model.

[0120] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present 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 the present 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.

[0121] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the open-source software license legal terms information extraction method provided by the above methods. The method includes: obtaining a license text containing complete semantic information related to the terms of the open-source software license; inputting the license text into a pre-trained legal terms information extraction model, and outputting the legal terms information of the open-source software license; wherein the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model.

[0122] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the open-source software license legal terms information extraction method provided by the above methods. This method includes: obtaining a license text containing complete semantic information related to the terms of the open-source software license; inputting the license text into a pre-trained legal terms information extraction model, and outputting the legal terms information of the open-source software license; wherein the legal terms information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and the training data for the knowledge distillation training includes soft labels output by inputting open-source software license training samples and a preset Prompt template into at least one teacher model based on a large language model.

[0123] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0124] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0125] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

[0127] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. An open source software license legal clause information extraction method characterized by, The method comprises the following steps: obtaining license text of an open source software license containing complete clause-related semantic information; inputting the license text into a pre-trained legal clause information extraction model to output legal clause information of the open source software license; wherein the legal clause information extraction model is obtained through knowledge distillation training on a student model based on a large language model, the training data of the knowledge distillation training includes soft labels output by at least one teacher model based on a large language model by inputting an open source software license training sample and a preset Prompt template into the teacher model; the legal clause information includes a prediction result of extraction and classification of legal clauses in the open source software license training sample; the legal clauses include obligation clauses, authorization clauses, prohibition clauses and their sub-clauses; before the step of inputting the license text into the legal clause information extraction model obtained through knowledge distillation training based on a large language model, the method further comprises: obtaining the legal clause information extraction model through knowledge distillation training based on a large language model; the step of obtaining the legal clause information extraction model through knowledge distillation training based on a large language model comprises: obtaining hard labels by labeling clause information of an open source software license training sample; wherein the hard labels include a Boolean label set indicating whether different types of legal clauses in the open source software license training sample appear; inputting the open source software license training sample and a preset Prompt template into at least one teacher model based on a large language model, integrating outputs of the at least one teacher model to obtain soft labels; wherein the soft labels include a first prediction result of extraction and classification of legal clauses in the open source software license training sample by the at least one teacher model; inputting the open source software license training sample, the Prompt template, the hard labels and the soft labels into a student model based on a large language model to obtain a second prediction result of extraction and classification of legal clauses in the open source software license training sample by the student model, training based on the second prediction result using a first loss function to obtain the legal clause information extraction model; Or, the legal clause information extraction model is obtained by training the large language model through knowledge distillation, including: inputting open source software license training samples and a preset Prompt template into at least one teacher model based on a large language model, integrating outputs of the at least one teacher model to obtain soft labels; wherein the soft labels include first prediction results of the at least one teacher model on extraction and classification of legal clauses in the open source software license training samples; inputting the open source software license training samples, the Prompt template and the soft labels into a student model based on a large language model to obtain third prediction results of the student model on extraction and classification of legal clauses in the open source software license training samples, training based on the third prediction results using a second loss function to obtain the legal clause information extraction model.

2. The open source software license legal clause information extraction method according to claim 1, characterized in that, The first loss function is a weighted sum of a hard label loss and a soft label loss; wherein the hard label loss represents the closeness of the second prediction results and the hard labels, and the soft label loss represents the closeness of the second prediction results and the first prediction results.

3. The open source software license legal clause information extraction method according to claim 1, characterized in that, The second loss function represents the closeness of the third prediction results and the first prediction results.

4. The open source software license legal clause information extraction method according to claim 1, characterized in that, The Prompt template includes task description information, a legal clause classification system and output format constraint information; wherein the task description information is used to limit the content of legal clause information output by the teacher model and the student model, and the output format constraint information is used to limit the teacher model and the student model to output the legal clause information in a preset structured format based on the legal clause classification system.

5. The open source software license legal clause information extraction method according to claim 4, characterized in that, The integrating the outputs of the at least one teacher model to obtain soft labels includes: voting processing or weighted average processing of prediction results of the at least one teacher model on extraction and classification of legal clauses in the open source software license training samples to obtain the first prediction results; obtaining the soft labels according to the first prediction results.

6. The open source software license legal clause information extraction method according to claim 4, characterized in that, The legal clause information further includes judgment basis and clause explanation information of prediction results on extraction and classification of legal clauses in the open source software license training samples; The integrating the outputs of the at least one teacher model to obtain soft labels includes: voting processing or weighted average processing of prediction results of the at least one teacher model on extraction and classification of legal clauses in the open source software license training samples to obtain the first prediction results; integrating the judgment basis and the clause explanation information of prediction results of the at least one teacher model consistent with the first prediction results to obtain an integrated result of the judgment basis and the clause explanation information; obtaining the soft labels according to the first prediction results and the integrated result of the judgment basis and the clause explanation information.

7. An open source software license legal clause information extraction apparatus characterized by comprising: including: an acquisition module, configured to acquire license texts of open source software licenses containing complete clause related semantic information; The output module is configured to input the license text into a pre-trained legal clause information extraction model, and output legal clause information of the open source software license; wherein the legal clause information extraction model is obtained by knowledge distillation training on a student model based on a large language model, and training data of the knowledge distillation training includes soft labels output by at least one teacher model based on a large language model by inputting an open source software license training sample and a preset Prompt template into the at least one teacher model; the legal clause information includes a prediction result of extraction and classification of legal clauses in the open source software license training sample; and the legal clauses include obligation clauses, authorization clauses, prohibition clauses, and sub-clauses thereof. The device further includes a training module configured to obtain the legal clause information extraction model by knowledge distillation training based on a large language model. When obtaining the legal clause information extraction model by knowledge distillation training based on a large language model, the training module is specifically configured to: obtain hard labels by labeling clause information of an open source software license training sample; wherein the hard labels include a Boolean label set indicating whether different types of legal clauses in the open source software license training sample appear; obtain soft labels by inputting an open source software license training sample and a preset Prompt template into at least one teacher model based on a large language model, and integrating outputs of the at least one teacher model; wherein the soft labels include first prediction results of extraction and classification of legal clauses in the open source software license training sample by the at least one teacher model; input the open source software license training sample, the Prompt template, the hard labels, and the soft labels into a student model based on a large language model, to obtain second prediction results of extraction and classification of legal clauses in the open source software license training sample by the student model, train the student model based on the second prediction results using a first loss function, and obtain the legal clause information extraction model; Or, when obtaining the legal clause information extraction model by knowledge distillation training based on a large language model, the training module is specifically configured to: obtain soft labels by inputting an open source software license training sample and a preset Prompt template into at least one teacher model based on a large language model, and integrating outputs of the at least one teacher model; wherein the soft labels include first prediction results of extraction and classification of legal clauses in the open source software license training sample by the at least one teacher model; input the open source software license training sample, the Prompt template, and the soft labels into a student model based on a large language model, to obtain third prediction results of extraction and classification of legal clauses in the open source software license training sample by the student model, train the student model based on the third prediction results using a second loss function, and obtain the legal clause information extraction model.

Citation Information

Patent Citations

  • Double prior text classification method based on knowledge distillation

    CN118227795A

  • Document-level event extraction method and device based on large model knowledge distillation

    CN119962515A