A code error diagnosis method capable of holographic reproduction

By collecting and analyzing code execution trajectories through a multi-layered pipeline, a semantic step sequence with clear algorithm operation labels is generated. This solves the problems of semantic missingness in code error tracking and analysis and lack of runtime evidence in AI diagnosis in existing technologies. It achieves high-precision code error location and visual playback, supports automatic generation of execution animations for any user's code, and forms a complete learning loop.

CN123178232APending Publication Date: 2026-11-27SHANGHAI OCEAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611348517.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-02
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing code error tracing and analysis methods suffer from deficiencies such as missing execution trajectory semantics, lack of runtime evidence for AI diagnosis, and inability to cover user error codes in visualization, thus failing to achieve a complete teaching support chain.

Method used

Through a multi-layered core pipeline consisting of imaging tracer function, imaging function, symptom evidence function, and holographic reconstruction function, the code execution trajectory is collected and analyzed to generate a semantic step sequence with clear algorithm operation labels. A large language model is used for line-level error localization and visual playback, and the execution animation of any user code can be automatically generated.

Benefits of technology

It improves the accuracy of error localization from the text/function level to the line-of-code level and the specific variable value level, significantly reduces the risk of AI illusion, provides consistent visual interaction effects across languages, supports automatic generation of execution animations for any code, and forms a complete learning loop.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178232A_ABST
    Figure CN123178232A_ABST
Patent Text Reader

Abstract

The application discloses a code error diagnosis method capable of holographic reproduction, and steps are as follows: obtaining a code to be diagnosed, a question description and expected output for error diagnosis, performing language recognition on the code to be diagnosed and executing entry standardization encapsulation, and then running the code to be diagnosed in an isolated sandbox; using a contrast tracing function to collect an execution process of the code to be diagnosed running in the isolated sandbox in real time to obtain an original snapshot sequence; using a developing function to process the original snapshot sequence to obtain a semantic step sequence; using a symptom evidence function to extract features from the semantic step sequence to obtain program runtime code vital signs; and inputting the program runtime code vital signs, the source code, the question description and the expected output into a large language model to obtain a labeling result including diagnosis information corresponding to each line. The code error diagnosis method has good application prospects by virtue of execution tracking, semantic analysis and visual interaction technology, and realizes tracing development, symptom evidence and holographic reproduction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and to a code error diagnosis method that can achieve holographic reconstruction, and particularly to a code error diagnosis method based on execution tracing and evidence-based symptom tracking to achieve holographic reconstruction. Background Technology

[0002] Real-time code error tracking and analysis refers to the process of dynamically collecting, reconstructing, and locating errors in the execution of user-submitted code during online programming assessments, and accurately mapping the execution status to source code lines. This technology is widely used in programming education, algorithm training, online assessments, and intelligent error correction. With the popularization of online programming education and the upgrading of teaching needs, traditional assessment methods that only output judgment results can no longer meet teaching requirements. Error diagnosis technology with process playback, line-level prompts, and visual analysis has become a research hotspot. Unlike conventional code debugging, error tracking in online assessment scenarios needs to adapt to multi-language heterogeneous environments, lightweight sandbox execution, and instructional interactive logic, placing higher demands on lightweight execution data collection, the universality of trajectory modeling, and the accuracy of error prompts.

[0003] Current code error tracing and analysis methods, such as Figure 1 The methods are categorized into three types: debugger-based execution tracing methods, large language model code analysis methods, and algorithm visualization teaching methods.

[0004] Debugger-based execution tracing methods have become mainstream for process analysis in recent years. They typically utilize a debugger interface to mount the executing process and collect line numbers, variables, and call stack information to reconstruct the execution flow. The steps are as follows: After the user submits code, the executing process is mounted via the debugger interface to collect line numbers, variables, and call stack information, outputting a raw snapshot sequence. Currently, the generated raw snapshots only record bytecode execution information, resulting in a large amount of data and scarce effective semantics. Snapshots only identify line-by-line execution and cannot distinguish algorithmic operations such as comparisons, swaps, and index moves; iterative loops produce a large number of duplicate and redundant records, leading to an inflated number of replay steps. Furthermore, this method suffers from the drawback of lacking semantic annotations for algorithmic operations, making it difficult for both AI and users to quickly locate fault nodes and their causes. The core flaw of this method lies in the low semantic density of the generated data, making it unable to distinguish the types of algorithmic operations.

[0005] Large language model code analysis methods, centered on LLM (Large Language Model), directly input user source code text and error messages into the model (LLM). The model then infers errors based on static code patterns and generates natural language diagnostic suggestions. This method does not rely on actual program execution, and its analysis scope is limited to the static features of the code text. Its drawback lies in analyzing only static text, ignoring runtime variable values, branch paths, and exception contexts. Error diagnosis relies on pattern inference from the code's appearance rather than logical judgment of runtime facts, posing a high risk of illusion—the AI ​​may point out non-existent defects or miss real problems. In particular, in complex logic scenarios such as loops and recursion, it is even more difficult to reconstruct the actual execution path based solely on static text, further reducing diagnostic accuracy. Representative works include code review assistance tools based on general large models such as GPT-4 and DeepSeek.

[0006] Algorithm visualization teaching methods use pre-programmed animation scripts to present the correct execution process of standard algorithms in visual formats such as bar charts, pointer animations, and tree diagrams, helping students understand the algorithm principles. The steps are as follows: taking standard algorithm code as input, the animation script is manually pre-programmed and played along a preset path to demonstrate the correct algorithm's execution process. Its limitation is that it only supports preset standard algorithms and cannot accept arbitrary user code (especially code containing errors) and automatically generate corresponding visual animations. Meanwhile, online evaluation scenarios cover multiple languages ​​such as Java, Python, C, and C++. Existing solutions lack a unified standard for cross-language trajectory modeling and playback, making it difficult to achieve consistent visualization and comparative analysis of the execution process. Representative tools include VisuAlgo and Python Tutor.

[0007] All of the above methods suffer from the common defects of "having data but no understanding", "having analysis but no evidence", and "having animation but no universality", and cannot form a complete teaching support chain.

[0008] Therefore, developing a code error diagnosis method that relies on runtime trajectory to achieve evidence-based diagnosis and visual playback is of great practical significance. Summary of the Invention

[0009] Due to the aforementioned deficiencies in existing technologies, this invention provides a code error diagnosis method that relies on runtime trajectory to achieve evidence-based diagnosis and visualized playback, overcoming the shortcomings of existing code error tracing and analysis methods, such as missing execution trajectory semantics, lack of runtime evidence in AI diagnosis, and inability of visualization to cover user error code.

[0010] To achieve the above objectives, the present invention provides the following technical solution: A code error diagnosis method capable of holographic reproduction includes the following steps: (1) Obtain the code to be diagnosed, the problem description for error diagnosis and the expected output, perform language recognition on the code to be diagnosed and perform entry standardization encapsulation, and then run the code to be diagnosed in an isolated sandbox; (2) The execution process of the code to be diagnosed running in the isolation sandbox is collected in real time using the imaging tracer function to obtain the original snapshot sequence; (3) The original snapshot sequence is processed using the development function to obtain the semantic step sequence; (4) Use the symptom-based evidence function to extract features from the semantic step sequence to obtain the code life signs during program execution; (5) Input the program's runtime code vital signs, source code, problem description and expected output into the large language model to obtain annotation results, the annotation results including diagnostic information corresponding to each line.

[0011] This invention achieves traceability and evidence-based diagnostics through innovative execution tracing and semantic parsing. Specifically, it enhances and encapsulates native debugging interfaces to collect high-quality execution trajectories of multi-language code. Then, a deterministic rule engine performs step compression, state differentiation, and semantic annotation on the original snapshot sequence, automatically transforming hundreds of low-semantic-density records into structured semantic steps with clear algorithm operation labels (swap / compare / move / call / return / fill). This enables traceability and visualization from the original snapshot to the semantic steps. From the semantic steps, three types of vital sign data—variable values, branch paths, and abnormal signals—are extracted and submitted to a large language model along with the source code and necessary features. This allows diagnostic conclusions to be based on specific runtime data, improving error localization accuracy from the text / function level to the line-of-code and specific variable value level. This significantly reduces the risk of AI illusions and achieves evidence-based AI diagnosis based on the vital signs of runtime code.

[0012] As a preferred technical solution: The code error diagnosis method for holographic reproduction described above also includes: (6) Using the semantic step sequence and annotation results as input, the holographic reconstruction function is used to achieve visual reconstruction.

[0013] Step (6) drives multimodal visualization reconstruction together with semantic steps and annotation results including diagnostic information. Each execution step carries a complete runtime context, and any code (including error codes) can automatically generate corresponding animations without manual pre-arrangement. At the same time, standardized trajectory logs are uniformly encapsulated through a multi-language adaptation layer to provide a consistent playback experience across languages, realizing the holographic reproduction of execution animations automatically generated by any user code. The visualization interaction effect has been greatly improved compared with existing technologies.

[0014] This invention utilizes an imaging tracer function. P →Development function F →Evidence-based function of vital signs L →Large Language Model (LLM)→Holographic Reproduction Function Oh The multi-layered core pipeline enables the tracer development from the original snapshot to the semantic steps, AI evidence-based diagnosis based on the life signs of runtime code, and holographic reproduction of execution animations automatically generated from any user code, completely breaking the limitation of traditional online evaluation that "only provides the final result".

[0015] This invention fundamentally changes existing code diagnostic methods, which can only make judgments but cannot display the specific steps of code errors, the root cause of errors, the values ​​of variables at the moment of error, and other operational details. Beginners can only rely on their static imagination to troubleshoot the code execution process without real runtime data as a reference, making it difficult to quickly locate code defects. This invention no longer simply tells students "you made a mistake," but replays the entire code execution process line by line for students—how the code proceeds at each step, how the array changes in each iteration, and what the value of the variables is at each moment. Then, the AI ​​indicates the source of the problem through a prompt box on the line where the error occurred.

[0016] To address the aforementioned issues, this invention employs a five-layer architecture—"execution acquisition layer—tracer imaging layer—evidence-based diagnostic layer—holographic reproduction layer—learning feedback layer"—as its core technical architecture, achieving an end-to-end processing pipeline from source code to the learning loop. 1. Execution and data collection layer: This layer is mainly responsible for recording every step of the code execution process, retaining the original execution data, and providing basic support for upper-layer functions. It is a standard engineering basic capability.

[0017] 2. Tracer and Imaging Layer: Drawing on the ideas of medical tracing and imaging, the tracer and imaging function tracks the code execution trajectory line by line and automatically parses the algorithm semantics, transforming the original execution snapshot into a structured sequence of steps with clear operation semantic labels.

[0018] 3. Evidence-based diagnostic layer: Drawing on the diagnostic concept of evidence-based medicine that is "based on data rather than appearances", the system uses the values ​​of variables, execution paths, and exception contexts during code runtime as diagnostic criteria through symptom-based evidence functions. This enables the Large Language Model (LLM) to locate and diagnose line-level errors based on real runtime data, thereby reducing the illusionary risks of static code analysis from the root.

[0019] 4. Holographic Reproduction Layer: Drawing inspiration from the principle of "fragments are the whole picture" in optical holography, the holographic reproduction function ensures that each execution step carries complete context data. Any user code can automatically generate the corresponding execution animation without manual pre-arrangement. It supports timeline dragging, speed adjustment, and dual-column comparison playback of errors and correct results.

[0020] 5. Learning Feedback Layer: Records students' learning behavior while watching code replays, accurately identifies students' knowledge gaps, and forms a complete learning loop, which is a conventional closed-loop supplementary capability.

[0021] The specific process of the evidence-based diagnostic layer is as follows: 1. Vital Signs Collection: Extracting vital signs from the execution trajectory V ( t ), B ( t ), E ( t The triplet forms a complete record of coded vital signs.

[0022] 2. Evidence-based analysis: The vital signs evidence function packages the program's runtime code vital signs, source code, problem description, and expected output and submits them to the Large Language Model (LLM). The LLM then uses the specific values ​​in the program's runtime code vital signs, combined with the source code, problem description, and expected output, to locate the root cause and obtain row-level diagnostic information.

[0023] 3. Row-level annotation: AI return l j The mapping table annotates the corresponding code lines with diagnostic information containing specific variable values ​​(such as "here"). j =3, j +1=4, the array length is only 4, which is out of bounds.

[0024] 4. Tiered response: The results are persistently cached after the initial analysis, and subsequent accesses will hit the cache directly within milliseconds, ensuring a smooth playback experience.

[0025] As described above, in a code error diagnosis method capable of holographic reproduction, the language recognition refers to identifying the programming language to which the code to be diagnosed belongs; The standardized encapsulation of the execution entry point specifically refers to standardizing the input-output interaction logic of the code to be diagnosed using a dedicated adapter corresponding to the programming language to which the code to be diagnosed belongs.

[0026] Dedicated adapters were developed for programming languages ​​such as Java, Python, and C / C++, standardizing the input / output interaction logic for each language. Python programs use the built-in line-level callback interface of sys.settrace to natively capture variable snapshots at the moment of execution of each line of code; Java and C / C++ programs rely on the JDI and GDB debugging interfaces to achieve equivalent single-step execution tracing.

[0027] The raw runtime data collected from various languages ​​will be uniformly packaged into a standardized trace log. The log contains structured fields such as execution step sequence number, source code line number, execution event type, real-time variable snapshot, standard output content, and runtime exception information.

[0028] The data acquisition layer is the underlying foundational support module of the system, serving as a prerequisite for subsequent semantic reconstruction, AI diagnostics, and visualization playback functions. Multi-language adaptation and isolated sandbox execution are both mature engineering solutions in the industry.

[0029] As described above, in a code error diagnosis method capable of holographic reproduction, step (2) specifically comprises: Through the imaging tracer function P The runtime tracing interface of the programming language to which the code to be diagnosed belongs is encapsulated and enhanced, and tracing probes are injected into the code execution flow to collect runtime signals before and after the code line is executed, forming an execution trajectory; the runtime signals include at least the securely serialized variable states, synchronously acquired standard outputs, and exception context information; The contrast tracer function P Specifically: in, C For user-submitted source code, I The code to be diagnosed. For steps t A finite sequence with an index. t From 0 to N , N Total number of execution steps s t It is the first t Runtime snapshot of the step; The s t The complete sequence of snapshots is: in, t This is the current line number being executed; the data source is frame.f_lineno. e t The event type can be set to call, line, return, or exception. n t This is a snapshot of runtime variables, generated by integrating local variables from `frame.f_locals` and global variables from `f_globals`. oh t The program accumulates standard output, which is taken from the output buffer stdout_buffer. x t This is an optional storage field that records runtime exception information, including the exception type exc_type and the exception content exc_value.

[0030] As described above, in a code error diagnosis method capable of holographic reproduction, step (3) specifically comprises: Through the development function F Transform the original snapshot sequence with low semantic density into a sequence of semantic steps with explicit operation labels; The development function F Specifically: in, This is the original snapshot sequence. This is the semantic step sequence generated after compression, differencing, and annotation. j For step indexing, K The total number of semantic steps; K N, The number of semantic steps is much smaller than the number of original snapshots (e.g., 15). 342), reflecting the development and compression effect; The s j The semantic step sequence is as follows: in, Inherited from the imaging tracer function P Output s t Keyframe snapshots retained after compression These correspond to the result components after the completion of the three sub-steps: step compression, state differencing, and semantic annotation. The three sub-steps are as follows: (1) Step compression. The same source code line is executed multiple times in the loop body, and the original record generates a large number of redundant snapshots. The system automatically merges the consecutive records of the same line and only retains the key frames in which the variable state has changed substantially, compressing hundreds of snapshots into dozens.

[0031] (2) State difference. The system compares key data structures (sorted arrays, search pointers, dynamic programming tables, etc.) in adjacent snapshots frame by frame, and automatically identifies the state changes between each step and the previous step—which element positions are swapped, where the pointer moves from and where, and which cell in the two-dimensional table is updated.

[0032] (3) Semantic labeling. Based on the state difference results, the system automatically assigns algorithm semantic labels to each step according to predefined rules: 1. swap: The difference characteristic of two elements in an array being swapped, that is, the two numbers are being swapped.

[0033] 2. compare: This corresponds to the difference feature that only accesses and compares two elements without performing a transposition operation, that is, the program is determining which of the two numbers is smaller or larger.

[0034] 3. Move: This refers to the differential feature where the pointer or index position changes, meaning the search range of the code is narrowed to the left or right.

[0035] 4. call (invocation): The differential characteristic of the function triggering the invocation behavior is that the program has entered the next level of recursion.

[0036] 5. return: The difference between the values ​​returned by the function after execution indicates the result calculated for the current level of recursion.

[0037] 6. Fill (table filling): This corresponds to the difference feature where the value of a cell in a two-dimensional table is updated, which is the value that dynamic programming is deriving and calculating in this cell.

[0038] Taking bubble sort as an example, the original trace has 300+ records. After semantic reconstruction, it becomes about 15 key steps, each with a clear semantic label (Step 3: compare arr[0]=5 and arr[1]=2; Step 4: swap - 5 is greater than 2, swap).

[0039] Through the imaging tracer function P , s t Complete sequence of snapshots, development function F and s j The semantic step sequence leads to the complete tracer development function as follows: in, Specifically, it involves function composition, which is executed first. P Execute again F ;( C,I Specifically, the input to the composite function is the source code. C With the code to be diagnosed I ; Specifically, the development function F The output sequence of semantic steps, j From 0 to K .

[0040] The tracer imaging function indicates the input source code and the code to be diagnosed, first by the contrast tracer function. P The execution trajectory was collected line by line. N Step the original snapshot, then use the development function. F Compression, redundancy removal, and semantic annotation of the algorithm result in the final output. KA sequence of structured semantic steps with operation labels ( K N ). This fully expresses that "contrast acquisition + imaging analysis" is an end-to-end continuous pipeline—input C and I , directly obtain s j No human intervention is required in the process.

[0041] As described above, in a code error diagnosis method capable of holographic reproduction, step (4) specifically comprises: From semantic steps s j Extract the runtime code life signs of the program, namely the variable values, branch paths, and exception signal triples at each step: in V j For variable snapshots, B j For branching directions, E j This triplet is an abnormal signal, constituting the runtime code life signs of the program.

[0042] As described above, in a code error diagnosis method capable of holographic reproduction, step (5) is as follows: The runtime code lifecycle data of the program, along with the source code, problem description, and expected output, are packaged and submitted to the large language model to generate annotation results. l j That is, a row-level diagnostic triplet that includes specific variable values ​​and the cause of the anomaly; l j Specifically: in line j For line numbers, hint j For diagnostic information, suggestion j Recommendations for repair; The above process is as follows: in, For symptom-based evidence functions from semantic step series The program runtime code vital signs extracted from it. C The source code submitted by the user, used by LLM to locate the context of the erroneous line. ,PProvide the correct semantic reference for the algorithm in the problem description. E The expected output is compared with the vital sign data to determine the deviation point. For the output annotation results, each step l j Bind line number, diagnostic information, and repair suggestions.

[0043] As described above, in a code error diagnosis method capable of holographic reproduction, step (6) specifically comprises: Semantic step sequence and annotation results As input, using the holographic reconstruction function Oh Achieve multimodal visual reconstruction—each execution step carries a complete runtime context (array state, variable snapshot, pointer position, exception flag), enabling any user code to automatically generate corresponding execution animations without manual pre-arrangement; The holographic reproduction function Oh Specifically: in, Provide the line number for each step in the semantic step sequence. j Variable snapshot n j Semantic tags t j Output text oh j Abnormal information x j —The raw data that drives the canvas, variable panel, console, and exception panel. Provide diagnostic information for each step of the annotation results. hint j Repair suggestions suggestion j —Light bulb annotations on the driver code panel and repair suggestions on the error panel. For the output holographic playback view sequence, each step R j The complete rendering state of the corresponding four-zone linked front-end interface; The R j Specifically: in, H j The code line highlighting and diagnostic information are displayed in conjunction, with line numbers derived from... j Diagnostic information comes from lj of hint j ; G j Represents the algorithm canvas rendering state, and can automatically match the corresponding visualization rendering paradigm based on the algorithm type. The array data and semantic event tags originate from... n j and t j ; M j The panel represents an array of variable cards, visually distinguishing between arrays and ordinary numerical values. Variable snapshots are sourced from... n j ; C j This represents the console output text display module, where the accumulated output text originates from... oh j ; E j This represents the error display panel, showing the error type, error message, and suggested repair methods. The error information originates from... x j The repair suggestion originated from suggestion j .

[0044] The complete pipeline function is: P Imaging acquisition → S t (Original snapshot) F Development and analysis → s j (Semantic steps) L Vital signs extraction → ( V j ,B j ,E j (Program runtime code vital signs) L Large Language Model Diagnosis →l j (The labeled results are the row-level diagnoses.) Oh Holographic Reproduction → R j (Four-zone linked playback view) Enter source code C Diagnostic Code I Problem Description P Expected output EAfter four layers of concatenated processing, a holographic playback view arranged along the timeline is output. The playback interface contains four linked panels: (1) Code panel. The currently executing line in Monaco Editor is marked with a purple highlight bar, which scrolls automatically with the playback progress. If there is an AI diagnostic prompt in the current line, a yellow light bulb icon will appear next to the line number. Click to expand the specific diagnostic content.

[0045] (2) Algorithm Canvas. The system configures exclusive visualization rendering schemes and corresponding animation effects for different algorithms, specifically divided into five categories: Sorting algorithms (bubble sort, quick sort, merge sort, etc.): Use bar charts and array cards for rendering. Elements are highlighted and blinked during comparison operations. When elements are swapped, the bars are smoothly shifted. Incorrect swap directions are highlighted in red. Search algorithms (binary search, linear search, etc.): use array cards combined with pointer lines for rendering. The left, mid, and right pointers slide smoothly with each execution step, and a green diffusion wave animation is triggered when the target is hit. Dynamic programming algorithm: It uses a two-dimensional grid table for rendering, with the currently calculated cell highlighted and the backtracking path marked with gradient colors; Graph Algorithm: Node-edge force-guided graph rendering is used, visited nodes are lit up one by one, and edge lines that have undergone relaxation operations are displayed with pulse animation; Recursive and divide-and-conquer algorithms: A tree-like unfolding graph is used for rendering. The function call stack expands layer by layer, and the recursive return values ​​flow upwards along the tree lines.

[0046] (3) Variable panel. The variables involved in the current step are displayed in a card array: array variables are rendered as a visual grid array, and the operated elements are marked with a highlighted border; value type variables are displayed in the format of "variable name: current value".

[0047] (4) Error Panel. When replaying to the error step, a yellow banner appears at the top of the panel, displaying the error type, error message, and AI repair suggestions.

[0048] Interactive controls: Supports play / pause, frame-by-frame forward / backward, timeline dragging for navigation, and three speed settings (0.5x / 1x / 2x). All operations support keyboard shortcuts.

[0049] The above technical solution is only one feasible technical solution of the present invention. The scope of protection of the present invention is not limited thereto. Those skilled in the art can reasonably adjust the specific design according to actual needs.

[0050] The above invention has the following advantages or beneficial effects: (1) The code error diagnosis method of the present invention, which can realize holographic reproduction, completes the high-quality execution trajectory collection of multi-language code by enhancing and encapsulating the native debugging interface, and then performs step compression, state difference and semantic annotation on the original snapshot sequence by a deterministic rule engine, automatically transforming hundreds of low semantic density records into structured semantic steps with clear algorithm operation labels (swap / compare / move / call / return / fill), thereby realizing the tracing and development from the original snapshot to the semantic steps; (2) The code error diagnosis method of the present invention, which can realize holographic reproduction, extracts three types of vital sign data from semantic steps: variable values, branch direction, and abnormal signals. These data are submitted to the large language model along with the source code and necessary features, so that the diagnostic conclusion is based on specific runtime data. This improves the error location accuracy from the text level / function level to the code line level and specific variable value level, significantly reduces the risk of AI illusion, and realizes AI evidence-based diagnosis based on runtime code vital signs as evidence. (3) The code error diagnosis method of the present invention, which can realize holographic reproduction, drives multimodal visualization reconstruction together with semantic steps and annotation results including diagnostic information. Each execution step carries a complete runtime context, and any code (including error code) can automatically generate corresponding animation without manual pre-arrangement; (4) The code error diagnosis method of the present invention, which can realize holographic reproduction, provides a consistent playback experience across languages ​​by uniformly encapsulating standardized trajectory logs through a multi-language adaptation layer, realizes the holographic reproduction of the execution animation of any user code automatically generated, and the visualization and interactive effect has been greatly improved compared with the existing technology, and has great application prospects. Attached Figure Description

[0051] The invention, its features, shape, and advantages will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. Like reference numerals denote like parts throughout the drawings. The drawings are not drawn to scale; the emphasis is on illustrating the gist of the invention.

[0052] Figure 1 A schematic diagram illustrating the existing code error tracing and analysis methodology and its core defects; Figure 2 This is a flowchart of the code error diagnosis method for holographic reproduction according to the present invention; Figure 3 This is a schematic diagram illustrating the code conversion of the present invention; Figure 4 The flowchart for tracer development; Figure 5 This is a comparison chart of the present invention and existing technologies for diagnosing AI hallucinations; Figure 6 This is a schematic diagram of the playback interface; Figure 7 A schematic diagram of the algorithm's learning closed loop; Figure 8 A comparison chart of the number of snapshots before and after tracer development; Figure 9 A comparison chart of the effectiveness of evidence-based diagnosis based on physical signs; Figure 10 , 11 Screenshots 12 and 13 are screenshots of steps 9, 10, 11 and 12 of the error replay interface, respectively. Detailed Implementation

[0053] The structure of the present invention will be further described below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the present invention.

[0054] Example 1 A code error diagnosis method capable of holographic reproduction, the steps of which are as follows: Figure 2 As shown: (1) Obtain the code to be diagnosed, the problem description and expected output for error diagnosis, perform language recognition on the code to be diagnosed (identify the programming language to which the code to be diagnosed belongs) and perform entry standardization encapsulation (apply the dedicated adapter corresponding to the programming language to which the code to be diagnosed belongs to standardize the input and output interaction logic of the code to be diagnosed), and then run the code to be diagnosed in the isolation sandbox; The code transformations involved are as follows: Figure 3 As shown, the specific steps are: four language codes → adaptation layer → unified trace_log format. Figure 3 On the left are four code snippets with different syntaxes: Java, Python, C++, and C. In the middle, conversion boxes of different colors represent adapters for various languages. On the right, they are all grouped into a standard JSON record in the same format.

[0055] (2) The execution process of the code to be diagnosed running in the isolation sandbox is collected in real time using the contrast tracer function to obtain the original snapshot sequence, specifically: Through the imaging tracer function P Inject tracing probes into the code execution flow to collect runtime signals line by line and form a complete execution trajectory; For Python code, the imaging tracer function P It is implemented based on the sys.settrace callback mechanism; on the basis of the original callback mechanism, variable safe serialization, output buffer synchronization and automatic exception context capture are added, and double-ended sampling is achieved by recording the runtime state before and after the code line is executed. For Java language code, the imaging tracer function PBased on the JDI (Java Debug Interface) debugging interface: By mounting the Java Virtual Machine debugging session, single-step execution is performed at the breakpoint of the code to be diagnosed, and the currently visible local variables and array states are read through the stack frame interface. Combined with output buffer acquisition and exception stack capture, the original snapshot sequence is obtained. For C / C++ language code, the imaging tracer function P Based on the GDB debugger: The code to be diagnosed is executed step by step using a GDB script. Local variables, array elements and memory status are read at breakpoints. With output redirection and signal capture, the original snapshot sequence is obtained. Contrast tracer function P Specifically: in, C For user-submitted source code, I The code to be diagnosed. For steps t A finite sequence with an index. t From 0 to N , N Total number of execution steps s t It is the first t Runtime snapshot of the step; s t The complete sequence of snapshots is: in, t The current line number being executed. e t For the execution event type, n t A snapshot of runtime variables. oh t To accumulate standard output for the program, x t This is an optional storage field used to record runtime exception information.

[0056] (3) The original snapshot sequence is processed using the developing function to obtain the semantic step sequence, specifically: Through the development function F Transform the original snapshot sequence into a semantic step sequence with explicit operation labels; Development function F Specifically: in, This is the original snapshot sequence. This is the semantic step sequence generated after compression, differencing, and annotation. j For step indexing, K The total number of semantic steps; s j The semantic step sequence is as follows: in, Inherited from the imaging tracer function P Output s t Keyframe snapshots retained after compression These correspond to the result components after the completion of the three sub-steps: step compression, state differencing, and semantic annotation, respectively. Imaging tracer → Development as Figure 4 As shown, Figure 4 On the left are hundreds of original snapshot sequences, which are processed through three nodes in the middle—step compression, state differentiation, and semantic annotation—and on the right is a concise labeled sequence of steps, with a small bubble next to each step containing human-readable descriptive text.

[0057] (4) Using symptom-based evidence functions L Feature extraction is performed on the semantic step sequence to obtain the runtime code vital signs, specifically: From semantic steps s j Extract the runtime code life signs of the program, namely the variable values, branch paths, and exception signal triples at each step: in V j For variable snapshots, B j For branching directions, E j This is an abnormal signal.

[0058] (5) Input the program's runtime code life signs, source code, problem description, and expected output into the large language model to obtain the annotation results. l j ; l j Specifically: in line j For line numbers, hint j For diagnostic information, suggestion j Recommendations for repair; The above process is as follows: in, For symptom-based evidence functions from semantic step series The program runtime code vital signs extracted from it. C For user-submitted source code, P For the title description, E For the desired output, This is the output annotation result.

[0059] (6) Using the semantic step sequence and annotation results as input, the holographic reconstruction function is used to achieve visual reconstruction, specifically: Semantic step sequence and annotation results As input, using the holographic reconstruction function Oh The system enables visual reconstruction, with the code panel highlighting the current line of execution and displaying AI diagnostic information. The algorithm canvas automatically matches rendering paradigms such as sorted bar charts or search pointer animations based on the algorithm type of the problem. The variable panel synchronizes the variable snapshot of the current step in real time. The exception panel displays error details and repair suggestions at the error step. Students can drag the timeline, step by frame, and interact with multiple speed settings to review the complete execution process. Holographic Reproduction Function Oh Specifically: in, It is a sequence of semantic steps. For the annotation results, This is the output sequence of holographic playback views; R j Specifically: in, H j The code line highlighting and diagnostic information are displayed in conjunction, with line numbers derived from... j Diagnostic information comes from l j of hint j ; G j Representing the algorithm's canvas rendering state, the array data and semantic event labels originate from... n j and t j ; M j Represents an array of variable panel cards; variable snapshots are derived from... n j; C j This represents the console output text display module, where the accumulated output text originates from... oh j ; E j This represents the error display panel, showing the error type, error message, and suggested repair methods. The error information originates from... x j The repair suggestion originated from suggestion j ; The playback interface of this invention is specifically as follows: Figure 6 As shown, Figure 6 The top left is the Monaco code editor, with the current line highlighted and a light bulb icon next to the line number; the top right is the algorithm canvas, showing a bar chart using sorting as an example, with two bars undergoing an animation of swapping positions (arrows indicate the direction); the bottom left is the variable card panel, where arrays are displayed in colored squares, and the currently operated element has a highlighted border; the bottom right is the console output area, with a timeline slider and play / pause / speed adjustment buttons at the bottom, and dashed arrows between the four columns indicating synchronized relationships.

[0060] In contrast, existing algorithm visualizations are "pre-arranged animations" that can only display the fixed script of standard algorithms; this method achieves data-driven holographic reproduction—any code submitted by a user (including error codes) can automatically generate corresponding execution animations, enabling students to "see" the actual execution behavior of their own code for the first time, rather than just obtaining a result judgment.

[0061] (7) During the playback process, the system continuously records the student's operation behavior during the playback process - which step they stay in the longest, which section they repeatedly rewind to, and how many times they manually adjust the complexity - these behavioral data are reported to the backend to identify the student's weak points, drive personalized question recommendations and automatic adjustment of subsequent playback speed, and form a learning closed loop of diagnosis-intervention-re-diagnosis. Learning behavior analysis and personalized recommendations are common methods in the field of educational technology. The unique value of this invention lies in the fact that the first three core steps provide the content and materials for analysis (semantic trajectory + AI diagnosis), while the feedback loop is merely the "last mile" in translating these results into learning outcomes.

[0062] Algorithm learning closed loop such as Figure 7 As shown, the student's actions on the replay interface (pause / rewind / speed adjustment) are collected as behavioral data → the backend analysis shows that "the student repeatedly reviewed the array out-of-bounds problem" → the system automatically recommends relevant practice questions and adjusts the initial speed of the next replay.

[0063] Comparative Example A code error diagnosis method that can achieve holographic reproduction is specifically proposed by inputting the code to be diagnosed, source code, problem description and expected output, which are the same as those in Example 1, into a large language model to obtain analysis results.

[0064] Comparison of the analysis results of Example 1 and the comparative example Figure 5 As shown in the figure, the essential difference between the method of this application and existing AI programming assistants can be seen: ordinary AI code review relies solely on static code text for analysis, can only vaguely speculate on code errors, has a high risk of hallucination in diagnostic results, and the teaching mode directly outputs the standard answer; while this method uses both code text and runtime code vital signs {V,B,E} as the basis for analysis, which can accurately locate the line of code with errors and provide the corresponding specific variable values. All diagnostic conclusions are supported by vital sign data, effectively reducing the risk of hallucination. At the teaching level, only the abnormal state of the program is marked, guiding students to independently troubleshoot problems.

[0065] To verify the effectiveness of the technical solution of this invention, a test set was constructed by selecting 12 programming problems covering four types of algorithms: sorting, searching, dynamic programming, and recursion. For each problem, correct submissions and submissions with errors (including three typical errors: array out of bounds, missing boundary conditions, and logical inversion) in both Python and Java were collected, totaling 96 test samples. The experimental environment was deployed with a five-layer architecture: "Execution Acquisition Layer—Tracer Development Layer—Evidence-Based Diagnosis Layer—Holographic Reproduction Layer—Learning Feedback Layer".

[0066] 1. Tracer development effect With imaging tracer function P The acquired raw snapshot sequence and the developed function F The processed semantic step sequence is compared. Figure 8 This paper presents a before-and-after comparison of tracer development for a set of bubble sort error codes.

[0067] Table 1 shows the statistical results of the number of original snapshots and the number of semantic steps across all 96 test samples: Table 1 The results show that the number of semantic steps after tracer development is compressed by an average of about 17 times compared with the original snapshot. Each step has a clear algorithm operation label (swap / compare / move / call / return / fill), which effectively eliminates redundant steps in student playback scenarios and significantly improves the readability of the execution process.

[0068] 2. Evidence-based diagnostic efficacy of physical signs To verify the evidence-based function of vital signs LTo assess the improvement in diagnostic accuracy for LLM, two comparative experiments were conducted: a control group (comparative example) and an experimental group (Example 1). Both groups used the same LLM model, with manually labeled error rows used as Ground Truth for hit determination. The effectiveness of evidence-based diagnosis based on physical signs was compared. Figure 9 As shown, the experimental results are presented in Table 2: Table 2 The diagnostic prompts for the experimental group all included specific variable values ​​and abnormal context (such as " j =3, j "+1=4 exceeds array length 4"), the control group could only provide a vague general description. The results show that introducing runtime vital signs data can improve the error line location hit rate of LLM from about 54% to about 86%.

[0069] 3. Consistency of holographic reproduction To verify the holographic reproduction function Oh The consistency between the generated replay view and the actual execution behavior of the user code was verified by comparing the algorithm operation labels marked in the semantic step sequence with the actual data state changes displayed in the replay animation for each of the 96 test samples. Based on manual step-by-step verification, the consistency rate between the operation labels and the actual execution behavior was calculated. The results are shown in Table 3. Table 3 Experimental results show that the semantic consistency rate between the playback animation produced by holographic reconstruction and the actual execution behavior of user code reaches 92.5%, with all four algorithm scenarios maintaining a consistency rate of over 91%. Sorting and search algorithms, due to their relatively regular semantic operations, have a higher consistency rate than algorithms with complex nested structures such as recursion. Regarding cross-language consistency, the playback interfaces for the same algorithm problem in Python and Java maintain consistency at the semantic step level, with unified variable display formats, resulting in a consistent cross-language playback experience.

[0070] Figure 10~13 The screenshots above show steps 9-12 of the system prototype in an actual error playback scenario. These screenshots demonstrate that the system reproduces each step comprehensively. The left side features the Monaco code editor, with the currently executing line highlighted in purple and a yellow lightbulb icon next to the line number indicating an AI diagnostic prompt. The upper right is the algorithm canvas; the lower left is the variable panel, displaying arrays in a colored grid array with the currently manipulated element highlighted; the lower right is the console output area, showing the program's standard output and exception information; and the bottom features a timeline slider and playback control bar. The above interface fully presents the holographic reproduction function of this invention. OhThe resulting four-zone synchronized playback effect, as shown in the above figure, demonstrates that the method of this invention can achieve holographic reproduction of the executed animation.

[0071] In summary, the present invention proposes... P → F → L → L → Oh Multi-layer production lines achieve the following qualitative effects: 1. Tracing and Development: After semantic reconstruction, the original execution trajectory is compressed from hundreds of unlabeled snapshots into more than ten key steps with operational semantics, significantly improving the traceability of the execution process; 2. Evidence-based diagnosis: AI diagnosis uses runtime code vital sign data as factual basis, improving the localization hit rate by about 32 percentage points. The diagnostic conclusion is accompanied by specific variable value evidence, effectively reducing the risk of hallucinations. 3. Holographic Recreation: Any user code can automatically generate corresponding execution animations, with a semantic tag consistency rate of 92.5% and consistent cross-language playback experience; Simultaneously, the following quantitative effects are achieved: 1. The average compression ratio of the original snapshot is approximately 17:1, effectively eliminating playback redundancy; 2. The error line location hit rate has increased from approximately 54% to approximately 86%; 3. The consistency rate between semantic tags and animation states reached 92.5%; 4. The system fully supports consistent playback across languages ​​for both Python and Java, the two mainstream teaching languages.

[0072] Those skilled in the art should understand that variations can be implemented by combining existing technology with the above embodiments, which will not be elaborated here. Such variations do not affect the essence of the present invention, and will not be elaborated here either.

[0073] The preferred embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and the devices and structures not described in detail should be understood as being implemented in a conventional manner in the art. Any person skilled in the art can make many possible variations and modifications to the technical solutions of the present invention using the methods and techniques disclosed above, or modify them into equivalent embodiments with equivalent changes, without departing from the scope of the present invention. This does not affect the essential content of the present invention. Therefore, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the present invention's technical solutions still fall within the protection scope of the present invention.

Claims

1. A code error diagnosis method capable of holographic reproduction, characterized in that: Includes the following steps: (1) Obtain the code to be diagnosed, the problem description for error diagnosis and the expected output, perform language recognition on the code to be diagnosed and perform entry standardization encapsulation, and then run the code to be diagnosed in an isolated sandbox; (2) The execution process of the code to be diagnosed running in the isolation sandbox is collected in real time using the imaging tracer function to obtain the original snapshot sequence; (3) The original snapshot sequence is processed using the development function to obtain the semantic step sequence; (4) Use the symptom-based evidence function to extract features from the semantic step sequence to obtain the code life signs during program execution; (5) Input the program's runtime code vital signs, source code, problem description and expected output into the large language model to obtain annotation results, the annotation results including diagnostic information corresponding to each line.

2. The code error diagnosis method capable of holographic reproduction according to claim 1, characterized in that, Also includes: (6) Using the semantic step sequence and annotation results as input, the holographic reconstruction function is used to achieve visual reconstruction.

3. The code error diagnosis method for holographic reproduction according to claim 1, characterized in that, The language recognition refers to identifying the programming language to which the diagnostic code belongs; The standardized encapsulation of the execution entry point specifically refers to standardizing the input-output interaction logic of the code to be diagnosed using a dedicated adapter corresponding to the programming language to which the code to be diagnosed belongs.

4. The code error diagnosis method for holographic reproduction according to claim 2, characterized in that, Step (2) specifically involves: Through the imaging tracer function Ψ Inject tracing probes into the code execution flow to collect runtime signals line by line and form a complete execution trajectory; The contrast tracer function Ψ Specifically: in, C For user-submitted source code, I The code to be diagnosed. For steps t A finite sequence with an index. t From 0 to N , N Total number of execution steps s t It is the first t Runtime snapshot of the step; The s t The complete sequence of snapshots is: in, t The current line number being executed. ε t For the execution event type, ν t A snapshot of runtime variables. ω t To accumulate standard output for the program, ξ t This is an optional storage field used to record runtime exception information.

5. A code error diagnosis method capable of holographic reproduction according to claim 4, characterized in that, Step (3) specifically involves: Through the development function Φ Transform the original snapshot sequence into a semantic step sequence with explicit operation labels; The development function Φ Specifically: in, This is the original snapshot sequence. This is the semantic step sequence generated after compression, differencing, and annotation. j For step indexing, K The total number of semantic steps; The σ j The semantic step sequence is as follows: in, Inherited from the imaging tracer function Ψ Output s t Keyframe snapshots retained after compression These correspond to the result components after the completion of the three sub-steps: step compression, state difference, and semantic annotation.

6. A code error diagnosis method capable of holographic reproduction according to claim 5, characterized in that, Step (4) specifically involves: From semantic steps σ j Extract the runtime code life signs of the program, namely the variable values, branch paths, and exception signal triples at each step: in V j For variable snapshots, B j For branching directions, E j This is an abnormal signal.

7. A code error diagnosis method capable of holographic reproduction according to claim 6, characterized in that, Step (5) is as follows: The runtime code lifecycle data of the program, along with the source code, problem description, and expected output, are packaged and submitted to the large language model to generate annotation results. λ j ; λ j Specifically: in line j For line numbers, hint j For diagnostic information, suggestion j Recommendations for repair; The above process is as follows: in, For symptom-based evidence functions from semantic step series The program runtime code vital signs extracted from it. C For user-submitted source code, P For the title description, E For the desired output, This is the output annotation result.

8. A code error diagnosis method capable of holographic reproduction according to claim 7, characterized in that, The specific steps (6) are as follows: Semantic step sequence and annotation results As input, using the holographic reconstruction function Ω Achieve visualized reconstruction; The holographic reproduction function Ω Specifically: in, It is a sequence of semantic steps. For the annotation results, This is the output sequence of holographic playback views; The R j Specifically: in, H j The code line highlighting and diagnostic information are displayed in conjunction, with line numbers derived from... j Diagnostic information comes from λ j of hint j ; G j Representing the algorithm's canvas rendering state, the array data and semantic event labels originate from... ν j and τ j ; M j Represents an array of variable panel cards; variable snapshots are derived from... ν j ; C j This represents the console output text display module, where the accumulated output text originates from... ω j ; E j This represents the error display panel, showing the error type, error message, and suggested repair methods. The error information originates from... ξ j The repair suggestion originated from suggestion j .