Self-adaptive test question generation method and device, medium and equipment

By acquiring multi-source learning data, utilizing a user intent recognition model and a dynamic Prompt template selection mechanism, and combining a RAG knowledge enhancement mechanism and a large language model, relay protection test questions that conform to the user's learning intent are generated. This solves the problem of the inability to accurately and efficiently generate relay protection test questions in existing technologies, realizes the personalization and professionalism of test question generation, and improves learning efficiency and user satisfaction.

CN121614601APending Publication Date: 2026-03-06GUANGZHOU POWER SUPPLY BUREAU GUANGDONG POWER GRID CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511651288.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing technologies cannot accurately and efficiently generate adaptive test questions in the field of relay protection. They lack an understanding of the individual needs of learners, the generation strategy lacks flexibility, cannot achieve personalized and dynamic matching of questions, and lack a closed-loop optimization mechanism for answer feedback.

Method used

By acquiring multi-source learning data, utilizing user intent recognition models and dynamic Prompt template selection mechanisms, combined with RAG knowledge enhancement mechanisms and large language models, relay protection domain test questions that conform to users' learning intentions are generated. Furthermore, the model is optimized through reinforcement learning feedback mechanisms to improve the accuracy and relevance of test question generation.

Benefits of technology

It enables personalized and dynamic optimization of relay protection test questions, improves the professionalism and accuracy of test question generation, and enhances user learning efficiency and satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121614601A_ABST
    Figure CN121614601A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive test question generation method and device, a medium and equipment, and belongs to the field of test question generation. Multi-source learning data of a user is obtained and input into a user intention recognition model, and the learning intention category of the user is accurately determined. And according to the category, screening a matching template from a structured Prompt template library, and filling a slot in combination with user portrait data to generate a natural language Prompt. Then, knowledge fragments in the relay protection field knowledge base are retrieved and spliced through an RAG knowledge enhancement mechanism, an input sequence is formed, finally, a large language model is input to generate personalized relay protection field test questions, and the learning efficiency and experience are improved. The problem that the relay protection test questions cannot be accurately and efficiently generated in the prior art is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of test item generation, and more particularly to an adaptive test item generation method, apparatus, medium, and device. Background Technology

[0002] In the safe and stable operation of power systems, relay protection, as an important automation technology, is widely used in key aspects such as power grid anomaly detection, fault location, and fault isolation. Due to the complexity of relay protection principles, rapid technological evolution, and diverse practical scenarios, the industry places high demands on the theoretical depth and practical skills of relay protection professionals. Therefore, relay protection training and assessment are of paramount importance in power companies and higher education institutions.

[0003] Traditional relay protection training and assessment typically rely on static question bank systems, which either manually create questions or extract them from existing question banks based on knowledge point tags. While this approach offers some coverage, it has significant limitations: First, it lacks an understanding of individual learners' needs, failing to identify their learning intentions or areas of weakness. Second, the generation strategy lacks flexibility, relying solely on fixed templates to generate questions, making it difficult to personalize and dynamically match questions. Third, the systems generally lack a closed-loop optimization mechanism for answer feedback, making it difficult to use user behavior data to guide question optimization.

[0004] In recent years, with the development of artificial intelligence technology, especially the widespread application of Large Language Models (LLM) in text generation, the intelligence level of intelligent question bank systems has been improved. However, current research mostly focuses on general educational scenarios, and there is still a lack of highly adaptable and accurate question generation solutions for the highly specialized field of relay protection. Furthermore, most intelligent question bank systems are still template-driven, lacking intent recognition capabilities and the ability to dynamically adjust according to different learning objectives. These shortcomings prevent existing technologies from accurately and efficiently generating relay protection questions. Summary of the Invention

[0005] This invention provides an adaptive test question generation method, apparatus, medium, and device to solve the problem that existing technologies cannot accurately and efficiently generate relay protection test questions.

[0006] Firstly, this application provides an adaptive test question generation method, including:

[0007] Acquire multi-source learning data from users; the multi-source learning data includes answer behavior data, search request data, user profile data, and natural language learning demand data;

[0008] The multi-source learning data is input into a preset user intent recognition model to obtain the user's current learning intent category; wherein, the user intent recognition model is a multi-classification task constructed based on user behavior feature vectors and trained using cross-entropy as the loss function;

[0009] Based on the learning intent category, a matching template is selected from the structured Prompt template library through a preset dynamic Prompt template selection mechanism, and the slot positions in the matching template are filled in combination with user profile data to obtain a natural language Prompt.

[0010] Based on the natural language Prompt, and combined with the preset RAG knowledge enhancement mechanism, knowledge fragments in the preset relay protection domain knowledge base are retrieved and concatenated to obtain the input sequence; wherein, the RAG knowledge enhancement mechanism is based on vectorized encoding and Top-k similarity filtering;

[0011] The input sequence is fed into a preset large language model to generate relay protection domain test questions, wherein the large language model is trained based on relay protection domain corpus.

[0012] This application comprehensively understands users' learning status and needs by acquiring multi-source learning data, including answer behavior data, search request data, user profile data, and natural language learning demand data. This data is input into a pre-defined user intent recognition model. This model constructs a multi-classification task based on user behavior feature vectors and is trained using cross-entropy as the loss function, thereby accurately identifying the user's current learning intent category. Based on the identified learning intent category, this application uses a pre-defined dynamic Prompt template selection mechanism to filter matching templates from a structured Prompt template library and fills the slots in the templates with user profile data to generate a natural language Prompt. Furthermore, a pre-defined RAG knowledge enhancement mechanism is used to retrieve and concatenate knowledge fragments in the relay protection domain knowledge base to obtain the input sequence. This mechanism, based on vectorized encoding and Top-k similarity filtering calculation, ensures the relevance and accuracy of the knowledge fragments. Finally, the input sequence is input into a pre-defined large language model, which is trained on relay protection domain corpora and can generate high-quality relay protection domain test questions that match the user's learning intent. This process not only enables personalized and dynamic optimization of test question generation, but also enhances the professionalism and accuracy of the generated content through the RAG knowledge enhancement mechanism, thereby effectively solving the problem that existing technologies cannot accurately and efficiently generate relay protection test questions.

[0013] Furthermore, after generating the relay protection domain test questions, the process also includes:

[0014] Obtain user feedback data on their answers to the test questions in the field of relay protection;

[0015] Based on the answer feedback data and combined with the preset reinforcement learning feedback mechanism, the user intent recognition model and the dynamic Prompt template selection mechanism are optimized to obtain the optimized user intent recognition model and the optimized dynamic Prompt template selection mechanism.

[0016] After generating test questions in the relay protection field, this application further obtains user feedback data based on these test questions. Using this feedback data, combined with a pre-defined reinforcement learning feedback mechanism, the user intent recognition model and dynamic prompt template selection mechanism are optimized. This process utilizes actual user answering behavior data as a reward signal for reinforcement learning, adjusting model parameters through policy gradient methods or other reinforcement learning algorithms. This enables the user intent recognition model to more accurately identify the user's learning intent, and the dynamic prompt template selection mechanism to more effectively filter and generate test questions that meet user needs. The optimized user intent recognition model and dynamic prompt template selection mechanism can better adapt to users' personalized learning needs, improve the accuracy and relevance of test question generation, and thus significantly improve user learning efficiency and satisfaction.

[0017] Furthermore, the acquisition of the user's multi-source learning data specifically includes:

[0018] The system retrieves user answer behavior data from a pre-set answer record storage system; the answer behavior data includes the accuracy rate, error rate, average answer time, and question type distribution of the most recent preset number of answers.

[0019] The system acquires user search request data from a pre-set search log collection system; the search request data includes the user's input search keywords, the text length of the query intent, and the correlation strength between the keywords and knowledge points in the field of relay protection.

[0020] User profile data is obtained from a pre-set user information management system; the user profile data includes the user's total historical learning time, the distribution of mastered knowledge points, and error patterns during the answering process;

[0021] Receive natural language learning requirement data input by the user through an interactive interface; the natural language learning requirement data includes the relay protection learning objectives described by the user;

[0022] The extracted answer behavior data, search request data, user profile data, and received natural language learning demand data are preprocessed and integrated to obtain the multi-source learning data.

[0023] This application comprehensively collects user-related learning data by acquiring user answer behavior data from a pre-set answer record storage system, including the accuracy rate, error rate, average answer time, and question type distribution of the most recent pre-set number of answers; acquiring user search request data from a pre-set search log collection system, including user-input search keywords, the text length of the query intent, and the correlation strength between keywords and knowledge points in the relay protection field; acquiring user profile data from a pre-set user information management system, including the user's total historical learning time, the distribution of mastered relay protection knowledge points, and error patterns during the answering process; and receiving natural language learning needs data input by the user through the interactive interface, including the user's described relay protection learning goals. This application preprocesses and integrates this data to obtain multi-source learning data, providing a rich data foundation for subsequent user intent recognition and personalized test question generation. This enables the application to more accurately identify user learning intent, thereby generating relay protection test questions that better meet user needs.

[0024] Furthermore, the step of inputting the multi-source learning data into a preset user intent recognition model to obtain the user's current learning intent category specifically involves:

[0025] The multi-source learning data is converted into a user behavior feature vector; the user behavior feature vector integrates the numerical features of the answer behavior data, the correlation features of the search request data, the distribution features of the user profile data, and the semantic vector features of the natural language learning demand data.

[0026] The user behavior feature vector is input into the user intent recognition model so that the user intent recognition model performs feature extraction and classification calculation on the user behavior feature vector based on a shallow neural network or a lightweight Transformer structure.

[0027] And through the built-in softmax function, the classification calculation results are converted into probability distributions of each preset learning intent category;

[0028] The category with the highest probability value from the probability distribution is selected as the user's current learning intention category for output; wherein, the preset learning intention categories include filling in knowledge gaps, pre-exam cramming, concept understanding, practical training, and competition preparation.

[0029] This application transforms multi-source learning data of users into user behavior feature vectors, integrating numerical features of answer behavior data, correlation features of search request data, distribution features of user profile data, and semantic vector features of natural language learning demand data. This enables the creation of a comprehensive and accurate user feature representation. This feature vector is then input into a user intent recognition model based on a shallow neural network or a lightweight Transformer structure, allowing the model to perform effective feature extraction and classification calculations. Using a built-in softmax function, the classification results are converted into probability distributions for each preset learning intent category, and the category with the highest probability value is selected as the user's current learning intent category for output. This process not only improves the accuracy of user intent recognition but also generates more personalized and precise learning content based on the user's specific learning needs, such as filling knowledge gaps, exam preparation, concept understanding, practical training, and competition preparation.

[0030] Furthermore, based on the learning intent category, a matching template is selected from the structured Prompt template library through a preset dynamic Prompt template selection mechanism, and the slot positions in the matching template are filled in combination with user profile data to obtain a natural language Prompt, specifically as follows:

[0031] Each template in the structured Prompt template library contains an applicable intent tag, a language structure skeleton, and a set of slot positions; the applicable intent tags correspond one-to-one with the learning intent categories; the language structure skeleton is a sentence framework that conforms to the expression habits of the relay protection field;

[0032] Based on the user's current learning intent category and the preset dynamic Prompt template selection mechanism, templates with applicable intent tags that match the learning intent category are selected from the structured Prompt template library as candidate templates.

[0033] The dynamic Prompt template selection mechanism is based on semantic vector similarity calculation.

[0034] Using a pre-defined natural language sentence encoder, the language structure skeleton of each candidate template is converted into a template semantic vector, and user profile data is converted into user semantic vectors.

[0035] Calculate the semantic similarity between the user semantic vector and the semantic vectors of each candidate template;

[0036] Select the candidate template with the highest semantic similarity as the matching template;

[0037] Extract the relay protection knowledge points from user profile data that have been missed a preset number of times, and the difficulty level of the test questions corresponding to the user's current ability level;

[0038] The extracted knowledge points on relay protection and the difficulty level of the test questions are filled into the corresponding slots of the matching template to obtain the natural language Prompt.

[0039] This application employs a dynamic Prompt template selection mechanism based on learning intent categories to filter out templates from a structured Prompt template library that match the user's current learning intent. Figure 1 A personalized template is generated, and user profile data is used to fill in the slots within the template to produce a natural language prompt. This process first utilizes semantic vector similarity calculation. A natural language sentence encoder converts candidate templates and user profile data into semantic vectors, calculates their similarity, and selects the best-matching template. Then, frequently missed knowledge points and appropriate question difficulty levels are extracted from the user profile and filled into the corresponding slots in the template, forming a precise natural language prompt. This not only improves the personalization and targeting of question generation but also ensures the professionalism and accuracy of the generated content, thereby effectively enhancing user learning efficiency and experience.

[0040] Furthermore, based on the natural language Prompt and combined with a preset RAG knowledge enhancement mechanism, knowledge fragments in a preset relay protection domain knowledge base are retrieved and concatenated to obtain the input sequence, specifically as follows:

[0041] The natural language Prompt is converted into a query semantic vector using a preset natural language encoding model.

[0042] The preset knowledge base for relay protection contains multiple independent knowledge fragments, and each knowledge fragment is converted into a fragment semantic vector through the natural language encoding model;

[0043] Calculate the semantic similarity between the query semantic vector and the semantic vectors of each segment;

[0044] The calculated semantic similarity scores are sorted in descending order, and the top preset number of knowledge fragments after sorting are selected as target knowledge fragments.

[0045] The natural language Prompt and each target knowledge fragment are concatenated sequentially in the order of natural language Prompt first and target knowledge fragment last to obtain the input sequence.

[0046] This application achieves accurate retrieval of knowledge fragments by converting natural language prompts into query semantic vectors and calculating their semantic similarity with fragment semantic vectors in a pre-defined knowledge base for the relay protection domain. Each fragment in the knowledge base is converted into a fragment semantic vector through a natural language encoding model, ensuring comparability with the query vector. By calculating semantic similarity and sorting in descending order, the top preset number of most relevant knowledge fragments are selected as target knowledge fragments, further enhancing the professionalism and accuracy of the generated content. Finally, the natural language prompts and target knowledge fragments are concatenated in a specified order to form an input sequence, providing rich contextual information for subsequent generation of high-quality test questions using a large language model. This process not only improves the professionalism and relevance of test question generation but also ensures the logic and coherence of the generated content, thereby significantly improving user learning efficiency and experience.

[0047] Furthermore, the step of inputting the input sequence into a preset large language model to generate relay protection domain test questions specifically involves:

[0048] The input sequence is input into a preset large language model; the large language model first parses the natural language Prompt in the input sequence to determine the question generation target, then extracts the relay protection domain information of the target knowledge segment in the input sequence, and generates relay protection domain questions containing the question stem, options, correct answer and explanation segment by segment;

[0049] The test question generation objectives include the test question type, the relay protection knowledge points tested, and the test question difficulty level.

[0050] This application achieves automatic generation of relay protection test questions by inputting the input sequence into a pre-defined large language model. Specifically, the large language model first parses the natural language prompt in the input sequence to clarify the target of test question generation, including the test question type, the relay protection knowledge points tested, and the difficulty level. Subsequently, the model extracts relay protection domain information from the target knowledge segments in the input sequence and generates complete test questions segment by segment, including the stem, options, correct answer, and explanation. This process not only ensures the professionalism and accuracy of the test questions but also enhances the relevance and personalization of the generated test questions by combining the natural language prompt and knowledge segments. Ultimately, the generated test questions better meet users' learning needs and improve learning efficiency and experience.

[0051] Secondly, this application provides an adaptive test question generation device, the adaptive test question generation device comprising:

[0052] The acquisition module is used to acquire users' multi-source learning data; the multi-source learning data includes answer behavior data, search request data, user profile data, and natural language learning demand data;

[0053] The category recognition module is used to input the multi-source learning data into a preset user intent recognition model to obtain the user's current learning intent category; wherein, the user intent recognition model is a multi-classification task constructed based on user behavior feature vectors and trained using cross-entropy as the loss function;

[0054] The template matching module is used to filter matching templates from the structured Prompt template library based on the learning intent category through a preset dynamic Prompt template selection mechanism, and fill the slot positions in the matching templates with user profile data to obtain a natural language Prompt.

[0055] The retrieval module is used to retrieve and concatenate knowledge fragments in a preset relay protection domain knowledge base based on the natural language Prompt and a preset RAG knowledge enhancement mechanism to obtain an input sequence; wherein, the RAG knowledge enhancement mechanism is based on vectorized encoding and Top-k similarity filtering;

[0056] The test question generation module is used to input the input sequence into a preset large language model to generate test questions in the relay protection domain, wherein the large language model is trained based on relay protection domain corpus.

[0057] The adaptive question generation device of this application collects multi-source learning data from users through an acquisition module, including answer behavior data, search request data, user profile data, and natural language learning demand data, providing comprehensive data support for accurately identifying user learning intentions. The category recognition module uses this data to input into a user intention recognition model. This model constructs a multi-classification task based on user behavior feature vectors and is trained using cross-entropy as the loss function, thereby accurately obtaining the user's current learning intention category. The template matching module, based on the learning intention category, selects matching templates from a structured Prompt template library through a dynamic Prompt template selection mechanism and fills the slot positions in the templates with user profile data to generate a natural language Prompt. The retrieval module, based on the natural language Prompt and combined with the RAG knowledge enhancement mechanism, retrieves and splices knowledge fragments in the relay protection domain knowledge base to form an input sequence. This process, based on vectorized encoding and Top-k similarity filtering, ensures the relevance and accuracy of the knowledge fragments. Finally, the question generation module inputs the input sequence into a preset large language model to generate relay protection domain questions that match the user's learning intentions. This model is trained based on relay protection domain corpora and can generate high-quality, personalized questions. The collaborative work of these modules has enabled full automation and intelligence of the entire process from user data collection to personalized test question generation, significantly improving the efficiency and quality of test question generation in the relay protection field and meeting the learning needs of different users.

[0058] Thirdly, this application provides a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the adaptive test item generation method as described above. Its beneficial effects are the same as those of the adaptive test item generation method provided in the first aspect of this application.

[0059] Fourthly, this application provides a terminal device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement any of the adaptive test question generation methods described in the first aspect. Attached Figure Description

[0060] Figure 1 : A schematic flowchart of an embodiment of the adaptive test question generation method provided in this application;

[0061] Figure 2 : A schematic diagram of one embodiment of the adaptive test question process provided in this application;

[0062] Figure 3 : A schematic diagram of an embodiment of the adaptive test question generation device provided in this application. Detailed Implementation

[0063] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0064] Example 1

[0065] Please refer to Figure 1 In order to solve the problem that existing technologies cannot accurately and efficiently generate relay protection test questions, this invention provides an adaptive test question generation method, including steps S01-S05.

[0066] S01: Obtain multi-source learning data from users; the multi-source learning data includes answer behavior data, search request data, user profile data, and natural language learning demand data.

[0067] In a preferred embodiment of this invention, the acquisition of the user's multi-source learning data specifically includes:

[0068] In this embodiment, all systems and mechanisms marked 'preset' are standardized functional modules pre-deployed on the relay protection professional learning platform. Among them: data storage pre-set systems include a question record storage system, a search log collection system, and a user information management system; model calculation pre-set mechanisms include a user intent recognition model, a dynamic Prompt template selection mechanism, a RAG knowledge enhancement mechanism, a large language model, and a reinforcement learning feedback mechanism. The specific implementation of each pre-set module is as follows:

[0069] By accessing a pre-set question-and-answer record storage system, user behavior data in a relay protection-related question bank is extracted. This data includes the user's accuracy rate, error rate, average answer time per question, and the distribution of question types (e.g., the proportion of multiple-choice, fill-in-the-blank, and short-answer questions in the total number of answers) in the last 30 attempts. Simultaneously, user search request data is obtained from a search log collection system, including search keywords entered by the user on the learning platform (e.g., "differential protection setting calculation" and "relay protection device debugging steps"), the text length of each query intent, and the correlation strength between keywords and relay protection knowledge points calculated using a keyword matching algorithm (e.g., the correlation between "differential protection" and "transformer protection" is 0.85).

[0070] In addition, user profile data is retrieved from the user information management system. This data covers the total historical learning time since user registration, the distribution of mastered relay protection knowledge points marked by knowledge graphs (e.g., 70% mastery of the "line protection" module and 45% mastery of the "busbar protection" module), and common error types identified by error pattern analysis tools (e.g., "confusion of setting calculation parameters" and "error in protection logic timing judgment"). Simultaneously, the system receives natural language learning needs data actively input by users through the learning platform's interactive interface, such as user-inputted learning objectives like "I need 10 medium-difficulty practice questions targeting common errors in transformer differential protection" or "I want to learn about case analysis questions related to the latest relay protection regulations."

[0071] Finally, the extracted and received data were preprocessed: the accuracy and error rates in the answering behavior data were converted into numerical features between 0 and 1, and the question type distribution was converted into label features; the unstructured natural language learning demand data was converted into 768-dimensional semantic vectors using a BERT-based text embedding model; the knowledge mastery level in the user profile data was converted into percentage values, and error patterns were converted into classification labels. These preprocessed data were then integrated into a unified format of multi-source learning data, providing an input foundation for subsequent user intent recognition.

[0072] S02: Input the multi-source learning data into a preset user intent recognition model to obtain the user's current learning intent category; wherein, the user intent recognition model is a multi-classification task constructed based on user behavior feature vectors and trained using cross-entropy as the loss function.

[0073] In a preferred embodiment of this invention, the step of inputting the multi-source learning data into a preset user intent recognition model to obtain the user's current learning intent category specifically involves:

[0074] First, feature fusion is performed on the integrated multi-source learning data to generate a user behavior feature vector. Specifically, numerical features such as accuracy and error rate in the quiz behavior data are standardized to values ​​in the 0-1 range; the label features of question type distribution are converted into binary vectors using one-hot encoding; the association strength features of the search request data and the percentage of knowledge point mastery in the user profile data are normalized; and the 768-dimensional semantic vector of the natural language learning demand data is concatenated with the above features according to preset weights to form a 1024-dimensional user behavior feature vector.

[0075] The user intent recognition model adopts a lightweight Transformer structure, containing four attention heads and two encoder layers. Its training process is based on historical user data: 100,000 samples containing multi-source learning data and manually labeled intent categories are used as the training set. User behavior feature vectors are used as input, and five intent categories, namely "filling gaps," "pre-exam cramming," "concept understanding," "practical training," and "competition preparation," are used as output labels to construct a multi-classification task. During training, the cross-entropy loss function is used to calculate the difference between the predicted category and the true label. The model parameters are iteratively adjusted through the Adam optimizer (initial learning rate is set to 0.001, and the number of iterations is 50) until the loss value converges to below 0.05, thus completing the model training.

[0076] In practical applications, the real-time generated user behavior feature vectors are input into the trained user intent recognition model. The model performs deep semantic extraction on the feature vectors through an encoder, and outputs the probability distribution of five types of learning intents after transformation by the softmax function (such as "filling gaps" with a probability of 0.72, "concept understanding" with a probability of 0.15, etc.). Finally, the category with the highest probability value is selected as the user's current learning intent category. For example, when the probability of "filling gaps" is the highest, it is determined that the user's current intent is to strengthen practice on weak knowledge points.

[0077] Furthermore, suppose that the user's input behavior features can be represented as a d-dimensional vector. The goal of the intent recognition model is to output a probability distribution vector containing C categories, where each element represents the probability that the user belongs to a certain intent category.

[0078] This application employs a shallow neural network or a lightweight Transformer structure as the intent recognition model, denoted as f. θ (·), where θ represents the model parameters to be trained. The model's output is processed by the softmax function to form a normalized class probability vector. The c-th component represents the probability that the model predicts the user belongs to the c-th intent category, denoted as .

[0079] During model training, cross-entropy is used as the loss function, specifically in the form of:

[0080]

[0081] in, y represents the total intent recognition loss function value; N represents the total number of training samples; C represents the number of intent categories; i,c It is the indicator function of the true label, y is the expression for the true intent category of the i-th sample being the c-th class. i,c =1, otherwise 0; This represents the model's predicted probability for that category.

[0082] To ensure the model accurately captures the user's true learning intent, the feature vector x i The construction of the model is particularly crucial. Specific features include, but are not limited to, the following: First, user answering behavior characteristics, such as the accuracy rate, error rate, average answering time, and question type distribution of the most recent n answers; Second, user search behavior characteristics, such as the keywords entered, the length of the query intent, and the strength of the association between keywords and knowledge points; Third, user profile information, including historical learning time, distribution of mastered knowledge points, and common error patterns; Fourth, if the user directly inputs a natural language request (such as "I want to practice protection value tuning questions"), semantic vectors can be extracted as supplementary features through BERT or other text embedding models.

[0083] After the model is trained, for each user action input, the system can output a multi-class probability distribution in real time, and use the category corresponding to the highest probability as the user's primary learning intent. This is denoted as:

[0084]

[0085] in, Category labels representing predicted user intent; This represents the probability that the user belongs to the c-th type of intent; argmax represents selecting the index of the category with the highest probability.

[0086] The recognition results of this module can clearly identify the user's current learning objectives, such as whether they want to fill in knowledge gaps, prepare for exams, understand concepts, practice, or prepare for competitions. This provides precise guidance for the selection of Prompt templates and retrieval of knowledge content in the subsequent generation process, ensuring that the entire generation path has a high degree of contextual relevance and adaptability.

[0087] In this step, the input data is the preprocessed user multi-source learning feature vector x. i The output is the user's learning intent category label. This category label will serve as a key input for dynamic Prompt template matching and slot filling in step two, thereby ensuring the continuity and adaptability of the generation process.

[0088] S03: Based on the learning intent category, a matching template is selected from the structured Prompt template library through a preset dynamic Prompt template selection mechanism, and the slot positions in the matching template are filled in combination with user profile data to obtain a natural language Prompt.

[0089] In a preferred embodiment of this example, based on the learning intent category, a matching template is selected from the structured Prompt template library through a preset dynamic Prompt template selection mechanism, and the slot positions in the matching template are filled in combination with user profile data to obtain a natural language Prompt. Specifically:

[0090] The structured Prompt template library stores standardized templates corresponding to various learning intentions. Each template contains three parts: applicable intention tags (such as "filling gaps" and "exam preparation," each corresponding to a user intention category), a fixed language structure skeleton (such as "Please generate practice questions of {difficulty} targeting {knowledge points}, focusing on {common mistakes}"), and slots that need to be dynamically filled (i.e., placeholders for "{knowledge points}", "{difficulty}", and "{common mistakes}" in the skeleton). For example, the template skeleton for the "filling gaps" intention is "Generate 3 practice questions of {difficulty level} involving {weak knowledge points}, with explanations of common errors."

[0091] The dynamic Prompt template selection mechanism achieves template filtering through semantic vector matching: First, it calls the RoBERTa-based Chinese sentence encoder to convert user profile data (including the distribution of mastered knowledge points, error patterns, etc.) into 512-dimensional user semantic vectors. At the same time, it converts the language structure skeletons of all candidate templates in the structured template library that match the current learning intention category into template semantic vectors. Then, it calculates the cosine similarity between the user semantic vector and the semantic vectors of each candidate template (e.g., the similarity between one candidate template and the user profile is 0.89, and another is 0.72), and selects the template with the highest similarity as the matching template.

[0092] During the slot filling stage, specific information corresponding to the slots is extracted from the user profile data: if the slots of the matching template are "{weak knowledge points}", "{difficulty level}", and "{common mistakes}", then "transformer differential protection", which has an error rate of more than 60% in the user's last 3 answers, is extracted as a weak knowledge point. Based on the user's historical answer accuracy rate (65%), the difficulty level is determined to be "medium". And "misunderstanding of braking characteristic curve", which appears most frequently in the error pattern analysis, is extracted as a common mistake. This information is then filled into the corresponding slots of the matching template to form a natural language Prompt, such as "Generate 3 medium-difficulty practice questions involving transformer differential protection. The explanation should indicate the common reasons for errors (such as misunderstanding of braking characteristic curve)".

[0093] More specifically, first, establish a structured prompt template library, denoted as... Where p i Let p represent the i-th template, and m be the total number of templates in the template library. Each template p i It consists of three components: the first is the applicable intent tag, which indicates which intent category the template is applicable to (e.g., "filling in knowledge gaps", "pre-exam cramming", "concept understanding"); the second is the language structure skeleton, which is the sentence framework of human language prompts, such as "Please generate a multiple-choice question containing {knowledge points}, with an explanation"; and the third is the set of slot positions, which is used to fill in the content based on user characteristics when invoked.

[0094] During model runtime, the user intent recognition module has output the most likely intent category of the current user, denoted as . The system needs to select the template p that best matches the intent category from the template library. * To achieve a more personalized matching effect, this invention further designs a Prompt filtering mechanism based on vector similarity.

[0095] The specific process is as follows: The system generates each template p i Construct a semantic vector This vector is used to represent the structural, purpose, and linguistic intent information contained in the template. It can be obtained by encoding the linguistic portion of the template using a natural language sentence encoder (such as BERT, Sentence-BERT, etc.), or by vectorizing predefined template meta-information. Simultaneously, the system utilizes the user's historical behavior data and current input to construct a semantic vector representing the user's current knowledge state and target needs. This vector takes into account information such as the distribution of knowledge points mastered by the user, the current learning task objectives, and behavioral habits.

[0096] Subsequently, the system calculates the semantic matching score between the user vector and each template vector, using a cosine similarity function for measurement. The matching score formula is as follows:

[0097]

[0098] Among them, s i This indicates the user's current state and the template p. i Match score between them; Represents the dot product of two vectors; ||v u ‖ represents the Euclidean norm of the user vector. This represents the Euclidean norm of the template vector. The matching score reflects how well the template matches the user's current semantic state; a higher score indicates that the template is more suitable for the user's current intent and needs.

[0099] Ultimately, the system selects the template with the highest score as the prompt structure used for this task generation, namely:

[0100]

[0101] Where, p * This indicates the final selected Prompt template, and the arg max operation indicates selecting the index with the highest score.

[0102] Select template p * Then, the system will dynamically fill the slots in the template using specific data from the user's knowledge profile. For example, if the template sentence is "Please generate a relay protection multiple-choice question with difficulty level {level} and involving {knowledge points}", the system will extract the knowledge points that the user has repeatedly made mistakes on in past answers (such as "differential protection principle") and fill them into the slot {knowledge point}. It will also infer the appropriate practice difficulty level (such as "medium" or "difficult") based on the user's current ability level and fill it into the slot {level}, ultimately forming a complete natural language prompt.

[0103] "Please generate a single-choice question on relay protection with a medium difficulty level that involves the principle of differential protection."

[0104] This prompt will serve as an important cue signal for the subsequent input large model generator, guiding it to output relay protection test questions with accurate structure, clear direction, and in line with teaching objectives.

[0105] S04: Based on the natural language Prompt, and combined with the preset RAG knowledge enhancement mechanism, knowledge fragments in the preset relay protection domain knowledge base are retrieved and spliced ​​to obtain the input sequence; wherein, the RAG knowledge enhancement mechanism is obtained based on vectorized encoding and Top-k similarity filtering.

[0106] In a preferred embodiment of this example, the step of retrieving and concatenating knowledge fragments in a preset relay protection domain knowledge base based on the natural language Prompt and a preset RAG knowledge enhancement mechanism to obtain an input sequence is as follows:

[0107] The pre-built knowledge base for relay protection contains structured professional content, covering relay protection regulations, typical fault case analysis, excerpts from device commissioning manuals, and analysis of past exam questions. All content is divided into independent knowledge segments (each segment is controlled to be 200-500 words), and is converted into 768-dimensional segment semantic vectors through an ERNIE-based Chinese encoding model, and stored in a vector database.

[0108] After obtaining the natural language prompt (e.g., "Generate 3 medium-difficulty practice questions involving transformer differential protection, and the analysis should indicate common error reasons (e.g., misunderstanding of braking characteristic curve)"), it is converted into a query semantic vector using the same ERNIE encoding model. Then, the cosine similarity between this query vector and the semantic vectors of all knowledge fragments in the vector database is calculated. For example, the similarity of a fragment "Setting principles and common misconceptions of the braking characteristic curve of transformer differential protection" is 0.87, the similarity of another fragment "Explanation of the clauses on differential protection in GB / T14285-2006" is 0.82, and the similarity of the remaining fragments is all below 0.8.

[0109] According to the Top-k selection rule of the RAG knowledge enhancement mechanism (k=2 in this embodiment), the two knowledge fragments with the highest similarity are selected as target knowledge fragments. Finally, they are concatenated in the order of "Natural Language Prompt + Target Knowledge Fragment 1 + Target Knowledge Fragment 2" to form the input sequence. For example, the concatenated sequence is: "Generate 3 medium-difficulty practice questions involving transformer differential protection. The analysis should indicate common error reasons (such as misunderstanding of the braking characteristic curve). The setting principle and common misconceptions of the braking characteristic curve of transformer differential protection: In the case of faults outside the zone, the increase of the braking current can effectively prevent the protection from maloperating. In practical applications, it is easy to confuse the setting logic of 'braking coefficient' and 'inflection point current'... Explanation of the clauses on differential protection in GB / T 14285-2006: Clause 4.3.2 stipulates that for transformers with a capacity of more than 100MVA, the differential protection should adopt the ratio braking characteristic...". This input sequence contains both the instruction to generate test questions and integrates relevant domain knowledge, providing support for the subsequent generation of professional test questions by the large language model.

[0110] More specifically, to enhance the professionalism and contextual consistency of test question generation, this application introduces a RAG (Retrieval-Augmented Generation) mechanism on top of the Prompt template. By leveraging highly relevant fragments from the domain knowledge base, the input prompts are semantically enhanced, enabling the large language model to not only rely on its own parameter memory when generating test questions, but also to reference real and authoritative legacy knowledge content, thereby significantly improving the accuracy, professionalism, and relevance of the questions.

[0111] In the RAG architecture adopted in this application, after the Prompt template is generated, it will be used to construct the retrieval query vector to interface with the vector space representation of the relay protection knowledge base, thereby retrieving the knowledge fragments most relevant to the user's needs. The entire RAG retrieval process can be divided into three key sub-steps: query construction, knowledge base preprocessing, and vector matching retrieval.

[0112] First, based on the user's intent and the result of the dynamically populated Prompt template, the system generates a complete text request, such as: "Please generate a medium-difficulty multiple-choice question about relay protection principles, along with an explanation." This text is input into a natural language encoding model (such as BERT, Sentence-BERT, MiniLM, etc.) and transformed into a fixed-dimensional vector representation, denoted as the query vector. Where d represents the dimension of the vector, which is usually 256, 512 or 768, etc.

[0113] Meanwhile, the system pre-processed the structured and unstructured knowledge base content in the relay protection field using vectorized encoding. This knowledge base may include chapters from relay protection textbooks, power industry standard documents, analyses of past training questions, power grid operation procedures, case studies, etc., which are divided into multiple logical paragraphs or text fragments, denoted as D = {d1, d2, ..., d...}. n}, and each fragment d is encoded using the same encoding model. i Encode into a vector

[0114] During the retrieval phase, the system calculates the query vector v. q With all knowledge fragment vectors The similarity is used to measure the semantic relevance of each knowledge fragment to the user's request. This invention uses cosine similarity as the similarity function, and its calculation formula is:

[0115]

[0116] in, This represents the semantic similarity between the query vector and the i-th knowledge fragment vector; Represents the dot product of two vectors; ||v q ‖ represents the Euclidean norm (i.e., modulus) of the query vector. This represents the norm of the knowledge fragment vector. The closer this similarity value is to 1, the more similar the two vectors are, and the higher the semantic fit between the corresponding knowledge fragment and the Prompt.

[0117] Based on the aforementioned similarity index, the system selects the k segments from all knowledge segments that are closest to the query vector, forming a knowledge set for generating enhancements, denoted as:

[0118]

[0119] Among them, D top-k This represents the set of the k knowledge fragments with the highest similarity. The arg max operation selects the k most similar fragments from all knowledge fragments, where k is the preset number of augmented fragments, usually between 3 and 5.

[0120] Selected fragment set D top-k This information will be concatenated into the Prompt and input into the large language model as contextual background. This design enables the generative model to reference external knowledge, significantly improving the performance of generated test questions in terms of logical accuracy, terminology usage, and professional background, making it particularly suitable for highly structured and logically rigorous subject content in areas such as relay protection.

[0121] S05: Input the input sequence into a preset large language model to generate relay protection domain test questions; wherein, the large language model is trained based on relay protection domain corpus.

[0122] In a preferred embodiment of this invention, the step of inputting the input sequence into a preset large language model to generate relay protection domain test questions specifically involves:

[0123] The large language model is based on an open-source Chinese pre-trained model and fine-tuned using a professional corpus in the field of relay protection. The domain corpus used for training includes the full text of the "Power System Relay Protection Regulations," transformer / line protection device commissioning manuals, past ten years' relay protection exam questions and analyses, and a typical fault handling case library, totaling approximately 5 million characters. The fine-tuning process employs a mini-batch gradient descent method with a batch size of 16 and a learning rate of 2e^(-1 / 2). -5 The training rounds consist of 30 rounds to ensure that the model fully learns the professional terminology, logical rules, and question expression style in the field of relay protection.

[0124] When an input sequence (such as a concatenated text containing natural language prompts and related knowledge fragments) is fed into the large language model, the model first parses the instruction portion of the input sequence to clarify the test question generation objective. For example, from the objective of "generating 3 medium-difficulty practice questions involving transformer differential protection, with explanations of common error causes," the model extracts key parameters such as "question type: practice questions," "knowledge point tested: transformer differential protection," "difficulty level: medium," "number: 3 questions," and "explanations must include common error causes." Subsequently, the model calls the built-in domain knowledge extraction module to filter out professional information related to the objective from the knowledge fragments of the input sequence, such as "braking characteristic curve setting principles" and "relevant clauses of GB / T 14285-2006," as the knowledge basis for test question generation.

[0125] During the question generation phase, the model uses an autoregressive generation method to output content for each question: First, it generates the question stem, designing a scenario-based description around the "braking characteristics of transformer differential protection" (e.g., "A 220kV transformer differential protection malfunctions during an external fault. Its braking characteristic curve inflection point current is set to 1.2 times the rated current, and the braking coefficient is 0.3. Analyze the possible reasons"). Then, it generates four options, one of which is the correct option corresponding to the standard content in the knowledge fragment, and the other three distractors are designed based on common error patterns (e.g., confusing the value range of "braking coefficient" and "reliability coefficient"). Subsequently, it provides the correct answer and explanation. The explanation needs to combine the retrieved knowledge fragment to explain the principle (e.g., citing the regulations to explain the reasonable setting range of the inflection point current) and mark common error reasons (e.g., "mistakenly setting the inflection point current to less than 0.8 times the rated current, resulting in insufficient braking capacity").

[0126] Once generated, the model uses a built-in verification module to check the compliance of the questions, ensuring that the question stems are unambiguous, the option settings conform to the logic of relay protection, and the analysis is consistent with domain knowledge. Finally, it outputs complete relay protection domain questions, forming learning materials that meet the user's intent.

[0127] After completing user intent recognition, dynamic prompt template construction, and knowledge-enhanced fragment retrieval, this application employs a Large Language Model (LLM) as the core generation engine. Based on the input personalized prompt and its corresponding knowledge-enhanced content, it automatically generates relay protection professional test texts that conform to the user's learning intent. The goal of this application is to achieve high-quality, structurally complete, and stylistically consistent question output, covering multiple components such as the question stem, options, answers, and explanations, while also possessing good contextual consistency and correct professional terminology.

[0128] The input to LLM consists of two parts: first, a natural language prompt after intent recognition and template filling; and second, a set of highly relevant knowledge fragments D selected from the RAG mechanism. top-k The system concatenates these two parts into a complete input text, which is constructed as follows:

[0129] X = [Prompt||D top-k ]

[0130] Where X represents the complete sequence ultimately used to input the language model, and the symbol || represents the text concatenation operation, which connects the Prompt with multiple knowledge fragments in sequence to form a continuous input.

[0131] Subsequently, the concatenated input X is fed into a pre-trained large language model, such as ChatGLM, GPT-3.5, GPT-4, or other LLM architectures with specialized contextual understanding capabilities. The model's goal is to generate test text T that meets semantic expectations based on this input. This generation process can be formalized as a conditional text generation problem, with the modeling objective being to maximize the following conditional probabilities:

[0132]

[0133] Where T represents the final generated test question text; P(T|X) represents the conditional probability distribution of the model output sequence T given the input sequence X; This means selecting the sequence with the highest probability from all possible outputs.

[0134] In actual reasoning, this generation process is achieved by word-by-word prediction by the model, that is:

[0135]

[0136] Among them, w t P(w) represents the t-th word or token in the generated sequence, where n represents the final number of words generated; t |w1,…,w t-1 (x) represents predicting the next word w given the first t-1 tokens and the input X. t The probability of this. This formula reflects the autoregressive generative nature of the language model.

[0137] To ensure the controllability and consistency of the generated content, this application explicitly prompts key information such as question type, knowledge point, and difficulty level in the Prompt section, and provides contextual knowledge background in the knowledge enhancement section. This allows the model to focus on the target topic during the generation process, reducing semantic deviation and improving generation accuracy. For example, when the user's intention is "exam preparation" and specifies "transformer differential protection" as the knowledge point, the large model Prompt input by the system will explicitly require the generation of a multiple-choice question on that topic, and the output should include the question stem, options, correct answer, and brief explanation.

[0138] The structure of the generated style is as follows:

[0139] Question type: Multiple choice

[0140] Question: Regarding the operating characteristics of differential protection, which of the following statements is correct?

[0141] A. The smaller the differential current, the faster the operating speed;

[0142] B. It will only activate in the event of an internal malfunction;

[0143] C. External faults will directly trigger a trip;

[0144] D. The direction of the current will not affect the differential criterion;

[0145] Correct answer: B.

[0146] Explanation: The basic principle of differential protection is to determine whether there is a fault inside the transformer. It only operates when the difference between the inflow and outflow current exceeds a set value (i.e., an internal fault); external faults should be prevented from operating by the section selection.

[0147] The generated results include not only the question stem, but also reasonable distractors, standard answers, and explanation text. This content can be used as input to the subsequent evaluation system or as training data for the optimization module.

[0148] Regarding model invocation strategies, this application supports multiple invocation modes, including basic single-round invocation, diversified output generation based on top-ksampling or nucleus sampling (top-p) strategies, and generation modes that switch between different temperature parameters according to user settings (such as "conservative generation" or "innovative generation"). For example, if the temperature parameter is used to control the randomness of generation, the word generation probability at each step will be adjusted as follows:

[0149]

[0150] Wherein, P′(w t ) represents the sampling probability of the t-th token under temperature parameter adjustment; T is the temperature parameter, which usually ranges from 0.5 to 1.5. The larger T is, the more random the generation is, and the smaller T is, the more certain the generation is.

[0151] The final generated test question T is processed by a standardized structure and then pushed to the user interface, or used in subsequent question feedback collection and reinforcement learning optimization modules.

[0152] Furthermore, after generating the relay protection domain test questions, the process also includes:

[0153] Obtain user feedback data on their answers to the test questions in the field of relay protection;

[0154] Based on the answer feedback data and combined with the preset reinforcement learning feedback mechanism, the user intent recognition model and the dynamic Prompt template selection mechanism are optimized to obtain the optimized user intent recognition model and the optimized dynamic Prompt template selection mechanism.

[0155] More specifically, the reinforcement learning problem is modeled as an expectation-maximization task with a policy network. The policy model is set to π. θ (a|s), where θ are the trainable parameters of the policy model, s represents the current state (such as user behavior profile, intent prediction result, Prompt template used, etc.), and a represents the action taken (such as selecting a Prompt template or a generation policy). Then the objective function of reinforcement learning is:

[0156]

[0157] in, This represents maximizing the expected reward under the current policy distribution; r is the feedback reward value after the user answers the question, representing the overall quality of the learning effect produced by a single interaction.

[0158] In practical implementation, the reward signal r is not directly obtainable, but is composed of multiple observed variables. In this application, the reward function is designed as follows:

[0159]

[0160] Where 'a' represents the user's accuracy rate in answering the current question; 't' represents the time taken to complete the question; and 'T' represents the time taken to complete the question. max The system sets the maximum allowed answering time for this question type; 's' represents the user's satisfaction rating for the generated question, which can be derived from explicit scoring or implicit behavior (such as time spent viewing the explanation, skipping rate, etc.); 'f' indicates whether the user has corrected their errors in this question (e.g., answered correctly after an initial error); α1, α2, α3, and α4 are the weighting coefficients for each indicator, used to balance the influence of different feedback signals. These weights can be obtained through experimental optimization or learned from data.

[0161] This reward value will be used as a reinforcement signal input into the policy optimization process. Regarding the parameter update method, this invention can employ the classic Policy Gradient method for optimization, with the basic update formula as follows:

[0162]

[0163] Where J(θ) represents the expected return function of the strategy under the current parameters; θ is the gradient term of the policy logarithm, representing the sensitivity of the current policy to choosing this action; r is the corresponding actual reward signal. The gradient ascent method can be used to continuously adjust the policy parameters θ, thereby increasing the probability of choosing the optimal Prompt or policy in the current state.

[0164] In this step, the input data consists of the test questions output from step four and the user's actual answering behavior data. After reward function calculation and policy gradient optimization, the output is the updated user intent recognition model and Prompt template selection strategy. This output will directly affect the next round of test question generation, thereby achieving closed-loop optimization of "user feedback driving system adaptive evolution". Through this design, the system continuously improves its responsiveness to user learning needs and the matching degree of generated content in multiple rounds of interaction, ultimately forming a dynamically evolving intelligent question bank generation framework.

[0165] In practical implementation, the enhanced feedback of this application can be applied to the following two sub-modules respectively:

[0166] First, optimize the intent recognition model to enhance its discriminative ability in scenarios with ambiguous boundaries or multiple intents. The reinforcement signal will be fed back into the loss function of the intent classification model, combining with the supervised learning objective to form a multi-objective optimization process.

[0167] Second, the prompt template selection strategy is optimized to gradually favor templates that provide higher learning feedback. The system records the historical average reward of different prompts under different intent categories and adjusts the selection probability based on the policy network, prioritizing high-feedback templates.

[0168] Furthermore, to prevent the model from overfitting to short-term user preferences or getting trapped in local optima in the early stages of reinforcement learning, this invention introduces an ε-greedy strategy in the initial stages of reinforcement learning. This involves randomly selecting an action with probability ε and choosing the current optimal strategy with probability 1-ε. As the number of training iterations increases, ε is gradually decreased, achieving a smooth transition from exploration to exploitation.

[0169] The entire reinforcement and optimization process will continuously interact with the user as part of the model service, forming the following closed-loop path: user answers questions → system records feedback → calculates rewards → updates intent recognition and template selection strategies → generates better questions for the next round → user answers questions again. This cycle can be triggered periodically daily, weekly, or based on the number of questions answered, and can also support online streaming updates, ensuring that the model remains highly sensitive to the user's learning status.

[0170] like Figure 2 As shown, Figure 2 The execution flow of the adaptive test question generation method in the relay protection field is demonstrated: Starting from "beginning", in step S1, a user intent recognition model is constructed based on multi-source information such as user answer data, search behavior, profile, and natural language requests, and user intent labels are output. Then, in step S2, a dynamic prompt template is generated and matched based on the intent. Next, in step S3, relevant knowledge fragments in the relay protection knowledge base are retrieved through the RAG knowledge enhancement retrieval mechanism and concatenated with the dynamic prompt to form enhanced input. Then, in step S4, the enhanced input is fed into the large language model to generate relay protection test questions. Finally, in step S5, through a multi-round reinforcement learning feedback optimization mechanism, the user intent recognition model and the dynamic prompt template selection mechanism are optimized using user answer history feedback, forming a closed loop of "generation-feedback-optimization", and finally completing the process and outputting the optimized system module.

[0171] In summary, this application comprehensively understands users' learning status and needs by acquiring multi-source learning data, including answer behavior data, search request data, user profile data, and natural language learning demand data. This data is input into a pre-defined user intent recognition model. This model constructs a multi-classification task based on user behavior feature vectors and is trained using cross-entropy as the loss function, thereby accurately identifying the user's current learning intent category. Based on the identified learning intent category, this application uses a pre-defined dynamic Prompt template selection mechanism to filter matching templates from a structured Prompt template library and fills the slots in the templates with user profile data to generate a natural language Prompt. Furthermore, a pre-defined RAG knowledge enhancement mechanism is used to retrieve and concatenate knowledge fragments in the relay protection domain knowledge base to obtain the input sequence. This mechanism, based on vectorized encoding and Top-k similarity filtering calculations, ensures the relevance and accuracy of the knowledge fragments. Finally, the input sequence is input into a pre-defined large language model, which is trained on relay protection domain corpora and can generate high-quality relay protection domain test questions that match the user's learning intent. This process not only enables personalized and dynamic optimization of test question generation, but also enhances the professionalism and accuracy of the generated content through the RAG knowledge enhancement mechanism, thereby effectively solving the problem that existing technologies cannot accurately and efficiently generate relay protection test questions.

[0172] Example 2

[0173] Please refer to Figure 3 This is an adaptive test question generation device provided in the embodiments of this application.

[0174] In this embodiment, the adaptive test question generation device includes an acquisition module 10, a category recognition module 20, a template matching module 30, a retrieval module 40, and a test question generation module 50.

[0175] The acquisition module 10 is used to acquire the user's multi-source learning data; the multi-source learning data includes answer behavior data, search request data, user profile data, and natural language learning demand data;

[0176] The category recognition module 20 is used to input the multi-source learning data into a preset user intent recognition model to obtain the user's current learning intent category; wherein, the user intent recognition model is a multi-classification task constructed based on user behavior feature vectors and trained with cross-entropy as the loss function;

[0177] The template matching module 30 is used to filter matching templates from the structured Prompt template library based on the learning intent category through a preset dynamic Prompt template selection mechanism, and fill the slot positions in the matching templates with user profile data to obtain a natural language Prompt.

[0178] The retrieval module 40 is used to retrieve and splice knowledge fragments in a preset relay protection domain knowledge base based on the natural language Prompt and a preset RAG knowledge enhancement mechanism to obtain an input sequence; wherein, the RAG knowledge enhancement mechanism is based on vectorized encoding and Top-k similarity filtering.

[0179] The test question generation module 50 is used to input the input sequence into a preset large language model to generate test questions in the relay protection domain, wherein the large language model is trained based on relay protection domain corpus.

[0180] For ease of description and brevity, the embodiments of the device of the present invention include all the implementation methods described in the above-described adaptive test question generation method embodiments, and will not be repeated here.

[0181] Example 3:

[0182] This application provides a computer-readable storage medium, which includes a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the adaptive test question generation method.

[0183] The adaptive test question generation method, when implemented as a software functional unit and used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0184] Example 4

[0185] This embodiment provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements any of the adaptive test question generation methods described in Embodiment 1.

[0186] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. An adaptive test generation method, characterized by, The method comprises the following steps: obtaining multi-source learning data of a user; the multi-source learning data comprises answer behavior data, search request data, user portrait data and natural language learning demand data; inputting the multi-source learning data into a preset user intention recognition model to obtain a current learning intention category of the user; wherein the user intention recognition model is constructed based on a user behavior feature vector for a multi-classification task, and is trained by using cross-entropy as a loss function; based on the learning intention category, a matching template is screened from a structured Prompt template library through a preset dynamic Prompt template selection mechanism, and a slot position in the matching template is filled in combination with user portrait data to obtain a natural language Prompt; according to the natural language Prompt, knowledge fragments in a preset relay protection field knowledge base are retrieved and spliced in combination with a preset RAG knowledge enhancement mechanism to obtain an input sequence; wherein the RAG knowledge enhancement mechanism is obtained based on vectorization encoding and Top-k similarity screening; inputting the input sequence into a preset large language model to generate a relay protection field test question; wherein the large language model is trained based on relay protection field corpus.

2. The adaptive test generation method of claim 1, wherein, After generating the relay protection field test question, the method further comprises the following steps: obtaining answer feedback data of the user based on the relay protection field test question; based on the answer feedback data, the user intention recognition model and the dynamic Prompt template selection mechanism are optimized in combination with a preset reinforcement learning feedback mechanism to obtain an optimized user intention recognition model and an optimized dynamic Prompt template selection mechanism.

3. The adaptive test generation method of claim 1, wherein, The method of obtaining multi-source learning data of a user comprises the following steps: obtaining answer behavior data of the user from a preset answer record storage system; the answer behavior data comprises a correct rate, an error rate, an average answer time and a question type distribution of a preset number of recent answers; obtaining search request data of the user from a preset search log collection system; the search request data comprises a search keyword input by the user, a text length of a query intention and an association strength between the keyword and a relay protection field knowledge point; obtaining user portrait data of the user from a preset user information management system; the user portrait data comprises a total learning time of the user, a distribution of mastered relay protection knowledge points and an error mode in an answer process; receiving natural language learning demand data input by the user through an interactive interface; the natural language learning demand data comprises a relay protection learning goal described by the user; the extracted answer behavior data, search request data, user portrait data and received natural language learning demand data are preprocessed to obtain the multi-source learning data.

4. The adaptive test generation method of claim 1, wherein, The method of inputting the multi-source learning data into a preset user intention recognition model to obtain a current learning intention category of the user comprises the following steps: the multi-source learning data is converted into a user behavior feature vector; the user behavior feature vector integrates numerical features of the answer behavior data, association features of the search request data, distribution features of the user portrait data and semantic vector features of the natural language learning demand data; input the user behavior feature vector into the user intention recognition model, so that the user intention recognition model performs feature extraction and classification calculation on the user behavior feature vector based on a shallow neural network or a lightweight Transformer structure; and through the built-in softmax function, the classification calculation result is converted into a probability distribution of each preset learning intention category; select the category with the maximum probability value from the probability distribution as the current learning intention category of the user for output; wherein the preset learning intention category includes leakage filling, pre-examination sprint, concept understanding, practical operation training and competition preparation.

5. The adaptive test generation method of claim 1, wherein, Based on the learning intention category, a matching template is selected from a structured Prompt template library through a preset dynamic Prompt template selection mechanism, and the slot positions in the matching template are filled in combination with user portrait data to obtain a natural language Prompt, specifically: Each template in the structured Prompt template library includes an applicable intention label, a language structure skeleton and a slot position set; the applicable intention label corresponds one-to-one to the learning intention category; the language structure skeleton is a sentence pattern framework consistent with the expression habit in the relay protection field; Based on the current learning intention category of the user and the preset dynamic Prompt template selection mechanism, a template with an applicable intention label consistent with the learning intention category is selected from the structured Prompt template library as a candidate template; Wherein, the dynamic Prompt template selection mechanism is based on semantic vector similarity calculation; Through a preset natural language sentence encoder, the language structure skeleton of each candidate template is converted into a template semantic vector, and the user portrait data is converted into a user semantic vector; Calculate the semantic similarity of the user semantic vector and each candidate template semantic vector; select the candidate template with the highest semantic similarity as the matching template; extract the relay protection knowledge points that the user has made errors for a preset number of times and the test question difficulty level corresponding to the current ability level of the user from the user portrait data; fill the extracted relay protection knowledge points and test question difficulty level into the corresponding slot positions of the matching template to obtain the natural language Prompt.

6. The adaptive test generation method of claim 1, wherein, According to the natural language Prompt, in combination with a preset RAG knowledge enhancement mechanism, knowledge fragments in a preset relay protection domain knowledge base are retrieved and spliced to obtain an input sequence, specifically: convert the natural language Prompt into a query semantic vector through a preset natural language encoding model; The preset relay protection domain knowledge base includes a plurality of independent knowledge fragments, and each knowledge fragment is converted into a fragment semantic vector through the natural language encoding model; Calculate the semantic similarity of the query semantic vector and each fragment semantic vector; sort the calculated semantic similarity in descending order, and select the top preset number of knowledge fragments as target knowledge fragments; The natural language Prompt and each target knowledge fragment are spliced in the order of natural language Prompt first and target knowledge fragment last to obtain an input sequence.

7. The adaptive test generation method of claim 1, wherein, The input sequence is input into a preset large language model to generate a relay protection field test question. The input sequence is input into a preset large language model; the large language model first analyzes the natural language Prompt in the input sequence, determines the test question generation target, then extracts the relay protection field information of the target knowledge segment in the input sequence, and generates a relay protection field test question containing the stem, options, correct answer and analysis step by step. The test question generation target includes test question type, examined relay protection knowledge points and test question difficulty level.

8. An adaptive test generation apparatus, characterized by comprising: It includes: An acquisition module for acquiring multi-source learning data of a user; The multi-source learning data includes answer behavior data, search request data, user portrait data and natural language learning demand data; A category identification module for inputting the multi-source learning data into a preset user intent recognition model to obtain the current learning intent category of the user; wherein the user intent recognition model is constructed based on user behavior feature vectors for a multi-classification task, and is trained based on cross-entropy as a loss function; A template matching module for selecting a matching template from a structured Prompt template library based on the learning intent category through a preset dynamic Prompt template selection mechanism, and filling the slot positions in the matching template combined with the user portrait data to obtain a natural language Prompt; A retrieval module for retrieving and splicing knowledge segments in a preset relay protection field knowledge base based on the natural language Prompt combined with a preset RAG knowledge enhancement mechanism to obtain an input sequence; wherein the RAG knowledge enhancement mechanism is obtained based on vectorization encoding and Top-k similarity filtering; A test question generation module for inputting the input sequence into a preset large language model to generate a relay protection field test question, wherein the large language model is trained based on relay protection field corpus.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the adaptive test question generation method of any one of claims 1 to 7.

10. A terminal device, comprising: It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor executes the computer program to implement the adaptive test question generation method of any one of claims 1 to 7.

Citation Information

Cited By

  • Automatic proposition method and system based on structural knowledge resources and reasoning track verification

    CN122347126A