Large model assistant dynamic output rectification method and system in network target range

By adding custom tags to the output content of the big model and using the cache module, tag search module and rendering module, it solves the problem that the big model is difficult to give targeted answers and streaming output in specific fields and cannot render in real time, and efficient content rectification and rendering is achieved, improving user experience.

CN119557526AActive Publication Date: 2025-03-04SAINING WANGAN

Patent Information

Application Number
CN202510081390.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-03-04
Estimated Expiration
2045-01-20

AI Technical Summary

Technical Problem

It is difficult for big models to give targeted answers to special issues in specific professional fields such as network shooting ranges, and the streaming output process cannot dynamically distinguish and render specific content in real time, resulting in poor user experience.

Method used

By adding custom tags to the original content, the output content of the large model is rectified in real time, using cache modules, tag search modules and rendering modules, dynamically searching and updating tags, and optimizing browser rendering status.

Benefits of technology

Real-time rectification and rendering of large-scale output content is realized, reducing browser hardware resources, and improving traversal performance and user experience of specific content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557526A_ABST
    Figure CN119557526A_ABST
Patent Text Reader

Abstract

The invention discloses a large model assistant dynamic output rectification method and system in a network target range. The method comprises the following steps: receiving a character string output by a large model, and adding the character string into a cache list; when the length of the character string in the cache list reaches a preset threshold value, searching a user-defined tag in the current cache list, when the state of the hit starting tag is true, searching an ending tag, and otherwise, searching the starting tag; according to a tag hit result, generating a value returned by tag searching, and updating the cache list; setting a rendering state of the browser according to the current hit start label state; if the tag hit result is true, turning over a hit start tag state; finally returning a tuple containing a value to be displayed and a corresponding rendering state aiming at each time of inputting a character string; and continuously receiving the output content of the large model and dynamically displaying the output content. The output content of the large model can be rectified in real time, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a large model assistant dynamic output rectification method and system in a network target range, belonging to the technical field of information processing and network security. Background Art

[0002] Large models have significant advantages in natural language understanding and text generation, and can serve as efficient human-computer interaction intelligent assistants. However, the model's knowledge source is limited to training data, which means that its ability to answer questions is limited to the content of the training period, and these data usually cover domain knowledge of specific industries (such as programming, mathematics, etc.). Therefore, when faced with special questions in some specific professional fields (such as cyber ranges, etc.), large models often find it difficult to give targeted answers.

[0003] To solve this problem, an external knowledge base is usually combined with the Retrieval-Augmented Generation (RAG) method to inject additional professional domain knowledge into the large model. When a user asks a question, the large model first matches the relevant information through the external knowledge base, and then uses its own text generation capabilities to process and output this information. This process generates text in a streaming manner, in which the model predicts the most likely next output based on the current context and the previous and next content. When the model outputs, it outputs one or several characters at a time.

[0004] The streaming output process allows users to dynamically perceive the model generation process, but it also brings the following problems: 1. It is impossible to dynamically identify and render specific content (such as HTML links) in real time, resulting in the inability to effectively display specific content such as network link addresses. Figure 1 As shown, the large model outputs a string list, and the client cannot determine the beginning and end of the link address based on the dynamic string list, resulting in an unfriendly display style; 2. Use a global cache large model to output content, and traverse the output content to find specific tags. In the case of large amounts of data, this will cause the browser cache to be too high and the traversal speed to be very slow. In addition, this method will cause the page to refresh when traversing to specific content, affecting the user experience. Summary of the invention

[0005] Purpose of the invention: In view of the problems existing in the above-mentioned prior art, the purpose of the present invention is to provide a method and system for dynamic output rectification of a large model assistant in a network target range. By adding custom tags to the original content, the output content of the large model is rectified in real time to improve the user experience.

[0006] Technical solution: To achieve the above-mentioned invention object, the present invention adopts the following technical solution: In a first aspect, the present invention provides a large model assistant dynamic output rectification method in a network range, comprising the following steps: Set the hit start tag state to the initial value false; Receive the character string output by the large model, and add the character string to the cache list; Determine whether the length of the string in the current cache list reaches a preset threshold. If not, continue to receive and cache new strings; otherwise, proceed to the next step; Searching for a custom tag in the current cache list according to the hit start tag status, and searching for an end tag when the hit start tag status is true; and searching for a start tag when the hit start tag status is false; According to the tag hit result, generate the tag search return value and update the cache list at the same time; Set the browser's rendering state according to the current hit start tag state; if the tag hit result is true, flip the hit start tag state; For each input string, a tuple containing the value to be displayed and the corresponding rendering status is finally returned; the output content of the large model is continuously received and displayed dynamically.

[0007] Preferably, the step of finding a start tag or an end tag includes: Concatenate all the strings in the cache list into a complete string and split them by the tag to be found; Determine whether the segmented string set is equal to the original string after concatenation. If they are equal, it means that the tag is not found, and the tag hit result is set to false; otherwise, the tag hit result is set to true.

[0008] Preferably, the steps of generating a tag, finding a returned value, and updating a cache list include: If the tag hit result is false, the returned value is the first value popped out of the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values ​​in the segmented string set are added to the cache list in sequence.

[0009] In a second aspect, the present invention provides a large model assistant dynamic output rectification system in a network range, comprising a cache module, a label search module, and a rendering module; The cache module is used to receive the string output by the large model and add the string to the cache list; and determine whether the length of the string in the current cache list reaches a preset threshold. If not, continue to receive and cache new strings; otherwise, call the tag search module; The tag search module is used to set the hit start tag state to an initial value of false. When the length of the string cached in the cache module reaches a preset threshold, the custom tag is searched in the current cache list according to the hit start tag state. When the hit start tag state is true, the end tag is searched; when the state is false, the start tag is searched; and, according to the tag hit result, the value returned by the tag search is generated, and the cache list is updated at the same time; the rendering state of the browser is set according to the current hit start tag state; if the tag hit result is true, the hit start tag state is flipped; for each input string, a tuple containing the value to be displayed and the corresponding rendering state is finally returned; The rendering module is used to dynamically display the value to be displayed according to the rendering state in the tuple.

[0010] In a third aspect, the present invention provides a computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein the computer program / instruction, when executed by the processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.

[0011] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of dynamic output rectification of a large model assistant in a network target range are implemented.

[0012] In a fifth aspect, the present invention provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.

[0013] Beneficial effects: Compared with the prior art, the present invention has the following advantages: the present invention adds custom tags to the original content, rectifies the output content of the large model in real time, searches for the user's custom tags, and outputs the rectified content and rendering rules in real time according to the search results; the browser only needs to cache a small amount of output content of the large model, and does not need to cache the output of the model globally, thereby reducing the hardware resource usage of the browser and speeding up the traversal performance of specific content; by adopting the dynamic rectification method, the page can output specific style content in real time without refreshing the page after hitting a specific tag, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 Example graph of address linking issues output for a large model.

[0015] Figure 2 The figure is a dynamic rectification flow chart of an embodiment of the present invention.

[0016] Figure 3 This is an example diagram of labeling of the original document of the knowledge base illustrated in the embodiment of the present invention. DETAILED DESCRIPTION

[0017] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.

[0018] like Figure 2 As shown, a large model assistant dynamic output rectification method in a network target range disclosed in an embodiment of the present invention mainly includes the following steps: Step S101, setting the hit start tag state to an initial value of false.

[0019] Step S102: Receive the character string output by the large model and add the character string to the cache list.

[0020] Step S103, determining whether the length of the character string in the current cache list reaches a preset threshold, if not, continuing to receive and cache new character strings; otherwise, executing the next step; Step S104, searching for a custom tag in the current cache list according to the hit start tag status, and when the hit start tag status is true, searching for an end tag; when the status is false, searching for a start tag; Step S105: Generate a tag search return value based on the tag hit result, and update the cache list at the same time; Step S106, setting the rendering state of the browser according to the current hit start tag state; if the tag hit result is true, flipping the hit start tag state; Step S107: For each input string, a tuple including the value to be displayed and the corresponding rendering status is finally returned; the output content of the large model is continuously received and dynamically displayed.

[0021] In some embodiments, the step of searching for a start tag or an end tag in step S104 may be: Step S1041, concatenate all the character strings in the cache list into a complete character string, and segment them using the tag to be found; Step S1042, determine whether the segmented string set is equal to the original string after concatenation. If they are equal, it means that the tag is not found, and the tag hit result is set to false; otherwise, the tag hit result is set to true.

[0022] In step S105, the steps of generating a tag to find the returned value and updating the cache list can be: if the tag hit result is false, the returned value is the first value popped up in the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values ​​in the segmented string set are added to the cache list in sequence.

[0023] The following is an illustrative explanation using the dynamic identification and rendering of HTML links as an example.

[0024] Before the method of the embodiment of the present invention is implemented, custom tags are added to the places where special rendering is required in the original document corresponding to the knowledge base, and the custom tags are divided into a start tag and a corresponding end tag. Figure 3 It is a new tag added to the HTML link, where the start tag is [[snlink]] and the end tag is [[ / snlink]].

[0025] Specifically, the detailed execution steps of the large model assistant dynamic output rectification method in the network range include: Step S201, setting the hit start tag status hitStartStatus to false, indicating that no custom tag is currently found.

[0026] Step S202: Receive the character string X output by the large model, and add the received character string X to the cache list C.

[0027] Step S203, determine whether the length of the string currently cached in C has reached a threshold (for example, 15, as long as the length is sufficient to cover the label. For the [[snlink]] label, assuming that the model outputs one character each time, the complete label can be output 10 times). If the threshold is not reached, this rectification does not output anything and jumps to step S202; otherwise, jumps to step S204.

[0028] Step S204: Search for a custom tag in the current cache list C according to the hitStartStatus. If hitStartStatus is true, search for the end tag; otherwise, search for the start tag. The tag to be searched is recorded as T. See steps S205 to S208 for searching for tag T.

[0029] Step S205: concatenate all the strings in the cache list to form a complete string. Assume that the value in the cache list C is {"hello ","a ","c "," [[","sn","link","]", "]http", ": / / ", "www"}, and the concatenated string S = "hello ac [[snlink]]http: / / www".

[0030] Step S206: Segment the string S with T, and record the segmented string set as S1. For the example of step S205, S1={"hello ac", "http: / / www"}.

[0031] Step S207, determine whether the concatenated string of set S1 is equal to S. If they are equal, it means that tag T is not found, and the tag hit result hitTag is false; otherwise, hitTag is true.

[0032] Step S208, generate the tag to find the value V to be returned. If hitTag is false, V is the first value popped up in cache list C; otherwise, the popped value V is the first value in S1, and the current cache list C is cleared, and the remaining values ​​in S1 are added to C in sequence. For the example shown in step S206, V="hello ac", the value in cache list C is {"http: / / www"}.

[0033] Step S209: Determine the browser's rendering status renderStatus in combination with the current hitStartStatus. If hitStartStatus is true, set the renderStatus of this rectification to true; otherwise, set renderStatus to false.

[0034] Step S210: If hitTag is true, flip the state of hitStartStatus, that is, if the current value of hitStartStatus is true, it becomes false, and if it is false, it becomes true.

[0035] Step S211: The final return value of the rectification of the input string X is (V, renderStatus). When renderStatus is true, the browser needs to perform special rendering (such as displaying it as an HTML link) on the V value returned this time, otherwise the V value is output normally.

[0036] Step S212: Repeat steps S202 to S211 to continuously receive the output content of the large model and display it dynamically.

[0037] The embodiment of the present invention also discloses a large model assistant dynamic output rectification system in a network target range, which mainly includes a cache module, a label search module, and a rendering module; the cache module is used to receive the string output by the large model and add the string to the cache list; and determine whether the length of the string in the current cache list reaches a preset threshold. If not, continue to receive and cache new strings; otherwise, call the label search module; the label search module is used to set the hit start label state to the initial value false. When the length of the string cached in the cache module reaches the preset threshold, search for a custom label in the current cache list according to the hit start label state, and when the hit start label state is true, search for the end label; when the state is false, search for the start label; and, according to the label hit result, generate the value returned by the label search and update the cache list at the same time; determine the rendering state of the browser according to the current hit start label state; if the label hit result is true, flip the hit start label state; for each input string, finally return a tuple containing the value to be displayed and the corresponding rendering state; the rendering module is used to dynamically display the value to be displayed according to the rendering state in the tuple.

[0038] An embodiment of the present invention also discloses a computer system, including a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein the computer program / instruction, when executed by the processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.

[0039] An embodiment of the present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of dynamic output rectification of a large model assistant in a network target range are implemented.

[0040] An embodiment of the present invention also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.

Claims

1. A large model assistant dynamic output rectification method in a network range, characterized in that: The following steps are involved: Set the hit start tag state to the initial value false; Receive the character string output by the large model, and add the character string to the cache list; Determine whether the length of the string in the current cache list reaches a preset threshold. If not, continue to receive and cache new strings; otherwise, proceed to the next step; Searching for a custom tag in the current cache list according to the hit start tag status, and searching for an end tag when the hit start tag status is true; When the state is false, look for the start tag; According to the tag hit result, generate the tag search return value and update the cache list at the same time; Set the browser's rendering state according to the current hit start tag state; If the tag hit result is true, flip the hit start tag state; For each input string, a tuple containing the value to be displayed and the corresponding rendering status is finally returned; Continuously receive the output content of large models and display it dynamically.

2. According to claim 1, a large model assistant dynamic output rectification method in a network range is characterized in that: The steps to find a start or end tag are: Concatenate all the strings in the cache list into a complete string and split them by the tag to be found; Determine whether the segmented string set is equal to the original string after concatenation. If they are equal, it means that the tag is not found, and the tag hit result is set to false; otherwise, the tag hit result is set to true.

3. The method for dynamic output rectification of a large model assistant in a network range according to claim 2, characterized in that: The steps to generate the tag, find the returned value, and update the cache list include: If the tag hit result is false, the returned value is the first value popped out of the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values ​​in the segmented string set are added to the cache list in sequence.

4. The method for dynamic output rectification of a large model assistant in a network range according to claim 1, characterized in that: The preset threshold is set to a minimum length sufficient to cover the custom label.

5. The method for dynamic output rectification of a large model assistant in a network range according to claim 1, characterized in that: When the rendering state is true, the browser renders the returned value according to preset rules.

6. The method for dynamic output rectification of a large model assistant in a network range according to claim 1, characterized in that: The custom tag is used to mark an HTML link. When the rendering state is true, the returned value is displayed as an HTML link.

7. A large model assistant dynamic output rectification system in a network range, characterized in that: Includes cache module, tag search module, and rendering module; The cache module is used to receive the character string output by the large model and add the character string to the cache list; And determine whether the length of the string in the current cache list reaches the preset threshold. If not, continue to receive and cache new strings; otherwise, call the tag search module; The tag search module is used to set the hit start tag state to an initial value of false. When the length of the character string cached in the cache module reaches a preset threshold, the custom tag is searched in the current cache list according to the hit start tag state. When the hit start tag state is true, the end tag is searched; when the state is false, the start tag is searched; And, based on the tag hit result, generate the tag to find the returned value and update the cache list at the same time; Set the browser's rendering state according to the current hit start tag state; If the tag hit result is true, flip the hit start tag state; For each input string, a tuple containing the value to be displayed and the corresponding rendering status is finally returned; The rendering module is used to dynamically display the value to be displayed according to the rendering state in the tuple.

8. A computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, characterized in that: When the computer program / instructions are executed by the processor, the steps of dynamic output rectification of a large model assistant in a network range according to any one of claims 1-6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of dynamic output rectification of a large model assistant in a network range according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by the processor, the steps of dynamic output rectification of a large model assistant in a network range according to any one of claims 1-6 are implemented.

Citation Information

Patent Citations

  • Front-end rendering optimization method based on streaming output

    CN118869803A

  • Method for stream output of semi-structured response by intelligent agent

    CN118939837A

  • Semantic-based large model assistant optimization method and system in target range

    CN119025666A

Cited By

  • Rendering method and system based on streaming transmission

    CN120881361A

  • A streaming-based rendering method and system

    CN120881361B