Methods, apparatus, equipment, and media for generating auxiliary information for code answer questions.

By utilizing large language models for intent recognition and code annotation within a programming education platform, accurate code answer responses are generated, addressing the challenges of teachers' ability threshold and time cost in answering code questions, and improving the accuracy and efficiency of responses.

CN122087047APending Publication Date: 2026-05-26BEIJING SIMING QICHUANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610132014.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-30
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

The programming education platform cannot accurately locate code errors and provide reasons, and teachers need a high level of ability to answer questions, which takes a long time, resulting in the inability to provide accurate answers in a timely manner.

Method used

By acquiring code description information and user questions, and using a large language model for intent recognition, accurate response content is generated by combining code comment information and question-related data, including judgment results and historical conversations, to assist teachers in answering student questions.

Benefits of technology

It improved the accuracy and efficiency of answering questions, and reduced the difficulty and time cost for teachers to solve code problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122087047A_ABST
    Figure CN122087047A_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and medium for generating auxiliary information for code answer questions. The method includes: acquiring code description information and a user question provided by a first user, wherein the code description information includes a code question and a corresponding code answer; the user question includes a question raised by a second user related to the code description information; acquiring annotation information of the code answer; performing intent recognition on the user question to obtain a user intent; and determining the corresponding response content for the user question based on the user intent, the code description information, and the annotation information. Embodiments of this invention can provide accurate response content for questions raised in response to answers to code questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet technology, and in particular to a method, apparatus, device, and medium for generating auxiliary information for code answer questions. Background Technology

[0002] In the programming education platform, students can learn and be assessed on programming. During the assessment, students input code answers to questions, and the platform can evaluate the code answers, indicating whether the code answer passes the assessment and identifying any errors in the code answer.

[0003] When students have questions about the code and need teacher guidance, they send the code and their questions to the teacher. During the guidance process, the teacher provides answers based on the information provided by the system and their own abilities, guiding students to answer correctly. This is an important part of programming teaching.

[0004] Currently, programming education platforms cannot pinpoint errors or provide reasons for them. Teachers need a high level of skill and considerable time to think before answering these questions, making it difficult to provide accurate answers promptly. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and medium for generating auxiliary information for code answer questions, which can provide accurate response content to questions raised in response to code questions.

[0006] According to one aspect of the present invention, an embodiment of the present invention provides a method for generating auxiliary information for code answer questions, the method comprising: Obtain code description information and user questions provided by a first user. The code description information includes a code question and the corresponding code answer. The user questions include questions raised by a second user that are related to the code description information. Obtain the comment information for the code answer; The user's question is subjected to intent recognition to obtain the user's intent; Based on the user intent, the code description information, and the comment information, determine the response content corresponding to the user question.

[0007] According to another aspect of the present invention, embodiments of the present invention also provide an apparatus for generating code answer question auxiliary information, the apparatus comprising: The question acquisition module is used to acquire code description information and user questions provided by a first user. The code description information includes a code question and the corresponding code answer. The user questions include questions raised by a second user that are related to the code description information. The code comment module is used to obtain comment information for the code answer; The intent recognition module is used to recognize the intent of the user's question and obtain the user's intent. The response generation module is used to determine the response content corresponding to the user question based on the user intent, the code description information, and the annotation information.

[0008] According to another aspect of the present invention, embodiments of the present invention also provide a device for generating code answer question auxiliary information, the device comprising: At least one processor; and A memory that is communicatively connected to at least one processor; wherein, The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to execute the method for generating code answer question assistance information according to any embodiment of the present invention.

[0009] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute a method for generating code answer question auxiliary information according to any embodiment of the present invention.

[0010] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the method for generating code answer question auxiliary information as described in any embodiment of the present invention.

[0011] The technical solution of this invention obtains a code question, the corresponding code answer, and a user question provided by a first user. It adds annotation information to the code answer, identifies the user's intent in the question, and obtains the response content based on the user intent, the code question, the code answer, and the annotation information. This allows for accurate responses to questions raised in response to code questions, solving the problem in existing technologies where teachers need a high level of ability and considerable time to think, leading to delays in providing accurate answers. The invention provides teachers with annotation and response information to assist them in answering student questions, improving the accuracy and efficiency of question responses.

[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a flowchart of a method for generating code answer question auxiliary information according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a page displaying code questions and answers according to an embodiment of the present invention; Figure 3 This is a schematic diagram of an interactive page for a method of generating code answer question auxiliary information according to an embodiment of the present invention; Figure 4 This is a flowchart of another method for generating code answer question auxiliary information according to an embodiment of the present invention; Figure 5 This is a scenario diagram of a method for generating auxiliary information for code answer questions according to an embodiment of the present invention; Figure 6 This is a structural diagram of a device for generating code answer question auxiliary information according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a device for generating code answer question auxiliary information provided in an embodiment of the present invention. Detailed Implementation

[0015] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0016] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0017] The acquisition, storage, and application of driving trajectory points and other related technologies in the technical solutions of this invention comply with relevant laws and regulations and do not violate public order and good morals.

[0018] Figure 1 This is a flowchart illustrating a method for generating code answer question assistance information according to an embodiment of the present invention. This embodiment is applicable to situations where users providing programming education services are answering questions provided by students, where the question is a question posed by the system after the student inputs a code answer to a programming problem. This method can be executed by a code answer question assistance information generation device, which can be implemented in hardware and / or software. This device can be configured within an intelligent agent invoked by the programming education platform. The intelligent agent invokes a large language model to implement functions such as code annotation, code intent recognition, and response content generation.

[0019] See Figure 1 The method for generating auxiliary information for the code answer questions shown includes: S101. Obtain code description information and user questions provided by the first user. The code description information includes code questions and corresponding code answers. The user questions include questions raised by the second user that are related to the code description information.

[0020] In this context, a user question can be initiated by the first user, or it can be initiated by another user and forwarded by the first user. When a user question is initiated by a user other than the first user, the first user can refer to the user who replies to the user question. Additionally, when a user question is initiated by a user other than the first user, the first user can optimize the user question based on experience, making it clearer, more explicit, and more complete. In this case, the intent of the user question is still that of another user.

[0021] In this embodiment of the invention, the first user can refer to the user providing programming education services. Code description information can refer to information associated with the code that needs to be solved, which is information input by the user receiving programming education. User questions can refer to questions related to the code description information. User questions can be information directly input by the user receiving programming education, or information proposed by the user receiving programming education and indirectly input by the user providing programming education services. Code problems can refer to problems in the code practice or assessment process. The second user is different from the first user. The second user can be a student user. In some embodiments, code problems can refer to practice or assessment problems that require writing code to solve. Code answers can refer to the answers input by the user receiving programming education when solving the code problems.

[0022] In some embodiments, students answer code questions provided by a programming education platform, inputting code answers. The programming education platform provides students with programming knowledge data (e.g., knowledge text, knowledge graphs, and knowledge videos), programming application software, programming question banks, and human assistance. The platform judges the code answers based on the knowledge points of the code questions and provides the judgment results back to the students. The judgment results include whether the code answer passed the assessment and may also include any errors. If students have questions about the judgment results, they submit user questions to a first user and provide code description information. The first user inputs the user questions and code description information into the code answer question assistance information generation system implemented in this embodiment of the invention. In some examples, user questions may include at least one of the following: incorrect answer, compilation error, boundary problem, time limit problem, and memory limit problem.

[0023] In an optional embodiment, the user question includes: the code answer is the answer provided by the second user to the code question.

[0024] In this process, the second user solves the code problem by inputting the code answer and then poses a question based on the code problem and the answer. The code answer can refer to the code snippet entered by the second user in response to the code problem. The second user then sends the code problem, the code answer, and the user question to the first user, seeking a response from the first user regarding the user question.

[0025] In some embodiments, a user question may be asking other questions related to the code answer. For example, a user question may be asking how to optimize the code answer. Another example is asking about the principles behind the standard answer to a code problem. Yet another example is asking if there are other extended answers.

[0026] It is evident that by limiting the code description information and user questions to the input data of a second user, the method of generating auxiliary information for code answer questions can be applied to the application scenario where students ask teachers questions about code answers. By determining the response content for the user questions raised by students based on the code description content, teachers can quickly provide detailed and accurate auxiliary information for answering their questions, provide them with rich information related to the answers, simplify the difficulty of answering questions, and improve the efficiency of answering questions.

[0027] The method and system for generating code answer question assistance information implemented in this invention can interact with a programming education platform. In some embodiments, the system has an entry point configured on the programming education platform. A first user can directly use the system's services from the programming education platform. This system may be accessible only to the first user and not to second users; that is, the first user has permission to use the system, while the second user does not. The first user can directly access the programming education platform's question bank to obtain code questions and the second user's code answers for those questions. Furthermore, the second user can also ask the first user questions based on code questions and answers not available on the programming education platform.

[0028] In some embodiments, the programming education platform can be made available to a second user. The second user can also directly access the platform's Q&A page via its interface, input code descriptions, and receive responses. This direct access to the response reduces the burden on the first user.

[0029] In some embodiments, the first user can directly provide code description information. In some embodiments, the first user can indirectly provide code description information through resource location information. In an optional embodiment, obtaining the code description information provided by the first user includes: obtaining resource location information provided by the first user; the resource location information is used to point to resources in the code-solving system; obtaining the code description information pointed to by the resource location information; obtaining the answer identifier provided by the first user; querying the code description information corresponding to the answer identifier from the code-solving system; or obtaining the code description information provided by the first user.

[0030] The resource location information refers to the storage location of the code questions and answers in the code-solving system. The code-solving system is a programming education platform used to provide students with programming problems. The resource location information can include links to the code questions and answers within the system. Users can directly access the resource location information to navigate to a page containing the code questions and answers, which are then displayed according to the links provided.

[0031] In some embodiments, the first user can, for example, Figure 2 The page shown includes code questions and answers, triggering the target control ( Figure 2 The button area for intelligent parsing redirects to an interactive page that generates code answer question assistance information. This interactive page can be a service page provided by the system of the code answer question assistance information generation method implemented in this embodiment of the invention. Figure 3 As shown, the interactive page includes a dialogue area where users can input questions. Simultaneously, the interactive page sends the code question and answer from before the redirection as code description information to the system of the code answer question assistance information generation method implemented in this embodiment of the invention. Alternatively, the first user can send resource location information again in the input area. The system of the code answer question assistance information generation method implemented in this embodiment of the invention can interact with the code-solving system through resource location information to obtain code description information fed back by the code-solving system based on the resource location information. Furthermore, the dialogue area may also include a conversation area displaying the dialogue content between the first user and the system of the code answer question assistance information generation method implemented in this embodiment of the invention. The conversation content may include the first user's input and the system's response, etc.

[0032] Answer identifiers are used in the code-solving system to identify code description information, specifically identifying the code question and its answer. The system is accessible to multiple students, all of whom can attempt the code question, but their answers will differ. Answer identifiers distinguish between code questions attempted by different students and the corresponding answers provided. When a student enters an answer to a code question, the system generates an answer identifier for that answer, allowing the system to retrieve both the code question and its answer. Different questions have different answer identifiers, and different second-user answers have different identifiers. Even the same second-user may have different answer identifiers for different rounds of input on the same question.

[0033] In some embodiments, the first user is redirected to an interactive page for generating code answer question assistance information. The first user enters a user question and an answer identifier in the input area. The system of the code answer question assistance information generation method implemented in this embodiment receives the answer identifier and interacts with the code-solving system to obtain the code description information queried by the code-solving system based on the answer identifier.

[0034] The second user can also directly input code description information and send it to the first user. The second user can send the code description information to the first user through the user interface of the code-solving system, or through other interactive pages. Typically, this code description information comes from a data source outside the code-solving system. The first user can directly forward the code description information.

[0035] In some embodiments, the first user is redirected to an interactive page for generating code answer question assistance information, where the first user enters user questions and code description information in the input area.

[0036] Resource location information can directly locate code description information within the code-solving system, while answer identification requires querying code description information within the same system. Both resource location information and answer identification are used in question-and-answer scenarios targeting code description information from the code-solving system. Directly sent code description information is used in question-and-answer scenarios involving code description information from other data sources different from the code-solving system. These three methods acquire code description information from both the extended functionality and general response functionality of the code-solving system, enriching the sources of code description information.

[0037] It is evident that by obtaining code description information from the code-based problem-solving system through resource location information and answer identifiers, interaction with the system can be achieved, thereby expanding its functionality and adding auxiliary question-and-answer reply capabilities. Furthermore, by directly obtaining code description information, the scenarios for auxiliary question-and-answer replies can be expanded, increasing the availability of general auxiliary question-and-answer replies based on code description information, enriching the sources of code description information, and improving the generalization ability of auxiliary question-and-answer replies based on code description information.

[0038] S102. Obtain the comment information of the code answer.

[0039] The comments can refer to explanatory text for the code answer, explaining its function, purpose, and implementation logic. The code answer may include at least one line of code. The comments include comment text for at least one line of code. Specifically, the comments may include comment text for each line of code, or comment text for a portion of the code.

[0040] In some embodiments, the code answer and comment information are as follows: Line 1 code / / Comment text Line 2 code / / Comment text S103. Perform intent recognition on the user question to obtain the user intent.

[0041] User intent can refer to the true purpose and need indicated by a user's question. User intent is used to accurately convert ambiguous natural language into explicit instructions that can be executed and recognized by a machine. In some embodiments, the user question can be input into a large language model to obtain the user intent output by the large language model. In some embodiments, the large language model encodes the input user question to obtain a feature vector, and then decodes the feature vector to obtain the user intent. In some embodiments, the user question can be input into a classification model to obtain a classification result, and the classification result is determined as the user intent.

[0042] S104. Determine the response content corresponding to the user question based on the user intent, the code description information, and the comment information.

[0043] The user intent is used to provide the user's question. The code description question is used to provide the question the user intent points to. The comment information is used to provide explanations of the code answer. The user intent, code description information, and comment content can be input into the large language model to obtain the response content output by the large language model. In some embodiments, the large language model encodes the input content to obtain a feature vector, and decodes the feature vector to obtain the response content.

[0044] The technical solution of this invention obtains the code question, the corresponding code answer, and the user's question provided by a first user, as well as the comment information of the code answer. It then performs intent recognition on the user's question to obtain the user's intent. Based on the user's intent, the code question, the code answer, and the comment information, it obtains the response content. This enables the provision of accurate responses to questions raised in response to code questions. It solves the problem in the prior art that teachers need a high level of ability and a long time to think when answering questions, which makes it difficult to provide accurate answers in a timely manner. It can provide teachers with comment information and response information to assist them in answering student questions and improve the accuracy and efficiency of question responses.

[0045] Figure 4This is a flowchart illustrating a method for generating code answer question assistance information according to an embodiment of the present invention. Based on the above embodiments, this embodiment determines the response content corresponding to the user question according to the user intent, the code description information, and the annotation information. Specifically, this involves: querying question-related information based on the code question, the question-related information including: question knowledge and / or the question's standard answer; obtaining judgment information associated with the code answer, the judgment information including at least one of the following: judgment result, error information, and error example; obtaining historical sessions; adding the user intent, the code description information, the annotation information, the question-related information, the judgment information, and the historical sessions to a code question-and-answer prompt template to obtain code question-and-answer input data; and inputting the code question-and-answer input data into a large language model to obtain the response content corresponding to the user question.

[0046] It should be noted that for parts not described in detail in the embodiments of the present invention, please refer to the descriptions in other embodiments.

[0047] See Figure 4 The method for generating auxiliary information for the code answer questions shown includes: S401. Obtain code description information and user questions provided by the first user. The code description information includes code questions and corresponding code answers. The user questions include questions raised by the second user that are related to the code description information.

[0048] S402. Obtain the comment information of the code answer.

[0049] S403. Perform intent recognition on the user question to obtain the user intent.

[0050] S404. Based on the code question, query the question association information, which includes: question knowledge and / or question standard answer.

[0051] The question-related information is used to aid in understanding the question information. Question knowledge can refer to the knowledge points tested in the question, or the knowledge required to solve the coding question. The standard answer to the question can be the correct answer to the coding question. The standard answer includes standard code. There can be at least one standard answer. The question-related information corresponding to a coding question can be queried in the coding question system. When question knowledge is found, it is identified as question-related information. When a standard answer is found, it is identified as question-related information. Additionally, question-related information may also include: coding mode, time limit, space limit, and judging mode. Judging modes may include normal judging, special judging, interactive judging, and subtask judging modes.

[0052] S405. Obtain the judging information associated with the code answer, wherein the judging information includes at least one of the following: judging result, error information, and error example.

[0053] The judgment information refers to whether the code answer passes the assessment of the code question. In some implementation sets, the code-solving system judges the correctness of the code answer and obtains judgment information. Judgment information can be obtained from the code-solving system. The judgment result refers to the result of judging whether the code answer is correct. Error information refers to information about the errors in the code answer when it is incorrect. Error information only includes the existence of errors, excluding the location of the incorrect code in the code answer and the reason for the error. Error examples can refer to incorrect answers to the code question and the corresponding error category. Judgment information can be obtained from the code-solving system.

[0054] S406, Get historical sessions.

[0055] In this system, the first user can ask questions multiple times. A single session can refer to one question asked and one response received by the first user. The first user can engage in multiple rounds of conversation. Sessions preceding the current session are considered historical sessions. If the current session is the first session, the historical sessions can be empty. If the current session is not the first session, sessions preceding the current session can be retrieved and identified as historical sessions. Historical sessions can include the first user's historical questions within a historical time period, historical responses received, and input data related to those historical questions. Each round of conversation can be initiated by the second user. The first user merely forwards the second user's question or optimizes its form, without modifying the intent or essence of the question. Furthermore, the second user can engage in multiple rounds of conversation with the large language model but finds the problem unresolved. In this case, an event seeking assistance from the first user can be triggered. In this situation, the second user's multiple rounds of conversation can be retrieved as historical sessions. The first user engages in multiple rounds of conversation with the large language model, and the historical sessions initiated by the second user are provided as context to the large language model. This allows the large language model to respond to the first user's input based on the historical sessions initiated by the second user.

[0056] S407. Add the user intent, the code description information, the comment information, the question association information, the judgment information, and the historical session to the code question and answer prompt template to obtain code question and answer input data.

[0057] The code question-and-answer (CTO) hint template guides the large language model in generating responses to user questions posed by code answers. The template has multiple slots, each corresponding to different information. By filling these slots with the appropriate information, user intent, code description, comments, question associations, judgment information, historical conversations, and the code question hint template are combined to form the CTO input data. This input data then serves as the input data for the large language model.

[0058] In some embodiments, the code Q&A prompt template is as follows: You are a world-class programming tutor and AI teaching assistant. A student's code has encountered an error. Your primary task is to **diagnose the error**.

[0059] Please carefully analyze the error message and code, locate the root cause of the problem, and explain the reason for the error in clear and easy-to-understand language.

[0060] Finally, specific code modification suggestions are provided to fix this bug.

[0061] Students' levels may vary, so please explain in the simplest and most understandable way.

[0062] **This is the core information you need to analyze:** **Problem Description:** {User Intent} **topic:** {Code Question} **Knowledge points covered in the question:** {Question Knowledge} **The standard answer to the question (if any):** {Standard Answer} **Student's complete code:** {Code answer and comments} **Relevant judging information (if any):** {Judging Information} This is a history of conversations between the student and the previous teaching assistant: (If the history session is empty, it means this is the student's first question.) Your task is to continue this conversation based on all the information above and answer the student's latest questions. Please explain in a friendly, encouraging, and clear manner. When explaining code, please cite specific lines or blocks of code. When offering suggestions for improvement, please provide clear examples.

[0063] S408. Input the code question and answer input data into the large language model to obtain the response content corresponding to the user question.

[0064] In some embodiments, the large language model encodes and decodes the code-based question-and-answer input data to obtain the response content corresponding to the user's question. In this embodiment of the invention, the large language model is a model that has been fine-tuned using relevant samples such as code answers and question responses. Fine-tuning methods may include: outputting results from multiple large language models with different structures and performing cross-scoring, then fine-tuning each large language model based on the cross-scoring results; instructing the large language model to output the modified correct code, inputting the correct code into a code-based question-solving system, where the system checks whether the correct code can pass the judging process of the corresponding question, and fine-tunes the large language model based on the detection results.

[0065] Specifically, for cross-scoring scenarios, Model A outputs the results, while Model B scores the accuracy of Model A's results. Based on the scoring results and code pass rate, the prompt templates and models are repeatedly optimized. After fine-tuning each model, a model can be selected based on the cross-scoring. The model with better scoring performance is then applied. After multiple tests and verifications, based on considerations of improving user experience and cost, when responding to user questions, different large language models can be automatically switched according to the difficulty of the question to complete the student question response. For example, for questions of basic and / or higher difficulty, Model 1 is used to respond to user questions faster while ensuring accuracy. For questions of basic and / or higher difficulty, Model 2 (Deep Thinking) is used to ensure accuracy.

[0066] This invention enriches input data by acquiring user intent, code description information, comment information, question association information, judgment information, and historical conversations. The aforementioned content is combined with code question prompt templates to form code question-and-answer input data, which is then provided to a large language model to obtain response content. This can guide the large language model to respond to user questions based on code description information, thereby improving the accuracy of the response content.

[0067] In an optional embodiment, the step of performing intent recognition on the user question to obtain the user intent includes: adding the user question to an intent classification prompt template to obtain intent recognition input data, wherein the intent classification prompt template includes at least one intent category; inputting the intent recognition input data into a large language model, determining the intent category corresponding to the user question in each intent category, and using it as the user intent.

[0068] The intent classification prompt template guides the large language model to recognize the intent of user questions. The template contains slots for user questions. Adding user questions to the corresponding slots combines them with the intent classification prompt template to form intent recognition input data. This input data serves as the input data for the large language model. The intent classification prompt template includes at least one intent category, which constrains the large language model to determine the intent category of the user question from a preset range of intent categories, reducing misclassification of user intents.

[0069] In some embodiments, the large language model encodes and decodes the intent recognition input data to obtain the user intent corresponding to the user question.

[0070] It is evident that by combining user questions with intent classification prompt templates that include intent categories to form intent recognition input data, and providing this data to a large language model to obtain user intent, the large language model can be guided to perform intent recognition on user questions, thereby improving the efficiency of user intent recognition. Furthermore, by limiting the intent categories in the intent classification prompt templates, the range of output user intents can be constrained, reducing misclassification results and improving the accuracy of user intent recognition.

[0071] In an optional embodiment, the intent category includes at least one or more of the following: asking for help with code errors, explaining how the code works, asking for optimization suggestions for the code, and general intents.

[0072] The intent categories are as follows: 1. Asking for help with code errors: This category is used to locate errors in the code answer and find their causes when errors exist. 2. Explaining how code works: This category explains the execution logic, algorithm flow, or technical implementation of the code, such as providing explanations of how the code answer or standard code answer works. 3. Asking for code optimization suggestions: This category focuses on improving code quality or resolving errors. 4. General intents: This category is used to categorize broad user questions that are not explicitly classified. User intents that do not belong to the other three categories are usually classified as general intents to provide tolerance for user questions that are not related to programming code. The response content for general intents can usually be configured with preset responses, such as "the question is irrelevant" or "it cannot be handled."

[0073] In some embodiments, the intent categorization prompt template is as follows: You are an intent classification expert. Your task is to analyze users' latest questions and classify them into one of the following intents. Please return only the English names of the intents.

[0074] Optional intents include: Asking for help with code errors: Users ask for help about code errors (e.g., "Why did I time out?", "What does this compilation error mean?").

[0075] Explaining how the code works: Users request an explanation of how the code works (e.g., "Can you explain this function?", "What does this line of code do?").

[0076] Asking for code optimization suggestions: Users are seeking suggestions to optimize their code (e.g., "How can I make it run faster?", "Is there a better way to write it?").

[0077] General intent: The user is asking a general programming question, which may be unrelated to the specific logic of the current code. Not all of the above three intents can be regarded as this intent.

[0078] The latest question from users is: "{User Issues}" Based on this question, what is the most likely intent? Please only return the name of the intent category (e.g., explain how the code works).

[0079] As can be seen, by configuring the intent category as asking for help with code errors, explaining how the code works, asking for code optimization suggestions, and general intents, user questions can be accurately categorized, intent recognition efficiency can be improved, and multiple scenarios of asking for code answers can be fully covered, achieving accurate responses adapted to the scenarios.

[0080] In an optional embodiment, obtaining the annotation information of the code answer includes: when a historical session exists, obtaining the annotation information in the historical session and using it as the annotation information of the code answer; when no historical session exists, adding the code answer to the annotation prompt template to obtain annotation input data; and inputting the annotation input data into the large language model to obtain the annotation information of the code answer.

[0081] In this process, annotation information is generated only in the initial session. Subsequent sessions can directly retrieve the annotation information generated in the initial session, reducing redundant annotation generation and avoiding resource waste. If no historical sessions exist, it indicates that the current session is the first session and no annotation information has been generated. In this case, annotation information can be generated and added to the code answer. If historical sessions exist, it indicates that annotation information was already generated in the initial session. In this case, there is no need to reuse the resources of the large language model, reducing resource waste, and the annotation information generated in the historical session (initial session) can be directly retrieved.

[0082] Comment suggestion templates are used to guide the large language model in adding comment information to the code answers. The comment suggestion templates have slots for the code answers. Adding the code answers to the corresponding slots combines the code answers with the comment suggestion templates to form the comment input data. This comment input data serves as the input data for the large language model.

[0083] In some embodiments, the large language model encodes and decodes the annotated input data to obtain annotation information for the code answer. In some embodiments, the large language model directly outputs the code answer with attached annotation information.

[0084] In some embodiments, the annotation prompt template is as follows: You are a senior programmer and code review expert. Your task is to provide comprehensive analysis and line-by-line comments for the given code.

[0085] You are dealing with student code from teenagers learning to program. Their skill levels may vary, so please make sure your comments are as easy to understand as possible.

[0086] Your output should include the following additions to the original code: 1. Overall Summary: A paragraph explaining the purpose of the code, the algorithm used, and its implementation idea.

[0087] 2. Detailed Explanation: Explain the code line by line or block by block. Each explanation should be clear, concise, and easy for beginners to understand.

[0088] The code you need to analyze is as follows: {Code Answer} It is evident that by adding the code answer to the comment hint template to obtain the comment input data, and then inputting it into the large language model to obtain the comment information of the code answer, the efficiency and accuracy of comment information generation can be improved. At the same time, the comment information generated only when there is no historical session can reduce the redundant generation process of comment information.

[0089] In a scenario, such as Figure 5 As shown, methods for generating auxiliary information for code answer questions may include: S501, First user triggers intelligent parsing.

[0090] The first user clicks on the resource location information provided by the second user and is redirected to the code-solving system page, which is as follows: Figure 2 As shown. The first user can trigger the intelligent parsing control in the code-solving system, which will redirect them to the question-and-answer interactive page, as shown below. Figure 3 As shown.

[0091] S502. Determine whether to create a new session; if yes, execute S503; otherwise, execute S508.

[0092] If you continue from where you left off, you will not create a new session. If there is no history of conversations, you can create a new session.

[0093] S503, Generate a new session.

[0094] S504. Determine whether the code answer is commented out; if so, execute S505; otherwise, execute S510.

[0095] S505. Call the large language model to generate annotation information for the code answer.

[0096] Comment information can be displayed to the first user as annotated code answers. Specifically, the annotated code answers are streamed into a dialog box and presented to the first user.

[0097] S506, Stored Session.

[0098] S507. Store the comment information and execute S509.

[0099] S508, Load historical sessions.

[0100] Retrieve the content of historical sessions and load the interactive page.

[0101] S509. Enter the interactive page and display the conversation area, which includes code questions and code answers with comments.

[0102] The interactive page includes a dialogue area, which further comprises a conversation area and an input area. The input area is used to input the first user's interactive information. The conversation area is used to display the conversation content.

[0103] S510, Load the historical annotation information generated by the code answer, and execute S509.

[0104] S511, User Acquisition Issues.

[0105] Receive the user question from the first user in the input area.

[0106] S512. Call the large language model to perform intent recognition on the user's question and obtain the user's intent.

[0107] S513. Call the large language model, input user intent, code description information, comment information, question association information, judgment information and historical conversation, and output the response content.

[0108] The system retrieves question-related information based on the code question and judge information based on the code answer. User intent, code description, comments, question-related information, judge information, and historical conversations are input into a large language model to obtain the response content output by the large language model.

[0109] S514, Storage Session.

[0110] The stored sessions can be retrieved and invoked as historical sessions in subsequent sessions.

[0111] The embodiments of the present invention can not only provide standard error feedback for the code, but also provide specific error analysis and diagnosis and optimization suggestions based on student questions. In teaching and tutoring scenarios, this can improve the efficiency of teacher tutoring and the ability of students to improve themselves.

[0112] Figure 6 This is a schematic diagram of a device for generating code-answer question auxiliary information according to an embodiment of the present invention. This embodiment of the present invention is applicable to situations where educational users provide answers to questions provided by students. The device can execute a method for generating code-answer question auxiliary information and can be implemented in hardware and / or software.

[0113] See Figure 6 The apparatus for generating code answer question auxiliary information shown includes: The question acquisition module 601 is used to acquire code description information and user questions provided by a first user. The code description information includes a code question and the corresponding code answer. The user questions include questions raised by a second user that are related to the code description information. The code comment module 602 is used to obtain the comment information of the code answer; The intent recognition module 603 is used to recognize the intent of the user question and obtain the user intent; The response generation module 604 is used to determine the response content corresponding to the user question based on the user intent, the code description information, and the annotation information.

[0114] The technical solution of this invention obtains a code question, the corresponding code answer, and a user question provided by a first user. It adds annotation information to the code answer, identifies the user's intent in the question, and obtains the response content based on the user intent, the code question, the code answer, and the annotation information. This allows for accurate responses to questions raised in response to code questions, solving the problem in existing technologies where teachers need a high level of ability and considerable time to think, leading to delays in providing accurate answers. The invention provides teachers with annotation and response information to assist them in answering student questions, improving the accuracy and efficiency of question responses.

[0115] Optionally, the response generation module 604 includes: The associated information acquisition unit is used to query the associated information of the question based on the code question, wherein the associated information includes: question knowledge and / or question standard answer; The judging information acquisition unit is used to acquire the judging information associated with the code answer, wherein the judging information includes at least one of the following: judging result, error information, and error example; The historical session acquisition unit is used to acquire historical sessions; The question-and-answer input determination unit is used to add the user intent, the code description information, the annotation information, the question association information, the judgment information, and the historical session to the code question-and-answer prompt template to obtain code question-and-answer input data; The response processing unit is used to input the code question and answer input data into the large language model to obtain the response content corresponding to the user question.

[0116] Optionally, the intent recognition module 603 includes: An intent input determination unit is used to add the user question to an intent classification prompt template to obtain intent recognition input data, wherein the intent classification prompt template includes at least one intent category. The intent recognition unit is used to input the intent recognition input data into the large language model, determine the intent category corresponding to the user question in each intent category, and use it as the user intent.

[0117] Optionally, the intent categories include: asking for help with code errors, explaining how the code works, asking for code optimization suggestions, and general intents.

[0118] Optional, code comment module 602, including: The historical annotation acquisition unit is used to acquire annotation information from historical sessions when historical sessions exist, and use it as annotation information for the code answer; The annotation input determination unit is used to add the code answer to the annotation prompt template when there is no historical session, thereby obtaining annotation input data; The annotation determination unit is used to input the annotation input data into the large language model to obtain the annotation information of the code answer.

[0119] Optionally, the problem retrieval module 601 includes: The first acquisition unit is used to acquire resource location information provided by the first user; the resource location information is used to point to resources in the code-solving system. The first acquisition unit is used to acquire the code description information pointed to by the resource location information; The second acquisition unit is used to acquire the answer identifier provided by the first user; The second acquisition unit is used to query the code description information corresponding to the answer identifier from the code-based question-solving system; or The third acquisition unit is used to acquire the code description information provided by the first user.

[0120] Optionally, the user question includes: the code answer is the code content provided by the second user for the code question.

[0121] The code answer question auxiliary information generation device provided in the embodiments of the present invention can execute the code answer question auxiliary information generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the code answer question auxiliary information generation method.

[0122] Figure 7 A schematic diagram of the structure of an electronic device 700 that can be used to implement an embodiment of the present invention is shown.

[0123] like Figure 7 As shown, the electronic device 700 includes at least one processor 701 and a memory, such as a read-only memory 702 and a random access memory 703, communicatively connected to the at least one processor 701. The memory stores computer programs executable by the at least one processor. The processor 701 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 702 or loaded from storage unit 708 into the random access memory 703. The random access memory 703 can also store various programs and data required for the operation of the electronic device 700. The processor 701, read-only memory 702, and random access memory 703 are interconnected via a bus 704. An input / output interface 705 is also connected to the bus 704.

[0124] Multiple components in electronic device 700 are connected to input / output interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows electronic device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0125] Processor 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 701 include, but are not limited to, central processing units, graphics processing units, various special-purpose artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any suitable processor, controller, microcontroller, etc. Processor 701 performs the various methods and processes described above, such as methods for generating code answer question auxiliary information.

[0126] In some embodiments, the method for generating code answer question assistance information can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 700 via read-only memory 702 and / or communication unit 709. When the computer program is loaded into random access memory 703 and executed by processor 701, one or more steps of the method for generating code answer question assistance information described above can be performed. Alternatively, in other embodiments, processor 701 can be configured to execute the method for generating code answer question assistance information by any other suitable means (e.g., by means of firmware).

[0127] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), systems-on-a-chip (SoCs), complex programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0128] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0129] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, flash memory, optical fiber, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0130] To provide interaction with a user, the systems and techniques described herein can be implemented on an operational detection device. This electronic device includes: a display device (e.g., a cathode ray tube or liquid crystal display monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0131] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0132] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system. This addresses the shortcomings of traditional physical hosts and virtual private servers, such as high management difficulty and weak business scalability.

[0133] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0134] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for generating auxiliary information for code answer questions, characterized in that, The method includes: Obtain code description information and user questions provided by a first user. The code description information includes a code question and the corresponding code answer. The user questions include questions raised by a second user that are related to the code description information. Obtain the comment information for the code answer; The user's question is subjected to intent recognition to obtain the user's intent; Based on the user intent, the code description information, and the comment information, determine the response content corresponding to the user question.

2. The method according to claim 1, characterized in that, The step of determining the response content corresponding to the user question based on the user intent, the code description information, and the comment information includes: Based on the code question, query the question association information, which includes: question knowledge and / or the question standard answer; Obtain the judging information associated with the code answer, wherein the judging information includes at least one of the following: judging result, error message, and error example; Retrieve historical sessions; The user intent, the code description information, the comment information, the question association information, the judgment information, and the historical session are added to the code question and answer prompt template to obtain code question and answer input data; The code-based question-and-answer input data is input into a large language model to obtain the response content corresponding to the user's question.

3. The method according to claim 1, characterized in that, The process of identifying the user's intent in the user question to obtain the user's intent includes: The user question is added to the intent classification prompt template to obtain intent recognition input data, wherein the intent classification prompt template includes at least one intent category; The intent recognition input data is input into the large language model, and the intent category corresponding to the user question is determined in each intent category, which is then used as the user intent.

4. The method according to claim 3, characterized in that, The intent categories include at least one or more of the following: asking for help with code errors, explaining how the code works, asking for optimization suggestions for the code, and general intents.

5. The method according to claim 1, characterized in that, The annotation information for obtaining the code answer includes: When a historical session exists, retrieve the annotation information from the historical session and use it as the annotation information for the code answer; When no historical session exists, the code answer is added to the comment hint template to obtain the comment input data; The annotation input data is input into the large language model to obtain the annotation information of the code answer.

6. The method according to claim 1, characterized in that, The step of obtaining the code description information provided by the first user includes: Obtain resource location information provided by the first user; the resource location information is used to point to resources in the code-solving system. Obtain the code description information pointed to by the resource location information; Obtain the answer identifier provided by the first user; Query the code description information corresponding to the answer identifier from the code-based question-solving system; or Obtain the code description information provided by the first user.

7. The method according to claim 1, characterized in that, The code answer is the code content provided by the second user for the code question.

8. A device for generating auxiliary information for code answer questions, characterized in that, The device includes: The question acquisition module is used to acquire code description information and user questions provided by a first user. The code description information includes a code question and the corresponding code answer. The user questions include questions raised by a second user that are related to the code description information. The code comment module is used to obtain comment information for the code answer; The intent recognition module is used to recognize the intent of the user's question and obtain the user's intent. The response generation module is used to determine the response content corresponding to the user question based on the user intent, the code description information, and the annotation information.

9. A device for generating auxiliary information for code answer questions, characterized in that, The device for generating auxiliary information for the code answer questions includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method for generating code answer question auxiliary information according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for generating code answer question auxiliary information as described in any one of claims 1-7.