A large language model-based youth algorithm code assisted learning system and method

The algorithm code-assisted learning system for teenagers, built using a large language model, solves the problems of limited innovation space and practical application in existing programming education. It provides personalized and guided code teaching to enhance teenagers' programming skills and learning interest.

CN117235347BActive Publication Date: 2025-11-04HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310782650.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2025-11-04
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

Current programming education for teenagers mainly relies on block-based programming methods, which limits children's creativity and practical application abilities. Furthermore, existing code teaching platforms cannot answer difficult questions in real time, lack relevance and innovation, and fail to meet the learning needs of teenagers.

Method used

A large language model is used to build an algorithm code-assisted learning system for teenagers, which includes step-by-step difficulty question generation, code intent recognition, related question recommendation and modular programming modules. It combines Alpaca and Self-Instruct models for instruction fine-tuning and uses iterative prompting and a deep full information transmission network for personalized question recommendation and code teaching.

Benefits of technology

It provides original, cheat-proof code instruction, offers one-on-one guided learning, enhances the programming skills and innovative thinking of teenagers, meets the learning needs of different age groups, and improves learning efficiency and interest.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117235347B_ABST
    Figure CN117235347B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on big language model's youth algorithm code auxiliary learning system and method, belong to algorithm code auxiliary learning technical field.Jump difficulty question generation module, code intention identification module and relevant question recommendation module are integrated in based on big language model, to form big model teacher Ada, and provide programming code teaching service for student with autonomous learning ability.Block programming EnjoyCode module provides drag-and-drop block module teaching service for low-age beginners of low knowledge level.The application effectively helps 10-15 years old youth to establish code interest in the form of youth code auxiliary teaching webpage, can effectively expand the knowledge reserve of youth in practice, improve the programming ability of youth, and expand the divergent thinking of youth, guide them to think deeply.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a learning system and method for teenagers based on large language models and algorithm code, belonging to the field of algorithm code-assisted learning technology. Background Technology

[0002] In the past two years, computer knowledge and technology have developed rapidly, bringing convenience and improvements to all aspects of life, placing us at the center of a knowledge revolution. The government has introduced policies to develop artificial intelligence education and promote programming education, vigorously promoting computer knowledge education and dissemination among young people, and holding numerous lectures, youth artificial intelligence innovation competitions, and so on. Undoubtedly, the educational resources available to young people lay the foundation for their future vision and potential, and their interests and early exposure to relevant knowledge during adolescence can significantly influence their future development.

[0003] Most existing computer education for teenagers on the market focuses on graphical programming, such as Scratch, a software widely used in educational institutions. Code is embedded in individual block modules, allowing teenagers to perform various operations through nested module combinations, such as control, calculation, and output modules. A smaller portion uses block-based modularization to teach artificial intelligence thinking, where children drag and drop modules to perform simple AI tasks such as image segmentation and classification. Both methods provide children with a certain understanding of programming processes; however, modular, block-based programming is a double-edged sword. While it has made it dominant in early childhood education, it has also limited its application scope.

[0004] ① Block-based programming does not fully unleash the learning potential of teenagers. Teenagers are intellectually capable of understanding words like "if" and "else," and they can also comprehend the logic of programming languages ​​in reality. However, limiting themselves to block-based programming cannot fully expand their thinking and may create a learning blind spot where they know what but not why.

[0005] ② The knowledge learned through modular programming is not easily applicable in practice. Current computer science widely uses algorithms implemented using variables and keywords in programming languages ​​as atomic units. This invention can call various libraries to achieve modular programming, and can also make task-adaptive modifications to the code logic. Therefore, this invention can be used to write web pages, implement apps, etc. Modular programming can only be applied to the software it provides, and cannot be truly applied outside the platform.

[0006] ③ The modular, block-based approach also significantly limits children's creative space. Children cannot create new content not provided by the blocks. For example, in block-based education, the classification model is represented as a block-like black box model. When a child learns to classify images of "apple" and "banana," their creativity is limited to using the modules, only able to change "apple" and "banana" to "tiger" and "lion" to achieve different outputs. However, they do not learn to learn code. This invention, by changing the internal structure of the model, enables the machine to capture more refined features and improve classification accuracy.

[0007] Just as people learn Chinese from birth through conversation, this invention introduces the grammar and thought processes required for elementary school, where students learn pinyin (phonetic transcription of Chinese characters) to write characters, form words, and so on. Teenagers are now at an age where they can readily engage with coding instruction, and their education can no longer be confined to the rote memorization of block-based programming. Therefore, this invention focuses on teaching algorithm coding to teenagers. The curriculum includes fundamental programming knowledge of the Python high-level language and exercises that expand thinking through problem-solving, such as implementing greedy algorithms using Python.

[0008] Existing coding tutorial platforms target adults with strong self-learning abilities, such as college students. The teaching method is to explain knowledge points and provide examples, such as "Cainiao Tutorial". These websites have two drawbacks: first, they cannot answer students' questions in real time; second, for teenagers, whose knowledge reserves are insufficient and whose intellectual level is not yet fully developed, they may not be able to understand the content. These websites list knowledge points and lack guidance, i.e., a learning process from easy to difficult.

[0009] Existing adult coding practice websites, such as LeetCode, are designed for users who already have basic coding concepts and advanced language syntax knowledge. Teenagers lack the corresponding coding foundation and algorithm knowledge, making it impossible for them to apply these skills directly. Furthermore, these websites suffer from drawbacks such as poorly targeted and outdated questions that limit the development of teenagers' innovative thinking.

[0010] Large Language Models (LLMs), exemplified by ChatGPT, caused a sensation upon their release, demonstrating powerful capabilities in logical reasoning, event extraction, and text generation, especially their code generation capabilities, which produced astonishing results. Currently, the application of large models across various industries remains to be explored. How to leverage large model technology to improve existing mechanisms and provide more convenient services is a crucial aspect and driving force for the development of the computer industry. The emergence of the Llama open-source model and its instruction fine-tuning improvement model, Stanford Alpaca, has made it possible to utilize the powerful code generation capabilities of large models to help teenagers learn high-level languages ​​and algorithm design. Therefore, this invention utilizes the powerful code generation capabilities of large oracle models to implement a highly targeted, customized, and original question generation model.

[0011] my country has long faced the problem of uneven distribution of educational resources among different regions. In order to overcome the drawbacks of this, which leads to small towns producing only "test-taking experts" who are unable to access contemporary algorithm knowledge and coding teaching resources, and to alleviate the problems of boring coding teaching, obscure and inefficient algorithm teaching, this invention, in response to national policy needs, adheres to the concept of developing the intellectual development of teenagers (10-15 years old), stimulating their interest in the field of computer code, and popularizing algorithm code teaching that is acceptable and practical to teenagers, and designs and develops a teenager algorithm code auxiliary learning system based on a large language model. Summary of the Invention

[0012] This invention proposes a learning system and method for teenagers using algorithmic code based on a large language model. It comprises an iterative prompting-based tiered difficulty question generation model, a code intent recognition model based on Alpaca and Self-Instruct, a relevant question recommendation model based on a deep full-information transmission network, a visual programming and debugging module based on Django embedded in Jupyter, a game-based teaching module based on Scratch, and a front-end development technology based on Spring. This forms an interactive "large model teacher" to address the current lack of original question-guided code teaching applications in the teenager education market.

[0013] A large language model-based algorithm code-assisted learning system for teenagers is disclosed. This system includes a tiered difficulty question generation module, a code intent recognition module, a related question recommendation module, and a modular programming Enjoy Code module. The tiered difficulty question generation module, code intent recognition module, and related question recommendation module are all integrated within the system, forming a large model teacher, Ada. Ada is used to provide programming code teaching services for students with self-learning abilities. The modular programming Enjoy Code module provides drag-and-drop modular teaching services for younger, less advanced beginners.

[0014] The stepped difficulty question generation module is used to generate original questions with specific knowledge points based on the user's requirements when the large model teacher Ada receives a user request.

[0015] The code intent recognition module is used to automatically identify the purpose and function of the code that the user has entered based on the question information generated by the step-by-step difficulty question generation module after the large model teacher Ada receives the question information, and to predict the next operation that the user should perform and the knowledge that the user should possess.

[0016] The relevant question recommendation module is called by the large model teacher Ada to recommend questions related to relevant knowledge points to the user when the user has answered correctly. It is also used for personalized question recommendations on the website homepage.

[0017] The modular programming Enjoy Code module integrates a Scratch visual programming module and embeds a Jupyter Notebook. It uses hyperlinks to link the Scratch visual programming module and the puzzle game module, providing a clear representation and output of data structures and content.

[0018] A method for assisting adolescents in learning algorithmic code based on a large language model, comprising the following steps, based on the aforementioned system for assisting adolescents in learning algorithmic code based on a large language model:

[0019] S100: Determine the user's needs. If the user's needs are historical, proceed to S200; if the user's needs are real-time, proceed to S300.

[0020] S200, Recommend relevant questions to users;

[0021] S300 generates and recommends tiered difficulty questions to users;

[0022] S400: After the user answers, the code intent of the user's answer is identified;

[0023] S500: Based on the user's needs, it can provide explanations of the knowledge points for the current question or provide targeted code guidance for the answer.

[0024] S600. Determine whether the answer is correct. If correct, proceed to S700; otherwise, return to S400.

[0025] S700: Determine whether additional conditions can be added to the current question. If yes, return to S300 and recommend a question of higher difficulty to the user; otherwise, return to S200.

[0026] Furthermore, in S300, the generation of tiered difficulty questions is achieved through an iterative prompting-based tiered difficulty question generation model. This model uses hard prompts as the prompts and obtains the question and each prompt p through BERT. i The encoding representation of k i The encoding of question Q is q.

[0027] q = BERT(Q)

[0028] k i =BERT(p i )

[0029] Each prompt encoding representation p is obtained through a multi-head self-attention layer MHSA. i The representation c after interaction with the original problem encoding representation q i ,

[0030]

[0031] c j =Concat(head) i ...head n W O

[0032]

[0033] The representation information is input into a multilayer perceptron (MLP) layer. The MLP layer obtains a relevance score between each prompt and the original question. After normalization using softmax, each prompt p is obtained.i The probability a i The prompts for choosing the model to use are made in a roulette-like manner.

[0034] a i =softmax(f(W0c) i +θ))

[0035] Where f is the sigmoid function.

[0036] Furthermore, in S400 and S500, a code intent recognition model based on Alpaca and Self-Instruct is used to identify the code answers input by the user, determine the purpose and function of the code answers, and predict the next operation that the user should perform and the knowledge that the user should possess, forming guided teaching. The code intent recognition model based on Alpaca and Self-Instruct uses Self-Instruct technology to generate 20K instruction fine-tuning training data for fine-tuning Alpaca data.

[0037] Furthermore, 20K instruction fine-tuning training data are generated using the Self-Instruct technique, as follows:

[0038] The Alpaca model begins with a task pool consisting of a single instruction and an input / output instance for each task, written manually. Random tasks are drawn from this pool and used to prompt the existing model (LM) to generate new instructions and corresponding instances. Low-quality or similar generation is then filtered out and added back to the task pool. This process is repeated until 20,000 training data points are generated. This data is used later for instruction tuning of the Alpaca model.

[0039] The instruction adjustment process employs an autoregressive generation task to fine-tune Alpaca. The principle of the autoregressive generation task is as follows: for an unlabeled corpus U = {u1, u2, ..., u...}, ..., ... n The maximum (log-likelihood) estimate is:

[0040]

[0041] Where i is the context window size, p is the conditional probability, and θ is the parameter of the conditional probability, which is updated using Adam.

[0042] Furthermore, S200 includes the following steps:

[0043] S210. Use automatic crawling technology to build a database containing thousands of algorithm questions, and use the cache of users' historical query records as questions. Calculate the similarity between the user's cached information and the candidate algorithm questions in the database. Based on the similarity calculation, select the most relevant TOP-10 or TOP-1 as the answers for the code questions recommended on the homepage and the related questions recommended by the code teaching assistant after receiving the correct answer, respectively.

[0044] S220 uses BM25 coarse-ranking search and deep full-information transfer network fine-ranking for more accurate filtering, thereby obtaining the most relevant homepage code questions and the most relevant algorithm questions to the original problem.

[0045] Furthermore, in S220, the principle of the BM25 coarse-sorting search is as follows:

[0046]

[0047] Where Q represents the question that the user has answered correctly, d represents the candidate algorithm question, and c i The word in Q, w i The word weight is represented by the Inverse Document Frequency (IDF) in the BM25 coarse-grained search method, and is calculated as follows:

[0048]

[0049] Where N represents the total number of problems in the algorithm problem set, df i For keywords containing c i The number of questions, for a certain keyword c i , including c i The more documents there are, the better c i The lower the importance and the lower the distinguishability, the smaller the IDF. Therefore, IDF is used to characterize c. i Similarity to documents,

[0050] The keywords extracted from the original question are matched with pre-stored keyword sequences in the candidate algorithm question set. Each sequence is scored, and the ten algorithm question pairs with the highest scores are selected as candidate related questions and recommended to the user.

[0051] Furthermore, in S220, the deep full-information transmission network model includes several sub-units, each sub-unit including an embedding module, a deep interaction module, and a prediction module. The embedding module, deep interaction module, and prediction module are connected sequentially. The deep full-information transmission network model is formed by stacking these sub-units sequentially.

[0052] The embedding module uses word embeddings obtained based on BERT and convolutional embeddings obtained based on a convolutional neural network to concatenate and obtain initial embedding representations of the original question and coarsely ranked candidate questions. This representation is then input into a Bi-LSTM layer to obtain a better interactive representation.

[0053]

[0054]

[0055] Q i ChConv is the original problem or a candidate related subproblem obtained through coarse ranking, l is the character-level CNN, and l is the representation after the l-th stacking iteration.

[0056] The deep interaction module obtains a 3D post-interaction matrix to be selected by calculating element-wise multiplication.

[0057]

[0058] in This indicates element-wise multiplication.

[0059] The 3D matrix of candidates to be selected after interaction is concatenated with the memory information obtained from the previous layer, and then passed through a fully connected layer to obtain the matrix of deep interaction.

[0060]

[0061] Finally, an attention pooling layer is used to reduce the dimensionality of the feature representation after 3D depth interaction.

[0062]

[0063] After concatenating the original encoded representations, feature selection is performed through a fully connected layer to obtain the final feature representation, which serves as the output of this module.

[0064]

[0065] In the above formulas, f represents a fully connected layer;

[0066] The prediction module passes the final feature representation through a multilayer perceptron layer to obtain the final relevance score, and selects the most relevant question as the relevant question recommended to the user by the large language model.

[0067] i = argmax i (sigmoid(W0c i +θ)).

[0068] A storage medium storing a computer program, which, when executed by a processor, implements the aforementioned learning method for adolescents based on a large language model algorithm code.

[0069] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method for adolescent algorithm code-assisted learning based on a large language model.

[0070] The beneficial effects of this invention are:

[0071] This invention discloses a learning system and method for algorithmic code-assisted learning for teenagers based on a large language model. It constructs and implements a web-based application called "Enjoy Code," which includes a one-on-one code teaching assistant—"Large Model Teacher Ada." This addresses the lack of existing code-based educational applications for teenagers in the market, and the application is characterized by originality, anti-cheating features, and strong guidance. Specifically, this invention has the following advantages:

[0072] ① Generating original coding challenges with tiered difficulty. Guiding young users from simple to complex problems to find multiple solutions or even better solutions, inspiring their innovative and divergent thinking. Simultaneously, the original challenges generated by the large-scale model serve as an anti-cheating measure.

[0073] ②One-on-one coding teaching assistant – “Large Model Teacher Ada”:

[0074] a) Large-scale model teacher-guided teaching. The system analyzes the difficulties students encounter while coding and provides professional knowledge or code hints. Users can interact with the large-scale model teacher through dialogue, providing feedback on the hints for more targeted knowledge explanations and code analysis.

[0075] b) It can guide users to provide better or other solutions after receiving the correct answer.

[0076] c) Recommending related questions based on the user's solutions. This provides teenagers with a sufficient number of questions to practice their skills.

[0077] ③ Embed mature modular programming, programming game plugins, and visual programming and visual debugging modules:

[0078] This system can effectively help teenagers aged 10-15 develop an interest in coding. The one-on-one tutoring model, which acts as a private teacher, conforms to the normal learning patterns of people. It can effectively expand teenagers' knowledge reserves, improve their programming skills, and develop their divergent thinking in practice. It can also guide teenagers to think deeply and experience the algorithm implementation process. Attached Figure Description

[0079] Figure 1 For web-based interface display;

[0080] Figure 2 Generate example flowcharts for step-by-step difficulty problems based on iterative prompting;

[0081] Figure 3 Example diagram for code intent recognition;

[0082] Figure 4 This is a diagram of the architecture of a deep full-information transmission network model.

[0083] Figure 5 Example diagram of a two-stage retrieval recommendation model;

[0084] Figure 6 A visual diagram of the doubly linked list structure in Jupyter;

[0085] Figure 7 This is a diagram of the overall system architecture.

[0086] Figure 8 This is a diagram of the Self-Instruct model framework. Detailed Implementation

[0087] 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.

[0088] In the accompanying drawings of specific embodiments of the present invention, in order to better and more clearly describe the working principle of each component in the system and show the connection relationship of each part in the device, only the relative positional relationship between each component is clearly distinguished. It does not constitute a limitation on the signal transmission direction, connection sequence, or size, dimension, and shape of each part within the component or structure.

[0089] A large language model-based algorithm code-assisted learning system for teenagers is disclosed. This system includes a tiered difficulty question generation module, a code intent recognition module, a related question recommendation module, and a modular programming Enjoy Code module. The tiered difficulty question generation module, code intent recognition module, and related question recommendation module are all integrated within the system, forming a large model teacher, Ada. Ada is used to provide programming code teaching services for students with self-learning abilities. The modular programming Enjoy Code module provides drag-and-drop modular teaching services for younger, less advanced beginners.

[0090] The stepped difficulty question generation module is used to generate original questions with specific knowledge points based on the user's requirements when the large model teacher Ada receives a user request.

[0091] The code intent recognition module is used to automatically identify the purpose and function of the code that the user has entered based on the question information generated by the step-by-step difficulty question generation module after the large model teacher Ada receives the question information, and to predict the next operation that the user should perform and the knowledge that the user should possess.

[0092] The relevant question recommendation module is called by the large model teacher Ada to recommend questions related to relevant knowledge points to the user when the user has answered correctly. It is also used for personalized question recommendations on the website homepage.

[0093] The modular programming Enjoy Code module integrates a Scratch visual programming module and embeds a Jupyter Notebook. It uses hyperlinks to link the Scratch visual programming module and the puzzle game module, providing a clear representation and output of data structures and content.

[0094] Specifically, to address the lack of original, guided coding instruction applications for youth education in the current market, this invention utilizes the Alpaca language model to create a one-on-one interactive coding teaching assistant – "Ada, the Large Model Teacher" – which integrates tiered difficulty original question generation (including functional code completion and framework-free coding), interactive code guidance explanations, and related question recommendations. A user-friendly web application, "EnjoyCode," was also designed for it. This invention fully leverages current technological advantages to fill a market gap, featuring originality, anti-cheating measures, and strong guidance. Furthermore, the web application embeds a casual game teaching module developed with Scratch, a graphical visualization coding module from Jupyter, and a recommendation system based on algorithmic question recommendations on the web homepage.

[0095] This invention is based on the Spring-based web application "Enjoy Code," which allows users to practice code and algorithms and reinforce their algorithmic thinking through a simple webpage. It avoids software and hardware system compatibility issues, and its online format provides users with a more convenient user experience.

[0096] As for the Enjoy Code module of block-based programming, its embedded Scratch is a graphical programming tool released in 2007 by the "Lifelong Kindergarten Team" at MIT. It is mainly open to teenagers around the world and is one of the most well-known graphical programming tools. Anyone can create their own programs in the software.

[0097] The "Casual Games" module in the "Enjoy Code" homepage menu embeds the Scratch visual programming module and the puzzle game module using hyperlinks.

[0098] The Enjoy Code module, a modular programming approach, also integrates Jupyter Notebook via Django. Jupyter Notebook is a web-based online programming tool with powerful interactive features, facilitating the creation and sharing of program documentation, supporting live code, and boasting excellent visualization capabilities. When outputting data, Jupyter can clearly represent and display data structures and content using bar charts, funnel charts, tree views, and table views. Even more advantageous is its visual debug module, which differs significantly from traditional debug methods that only display variable names and values. It establishes intuitive visual representations of different data structures, showing the numerical changes of executed statements within these data structures. Figure 6 A visual structure diagram of a defined doubly linked list is shown.

[0099] "Enjoy Code" modifies the Jupyter Notebook configuration to allow embedding requests from various IP addresses, enabling the Jupyter Notebook display interface to be embedded into a webpage using an iframe.

[0100] A method for assisting adolescents in learning algorithmic code based on a large language model, comprising the following steps, based on the aforementioned system for assisting adolescents in learning algorithmic code based on a large language model:

[0101] S100: Determine the user's needs. If the user's needs are historical, proceed to S200; if the user's needs are real-time, proceed to S300.

[0102] S200, Recommend relevant questions to users;

[0103] S300 generates and recommends tiered difficulty questions to users;

[0104] S400: After the user answers, the code intent of the user's answer is identified;

[0105] S500: Based on the user's needs, it can provide explanations of the knowledge points for the current question or provide targeted code guidance for the answer.

[0106] S600. Determine whether the answer is correct. If correct, proceed to S700; otherwise, return to S400.

[0107] S700: Determine whether additional conditions can be added to the current question. If yes, return to S300 and recommend a question of higher difficulty to the user; otherwise, return to S200.

[0108] Furthermore, in S300, the input for generating tiered difficulty questions is the user's requirements. These requirements can be a natural language description of the user's needs, or questions can be selected through tag filtering. The user's requirements are then input into Alpaca, where an iterative prompting-based tiered difficulty question generation model generates original questions with specific knowledge points. This iterative prompting-based tiered difficulty question generation model uses hard prompts, and obtains the relationship between the question and each prompt point using BERT. i The encoding representation of k i The encoding of question Q is q.

[0109] q = BERT(Q)

[0110] k i =BERT(pi )

[0111] Each prompt encoding representation p is obtained through a multi-head self-attention layer MHSA. i The representation c after interaction with the original problem encoding representation q i ,

[0112]

[0113] c j =Concat(head) i ...head n W O

[0114]

[0115] The representation information is input into a multilayer perceptron (MLP) layer. The MLP layer obtains a relevance score between each prompt and the original question. After normalization using softmax, each prompt p is obtained. i The probability a i The prompts for choosing the model to use are made in a roulette-like manner.

[0116] a i =softmax(f(W0c) i +θ))

[0117] Where f is the sigmoid function.

[0118] Since people absorb knowledge in daily life in a gradual, step-by-step manner, code completion is more effective for beginners than directly writing complete methods in object-oriented programming. For algorithmic problems without a framework, the same problem can have solutions with varying time complexity and difficulty. Even with the same solution, optimizing the statement representation can yield more reusable and robust solutions. Therefore, this invention designs a series of prompts for iteratively stimulating Alpaca to better uncover the implicit knowledge within large models. This allows the large model to act like a teacher, guiding students step-by-step, constantly posing questions, thus leading to a gradual increase in difficulty, continuous optimization of problem-solving approaches, and multiple solutions to a single problem. The model example flowchart is as follows. Figure 2 As shown.

[0119] Furthermore, in S400 and S500, a code intent recognition model based on Alpaca and Self-Instruct is used to identify the code answer input by the user, determine the purpose and function of the code answer, and predict the next operation that the user should perform and the knowledge that the user should possess, forming guided teaching. The code intent recognition model based on Alpaca and Self-Instruct uses Self-Instruct technology to generate 20K instruction fine-tuning training data to fine-tune Alpaca.

[0120] Specifically, Code Intent Recognition refers to a model that, based on the question information provided above, automatically identifies the purpose and function of the user's entered code, and predicts the next action the user should take and the knowledge the user should possess.

[0121] Llama is an open-source collection of foundational language models based on the transformer architecture, providing large language models with parameter ranges from 7B to 65B. It is pre-trained on trillions of publicly available tokens, giving the model a "human-like" level of intelligence. Currently, Llama 13B outperforms GPT-3 (175B) in most benchmark tests. Alpaca, based on the Llama-7B model, uses OpenAI's text-davinci-003 model to generate 52K instruction-following samples in a self-instruct manner as supplementary training data. Experimental results show that Alpaca outperforms the base Llama model in many aspects, similar to text-davinci-003. In other words, the lightweight 7B model Alpaca performs comparably to ultra-large-scale language models like GPT-3.5. Therefore, this invention uses this model as the foundational language model.

[0122] However, since code training data only accounts for 4.5% of all data in Alpaca, it cannot fully develop the code generation capabilities of large models. Therefore, this invention adds 20K instruction fine-tuning data to continue training the Alpaca model using the original autoregressive generation task. The 20K instruction fine-tuning data is automatically generated by the Self-Instruct method.

[0123] The Alpaca model, fine-tuned in the above manner, exhibits superior code generation performance and can focus more on user-provided instructions. Figure 3This intent recognition example demonstrates that the model generates high-quality code hints and knowledge point hints by following pre-set prompts. At the same time, users can also interact with the large model teacher in real time, providing feedback on the guided teaching provided by the Alpaca model, enabling the large model teacher to provide more targeted guidance and answers.

[0124] Furthermore, the code intent recognition model based on Alpaca and Self-Instruct uses Self-Instruct techniques to generate 20K instruction fine-tuning training data for the Alpaca fine-tuning data. Figure 8 A model framework diagram for Self-Instruct command generation is provided.

[0125] The method for generating 20K instruction fine-tuning training data using the Self-Instruct technique is as follows:

[0126] Starting with a set of hand-written task instructions as a task pool, each task instruction consists of one instruction and one input / output instance for each task. Random tasks are drawn from this task pool and used to prompt the existing LM to generate new instructions and corresponding instances. Low-quality or similar generation is then filtered out and added back to the task pool. This process is repeated until 20K training data are generated. This generated data is used later to fine-tune the Alpaca model to better follow the instructions. The large model used in the diagram to generate instructions and instances is GPT3.

[0127] The instruction adjustment process employs an autoregressive generation task to fine-tune Alpaca. The principle of the autoregressive generation task is as follows: for unlabeled corpus U = {u1, u2, ..., u...} n The maximum (log-likelihood) estimate is:

[0128]

[0129] Where i is the context window size, p is the conditional probability, and θ is the parameter of the conditional probability, which is updated using Adam.

[0130] Furthermore, refer to Figure 5 As shown, S200 includes the following steps:

[0131] S210. Use automatic crawling technology to build a database containing thousands of algorithm questions, and use the cache of users' historical query records as questions. Calculate the similarity between the user's cached information and the candidate algorithm questions in the database. Based on the similarity calculation, select the most relevant TOP-10 or TOP-1 as the answers for the code questions recommended on the homepage and the related questions recommended by the code teaching assistant after receiving the correct answer, respectively.

[0132] S220 uses BM25 coarse-ranking search and deep full-information transfer network fine-ranking for more accurate filtering, thereby obtaining the most relevant homepage code questions and the most relevant algorithm questions to the original problem.

[0133] Specifically, the relevant question recommendation based on the deep full information transmission network can not only be used in code teaching assistants to recommend questions on relevant knowledge points to users after they have answered correctly, but also in personalized question recommendations on the website homepage.

[0134] The Deep Full Information Transmission Network (D-FITN) is a comprehensive model for sentence pair matching tasks, combining sentence expression-based and information interaction-based paradigms. Text similarity calculation is one aspect of sentence pair matching. We abstract the relevant question recommendation task into a text similarity calculation task. The D-FITN can effectively focus attention on the thematic information that the questions want to test, and perform fine-grained searching for the most relevant questions among the existing questions. Figure 4 The model architecture diagram of this network is given.

[0135] This recommendation model first uses a database of 3000 algorithm questions built using automated web crawling technology. It uses cached user query records as questions, calculates the similarity between the user's cached information and the candidate algorithm questions in the database, and selects the most relevant TOP-10 or TOP-1 questions as the answers recommended on the homepage and in the code tutorial assistant after receiving the correct answer, respectively. Due to the large number of questions in the database, we designed a two-stage retrieval method using BM25 coarse-ranking and deep full-information network fine-ranking, balancing the accuracy and efficiency of relevant question recommendations. Below... Figure 5 An example diagram of the model is provided.

[0136] Furthermore, after a user answers a question correctly, we will first process the question into words and extract keywords to obtain a keyword set. We will then use this keyword set as search keywords and employ the BM25 algorithm from the field of information retrieval to calculate the similarity between the question and all questions in the algorithm question set. We will then perform a coarse ranking of the candidate algorithm questions and extract the top-ranked similar questions for further processing.

[0137] In S220, the principle of the BM25 coarse-sorting search is as follows:

[0138]

[0139] Where Q represents the question that the user has answered correctly, d represents the candidate algorithm question, and c i The word in Q, w iThe word weight is represented by the Inverse Document Frequency (IDF) in the BM25 coarse-grained search method, and is calculated as follows:

[0140]

[0141] Where N represents the total number of problems in the algorithm problem set, df i For keywords containing c i The number of questions, for a certain keyword c i , including c i The more documents there are, the better c i The lower the importance and the lower the distinguishability, the smaller the IDF. Therefore, IDF is used to characterize c. i Similarity to documents,

[0142] The keywords extracted from the original question are matched with pre-stored keyword sequences in the candidate algorithm question set. Each sequence is scored, and the ten algorithm question pairs with the highest scores are selected as candidate related questions and recommended to the user.

[0143] Furthermore, in S220, the deep full-information transmission network model includes several sub-units, each sub-unit including an embedding module, a deep interaction module, and a prediction module. The embedding module, deep interaction module, and prediction module are connected sequentially. The deep full-information transmission network model is formed by stacking these sub-units sequentially.

[0144] The embedding module uses word embeddings obtained based on BERT and convolutional embeddings obtained based on a convolutional neural network (CNN) to concatenate and obtain initial embedding representations of the original question and coarsely ranked candidate questions. This representation is then input into a Bi-LSTM layer to obtain a better interactive representation.

[0145]

[0146]

[0147] Q i ChConv is the original problem or a candidate related subproblem obtained through coarse sorting, l is the character-level CNN, and l is the representation after the first stacking iteration.

[0148] Unlike traditional self-attention modules that use matrix multiplication to obtain self-attention weights, the deep interaction module does not use the sum of element-wise products of rows and columns to represent the attention weight of position i for position j. Instead, it calculates the element-wise products to obtain a 3D matrix of interactions to be selected, which can retain more dimensional information.

[0149]

[0150] in This indicates element-wise multiplication.

[0151] The 3D matrix of candidates to be selected after interaction is concatenated with the memory information obtained from the previous layer, and then passed through a fully connected layer to obtain the matrix of deep interaction.

[0152]

[0153] Finally, an attention pooling layer is used to reduce the dimensionality of the feature representation after 3D depth interaction.

[0154]

[0155] After concatenating the original encoded representations, feature selection is performed through a fully connected layer to obtain the final feature representation, which serves as the output of this module.

[0156]

[0157] In the above formulas, f represents a fully connected layer;

[0158] The prediction module then passes the deep interaction feature representations obtained above through a multilayer perceptron (MLP) layer to obtain the final relevance score. The most relevant question is then selected as the relevant question recommended to the user by the large language model.

[0159] i = argmax i (sigmoid(W0c i +θ)).

[0160] A storage medium storing a computer program, which, when executed by a processor, implements the aforementioned learning method for adolescents based on a large language model algorithm code.

[0161] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method for adolescent algorithm code-assisted learning based on a large language model.

[0162] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0163] This invention provides a learning system and method for algorithm code assistance for teenagers based on a large language model. It can effectively help teenagers aged 10-15 develop an interest in coding. The one-to-one large model, acting as a private tutor, conforms to the normal learning patterns of human beings. In practice, it can effectively expand teenagers' knowledge reserves, improve their programming skills, expand their divergent thinking, guide teenagers to think deeply, and experience the algorithm implementation process.

[0164] Table 1 below shows the performance of Llama, the base model of Alpaca, in code generation.

[0165]

[0166]

[0167] Table 1

[0168] For the question recommendation model related to deep full information transmission networks, we trained and tested the model on the standard dataset LCQMC. The LCQMC dataset is a Chinese question-answering matching dataset with 260,000 samples, which is widely used in some Chinese semantic matching evaluations. The accuracy and recall on the test set are shown in Table 2 below:

[0169]

[0170] Table 2.

Claims

1. A learning system for teenagers based on large language models and assisted by algorithm code, characterized in that, The large language model-based algorithm code-assisted learning system for teenagers includes a tiered difficulty question generation module, a code intent recognition module, a related question recommendation module, and a modular programming Enjoy Code module. The tiered difficulty question generation module, code intent recognition module, and related question recommendation module are all integrated into the large language model-based algorithm code-assisted learning system for teenagers, forming a large model teacher (Ada). The large model teacher (Ada) is used to provide programming code teaching services for students with self-learning abilities. The modular programming Enjoy Code module is used to provide drag-and-drop modular teaching services for younger beginners with lower knowledge levels. The stepped difficulty question generation module is used to generate original questions with specific knowledge points based on the user's requirements when the large model teacher Ada receives a user request. The code intent recognition module is used to automatically identify the purpose and function of the code that the user has entered based on the question information generated by the step-by-step difficulty question generation module after the large model teacher Ada receives the question information, and to predict the next operation that the user should perform and the knowledge that the user should possess. The relevant question recommendation module is called by the large model teacher Ada to recommend questions related to relevant knowledge points to the user when the user has answered correctly. It is also used for personalized question recommendations on the website homepage. The modular programming Enjoy Code module integrates a Scratch visual programming module and embeds a JupyterNotebook. It uses hyperlinks to link the Scratch visual programming module and the puzzle game module, providing a clear representation and output of data structures and content.

2. A method for adolescent algorithm code-assisted learning based on a large language model, comprising the adolescent algorithm code-assisted learning system based on a large language model as described in claim 1, characterized in that, The algorithm-based learning method for teenagers based on large language models includes the following steps: S100: Determine the user's needs. If the user's needs are historical, proceed to S200; if the user's needs are real-time, proceed to S300. S200, Recommend relevant questions to users; S300 generates and recommends tiered difficulty questions to users; S400: After the user answers, the code intent of the user's answer is identified; S500: Based on the user's needs, it can provide explanations of the knowledge points for the current question or provide targeted code guidance for the answer. S600. Determine whether the answer is correct. If correct, proceed to S700; otherwise, return to S400. S700: Determine whether additional conditions can be added to the current question. If yes, return to S300 and recommend a question of higher difficulty to the user; otherwise, return to S200.

3. The method for adolescent algorithm code-assisted learning based on a large language model according to claim 2, characterized in that, In S300, the generation of tiered difficulty questions is achieved through an iterative prompting-based tiered difficulty question generation model. This model uses a hard prompt and obtains the relationship between the question and each prompt p through BERT. i The encoding representation of k i The encoding of question Q is q. q = BERT(Q) k i =BERT(p i ) Each prompt encoding representation p is obtained through a multi-head self-attention layer MHSA. i The representation c after interaction with the original problem encoding representation q i , c j =Concat(head i ...head n )W O The representation information is input into a multilayer perceptron (MLP) layer. The MLP layer obtains a relevance score between each prompt and the original question. After normalization using softmax, each prompt p is obtained. i The probability a i The prompts for using the model are selected in a roulette-like manner; a i =softmax(f(W0c i +i)) Where f is the sigmoid function.

4. The method for adolescent algorithm code-assisted learning based on a large language model according to claim 2, characterized in that, In S400 and S500, a code intent recognition model based on Alpaca and Self-Instruct is used to identify the code answers input by the user, determine the purpose and function of the code answers, and predict the next operation that the user should perform and the knowledge that the user should possess, forming guided teaching. The code intent recognition model based on Alpaca and Self-Instruct uses Self-Instruct technology to generate 20K instruction fine-tuning training data for fine-tuning Alpaca data.

5. The method for adolescent algorithm code-assisted learning based on a large language model according to claim 4, characterized in that, The method for generating 20K instruction fine-tuning training data using the Self-Instruct technique is as follows: The Alpaca model begins with a task pool consisting of a single instruction and an input / output instance for each task, written manually. Random tasks are drawn from this pool and used to prompt the existing model (LM) to generate new instructions and corresponding instances. Low-quality or similar generation is then filtered out and added back to the task pool. This process is repeated until 20,000 training data points are generated. This data is used later for instruction tuning of the Alpaca model. The instruction adjustment process employs an autoregressive generation task to fine-tune Alpaca. The principle of the autoregressive generation task is as follows: for unlabeled corpus U = {u1, u2, ..., u...} n The maximum (log-likelihood) estimate is: Where i is the context window size, p is the conditional probability, and θ is the parameter of the conditional probability, which is updated using Adam.

6. The method for adolescent algorithm code-assisted learning based on a large language model according to claim 2, characterized in that, S200 includes the following steps: S210. Use automatic crawling technology to build a database containing thousands of algorithm questions, and use the cache of users' historical query records as questions. Calculate the similarity between the user's cached information and the candidate algorithm questions in the database. Based on the similarity calculation, select the most relevant TOP-10 or TOP-1 as the answers for the code questions recommended on the homepage and the related questions recommended by the code teaching assistant after receiving the correct answer, respectively. S220 uses BM25 coarse-ranking search and deep full-information transfer network fine-ranking for more accurate filtering, thereby obtaining the most relevant homepage code questions and the most relevant algorithm questions to the original problem.

7. The method for adolescent algorithm code-assisted learning based on a large language model according to claim 6, characterized in that, In S220, the principle of the BM25 coarse-sorting search is as follows: Where Q represents the question that the user has answered correctly, d represents the candidate algorithm question, and c i The word in Q, w i The word weight is represented by the Inverse Document Frequency (IDF) in the BM25 coarse-grained search method, and is calculated as follows: Where N represents the total number of problems in the algorithm problem set, df i For keywords containing c i The number of questions, for a certain keyword c i , including c i The more documents there are, the better c i The lower the importance and the lower the distinguishability, the smaller the IDF. Therefore, IDF is used to characterize c. i Similarity to documents, The keywords extracted from the original question are matched with pre-stored keyword sequences in the candidate algorithm question set. Each sequence is scored, and the ten algorithm question pairs with the highest scores are selected as candidate related questions and recommended to the user.

8. The method for adolescent algorithm code-assisted learning based on a large language model according to claim 6, characterized in that, In S220, the deep full-information transmission network model includes several sub-units. Each sub-unit includes an embedding module, a deep interaction module, and a prediction module. The embedding module, deep interaction module, and prediction module are connected sequentially. The deep full-information transmission network model is formed by stacking these sub-units sequentially. The embedding module uses word embeddings obtained based on BERT and convolutional embeddings obtained based on a convolutional neural network to concatenate and obtain initial embedding representations of the original question and coarsely ranked candidate questions. This representation is then input into a Bi-LSTM layer to obtain a better interactive representation. Q i Chconv represents the original problem or candidate related subproblems obtained through coarse sorting, where Chconv is a character-level CNN and l is the representation after the l-th stacked iteration. The deep interaction module obtains a 3D post-interaction matrix to be selected by calculating element-wise multiplication. in This indicates element-wise multiplication. The 3D matrix of candidates to be selected after interaction is concatenated with the memory information obtained from the previous layer, and then passed through a fully connected layer to obtain the matrix of deep interaction. Finally, an attention pooling layer is used to reduce the dimensionality of the feature representation after 3D depth interaction. After concatenating the original encoded representations, feature selection is performed through a fully connected layer to obtain the final feature representation, which serves as the output of this module. In the above formulas, f represents a fully connected layer; The prediction module passes the final feature representation through a multilayer perceptron layer to obtain the final relevance score, and selects the most relevant question as the relevant question recommended to the user by the large language model. i=argmax i (sigmoid(W0c i +θ))。 9. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the algorithm code-assisted learning method for teenagers based on a large language model as described in any one of claims 2-8.

10. A computer device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the algorithm code-assisted learning method for teenagers based on a large language model as described in any one of claims 2-8.

Citation Information

Patent Citations

  • Data structure teaching software

    CN102592486A

  • Extracurricular learning tutoring system based on deep learning and knowledge graph and implementation method

    CN112184500A